fuliqi
2025-01-07 e23edcf2619ad46fd77a710fca6c21de78234bc0
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package com.ycl.platform.controller;
 
import com.ycl.platform.domain.entity.CalculateRecord;
import com.ycl.platform.domain.form.CalculateReportBackfillForm;
import com.ycl.platform.domain.query.CalculateReportQuery;
import com.ycl.platform.service.CalculateReportService;
import com.ycl.system.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
/**
 * 核算报告 前端控制器
 *
 * @author xp
 * @since 2024-04-23
 */
@Validated
@RequiredArgsConstructor
@Api(value = "核算报告", tags = "核算报告管理")
@RestController
@RequestMapping("/calculate-report")
public class CalculateReportController {
 
    private final CalculateReportService calculateReportService;
 
    @GetMapping("/page")
    @ApiOperation(value = "分页", notes = "分页")
    @PreAuthorize("@ss.hasPermi('system:calculate:report:page')")
    public Result page(CalculateReportQuery query) {
        return calculateReportService.page(query);
    }
 
    @PostMapping("/backfill/money")
    @ApiOperation(value = "回填扣款金额", notes = "回填扣款金额")
    @PreAuthorize("@ss.hasPermi('system:calculate:report:backfill')")
    public Result backfill(@Validated @RequestBody CalculateReportBackfillForm form) {
        return calculateReportService.backfill(form);
    }
 
    @GetMapping("/{contractId}/{whichYear}")
    @ApiOperation(value = "详情", notes = "详情")
    @PreAuthorize("@ss.hasPermi('system:calculate:report:detail')")
    public Result detail(@PathVariable("contractId") Integer contractId,@PathVariable("whichYear") Integer whichYear) {
        CalculateReportQuery query = new CalculateReportQuery();
        query.setContractId(contractId);
        query.setWhichYear(whichYear);
        return calculateReportService.detail(query);
    }
 
    @PutMapping("/status/{contractId}/{whichYear}")
    @ApiOperation(value = "修改发布状态", notes = "修改发布状态")
    @PreAuthorize("@ss.hasPermi('system:calculate:report:status')")
    public Result updatePublishStatus(@PathVariable("contractId") Integer contractId,@PathVariable("whichYear") Integer whichYear) {
        return calculateReportService.updatePublishStatus(contractId,whichYear);
    }
 
    @PutMapping("/status/detail/{id}/{status}")
    @ApiOperation(value = "修改发布状态", notes = "修改发布状态")
    @PreAuthorize("@ss.hasPermi('system:calculate:report:status')")
    public Result updatePublishStatusById(@PathVariable("id") Integer id,@PathVariable("status") String status) {
 
        return calculateReportService.updatePublishStatusById(id,status);
    }
    @PostMapping("/export")
    @ApiOperation(value = "导出", notes = "导出")
    @PreAuthorize("@ss.hasPermi('system:calculate:report:export')")
    public void export(Integer calculateId,Integer contractId, HttpServletResponse response) {
        calculateReportService.export(calculateId,contractId, response);
    }
 
}