聊天会话记录

This commit is contained in:
2023-09-28 20:27:54 +08:00
parent 1459ec3656
commit 7aa2e17897
20 changed files with 95 additions and 142 deletions

View File

@@ -17,7 +17,6 @@ import java.util.List;
public class WebSocketMessageDecoder extends MessageToMessageDecoder<BinaryWebSocketFrame> {
@Override
protected void decode(ChannelHandlerContext ctx, BinaryWebSocketFrame msg, List<Object> out) throws Exception {
System.out.println("ws解码器收到信息");
ByteBuf content = msg.content();
if (content.readableBytes() < 28) {

View File

@@ -37,8 +37,10 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
@@ -49,4 +51,4 @@
</build>
</project>
</project>

View File

@@ -2,13 +2,16 @@ package com.lld.im.common.model;
import lombok.Data;
import java.io.Serializable;
/**
* @description:
* @author: lld
* @version: 1.0
*/
@Data
public class RequestBase {
public class RequestBase implements Serializable {
private static final long serialVersionUID = 1L;
private Integer appId;
private String operater;

View File

@@ -8,10 +8,12 @@ import lombok.Data;
**/
@Data
public class SyncReq extends RequestBase {
private static final long serialVersionUID = 1L;
//客户端最大seq
private Long lastSequence;
//一次拉取多少
private Integer maxLimit;
private String operater;
}

View File

@@ -9,9 +9,7 @@ import com.lld.im.service.group.model.req.ImportGroupReq;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* @description:
@@ -43,12 +41,8 @@ public class ConversationController {
}
@RequestMapping("/syncConversationList")
public ResponseVO syncFriendShipList(@RequestBody @Validated SyncReq req, Integer appId) {
public ResponseVO syncFriendShipList(@RequestBody @Validated SyncReq req,Integer appId) {
req.setAppId(appId);
log.info("&&&&&&&&&&&&&&&&&&&&&&&&&&&");
log.info(req.toString());
log.info(appId.toString());
log.info("&&&&&&&&&&&&&&&&&&&&&&&&&&&");
return conversationService.syncConversationSet(req);
}

View File

@@ -22,6 +22,7 @@ import com.lld.im.service.friendship.dao.ImFriendShipEntity;
import com.lld.im.service.seq.RedisSeq;
import com.lld.im.service.utils.MessageProducer;
import com.lld.im.service.utils.WriteUserSeq;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -33,6 +34,7 @@ import java.util.List;
* @author: lld
* @version: 1.0
*/
@Slf4j
@Service
public class ConversationService {
@@ -178,6 +180,12 @@ public class ConversationService {
queryWrapper.eq("app_id",req.getAppId());
queryWrapper.last(" limit " + req.getMaxLimit());
queryWrapper.orderByAsc("sequence");
log.info("============================= syncConversationSet ========================");
log.info("============================= syncConversationSet ========================");
log.info("============================= syncConversationSet ========================");
log.info(req.toString());
List<ImConversationSetEntity> list = imConversationSetMapper
.selectList(queryWrapper);

View File

@@ -1,6 +1,7 @@
package com.lld.im.service.friendship.controller;
import com.lld.im.common.ResponseVO;
import com.lld.im.common.model.SyncReq;
import com.lld.im.service.friendship.model.req.*;
import com.lld.im.service.friendship.service.ImFriendService;
import lombok.extern.slf4j.Slf4j;
@@ -85,5 +86,11 @@ public class ImFriendShipController {
return imFriendShipService.checkBlck(req);
}
@RequestMapping("/syncFriendshipList")
public ResponseVO syncFriendshipList(@RequestBody @Validated
SyncReq req, Integer appId){
req.setAppId(appId);
return imFriendShipService.syncFriendshipList(req);
}
}

View File

@@ -1,10 +1,12 @@
package com.lld.im.service.interceptor;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.lld.im.common.BaseErrorCode;
import com.lld.im.common.ResponseVO;
import com.lld.im.common.enums.GateWayErrorCode;
import com.lld.im.common.exception.ApplicationExceptionEnum;
import com.lld.im.common.model.RequestBase;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -13,7 +15,10 @@ import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.ws.RequestWrapper;
import java.io.PrintWriter;
import java.util.Enumeration;
import java.util.List;
/**
* @description:
@@ -34,9 +39,7 @@ public class GateWayInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// if (1 == 1){
// return true;
// }
//获取appId 操作人 userSign
String appIdStr = request.getParameter("appId");
@@ -71,6 +74,7 @@ public class GateWayInterceptor implements HandlerInterceptor {
return false;
}
return true;
}

View File

@@ -1,7 +1,7 @@
package com.lld.im.service.interceptor;
/**
* @author: Chackylee
* @author: rowger
* @description:
**/
public class RequestHolder {