Browse Source

feature 代码提交

xiahan 2 months ago
parent
commit
9cd27cc6d8

+ 7 - 0
js-common/src/main/java/com/rongwei/safecommon/utils/JSCommonUtils.java

@@ -53,6 +53,10 @@ import static com.rongwei.safecommon.utils.SaveConstans.*;
 @Component
 public class JSCommonUtils {
     public static final String DEFAULT_NOTIFY_STATUS = "3";
+    public static final SysUserVo DEFAULT_USER_VO = new SysUserVo(){{
+        setId("8672bf72ab274bec83052868ae336b38");
+        setName("系统管理员");
+    }};
     private static final Logger log = LoggerFactory.getLogger(JSCommonUtils.class.getName());
     private static SysSerialNumberService sysSerialNumberService;
     private static RedisService redisService;
@@ -278,6 +282,9 @@ public class JSCommonUtils {
                     currUser = redisService.getLoginUser(token);
                 }
             }
+        } else {
+            currUser = DEFAULT_USER_VO;
+
         }
         return currUser;
     }

+ 4 - 4
js-security/security-common/src/main/java/com/rongwei/sfcommon/sys/service/impl/HazardInvestigationServiceImpl.java

@@ -207,11 +207,11 @@ public class HazardInvestigationServiceImpl implements HazardInvestigationServic
         if (!"1".equals(aspRiskUnitDo.getMajorhazard()) || "0".equals(tempData.getChecktype())) {
             return aspRiskUnitDo.getDutyofficername() + "-;-" + aspRiskUnitDo.getDutyofficerid();
         }
-        Optional<AspMajorHazardSourcesDo> hazardSources = aspMajorHazardSourcesDos.stream().filter(data -> data.getId().equals(aspRiskUnitDo.getMajorhazardid())).findFirst();
-        JSCommonUtils.parameterCheck(hazardSources::isPresent,"无法获取到重大危险源","无法获取到重大危险源");
-        AspMajorHazardSourcesDo aspMajorHazardSourcesDo = hazardSources.get();
+        AspMajorHazardSourcesDo hazardSources = aspMajorHazardSourcesDos.stream().filter(data -> data.getId().equals(aspRiskUnitDo.getMajorhazardid())).findFirst()
+                .orElse(null);
+        JSCommonUtils.parameterCheck(()->hazardSources==null,"无法获取到重大危险源","无法获取到重大危险源");
         List<Function<AspMajorHazardSourcesDo, String>> functions = getCheckUserInfoFunctionMap.get(tempData.getChecktype());
-        return functions.get(0).apply(aspMajorHazardSourcesDo) + "-;-" + functions.get(1).apply(aspMajorHazardSourcesDo);
+        return functions.get(0).apply(hazardSources) + "-;-" + functions.get(1).apply(hazardSources);
     }
 
     /**

+ 2 - 1
js-security/security-common/src/main/java/com/rongwei/sfcommon/sys/service/impl/ScheduledTasksServiceImpl.java

@@ -320,7 +320,8 @@ public class ScheduledTasksServiceImpl implements ScheduledTasksService {
             LocalTime endTime = LocalTime.parse(hazardInvestigationTemplateDo.getEndtimeofwork());
             LocalTime currentTime = LocalTime.now();
             if(!currentTime.isBefore(startTime) && !currentTime.isAfter(endTime)){
-                if(generationdate==null || i == inspectioncycle){
+                // 如果生成时间为空 或者 巡检周期大于时间差值
+                if(generationdate==null || inspectioncycle == i){
                     return returnDate;
                 }else{
                     return  null;

+ 4 - 4
js-security/security-server/src/main/java/com/rongwei/savecheck/controller/ScheduledTasksController.java

@@ -90,15 +90,15 @@ public class ScheduledTasksController {
     @Scheduled(cron = "0 0 8 ? * *")
     @PostMapping("/save/check/plan")
     public R createCheckPlanByTemp() {
-        log.info("点巡检隐患任务提醒");
+        log.info("点巡检隐患任务定时生成");
         scheduledTasksService.createCheckPlanByTemp();
         return R.ok();
     }
 
-    @Scheduled(cron = "0 0 1 ? * *")
+    @Scheduled(cron = "0 0 0/1 * * ? ")
     @PostMapping("/hazard-investigation")
     public R creatHazardInvestigationTask(){
-        log.info("隐患排查任务定时提醒");
+        log.info("隐患排查任务定时生成");
        return scheduledTasksService.creatHazardInvestigationTask();
     }
 
@@ -113,7 +113,7 @@ public class ScheduledTasksController {
     @Scheduled(cron = "0 0 1 ? * *")
     @PostMapping("/hidden-danger/warning-status")
     public R updateHiddenDangerWarningStatus(){
-        log.info("资质证照复审定时提醒");
+        log.info("更新隐患任务预警状态");
         return scheduledTasksService.updateHiddenDangerWarningStatus();
     }
 }