فهرست منبع

停止补数定时任务

xiaowang 9 ماه پیش
والد
کامیت
756ea8c787

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

@@ -4,7 +4,6 @@ import com.example.mdd.service.BaiDuDownload;
 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;
@@ -20,7 +19,7 @@ public class Complements {
     BaiDuDownload d;
 
     //百度气象补数 只执行一次
-    @Scheduled(fixedDelay = Long.MAX_VALUE)
+    //@Scheduled(fixedDelay = Long.MAX_VALUE)
     public void download() {
         d.complements();
     }

+ 5 - 4
src/main/java/com/example/mdd/service/BaiDuDownload.java

@@ -459,16 +459,17 @@ public class BaiDuDownload {
                 DataSource ds = new SimpleDataSource("jdbc:mysql://192.168.12.10:23306/mdd"
                         , "root", "la!yibei82nianxueB");
                 Connection conn = DbUtil.use(ds).getConnection();
-                long time = 1722700800000L;
+                long time = 1716220800000L;
                 for (long i = time; i <= time; i = i - 86400000) {
                     for (PowerStation powerStation : list) {
                         if (!"".equals(powerStation.getLongitude()) && !"".equals(powerStation.getLatitude())) {
-                            //heFengDownload.download(conn, powerStation.getStationCode(), powerStation.getLongitude(), powerStation.getLatitude());
-                            //caiYunDownload.download(conn, powerStation.getStationCode(), powerStation.getLongitude(), powerStation.getLatitude());
-                            //xinZhiDownload.download(conn, powerStation.getStationCode(), powerStation.getLongitude(), powerStation.getLatitude());
                             download(conn, powerStation.getStationCode(), powerStation.getLongitude(), powerStation.getLatitude(), new Date(i));
                         }
                     }
+                    if (i == 1577808000000L) {
+                        log.info("已经补到2020-01-01的数据,补数结束");
+                        break;
+                    }
                 }
 
             } catch (SQLException e) {