| | |
| | | package com.ycl.platform.controller; |
| | | |
| | | import com.ycl.system.domain.group.Update; |
| | | import com.ycl.system.domain.group.Add; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import lombok.RequiredArgsConstructor; |
| | | import java.util.List; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import com.ycl.platform.service.ReportService; |
| | | import com.ycl.system.Result; |
| | | 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; |
| | | |
| | | /** |
| | | * 报备 前端控制器 |
| | |
| | | |
| | | @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); |
| | | } |
| | | } |