From 7236be66852b4ac245e9c1ddb2dd3d591fcd3941 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Mon, 31 May 2021 10:53:24 +0800
Subject: [PATCH] modify
---
src/main/java/com/xcong/excoin/rabbit/consumer/ChatConsumer.java | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 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 0507e7b..b568d96 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;
@@ -23,7 +24,7 @@
@Slf4j
@Component
-//@ConditionalOnProperty(prefix = "app", name = "rabbit-consumer", havingValue = "true")
+@ConditionalOnProperty(prefix = "app", name = "websocekt-job", havingValue = "true")
public class ChatConsumer {
@Autowired
@@ -34,6 +35,9 @@
@Autowired
private RedisUtils redisUtils;
+
+ @Autowired
+ private MemberSettingDao memberSettingDao;
@RabbitListener(queues = RabbitMqConfig.QUEUE_MSG_HISTORY)
@Transactional(rollbackFor = Exception.class)
@@ -48,9 +52,9 @@
OtcMsgUserListEntity fromList = otcMsgUserListDao.selectChatListByToAndFrom(toId, fromId);
if (fromList == null) {
OtcMsgUserListEntity from = new OtcMsgUserListEntity();
- from.setMemberId(toId);
- from.setTargetId(fromId);
- from.setIsRead(OtcMsgUserListEntity.ISREAD_ONE);
+ from.setMemberId(fromId);
+ from.setTargetId(toId);
+ from.setIsRead(OtcMsgUserListEntity.ISREAD_TWO);
from.setLastMsgTime(new Date());
otcMsgUserListDao.insert(from);
}
@@ -61,7 +65,7 @@
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);
} else {
@@ -91,6 +95,8 @@
fromHistory.setIsSelf(OtcMsgHistoryEntity.ISSELF_ONE);
fromHistory.setMemberId(fromId);
+ memberSettingDao.updateMessageReminderByMemberId(toId);
+
otcMsgHistoryDao.insert(fromHistory);
otcMsgHistoryDao.insert(toHistory);
}
--
Gitblit v1.9.1