소스 검색

解决bug 消息(提测0401):消息搜索,输入律师姓名查询不到和律师的聊天记录

liudongzhi 1 주 전
부모
커밋
8707b9efca

+ 10 - 3
alien-store/src/main/java/shop/alien/store/controller/LifeMessageController.java

@@ -27,11 +27,18 @@ public class LifeMessageController {
 
     @ApiOperation("消息列表")
     @ApiOperationSupport(order = 1)
-    @ApiImplicitParams({@ApiImplicitParam(name = "receiverId", value = "当前登录人", dataType = "String", paramType = "query"), @ApiImplicitParam(name = "friendType", value = "聊天类型  0-搜索 1-聊过 2-未聊过", dataType = "Integer", paramType = "query"), @ApiImplicitParam(name = "search", value = "搜索字段", dataType = "Integer", paramType = "query")})
+    @ApiImplicitParams(
+            {
+                    @ApiImplicitParam(name = "receiverId", value = "当前登录人", dataType = "String", paramType = "query"),
+                    @ApiImplicitParam(name = "friendType", value = "聊天类型  0-搜索 1-聊过 2-未聊过", dataType = "Integer", paramType = "query"),
+                    @ApiImplicitParam(name = "userName", value = "用户名", dataType = "String", paramType = "query"),
+                    @ApiImplicitParam(name = "search", value = "搜索字段", dataType = "Integer", paramType = "query")
+            }
+                      )
     @GetMapping("/getMessageList")
-    public R<List<LifeMessageVo>> getMessageList(@RequestParam String receiverId, @RequestParam int friendType, String search) throws Exception {
+    public R<List<LifeMessageVo>> getMessageList(@RequestParam String receiverId, @RequestParam int friendType, String search, String userName) throws Exception {
         log.info("LifeMessageController.getMessageList?receiverId={}, friendType={}, search={}", receiverId, friendType, search);
-        return R.data(lifeMessageService.getMessageList(receiverId, friendType, search));
+        return R.data(lifeMessageService.getMessageList(receiverId, friendType, search, userName));
     }
 
     @ApiOperation("未读消息与通知数量")

+ 1 - 1
alien-store/src/main/java/shop/alien/store/service/LifeMessageService.java

@@ -11,7 +11,7 @@ import java.util.List;
 
 public interface LifeMessageService extends IService<LifeMessage> {
 
-    List<LifeMessageVo> getMessageList(String receiverId, int friendType, String search) throws Exception;
+    List<LifeMessageVo> getMessageList(String receiverId, int friendType, String search,String userName) throws Exception;
 
     LifeMessageVo getStrangerMessageNum(String receiverId) throws Exception ;
 

+ 5 - 1
alien-store/src/main/java/shop/alien/store/service/impl/LifeMessageServiceImpl.java

@@ -48,7 +48,7 @@ public class LifeMessageServiceImpl extends ServiceImpl<LifeMessageMapper, LifeM
     private final LawyerConsultationOrderMapper lawyerConsultationOrderMapper;
 
     @Override
-    public List<LifeMessageVo> getMessageList(String receiverId, int friendType, String search) throws Exception {
+    public List<LifeMessageVo> getMessageList(String receiverId, int friendType, String search ,String userName) throws Exception {
         try {
             if (receiverId == null) {
                 return new ArrayList<>();
@@ -191,7 +191,11 @@ public class LifeMessageServiceImpl extends ServiceImpl<LifeMessageMapper, LifeM
                     lifeMessagePageResultList.add(messageVo);
                 }
             }
+            if (userName == null){
+                return lifeMessagePageResultList;
+            }
 
+            lifeMessagePageResultList = lifeMessagePageResultList.stream().filter(item -> item.getUserName().contains(userName)).collect(Collectors.toList());
             return lifeMessagePageResultList;
         } catch (Exception e) {
             log.error("LifeMessageServiceImpl.getMessageList Error Mgs={}", e.getMessage());