|
|
|
@ -2,11 +2,14 @@ package com.hnac.hzims.alarm.monitor.listener;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.hnac.hzims.alarm.entity.AlarmEntity; |
|
|
|
|
import com.hnac.hzims.alarm.handle.service.MessageService; |
|
|
|
|
import com.hnac.hzims.message.fegin.IMessageClient; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
|
import org.springblade.queue.annotation.RedisQueue; |
|
|
|
|
import org.springblade.queue.consume.IQueueConsume; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -18,11 +21,32 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
public class AlarmListener implements IQueueConsume { |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private RedisTemplate redisTemplate; |
|
|
|
|
private MessageService messageService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private StringRedisTemplate redisTemplate; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void handlerMessage(String message) { |
|
|
|
|
if(StringUtil.isEmpty(message)){ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// 步骤1.消息对象转换
|
|
|
|
|
AlarmEntity alarm = JSONObject.parseObject(message,AlarmEntity.class); |
|
|
|
|
log.error("handler_message_alarm : {}",alarm); |
|
|
|
|
|
|
|
|
|
// 步骤2.WEB/APP消息推送
|
|
|
|
|
if(alarm.getIsPlatformMessage() == 0){ |
|
|
|
|
messageService.webAppMessage(alarm); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 步骤3.短信推送
|
|
|
|
|
if(alarm.getIsShortMessage() == 0){ |
|
|
|
|
messageService.shortMessage(alarm); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 步骤4.微信公众号发送
|
|
|
|
|
if(alarm.getIsWxMessage() == 0){ |
|
|
|
|
messageService.weChatMessage(alarm); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |