From afdbaa02913adb95cb9701d1a0a3a3a65c48b13a Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Wed, 26 May 2021 20:28:49 +0800
Subject: [PATCH] 20210526 聊天
---
src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcMsgServiceImpl.java | 64 ++++++++++++++++++++++++++++++-
1 files changed, 61 insertions(+), 3 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcMsgServiceImpl.java b/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcMsgServiceImpl.java
index 61e92c7..ef8c087 100644
--- a/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcMsgServiceImpl.java
+++ b/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcMsgServiceImpl.java
@@ -15,19 +15,20 @@
import com.xcong.excoin.modules.member.entity.MemberSettingEntity;
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.MsgListDto;
-import com.xcong.excoin.modules.otc.dto.SendMsgDto;
+import com.xcong.excoin.modules.otc.dao.OtcOrderDao;
+import com.xcong.excoin.modules.otc.dto.*;
import com.xcong.excoin.modules.otc.entity.OtcMsgHistoryEntity;
import com.xcong.excoin.modules.otc.entity.OtcMsgUserListEntity;
import com.xcong.excoin.modules.otc.service.OtcMsgService;
import com.xcong.excoin.modules.otc.vo.ChatBoxVo;
+import com.xcong.excoin.modules.otc.vo.ChatOrderVo;
import com.xcong.excoin.modules.otc.vo.MsgListVo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
+import java.util.ArrayList;
import java.util.List;
@Service
@@ -36,6 +37,7 @@
private final OtcMsgUserListDao otcMsgUserListDao;
private final OtcMsgHistoryDao otcMsgHistoryDao;
+ private final OtcOrderDao otcOrderDao;
private final MemberSettingDao memberSettingDao;
private final MemberDao memberDao;
@@ -171,5 +173,61 @@
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);
+ }
+
+ @Override
+ public Result getChatOrder(ChatOrderDto chatOrderDto) {
+
+ MemberEntity member = LoginUserUtils.getAppLoginUser();
+ Long memberId = member.getId();
+// Long memberId = 443L;
+
+ long targetId = chatOrderDto.getTargetId();
+ if(ObjectUtil.isEmpty(targetId)){
+ return Result.fail("请返回重试");
+ }
+ ArrayList<ChatOrderVo> chatOrderVoList = new ArrayList<>();
+ List<ChatOrderVo> chatOrderVos = otcOrderDao.selectByMemberIdAndTargetId(memberId,targetId);
+ if(CollUtil.isNotEmpty(chatOrderVos)){
+ for(ChatOrderVo chatOrderVo : chatOrderVos){
+ if(memberId == chatOrderVo.getMemberId()){
+ chatOrderVoList.add(chatOrderVo);
+ }
+ }
+ }
+ return Result.ok(chatOrderVoList);
+ }
+
}
--
Gitblit v1.9.1