From 5bb14458c544ee4437dc3c80d4a70c0b4c5e89d3 Mon Sep 17 00:00:00 2001
From: zyy <zyy@email.com>
Date: Sun, 10 May 2026 17:15:56 +0800
Subject: [PATCH] 1

---
 src/main/java/com/nq/service/impl/UserRechargeServiceImpl.java |   53 +++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 37 insertions(+), 16 deletions(-)

diff --git a/src/main/java/com/nq/service/impl/UserRechargeServiceImpl.java b/src/main/java/com/nq/service/impl/UserRechargeServiceImpl.java
index 3a74ca2..9af5712 100644
--- a/src/main/java/com/nq/service/impl/UserRechargeServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserRechargeServiceImpl.java
@@ -67,17 +67,17 @@
     }
 
 
-    public ServerResponse inMoney(String amt, String payType, HttpServletRequest request) {
-        if (StringUtils.isBlank(amt) || StringUtils.isBlank(payType)) {
+    public ServerResponse inMoney(String amt, String img, HttpServletRequest request) {
+        if (StringUtils.isBlank(amt) || StringUtils.isBlank(img)) {
             return ServerResponse.createByErrorMsg("The parameter cannot be null");
         }
 
-        SiteSetting siteSetting = this.iSiteSettingService.getSiteSetting();
-        if (siteSetting == null) {
+        SitePay payChnnel = sitePayMapper.selectById(1);
+        if (payChnnel == null) {
             return ServerResponse.createByErrorMsg("set is not initialized");
         }
-        if ((new BigDecimal(siteSetting.getChargeMinAmt() + "")).compareTo(new BigDecimal(amt)) == 1) {
-            return ServerResponse.createByErrorMsg("The top-up amount shall not be less than" + siteSetting.getChargeMinAmt());
+        if ((new BigDecimal(payChnnel.getChannelMinLimit() + "")).compareTo(new BigDecimal(amt)) == 1) {
+            return ServerResponse.createByErrorMsg("The top-up amount shall not be less than" + payChnnel.getChannelMinLimit());
         }
 
 
@@ -94,9 +94,9 @@
         }
 
         User user = this.iUserService.getCurrentRefreshUser(request);
-        if (user.getIsActive().intValue() != 2) {
+        /*if (user.getIsActive().intValue() != 2) {
             return ServerResponse.createByErrorMsg("Recharge cannot be initiated without real-name authentication");
-        }
+        }*/
 
 
         ServerResponse serverResponse = checkInMoney(10, user.getId());
@@ -114,10 +114,14 @@
         String ordersn = KeyUtils.getRechargeOrderSn();
         userRecharge.setOrderSn(ordersn);
 
-        userRecharge.setPayChannel(payType);
+        userRecharge.setPayChannel("1");
         userRecharge.setPayAmt(new BigDecimal(amt));
         userRecharge.setOrderStatus(Integer.valueOf(0));
         userRecharge.setAddTime(new Date());
+        userRecharge.setAssetsType(EStockType.US.getCode());
+        userRecharge.setImg(img);
+        userRecharge.setPayId(1);
+        userRecharge.setPayTime(new Date());
 
         int insertCount = this.userRechargeMapper.insert(userRecharge);
         if (insertCount > 0) {
@@ -131,7 +135,7 @@
             /*SendHTMLMail.send(user, userRecharge, email_token, siteInfo
                     .getSiteHost(), siteInfo.getSiteEmailTo());
             log.info("用户充值,发送审核邮件成功");*/
-            return ServerResponse.createBySuccessMsg("Creating a payment order succeeded!");
+            return ServerResponse.createBySuccessMsg("Creating a payment order succeeded");
         }
         return ServerResponse.createByErrorMsg("Failed to create a payment order");
     }
@@ -217,9 +221,16 @@
         PageInfo pageInfo = new PageInfo(userRecharges);
 
         for (int i = 0; i <userRecharges.size() ; i++) {
-          SitePay s =   sitePayMapper.selectById(userRecharges.get(i).getPayId());
-            userRecharges.get(i).setAssetsType(EStockType.getDefault().getSymbol1());
-            userRecharges.get(i).setChannelName(EStockType.getDefault().getSymbol());
+            //SitePay s =   sitePayMapper.selectById(userRecharges.get(i).getPayId());
+            if (StringUtils.isNotBlank(userRecharges.get(i).getAssetsType())) {
+                EStockType eStockType = EStockType.getEStockTypeByCode(userRecharges.get(i).getAssetsType());
+                userRecharges.get(i).setAssetsType(eStockType.getSymbol1());
+                userRecharges.get(i).setChannelName(eStockType.getSymbol());
+            } else {
+                userRecharges.get(i).setAssetsType(EStockType.getDefault().getSymbol1());
+                userRecharges.get(i).setChannelName(EStockType.getDefault().getSymbol());
+            }
+
         }
 
         return ServerResponse.createBySuccess(pageInfo);
@@ -315,11 +326,13 @@
     }
 
 
-    public ServerResponse createOrder(Integer userId, Integer state, Integer amt, String payChannel) {
+    public ServerResponse createOrder(Integer userId, Integer state, Integer amt, String payChannel, String accectType) {
         if (userId == null || state == null || amt == null) {
             return ServerResponse.createByErrorMsg("参数不能为空");
         }
-
+        if (accectType == null || accectType.isEmpty()) {
+            accectType = EStockType.getDefault().getCode();
+        }
         try {
             User user = this.userMapper.selectById(userId);
             if (user == null) {
@@ -340,7 +353,8 @@
             userRecharge.setPayTime(new Date());
             userRecharge.setOrderStatus(Integer.valueOf(1));
             userRecharge.setPayId(1);
-            userAssetsServices.availablebalanceChange(EStockType.getDefault().getCode(),
+            userRecharge.setAssetsType(accectType);
+            userAssetsServices.availablebalanceChange(accectType,
                     userId,EUserAssets.TOP_UP,new BigDecimal(amt),"","");
             int insertCount = this.userRechargeMapper.insert(userRecharge);
             if (insertCount > 0) {
@@ -394,4 +408,11 @@
 
         return userRecharges;
     }
+
+    @Override
+    public int countPendingRecharge() {
+        com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<UserRecharge> queryWrapper = new com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<>();
+        queryWrapper.eq("order_status", 0);
+        return this.userRechargeMapper.selectCount(queryWrapper).intValue();
+    }
 }

--
Gitblit v1.9.3