| | |
| | | public IPage<MsgListVo> getMsgList(MsgListDto msgListDto) { |
| | | MemberEntity member = LoginUserUtils.getAppLoginUser(); |
| | | Long memberId = member.getId(); |
| | | // Long memberId = 444L; |
| | | // Long memberId = 445L; |
| | | Page<MsgListVo> page = new Page<>(msgListDto.getPageNum(), msgListDto.getPageSize()); |
| | | |
| | | OtcMsgUserListEntity otcMsgUserListEntity = new OtcMsgUserListEntity(); |
| | | otcMsgUserListEntity.setMemberId(memberId); |
| | | return otcMsgUserListDao.getMsgList(otcMsgUserListEntity, page); |
| | | IPage<MsgListVo> msgList = otcMsgUserListDao.getMsgList(otcMsgUserListEntity, page); |
| | | List<MsgListVo> records = msgList.getRecords(); |
| | | if(CollUtil.isNotEmpty(records)){ |
| | | for(MsgListVo msgListVo : records){ |
| | | long targetId = msgListVo.getTargetId(); |
| | | if(memberId == targetId){ |
| | | MemberEntity memberEntity = memberDao.selectById(msgListVo.getMemberId()); |
| | | msgListVo.setNickname(memberEntity.getName()); |
| | | }else{ |
| | | MemberEntity memberEntity = memberDao.selectById(targetId); |
| | | msgListVo.setNickname(memberEntity.getName()); |
| | | } |
| | | } |
| | | } |
| | | return msgList; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public Result getChatBox(ChatBoxDto chatBoxDto) { |
| | | MemberEntity member = LoginUserUtils.getAppLoginUser(); |
| | | // MemberEntity member = memberDao.selectById(444L); |
| | | //对话是否存在 |
| | | long id = chatBoxDto.getId(); |
| | | if(ObjectUtil.isEmpty(id)){ |
| | |
| | | otcMsgHistoryEntity.setMemberId(memberId); |
| | | otcMsgHistoryEntity.setTargetId(targetId); |
| | | IPage<ChatBoxVo> chatBoxVos= otcMsgHistoryDao.getChatBoxMsgList(page,otcMsgHistoryEntity); |
| | | List<ChatBoxVo> records = chatBoxVos.getRecords(); |
| | | if(CollUtil.isNotEmpty(records)){ |
| | | for(ChatBoxVo chatBoxVo : records){ |
| | | long memberIds = chatBoxVo.getMemberId(); |
| | | if(memberIds == member.getId()){ |
| | | chatBoxVo.setIsSelf(1); |
| | | }else{ |
| | | chatBoxVo.setIsSelf(2); |
| | | } |
| | | } |
| | | } |
| | | return Result.ok(chatBoxVos); |
| | | } |
| | | |