Explorar el Código

[fix] 修正年检第三阶段-整改,设置默认年检计划时间LocalDate.min->1970.01.01

wcz hace 5 años
padre
commit
e64bf87931

+ 8 - 8
lift-business-service/src/main/java/cn/com/ty/lift/business/annualinspection/controller/AnnualInspectionController.java

@@ -157,7 +157,7 @@ public class AnnualInspectionController {
         AnnualInspection previousConfirm = annualInspectionService.findPreviousConfirm(entity.getLiftId(), entity.getMtCompanyId());
         if(Objects.nonNull(previousConfirm) && Objects.nonNull(previousConfirm.getPlanDate())){
             LocalDate deadline = previousConfirm.getPlanDate().plusDays(DateUtils.daysOfYear());
-            Validate.notTrue(deadline.isBefore(entity.getPlanDate()), ValuePool.inspectionLastPlanDate(previousConfirm.getPlanDate(), deadline));
+            Validate.notTrue(deadline.isBefore(entity.getPlanDate()), ValuePool.inspectionSetPlanDateIllegal(previousConfirm.getPlanDate(), deadline));
         }
 
         entity.setStatus(ValuePool.INSPECTION_STATUS_TO_DO);
@@ -202,7 +202,7 @@ public class AnnualInspectionController {
         AnnualInspection old = annualInspectionService.findByMtCompanyId(entity.getId(), entity.getMtCompanyId());
         Validate.notNull(old, ValuePool.INSPECTION_NOT_EXIST);
         Integer oldStepName = ValuePool.nullable(old.getStepName(), 1);
-        Validate.equals(oldStepName, ValuePool.INSPECTION_STEP_ONE, ValuePool.inspectionMustOnStage("第一阶段"));
+        Validate.equals(oldStepName, ValuePool.INSPECTION_STEP_ONE, ValuePool.inspectionOptionOnStageIllegal("第一阶段"));
         old.setIsCheckGoverner(entity.getIsCheckGoverner());
         old.setLoadInspectionSetting(entity.getLoadInspectionSetting());
 
@@ -224,7 +224,7 @@ public class AnnualInspectionController {
         Integer oldStepName = ValuePool.nullable(old.getStepName(), 1);
         Integer oldStepStatus = ValuePool.nullable(old.getStepStatus(), 2);
         Integer stepStatus = entity.getStepStatus();
-        Validate.equals(oldStepName, ValuePool.INSPECTION_STEP_ONE, ValuePool.inspectionStepToNext("确认操作", "第一阶段"));
+        Validate.equals(oldStepName, ValuePool.INSPECTION_STEP_ONE, ValuePool.inspectionStepToNextIllegal("确认操作", "第一阶段"));
         Validate.between(oldStepStatus, ValuePool.INSPECTION_STAGE_CONFIRM, ValuePool.INSPECTION_STAGE_SELFCHECK, ValuePool.inspectionCurrentStepStatusIllegal( oldStepStatus, "第一阶段"));
         Validate.equals(stepStatus, ValuePool.INSPECTION_STAGE_SELFCHECK, ValuePool.inspectionNewStepStatusIllegal(stepStatus, "第一阶段"));
 
@@ -249,7 +249,7 @@ public class AnnualInspectionController {
         Validate.notNull(old, ValuePool.INSPECTION_NOT_EXIST);
         Integer oldStepName = ValuePool.nullable(old.getStepName(), 2);
         Integer oldStepStatus = ValuePool.nullable(old.getStepStatus(), 2);
-        Validate.between(oldStepName, ValuePool.INSPECTION_STEP_ONE,ValuePool.INSPECTION_STEP_TWO, ValuePool.inspectionStepToNext("第一阶段", "第二阶段"));
+        Validate.between(oldStepName, ValuePool.INSPECTION_STEP_ONE,ValuePool.INSPECTION_STEP_TWO, ValuePool.inspectionStepToNextIllegal("第一阶段", "第二阶段"));
         Validate.between(oldStepStatus, ValuePool.INSPECTION_STAGE_SELFCHECK, ValuePool.INSPECTION_STAGE_CONFIRM_CHECK, ValuePool.inspectionCurrentStepStatusIllegal(oldStepStatus, "第二阶段"));
 
         old.setCheckDate(entity.getCheckDate());
@@ -298,13 +298,13 @@ public class AnnualInspectionController {
         Integer oldStepName = ValuePool.nullable(old.getStepName(), 2);
         Integer oldStepStatus = ValuePool.nullable(old.getStepStatus(), 3);
         Integer stepStatus = entity.getStepStatus();
-        Validate.between(oldStepName,ValuePool.INSPECTION_STEP_TWO, ValuePool.INSPECTION_STEP_THREE, ValuePool.inspectionStepToNext("第二阶段", "第三阶段"));
+        Validate.between(oldStepName,ValuePool.INSPECTION_STEP_TWO, ValuePool.INSPECTION_STEP_THREE, ValuePool.inspectionStepToNextIllegal("第二阶段", "第三阶段"));
         Validate.between(oldStepStatus, ValuePool.INSPECTION_STAGE_CONFIRM_CHECK, ValuePool.INSPECTION_STAGE_CHECK_UNQUALIFIED, ValuePool.inspectionCurrentStepStatusIllegal(oldStepStatus, "第三阶段"));
         Validate.between(stepStatus, ValuePool.INSPECTION_STAGE_UPLOAD_CHECK, ValuePool.INSPECTION_STAGE_CHECK_UNQUALIFIED, ValuePool.inspectionNewStepStatusIllegal(stepStatus, "第三阶段"));
         LocalDate oldPlanDate = old.getPlanDate();
         if(Objects.nonNull(oldPlanDate)){
             LocalDate deadline = oldPlanDate.plusDays(DateUtils.daysOfYear());
-            Validate.notTrue(deadline.isBefore(entity.getNextInspectionTime()), ValuePool.inspectionLastPlanDate(oldPlanDate, deadline));
+            Validate.notTrue(deadline.isBefore(entity.getNextInspectionTime()), ValuePool.inspectionSetPlanDateIllegal(oldPlanDate, deadline));
         }
 
         old.setStepStatus(entity.getStepStatus());
@@ -318,7 +318,7 @@ public class AnnualInspectionController {
             old.setStepStatus(ValuePool.INSPECTION_STAGE_CONFIRM_CHECK);
             old.setStepName(ValuePool.INSPECTION_STEP_TWO);//转回阶段2
             old.setCheckResultImg("");
-            old.setNextInspectionTime(LocalDate.MIN);
+            old.setNextInspectionTime(ValuePool.INSPECTION_MIN_PLAN_DATE);
         }
         return annualInspectionService.stepThree(old, entity.getProjectId(), entity.getIsCheckGoverner(), entity.getLoadInspectionSetting());
     }
@@ -336,7 +336,7 @@ public class AnnualInspectionController {
         Integer oldStepName = ValuePool.nullable(old.getStepName(), 3);
         Integer oldStepStatus = ValuePool.nullable(old.getStepStatus(), 5);
         Integer stepStatus = entity.getStepStatus();
-        Validate.between(oldStepName, ValuePool.INSPECTION_STEP_THREE, ValuePool.INSPECTION_STEP_FOUR, ValuePool.inspectionStepToNext("第三阶段", "第四阶段"));
+        Validate.between(oldStepName, ValuePool.INSPECTION_STEP_THREE, ValuePool.INSPECTION_STEP_FOUR, ValuePool.inspectionStepToNextIllegal("第三阶段", "第四阶段"));
         Validate.between(oldStepStatus, ValuePool.INSPECTION_STAGE_CHECK_QUALIFIED, ValuePool.INSPECTION_STAGE_CERT_REPORT_UNQUALIFIED, ValuePool.inspectionCurrentStepStatusIllegal(oldStepStatus, "第四阶段"));
         Validate.between(stepStatus, ValuePool.INSPECTION_STAGE_UPLOAD_CERT_REPORT, ValuePool.INSPECTION_STAGE_CERT_REPORT_UNQUALIFIED, ValuePool.inspectionNewStepStatusIllegal(stepStatus, "第四阶段"));
 

+ 1 - 1
lift-business-service/src/main/java/cn/com/ty/lift/business/emergency/controller/EmergencyRepairController.java

@@ -238,7 +238,7 @@ public class EmergencyRepairController {
         LocalDate repairBegin = request.getRepairBegin();
         LocalDate repairEnd = request.getRepairEnd();
         if(Objects.nonNull(repairBegin) && Objects.nonNull(repairEnd)){
-            Validate.isTrue(repairBegin.isBefore(repairEnd), ValuePool.beginTimeIllegalToEndTime(repairBegin, repairEnd));
+            Validate.isTrue(repairBegin.isBefore(repairEnd), ValuePool.beginTimeToEndTimeIllegal(repairBegin, repairEnd));
         }
         IPage<RepairResponse> pages = emergencyRepairService.pageByCondition(request);
         long count = emergencyRepairService.countByCondition(request);

+ 2 - 2
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/controller/MaintenanceRecordController.java

@@ -70,7 +70,7 @@ public class MaintenanceRecordController {
         LocalDate planBegin = request.getPlanBegin();
         LocalDate planEnd = request.getPlanEnd();
         if(Objects.nonNull(planBegin) && Objects.nonNull(planEnd)){
-            Validate.isTrue(planBegin.isBefore(planEnd), ValuePool.beginTimeIllegalToEndTime(planBegin, planEnd));
+            Validate.isTrue(planBegin.isBefore(planEnd), ValuePool.beginTimeToEndTimeIllegal(planBegin, planEnd));
         }
         request.addDesc("work_date");
         IPage<MtRecordResponse> pages = maintenanceRecordService.pageRecordByCondition(request);
@@ -91,7 +91,7 @@ public class MaintenanceRecordController {
         LocalDate planBegin = request.getPlanBegin();
         LocalDate planEnd = request.getPlanEnd();
         if(Objects.nonNull(planBegin) && Objects.nonNull(planEnd)){
-            Validate.isTrue(planBegin.isBefore(planEnd), ValuePool.beginTimeIllegalToEndTime(planBegin, planEnd));
+            Validate.isTrue(planBegin.isBefore(planEnd), ValuePool.beginTimeToEndTimeIllegal(planBegin, planEnd));
         }
         request.addDesc("plan_date");
         IPage<MtPlanResponse> pages = maintenancePlanService.pagePlanByCondition(request);

+ 9 - 19
lift-common/src/main/java/cn.com.ty.lift.common/utils/ValuePool.java

@@ -6,22 +6,11 @@ import java.time.LocalTime;
 import java.util.Objects;
 
 /**
+ * 系统常量池
  * Copy to jodd.util
- * <p>
- * Pool of <code>String</code> constants to prevent repeating of
- * hard-coded <code>String</code> literals in the code.
- * Due to fact that these are <code>public static final</code>
- * they will be inlined by java compiler and
- * reference to this class will be dropped.
- * There is <b>no</b> performance gain of using this pool.
- * Read: https://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.5
- * <ul>
- * <li>Literal strings within the same class in the same package represent references to the same <code>String</code> object.</li>
- * <li>Literal strings within different classes in the same package represent references to the same <code>String</code> object.</li>
- * <li>Literal strings within different classes in different packages likewise represent references to the same <code>String</code> object.</li>
- * <li>Strings computed by constant expressions are computed at compile time and then treated as if they were literals.</li>
- * <li>Strings computed by concatenation at run time are newly created and therefore distinct.</li>
- * </ul>
+ *
+ * @author wcz
+ * @since 2020/5/8
  */
 public interface ValuePool {
 
@@ -126,7 +115,7 @@ public interface ValuePool {
     String   PATTERN_NAME              = "^[\u4e00-\u9fa5a-zA-Z0-9·.。;&\\s]{1,20}$";
     String   PATTERN_TELEPHONE         = "^1[345789]\\d{9}|0[1-9](\\d{1,2}\\-?)[1-9]\\d{6,7}$";
 
-    static String beginTimeIllegalToEndTime(LocalDate begin, LocalDate end) {
+    static String beginTimeToEndTimeIllegal(LocalDate begin, LocalDate end) {
         return String.format("开始时间(%tF)不能晚于结束时间(%tF)", begin, end);
     }
     //======================年检相关状态值和判断方法======================================
@@ -196,8 +185,9 @@ public interface ValuePool {
     int    INSPECTION_STAGE_CERT_REPORT_UNQUALIFIED = 10;
     String INSPECTION_NOT_EXIST                     = "年检不存在,请确认年检计划";
     String INSPECTION_EXIST_SAME                    = "年检计划已存在。";
+    LocalDate INSPECTION_MIN_PLAN_DATE = LocalDate.of(1970,1,1);
 
-    static String inspectionStepToNext(String previous, String current) {
+    static String inspectionStepToNextIllegal(String previous, String current) {
         return String.format("请先完成%s再进行%s操作", previous, current);
     }
 
@@ -209,11 +199,11 @@ public interface ValuePool {
         return String.format("年检新状态(%s),不能进行%s操作", newStepStatus, step);
     }
 
-    static String inspectionLastPlanDate(LocalDate previous, LocalDate deadline) {
+    static String inspectionSetPlanDateIllegal(LocalDate previous, LocalDate deadline) {
         return String.format("上次年检时间%tF,下次年检设置%tF之前有效", previous, deadline);
     }
 
-    static String inspectionMustOnStage(String stage) {
+    static String inspectionOptionOnStageIllegal(String stage) {
         return String.format("年检必须在%s才能操作", stage);
     }
 

+ 1 - 1
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/oa/controller/AttendanceController.java

@@ -97,7 +97,7 @@ public class AttendanceController {
         LocalDate begin = request.getBegin();
         LocalDate end = request.getEnd();
         if(Objects.nonNull(begin) && Objects.nonNull(end)){
-            Validate.isTrue(begin.isBefore(end), ValuePool.beginTimeIllegalToEndTime(begin, end));
+            Validate.isTrue(begin.isBefore(end), ValuePool.beginTimeToEndTimeIllegal(begin, end));
         }
         request.addDesc("create_date");
 //        if (Objects.isNull(request.getClockTime())) {