From 7c6d107258316a5797d346d5395ee1e9196e65bd Mon Sep 17 00:00:00 2001 From: liriming <1343021927@qq.com> Date: 星期三, 26 三月 2025 11:15:17 +0800 Subject: [PATCH] RunFHYZTask --- ansteel-biz/src/main/java/com/iailab/module/ansteel/job/task/RunFHYZTask.java | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 54 insertions(+), 0 deletions(-) diff --git a/ansteel-biz/src/main/java/com/iailab/module/ansteel/job/task/RunFHYZTask.java b/ansteel-biz/src/main/java/com/iailab/module/ansteel/job/task/RunFHYZTask.java new file mode 100644 index 0000000..eb8c1ff --- /dev/null +++ b/ansteel-biz/src/main/java/com/iailab/module/ansteel/job/task/RunFHYZTask.java @@ -0,0 +1,54 @@ +package com.iailab.module.ansteel.job.task; + +import com.iailab.module.model.api.mdk.MdkApi; +import com.iailab.module.model.api.mdk.dto.MdkPredictReqDTO; +import com.iailab.module.model.api.mdk.dto.MdkScheduleReqDTO; +import com.iailab.module.model.api.mdk.dto.MdkScheduleRespDTO; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +/** + * 执行模块预测定时任务 + */ +@Component("runFHYZTask") +public class RunFHYZTask implements ITask { + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private MdkApi mdkApi; + + @Override + public void run(String params) { + logger.info("runFHYZTask定时任务正在执行,参数为:{}", 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("RunFHYZTask运行异常"); + ex.printStackTrace(); + } + logger.info("runFHYZTask运行完成"); + } +} -- Gitblit v1.9.3