Browse Source

定时任务3

alan 1 year ago
parent
commit
38d62820a5

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

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

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

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

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

@@ -17,7 +17,16 @@
         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 )
+            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),'-','');
     </update>
 
     <select id="getAlarmLevelPie" resultMap="HzCarModel">