沙钢智慧能源系统后端代码
dengzedong
2025-01-24 a47ffc425a7c297d9de9866eaf09ffbac4e39460
功率因数调度 保存调度建议
已修改1个文件
35 ■■■■ 文件已修改
shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelElecPredictFinishConsumer.java 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelElecPredictFinishConsumer.java
@@ -1,9 +1,11 @@
package com.iailab.module.shasteel.mq.consumer;
import com.iailab.module.model.api.mcs.McsApi;
import com.iailab.module.model.api.mcs.dto.ScheduleSuggestRespDTO;
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 com.iailab.module.shasteel.mq.common.constant.CommonConstant;
import com.iailab.module.shasteel.mq.config.QueuePredictFinishConfig;
@@ -13,9 +15,7 @@
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.*;
/**
 * @description:
@@ -31,6 +31,17 @@
    @Resource
    private MdkApi mdkApi;
    //功率因数调度 code
    private static final List<String> elecScheduleCodes = new ArrayList<String>(){{
        add("rejuandiaodu");
        add("leyangdiaodu");
        add("lengzhadiaodu");
        add("hailidiaodu");
        add("dongqudiaodu");
    }};
    private static final String adviceKey = "advice";
    /**
     * 监听电力预测完成,执行电力调度
@@ -54,7 +65,23 @@
            MdkScheduleReqDTO mdkScheduleReqDTO = new MdkScheduleReqDTO();
            mdkScheduleReqDTO.setScheduleCode(stScheduleSchemeDTO.getCode());
            mdkScheduleReqDTO.setScheduleTime(scheduleTime);
            mdkApi.doSchedule(mdkScheduleReqDTO);
            MdkScheduleRespDTO mdkScheduleRespDTO = mdkApi.doSchedule(mdkScheduleReqDTO);
            //功率因数调度 保存调度建议
            if (elecScheduleCodes.contains(stScheduleSchemeDTO.getCode())) {
                Map<String, Object> result = mdkScheduleRespDTO.getResult();
                if (result.containsKey(adviceKey)) {
                    String advice = result.get(adviceKey).toString();
                    ScheduleSuggestRespDTO suggest = new ScheduleSuggestRespDTO();
                    suggest.setTitle("电力调度建议");
                    suggest.setContent(advice);
                    suggest.setScheduleObj(stScheduleSchemeDTO.getScheduleObj());
                    suggest.setScheduleTime(scheduleTime);
                    suggest.setSort(0);
                    mcsApi.createScheduleSuggest(suggest);
                }
            }
        }