| | |
| | | |
| | | @Slf4j |
| | | @Component |
| | | //@ConditionalOnProperty(prefix = "app", name = "rabbit-consumer", havingValue = "true") |
| | | @ConditionalOnProperty(prefix = "app", name = "websocket-job", havingValue = "true") |
| | | public class ChatConsumer { |
| | | |
| | | @Autowired |
| | |
| | | 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_ONE); |
| | | from.setMemberId(fromId); |
| | | from.setTargetId(toId); |
| | | from.setIsRead(OtcMsgUserListEntity.ISREAD_TWO); |
| | | from.setLastMsgTime(new Date()); |
| | | otcMsgUserListDao.insert(from); |
| | | } else { |
| | | fromList.setLastMsgTime(new Date()); |
| | | otcMsgUserListDao.updateById(fromList); |
| | | } |
| | | |
| | | // 收件人是否存在聊天框 |
| | |
| | | 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 { |