From 16f5baf41e3224ccb43fce45de968833f9f022d2 Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Sat, 06 Jun 2026 22:11:39 +0800
Subject: [PATCH] 1

---
 src/main/resources/application.properties                        |    2 
 target/classes/application.properties                            |    2 
 target/stock-0.0.1-SNAPSHOT.jar                                  |    0 
 src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java   |   75 ++++++++++++++++++++++++++++---------
 src/main/java/com/nq/service/impl/AgentUserServiceImpl.java      |    8 +++
 target/classes/com/nq/service/impl/UserWithdrawServiceImpl.class |    0 
 target/classes/com/nq/service/impl/AgentUserServiceImpl.class    |    0 
 target/classes/mapper/UserRechargeMapper.xml                     |    2 
 target/stock-0.0.1-SNAPSHOT.jar.original                         |    0 
 src/main/resources/mapper/UserRechargeMapper.xml                 |    2 
 10 files changed, 68 insertions(+), 23 deletions(-)

diff --git a/src/main/java/com/nq/service/impl/AgentUserServiceImpl.java b/src/main/java/com/nq/service/impl/AgentUserServiceImpl.java
index 8be4ce5..f6a3992 100644
--- a/src/main/java/com/nq/service/impl/AgentUserServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/AgentUserServiceImpl.java
@@ -411,7 +411,13 @@
 
         String pcUrl = host + PropertiesUtil.getProperty("site.pc.reg.url") + agentUser.getAgentCode();
         agentInfoVO.setPcUrl(pcUrl);
-        String mUrl = host + PropertiesUtil.getProperty("site.m.reg.url") + agentUser.getAgentCode();
+        String mobileHost = PropertiesUtil.getProperty("frontend.domain.url", host);
+        if (StringUtils.isNotBlank(mobileHost)) {
+            mobileHost = mobileHost.replaceAll("/$", "");
+        } else {
+            mobileHost = host;
+        }
+        String mUrl = mobileHost + PropertiesUtil.getProperty("site.m.reg.url") + agentUser.getAgentCode();
         agentInfoVO.setMUrl(mUrl);
         return agentInfoVO;
     }
diff --git a/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java b/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
index 7b33ddf..69c29db 100644
--- a/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
@@ -171,22 +171,27 @@
 
 
             synchronized (UserWithdrawServiceImpl.class){
-            //可取港币资金
-            BigDecimal hkAmt=user.getEnaleWithdrawAmt();
+            BigDecimal withdrawAmt = new BigDecimal(amt);
+            BigDecimal enableWithdrawAmt = user.getEnaleWithdrawAmt() == null ? BigDecimal.ZERO : user.getEnaleWithdrawAmt();
+            BigDecimal enableAmt = user.getEnableAmt() == null ? BigDecimal.ZERO : user.getEnableAmt();
 
-            int compareAmt = hkAmt.compareTo(new BigDecimal(amt));
-
-            if (compareAmt == -1) {
+            if (enableWithdrawAmt.compareTo(withdrawAmt) < 0) {
 
                 return ServerResponse.createByErrorMsg("提现失败,用户可取港币资金不足");
 
             }
 
-            BigDecimal reckon_hkAmt = hkAmt.subtract(new BigDecimal(amt));
+            if (enableAmt.compareTo(withdrawAmt) < 0) {
 
-            user.setEnaleWithdrawAmt(reckon_hkAmt);
+                return ServerResponse.createByErrorMsg("提现失败,用户可用资金不足");
 
-            log.info("提现前,港币金额={},提现后,港币金额={}",hkAmt,reckon_hkAmt);
+            }
+
+            BigDecimal reckonEnableWithdrawAmt = enableWithdrawAmt.subtract(withdrawAmt);
+
+            user.setEnaleWithdrawAmt(reckonEnableWithdrawAmt);
+
+            log.info("提现申请,用户 {} 冻结可取资金,原金额 = {} , 冻结后 = {}", user.getId(), enableWithdrawAmt, reckonEnableWithdrawAmt);
 
             int updateUserCount = this.userMapper.updateByPrimaryKeySelective(user);
 
@@ -305,17 +310,14 @@
 
             User user = this.userMapper.selectByPrimaryKey(userWithdraw.getUserId());
 
-            user.setUserAmt(user.getUserAmt().add(userWithdraw.getWithAmt()));
-
-            user.setEnableAmt(user.getEnableAmt().add(userWithdraw.getWithAmt()));
-
-            user.setEnaleWithdrawAmt(user.getEnaleWithdrawAmt().add(userWithdraw.getWithAmt()));
+            BigDecimal enableWithdrawAmt = user.getEnaleWithdrawAmt() == null ? BigDecimal.ZERO : user.getEnaleWithdrawAmt();
+            user.setEnaleWithdrawAmt(enableWithdrawAmt.add(userWithdraw.getWithAmt()));
 
             int updateUserCount = this.userMapper.updateByPrimaryKeySelective(user);
 
             if (updateUserCount > 0) {
 
-                log.info("反还用户资金,总 {} 可用 {}", user.getUserAmt(), user.getEnableAmt());
+                log.info("用户取消提现,返还可取资金 {}", userWithdraw.getWithAmt());
 
                 return ServerResponse.createBySuccessMsg("取消成功");
 
@@ -413,6 +415,7 @@
     }
 
 
+    @Transactional
     public ServerResponse updateState(Integer withId, Integer state, String authMsg) throws Exception {
 
         UserWithdraw userWithdraw = this.userWithdrawMapper.selectByPrimaryKey(withId);
@@ -440,6 +443,42 @@
         }
 
 
+        if (state.intValue() == 1) {
+
+            User user = this.userMapper.selectByPrimaryKey(userWithdraw.getUserId());
+
+            if (user == null) {
+
+                return ServerResponse.createByErrorMsg("用户不存在");
+
+            }
+
+            BigDecimal withAmt = userWithdraw.getWithAmt();
+            BigDecimal enableAmt = user.getEnableAmt() == null ? BigDecimal.ZERO : user.getEnableAmt();
+
+            if (enableAmt.compareTo(withAmt) < 0) {
+
+                return ServerResponse.createByErrorMsg("用户可用资金不足,无法完成提现");
+
+            }
+
+            BigDecimal afterEnableAmt = enableAmt.subtract(withAmt);
+
+            user.setEnableAmt(afterEnableAmt);
+
+            log.info("管理员确认提现成功,扣减用户 {} 可用资金,原金额 = {} , 扣减后 = {}", user.getId(), enableAmt, afterEnableAmt);
+
+            int updateCount = this.userMapper.updateByPrimaryKeySelective(user);
+
+            if (updateCount <= 0) {
+
+                throw new Exception("修改用户资金出错,抛出异常");
+
+            }
+
+        }
+
+
         if (state.intValue() == 2) {
 
 
@@ -451,12 +490,12 @@
 
             }
 
-            //计算返还的总港币金额
-            BigDecimal hkAmt = user.getHkAmt().add(userWithdraw.getWithAmt());
+            BigDecimal enableWithdrawAmt = user.getEnaleWithdrawAmt() == null ? BigDecimal.ZERO : user.getEnaleWithdrawAmt();
+            BigDecimal refundAmt = enableWithdrawAmt.add(userWithdraw.getWithAmt());
 
-            log.info("管理员确认提现订单失败,返还用户 {} 总资金,原金额 = {} , 返还后 = {}", new Object[]{user.getId(), user.getHkAmt(), hkAmt});
+            log.info("管理员确认提现订单失败,返还用户 {} 可取资金,原金额 = {} , 返还后 = {}", user.getId(), enableWithdrawAmt, refundAmt);
 
-            user.setHkAmt(hkAmt);
+            user.setEnaleWithdrawAmt(refundAmt);
             int updateCount = this.userMapper.updateByPrimaryKeySelective(user);
 
             if (updateCount > 0) {
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 4812e0d..23de710 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -75,7 +75,7 @@
 #site setting
 site.email.auth.url=/api/admin/authCharge.do
 site.pc.reg.url=/homes/#/register?code=
-site.m.reg.url=/wap/#/register?code=
+site.m.reg.url=/#/register?code=
 
 #??????
 #pc.refresh.time=3000
diff --git a/src/main/resources/mapper/UserRechargeMapper.xml b/src/main/resources/mapper/UserRechargeMapper.xml
index 74819af..dad47cc 100644
--- a/src/main/resources/mapper/UserRechargeMapper.xml
+++ b/src/main/resources/mapper/UserRechargeMapper.xml
@@ -221,7 +221,7 @@
   </select>
 
 
- <select id="listByAdmin" parameterType="map" resultType="com.nq.pojo.UserRecharge">
+ <select id="listByAdmin" parameterType="map" resultMap="BaseResultMap">
     SELECT
     <include refid="Base_Column_List"/>
     FROM user_recharge
diff --git a/target/classes/application.properties b/target/classes/application.properties
index 4812e0d..23de710 100644
--- a/target/classes/application.properties
+++ b/target/classes/application.properties
@@ -75,7 +75,7 @@
 #site setting
 site.email.auth.url=/api/admin/authCharge.do
 site.pc.reg.url=/homes/#/register?code=
-site.m.reg.url=/wap/#/register?code=
+site.m.reg.url=/#/register?code=
 
 #??????
 #pc.refresh.time=3000
diff --git a/target/classes/com/nq/service/impl/AgentUserServiceImpl.class b/target/classes/com/nq/service/impl/AgentUserServiceImpl.class
index c4672f5..92e4fba 100644
--- a/target/classes/com/nq/service/impl/AgentUserServiceImpl.class
+++ b/target/classes/com/nq/service/impl/AgentUserServiceImpl.class
Binary files differ
diff --git a/target/classes/com/nq/service/impl/UserWithdrawServiceImpl.class b/target/classes/com/nq/service/impl/UserWithdrawServiceImpl.class
index e66b535..01e481f 100644
--- a/target/classes/com/nq/service/impl/UserWithdrawServiceImpl.class
+++ b/target/classes/com/nq/service/impl/UserWithdrawServiceImpl.class
Binary files differ
diff --git a/target/classes/mapper/UserRechargeMapper.xml b/target/classes/mapper/UserRechargeMapper.xml
index 74819af..dad47cc 100644
--- a/target/classes/mapper/UserRechargeMapper.xml
+++ b/target/classes/mapper/UserRechargeMapper.xml
@@ -221,7 +221,7 @@
   </select>
 
 
- <select id="listByAdmin" parameterType="map" resultType="com.nq.pojo.UserRecharge">
+ <select id="listByAdmin" parameterType="map" resultMap="BaseResultMap">
     SELECT
     <include refid="Base_Column_List"/>
     FROM user_recharge
diff --git a/target/stock-0.0.1-SNAPSHOT.jar b/target/stock-0.0.1-SNAPSHOT.jar
index 60a88ec..eb6b2e9 100644
--- a/target/stock-0.0.1-SNAPSHOT.jar
+++ b/target/stock-0.0.1-SNAPSHOT.jar
Binary files differ
diff --git a/target/stock-0.0.1-SNAPSHOT.jar.original b/target/stock-0.0.1-SNAPSHOT.jar.original
index 1b6f250..f5a99f2 100644
--- a/target/stock-0.0.1-SNAPSHOT.jar.original
+++ b/target/stock-0.0.1-SNAPSHOT.jar.original
Binary files differ

--
Gitblit v1.9.3