Răsfoiți Sursa

代码优化一些

fangzhen 3 luni în urmă
părinte
comite
dd47d03371

+ 12 - 0
ruoyi-generator/src/main/java/com/ruoyi/generator/controller/CommunityChatMsgController.java

@@ -254,6 +254,18 @@ public class CommunityChatMsgController extends BaseController {
         if (returnRecords != null && !returnRecords.isEmpty()) {
             List<Long> returnIds = returnRecords.stream().map(CommunityReturnRecord::getId).collect(Collectors.toList());
             sysUserChatVos = communityChatMsgService.getChatListWithLatestMessage(userId, "anonymous", searchValue, returnIds);
+            if (!sysUserChatVos.isEmpty()) {
+                for (SysUserVo sysUserChatVo : sysUserChatVos) {
+                    CommunityReturnRecord returnRecord = communityReturnRecordService.getOne(new QueryWrapper<CommunityReturnRecord>().eq("id", sysUserChatVo.getReturnRecordId()));
+                    if (returnRecord != null) {
+                        if (sysUserChatVo.getSenderId().equals(returnRecord.getReturnCreateUserId())) {
+                            sysUserChatVo.setSenderNickName(returnRecord.getReturnCreateAnonName());
+                        } else {
+                            sysUserChatVo.setSenderNickName(returnRecord.getReturnReceiveAnonName());
+                        }
+                    }
+                }
+            }
         }
         return AjaxResult.success(sysUserChatVos);
     }