Bläddra i källkod

增加报告计算调度

王波 3 månader sedan
förälder
incheckning
2063f56715
1 ändrade filer med 33 tillägg och 0 borttagningar
  1. 33 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/task/AnalysisTask.java

+ 33 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/task/AnalysisTask.java

@@ -0,0 +1,33 @@
+package com.gyee.runeconomy.task;
+
+import com.gyee.runeconomy.service.EarlyWarning.EarlyWarningReliableService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+@Component
+@EnableAsync  // 启用异步方法执行
+public class AnalysisTask {
+    private static final Logger logger = LoggerFactory.getLogger(AnalysisTask.class);
+
+    @Autowired
+    private EarlyWarningReliableService earlyWarningReliableService;
+    // 每日1点 - 日曲线偏差
+    @Async
+    @Scheduled(cron = "0 0 1 1/1 * ?")
+    public void rqxpc() {
+        try {
+            logger.info("预警报告计算开始运行");
+            earlyWarningReliableService.Electricity();
+            logger.info("预警报告计算运行完成");
+        } catch (Exception e) {
+            logger.error("预警报告计算运行失败", e);
+        }
+    }
+
+}