From 9ee5f4f4c38f11f63c6019b977134cacea4d4926 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Wed, 26 May 2021 20:15:16 +0800
Subject: [PATCH] 20210526 聊天
---
src/main/java/com/xcong/excoin/modules/otc/dao/OtcOrderDao.java | 3 +
src/main/resources/mapper/otc/OtcOrderDao.xml | 11 +++
src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcMsgServiceImpl.java | 23 ++++++-
src/main/java/com/xcong/excoin/modules/otc/dto/ChatOrderDto.java | 14 ++++
src/main/java/com/xcong/excoin/modules/otc/controller/OtcMsgController.java | 13 ++++
src/main/java/com/xcong/excoin/modules/otc/vo/ChatOrderVo.java | 60 ++++++++++++++++++++
src/main/java/com/xcong/excoin/modules/otc/service/OtcMsgService.java | 7 +-
7 files changed, 123 insertions(+), 8 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/modules/otc/controller/OtcMsgController.java b/src/main/java/com/xcong/excoin/modules/otc/controller/OtcMsgController.java
index 4e81c56..c6bde94 100644
--- a/src/main/java/com/xcong/excoin/modules/otc/controller/OtcMsgController.java
+++ b/src/main/java/com/xcong/excoin/modules/otc/controller/OtcMsgController.java
@@ -5,6 +5,7 @@
import com.xcong.excoin.modules.otc.dto.*;
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 io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -66,6 +67,18 @@
}
/**
+ * 进入聊天框,获取聊天记录---获取未完成记录
+ */
+ @ApiOperation(value = "进入聊天框---获取未完成记录")
+ @ApiResponses({
+ @ApiResponse(code = 200, message = "success", response = ChatOrderVo.class)
+ })
+ @PostMapping(value = "/getChatOrder")
+ public Result getChatOrder(@RequestBody ChatOrderDto chatOrderDto) {
+ return otcMsgService.getChatOrder(chatOrderDto);
+ }
+
+ /**
* 发送消息
*/
@ApiOperation(value = "发送消息")
diff --git a/src/main/java/com/xcong/excoin/modules/otc/dao/OtcOrderDao.java b/src/main/java/com/xcong/excoin/modules/otc/dao/OtcOrderDao.java
index e9ad2e1..b39c27b 100644
--- a/src/main/java/com/xcong/excoin/modules/otc/dao/OtcOrderDao.java
+++ b/src/main/java/com/xcong/excoin/modules/otc/dao/OtcOrderDao.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xcong.excoin.modules.otc.entity.OtcOrder;
+import com.xcong.excoin.modules.otc.vo.ChatOrderVo;
import com.xcong.excoin.modules.otc.vo.OrderListVo;
import org.apache.ibatis.annotations.Param;
import org.web3j.abi.datatypes.Int;
@@ -34,4 +35,6 @@
List<OtcOrder> selectOrderListForUser(@Param("memberId") Long memberId, @Param("status") Integer status);
BigDecimal selectOrderTotalAmount(@Param("memberId") Long memberId);
+
+ List<ChatOrderVo> selectByMemberIdAndTargetId(@Param("memberId")Long memberId, @Param("targetId")long targetId);
}
diff --git a/src/main/java/com/xcong/excoin/modules/otc/dto/ChatOrderDto.java b/src/main/java/com/xcong/excoin/modules/otc/dto/ChatOrderDto.java
new file mode 100644
index 0000000..7451088
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/otc/dto/ChatOrderDto.java
@@ -0,0 +1,14 @@
+package com.xcong.excoin.modules.otc.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "ChatOrderDto", description = "参数接收类")
+public class ChatOrderDto {
+
+ @ApiModelProperty(value = "目标ID", example = "1")
+ private long targetId;
+
+}
diff --git a/src/main/java/com/xcong/excoin/modules/otc/service/OtcMsgService.java b/src/main/java/com/xcong/excoin/modules/otc/service/OtcMsgService.java
index 5c027e9..68b82d6 100644
--- a/src/main/java/com/xcong/excoin/modules/otc/service/OtcMsgService.java
+++ b/src/main/java/com/xcong/excoin/modules/otc/service/OtcMsgService.java
@@ -3,10 +3,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xcong.excoin.common.response.Result;
-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.dto.*;
import com.xcong.excoin.modules.otc.entity.OtcMsgUserListEntity;
import com.xcong.excoin.modules.otc.vo.ChatBoxVo;
import com.xcong.excoin.modules.otc.vo.MsgListVo;
@@ -20,4 +17,6 @@
Result sendMsg(SendMsgDto sendMsgDto);
Result getChatBoxConnect(ConnectDto connectDto);
+
+ Result getChatOrder(ChatOrderDto chatOrderDto);
}
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 ed01fec..3164006 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,14 +15,13 @@
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.ConnectDto;
-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;
@@ -37,6 +36,7 @@
private final OtcMsgUserListDao otcMsgUserListDao;
private final OtcMsgHistoryDao otcMsgHistoryDao;
+ private final OtcOrderDao otcOrderDao;
private final MemberSettingDao memberSettingDao;
private final MemberDao memberDao;
@@ -205,5 +205,20 @@
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("请返回重试");
+ }
+ List<ChatOrderVo> chatOrderVos = otcOrderDao.selectByMemberIdAndTargetId(memberId,targetId);
+ return Result.ok(chatOrderVos);
+ }
+
}
diff --git a/src/main/java/com/xcong/excoin/modules/otc/vo/ChatOrderVo.java b/src/main/java/com/xcong/excoin/modules/otc/vo/ChatOrderVo.java
new file mode 100644
index 0000000..bf99d92
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/otc/vo/ChatOrderVo.java
@@ -0,0 +1,60 @@
+package com.xcong.excoin.modules.otc.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+@ApiModel(value = "ChatOrderVo", description = "返回参数类")
+public class ChatOrderVo {
+
+ /**
+ * 订单编号
+ */
+
+ @ApiModelProperty(value = "订单编号")
+ private String orderNo;
+
+ /**
+ * 单价
+ */
+
+ @ApiModelProperty(value = "单价")
+ private BigDecimal unitPrice;
+
+ /**
+ * 数量
+ */
+
+ @ApiModelProperty(value = "数量")
+ private BigDecimal coinAmount;
+
+ /**
+ * 总额
+ */
+
+ @ApiModelProperty(value = "总额")
+ private BigDecimal totalAmount;
+
+ /**
+ * 订单状态 1-已提交未付款2-已付款3-已完成
+ */
+
+ @ApiModelProperty(value = "订单状态 1-已提交未付款2-已付款3-已完成4-已取消")
+ private Integer status;
+ public static final Integer STATUS_SUBMIT = 1;
+ public static final Integer STATUS_PAY = 2;
+ public static final Integer STATUS_FINISH = 3;
+ public static final Integer STATUS_CANCEL = 4;
+
+
+ /**
+ * 订单类型 B-买 S-卖
+ */
+
+ @ApiModelProperty(value = "订单类型 B-买 S-卖")
+ private String orderType;
+}
diff --git a/src/main/resources/mapper/otc/OtcOrderDao.xml b/src/main/resources/mapper/otc/OtcOrderDao.xml
index 50af6e6..d62502d 100644
--- a/src/main/resources/mapper/otc/OtcOrderDao.xml
+++ b/src/main/resources/mapper/otc/OtcOrderDao.xml
@@ -99,4 +99,15 @@
select sum(total_amount) from otc_order
where member_id=#{memberId} and status = 3
</select>
+
+ <select id="selectByMemberIdAndTargetId" resultType="com.xcong.excoin.modules.otc.vo.ChatOrderVo">
+ select * from otc_order
+ where ((member_id=#{memberId} and opposite_member_id=#{targetId})
+ or
+ (member_id=#{targetId} and opposite_member_id=#{memberId}))
+ and status in (1,2)
+ order by create_time desc
+
+ </select>
+
</mapper>
\ No newline at end of file
--
Gitblit v1.9.1