|
@@ -5,11 +5,11 @@ 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 com.dragon.tj.portal.common.enums.message.MsgRecordTypeEnum;
|
|
|
+import com.dragon.tj.portal.entity.MessageInfo;
|
|
|
+import com.dragon.tj.portal.entity.NoticeInfo;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.MediaType;
|
|
@@ -60,7 +60,7 @@ public class MessageConsumer {
|
|
|
return;
|
|
|
}
|
|
|
Set<String> clientIds = reqDTO.getClientIds();
|
|
|
- MessageInfoReq messageInfoReq = reqDTO.getMessageInfoReq();
|
|
|
+ MessageInfo messageInfo = reqDTO.getMessageInfo();
|
|
|
|
|
|
for (String clientId : clientIds) {
|
|
|
OpenApiSseEmitter emitter = sseEmitters.get(clientId);
|
|
@@ -69,10 +69,10 @@ public class MessageConsumer {
|
|
|
continue;
|
|
|
}
|
|
|
try {
|
|
|
- MessageInfoItem messageInfoItem = messageReqConvert.reqToItem(messageInfoReq);
|
|
|
- messageInfoItem.setClientId(clientId);
|
|
|
+ messageInfo.setClientId(clientId);
|
|
|
+ messageInfo.setRecordType(MsgRecordTypeEnum.MESSAGE.value());
|
|
|
|
|
|
- String sendMsg = JSON.toJSONString(messageInfoItem);
|
|
|
+ String sendMsg = JSON.toJSONString(messageInfo);
|
|
|
|
|
|
log.info("send sse msg={} to clientId={}", sendMsg, clientId);
|
|
|
emitter.send(sendMsg, MediaType.APPLICATION_JSON);
|
|
@@ -98,7 +98,7 @@ public class MessageConsumer {
|
|
|
return;
|
|
|
}
|
|
|
Set<String> clientIds = reqDTO.getClientIds();
|
|
|
- NoticeInfoReq noticeInfoReq = reqDTO.getNoticeInfoReq();
|
|
|
+ NoticeInfo noticeInfo = reqDTO.getNoticeInfo();
|
|
|
|
|
|
for (String clientId : clientIds) {
|
|
|
OpenApiSseEmitter emitter = sseEmitters.get(clientId);
|
|
@@ -107,10 +107,10 @@ public class MessageConsumer {
|
|
|
continue;
|
|
|
}
|
|
|
try {
|
|
|
- MessageInfoItem messageInfoItem = noticeReqConvert.reqToItem(noticeInfoReq);
|
|
|
- messageInfoItem.setClientId(clientId);
|
|
|
+ noticeInfo.setClientId(clientId);
|
|
|
+ noticeInfo.setRecordType(MsgRecordTypeEnum.NOTICE.value());
|
|
|
|
|
|
- String sendMsg = JSON.toJSONString(messageInfoItem);
|
|
|
+ String sendMsg = JSON.toJSONString(noticeInfo);
|
|
|
|
|
|
log.info("send sse msg={} to clientId={}", sendMsg, clientId);
|
|
|
emitter.send(sendMsg, MediaType.APPLICATION_JSON);
|