From 6a713bf32263bbda52cb1fb3b5274c92e56647ae Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期六, 18 一月 2025 13:33:59 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunSteamEvaluationConsumptionTask.java |   68 +++++++++++
 shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelPredictFinish2Consumer.java    |    6 
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunPredictModuleTask.java              |    5 
 shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelAlarmConsumer.java             |    9 +
 shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/common/constant/RoutingConstant.java         |    2 
 shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/config/QueueElecPredictFinishConfig.java     |   36 ++++++
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunSteamEvaluationDiffuseTask.java     |   67 +++++++++++
 shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelElecPredictFinishConsumer.java |   62 ++++++++++
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunSteamEvaluationTotalTask.java       |   67 +++++++++++
 shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/common/constant/CommonConstant.java          |    3 
 10 files changed, 323 insertions(+), 2 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
index 9365cfc..a99a554 100644
--- 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
@@ -3,6 +3,7 @@
 import com.iailab.framework.common.util.date.DateUtils;
 import com.iailab.module.model.api.mdk.MdkApi;
 import com.iailab.module.model.api.mdk.dto.MdkPredictReqDTO;
+import com.iailab.module.shasteel.mq.common.constant.CommonConstant;
 import com.iailab.module.shasteel.mq.common.constant.RoutingConstant;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -55,6 +56,10 @@
                 msg.put("moduleType", type);
                 msg.put("predictTime", DateUtils.format(predictTime, DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND));
                 rabbitTemplate.convertAndSend(RoutingConstant.EXCHANGE, RoutingConstant.Iailab_Model_PredictFinish, msg);
+                if (type.equals(CommonConstant.TRIGGER_CONDITION_ELEC)) {
+                    //电力管网预测完成发送单独消息,执行电力调度
+                    rabbitTemplate.convertAndSend(RoutingConstant.EXCHANGE, RoutingConstant.Iailab_Model_PredictFinish_Elec, msg);
+                }
             });
         } catch (Exception ex) {
             logger.error("runPredictModuleTask运行异常");
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运行完成");
+    }
+}
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/common/constant/CommonConstant.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/common/constant/CommonConstant.java
index f2b97e5..025a4de 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/common/constant/CommonConstant.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/common/constant/CommonConstant.java
@@ -25,4 +25,7 @@
 
     //超下限
     String EXCEEDING_LOWER_LIMIT = "LowerLimit";
+
+    //电力管网触发条件
+    String TRIGGER_CONDITION_ELEC = "NET_ELE";
 }
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/common/constant/RoutingConstant.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/common/constant/RoutingConstant.java
index fa56dfe..c639c4b 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/common/constant/RoutingConstant.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/common/constant/RoutingConstant.java
@@ -6,6 +6,8 @@
 
     // 预测模型完成路由
     String Iailab_Model_PredictFinish = "Iailab.Model.PredictFinish";
+    // 电力预测模型完成路由
+    String Iailab_Model_PredictFinish_Elec = "Iailab.Model.PredictFinish.Elec";
 
     //预警消息路由
     String Iailab_Model_Alarm = "Iailab.Model.Alarm";
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/config/QueueElecPredictFinishConfig.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/config/QueueElecPredictFinishConfig.java
new file mode 100644
index 0000000..693ca8d
--- /dev/null
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/config/QueueElecPredictFinishConfig.java
@@ -0,0 +1,36 @@
+package com.iailab.module.shasteel.mq.config;
+
+import com.iailab.module.shasteel.mq.common.constant.RoutingConstant;
+import org.springframework.amqp.core.Binding;
+import org.springframework.amqp.core.BindingBuilder;
+import org.springframework.amqp.core.Queue;
+import org.springframework.amqp.core.TopicExchange;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * @description: 电力预测完成消息队列
+ * @author: dzd
+ * @date: 2025/1/17 17:38
+ **/
+@Configuration
+public class QueueElecPredictFinishConfig {
+    // 队列名称
+    public final static String QUEUE_NAME = "IaiabFastShateel.Model.PredictFinish.Elec";
+
+    @Bean
+    public Queue predictFinishQueue() {
+        return new Queue(QueueElecPredictFinishConfig.QUEUE_NAME);
+    }
+
+    @Bean
+    TopicExchange predictFinishExchange() {
+        return new TopicExchange(RoutingConstant.EXCHANGE);
+    }
+
+    // 注意通配符*和#的用法
+    @Bean
+    Binding bindingExchangeMessagePF() {
+        return BindingBuilder.bind(predictFinishQueue()).to(predictFinishExchange()).with(RoutingConstant.Iailab_Model_PredictFinish_Elec);
+    }
+}
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelAlarmConsumer.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelAlarmConsumer.java
index b7f0e18..846333f 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelAlarmConsumer.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelAlarmConsumer.java
@@ -86,30 +86,35 @@
                         if ("faAdvice".equals(key) && !"".equals(result.get("faAdvice").toString())) {
                             ScheduleSuggestRespDTO suggestRespDTO = new ScheduleSuggestRespDTO();
                             suggestRespDTO.setId(UUID.randomUUID().toString());
+                            suggestRespDTO.setScheduleObj(stScheduleSchemeDTO.getScheduleObj());
                             suggestRespDTO.setContent(result.get("faAdvice").toString());//法夜空建议送出量建议
                             suggestRespDTO.setSchemeId(stScheduleSchemeDTO.getId());
                             mcsApi.createScheduleSuggest(suggestRespDTO);
                         }else if ("yingDiAdvice".equals(key) && !"".equals(result.get("yingDiAdvice").toString())) {
                             ScheduleSuggestRespDTO suggestRespDTO = new ScheduleSuggestRespDTO();
                             suggestRespDTO.setId(UUID.randomUUID().toString());
+                            suggestRespDTO.setScheduleObj(stScheduleSchemeDTO.getScheduleObj());
                             suggestRespDTO.setContent(result.get("yingDiAdvice").toString());//盈德低压建议送出量建议
                             suggestRespDTO.setSchemeId(stScheduleSchemeDTO.getId());
                             mcsApi.createScheduleSuggest(suggestRespDTO);
                         }else if ("yingZhongAdvice".equals(key) && !"".equals(result.get("yingZhongAdvice").toString())) {
                             ScheduleSuggestRespDTO suggestRespDTO = new ScheduleSuggestRespDTO();
                             suggestRespDTO.setId(UUID.randomUUID().toString());
+                            suggestRespDTO.setScheduleObj(stScheduleSchemeDTO.getScheduleObj());
                             suggestRespDTO.setContent(result.get("yingZhongAdvice").toString());//盈德中压建议送出量建议
                             suggestRespDTO.setSchemeId(stScheduleSchemeDTO.getId());
                             mcsApi.createScheduleSuggest(suggestRespDTO);
                         }else if ("hongAdvice".equals(key) && !"".equals(result.get("hongAdvice").toString())) {
                             ScheduleSuggestRespDTO suggestRespDTO = new ScheduleSuggestRespDTO();
                             suggestRespDTO.setId(UUID.randomUUID().toString());
+                            suggestRespDTO.setScheduleObj(stScheduleSchemeDTO.getScheduleObj());
                             suggestRespDTO.setContent(result.get("hongAdvice").toString());//宏昌建议送出量建议
                             suggestRespDTO.setSchemeId(stScheduleSchemeDTO.getId());
                             mcsApi.createScheduleSuggest(suggestRespDTO);
                         }else if ("RunAdvice".equals(key) && !"".equals(result.get("RunAdvice").toString())) {
                             ScheduleSuggestRespDTO suggestRespDTO = new ScheduleSuggestRespDTO();
                             suggestRespDTO.setId(UUID.randomUUID().toString());
+                            suggestRespDTO.setScheduleObj(stScheduleSchemeDTO.getScheduleObj());
                             suggestRespDTO.setContent(result.get("RunAdvice").toString());//润忠建议送出量建议
                             suggestRespDTO.setSchemeId(stScheduleSchemeDTO.getId());
                             mcsApi.createScheduleSuggest(suggestRespDTO);
@@ -125,24 +130,28 @@
                         if ("yingdiAdvice".equals(key) && !"".equals(result.get("yingdiAdvice").toString())) {
                             ScheduleSuggestRespDTO suggestRespDTO = new ScheduleSuggestRespDTO();
                             suggestRespDTO.setId(UUID.randomUUID().toString());
+                            suggestRespDTO.setScheduleObj(stScheduleSchemeDTO.getScheduleObj());
                             suggestRespDTO.setContent(result.get("yingdiAdvice").toString());//盈德中压建议调整量建议
                             suggestRespDTO.setSchemeId(stScheduleSchemeDTO.getId());
                             mcsApi.createScheduleSuggest(suggestRespDTO);
                         }else if ("faAdvice".equals(key) && !"".equals(result.get("faAdvice").toString())) {
                             ScheduleSuggestRespDTO suggestRespDTO = new ScheduleSuggestRespDTO();
                             suggestRespDTO.setId(UUID.randomUUID().toString());
+                            suggestRespDTO.setScheduleObj(stScheduleSchemeDTO.getScheduleObj());
                             suggestRespDTO.setContent(result.get("faAdvice").toString());//法夜空建议调整量建议
                             suggestRespDTO.setSchemeId(stScheduleSchemeDTO.getId());
                             mcsApi.createScheduleSuggest(suggestRespDTO);
                         }else if ("hongAdvice".equals(key) && !"".equals(result.get("hongAdvice").toString())) {
                             ScheduleSuggestRespDTO suggestRespDTO = new ScheduleSuggestRespDTO();
                             suggestRespDTO.setId(UUID.randomUUID().toString());
+                            suggestRespDTO.setScheduleObj(stScheduleSchemeDTO.getScheduleObj());
                             suggestRespDTO.setContent(result.get("hongAdvice").toString());//宏昌建议调整量建议
                             suggestRespDTO.setSchemeId(stScheduleSchemeDTO.getId());
                             mcsApi.createScheduleSuggest(suggestRespDTO);
                         }else if ("RunAdvice".equals(key) && !"".equals(result.get("RunAdvice").toString())) {
                             ScheduleSuggestRespDTO suggestRespDTO = new ScheduleSuggestRespDTO();
                             suggestRespDTO.setId(UUID.randomUUID().toString());
+                            suggestRespDTO.setScheduleObj(stScheduleSchemeDTO.getScheduleObj());
                             suggestRespDTO.setContent(result.get("RunAdvice").toString());//润忠建议调整量建议
                             suggestRespDTO.setSchemeId(stScheduleSchemeDTO.getId());
                             mcsApi.createScheduleSuggest(suggestRespDTO);
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelElecPredictFinishConsumer.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelElecPredictFinishConsumer.java
new file mode 100644
index 0000000..c7da9d2
--- /dev/null
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelElecPredictFinishConsumer.java
@@ -0,0 +1,62 @@
+package com.iailab.module.shasteel.mq.consumer;
+
+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.enums.ScheduleTriggerMethodEnum;
+import com.iailab.module.shasteel.mq.common.constant.CommonConstant;
+import com.iailab.module.shasteel.mq.config.QueueElecPredictFinishConfig;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.core.Message;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @description:
+ * @author: dzd
+ * @date: 2025/1/17 17:41
+ **/
+@Slf4j
+@Component
+public class ModelElecPredictFinishConsumer {
+
+    @Resource
+    private McsApi mcsApi;
+
+    @Resource
+    private MdkApi mdkApi;
+
+    /**
+     * 监听电力预测完成,执行电力调度
+     *
+     * @param message
+     */
+    @RabbitListener(queues = QueueElecPredictFinishConfig.QUEUE_NAME)
+    public void listen(Message message) {
+        String messageBody = new String(message.getBody());
+        log.info("开始执行电力调度,messageBody:" + messageBody);
+        // 查找需要执行的电力调度方案
+        List<StScheduleSchemeDTO> scheduleSchemeList = mcsApi.listScheduleScheme(ScheduleTriggerMethodEnum.EVENT.getCode(), CommonConstant.TRIGGER_CONDITION_ELEC);
+        // 电力预测完成,执行电力调度模型
+        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);
+        Date scheduleTime = calendar.getTime();
+        for (StScheduleSchemeDTO stScheduleSchemeDTO : scheduleSchemeList) {
+            MdkScheduleReqDTO mdkScheduleReqDTO = new MdkScheduleReqDTO();
+            mdkScheduleReqDTO.setScheduleCode(stScheduleSchemeDTO.getCode());
+            mdkScheduleReqDTO.setScheduleTime(scheduleTime);
+            mdkApi.doSchedule(mdkScheduleReqDTO);
+        }
+
+
+    }
+}
\ No newline at end of file
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelPredictFinish2Consumer.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelPredictFinish2Consumer.java
index 0234ae1..10aa293 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelPredictFinish2Consumer.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelPredictFinish2Consumer.java
@@ -1,6 +1,5 @@
 package com.iailab.module.shasteel.mq.consumer;
 
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.iailab.framework.common.util.date.DateUtils;
 import com.iailab.module.model.api.mcs.McsApi;
@@ -20,7 +19,6 @@
 import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
@@ -83,12 +81,14 @@
                         }else if("dispatchStart".equals(key) && !"".equals(result.get("dispatchStart").toString())){
                             ScheduleSuggestRespDTO suggestRespDTO = new ScheduleSuggestRespDTO();
                             suggestRespDTO.setId(UUID.randomUUID().toString());
+                            suggestRespDTO.setScheduleObj(stScheduleSchemeDTO.getScheduleObj());
                             suggestRespDTO.setContent(result.get("dispatchStart").toString());//空压机启动调度建议
                             suggestRespDTO.setSchemeId(stScheduleSchemeDTO.getId());
                             mcsApi.createScheduleSuggest(suggestRespDTO);
                         }else if("dispatchEnd".equals(key) && !"".equals(result.get("dispatchEnd").toString())){
                             ScheduleSuggestRespDTO suggestRespDTO = new ScheduleSuggestRespDTO();
                             suggestRespDTO.setId(UUID.randomUUID().toString());
+                            suggestRespDTO.setScheduleObj(stScheduleSchemeDTO.getScheduleObj());
                             suggestRespDTO.setContent(result.get("dispatchClose").toString());//空压机关停调度建议
                             suggestRespDTO.setSchemeId(stScheduleSchemeDTO.getId());
                             mcsApi.createScheduleSuggest(suggestRespDTO);
@@ -128,12 +128,14 @@
                         }else if ("jinfengAdvice".equals(key) && !"".equals(result.get("jinfengAdvice").toString())) {
                             ScheduleSuggestRespDTO suggestRespDTO = new ScheduleSuggestRespDTO();
                             suggestRespDTO.setId(UUID.randomUUID().toString());
+                            suggestRespDTO.setScheduleObj(stScheduleSchemeDTO.getScheduleObj());
                             suggestRespDTO.setContent(result.get("jinfengAdvice").toString());//锦丰调度建议
                             suggestRespDTO.setSchemeId(stScheduleSchemeDTO.getId());
                             mcsApi.createScheduleSuggest(suggestRespDTO);
                         }else if ("daxinAdvice".equals(key) && !"".equals(result.get("daxinAdvice").toString())) {
                             ScheduleSuggestRespDTO suggestRespDTO = new ScheduleSuggestRespDTO();
                             suggestRespDTO.setId(UUID.randomUUID().toString());
+                            suggestRespDTO.setScheduleObj(stScheduleSchemeDTO.getScheduleObj());
                             suggestRespDTO.setContent(result.get("daxinAdvice").toString());//大新调度建议
                             suggestRespDTO.setSchemeId(stScheduleSchemeDTO.getId());
                             mcsApi.createScheduleSuggest(suggestRespDTO);

--
Gitblit v1.9.3