From c9ff6a7f2e89f751e2eec68ec02fa93919d05296 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期三, 11 十二月 2024 13:56:59 +0800 Subject: [PATCH] 监听报警信息 --- shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunPredictModuleTask.java | 13 ++++++------- 1 files changed, 6 insertions(+), 7 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 9306023..4675dd5 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,7 +3,7 @@ import com.iailab.module.model.api.mdk.MdkApi; import com.iailab.module.model.api.mdk.dto.MdkPredictModuleRespDTO; import com.iailab.module.model.api.mdk.dto.MdkPredictReqDTO; -import com.iailab.module.shasteel.mq.consumer.PredictFinishMessage; +import com.iailab.module.shasteel.mq.common.RoutingConstant; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.amqp.rabbit.core.RabbitTemplate; @@ -14,7 +14,6 @@ /** * 执行模块预测定时任务 - * */ @Component("runPredictModuleTask") public class RunPredictModuleTask implements ITask { @@ -22,24 +21,24 @@ @Autowired private MdkApi mdkApi; + @Autowired private RabbitTemplate rabbitTemplate; - @Override public void run(String params) { - logger.info("runPredictModuleTask定时任务正在执行,参数为:{}",params ); + logger.info("runPredictModuleTask定时任务正在执行,参数为:{}", params); try { Calendar calendar = Calendar.getInstance(); - calendar.set(Calendar.SECOND,0); - calendar.set(Calendar.MILLISECOND,0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); MdkPredictReqDTO dto = new MdkPredictReqDTO(); dto.setPredictTime(calendar.getTime()); dto.setModuleType(params); MdkPredictModuleRespDTO mdkPredictModuleRespDTO = mdkApi.predictModule(dto); logger.info(params + "模块预测完成," + mdkPredictModuleRespDTO); - rabbitTemplate.convertAndSend(PredictFinishMessage.EXCHANGE, PredictFinishMessage.PREDICTFINISH_ROUTING_KEY, mdkPredictModuleRespDTO); + rabbitTemplate.convertAndSend(RoutingConstant.EXCHANGE, RoutingConstant.Iailab_Model_PredictFinish, mdkPredictModuleRespDTO); } catch (Exception ex) { logger.error("runPredictModuleTask运行异常"); -- Gitblit v1.9.3