| | |
| | | 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.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; |
| | |
| | | |
| | | @Autowired |
| | | private ITPubWithdrawalService tPubWithdrawalService; |
| | | @Autowired |
| | | private ITUserService userService; |
| | | |
| | | @Autowired |
| | | private ITSystemNoticeService tSystemNoticeService; |
| | |
| | | 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); |
| | | TDriver tDriver = driverService.selectById(tPubWithdrawal.getUserId()); |
| | | System.err.println("支付宝提现返回信息"+AlipayUtils.aliWithdrawal(code,tPubWithdrawal.getMoney()+"",tPubWithdrawal.getCode(),tDriver.getIdCard())); |
| | | tPubWithdrawal.setOutOrderNo( code); |
| | | 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; |