From d7abdea2896b4062cbd082ce2f8988c76104a5d7 Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期三, 19 三月 2025 15:08:27 +0800
Subject: [PATCH] 执行调度方案定时任务

---
 ansteel-biz/src/main/java/com/iailab/module/ansteel/job/task/RunScheduleModuleTask.java |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/ansteel-biz/src/main/java/com/iailab/module/ansteel/job/task/RunScheduleModuleTask.java b/ansteel-biz/src/main/java/com/iailab/module/ansteel/job/task/RunScheduleModuleTask.java
new file mode 100644
index 0000000..233493f
--- /dev/null
+++ b/ansteel-biz/src/main/java/com/iailab/module/ansteel/job/task/RunScheduleModuleTask.java
@@ -0,0 +1,51 @@
+package com.iailab.module.ansteel.job.task;
+
+import com.iailab.module.model.api.mdk.MdkApi;
+import com.iailab.module.model.api.mdk.dto.MdkScheduleReqDTO;
+import com.iailab.module.model.api.mdk.dto.MdkScheduleRespDTO;
+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("runScheduleModuleTask")
+public class RunScheduleModuleTask implements ITask {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private MdkApi mdkApi;
+
+
+    @Override
+    public void run(String params) {
+        logger.info("runScheduleModuleTask定时任务正在执行,参数为:{}",params );
+        try {
+            Calendar calendar = Calendar.getInstance();
+            calendar.set(Calendar.SECOND,0);
+            calendar.set(Calendar.MILLISECOND,0);
+
+            MdkScheduleReqDTO dto = new MdkScheduleReqDTO();
+            dto.setScheduleTime(calendar.getTime());
+            dto.setScheduleCode(params);
+            MdkScheduleRespDTO mdkScheduleRespDTO = mdkApi.doSchedule(dto);
+            logger.info(params + "调度方案执行完成," + mdkScheduleRespDTO);
+            logger.info("调度方案结果开始下发");
+            if (mdkApi.scheduleModelOut(mdkScheduleRespDTO)) {
+                logger.info("调度方案结果下发成功");
+            }else {
+                logger.error("调度方案结果下发失败");
+            }
+
+        } catch (Exception ex) {
+            logger.error("runScheduleModuleTask运行异常");
+            ex.printStackTrace();
+        }
+        logger.info("runScheduleModuleTask运行完成");
+    }
+}

--
Gitblit v1.9.3