| | |
| | | package com.stylefeng.guns.modular.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.account.dao.UserWithdrawalMapper; |
| | | import com.stylefeng.guns.modular.account.service.UserWithdrawalService; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.AllocationReq; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.WithdrawalReq; |
| | | import com.stylefeng.guns.modular.system.model.UserWithdrawal; |
| | | import com.unionpay.upyzt.resp.CusApplicationResp; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class UserWithdrawalServiceImpl extends ServiceImpl<UserWithdrawalMapper, UserWithdrawal> implements UserWithdrawalService { |
| | | |
| | | @Override |
| | | public void cusApplicationRespToUserWithdrawal(UserWithdrawal userWithdrawal,CusApplicationResp cusApplicationResp) { |
| | | userWithdrawal.setApplicationStatus(cusApplicationResp.getApplicationStatus()); |
| | | userWithdrawal.setCusId(cusApplicationResp.getCusId()); |
| | | userWithdrawal.setSucceededAt(cusApplicationResp.getSucceededAt()); |
| | | if(!CollectionUtils.isEmpty(cusApplicationResp.getFailureMsgs())){ |
| | | userWithdrawal.setFailureMsgsReason(cusApplicationResp.getFailureMsgs().get(0).getReason()); |
| | | } |
| | | userWithdrawal.setRelAcctNo(cusApplicationResp.getRelAcctNo()); |
| | | userWithdrawal.setBindAcctName(cusApplicationResp.getBindAcctName()); |
| | | userWithdrawal.setBalanceAcctId(cusApplicationResp.getBalanceAcctId()); |
| | | userWithdrawal.setSettleAcctId(cusApplicationResp.getSettleAcctId()); |
| | | userWithdrawal.setCusApplicationId(cusApplicationResp.getCusApplicationId()); |
| | | // 审核通过 |
| | | } |
| | | |
| | | @Override |
| | | public AllocationReq createAllocationReq(String balanceAcctId, String companyBalanceAcctId, Integer amount,String password) { |
| | | AllocationReq allocationReq = new AllocationReq(); |
| | | allocationReq.setOutOrderNo(ToolUtil.getRandomString(32)); |
| | | allocationReq.setPayBalanceAcctId(companyBalanceAcctId); |
| | | allocationReq.setRecvBalanceAcctId(balanceAcctId); |
| | | allocationReq.setAmount(amount*100); |
| | | allocationReq.setOrderNo(ToolUtil.getRandomString(32)); |
| | | allocationReq.setPassword(password); |
| | | allocationReq.setOrderAmount(Long.valueOf(amount)); |
| | | allocationReq.setProductName("司机提现"); |
| | | allocationReq.setProductCount(1); |
| | | return allocationReq; |
| | | } |
| | | |
| | | @Override |
| | | public WithdrawalReq createWithdrawalReq(String balanceAcctId, Integer amount, String password, String code) { |
| | | WithdrawalReq withdrawalReq = new WithdrawalReq(); |
| | | withdrawalReq.setOutOrderNo(ToolUtil.getRandomString(32)); |
| | | withdrawalReq.setBalanceAcctId(balanceAcctId); |
| | | withdrawalReq.setAmount(amount*100); |
| | | withdrawalReq.setBankAcctNo(code); |
| | | withdrawalReq.setPassword(password); |
| | | return withdrawalReq; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean withdrawDeposit(Integer amount, String bankAcctNo, String withdrawPassword) { |