From 25aec7899b8ab3d483bbfd6d7580c6966318ee7f Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Tue, 01 Jun 2021 11:19:31 +0800
Subject: [PATCH] modify

---
 src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java |    7 ++++++-
 1 files changed, 6 insertions(+), 1 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 688afe5..38de88b 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
@@ -32,6 +32,7 @@
 import com.xcong.excoin.modules.otc.vo.BuyOrderDetailVo;
 import com.xcong.excoin.modules.otc.vo.OrderListVo;
 import com.xcong.excoin.modules.otc.vo.SaleOrderDetailVo;
+import com.xcong.excoin.rabbit.producer.OtcProducter;
 import com.xcong.excoin.utils.RedisUtils;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -57,6 +58,7 @@
     private final OtcBlackListDao otcBlackListDao;
     private final OtcSettingDao otcSettingDao;
     private final RedisUtils redisUtils;
+    private final OtcProducter otcProducter;
 
 
     @Override
@@ -97,7 +99,7 @@
             throw new GlobalException("剩余数量不足");
         }
 
-        BigDecimal cny = orderAddDto.getUsdtAmount().multiply(entrustOrder.getUnitPrice());
+        BigDecimal cny = orderAddDto.getUsdtAmount().multiply(entrustOrder.getUnitPrice()).setScale(2,BigDecimal.ROUND_DOWN);;
         if (cny.compareTo(orderAddDto.getCnyAmount()) != 0) {
             throw new GlobalException("数量与金额不符");
         }
@@ -315,6 +317,7 @@
         memberWalletCoinDao.reduceFrozenBalance(saleWallet.getId(), buyOrder.getCoinAmount());
 
         this.baseMapper.updateOrderStatusByOrderNo(OtcOrder.STATUS_FINISH, null, otcOrder.getOrderNo());
+        otcProducter.sendMarketBussinessMsg(otcOrder.getEntrustOrderId(), OtcOrder.STATUS_FINISH);
     }
 
     @Override
@@ -464,6 +467,8 @@
 
         otcEntrustOrderDao.updateRemainAmount(otcOrder.getEntrustOrderId(), otcOrder.getCoinAmount());
         this.baseMapper.updateOrderStatusByOrderNo(OtcOrder.STATUS_CANCEL, null, otcOrder.getOrderNo());
+
+        otcProducter.sendMarketBussinessMsg(otcOrder.getEntrustOrderId(), OtcOrder.STATUS_CANCEL);
     }
 
     @Override

--
Gitblit v1.9.1