From 3216ed3fb2d9dc9cf61da21bda3175e66ec46426 Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期五, 06 十二月 2024 17:04:11 +0800 Subject: [PATCH] IailabClient 配置 --- shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ScheduleConsumer.java | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 56 insertions(+), 0 deletions(-) diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ScheduleConsumer.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ScheduleConsumer.java new file mode 100644 index 0000000..78a2acb --- /dev/null +++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ScheduleConsumer.java @@ -0,0 +1,56 @@ +package com.iailab.module.shasteel.mq.consumer; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.iailab.module.model.api.mcs.McsApi; +import com.iailab.module.model.api.mcs.dto.AlarmMessageRespDTO; +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 org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author lirm + * @Description + * @createTime 2024年11月27日 + */ +@Component +@RabbitListener(queues = AlarmMessage.ALARM_ROUTING_KEY) +public class ScheduleConsumer { + + @Resource + private McsApi mcsApi; + + @Resource + private MdkApi mdkApi; + + @RabbitHandler + public void process(AlarmMessage alarmMessage) { + Map<String, Object> params = new HashMap<>(); + params.put("trigger_condition", AlarmMessage.ALARM_ROUTING_KEY); + List<StScheduleSchemeDTO> scheduleSchemeList = mcsApi.listScheduleScheme(params);//根据触发条件获取调度方案列表 + for(StScheduleSchemeDTO stScheduleSchemeDTO : scheduleSchemeList){ + MdkScheduleReqDTO mdkScheduleReqDTO = new MdkScheduleReqDTO(); + mdkScheduleReqDTO.setScheduleCode(stScheduleSchemeDTO.getCode()); + mdkScheduleReqDTO.setScheduleTime(stScheduleSchemeDTO.getScheduleTime()); +// MdkScheduleRespDTO mdkScheduleRespDTO = mdkApi.doSchedule(mdkScheduleReqDTO);//执行调度方案 +// String result = mdkScheduleRespDTO.getResult().toString(); +// System.out.println(result); +// AlarmMessageRespDTO alarmMessageRespDTO = new AlarmMessageRespDTO(); +// mcsApi.createAlarmMessage(alarmMessageRespDTO); + } +// AlarmMessageRespDTO alarmMessageRespDTO = alarmMessage.getAlarmMessageRespDTO(); +// JSONObject contentJson = JSONObject.parseObject(alarmMessageRespDTO.getContent()); +// String overLimitTime = contentJson.get("overLimitTime").toString(); + } +} -- Gitblit v1.9.3