3254194295 3 жил өмнө
parent
commit
100cd69de6

+ 49 - 10
platform-service/src/main/java/com/platform/service/check/impl/CheckJobServiceImpl.java

@@ -550,18 +550,57 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
 
                 CheckJob checkJob = new CheckJob();
                 checkJob.setSbId(standard.getSbId());
+            SbInfo sbInfo = sbInfoService.getModelById(standard.getSbId());
 
                 // 有可能设备已经删除了,继续执行其他的
-                if(StringUtils.isBlank(standard.getSbId())){
-                    throw new DeniedException("设备已经被删除了,无法生成保养任务!");
-                }
-                SbInfo sbInfo = sbInfoService.getModelById(standard.getSbId());
-                if(sbInfo == null){
-                    throw new DeniedException("没有找到该设备,无法生成保养任务!");
-                }
-                if(!sbInfo.getStatus().equals(SbInfoStatusEnum.IN_USE.getValue())){
-                    throw new DeniedException("设备不在使用中,无法生成保养任务!");
-                }
+            switch (standard.getType()){
+                case 1:
+                    if(StringUtils.isBlank(standard.getSbId())){
+                        throw new DeniedException("设备已经被删除了,无法生成点检任务!");
+                    }
+
+                    if(sbInfo == null){
+                        throw new DeniedException("没有找到该设备,无法生成点检任务!");
+                    }
+                    if(!sbInfo.getStatus().equals(SbInfoStatusEnum.IN_USE.getValue())){
+                        throw new DeniedException("设备不在使用中,无法生成点检任务!");
+                    }
+                    break;
+
+                case 2:
+                    if(StringUtils.isBlank(standard.getSbId())){
+                        throw new DeniedException("设备已经被删除了,无法生成保养任务!");
+                    }
+                    if(sbInfo == null){
+                        throw new DeniedException("没有找到该设备,无法生成保养任务!");
+                    }
+                    if(!sbInfo.getStatus().equals(SbInfoStatusEnum.IN_USE.getValue())){
+                        throw new DeniedException("设备不在使用中,无法生成保养任务!");
+                    }
+                    break;
+
+                case 3:
+                    if(StringUtils.isBlank(standard.getSbId())){
+                        throw new DeniedException("设备已经被删除了,无法生成润滑任务!");
+                    }
+                    if(sbInfo == null){
+                        throw new DeniedException("没有找到该设备,无法生成润滑任务!");
+                    }
+                    if(!sbInfo.getStatus().equals(SbInfoStatusEnum.IN_USE.getValue())){
+                        throw new DeniedException("设备不在使用中,无法生成润滑任务!");
+                    }
+                    break;
+            }
+//                if(StringUtils.isBlank(standard.getSbId())){
+//                    throw new DeniedException("设备已经被删除了,无法生成保养任务!");
+//                }
+//                SbInfo sbInfo = sbInfoService.getModelById(standard.getSbId());
+//                if(sbInfo == null){
+//                    throw new DeniedException("没有找到该设备,无法生成保养任务!");
+//                }
+//                if(!sbInfo.getStatus().equals(SbInfoStatusEnum.IN_USE.getValue())){
+//                    throw new DeniedException("设备不在使用中,无法生成保养任务!");
+//                }
                 if(standard.getCheckUserType() == null){
                     if(standard.getPeriodType()< CheckPlanPeriodTypeEnum.WEEK.getValue()){
                         checkJob.setCheckUserId(sbInfo.getSaveUser());