|
@@ -2,8 +2,11 @@ package com.ruoyi.framework.webSocket;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
+import com.ruoyi.generator.domain.Community.CommunityReturnRecord;
|
|
|
+import com.ruoyi.generator.service.ICommunityReturnRecordService;
|
|
|
import com.ruoyi.system.domain.CommunityChatMsg;
|
|
|
import com.ruoyi.system.service.ICommunityChatMsgService;
|
|
|
import io.netty.util.HashedWheelTimer;
|
|
@@ -69,11 +72,18 @@ public class WebSocketServer {
|
|
|
|
|
|
public static ICommunityChatMsgService chatMsgService;
|
|
|
|
|
|
+ public static ICommunityReturnRecordService returnRecordService;
|
|
|
+
|
|
|
@Autowired
|
|
|
public void setChatMsgService(ICommunityChatMsgService chatMsgService) {
|
|
|
WebSocketServer.chatMsgService = chatMsgService;
|
|
|
}
|
|
|
|
|
|
+ @Autowired
|
|
|
+ public void setReturnRecordService(ICommunityReturnRecordService returnRecordService) {
|
|
|
+ WebSocketServer.returnRecordService = returnRecordService;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 连接建立成功调用的方法
|
|
|
*/
|
|
@@ -253,6 +263,26 @@ public class WebSocketServer {
|
|
|
if (type.equals(MessageType.ANONYMOUS.getType())) {
|
|
|
chatMsg.setSenderAnonName(jsonObject.getString("senderAnonName"));
|
|
|
chatMsg.setReceiverAnonName(jsonObject.getString("receiverAnonName"));
|
|
|
+
|
|
|
+ //获取返图创建人用户id和返图接收人用户id
|
|
|
+ String returnCreateUserId = jsonObject.getString("returnCreateUserId");
|
|
|
+ String returnReceiveUserId = jsonObject.getString("returnReceiveUserId");
|
|
|
+ if (returnCreateUserId != null && returnReceiveUserId != null) {
|
|
|
+ //不为null时,则进行判断返图列表是否存在记录
|
|
|
+ CommunityReturnRecord returnRecord = returnRecordService.getOne(new QueryWrapper<CommunityReturnRecord>()
|
|
|
+ .eq("return_create_user_id", returnCreateUserId)
|
|
|
+ .eq("return_receive_user_id", returnReceiveUserId)
|
|
|
+ .eq("is_delete", false)
|
|
|
+ .eq("status", false));
|
|
|
+ if (returnRecord == null) {
|
|
|
+ CommunityReturnRecord communityReturnRecord = new CommunityReturnRecord();
|
|
|
+ communityReturnRecord.setReturnCreateUserId(Long.parseLong(returnCreateUserId));
|
|
|
+ communityReturnRecord.setReturnReceiveUserId(Long.parseLong(returnReceiveUserId));
|
|
|
+ communityReturnRecord.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
|
|
|
+ communityReturnRecord.setCreateBy(Long.parseLong(returnCreateUserId));
|
|
|
+ returnRecordService.save(communityReturnRecord);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
chatMsg.setCreateBy(senderId);
|
|
|
chatMsg.setSenderIsRead(true);
|