会议问题修复

This commit is contained in:
2025-12-30 20:55:01 +08:00
parent 5ce012000b
commit babfe9fb48

View File

@@ -67,6 +67,21 @@ public class ChatMessageListener implements MessageListener {
// 转发到聊天室列表订阅者,前端刷新列表状态 // 转发到聊天室列表订阅者,前端刷新列表状态
messagingTemplate.convertAndSend("/topic/chat/list-update", chatMessage); messagingTemplate.convertAndSend("/topic/chat/list-update", chatMessage);
logger.debug("列表更新已转发到STOMP: /topic/chat/list-update"); logger.debug("列表更新已转发到STOMP: /topic/chat/list-update");
// 同时转发到对应聊天室频道,确保聊天窗口也能收到消息
String roomId = chatMessage.getRoomId();
if (roomId != null && !roomId.isEmpty()) {
// 查询完整的VO数据
ChatRoomMessageVO messageVO = chatMessageMapper.selectChatMessageVOById(chatMessage.getMessageId());
if (messageVO != null) {
messagingTemplate.convertAndSend("/topic/chat/" + roomId, messageVO);
logger.debug("列表更新消息同时转发到聊天室: /topic/chat/{}", roomId);
} else {
// 如果查不到VO可能事务未提交直接用DTO转发
logger.warn("未找到消息VO使用DTO转发: messageId={}", chatMessage.getMessageId());
messagingTemplate.convertAndSend("/topic/chat/" + roomId, chatMessage);
}
}
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("处理Redis消息失败", e); logger.error("处理Redis消息失败", e);