xiaoyi
2 天以前 b5e1bceabb36fe1d1e5e88397280d12e7044c6dd
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
package cn.iocoder.yudao.module.erp.controller.admin.finance;
 
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.erp.dal.dataobject.finance.ErpAfterSaleFinanceDraftDO;
import cn.iocoder.yudao.module.erp.service.finance.ErpAfterSaleFinanceDraftService;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.invalidParamException;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
 
@RestController
@RequestMapping("/erp/finance/after-sale-draft")
public class ErpAfterSaleFinanceDraftController {
    @Resource private ErpAfterSaleFinanceDraftService service;
 
    @GetMapping("/page")
    @PreAuthorize("@ss.hasPermission('erp:after-sale-finance:query')")
    public CommonResult<PageResult<ErpAfterSaleFinanceDraftDO>> page(@Valid PageParam page,
            @RequestParam(value = "status", required = false) Integer status) {
        return success(service.page(page, status));
    }
 
    @PutMapping("/review")
    @PreAuthorize("@ss.hasPermission('erp:after-sale-finance:review')")
    public CommonResult<Boolean> review(@RequestParam("id") Long id, @RequestBody ReviewRequest request) {
        if (request == null || request.approved() == null) throw invalidParamException("请选择审核结果");
        service.review(id, getLoginUserId(), request.approved(), request.remark());
        return success(true);
    }
 
    public record ReviewRequest(Boolean approved, String remark) {}
}