| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.BalanceChangeRecord; |
| | | import com.ruoyi.account.api.model.WithdrawalRequests; |
| | | import com.ruoyi.account.dto.WithQuery; |
| | | import com.ruoyi.account.dto.WithdrawalRequestsDTO; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.WithdrawalRequestsService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/withdrawal-requests") |
| | | @Api(tags = "提现申请") |
| | | public class WithdrawalRequestsController { |
| | | |
| | | @Resource |
| | | private WithdrawalRequestsService withdrawalRequestsService; |
| | | @Resource |
| | | private AppUserService appUserService; |
| | | |
| | | /** |
| | | * 提现申请 |
| | | */ |
| | | @PostMapping("/withdrawalApply") |
| | | @ApiOperation(value = "提现申请", tags = {"提现申请-小程序"}) |
| | | public AjaxResult withdrawalApply(@RequestBody WithdrawalRequestsDTO params){ |
| | | withdrawalRequestsService.withdrawalApply(params); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @PostMapping("/page") |
| | | @ApiOperation(value = "提现申请列表", tags = {"后台"}) |
| | | public R<IPage<WithdrawalRequests>> page(@RequestBody WithQuery withQuery){ |
| | | IPage<WithdrawalRequests> withdrawalRequestsIPage = withdrawalRequestsService.pageList(withQuery); |
| | | for (WithdrawalRequests record : withdrawalRequestsIPage.getRecords()) { |
| | | record.setIdStr(record.getId().toString()); |
| | | } |
| | | return R.ok(withdrawalRequestsIPage); |
| | | } |
| | | @PostMapping("/auth") |
| | | @ApiOperation(value = "提现申请审批", tags = {"后台"}) |
| | | public R<IPage<WithdrawalRequests>> auth(@RequestParam Long id,@ApiParam("2'审核通过',3'审核拒绝'") Integer auditStatus){ |
| | | WithdrawalRequests byId = withdrawalRequestsService.getById(id); |
| | | if (auditStatus==2){ |
| | | |
| | | //将用户待审核金额减少,已提现金额增加 |
| | | AppUser byId1 = appUserService.getById(byId.getAppUserId()); |
| | | byId1.setWithdrawnAmount(byId1.getWithdrawnAmount().add(byId.getWithdrawalAmount())); |
| | | appUserService.updateById(byId1); |
| | | //执行对应的第三方提现 todo |
| | | } |
| | | //通过 |
| | | byId.setAuditStatus(auditStatus); |
| | | withdrawalRequestsService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |