From 7e70400b27b6922001766bd337741f451bd5af21 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Fri, 28 May 2021 15:58:28 +0800
Subject: [PATCH] modify

---
 src/main/java/com/xcong/excoin/rabbit/consumer/ChatConsumer.java |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 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 fffc824..6b78134 100644
--- a/src/main/java/com/xcong/excoin/rabbit/consumer/ChatConsumer.java
+++ b/src/main/java/com/xcong/excoin/rabbit/consumer/ChatConsumer.java
@@ -6,6 +6,7 @@
 import com.alibaba.fastjson.JSONObject;
 import com.xcong.excoin.common.contants.AppContants;
 import com.xcong.excoin.configurations.RabbitMqConfig;
+import com.xcong.excoin.modules.member.dao.MemberSettingDao;
 import com.xcong.excoin.modules.otc.dao.OtcMsgHistoryDao;
 import com.xcong.excoin.modules.otc.dao.OtcMsgUserListDao;
 import com.xcong.excoin.modules.otc.entity.OtcMsgHistoryEntity;
@@ -35,6 +36,9 @@
     @Autowired
     private RedisUtils redisUtils;
 
+    @Autowired
+    private MemberSettingDao memberSettingDao;
+
     @RabbitListener(queues = RabbitMqConfig.QUEUE_MSG_HISTORY)
     @Transactional(rollbackFor = Exception.class)
     public void msgHistoryConsumer(String content) {
@@ -44,13 +48,14 @@
         Long toId = chat.getTargetId();
         Long fromId = chat.getFromMemberId();
 
+        log.info("--->{}, {}", toId, fromId);
         // 发送人是否存在聊天框
         OtcMsgUserListEntity fromList = otcMsgUserListDao.selectChatListByToAndFrom(toId, fromId);
         if (fromList == null) {
             OtcMsgUserListEntity from = new OtcMsgUserListEntity();
             from.setMemberId(toId);
             from.setTargetId(fromId);
-            from.setIsRead(OtcMsgUserListEntity.ISREAD_TWO);
+            from.setIsRead(OtcMsgUserListEntity.ISREAD_ONE);
             from.setLastMsgTime(new Date());
             otcMsgUserListDao.insert(from);
         }
@@ -61,7 +66,7 @@
             OtcMsgUserListEntity from = new OtcMsgUserListEntity();
             from.setMemberId(toId);
             from.setTargetId(fromId);
-            from.setIsRead(OtcMsgUserListEntity.ISREAD_ONE);
+            from.setIsRead(OtcMsgUserListEntity.ISREAD_TWO);
             from.setLastMsgTime(new Date());
             otcMsgUserListDao.insert(from);
         } else {
@@ -71,7 +76,7 @@
                 toList.setLastMsgTime(new Date());
                 otcMsgUserListDao.updateById(toList);
             } else {
-                toList.setIsRead(OtcMsgUserListEntity.ISREAD_TWO);
+                toList.setIsRead(OtcMsgUserListEntity.ISREAD_ONE);
                 toList.setLastMsgTime(new Date());
                 otcMsgUserListDao.updateById(toList);
             }
@@ -91,6 +96,8 @@
         fromHistory.setIsSelf(OtcMsgHistoryEntity.ISSELF_ONE);
         fromHistory.setMemberId(fromId);
 
+        memberSettingDao.updateMessageReminderByMemberId(toId);
+
         otcMsgHistoryDao.insert(fromHistory);
         otcMsgHistoryDao.insert(toHistory);
     }

--
Gitblit v1.9.1