소스 검색

添加默认查询开始时间和结束时间。

zhuoning 4 년 전
부모
커밋
995a7d2831

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

@@ -20,7 +20,7 @@ import java.time.LocalDateTime;
 @Configuration      //1.主要用于标记配置类,兼备Component的效果。
 @EnableScheduling   // 2.开启定时任务
 public class SaticScheduleTask  {
-    @Autowired
+    @Autowired(required = false)
     private IAutoGetErpData iAutoGetErpData;
 
 //    @Scheduled(cron = "* 0/5 * * * ?")
@@ -30,45 +30,45 @@ public class SaticScheduleTask  {
 //        System.err.println("执行静态定时任务时间: " + LocalDateTime.now());
 //    }
 
-    @Scheduled(cron = "* 0/30 * * * ?")
+    @Scheduled(cron = "0/1 * * * * ?")
     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/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());
+//    }
 
 }

+ 10 - 1
huimv-hy-production/huimv.hy.autoGetData/src/main/java/com/huimv/production/autoGetData/service/impl/AutoGetErpDataImpl.java

@@ -1,6 +1,7 @@
 package com.huimv.production.autoGetData.service.impl;
 
 import com.huimv.production.autoGetData.service.IAutoGetErpData;
+import org.springframework.beans.factory.annotation.Value;
 
 /**
  * @Project : huimv.shiwan
@@ -11,9 +12,17 @@ import com.huimv.production.autoGetData.service.IAutoGetErpData;
  * @Create : 2020-12-25
  **/
 public class AutoGetErpDataImpl implements IAutoGetErpData {
+    // 查询开始日期
+    @Value("${erp.datasource.startDate}")
+    private String startDate;
+
+    // 查询结束日期
+    @Value("${erp.datasource.endDate}")
+    private String endDate;
 
     @Override
     public void getPsy() {
-
+        System.out.println("startDate:"+startDate);
+        System.out.println("endDate:"+endDate);
     }
 }

+ 3 - 0
huimv-hy-production/huimv.hy.autoGetData/src/main/resources/application.properties

@@ -1 +1,4 @@
 spring.profiles.active=dev
+
+erp.datasource.startDate=2021.1.1
+erp.datasource.endDate=2021.12.31