Browse Source

优化短期解析及超短期入库时间

fanxiaoyu 2 weeks ago
parent
commit
0ca0fcf42a

+ 3 - 1
ipp-client/src/main/java/com/jiayue/ipfcst/client/Schedule/ConfigTask.java

@@ -29,7 +29,9 @@ public class ConfigTask {
 	 * 每5分钟通知一次
 	 */
 	@Async
-	@Scheduled(initialDelay =30 * 1000, fixedRateString = "300000")
+	// 改为一个小时心跳一次
+	// @Scheduled(initialDelay =30 * 1000, fixedRateString = "300000")
+	@Scheduled(initialDelay = 30 * 1000, fixedRateString = "3600000")
 	void heartbeatCommunication(){
 		log.info("开始执行定时任务:与云预测心跳通信并获取基本配置信息");
 		try{

+ 4 - 3
ipp-client/src/main/java/com/jiayue/ipfcst/client/Schedule/ParsingJob.java

@@ -116,7 +116,8 @@ public class ParsingJob {
     }
 
     //    @Scheduled(fixedRate = 900000)
-    @Scheduled(fixedRate = 60000)
+//    @Scheduled(fixedRate = 60000)
+    @Scheduled(cron = "0 8,13,19,28,38,43,53 6,17,18 * * ?")
     public void start() {
         List<ParsingChannel> parsingChannels = new ArrayList<>();
 
@@ -147,16 +148,16 @@ public class ParsingJob {
      * 超短期生成定时任务
      */
     @Async
-    @Scheduled(cron = "35 0,15,30,45 * * * ? ")
+    @Scheduled(cron = "0 0,15,30,45 * * * ? ")
 //    @Scheduled(fixedRate = 60000)
     public void ultraShortTermApi() {
         jiaYueWindPowerCdqResultCoverFD0001Service.executeForecast();
         jiaYueWindPowerCdqResultCoverFD0002Service.executeForecast();
         jiaYueWindPowerCdqResultCoverFD0003Service.executeForecast();
+        jiaYueWindPowerCdqResultCoverFD0007Service.executeForecast();
         jiaYueWindPowerCdqResultCoverFD0004Service.executeForecast();
         jiaYueWindPowerCdqResultCoverFD0005Service.executeForecast();
         jiaYueWindPowerCdqResultCoverFD0006Service.executeForecast();
-        jiaYueWindPowerCdqResultCoverFD0007Service.executeForecast();
         jiaYueWindPowerCdqResultCoverFD0009Service.executeForecast();
         jiaYueWindPowerCdqResultCoverFD0010Service.executeForecast();
         jiaYueWindPowerCdqResultCoverFD0015Service.executeForecast();

+ 3 - 2
ipp-client/src/main/java/com/jiayue/ipfcst/client/Schedule/Task.java

@@ -131,7 +131,7 @@ public class Task {
     @Async
 //    @Scheduled(fixedRate = 6000)
 //    @Scheduled(initialDelay = 45 * 1000, fixedRateString = "300000")
-    @Scheduled(cron = "0 0/5 5,6,17,18 * * ?")
+    @Scheduled(cron = "30 5,10,16,25,35,40,50 6,17,18 * * ?")
     void v3DataFilesDownload() {
         if ("否".equals(Constant.cacheClientConfig.getDqAndNwpFileTask())) {
             log.info("气象文件下载任务已关闭");
@@ -423,7 +423,8 @@ public class Task {
      * 当new 和bak文件夹都不存在已下载的文件时,判定文件已传输到内网并向云端回传
      */
     @Async
-    @Scheduled(initialDelay = 30 * 1000, fixedRateString = "120000")
+//    @Scheduled(initialDelay = 30 * 1000, fixedRateString = "120000")
+    @Scheduled(cron = "0 9,14,20,29,39,44,54 6,17,18 * * ?")
     void scanTasksFxgl() {
         if ("否".equals(Constant.cacheClientConfig.getFxglTask())) {
             log.info("反向隔离扫描任务已关闭");

+ 10 - 11
ipp-client/src/main/java/com/jiayue/ipfcst/client/service/impl/an/ParsingDqInfoServiceImpl.java

@@ -241,25 +241,24 @@ public class ParsingDqInfoServiceImpl extends ServiceImpl<ParsingDqInfoMapper, P
             parsingDqInfo.setFpValue("3-1538<=>5");
             String timeConfig = "3<=>4";
 
+            String dayStr = new SimpleDateFormat("yyyyMMdd").format(new Date());
+
             // 获取文件名中的日期时间进行判断
             String fileName = file.getName();
+            // 如果文件不是当然的,删除文件
+            if (!fileName.contains(dayStr)) {
+                file.delete();
+                log.warn(fileName + "不是当天的文件,删除!");
+                return parsingStatus = fileName + "不是当天的文件,删除!";
+            }
             String fileNameHour = fileName.substring(11, 13);
 
             int hour = Integer.valueOf(fileNameHour);
 
-            if (hour == 1 || hour == 13) {
-                log.info("不需解析改时间点的文件!");
-                return parsingStatus += "不需解析改时间点的文件!";
-
-            }
 
-            if (hour >= 1 && hour < 5) {
-                fileNameHour = "01";
-            } else if (hour >= 5 && hour < 13) {
+            if (hour >= 0 && hour < 13) {
                 fileNameHour = "05";
-            } else if (hour >= 13 && hour < 17) {
-                fileNameHour = "13";
-            } else if (hour >= 17) {
+            }  else if (hour >= 13) {
                 fileNameHour = "17";
             }
 

+ 9 - 12
ipp-client/src/main/java/com/jiayue/ipfcst/client/service/impl/an/ParsingNwpInfoServiceImpl.java

@@ -215,27 +215,24 @@ public class ParsingNwpInfoServiceImpl extends ServiceImpl<ParsingNwpInfoMapper,
             List<JiaYueWindPowerNwpResultCoverGF0016> jiaYueWindPowerNwpResultCoverGF0016List = new ArrayList<>();
             List<JiaYueWindPowerNwpResultCoverGF0019> jiaYueWindPowerNwpResultCoverGF0019List = new ArrayList<>();
 
+            String dayStr = new SimpleDateFormat("yyyyMMdd").format(new Date());
 
             // 获取文件名中的日期时间进行判断
             String fileName = file.getName();
+            // 如果文件不是当然的,删除文件
+            if (!fileName.contains(dayStr)) {
+                file.delete();
+                log.warn(fileName + "不是当天的文件,删除!");
+                return parsingStatus = fileName + "不是当天的文件,删除!";
+            }
             String fileNameHour = fileName.substring(12, 14);
 
             int hour = Integer.valueOf(fileNameHour);
 
 
-            if (hour == 1 || hour == 13) {
-                log.info("不需解析改时间点的文件!");
-                return parsingStatus += "不需解析改时间点的文件!";
-
-            }
-
-            if (hour >= 1 && hour < 5) {
-                fileNameHour = "01";
-            } else if (hour >= 5 && hour < 13) {
+            if (hour >= 0 && hour < 13) {
                 fileNameHour = "05";
-            } else if (hour >= 13 && hour < 17) {
-                fileNameHour = "13";
-            } else if (hour >= 17) {
+            }  else if (hour >= 13) {
                 fileNameHour = "17";
             }