From 5ed78846f18a51a66869b44491a53065b058549d Mon Sep 17 00:00:00 2001
From: zyy <zyy@email.com>
Date: Wed, 21 Jan 2026 18:27:35 +0800
Subject: [PATCH] 新增可取资金
---
src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java | 31 +++++++++++++++++++++----------
1 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java b/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
index 5cf5d25..a97e665 100644
--- a/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
@@ -132,7 +132,9 @@
SiteSetting siteSetting = this.iSiteSettingService.getSiteSetting();
- if ((new BigDecimal(amt)).compareTo(new BigDecimal(siteSetting.getWithMinAmt().intValue())) == -1) {
+ BigDecimal outAmt = new BigDecimal(amt);
+
+ if (outAmt.compareTo(new BigDecimal(siteSetting.getWithMinAmt().intValue())) == -1) {
return ServerResponse.createByErrorMsg("出金金额不得低于" + siteSetting.getWithMinAmt() + "元");
@@ -171,17 +173,24 @@
//可取港币资金
BigDecimal hkAmt=user.getEnaleWithdrawAmt();
- int compareAmt = hkAmt.compareTo(new BigDecimal(amt));
+ BigDecimal userAmt=user.getEnableAmt();
+
+ int compareAmt = hkAmt.compareTo(outAmt);
if (compareAmt == -1) {
- return ServerResponse.createByErrorMsg("提现失败,用户可取港币资金不足");
+ return ServerResponse.createByErrorMsg("提现失败,用户可取资金不足");
}
- BigDecimal reckon_hkAmt = hkAmt.subtract(new BigDecimal(amt));
+ if (userAmt.compareTo(outAmt) < 0) {
+ return ServerResponse.createByErrorMsg("提现失败,用户可用资金不足");
+ }
+
+ BigDecimal reckon_hkAmt = hkAmt.subtract(outAmt);
user.setEnaleWithdrawAmt(reckon_hkAmt);
+ user.setEnableAmt(userAmt.subtract(outAmt));
log.info("提现前,港币金额={},提现后,港币金额={}",hkAmt,reckon_hkAmt);
@@ -208,7 +217,7 @@
userWithdraw.setAgentId(user.getAgentId());
- userWithdraw.setWithAmt(new BigDecimal(amt));
+ userWithdraw.setWithAmt(outAmt);
userWithdraw.setApplyTime(new Date());
@@ -223,7 +232,7 @@
userWithdraw.setWithStatus(Integer.valueOf(0));
- BigDecimal withfee = siteSetting.getWithFeePercent().multiply(new BigDecimal(amt)).add(new BigDecimal(siteSetting.getWithFeeSingle().intValue()));
+ BigDecimal withfee = siteSetting.getWithFeePercent().multiply(outAmt).add(new BigDecimal(siteSetting.getWithFeeSingle().intValue()));
//userWithdraw.setWithFee(withfee);
@@ -448,12 +457,14 @@
}
- //计算返还的总港币金额
- BigDecimal hkAmt = user.getHkAmt().add(userWithdraw.getWithAmt());
+ //计算返还的可取金额
+ BigDecimal hkAmt = user.getEnaleWithdrawAmt().add(userWithdraw.getWithAmt());
- log.info("管理员确认提现订单失败,返还用户 {} 总资金,原金额 = {} , 返还后 = {}", new Object[]{user.getId(), user.getHkAmt(), hkAmt});
+ log.info("管理员确认提现订单失败,返还用户 {} 可取资金,原金额 = {} , 返还后 = {}", new Object[]{user.getId(), user.getEnaleWithdrawAmt(), hkAmt});
- user.setHkAmt(hkAmt);
+ user.setEnaleWithdrawAmt(hkAmt);
+ user.setEnableAmt(user.getEnableAmt().add(userWithdraw.getWithAmt()));
+
int updateCount = this.userMapper.updateByPrimaryKeySelective(user);
if (updateCount > 0) {
--
Gitblit v1.9.3