From 02bdd77db8b0bffc471dce9c3ed1a487a8743d55 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Fri, 28 May 2021 10:25:35 +0800
Subject: [PATCH] 20210528

---
 src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcEntrustOrderServiceImpl.java |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcEntrustOrderServiceImpl.java b/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcEntrustOrderServiceImpl.java
index 693d224..b0784f4 100644
--- a/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcEntrustOrderServiceImpl.java
+++ b/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcEntrustOrderServiceImpl.java
@@ -70,13 +70,14 @@
         BigDecimal totalAmount = addDto.getUnitPrice().multiply(addDto.getAmount());
         otcEntrustOrder.setTotalAmount(totalAmount);
 
-        if (addDto.getMax().compareTo(totalAmount) < 0) {
+        if (totalAmount.compareTo(addDto.getMax()) < 0) {
             throw new GlobalException("最大限额应小于总金额");
         }
 
         if (OtcEntrustOrder.ORDER_TYPE_S.equals(addDto.getType())) {
             MemberWalletCoinEntity coinWallet = memberWalletCoinDao.selectWalletCoinBymIdAndCode(member.getId(), "USDT");
-            if(coinWallet.getAvailableBalance().compareTo(totalAmount) < 0) {
+            BigDecimal multiply = addDto.getUnitPrice().multiply(coinWallet.getAvailableBalance());
+            if(multiply.compareTo(totalAmount) < 0) {
                 throw new GlobalException("可用金额不足");
             }
 

--
Gitblit v1.9.1