| | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.modular.account.dao.TBankNextMapper; |
| | | import com.stylefeng.guns.modular.account.model.TBankNext; |
| | | import com.stylefeng.guns.modular.account.server.UserBankAccountService; |
| | | import com.stylefeng.guns.modular.account.server.UserWithdrawalService; |
| | | import com.stylefeng.guns.modular.cloudPayment.example.CusApplicationExample; |
| | | import com.stylefeng.guns.modular.huifu.biz.DouGongBasicDataBiz; |
| | | import com.stylefeng.guns.modular.system.model.UserBankAccount; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.model.UserWithdrawal; |
| | |
| | | import com.stylefeng.guns.modular.system.service.IWithdrawalService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.WithdrawalWarpper; |
| | | import com.unionpay.upyzt.resp.CusApplicationResp; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | |
| | | @Resource |
| | | private TBankNextMapper tBankNextMapper; |
| | | @Autowired |
| | | private DouGongBasicDataBiz douGongBasicDataBiz; |
| | | |
| | | /** |
| | | * 账户余额提现操作 |
| | |
| | | @ApiImplicitParam(value = "银行名称", name = "bankName", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "银行卡号", name = "code", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "银行卡持有人姓名", name = "name", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "验证码", name = "smsCode", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "验证码-废弃", name = "smsCode", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil withdrawal(Double money, String bankName, String code, String name,String smsCode,HttpServletRequest request){ |
| | |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | UserWithdrawal userWithdrawal = userWithdrawalService.selectOne(new EntityWrapper<UserWithdrawal>() |
| | | .eq("phone", userInfo.getPhone()) |
| | | .eq("type", 1) |
| | | .last("LIMIT 1")); |
| | | if(Objects.isNull(userWithdrawal)){ |
| | | return ResultUtil.error("请先进行个人用户进件信息填写"); |
| | | } |
| | | TBankNext bankName1 = tBankNextMapper.selectList(new EntityWrapper<TBankNext>().eq("bankName", bankName)).get(0); |
| | | //TBankNext bankName1 = tBankNextMapper.selectList(new EntityWrapper<TBankNext>().eq("bankName", bankName)).get(0); |
| | | userWithdrawal.setBankCardCode(code); |
| | | userWithdrawal.setBankCode(bankName1.getDrecCode()); |
| | | userWithdrawal.setBankBranchCode(bankName1.getBankCode()); |
| | | userWithdrawal.setCode(smsCode); |
| | | CusApplicationResp renew = CusApplicationExample.renew(userWithdrawal); |
| | | //userWithdrawal.setBankCode(bankName1.getDrecCode()); |
| | | //userWithdrawal.setBankBranchCode(bankName1.getBankCode()); |
| | | //userWithdrawal.setCode(smsCode); |
| | | //CusApplicationResp renew = CusApplicationExample.renew(userWithdrawal); |
| | | //System.err.println("修改个人用户进件信息返回"+renew); |
| | | if("succeeded".equals(renew.getApplicationStatus())){ |
| | | // 修改银行卡信息 |
| | | //bankCard.setSettleAcctId(renew.getSettleAcctId()); |
| | | bankAccountService.updateById(bankCard); |
| | | |
| | | userWithdrawal.setBankCardCode(code); |
| | | userWithdrawal.setBankCode(bankCard.getBankCode()); |
| | | userWithdrawal.setBankBranchCode(bankCard.getBankBranchCode()); |
| | | userWithdrawal.setBankName(bankCard.getBankName()); |
| | | //userWithdrawal.setSettleAcctId(renew.getSettleAcctId()); |
| | | //userWithdrawal.setBalanceAcctId(renew.getBalanceAcctId()); |
| | | userWithdrawalService.updateById(userWithdrawal); |
| | | return withdrawalService.withdrawal(money, bankName, code, name, uid); |
| | | }else { |
| | | return ResultUtil.error(renew.getFailureMsgs().get(0).getReason()); |
| | | userWithdrawal.setBankCardProvinceCode(bankCard.getBankCardProvinceCode()); |
| | | userWithdrawal.setBankCardCityCode(bankCard.getBankCardCityCode()); |
| | | Map<String, Object> map = douGongBasicDataBiz.userBasicDataIndvModify(userWithdrawal); |
| | | if (!"00000000".equals(map.get("resp_code"))) { |
| | | return ResultUtil.error("修改个人用户进件信息失败,原因:" + map.get("resp_desc")); |
| | | } |
| | | |
| | | |
| | | Map<String, Object> res = douGongBasicDataBiz.userBusinessOpenModify(userWithdrawal); |
| | | if (!"00000000".equals(res.get("resp_code"))) { |
| | | return ResultUtil.error("修改个人用户进件信息失败,原因:" + res.get("resp_desc")); |
| | | } |
| | | userWithdrawal.setBankCardCode(code); |
| | | userWithdrawal.setBankCode(bankCard.getBankCode()); |
| | | userWithdrawal.setBankBranchCode(bankCard.getBankBranchCode()); |
| | | userWithdrawal.setBankName(bankCard.getBankName()); |
| | | //userWithdrawal.setSettleAcctId(renew.getSettleAcctId()); |
| | | //userWithdrawal.setBalanceAcctId(renew.getBalanceAcctId()); |
| | | userWithdrawal.setHuifuId((String) map.get("huifu_id")); |
| | | String tokenNo = (String) res.get("token_no"); |
| | | userWithdrawal.setTokenNo(tokenNo); |
| | | userWithdrawalService.updateById(userWithdrawal); |
| | | return withdrawalService.withdrawal(money, bankName, code, name, uid); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |