RiderWithdrawController.java
1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.diligrp.rider.controller;
import com.diligrp.rider.common.result.Result;
import com.diligrp.rider.dto.RiderWithdrawApplyDTO;
import com.diligrp.rider.service.RiderWithdrawService;
import com.diligrp.rider.vo.PageResultVO;
import com.diligrp.rider.vo.RiderWithdrawApplyVO;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/rider/withdraw")
@RequiredArgsConstructor
public class RiderWithdrawController {
private final RiderWithdrawService withdrawService;
@PostMapping("/apply")
public Result<Void> apply(@Valid @RequestBody RiderWithdrawApplyDTO dto, HttpServletRequest request) {
Long riderId = (Long) request.getAttribute("riderId");
withdrawService.apply(riderId, dto);
return Result.success();
}
@GetMapping("/list")
public Result<PageResultVO<RiderWithdrawApplyVO>> list(@RequestParam(required = false) Integer status,
@RequestParam(defaultValue = "1") int page,
HttpServletRequest request) {
Long riderId = (Long) request.getAttribute("riderId");
return Result.success(withdrawService.riderList(riderId, status, page));
}
}