From c6f226f7f9f9aa46c27db28d6796cd15d101cfe9 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Tue, 25 May 2021 15:37:38 +0800
Subject: [PATCH] modify
---
src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 52 insertions(+), 7 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java b/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java
index 6f4966e..c422f84 100644
--- a/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java
+++ b/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java
@@ -3,6 +3,7 @@
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -20,13 +21,16 @@
import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity;
import com.xcong.excoin.modules.otc.dao.OtcEntrustOrderDao;
import com.xcong.excoin.modules.otc.dao.OtcMarketBussinessDao;
+import com.xcong.excoin.modules.otc.dao.OtcOrderAppealDao;
import com.xcong.excoin.modules.otc.dto.HasPayDto;
+import com.xcong.excoin.modules.otc.dto.OrderApealDto;
import com.xcong.excoin.modules.otc.dto.OrderListDto;
import com.xcong.excoin.modules.otc.dto.OtcOrderAddDto;
import com.xcong.excoin.modules.otc.entity.OtcEntrustOrder;
import com.xcong.excoin.modules.otc.entity.OtcMarketBussiness;
import com.xcong.excoin.modules.otc.entity.OtcOrder;
import com.xcong.excoin.modules.otc.dao.OtcOrderDao;
+import com.xcong.excoin.modules.otc.entity.OtcOrderAppeal;
import com.xcong.excoin.modules.otc.service.OtcOrderService;
import com.xcong.excoin.modules.otc.vo.BuyOrderDetailVo;
import com.xcong.excoin.modules.otc.vo.OrderListVo;
@@ -48,6 +52,7 @@
private final OtcMarketBussinessDao otcMarketBussinessDao;
private final OtcEntrustOrderDao otcEntrustOrderDao;
+ private final OtcOrderAppealDao otcOrderAppealDao;
private final CommonService commonService;
private final MemberWalletCoinDao memberWalletCoinDao;
private final MemberDao memberDao;
@@ -101,19 +106,24 @@
otcOrder.setEntrustMemberId(entrustOrder.getMemberId());
otcOrder.setOrderType(OtcEntrustOrder.ORDER_TYPE_B);
- MemberPaymentMethodEntity defualtMethod = memberPaymentMethodDao.selectDefualtMethod(entrustOrder.getMemberId(), 3, "1");
+ MemberPaymentMethodEntity defualtMethod = memberPaymentMethodDao.selectDefualtMethod(entrustOrder.getMemberId(), null, "1");
if (defualtMethod == null) {
throw new GlobalException("对方未设置默认支付方式");
}
+ if (MemberPaymentMethodEntity.PAYMENTTYPE_CARD.toString().equals(defualtMethod.getPaymentType())) {
+ otcOrder.setBankName(defualtMethod.getBank());
+ } else {
+ otcOrder.setBankName(defualtMethod.getPaymentQrcode());
+ }
- otcOrder.setBankName(defualtMethod.getBank());
otcOrder.setBankNo(defualtMethod.getAccount());
otcOrder.setCardName(defualtMethod.getName());
+ otcOrder.setPayType(defualtMethod.getPaymentType());
OtcOrder sale = new OtcOrder();
BeanUtil.copyProperties(otcOrder, sale);
sale.setMemberId(entrustOrder.getMemberId());
- otcOrder.setOppositeMemberId(member.getId());
+ sale.setOppositeMemberId(member.getId());
sale.setOrderType(OtcEntrustOrder.ORDER_TYPE_S);
otcEntrustOrderDao.updateRemainAmount(entrustOrder.getId(), orderAddDto.getUsdtAmount().negate());
this.baseMapper.insert(otcOrder);
@@ -189,13 +199,19 @@
buy.setOppositeMemberId(member.getId());
buy.setOrderType(OtcEntrustOrder.ORDER_TYPE_B);
- MemberPaymentMethodEntity defualtMethod = memberPaymentMethodDao.selectDefualtMethod(member.getId(), 3, "1");
+ MemberPaymentMethodEntity defualtMethod = memberPaymentMethodDao.selectDefualtMethod(member.getId(), null, "1");
if (defualtMethod == null) {
throw new GlobalException("未设置默认支付方式");
}
- buy.setBankName(defualtMethod.getBank());
+
+ if (MemberPaymentMethodEntity.PAYMENTTYPE_CARD.toString().equals(defualtMethod.getPaymentType())) {
+ buy.setBankName(defualtMethod.getBank());
+ } else {
+ buy.setBankName(defualtMethod.getPaymentQrcode());
+ }
buy.setBankNo(defualtMethod.getAccount());
buy.setCardName(defualtMethod.getName());
+ buy.setPayType(defualtMethod.getPaymentType());
otcEntrustOrderDao.updateRemainAmount(entrustOrder.getId(), orderAddDto.getUsdtAmount().negate());
this.baseMapper.insert(otcOrder);
@@ -234,7 +250,7 @@
}
if (StrUtil.isBlank(hasPayDto.getName())) {
- MemberPaymentMethodEntity defualtMethod = memberPaymentMethodDao.selectDefualtMethod(member.getId(), 3, "1");
+ MemberPaymentMethodEntity defualtMethod = memberPaymentMethodDao.selectDefualtMethod(member.getId(), null, "1");
hasPayDto.setName(defualtMethod.getName());
}
@@ -305,6 +321,7 @@
buyDetail.setBankName(buyOrder.getBankName());
buyDetail.setBankNo(buyOrder.getBankNo());
buyDetail.setCardName(buyOrder.getCardName());
+ buyDetail.setPayType(buyOrder.getPayType());
buyDetail.setPayTime(buyOrder.getPayTime());
if (!buyOrder.getMemberId().equals(buyOrder.getEntrustMemberId())) {
@@ -313,7 +330,6 @@
buyDetail.setFinishRatio(otcMb.getFinishRatio());
buyDetail.setOrderCnt(otcMb.getBuyCnt());
}
-
if (OtcOrder.STATUS_SUBMIT.equals(buyOrder.getStatus())) {
long between = DateUtil.between(new Date(), DateUtil.offsetMinute(buyOrder.getCreateTime(), 30), DateUnit.SECOND, false);
@@ -348,6 +364,7 @@
saleDetail.setIsMb(member.getIsTrader());
saleDetail.setPayName(saleOrder.getPayName());
saleDetail.setSaleName(buyMember.getName());
+ saleDetail.setPayType(saleOrder.getPayType());
if (!saleOrder.getMemberId().equals(saleOrder.getEntrustMemberId())) {
OtcMarketBussiness otcMb = otcMarketBussinessDao.selectMarketBussinessByMemberId(saleOrder.getEntrustMemberId());
@@ -384,4 +401,32 @@
otcEntrustOrderDao.updateRemainAmount(otcOrder.getEntrustOrderId(), otcOrder.getCoinAmount());
this.baseMapper.updateOrderStatusByOrderNo(OtcOrder.STATUS_CANCEL, null, otcOrder.getOrderNo());
}
+
+ @Override
+ public Result orderApeal(OrderApealDto orderApealDto) {
+ MemberEntity member = LoginUserUtils.getAppLoginUser();
+ Long memberId = member.getId();
+// long memberId = 446L;
+ Long orderId = orderApealDto.getOrderId();
+ OtcOrder otcOrder = this.baseMapper.selectById(orderId);
+ if(ObjectUtil.isEmpty(otcOrder)){
+ return Result.fail("订单不存在");
+ }
+ String reason = orderApealDto.getReason();
+ if(StrUtil.isEmpty(reason)){
+ return Result.fail("请填写申诉原因");
+ }
+ String content = orderApealDto.getContent();
+ if(StrUtil.isEmpty(content)){
+ return Result.fail("请填写申诉内容");
+ }
+ OtcOrderAppeal otcOrderAppeal = new OtcOrderAppeal();
+ otcOrderAppeal.setMemberId(memberId);
+ otcOrderAppeal.setOrderId(orderId);
+ otcOrderAppeal.setReason(reason);
+ otcOrderAppeal.setContent(content);
+ otcOrderAppeal.setStatus(OtcOrderAppeal.STATUS_ONE);
+ otcOrderAppealDao.insert(otcOrderAppeal);
+ return Result.ok("成功");
+ }
}
--
Gitblit v1.9.1