Browse Source

定时器

Newspaper 1 năm trước cách đây
mục cha
commit
5bd31a14f8

+ 9 - 1
snowy-web-app/src/main/java/vip/xiaonuo/Timer/ProEnergyData.java

@@ -7,6 +7,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 import vip.xiaonuo.common.timer.CommonTimerTaskRunner;
+import vip.xiaonuo.modular.ai.taskInspection.entity.TaskInspection;
+import vip.xiaonuo.modular.ai.taskInspection.mapper.TaskInspectionMapper;
 import vip.xiaonuo.modular.ai.warningRemind.entity.WarningRemind;
 import vip.xiaonuo.modular.ai.warningRemind.mapper.WarningRemindMapper;
 import vip.xiaonuo.modular.base.baseConfig.entity.BaseConfig;
@@ -49,6 +51,8 @@ public class ProEnergyData implements CommonTimerTaskRunner {
     private WarningRemindMapper warningRemindMapper;
     @Autowired
     private BaseConfigMapper baseConfigMapper;
+    @Autowired
+    private TaskInspectionMapper taskInspectionMapper;
 
     @Override
     @Transactional
@@ -110,6 +114,11 @@ public class ProEnergyData implements CommonTimerTaskRunner {
                                 warningInfo.setOrgId(orgId);
                                 warningInfo.setWarningTypeId(envWarning.getId());
                                 warningInfoMapper.insert(warningInfo);
+                                TaskInspection taskInspection = new TaskInspection();
+                                taskInspection.setNotifierId(warningManager.getSecondManagerId());
+                                taskInspection.setOrgId(orgId);
+                                taskInspection.setWarningId(warningInfo.getId());
+                                taskInspectionMapper.insert(taskInspection);
                             }
                             BigDecimal waterUpper = energyThreshold.getWaterUpper();
                             if (water.compareTo(waterUpper) > 0){
@@ -193,7 +202,6 @@ public class ProEnergyData implements CommonTimerTaskRunner {
                                 warningInfoMapper.insert(warningInfo);
                             }
 
-
                         }
                     }
                 }

+ 5 - 1
snowy-web-app/src/main/java/vip/xiaonuo/Timer/WarningTransferTimer.java

@@ -28,6 +28,8 @@ public class WarningTransferTimer implements CommonTimerTaskRunner {
     private WarningManagerMapper warningManagerMapper;
     @Autowired
     private TaskInspectionMapper taskInspectionMapper;
+    @Autowired
+    private BaseConfigMapper baseConfigMapper;
 
     @Override
     @Transactional
@@ -35,10 +37,12 @@ public class WarningTransferTimer implements CommonTimerTaskRunner {
         List<WarningInfo> warningInfos = warningInfoMapper.selectList(new QueryWrapper<WarningInfo>().lambda().eq(WarningInfo::getWarningStatus, 0));
         for (WarningInfo warningInfo : warningInfos) {
             Date warningTime = warningInfo.getWarningTime();
+            String configName = baseConfigMapper.selectById(warningInfo.getWarningTypeId()).getConfigName();
+
             Date now = new Date();
             Integer warningType = null;
 
-            switch (warningInfo.getWarningType()) {
+            switch (configName) {
                 case "环控预警":
                     warningType = 0;
                     break;