src/main/java/com/xcong/excoin/modules/otc/controller/OtcMsgController.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/xcong/excoin/modules/otc/dao/OtcOrderDao.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/xcong/excoin/modules/otc/dto/ChatOrderDto.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/xcong/excoin/modules/otc/service/OtcMsgService.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcMsgServiceImpl.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/xcong/excoin/modules/otc/vo/ChatOrderVo.java | ●●●●● patch | view | raw | blame | history | |
src/main/resources/mapper/otc/OtcOrderDao.xml | ●●●●● patch | view | raw | blame | history |
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 = "发送消息") 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); } src/main/java/com/xcong/excoin/modules/otc/dto/ChatOrderDto.java
New file @@ -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; } 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); } 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); } } src/main/java/com/xcong/excoin/modules/otc/vo/ChatOrderVo.java
New file @@ -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; } 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>