From e178d78da637bb469b2919f957d94219bc59d618 Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Wed, 22 May 2024 17:46:59 +0800
Subject: [PATCH] 1

---
 src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java b/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
index 0db100b..6f436e5 100644
--- a/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
@@ -83,6 +83,8 @@
 
     @Autowired
     SiteSettingServiceImpl siteSettingService;
+    @Resource
+    UserAssetsMapper userAssetsMapper;
 
 
     @Transactional
@@ -144,6 +146,7 @@
             userWithdraw.setWithStatus(Integer.valueOf(0));
             BigDecimal withfee = siteSetting.getWithFeePercent().multiply(new BigDecimal(amt)).add(new BigDecimal(siteSetting.getWithFeeSingle().intValue()));
             userWithdraw.setWithFee(withfee);
+            userWithdraw.setAssetsType(accsetType);
             int insertCount = this.userWithdrawMapper.insert(userWithdraw);
             if (insertCount > 0) {
                 return ServerResponse.createBySuccessMsg("提现成功",request);
@@ -325,7 +328,12 @@
             if (user == null) {
                 return ServerResponse.createByErrorMsg("用户不存在");
             }
-            int updateCount = this.userMapper.updateById(user);
+            UserAssets userAssets = iUserAssetsServices.assetsByTypeAndUserId(userWithdraw.getAssetsType(), user.getId());
+            if (userAssets == null) {
+                return ServerResponse.createByErrorMsg("用户资金账户不存在");
+            }
+            userAssets.setAvailableBalance(userAssets.getAvailableBalance().add(userWithdraw.getWithAmt()));
+            int updateCount = userAssetsMapper.updateById(userAssets);
             if (updateCount > 0) {
                 log.info("提现失败,返还用户资金成功!");
             } else {

--
Gitblit v1.9.3