Quellcode durchsuchen

手动关闭预案,3Min不触发新的预案2

hanzhiwei vor 2 Jahren
Ursprung
Commit
7f592b3789

+ 6 - 2
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabRiskPlanServiceImpl.java

@@ -629,7 +629,11 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
     @Override
     public synchronized int triggerRiskPlan(SubFunction<SensorFunctionStatus> subFunction, Integer riskAttribute) {
         int flag = 200;
-        //这里判断火焰预案,就不继续往下执行了,锁死火焰预案
+        if (redisService.getCacheObject("manualLockRiskPlan" + subFunction.getSubId()) != null) {
+            log.info("当前手动关闭预案,不能触发预案!");
+            return flag;
+        }
+        //判断火焰预案
         if (redisService.getCacheObject("subjectByHuoyan" + subFunction.getSubId()) != null) {
             log.info("当前已触发火焰预案,不能触发其他预案!");
             return flag;
@@ -1101,7 +1105,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
                 redisService.deleteObject("subjectByYa" + subFunction.getSubId());
             }
             //设置手动关闭预案 延时触发时间
-            redisService.setCacheObject("subjectByYa" + subFunction.getSubId(), subFunction.getSubId(), 180L, TimeUnit.SECONDS);
+            redisService.setCacheObject("manualLockRiskPlan" + subFunction.getSubId(), subFunction.getSubId(), 180L, TimeUnit.SECONDS);
             //向前端发送预案关闭
             messageSendService.riskPlanTriggerNotice();
         }