From 12bf22cbe7779967dfcb4341256525e72ce90358 Mon Sep 17 00:00:00 2001
From: Jay <csj123456>
Date: 星期五, 17 一月 2025 18:28:07 +0800
Subject: [PATCH] 增加蒸汽评价指标执行任务

---
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunSteamEvaluationConsumptionTask.java |   68 +++++++++++++++++
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunSteamEvaluationDiffuseTask.java     |   67 ++++++++++++++++
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunSteamEvaluationTotalTask.java       |   67 ++++++++++++++++
 3 files changed, 202 insertions(+), 0 deletions(-)

diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunSteamEvaluationConsumptionTask.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunSteamEvaluationConsumptionTask.java
new file mode 100644
index 0000000..9702557
--- /dev/null
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunSteamEvaluationConsumptionTask.java
@@ -0,0 +1,68 @@
+package com.iailab.module.shasteel.job.task;
+
+import com.iailab.module.model.api.mcs.McsApi;
+import com.iailab.module.model.api.mcs.dto.StScheduleSchemeDTO;
+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 com.iailab.module.model.enums.ScheduleTriggerMethodEnum;
+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 org.springframework.util.CollectionUtils;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 蒸汽评价指标(汽耗率)
+ *
+ * @author Jay
+ */
+@Component("runSteamEvaluationConsumptionTask")
+public class RunSteamEvaluationConsumptionTask implements ITask {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private McsApi mcsApi;
+
+    @Autowired
+    private MdkApi mdkApi;
+
+    @Override
+    public void run(String params) {
+        logger.info("RunSteamEvaluationConsumptionTask,参数为:{}", params);
+        try {
+            Calendar calendar = Calendar.getInstance();
+            calendar.set(Calendar.MILLISECOND, 0);
+            calendar.set(Calendar.SECOND, 0);
+            Date scheduleTime = calendar.getTime();
+            if (StringUtils.isEmpty(params)) {
+                logger.info("参数为空");
+                return;
+            }
+            // 根据条件查找方案
+            List<StScheduleSchemeDTO> schemeList = mcsApi.listScheduleScheme(ScheduleTriggerMethodEnum.JOB.getCode(), params);
+            if (CollectionUtils.isEmpty(schemeList)) {
+                logger.info("方案为空");
+                return;
+            }
+            for (StScheduleSchemeDTO scheme : schemeList) {
+                MdkScheduleReqDTO dto = new MdkScheduleReqDTO();
+                dto.setScheduleTime(scheduleTime);
+                dto.setScheduleCode(scheme.getCode());
+                MdkScheduleRespDTO mdkScheduleRespDTO = mdkApi.doSchedule(dto);
+                // 结果写入测点
+                mdkApi.scheduleModelOut(mdkScheduleRespDTO);
+            }
+            logger.info(params + "调度方案执行完成");
+        } catch (Exception ex) {
+            logger.error("RunSteamEvaluationConsumptionTask运行异常");
+            ex.printStackTrace();
+        }
+        logger.info("RunSteamEvaluationConsumptionTask运行完成");
+    }
+}
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunSteamEvaluationDiffuseTask.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunSteamEvaluationDiffuseTask.java
new file mode 100644
index 0000000..1332fbc
--- /dev/null
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunSteamEvaluationDiffuseTask.java
@@ -0,0 +1,67 @@
+package com.iailab.module.shasteel.job.task;
+
+import com.iailab.module.model.api.mcs.McsApi;
+import com.iailab.module.model.api.mcs.dto.StScheduleSchemeDTO;
+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 com.iailab.module.model.enums.ScheduleTriggerMethodEnum;
+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 org.springframework.util.CollectionUtils;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 蒸汽评价指标(放散、发电、吨钢)
+ * @author Jay
+ */
+@Component("runSteamEvaluationDiffuseTask")
+public class RunSteamEvaluationDiffuseTask implements ITask {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private McsApi mcsApi;
+
+    @Autowired
+    private MdkApi mdkApi;
+
+    @Override
+    public void run(String params) {
+        logger.info("RunSteamEvaluationDiffuseTask,参数为:{}", params);
+        try {
+            Calendar calendar = Calendar.getInstance();
+            calendar.set(Calendar.MILLISECOND, 0);
+            calendar.set(Calendar.SECOND, 0);
+            Date scheduleTime = calendar.getTime();
+            if (StringUtils.isEmpty(params)) {
+                logger.info("参数为空");
+                return;
+            }
+            // 根据条件查找方案
+            List<StScheduleSchemeDTO> schemeList = mcsApi.listScheduleScheme(ScheduleTriggerMethodEnum.JOB.getCode(), params);
+            if (CollectionUtils.isEmpty(schemeList)) {
+                logger.info("方案为空");
+                return;
+            }
+            for (StScheduleSchemeDTO scheme : schemeList) {
+                MdkScheduleReqDTO dto = new MdkScheduleReqDTO();
+                dto.setScheduleTime(scheduleTime);
+                dto.setScheduleCode(scheme.getCode());
+                MdkScheduleRespDTO mdkScheduleRespDTO = mdkApi.doSchedule(dto);
+                // 结果写入测点
+                mdkApi.scheduleModelOut(mdkScheduleRespDTO);
+            }
+            logger.info(params + "调度方案执行完成");
+        } catch (Exception ex) {
+            logger.error("RunSteamEvaluationSumTask运行异常");
+            ex.printStackTrace();
+        }
+        logger.info("RunSteamEvaluationSumTask运行完成");
+    }
+}
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunSteamEvaluationTotalTask.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunSteamEvaluationTotalTask.java
new file mode 100644
index 0000000..9649fe6
--- /dev/null
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunSteamEvaluationTotalTask.java
@@ -0,0 +1,67 @@
+package com.iailab.module.shasteel.job.task;
+
+import com.iailab.module.model.api.mcs.McsApi;
+import com.iailab.module.model.api.mcs.dto.StScheduleSchemeDTO;
+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 com.iailab.module.model.enums.ScheduleTriggerMethodEnum;
+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 org.springframework.util.CollectionUtils;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 蒸汽评价指标(总界面用)
+ * @author Jay
+ */
+@Component("runSteamEvaluationTotalTask")
+public class RunSteamEvaluationTotalTask implements ITask {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private McsApi mcsApi;
+
+    @Autowired
+    private MdkApi mdkApi;
+
+    @Override
+    public void run(String params) {
+        logger.info("RunSteamEvaluationTotalTask,参数为:{}", params);
+        try {
+            Calendar calendar = Calendar.getInstance();
+            calendar.set(Calendar.MILLISECOND, 0);
+            calendar.set(Calendar.SECOND, 0);
+            Date scheduleTime = calendar.getTime();
+            if (StringUtils.isEmpty(params)) {
+                logger.info("参数为空");
+                return;
+            }
+            // 根据条件查找方案
+            List<StScheduleSchemeDTO> schemeList = mcsApi.listScheduleScheme(ScheduleTriggerMethodEnum.JOB.getCode(), params);
+            if (CollectionUtils.isEmpty(schemeList)) {
+                logger.info("方案为空");
+                return;
+            }
+            for (StScheduleSchemeDTO scheme : schemeList) {
+                MdkScheduleReqDTO dto = new MdkScheduleReqDTO();
+                dto.setScheduleTime(scheduleTime);
+                dto.setScheduleCode(scheme.getCode());
+                MdkScheduleRespDTO mdkScheduleRespDTO = mdkApi.doSchedule(dto);
+                // 结果写入测点
+                mdkApi.scheduleModelOut(mdkScheduleRespDTO);
+            }
+            logger.info(params + "调度方案执行完成");
+        } catch (Exception ex) {
+            logger.error("RunSteamEvaluationTotalTask运行异常");
+            ex.printStackTrace();
+        }
+        logger.info("RunSteamEvaluationTotalTask运行完成");
+    }
+}

--
Gitblit v1.9.3