Explorar o código

Merge branch 'wanghaicheng' of lift-manager/lift-server into develop

wanghaicheng %!s(int64=5) %!d(string=hai) anos
pai
achega
b71328ea4f

+ 4 - 4
lift-business-service/src/main/java/cn/com/ty/lift/business/library/dao/entity/Lift.java

@@ -7,7 +7,10 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
-import javax.validation.constraints.*;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
 import java.math.BigDecimal;
 import java.time.LocalDate;
 
@@ -48,9 +51,6 @@ public class Lift extends BaseEntity {
      * 电梯类型(1:直梯;2:扶梯)
      */
     @FieldName(name = "电梯类型")
-    @Min(value = 1, message = "电梯类型错误")
-    @Max(value = 2, message = "电梯类型错误")
-    @NotNull(message = "电梯类型不能为空")
     private Integer liftType;
 
     /**

+ 14 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/library/service/LiftService.java

@@ -296,6 +296,13 @@ public class LiftService extends ServiceImpl<LiftMapper, Lift> {
             }
             LocalDate lastDay = lift.getAnnualInspectionDate().with(TemporalAdjusters.lastDayOfMonth());
             lift.setAnnualInspectionDate(lastDay);
+            //根据电梯类别判断电梯类型
+            Integer category = lift.getCategory();
+            if (category == 1 || category == 2 || category == 3) {
+                lift.setLiftType(1);
+            } else {
+                lift.setLiftType(2);
+            }
             //新增电梯表
             boolean liftResult = save(lift);
             if (!liftResult)
@@ -431,6 +438,13 @@ public class LiftService extends ServiceImpl<LiftMapper, Lift> {
 //        }
         LocalDate lastDay = lift.getAnnualInspectionDate().with(TemporalAdjusters.lastDayOfMonth());
         lift.setAnnualInspectionDate(lastDay);
+        //根据电梯类别判断电梯类型
+        Integer category = lift.getCategory();
+        if (category == 1 || category == 2 || category == 3) {
+            lift.setLiftType(1);
+        } else {
+            lift.setLiftType(2);
+        }
         boolean result = updateById(lift);
         if (!result)
             return RestResponse.fail(MessageUtils.get("msg.modify.fail"));

+ 4 - 3
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/service/MaintenanceRecordService.java

@@ -916,7 +916,7 @@ public class MaintenanceRecordService extends ServiceImpl<MaintenanceRecordMappe
                 registrationCode = StrUtil.isNotEmpty(registrationCode) ? registrationCode.replace(illegalChars, "-") : "[电梯注册代码]";
                 useCompanyCode = useCompanyCode != null ? useCompanyCode : "";
                 //保养单及图片文件夹 dir/i.ProjectName-RegistrationCode/
-                String imgDir = StrUtil.format("{}{}{}.{}-{}-", dir, File.separator, (i + 1), projectName, registrationCode);
+                String imgDir = StrUtil.format("{}{}{}.{}-{}--", dir, File.separator, (i + 1), projectName, registrationCode);
                 imgDir += useCompanyCode + File.separator;
                 //生成维保图片
                 List<MtRecordImg> mtRecordImgs = mtRecordResponse.getMtRecordImgs();
@@ -959,10 +959,11 @@ public class MaintenanceRecordService extends ServiceImpl<MaintenanceRecordMappe
         if (entity.getRepairDiff() != null) {
             String repairDuration = this.getRepairDuration(entity.getRepairDiff());
             entity.setRepairDuration(repairDuration);
+        } else {
+            entity.setRepairDuration("");
         }
-        entity.setRepairDuration("");
         Validate.notNull(entity, ValuePool.MAINTENANCE_RECORD_NOT_EXIST);
-        /**
+        /*
          * 维保项id:0/1/2, 0:无需保养,1:已保养,2:需要更换
          * 保养项目  用键值对的方式存储,如(1:0,2:1,3:1...)
          */