|
|
|
@ -4,6 +4,7 @@ import cn.estsh.i3plus.core.api.iservice.busi.IPersonnelService;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysMessageService;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysUserService;
|
|
|
|
|
import cn.estsh.i3plus.core.apiservice.websocket.MessageWebSocket;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.JsonUtilTool;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.StringTool;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
|
|
|
|
@ -12,6 +13,7 @@ import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysMessage;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysRefUserMessage;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysUser;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
import com.rabbitmq.client.Channel;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
@ -57,14 +59,15 @@ public class MessageLetterQueueReceiver {
|
|
|
|
|
/**
|
|
|
|
|
* 站内信处理队列
|
|
|
|
|
*
|
|
|
|
|
* @param msg
|
|
|
|
|
* @param data
|
|
|
|
|
* @param channel
|
|
|
|
|
* @param message 发送:rabbitTemplate.convertAndSend(I3CoreQueueConfig.IMPP_MESSAGE_QUEUE, new SysMessage(....));
|
|
|
|
|
*/
|
|
|
|
|
@RabbitListener(queues = PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE)
|
|
|
|
|
public void processImppMessage(SysMessage msg, Channel channel, Message message) {
|
|
|
|
|
LOGGER.info("【MQ-{}】 数据接收成功:{}", PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE, msg);
|
|
|
|
|
public void processImppMessage(String data, Channel channel, Message message) {
|
|
|
|
|
LOGGER.info("【MQ-{}】 数据接收成功:{}", PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE, data);
|
|
|
|
|
try {
|
|
|
|
|
SysMessage msg = JsonUtilTool.decode(data, SysMessage.class);
|
|
|
|
|
msg = sysMessageService.insertSysMessage(msg);
|
|
|
|
|
|
|
|
|
|
if (!StringUtils.isBlank(msg.getMessageReceiversId())) {
|
|
|
|
@ -110,7 +113,7 @@ public class MessageLetterQueueReceiver {
|
|
|
|
|
msg, message.getMessageProperties().getDeliveryTag());
|
|
|
|
|
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
printErrorMessage(e, Exception.class, msg);
|
|
|
|
|
printErrorMessage(e, Exception.class, data);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
// 未成功处理,重新发送
|
|
|
|
@ -121,7 +124,7 @@ public class MessageLetterQueueReceiver {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void printErrorMessage(Exception e, Class zlass, SysMessage msg) {
|
|
|
|
|
private void printErrorMessage(Exception e, Class zlass, String msg) {
|
|
|
|
|
Long time = System.currentTimeMillis();
|
|
|
|
|
LOGGER.error("【MQ-{}】{} 异常代码:{} 消息内容{},处理出错:{}", PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE, time, zlass, msg, e.getMessage());
|
|
|
|
|
e.printStackTrace();
|
|
|
|
@ -136,7 +139,7 @@ public class MessageLetterQueueReceiver {
|
|
|
|
|
sysMessage.setIsSystem(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
|
|
|
|
|
sysMessage.setMessageReceiverType(ImppEnumUtil.MESSAGE_RECEIVER_TYPE.EXTERNAL.getValue());
|
|
|
|
|
sysMessage.setMessageReceiversNameRdd("yunhao.wang@estsh.com,wei.peng@estsh.com");
|
|
|
|
|
rabbitTemplate.convertAndSend(PlatformConstWords.IMPP_MESSAGE_MAIL_QUEUE, sysMessage);
|
|
|
|
|
rabbitTemplate.convertAndSend(PlatformConstWords.IMPP_MESSAGE_MAIL_QUEUE, JSON.toJSONString(sysMessage));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|