From e0f4ae4b29578beadb3bde5dc71b557f9f3b20ea Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期四, 04 九月 2025 12:02:37 +0800 Subject: [PATCH] bug修改 --- ManagementZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TPubWithdrawalController.java | 54 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 47 insertions(+), 7 deletions(-) diff --git a/ManagementZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TPubWithdrawalController.java b/ManagementZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TPubWithdrawalController.java index bc8208a..04e1e60 100644 --- a/ManagementZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TPubWithdrawalController.java +++ b/ManagementZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TPubWithdrawalController.java @@ -1,5 +1,7 @@ package com.stylefeng.guns.modular.system.controller.general; +import com.alibaba.fastjson.JSONObject; +import com.alipay.api.AlipayApiException; import com.baomidou.mybatisplus.plugins.Page; import com.stylefeng.guns.core.base.controller.BaseController; import com.stylefeng.guns.core.common.constant.factory.PageFactory; @@ -8,12 +10,19 @@ import com.stylefeng.guns.core.util.ExcelExportUtil; import com.stylefeng.guns.core.util.SinataUtil; import com.stylefeng.guns.core.util.ToolUtil; +import com.stylefeng.guns.modular.system.model.TDriver; import com.stylefeng.guns.modular.system.model.TPubWithdrawal; import com.stylefeng.guns.modular.system.model.TSystemNotice; +import com.stylefeng.guns.modular.system.model.TUser; +import com.stylefeng.guns.modular.system.service.ITDriverService; import com.stylefeng.guns.modular.system.service.ITPubWithdrawalService; import com.stylefeng.guns.modular.system.service.ITSystemNoticeService; +import com.stylefeng.guns.modular.system.service.ITUserService; import com.stylefeng.guns.modular.system.util.HttpRequestUtil; import com.stylefeng.guns.modular.system.util.PushURL; +import com.stylefeng.guns.modular.system.util.ResultUtil; +import com.stylefeng.guns.modular.system.util.alipay.AlipayUtils; +import com.stylefeng.guns.modular.system.util.alipay.UUIDUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -21,6 +30,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.text.SimpleDateFormat; import java.util.*; /** @@ -37,9 +47,13 @@ @Autowired private ITPubWithdrawalService tPubWithdrawalService; + @Autowired + private ITUserService userService; @Autowired private ITSystemNoticeService tSystemNoticeService; + @Autowired + private ITDriverService driverService; /** * 跳转到提现列表首页 @@ -115,7 +129,7 @@ */ @RequestMapping(value = "/immediately") @ResponseBody - public Object immediately(@RequestParam Integer id,@RequestParam Integer state,@RequestParam String remark) { + public Object immediately(@RequestParam Integer id,@RequestParam Integer state,@RequestParam String remark) throws AlipayApiException { TPubWithdrawal tPubWithdrawal = tPubWithdrawalService.selectById(id); if (SinataUtil.isNotEmpty(tPubWithdrawal)){ // tPubWithdrawal.setState(state); //调用接口修改状态 @@ -125,16 +139,42 @@ Integer stateObj = 1; if (2 == state){ //同意提现 stateObj = 1; + // 支付宝提现 + String certNo = ""; + if (tPubWithdrawal.getUserType()==1){ + TUser tUser = userService.selectById(tPubWithdrawal.getUserId()); + certNo = tUser.getIdCard(); + + }else{ + TDriver tDriver = driverService.selectById(tPubWithdrawal.getUserId()); + certNo = tDriver.getIdCard(); + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); + String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); + String s = AlipayUtils.aliWithdrawal(code, tPubWithdrawal.getMoney() + "", tPubWithdrawal.getCode(), certNo); + JSONObject res = JSONObject.parseObject(s); + JSONObject alipayFundTransUniTransferResponse = res.getJSONObject("alipay_fund_trans_uni_transfer_response"); + if (alipayFundTransUniTransferResponse!=null){ + if (alipayFundTransUniTransferResponse.getString("status").equals("Success")){ + String string = alipayFundTransUniTransferResponse.getString("order_id"); + tPubWithdrawal.setOrderNumber(string); + }else{ + return ResultUtil.error("提现失败:"+alipayFundTransUniTransferResponse.getString("msg")); + } + } + System.err.println("支付宝提现返回信息"+s); + tPubWithdrawal.setOutOrderNo(code); + tPubWithdrawalService.updateById(tPubWithdrawal); }else if (3 == state){ //拒绝提现 stateObj = 2; } - tPubWithdrawalService.updateById(tPubWithdrawal); - Map<String,String> map = new HashMap<>(); - map.put("id", String.valueOf(tPubWithdrawal.getId())); - map.put("state", String.valueOf(stateObj)); - String result = HttpRequestUtil.postRequest(PushURL.withdraw_auth_url, map); - System.out.println("提现审核接口 :【recordId="+tPubWithdrawal.getId().toString()+"】,调用接口:"+result); +// Map<String,String> map = new HashMap<>(); +// map.put("id", String.valueOf(tPubWithdrawal.getId())); +// map.put("state", String.valueOf(stateObj)); +// String result = HttpRequestUtil.postRequest(PushURL.withdraw_auth_url, map); +// System.out.println("提现审核接口 :【recordId="+tPubWithdrawal.getId().toString()+"】,调用接口:"+result); + //增加系统消息 TSystemNotice notice = new TSystemNotice(); -- Gitblit v1.7.1