| | |
| | | import com.ruoyi.account.vo.WithdrawalAuth; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | |
| | | |
| | | @Resource |
| | | private BalanceChangeRecordService balanceChangeRecordService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | /** |
| | | * 提现申请 |
| | |
| | | singlePay.setCallbackUrl("/account/withdrawal-requests/withdrawalCallback"); |
| | | SinglePayResult singlePayResult = TransferUtil.singlePay(singlePay); |
| | | if(null == singlePayResult){ |
| | | LoginUser loginUserApplet = tokenService.getLoginUserApplet(); |
| | | AppUser appUser = appUserService.getById(loginUserApplet.getUserid()); |
| | | BigDecimal balance = appUser.getBalance(); |
| | | BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord(); |
| | | balanceChangeRecord.setAppUserId(appUser.getId()); |
| | | balanceChangeRecord.setVipId(appUser.getVipId()); |
| | | // balanceChangeRecord.setOrderId(withdrawalRequests.getId()); |
| | | balanceChangeRecord.setChangeType(2); |
| | | balanceChangeRecord.setChangeAmount(withdrawalAmount); |
| | | balanceChangeRecord.setDelFlag(0); |
| | | balanceChangeRecord.setCreateTime(LocalDateTime.now()); |
| | | balanceChangeRecord.setChangeDirection(-1); |
| | | balanceChangeRecordService.save(balanceChangeRecord); |
| | | return R.fail("转账失败"); |
| | | } |
| | | withdrawal.setStatus(1); |
| | |
| | | balanceChangeRecord.setVipId(appUser.getVipId()); |
| | | balanceChangeRecord.setOrderId(withdrawal.getId()); |
| | | balanceChangeRecord.setChangeType(2); |
| | | balanceChangeRecord.setBeforeAmount(balance); |
| | | balanceChangeRecord.setChangeAmount(withdrawalAmount); |
| | | balanceChangeRecord.setAfterAmount(appUser.getBalance()); |
| | | balanceChangeRecord.setDelFlag(0); |
| | | balanceChangeRecord.setCreateTime(LocalDateTime.now()); |
| | | balanceChangeRecord.setChangeDirection(-1); |
| | | balanceChangeRecordService.save(balanceChangeRecord); |
| | | } |
| | | withdrawal.setAuditStatus(auditStatus); |
| | |
| | | balanceChangeRecord.setVipId(appUser.getVipId()); |
| | | balanceChangeRecord.setOrderId(withdrawalRequests.getId()); |
| | | balanceChangeRecord.setChangeType(2); |
| | | balanceChangeRecord.setBeforeAmount(balance); |
| | | balanceChangeRecord.setChangeAmount(withdrawalAmount); |
| | | balanceChangeRecord.setAfterAmount(appUser.getBalance()); |
| | | balanceChangeRecord.setDelFlag(0); |
| | | balanceChangeRecord.setCreateTime(LocalDateTime.now()); |
| | | balanceChangeRecord.setChangeDirection(-1); |
| | | balanceChangeRecordService.save(balanceChangeRecord); |
| | | |
| | | withdrawalRequests.setStatus(3); |