From 30c34fff57ead909cb5922d1791a9561e4f70957 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Mon, 13 Jul 2020 11:49:21 +0800 Subject: [PATCH] Merge branch 'master' of https://gitee.com/chonggaoxiao/new_excoin --- src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java b/src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java index 2837bdf..c96299f 100644 --- a/src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java +++ b/src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java @@ -180,13 +180,14 @@ BigDecimal closingPrice = price.multiply(amount).multiply(tradeSetting.getCoinFeeRatio()); //总费用 = 成交价*数量+手续费 BigDecimal totalPayPrice = price.multiply(amount).add(closingPrice); + BigDecimal totalPayPricCoin = nowPrice.multiply(amount).add(closingPrice); String walletCode = MemberWalletCoinEnum.WALLETCOINCODE.getValue(); MemberWalletCoinEntity walletCoinUsdt = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, walletCode); if (OrderCoinsEntity.ORDERTYPE_BUY.equals(type)) { //买入,所需总费用跟用户USDT金额进行比较 BigDecimal availableBalance = walletCoinUsdt.getAvailableBalance(); - if (totalPayPrice.compareTo(availableBalance) > 0) { + if (totalPayPrice.compareTo(availableBalance) > 0 || totalPayPricCoin.compareTo(availableBalance) > 0) { return Result.fail(MessageSourceUtils.getString("order_service_0010")); } } else { @@ -252,7 +253,7 @@ totalPayPrice = nowPrice.multiply(amount).add(closingPrice); price = nowPrice; } - order.setDealPrice(price); + order.setDealPrice(nowPrice); order.setDealAmount(totalPayPrice); order.setOrderStatus(OrderCoinsEntity.ORDERSTATUS_DONE); order.setTradeType(tradeType); @@ -268,7 +269,7 @@ detail.setSymbol(symbol); detail.setSymbolCnt(amount); detail.setEntrustPrice(nowPriceinBigDecimal); - detail.setDealPrice(price); + detail.setDealPrice(nowPrice); detail.setDealAmount(totalPayPrice); detail.setFeeAmount(closingPrice); detail.setOrderStatus(OrderCoinsDealEntity.ORDERSTATUS_DONE); -- Gitblit v1.9.1