package com.ruoyi.user.controller;
|
|
|
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.security.service.TokenService;
|
import com.ruoyi.system.api.model.LoginUserInfo;
|
import com.ruoyi.user.entity.Withdraw;
|
import com.ruoyi.user.service.WithdrawService;
|
import com.ruoyi.user.vo.WithdrawListVO;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import javax.annotation.Resource;
|
import java.util.List;
|
|
/**
|
* <p>
|
* 用户提现申请记录表 前端控制器
|
* </p>
|
*
|
* @author hjl
|
* @since 2024-06-07
|
*/
|
@RestController
|
@RequestMapping("/withdraw")
|
@Api(tags = {"用户端-提现"})
|
public class WithdrawController {
|
|
@Resource
|
private WithdrawService withdrawService;
|
@Resource
|
private TokenService tokenService;
|
|
@GetMapping("/withdrawList")
|
@ApiOperation(value = "提现列表", tags = {"用户端-个人中心"})
|
public R<WithdrawListVO> withdrawList() {
|
LoginUserInfo loginUser = tokenService.getLoginUserByUser();
|
if (null == loginUser) {
|
return R.loginExpire("登录失效!");
|
}
|
return R.ok(withdrawService.withdrawList(loginUser.getUserid()));
|
}
|
|
@GetMapping("/confirmWithdraw")
|
@ApiOperation(value = "确认提现", tags = {"用户端-个人中心"})
|
@ApiImplicitParams({
|
@ApiImplicitParam(value = "订单id", name = "orderId", dataType = "Integer", required = true)
|
})
|
public R<Boolean> confirmWithdraw(@RequestParam Integer orderId) {
|
LoginUserInfo loginUser = tokenService.getLoginUserByUser();
|
if (null == loginUser) {
|
return R.loginExpire("登录失效!");
|
}
|
return R.ok(withdrawService.confirmWithdraw(orderId, loginUser.getUserid()));
|
}
|
|
@GetMapping("/withdrawRecord")
|
@ApiOperation(value = "提现记录", tags = {"用户端-个人中心"})
|
public R<List<Withdraw>> withdrawRecord() {
|
LoginUserInfo loginUser = tokenService.getLoginUserByUser();
|
if (null == loginUser) {
|
return R.loginExpire("登录失效!");
|
}
|
return R.ok(withdrawService.lambdaQuery().eq(Withdraw::getUserId, loginUser.getUserid())
|
.eq(Withdraw::getIsDelete, 0).orderByDesc(Withdraw::getCreateTime).list());
|
}
|
|
}
|