Browse Source

定时任务4

alan 1 year ago
parent
commit
8f5b843756

+ 2 - 1
src/main/java/com/zhili/dashboard/scheduler/JobScheduler.java

@@ -30,7 +30,8 @@ public class JobScheduler {
      * 同步电池信息
      * 10min一次
      */
-    @Scheduled(cron = "0 0 0 * * ?")
+//    @Scheduled(cron = "0 0 0 * * ?")
+    @Scheduled(cron = "*/30 * * * * ?")
     public void updateAlarmMsg() {
         log.info("更新一次数据");
         alarmMsgService.updateAlarmMsg();

+ 2 - 0
src/main/java/com/zhili/dashboard/service/impl/AlarmMsgServiceImpl.java

@@ -1560,5 +1560,7 @@ public class AlarmMsgServiceImpl extends ServiceImpl<AlarmMsgMapper, AlarmMsg> i
     @Override
     public void updateAlarmMsg() {
         alarmMsgMapper.updateAlarmMsg();
+        alarmMsgWarnMapper.updateAlarmMsgWarn();
+        distributionMapMapper.updateDistributionMap();
     }
 }

+ 1 - 10
src/main/resources/mapper/AlarmMsgMapper.xml

@@ -17,16 +17,7 @@
         UPDATE t_alarm_msg t
         SET t.create_time = DATE_ADD( t.create_time, INTERVAL 1 DAY ),
             t.fault_time = DATE_ADD( t.fault_time, INTERVAL 1 DAY ),
-            t.finish_time = DATE_ADD( t.finish_time, INTERVAL 1 DAY );
-
-        UPDATE t_alarm_msg_warn t
-        SET t.create_time = DATE_ADD( t.create_time, INTERVAL 1 DAY ),
-            t.fault_time = DATE_ADD( t.fault_time, INTERVAL 1 DAY ),
-            t.finish_time = DATE_ADD( t.finish_time, INTERVAL 1 DAY );
-
--- 更新大屏数据库
-        UPDATE tb_distribution_map t
-        SET t.statis_date = REPLACE(DATE_ADD(t.statis_date,INTERVAL 1 DAY),'-','');
+            t.finish_time = DATE_ADD( t.finish_time, INTERVAL 1 DAY )
     </update>
 
     <select id="getAlarmLevelPie" resultMap="HzCarModel">