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; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; 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.*; /** * @description: * @author: dyk * @date: 2025/2/13 17:28 **/ @Slf4j @Component public class ModelLDGPredictFinishConsumer { @Resource private McsApi mcsApi; @Resource private MdkApi mdkApi; /** * 监听转炉预测完成,执行转炉调度 * * @param message */ @RabbitListener(queues = QueuePredictFinishConfig.QUEUE_NAME_LDG) public void listen(Message message) { String messageBody = new String(message.getBody()); log.info("开始执行转炉调度,messageBody:" + messageBody); // 查找需要执行的转炉调度方案 List scheduleSchemeList = mcsApi.listScheduleScheme(ScheduleTriggerMethodEnum.EVENT.getCode(), CommonConstant.NET_LDG); // 转炉预测完成,执行转炉调度模型 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); MdkScheduleRespDTO mdkScheduleRespDTO = mdkApi.doSchedule(mdkScheduleReqDTO); //转炉调度下发 mdkApi.scheduleModelOut(mdkScheduleRespDTO); } } }