|
@@ -4,9 +4,12 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.dragon.tj.portal.common.convert.mesage.MessageReqConvert;
|
|
|
+import com.dragon.tj.portal.common.convert.notice.NoticeReqConvert;
|
|
|
import com.dragon.tj.portal.common.dto.message.MessageInfoItem;
|
|
|
import com.dragon.tj.portal.common.dto.message.MessageInfoReq;
|
|
|
import com.dragon.tj.portal.common.dto.message.MessageInfoSend;
|
|
|
+import com.dragon.tj.portal.common.dto.notice.NoticeInfoReq;
|
|
|
+import com.dragon.tj.portal.common.dto.notice.NoticeInfoSend;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.MediaType;
|
|
@@ -33,6 +36,9 @@ public class MessageConsumer {
|
|
|
@Autowired
|
|
|
private MessageReqConvert messageReqConvert;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private NoticeReqConvert noticeReqConvert;
|
|
|
+
|
|
|
/**
|
|
|
* get client published message from kafka,process it according to the serverId
|
|
|
*
|
|
@@ -84,15 +90,15 @@ public class MessageConsumer {
|
|
|
log.error("kafka msg is empty, no process");
|
|
|
return;
|
|
|
}
|
|
|
- MessageInfoSend reqDTO;
|
|
|
+ NoticeInfoSend reqDTO;
|
|
|
try {
|
|
|
- reqDTO = JSONObject.parseObject(msg, MessageInfoSend.class);
|
|
|
+ reqDTO = JSONObject.parseObject(msg, NoticeInfoSend.class);
|
|
|
} catch (Exception e) {
|
|
|
log.error("parsing string to obj failed, msg={}, e={}", msg, e);
|
|
|
return;
|
|
|
}
|
|
|
Set<String> clientIds = reqDTO.getClientIds();
|
|
|
- MessageInfoReq messageInfoReq = reqDTO.getMessageInfoReq();
|
|
|
+ NoticeInfoReq noticeInfoReq = reqDTO.getNoticeInfoReq();
|
|
|
|
|
|
for (String clientId : clientIds) {
|
|
|
OpenApiSseEmitter emitter = sseEmitters.get(clientId);
|
|
@@ -101,7 +107,7 @@ public class MessageConsumer {
|
|
|
continue;
|
|
|
}
|
|
|
try {
|
|
|
- MessageInfoItem messageInfoItem = messageReqConvert.reqToItem(messageInfoReq);
|
|
|
+ MessageInfoItem messageInfoItem = noticeReqConvert.reqToItem(noticeInfoReq);
|
|
|
messageInfoItem.setClientId(clientId);
|
|
|
|
|
|
String sendMsg = JSON.toJSONString(messageInfoItem);
|