zxl
2025-05-12 fdcdd41fba7874c045766e3dea54d56d70df73ef
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
package com.ycl.platform.controller;
 
import com.ycl.platform.domain.form.ReportAuditingForm;
import com.ycl.platform.domain.form.ReportForm;
import com.ycl.platform.domain.query.ReportQuery;
import com.ycl.platform.domain.vo.ReportVO;
import com.ycl.platform.service.ReportService;
import com.ycl.system.Result;
import com.ycl.system.domain.group.Add;
import com.ycl.system.domain.group.Update;
import com.ycl.utils.poi.ExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.NotEmpty;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
/**
 * 报备 前端控制器
 *
 * @author xp
 * @since 2024-03-19
 */
@Validated
@RequiredArgsConstructor
@Api(value = "报备", tags = "报备管理")
@RestController
@RequestMapping("/report")
public class ReportController {
 
    private final ReportService reportService;
 
    @PostMapping
    @ApiOperation(value = "添加", notes = "添加")
    @PreAuthorize("@ss.hasPermi('system:report:add')")
    public Result add(@RequestBody @Validated(Add.class) ReportForm form) {
        return reportService.add(form);
    }
 
    @PostMapping("/import")
    @ApiOperation(value = "导入", notes = "导入")
    @PreAuthorize("@ss.hasPermi('system:report:add')")
    public Result importData(ReportForm form) {
        return reportService.importData(form);
    }
 
    @GetMapping("/getTogether/{pid}")
    @ApiOperation(value = "获取同一批次的报备", notes = "获取同一批次的报备")
    public Result getTogether(@PathVariable("pid") String pid) {
        return reportService.getTogether(pid);
    }
 
    @PostMapping("/importTemplate")
    @ApiOperation(value = "导入模板", notes = "导入模板")
    @PreAuthorize("@ss.hasPermi('system:report:add')")
    public void importTemplate(HttpServletResponse response) {
        reportService.importTemplate(response);
    }
 
    @PutMapping
    @ApiOperation(value = "修改", notes = "修改")
    @PreAuthorize("@ss.hasPermi('system:report:edit')")
    public Result update(@RequestBody @Validated(Update.class) ReportForm form) {
        return reportService.update(form);
    }
 
    @DeleteMapping("/{id}")
    @ApiOperation(value = "ID删除", notes = "ID删除")
    @PreAuthorize("@ss.hasPermi('system:report:remove')")
    public Result removeById(@PathVariable("id") String id) {
        return reportService.removeById(id);
    }
 
    @DeleteMapping("/batch")
    @ApiOperation(value = "批量删除", notes = "批量删除")
    @PreAuthorize("@ss.hasPermi('system:report:remove')")
    public Result remove(@RequestBody @NotEmpty(message = "请选择数据") List<String> ids) {
        return reportService.remove(ids);
    }
 
    @PostMapping("/page")
    @ApiOperation(value = "分页", notes = "分页")
    @PreAuthorize("@ss.hasPermi('system:report:page')")
    public Result page(@RequestBody ReportQuery query) {
        return reportService.page(query);
    }
 
    @GetMapping("/{id}")
    @ApiOperation(value = "详情", notes = "详情")
    @PreAuthorize("@ss.hasPermi('system:report:query')")
    public Result detail(@PathVariable("id") String id) {
        return reportService.detail(id);
    }
 
    @GetMapping("/list")
    @ApiOperation(value = "列表", notes = "列表")
    @PreAuthorize("@ss.hasPermi('system:report:list')")
    public Result list() {
        return reportService.all();
    }
 
    @GetMapping("/auditing/record/{id}")
    @ApiOperation(value = "审核记录", notes = "审核记录")
    @PreAuthorize("@ss.hasPermi('system:report:record')")
    public Result auditingRecord(@PathVariable("id") Integer id) {
        return reportService.auditingRecord(id);
    }
 
    @PostMapping("/auditing")
    @ApiOperation(value = "审核", notes = "审核")
    @PreAuthorize("@ss.hasPermi('system:report:auditing')")
    public Result auditing(@RequestBody @Validated ReportAuditingForm form) {
        return reportService.auditing(form);
    }
 
    @PostMapping("/export")
    @ApiOperation(value = "导出", notes = "导出")
    @PreAuthorize("@ss.hasPermi('system:report:export')")
    public void export(HttpServletResponse response, ReportQuery query)
    {
        List<ReportVO> list = reportService.export(query);
        ExcelUtil<ReportVO> util = new ExcelUtil<>(ReportVO.class);
        util.exportExcel(response, list, "运维单位");
    }
 
    @GetMapping("/list/{gb}")
    @ApiOperation(value = "根据国标码查报备", notes = "根据国标码查报备")
    public Result getListByGb(@PathVariable("gb") String gb)
    {
        return reportService.getListByGb(gb);
    }
}