From 8766cfc344d3635cd7e50a7c674cd5feb54d5a3d Mon Sep 17 00:00:00 2001
From: liriming <1343021927@qq.com>
Date: 星期一, 02 十二月 2024 09:30:35 +0800
Subject: [PATCH] 预警mq监听并发送

---
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunPredictModuleTask.java |   45 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunPredictModuleTask.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunPredictModuleTask.java
new file mode 100644
index 0000000..f6e5f46
--- /dev/null
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunPredictModuleTask.java
@@ -0,0 +1,45 @@
+package com.iailab.module.shasteel.job.task;
+
+import com.iailab.module.model.api.mdk.MdkApi;
+import com.iailab.module.model.api.mdk.dto.MdkPredictReqDTO;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Calendar;
+
+/**
+ * 执行模块预测定时任务
+ *
+ */
+@Component("runPredictModuleTask")
+public class RunPredictModuleTask implements ITask {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    MdkApi mdkApi;
+
+
+    @Override
+    public void run(String params) {
+        logger.info("runPredictModuleTask定时任务正在执行,参数为:{}",params );
+        try {
+            Calendar calendar = Calendar.getInstance();
+            calendar.set(Calendar.SECOND,0);
+            calendar.set(Calendar.MILLISECOND,0);
+
+            MdkPredictReqDTO dto = new MdkPredictReqDTO();
+            dto.setPredictTime(calendar.getTime());
+            dto.setModuleType(params);
+            mdkApi.predictModule(dto);
+            logger.info(params + "模块预测完成");
+
+
+        } catch (Exception ex) {
+            logger.error("runPredictModuleTask运行异常");
+            ex.printStackTrace();
+        }
+        logger.info("runPredictModuleTask运行完成");
+    }
+}

--
Gitblit v1.9.3