1
zj
2026-01-23 0dd4d58348ea76cb24bbe3b862fec6ebbd35b78a
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() + "元");
@@ -169,19 +171,26 @@
            synchronized (UserWithdrawServiceImpl.class){
            //可取港币资金
            BigDecimal hkAmt=user.getHkAmt();
            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("提现失败,用户可用资金不足");
            }
            user.setHkAmt(reckon_hkAmt);
            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) {