Browse Source

定时任务5

alan 1 year ago
parent
commit
8dff8485e4

+ 2 - 1
src/main/java/com/zhili/dashboard/mapper/AlarmMsgMapper.java

@@ -1,5 +1,6 @@
 package com.zhili.dashboard.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.zhili.dashboard.entity.AlarmMsg;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhili.dashboard.entity.Device;
@@ -160,6 +161,6 @@ public interface AlarmMsgMapper extends BaseMapper<AlarmMsg> {
      */
     @MapKey("id")
     List<Map<String, Object>> getBatteryMap(@Param("province") String province);
-
+    @InterceptorIgnore(blockAttack = "true")
     void updateAlarmMsg();
 }

+ 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();

+ 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();
     }
 }

+ 2 - 2
src/main/resources/application.yml

@@ -41,9 +41,9 @@ spring:
     type: com.zaxxer.hikari.HikariDataSource
     driver-class-name: com.mysql.cj.jdbc.Driver
     url: jdbc:mysql://172.16.121.243:3306/db_omes_dashboard?useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&tinyInt1isBit=false
-#    url: jdbc:mysql://192.168.0.40:3306/db_omes_dashboard?useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&tinyInt1isBit=false
+#    url: jdbc:mysql://localhost:3306/db_omes_dashboard?useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&tinyInt1isBit=false
     username: root
-#    password: Qx123456
+#    password: root
     password: Qx123456
   # 资源信息
   messages:

+ 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">