瀏覽代碼

保养标准导入优化

3254194295 3 月之前
父節點
當前提交
a0f02792e5

+ 12 - 7
platform-service/src/main/java/com/platform/service/check/impl/CheckStandardServiceImpl.java

@@ -623,20 +623,23 @@ public class CheckStandardServiceImpl extends BaseServiceImpl<CheckStandardMappe
 //            throw new BusinessException("未找到名为为"+vo.getRepairUserName()+"的维修负责人!");
 //        }
 //        sbInfo.setRepairUser(user.getUserId());
-        if ("使用人".equals(vo.getCheckUserType().trim())){
-            checkStandard.setCheckUserType(1);
-        }else if ("维修人".equals(vo.getCheckUserType())){
-            checkStandard.setCheckUserType(2);
-        }else if ("厂家".equals(vo.getCheckUserType())){
-            checkStandard.setCheckUserType(3);
+        if (vo.getPeriodType()==null){
+            throw new BusinessException("计划周期未填或填错!");
         }
+        checkStandard.setPeriodType(Integer.parseInt(vo.getPeriodType()));
+
+        if (vo.getCheckUserType()==null){
+            throw new BusinessException("执行人方式填错或未填!");
+        }
+        checkStandard.setCheckUserType(Integer.parseInt(vo.getCheckUserType()));
+
         if (StringUtils.isNotBlank(vo.getLastDate())) {
             checkStandard.setLastDate(LocalDate.parse(vo.getLastDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")));
         }
         if (StringUtils.isNotBlank(vo.getNextDate())) {
             checkStandard.setNextDate(LocalDate.parse(vo.getNextDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")));
         }
-        checkStandard.setPeriodType(DictCache.getValueByLabel("PERIOD_TYPE",vo.getPeriodType()));
+//        checkStandard.setPeriodType(DictCache.getValueByLabel("CHECK_PLAN_PERIOD_TYPE",vo.getPeriodType()));
         checkStandard.setCreatedTime(LocalDateTime.now());
         checkStandard.setUpdateTime(LocalDateTime.now());
         checkStandard.setUpdateUserId(SecurityUtils.getUserInfo().getUserId());
@@ -651,10 +654,12 @@ public class CheckStandardServiceImpl extends BaseServiceImpl<CheckStandardMappe
         if ("1".equals(vo.getCheckUserType())) {
 //            checkStandard.setSbId(sbInfo.getId());
             checkStandard.setCheckUserId(sbInfo.getSaveUser());
+            checkStandard.setLevel(1);
         }
         if ("2".equals(vo.getCheckUserType()) || "3".equals(vo.getCheckUserType())) {// 设备的维修员
 //            checkStandard.setSbId(sbInfo.getId());
             checkStandard.setCheckUserId(sbInfo.getRepairUser());
+            checkStandard.setLevel(2);
         }
     }