From 0918083443d3920335c5b09a5d28e4f8d1bb3f45 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Thu, 27 May 2021 16:59:28 +0800 Subject: [PATCH] modify --- src/main/java/com/xcong/excoin/rabbit/consumer/ChatConsumer.java | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/xcong/excoin/rabbit/consumer/ChatConsumer.java b/src/main/java/com/xcong/excoin/rabbit/consumer/ChatConsumer.java index 4902736..fffc824 100644 --- a/src/main/java/com/xcong/excoin/rabbit/consumer/ChatConsumer.java +++ b/src/main/java/com/xcong/excoin/rabbit/consumer/ChatConsumer.java @@ -41,33 +41,33 @@ log.info("收到历史消息处理:{}", content); ChatRequest chat = JSONObject.parseObject(content, ChatRequest.class); - Long toId = Long.parseLong(chat.getTo()); - Long fromId = Long.parseLong(chat.getFrom()); + Long toId = chat.getTargetId(); + Long fromId = chat.getFromMemberId(); // 发送人是否存在聊天框 - OtcMsgUserListEntity fromList = otcMsgUserListDao.selectChatListByToAndFrom(Long.parseLong(chat.getTo()), Long.parseLong(chat.getFrom())); + OtcMsgUserListEntity fromList = otcMsgUserListDao.selectChatListByToAndFrom(toId, fromId); if (fromList == null) { OtcMsgUserListEntity from = new OtcMsgUserListEntity(); - from.setMemberId(Long.parseLong(chat.getFrom())); - from.setTargetId(Long.parseLong(chat.getTo())); + from.setMemberId(toId); + from.setTargetId(fromId); from.setIsRead(OtcMsgUserListEntity.ISREAD_TWO); from.setLastMsgTime(new Date()); otcMsgUserListDao.insert(from); } // 收件人是否存在聊天框 - OtcMsgUserListEntity toList = otcMsgUserListDao.selectChatListByToAndFrom(Long.parseLong(chat.getFrom()), Long.parseLong(chat.getTo())); + OtcMsgUserListEntity toList = otcMsgUserListDao.selectChatListByToAndFrom(fromId, toId); if (toList == null) { OtcMsgUserListEntity from = new OtcMsgUserListEntity(); - from.setMemberId(Long.parseLong(chat.getTo())); - from.setTargetId(Long.parseLong(chat.getFrom())); + from.setMemberId(toId); + from.setTargetId(fromId); from.setIsRead(OtcMsgUserListEntity.ISREAD_ONE); from.setLastMsgTime(new Date()); otcMsgUserListDao.insert(from); } else { // 收件人正在聊的用户 - String value = redisUtils.getString(AppContants.MSG_CHATTING + chat.getTo()); - if (StrUtil.isNotBlank(value) && value.equals(chat.getFrom())) { + String value = redisUtils.getString(AppContants.MSG_CHATTING + toId); + if (StrUtil.isNotBlank(value) && value.equals(fromId.toString())) { toList.setLastMsgTime(new Date()); otcMsgUserListDao.updateById(toList); } else { @@ -84,7 +84,7 @@ toHistory.setTargetId(toId); toHistory.setIsSelf(OtcMsgHistoryEntity.ISSELF_TWO); toHistory.setMsgType(chat.getMsgType()); - toHistory.setMsg(chat.getContent()); + toHistory.setMsg(chat.getMsg()); OtcMsgHistoryEntity fromHistory = new OtcMsgHistoryEntity(); BeanUtil.copyProperties(toHistory, fromHistory); -- Gitblit v1.9.1