Browse Source

定时任务打印日志

alan 11 months ago
parent
commit
e8f1e266d0
1 changed files with 5 additions and 2 deletions
  1. 5 2
      src/main/java/com/zhili/dashboard/scheduler/JobScheduler.java

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

@@ -1,6 +1,7 @@
 package com.zhili.dashboard.scheduler;
 
 import com.zhili.dashboard.service.*;
+import lombok.extern.log4j.Log4j2;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
@@ -11,6 +12,7 @@ import javax.annotation.Resource;
  * @author user
  */
 @Component
+@Log4j2
 public class JobScheduler {
     @Resource
     IDeviceService deviceService;
@@ -29,9 +31,10 @@ public class JobScheduler {
      * 10min一次
      */
     @Async
-    @Scheduled(cron = "0 0 0 * * ?")
+    @Scheduled(cron = "*/5 * * * * ?")
     public void updateAlarmMsg() {
-        alarmMsgService.updateAlarmMsg();
+        log.info("定时任务执行一次");
+//        alarmMsgService.updateAlarmMsg();
     }
     /**
      * 同步电池信息