From dbee929294fc8b3bb8ff7c721023de4f57c89996 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Thu, 20 May 2021 17:48:24 +0800
Subject: [PATCH] modify

---
 src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java |   25 ++++++++++++++++++++++++-
 1 files changed, 24 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 f0838ba..476d7f1 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
@@ -69,8 +69,19 @@
             throw new GlobalException("无足够的USDT");
         }
 
+        if (orderAddDto.getUsdtAmount().compareTo(entrustOrder.getLimitMinAmount()) < 0) {
+            throw new GlobalException("低于最低限额");
+        }
+
+        if (orderAddDto.getCnyAmount().compareTo(entrustOrder.getLimitMaxAmount()) > 0) {
+            throw new GlobalException("高于最高限额");
+        }
+
+        if (orderAddDto.getCnyAmount().compareTo(entrustOrder.getRemainCoinAmount()) > 0) {
+            throw new GlobalException("剩余数量不足");
+        }
+
         BigDecimal cny = orderAddDto.getUsdtAmount().multiply(entrustOrder.getUnitPrice());
-        log.info("--->{}", cny);
         if (cny.compareTo(orderAddDto.getCnyAmount()) != 0) {
             throw new GlobalException("数量与金额不符");
         }
@@ -109,6 +120,18 @@
             throw new GlobalException("无法出售");
         }
 
+        if (orderAddDto.getCnyAmount().compareTo(entrustOrder.getLimitMinAmount()) < 0) {
+            throw new GlobalException("低于最低限额");
+        }
+
+        if (orderAddDto.getCnyAmount().compareTo(entrustOrder.getLimitMaxAmount()) > 0) {
+            throw new GlobalException("高于最高限额");
+        }
+
+        if (orderAddDto.getUsdtAmount().compareTo(entrustOrder.getRemainCoinAmount()) > 0) {
+            throw new GlobalException("剩余数量不足");
+        }
+
         if (StrUtil.isBlank(orderAddDto.getPassword())) {
             throw new GlobalException("资金密码不能为空");
         }

--
Gitblit v1.9.1