Explorar el Código

搭建从ERP数据源接口获取数据框架。

zhuoning hace 4 años
padre
commit
147532ff8a

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

@@ -0,0 +1,74 @@
+package com.huimv.production.autoGetData.config;
+
+import com.huimv.production.autoGetData.service.IAutoGetErpData;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.scheduling.annotation.SchedulingConfigurer;
+
+import java.time.LocalDateTime;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.biosafety.uface.controller
+ * @Description : TODO
+ * @Version : 1.0
+ * @Author : ZhuoNing
+ * @Create : 2020-12-25
+ **/
+@Configuration      //1.主要用于标记配置类,兼备Component的效果。
+@EnableScheduling   // 2.开启定时任务
+public class SaticScheduleTask  {
+    @Autowired
+    private IAutoGetErpData iAutoGetErpData;
+
+//    @Scheduled(cron = "* 0/5 * * * ?")
+//    //或直接指定时间间隔,例如:5秒
+//    //@Scheduled(fixedRate=5000)
+//    private void configureTasks() {
+//        System.err.println("执行静态定时任务时间: " + LocalDateTime.now());
+//    }
+
+    @Scheduled(cron = "* 0/30 * * * ?")
+    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());
+    }
+
+}

+ 5 - 0
huimv-hy-production/huimv.hy.autoGetData/src/main/java/com/huimv/production/autoGetData/service/IAutoGetErpData.java

@@ -0,0 +1,5 @@
+package com.huimv.production.autoGetData.service;
+
+public interface IAutoGetErpData {
+    void getPsy();
+}

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

@@ -0,0 +1,19 @@
+package com.huimv.production.autoGetData.service.impl;
+
+import com.huimv.production.autoGetData.service.IAutoGetErpData;
+
+/**
+ * @Project : huimv.shiwan
+ * @Package : com.huimv.biosafety.uface.controller
+ * @Description : TODO
+ * @Version : 1.0
+ * @Author : ZhuoNing
+ * @Create : 2020-12-25
+ **/
+public class AutoGetErpDataImpl implements IAutoGetErpData {
+
+    @Override
+    public void getPsy() {
+
+    }
+}