From 0d30c93d000413c6eb34f489ef17688ad4175201 Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Mon, 29 Apr 2024 18:18:21 +0800
Subject: [PATCH] 55测试环境
---
src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java | 8 +++++++-
1 files changed, 7 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 6d93c0f..f2cd874 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
@@ -34,6 +34,7 @@
import com.xcong.excoin.modules.otc.vo.SaleOrderDetailVo;
import com.xcong.excoin.rabbit.producer.OtcProducter;
import com.xcong.excoin.utils.RedisUtils;
+import com.xcong.excoin.utils.ThreadPoolUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
@@ -102,6 +103,7 @@
BigDecimal cny = orderAddDto.getUsdtAmount().multiply(entrustOrder.getUnitPrice()).setScale(2, BigDecimal.ROUND_DOWN);
BigDecimal usdt = orderAddDto.getCnyAmount().divide(entrustOrder.getUnitPrice(), 2, BigDecimal.ROUND_DOWN);
if (cny.compareTo(orderAddDto.getCnyAmount()) != 0 && usdt.compareTo(orderAddDto.getUsdtAmount()) != 0) {
+ log.info("BUY = CNY:{}, CNY_{}, USDT:{}, USDT_{}", cny, orderAddDto.getCnyAmount(), usdt, orderAddDto.getUsdtAmount());
throw new GlobalException("数量与金额不符");
}
/**
@@ -153,6 +155,7 @@
this.baseMapper.insert(otcOrder);
this.baseMapper.insert(sale);
+ ThreadPoolUtils.sendOrderMsg();
return Result.ok("购买成功", otcOrder.getId());
}
@@ -201,9 +204,10 @@
throw new GlobalException("资金密码错误");
}
- BigDecimal cny = orderAddDto.getUsdtAmount().multiply(entrustOrder.getUnitPrice());
+ BigDecimal cny = orderAddDto.getUsdtAmount().multiply(entrustOrder.getUnitPrice()).setScale(2, BigDecimal.ROUND_DOWN);
BigDecimal usdt = orderAddDto.getCnyAmount().divide(entrustOrder.getUnitPrice(), 2, BigDecimal.ROUND_DOWN);
if (cny.compareTo(orderAddDto.getCnyAmount()) != 0 && usdt.compareTo(orderAddDto.getUsdtAmount()) != 0) {
+ log.info("SALE = CNY:{}, CNY_{}, USDT:{}, USDT_{}", cny, orderAddDto.getCnyAmount(), usdt, orderAddDto.getUsdtAmount());
throw new GlobalException("数量与金额不符");
}
@@ -250,6 +254,8 @@
this.baseMapper.insert(buy);
memberWalletCoinDao.updateFrozenBalance(member.getId(), wallet.getId(), orderAddDto.getUsdtAmount());
+
+ ThreadPoolUtils.sendOrderMsg();
return Result.ok("出售成功", otcOrder.getId());
}
--
Gitblit v1.9.1