Browse Source

添加从属性文件获取默认查询时间区间。

zhuoning 4 năm trước cách đây
mục cha
commit
6a6910f562

+ 37 - 36
huimv-hy-production/huimv.hy.autoGetData/src/main/java/com/huimv/production/autoGetData/config/SaticScheduleTask.java

@@ -1,6 +1,7 @@
 package com.huimv.production.autoGetData.config;
 
 import com.huimv.production.autoGetData.service.IAutoGetErpData;
+import com.huimv.production.autoGetData.service.impl.AutoGetErpDataImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.scheduling.annotation.EnableScheduling;
@@ -20,7 +21,7 @@ import java.time.LocalDateTime;
 @Configuration      //1.主要用于标记配置类,兼备Component的效果。
 @EnableScheduling   // 2.开启定时任务
 public class SaticScheduleTask  {
-    @Autowired(required = false)
+    @Autowired
     private IAutoGetErpData iAutoGetErpData;
 
 //    @Scheduled(cron = "* 0/5 * * * ?")
@@ -30,45 +31,45 @@ public class SaticScheduleTask  {
 //        System.err.println("执行静态定时任务时间: " + LocalDateTime.now());
 //    }
 
-    @Scheduled(cron = "0/1 * * * * ?")
+    @Scheduled(cron = "0/5 * * * * ?")
     private void getPsyTask(){
         System.err.println("执行 getPsyTask 执行静态定时任务时间: " + LocalDateTime.now());
         iAutoGetErpData.getPsy();
     }
 
-//    @Scheduled(cron = "* 0/30 * * * ?")
-//    private void getReEstrusRate(){
-//        System.err.println("执行 getReEstrusRate 执行静态定时任务时间: " + LocalDateTime.now());
-//    }
-//
-//    @Scheduled(cron = "* 0/30 * * * ?")
-//    private void getParturitionRate(){
-//        System.err.println("执行 getParturitionRate 执行静态定时任务时间: " + LocalDateTime.now());
-//    }
-//
-//    @Scheduled(cron = "* 0/30 * * * ?")
-//    private void getStorage(){
-//        System.err.println("执行 getStorage 执行静态定时任务时间: " + LocalDateTime.now());
-//    }
-//
-//    @Scheduled(cron = "* 0/30 * * * ?")
-//    private void getPigletInfo(){
-//        System.err.println("执行 getPigletInfo 执行静态定时任务时间: " + LocalDateTime.now());
-//    }
-//
-//    @Scheduled(cron = "* 0/30 * * * ?")
-//    private void getMateQuantity(){
-//        System.err.println("执行 getMateQuantity 执行静态定时任务时间: " + LocalDateTime.now());
-//    }
-//
-//    @Scheduled(cron = "* 0/30 * * * ?")
-//    private void getConceptionRate(){
-//        System.err.println("执行 getConceptionRate 执行静态定时任务时间: " + LocalDateTime.now());
-//    }
-//
-//    @Scheduled(cron = "* 0/30 * * * ?")
-//    private void getAllStorage(){
-//        System.err.println("执行 getAllStorage 执行静态定时任务时间: " + LocalDateTime.now());
-//    }
+    @Scheduled(cron = "* 0/5 * * * ?")
+    private void getReEstrusRate(){
+        System.err.println("执行 getReEstrusRate 执行静态定时任务时间: " + LocalDateTime.now());
+    }
+
+    @Scheduled(cron = "* 0/5 * * * ?")
+    private void getParturitionRate(){
+        System.err.println("执行 getParturitionRate 执行静态定时任务时间: " + LocalDateTime.now());
+    }
+
+    @Scheduled(cron = "* 0/5 * * * ?")
+    private void getStorage(){
+        System.err.println("执行 getStorage 执行静态定时任务时间: " + LocalDateTime.now());
+    }
+
+    @Scheduled(cron = "* 0/5 * * * ?")
+    private void getPigletInfo(){
+        System.err.println("执行 getPigletInfo 执行静态定时任务时间: " + LocalDateTime.now());
+    }
+
+    @Scheduled(cron = "* 0/5 * * * ?")
+    private void getMateQuantity(){
+        System.err.println("执行 getMateQuantity 执行静态定时任务时间: " + LocalDateTime.now());
+    }
+
+    @Scheduled(cron = "* 0/5 * * * ?")
+    private void getConceptionRate(){
+        System.err.println("执行 getConceptionRate 执行静态定时任务时间: " + LocalDateTime.now());
+    }
+
+    @Scheduled(cron = "* 0/5 * * * ?")
+    private void getAllStorage(){
+        System.err.println("执行 getAllStorage 执行静态定时任务时间: " + LocalDateTime.now());
+    }
 
 }

+ 2 - 0
huimv-hy-production/huimv.hy.autoGetData/src/main/java/com/huimv/production/autoGetData/service/impl/AutoGetErpDataImpl.java

@@ -2,6 +2,7 @@ package com.huimv.production.autoGetData.service.impl;
 
 import com.huimv.production.autoGetData.service.IAutoGetErpData;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
 
 /**
  * @Project : huimv.shiwan
@@ -11,6 +12,7 @@ import org.springframework.beans.factory.annotation.Value;
  * @Author : ZhuoNing
  * @Create : 2020-12-25
  **/
+@Service
 public class AutoGetErpDataImpl implements IAutoGetErpData {
     // 查询开始日期
     @Value("${erp.datasource.startDate}")