From 0b2d47ad50450876b3fd26db354e3021248da869 Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Sun, 21 Sep 2025 19:53:40 +0800
Subject: [PATCH] 1

---
 src/main/java/com/nq/controller/protol/UserController.java |   72 +++++++++++++++++++++++++++++------
 1 files changed, 59 insertions(+), 13 deletions(-)

diff --git a/src/main/java/com/nq/controller/protol/UserController.java b/src/main/java/com/nq/controller/protol/UserController.java
index 7baadd5..b0a11b2 100644
--- a/src/main/java/com/nq/controller/protol/UserController.java
+++ b/src/main/java/com/nq/controller/protol/UserController.java
@@ -28,9 +28,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 @Controller
@@ -71,6 +69,9 @@
     @Autowired
     IApplyLeverServices iApplyLeverServices;
 
+    @Autowired
+    IUserWithdrawService iUserWithdrawService;
+
     private static final ThreadLocal<Boolean> orderCreated = ThreadLocal.withInitial(() -> false);
     private final Lock lock = new ReentrantLock();
 
@@ -105,6 +106,12 @@
     @ResponseBody
     public ServerResponse getMoney( HttpServletRequest request) {
         return this.iUserService.getMoney(request);
+    }
+
+    @RequestMapping("getWeeklyProfit.do")
+    @ResponseBody
+    public ServerResponse getWeeklyProfit( HttpServletRequest request) {
+        return this.iUserService.getWeeklyProfit(request);
     }
 
     //查询用户自选股
@@ -161,9 +168,9 @@
     //一键用户平仓操作
     @RequestMapping({"allsell.do"})
     @ResponseBody
-    public ServerResponse allsell(@RequestParam("stockType") String positionSn,HttpServletRequest request) {
+    public ServerResponse allsell(HttpServletRequest request) {
         try {
-            return this.iUserPositionService.allSell(request,positionSn);
+            return this.iUserPositionService.allSell(request);
         } catch (Exception e) {
             return  ServerResponse.createByErrorMsg("Sell Fail",request);
         }
@@ -415,14 +422,24 @@
      */
     @RequestMapping({"thirdPartyRecharge.do"})
     @ResponseBody
-    public ServerResponse thirdPartyRecharge(@RequestParam("tradeAmoun") String tradeAmoun,HttpServletRequest request) {
+    public ServerResponse thirdPartyRecharge(@RequestParam("tradeAmoun") String tradeAmoun,@RequestParam("type") Integer type,HttpServletRequest request) {
         payLock.lock();
         try {
             if (payCreated.get()) {
                 return ServerResponse.createByErrorMsg("当前充值人数过多,请稍后重试", request);
             }
+            if (!isIntegerGreaterThan100(tradeAmoun)) {
+                return ServerResponse.createByErrorMsg("请输入整数!",request);
+            }
+            if(null == type){
+                return ServerResponse.createByErrorMsg("请选择支付通道!",request);
+            }
+            if(new BigDecimal(tradeAmoun).compareTo(new BigDecimal("1000")) < 0){
+                return ServerResponse.createByErrorMsg("请重新输入,最低充值金额:1000", request);
+            }
+
             payCreated.set(true);
-            return payService.thirdPartyRecharge(request,tradeAmoun);
+            return payService.thirdPartyRecharge(request,tradeAmoun,type);
         } catch (Exception e) {
             e.printStackTrace();
             return ServerResponse.createByErrorMsg("获取充值链接异常,请稍后重试", request);
@@ -431,14 +448,43 @@
             payCreated.set(false);
         }
     }
-
+    // 判断字符串是否是整数且大于100
+    public static boolean isIntegerGreaterThan100(String str) {
+        try {
+            int number = Integer.parseInt(str);  // 尝试将字符串转换为整数
+            return number > 100;  // 判断是否大于100
+        } catch (NumberFormatException e) {
+            return false;  // 如果转换失败,说明不是整数
+        }
+    }
 
     /**
-     * 充值异步接收地址
+     * 充值1异步接收地址
      */
-    @RequestMapping({"rechargeCallback.do"})
-    @ResponseBody
-    public void rechargeCallback(HttpServletResponse response,RechargeCallbackVo rechargeCallbackVo) throws IOException {
-        payService.rechargeCallback(response,rechargeCallbackVo);
+    @PostMapping({"rechargeCallback.do"})
+    public void rechargeCallback(PaymentResponse vo, HttpServletResponse response) throws IOException {
+        payService.rechargeCallback(vo,response);
+    }
+
+    /**
+     * 充值2异步接收地址
+     */
+    @PostMapping({"rechargeCallbackTwo.do"})
+    public void rechargeCallbackTwo(@RequestParam("status") String status,
+                                    @RequestParam("merchantid") String merchantid,
+                                    @RequestParam("out_trade_no") String outTradeNo,
+                                    @RequestParam("total_fee") String totalFee,
+                                    @RequestParam("poundage") String poundage,
+                                    @RequestParam("account_fee") String accountFee,
+                                    @RequestParam("sign") String sign, HttpServletResponse response) throws IOException {
+        TransactionStatusVo vo = new TransactionStatusVo();
+        vo.setStatus(status);
+        vo.setMerchantid(merchantid);
+        vo.setOut_trade_no(outTradeNo);
+        vo.setTotal_fee(totalFee);
+        vo.setPoundage(poundage);
+        vo.setAccount_fee(accountFee);
+        vo.setSign(sign);
+        payService.rechargeCallbackTwo(vo,response);
     }
 }

--
Gitblit v1.9.3