From bf502dd67e829d23001abd8c4d85dcb600f96f4d Mon Sep 17 00:00:00 2001
From: zyy3 <zyy3@zy.com>
Date: Sun, 28 Sep 2025 15:32:58 +0800
Subject: [PATCH] 修改账户资金余额
---
trading-order-service/src/main/java/com/yami/trading/service/impl/CapitaltWalletServiceImpl.java | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/trading-order-service/src/main/java/com/yami/trading/service/impl/CapitaltWalletServiceImpl.java b/trading-order-service/src/main/java/com/yami/trading/service/impl/CapitaltWalletServiceImpl.java
index e424b24..bd5a61a 100644
--- a/trading-order-service/src/main/java/com/yami/trading/service/impl/CapitaltWalletServiceImpl.java
+++ b/trading-order-service/src/main/java/com/yami/trading/service/impl/CapitaltWalletServiceImpl.java
@@ -128,14 +128,17 @@
if (accountType == 1 && moneyRevise.compareTo(BigDecimal.ZERO) <= 0) { //充值
throw new YamiShopBindException("请输入大于0的数量");
}
- if (accountType == 2 && moneyRevise.compareTo(BigDecimal.ZERO) >= 0) {
- throw new YamiShopBindException("请输入小于0的数量");
+ if (accountType == 2) {
+ moneyRevise = moneyRevise.negate();
}
if ("usdt".equals(coinType)) {
double amount1 = moneyRevise.doubleValue();
CapitaltWallet capitaltWallet = getOne(new LambdaQueryWrapper<>(CapitaltWallet.class)
.eq(CapitaltWallet::getUserId, userId).last(" limit 1 "));
double amount_before = capitaltWallet.getMoney().doubleValue();
+ if (accountType == 2 && capitaltWallet.getMoney().subtract(moneyRevise).compareTo(BigDecimal.ZERO) < 0) {
+ throw new YamiShopBindException("账号资金不足");
+ }
update(capitaltWallet, amount1);
// 保存资金日志
@@ -162,6 +165,10 @@
double amount_before = walletExtend.getAmount();
+ if (accountType == 2 && Arith.sub(amount_before, volume) < 0) {
+ throw new YamiShopBindException("账号资金不足");
+ }
+
// walletExtend = walletService.saveWalletExtendByParaAndUpdate(String.valueOf(recharge.getPartyId()), recharge.getSymbol(), volume);
walletService.updateExtend(walletExtend.getPartyId().toString(), walletExtend.getWallettype(), volume);
--
Gitblit v1.9.3