Browse Source

修改定时任务

xiaowang 5 tháng trước cách đây
mục cha
commit
7fa46794e3

+ 2 - 1
src/main/java/com/example/mdd/job/Download.java

@@ -3,6 +3,7 @@ package com.example.mdd.job;
 import com.example.mdd.service.MeteorologicalDataDownload;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -17,7 +18,7 @@ public class Download {
 
     //每天10点下载数据
     //@Scheduled(fixedDelay = 1000)
-    //@Scheduled(cron = "0 0 10 * * ?")
+    @Scheduled(cron = "0 0 10 * * ?")
     public void download() {
         md.download();
     }

+ 2 - 1
src/main/java/com/example/mdd/job/DownloadHour.java

@@ -3,6 +3,7 @@ package com.example.mdd.job;
 import com.example.mdd.service.MeteorologicalDataDownload;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -17,7 +18,7 @@ public class DownloadHour {
 
     //每小时下载数据
     //@Scheduled(fixedDelay = 1000)
-    //@Scheduled(cron = "0 0 0/1 * * ?")
+    @Scheduled(cron = "0 0 0/1 * * ?")
     public void download() {
         md.downloadHour();
     }

+ 2 - 2
src/main/java/com/example/mdd/job/DownloadXMO.java

@@ -17,8 +17,8 @@ public class DownloadXMO {
     XMODownload xmoDownload;
 
     //xmo天气 从0点开始 每3小时调用一次
-    @Scheduled(fixedDelay = 600000)
-    //@Scheduled(cron = "0 0 0/3 * * *")
+    //@Scheduled(fixedDelay = 600000)
+    @Scheduled(cron = "0 0 0/3 * * *")
     public void download() {
         xmoDownload.download();
     }