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/TCompanyWithdrawController.java | 69 ++++++++++++++++++++++------------
1 files changed, 44 insertions(+), 25 deletions(-)
diff --git a/ManagementJYXTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCompanyWithdrawController.java b/ManagementJYXTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCompanyWithdrawController.java
index dd661c5..f934bf7 100644
--- a/ManagementJYXTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCompanyWithdrawController.java
+++ b/ManagementJYXTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCompanyWithdrawController.java
@@ -1,22 +1,23 @@
package com.stylefeng.guns.modular.system.controller.general;
+import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.core.base.controller.BaseController;
+import com.stylefeng.guns.core.base.tips.ErrorTip;
import com.stylefeng.guns.core.shiro.ShiroKit;
+import com.stylefeng.guns.core.util.RequestSeqUtil;
import com.stylefeng.guns.core.util.ToolUtil;
-import com.stylefeng.guns.modular.cloudPayment.example.BalanceAcctExample;
import com.stylefeng.guns.modular.cloudPayment.example.WithdrawalExample;
-import com.stylefeng.guns.modular.cloudPayment.req.BalanceAcctReq;
import com.stylefeng.guns.modular.cloudPayment.req.WithdrawalReq;
+import com.stylefeng.guns.modular.huifu.biz.DouGongBasicDataBiz;
+import com.stylefeng.guns.modular.huifu.biz.DouGongWithdrawBiz;
import com.stylefeng.guns.modular.system.controller.util.Base64Util;
import com.stylefeng.guns.modular.system.model.TEnterpriseWithdrawal;
import com.stylefeng.guns.modular.system.model.User;
import com.stylefeng.guns.modular.system.service.ITEnterpriseWithdrawalService;
import com.stylefeng.guns.modular.system.service.IUserService;
-import com.unionpay.upyzt.exception.UpyztException;
-import com.unionpay.upyzt.resp.BalanceAcctListResp;
-import com.unionpay.upyzt.resp.BalanceAcctResp;
import com.unionpay.upyzt.resp.WithdrawalResp;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@@ -41,6 +42,7 @@
* @author fengshuonan
* @Date 2023-03-17 14:18:09
*/
+@Slf4j
@Controller
@RequestMapping("/tCompanyWithdraw")
public class TCompanyWithdrawController extends BaseController {
@@ -53,6 +55,12 @@
@Resource
private ITEnterpriseWithdrawalService enterpriseWithdrawalService;
+ @Autowired
+ private DouGongBasicDataBiz douGongBasicDataBiz;
+
+ @Autowired
+ private DouGongWithdrawBiz douGongWithdrawBiz;
+
/**
* 跳转到首页
*/
@@ -62,14 +70,15 @@
List<TEnterpriseWithdrawal> companyId = enterpriseWithdrawalService.selectList(new EntityWrapper<TEnterpriseWithdrawal>().eq("companyId", id));
if(companyId.size()>0){
try {
- BalanceAcctReq balanceAcctReq = new BalanceAcctReq();
- balanceAcctReq.setMchId(companyId.get(0).getMchId());
- BalanceAcctListResp balanceAcctListResp = BalanceAcctExample.retrieveByUserId(balanceAcctReq);
- Long settledAmount = balanceAcctListResp.getBalanceAccts().get(0).getSettledAmount();
- String money = settledAmount.toString();
- model.addAttribute("money",new BigDecimal(money).divide(new BigDecimal(100)).toString());
- } catch (UpyztException e) {
- e.printStackTrace();
+ //BalanceAcctReq balanceAcctReq = new BalanceAcctReq();
+ //balanceAcctReq.setMchId(companyId.get(0).getMchId());
+ //BalanceAcctListResp balanceAcctListResp = BalanceAcctExample.retrieveByUserId(balanceAcctReq);
+ //Long settledAmount = balanceAcctListResp.getBalanceAccts().get(0).getSettledAmount();
+ //String money = settledAmount.toString();
+ BigDecimal money = douGongBasicDataBiz.balanceQuery(companyId.get(0).getHuifuId());
+ model.addAttribute("money",money.divide(new BigDecimal(100)).toString());
+ } catch (Exception e) {
+ log.error("查询企业用户汇付余额异常", e);
model.addAttribute("money",0);
}
@@ -137,14 +146,15 @@
List<TEnterpriseWithdrawal> companyId = enterpriseWithdrawalService.selectList(new EntityWrapper<TEnterpriseWithdrawal>().eq("companyId", ShiroKit.getUser().getObjectId()));
if(companyId.size()>0){
try {
- BalanceAcctReq balanceAcctReq = new BalanceAcctReq();
- balanceAcctReq.setMchId(companyId.get(0).getMchId());
- BalanceAcctListResp balanceAcctListResp = BalanceAcctExample.retrieveByUserId(balanceAcctReq);
- Long settledAmount = balanceAcctListResp.getBalanceAccts().get(0).getSettledAmount();
- if(settledAmount<money){
+ //BalanceAcctReq balanceAcctReq = new BalanceAcctReq();
+ //balanceAcctReq.setMchId(companyId.get(0).getMchId());
+ //BalanceAcctListResp balanceAcctListResp = BalanceAcctExample.retrieveByUserId(balanceAcctReq);
+ //Long settledAmount = balanceAcctListResp.getBalanceAccts().get(0).getSettledAmount();
+ BigDecimal settledAmount = douGongBasicDataBiz.balanceQuery(companyId.get(0).getHuifuId());
+ if(settledAmount.compareTo(BigDecimal.valueOf(money))<0){
return "5001";
}
- } catch (UpyztException e) {
+ } catch (Exception e) {
e.printStackTrace();
}
@@ -173,14 +183,23 @@
withdrawalReq.setPassword(Base64Util.decode(enterpriseWithdrawal.getTransactionAuthorizationCode()));
}
- WithdrawalResp withdrawalResp = WithdrawalExample.create(withdrawalReq);
+ String reqSeqId = RequestSeqUtil.extractPrefix("TX");
+ JSONObject result = douGongWithdrawBiz.encashment(reqSeqId, BigDecimal.valueOf(withdrawalReq.getAmount()), companyId.get(0).getHuifuId(), companyId.get(0).getTokenNo(), 1);
+ if (!result.get("resp_code").equals("00000000") || !result.getBoolean("success")) {
+ return new ErrorTip(500, "操作失败,异常原因:"+result.get("resp_desc"));
+ }
+ tCompanyWithdraw.setReqSeqId(reqSeqId);
+ String hfSeqId = (String) result.get("hf_seq_id");
+ tCompanyWithdraw.setHfSeqId(hfSeqId);
- System.out.println("公司添加提现:"+withdrawalResp);
- tCompanyWithdraw.setWithdrawId(withdrawalResp.getWithdrawalId());
+ //WithdrawalResp withdrawalResp = WithdrawalExample.create(withdrawalReq);
- } catch (UpyztException e) {
- e.printStackTrace();
- System.out.println("公司添加提现失败:"+e.getIssue());
+ //System.out.println("公司添加提现:"+withdrawalResp);
+ //tCompanyWithdraw.setWithdrawId(withdrawalResp.getWithdrawalId());
+
+ } catch (Exception e) {
+ log.error("公司添加提现异常", e);
+ return new ErrorTip(500, "公司添加提现异常");
}
tCompanyWithdrawService.insert(tCompanyWithdraw);
return SUCCESS_TIP;
--
Gitblit v1.7.1