| | |
| | | import com.xcong.excoin.modules.otc.dao.OtcMsgHistoryDao; |
| | | import com.xcong.excoin.modules.otc.dao.OtcMsgUserListDao; |
| | | import com.xcong.excoin.modules.otc.dto.ChatBoxDto; |
| | | import com.xcong.excoin.modules.otc.dto.ConnectDto; |
| | | import com.xcong.excoin.modules.otc.dto.MsgListDto; |
| | | import com.xcong.excoin.modules.otc.dto.SendMsgDto; |
| | | import com.xcong.excoin.modules.otc.entity.OtcMsgHistoryEntity; |
| | |
| | | @Transactional |
| | | public Result getChatBox(ChatBoxDto chatBoxDto) { |
| | | MemberEntity member = LoginUserUtils.getAppLoginUser(); |
| | | // MemberEntity member = memberDao.selectById(444L); |
| | | // MemberEntity member = memberDao.selectById(443L); |
| | | //对话是否存在 |
| | | long id = chatBoxDto.getId(); |
| | | if(ObjectUtil.isEmpty(id)){ |
| | |
| | | return Result.ok("发送成功"); |
| | | } |
| | | |
| | | @Override |
| | | public Result getChatBoxConnect(ConnectDto connectDto) { |
| | | |
| | | MemberEntity member = LoginUserUtils.getAppLoginUser(); |
| | | Long memberId = member.getId(); |
| | | // Long memberId = 443L; |
| | | long targetId = connectDto.getTargetId(); |
| | | if(ObjectUtil.isEmpty(targetId)){ |
| | | return Result.fail("请返回重试"); |
| | | } |
| | | IPage<ChatBoxVo> chatBoxVos= new Page<>(); |
| | | List<OtcMsgUserListEntity> otcMsgUserListEntitys = otcMsgUserListDao.selectListByMemberIdAndTargetId(memberId,targetId); |
| | | if(CollUtil.isNotEmpty(otcMsgUserListEntitys)){ |
| | | Page<ChatBoxVo> page = new Page<>(connectDto.getPageNum(), connectDto.getPageSize()); |
| | | OtcMsgHistoryEntity otcMsgHistoryEntity = new OtcMsgHistoryEntity(); |
| | | otcMsgHistoryEntity.setMemberId(memberId); |
| | | otcMsgHistoryEntity.setTargetId(targetId); |
| | | chatBoxVos = otcMsgHistoryDao.getChatBoxMsgList(page,otcMsgHistoryEntity); |
| | | List<ChatBoxVo> records = chatBoxVos.getRecords(); |
| | | if(CollUtil.isNotEmpty(records)){ |
| | | for(ChatBoxVo chatBoxVo : records){ |
| | | long memberIds = chatBoxVo.getMemberId(); |
| | | if(memberIds == memberId){ |
| | | chatBoxVo.setIsSelf(1); |
| | | }else{ |
| | | chatBoxVo.setIsSelf(2); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return Result.ok(chatBoxVos); |
| | | } |
| | | |
| | | |
| | | } |