Ver código fonte

[chg] app急修列表排序,年检自检报告限制三张,分解导出自检报告图片

wcz 5 anos atrás
pai
commit
66e6ed9434

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

@@ -238,7 +238,13 @@ public class AnnualInspectionController {
         Validate.between(oldStepStatus, ValuePool.INSPECTION_STAGE_CONFIRM, ValuePool.INSPECTION_STAGE_SELFCHECK, ValuePool.inspectionCurrentStepStatusIllegal( oldStepStatus, ValuePool.INSPECTION_STEP_ONE_DESC));
         Validate.equals(stepStatus, ValuePool.INSPECTION_STAGE_SELFCHECK, ValuePool.inspectionNewStepStatusIllegal(stepStatus, ValuePool.INSPECTION_STEP_ONE_DESC));
 
-        old.setSelfcheckReportImg(entity.getSelfcheckReportImg());
+        String selfcheckReportImg = entity.getSelfcheckReportImg();
+        if (selfcheckReportImg.contains(",")) {
+            int count = selfcheckReportImg.length() - selfcheckReportImg.replace(",", "").length();
+            Validate.notTrue(count > 3, ValuePool.INSPECTION_SELF_CHECK_IMAGE_COUNT);
+        }
+
+        old.setSelfcheckReportImg(selfcheckReportImg);
         old.setSelfcheckDate(entity.getSelfcheckDate());
         old.setStepStatus(entity.getStepStatus());
 
@@ -402,8 +408,14 @@ public class AnnualInspectionController {
         Integer stepName = ValuePool.nullable(entity.getStepName(), 1);
         Validate.equals(stepName, ValuePool.INSPECTION_STEP_ONE, ValuePool.inspectionCurrentStepStatusIllegal(stepName, ValuePool.INSPECTION_STEP_ONE_DESC));
 
+        String selfcheckReportImg = request.getSelfcheckReportImg();
+        if (selfcheckReportImg.contains(",")) {
+            int count = selfcheckReportImg.length() - selfcheckReportImg.replace(",", "").length();
+            Validate.notTrue(count > 3, ValuePool.INSPECTION_SELF_CHECK_IMAGE_COUNT);
+        }
+
         entity.setSelfcheckDate(request.getSelfcheckDate());
-        entity.setSelfcheckReportImg(request.getSelfcheckReportImg());
+        entity.setSelfcheckReportImg(selfcheckReportImg);
         entity.setStepStatus(ValuePool.INSPECTION_STAGE_SELFCHECK);
         entity.setStepName(ValuePool.INSPECTION_STEP_ONE);
 
@@ -514,7 +526,17 @@ public class AnnualInspectionController {
                 registrationCode = StrUtil.isNotEmpty(registrationCode) ? registrationCode.replace(illegalChars,"-") : "[电梯注册代码]";
                 //图片文件夹 dir/i.AreaName-ProjectName-RegistrationCode/
                 String imgDir = StrUtil.format("{}{}{}.{}-{}-{}{}", dir, File.separator, (i + 1), areaName, projectName, registrationCode, File.separator);
-                downloadImage(ins.getSelfcheckReportImg(), imgDir, "1.自检报告.jpg");
+                String selfcheckReportImg = ins.getSelfcheckReportImg();
+                if (Objects.nonNull(selfcheckReportImg)) {
+                    if (selfcheckReportImg.contains(",")) {
+                        String[] imgs = selfcheckReportImg.split(",");
+                        for (int num = 0; num < imgs.length; num++) {
+                            downloadImage(imgs[num], imgDir, "1.自检报告 "+ (num + 1) +".jpg");
+                        }
+                    } else {
+                        downloadImage(selfcheckReportImg, imgDir, "1.自检报告.jpg");
+                    }
+                }
                 downloadImage(ins.getCheckResultImg(), imgDir, "2.检验结果.jpg");
                 downloadImage(ins.getCertificateImgUrl(), imgDir, "3.合格证.jpg");
                 downloadImage(ins.getAnnualInspectionImg(), imgDir, "4.年检报告.jpg");

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

@@ -300,6 +300,11 @@ public class EmergencyRepairController {
     @PostMapping("pageWorker")
     @Validation(fields = {"mtCompanyId", "workerId"})
     public RestResponse pageWorker(@Val @RequestBody RepairRequest request) {
+        if (Objects.equals(ValuePool.EMERGENCY_STATE_COMPLETE, request.getStatus())) {
+            request.addDesc("recovery_date");
+        }else{
+            request.addDesc("assign_time");
+        }
         IPage<RepairResponse> pages = emergencyRepairService.pageByCondition(request);
         return RestResponse.success(pages);
     }
@@ -380,6 +385,11 @@ public class EmergencyRepairController {
     @PostMapping("pageByUser")
     @Validation(fields = {"userId"})
     public RestResponse pageByUser(@Val @RequestBody RepairRequest request) {
+        if (Objects.equals(ValuePool.EMERGENCY_STATE_COMPLETE, request.getStatus())) {
+            request.addDesc("recovery_date");
+        }else{
+            request.addDesc("assign_time");
+        }
         IPage<RepairResponse> pages = emergencyRepairService.pageByUser(request);
         return RestResponse.success(pages);
     }

+ 1 - 0
lift-common/src/main/java/cn.com.ty.lift.common/utils/ValuePool.java

@@ -190,6 +190,7 @@ public interface ValuePool {
     int    INSPECTION_STAGE_CERT_REPORT_UNQUALIFIED = 10;
     String INSPECTION_NOT_EXIST                     = "年检不存在,请确认年检计划";
     String INSPECTION_EXIST_SAME                    = "年检计划已存在。";
+    String INSPECTION_SELF_CHECK_IMAGE_COUNT        = "自检图片不得超过三张。";
     LocalDate INSPECTION_MIN_PLAN_DATE = LocalDate.of(1970,1,1);
 
     static String inspectionStepToNextIllegal(String previous, String current) {