From f93be90560e001b8330c53b848272ae04a78fc66 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期二, 01 四月 2025 22:26:40 +0800
Subject: [PATCH] runScheduleDayLastTask每天最后时刻执行

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

diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleDayLastTask.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleDayLastTask.java
new file mode 100644
index 0000000..1086a85
--- /dev/null
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleDayLastTask.java
@@ -0,0 +1,57 @@
+package com.iailab.module.shasteel.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;
+
+/**
+ *
+ * 每天最后时刻执行
+ * 适用于模型输入数据粒度为天的
+ *
+ * @author PanZhibao
+ * @Description
+ * @createTime 2025年04月01日
+ */
+@Component("runScheduleDayLastTask")
+public class RunScheduleDayLastTask implements ITask {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private MdkApi mdkApi;
+
+    @Override
+    public void run(String params) {
+        logger.info("RunScheduleDayLastTask定时任务正在执行,参数为:{}",params );
+        try {
+            Calendar calendar = Calendar.getInstance();
+            calendar.set(Calendar.MILLISECOND,0);
+            calendar.set(Calendar.SECOND,0);
+            calendar.set(Calendar.MINUTE,0);
+            calendar.set(Calendar.HOUR_OF_DAY,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("RunScheduleDayLastTask运行异常");
+            ex.printStackTrace();
+        }
+        logger.info("RunScheduleDayLastTask运行完成");
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.3