From 90bbad55c88041f09395587317d06d6d99481e4f Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期六, 22 十一月 2025 18:08:19 +0800
Subject: [PATCH] 提现修改

---
 ManagementJYXTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TPubWithdrawalController.java |   44 +++++++++++++++++++++++++++++++++++---------
 1 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/ManagementJYXTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TPubWithdrawalController.java b/ManagementJYXTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TPubWithdrawalController.java
index a300df6..ad9e150 100644
--- a/ManagementJYXTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TPubWithdrawalController.java
+++ b/ManagementJYXTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TPubWithdrawalController.java
@@ -1,14 +1,18 @@
 package com.stylefeng.guns.modular.system.controller.general;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.plugins.Page;
 import com.stylefeng.guns.core.base.controller.BaseController;
+import com.stylefeng.guns.core.base.tips.ErrorTip;
 import com.stylefeng.guns.core.common.constant.factory.PageFactory;
 import com.stylefeng.guns.core.shiro.ShiroKit;
+import com.stylefeng.guns.core.util.RequestSeqUtil;
 import com.stylefeng.guns.core.util.SinataUtil;
 import com.stylefeng.guns.modular.cloudPayment.example.AllocationExample;
 import com.stylefeng.guns.modular.cloudPayment.example.WithdrawalExample;
 import com.stylefeng.guns.modular.cloudPayment.req.WithdrawalReq;
+import com.stylefeng.guns.modular.huifu.biz.DouGongWithdrawBiz;
 import com.stylefeng.guns.modular.system.model.*;
 import com.stylefeng.guns.modular.system.service.*;
 import com.stylefeng.guns.modular.system.util.HttpRequestUtil;
@@ -51,6 +55,8 @@
     private ITSystemNoticeService tSystemNoticeService;
     @Resource
     private IUserWithdrawalService userWithdrawalService;
+    @Autowired
+    private DouGongWithdrawBiz douGongWithdrawBiz;
 
     /**
      * 跳转到提现列表首页
@@ -134,7 +140,7 @@
      */
     @RequestMapping(value = "/immediately")
     @ResponseBody
-    @Transactional(rollbackFor = UpyztException.class,propagation = Propagation.REQUIRES_NEW)
+    @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRES_NEW)
     public synchronized Object immediately(@RequestParam Integer id,@RequestParam Integer state,@RequestParam String remark) {
         TPubWithdrawal tPubWithdrawal = tPubWithdrawalService.selectById(id);
         if(tPubWithdrawal.getState()!=1){
@@ -176,12 +182,22 @@
                         System.out.println("用户:"+userWithdrawals.get(0));
                         try {
                             log.info("用户提现创建=========");
-                            WithdrawalResp withdrawalResp = WithdrawalExample.create(userWithdrawalService.createInfo(userWithdrawals.get(0), tPubWithdrawal));
-                            tPubWithdrawal.setWithdrawId(withdrawalResp.getWithdrawalId());
+                            String reqSeqId = RequestSeqUtil.generate("TX");
+                            JSONObject result = douGongWithdrawBiz.encashment(reqSeqId, tPubWithdrawal.getMoney(), userWithdrawals.get(0).getHuiFuId(), userWithdrawals.get(0).getTokenNo(), 2);
+                            if (!result.get("resp_code").equals("00000000") || !result.getBoolean("success")) {
+                                return new ErrorTip(500, "操作失败,异常原因:"+result.get("resp_desc"));
+                            }
+
+                            String hfSeqId = (String) result.get("hf_seq_id");
+                            tPubWithdrawal.setReqSeqId(reqSeqId);
+                            tPubWithdrawal.setHfSeqId(hfSeqId);
+                            //WithdrawalResp withdrawalResp = WithdrawalExample.create(userWithdrawalService.createInfo(userWithdrawals.get(0), tPubWithdrawal));
+                            //tPubWithdrawal.setWithdrawId(withdrawalResp.getWithdrawalId());
                             tPubWithdrawalService.updateById(tPubWithdrawal);
-                            log.info("用户提现创建信息========="+withdrawalResp.toString());
+                            //log.info("用户提现创建信息========="+withdrawalResp.toString());
+                            log.info("用户提现创建信息:{}", result.toJSONString());
                             log.info("用户提现创建成功=========");
-                        } catch (UpyztException e) {
+                        } catch (Exception e) {
                             log.info("用户提现创建失败=========");
                             e.printStackTrace();
                             if(userType==1){
@@ -219,12 +235,22 @@
                     }
                     try {
                         log.info("司机提现创建=========");
-                        WithdrawalResp withdrawalResp = WithdrawalExample.create(userWithdrawalService.createInfo(userWithdrawal, tPubWithdrawal));
-                        tPubWithdrawal.setWithdrawId(withdrawalResp.getWithdrawalId());
+                        String reqSeqId = RequestSeqUtil.generate("TX");
+                        JSONObject result = douGongWithdrawBiz.encashment(reqSeqId, tPubWithdrawal.getMoney(), userWithdrawal.getHuiFuId(), userWithdrawal.getTokenNo(), 2);
+                        if (!result.get("resp_code").equals("00000000") || !result.getBoolean("success")) {
+                            return new ErrorTip(500, "操作失败,异常原因:"+result.get("resp_desc"));
+                        }
+
+                        String hfSeqId = (String) result.get("hf_seq_id");
+                        tPubWithdrawal.setReqSeqId(reqSeqId);
+                        tPubWithdrawal.setHfSeqId(hfSeqId);
+                        //WithdrawalResp withdrawalResp = WithdrawalExample.create(userWithdrawalService.createInfo(userWithdrawal, tPubWithdrawal));
+                        //tPubWithdrawal.setWithdrawId(withdrawalResp.getWithdrawalId());
                         tPubWithdrawalService.updateById(tPubWithdrawal);
-                        log.info("司机提现创建信息========="+withdrawalResp.toString());
+                        //log.info("司机提现创建信息========="+withdrawalResp.toString());
+                        log.info("司机提现创建信息:{}", result.toJSONString());
                         log.info("司机提现创建成功=========");
-                    } catch (UpyztException e) {
+                    } catch (Exception e) {
                         log.info("司机提现创建失败=========");
                         e.printStackTrace();
                         if(userType==1){

--
Gitblit v1.7.1