|
|
@@ -1,95 +1,92 @@
|
|
|
-package cn.iocoder.yudao.module.iscs.controller.admin.exception;
|
|
|
-
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
-import jakarta.annotation.Resource;
|
|
|
-import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
-import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
-import io.swagger.v3.oas.annotations.Parameter;
|
|
|
-import io.swagger.v3.oas.annotations.Operation;
|
|
|
-
|
|
|
-import jakarta.validation.constraints.*;
|
|
|
-import jakarta.validation.*;
|
|
|
-import jakarta.servlet.http.*;
|
|
|
-import java.util.*;
|
|
|
-import java.io.IOException;
|
|
|
-
|
|
|
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
-import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
-import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
-
|
|
|
-import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
-
|
|
|
-import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
-import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
|
|
-
|
|
|
-import cn.iocoder.yudao.module.iscs.controller.admin.exception.vo.*;
|
|
|
-import cn.iocoder.yudao.module.iscs.dal.dataobject.exception.ExceptionDO;
|
|
|
-import cn.iocoder.yudao.module.iscs.service.exception.ExceptionService;
|
|
|
-
|
|
|
-@Tag(name = "管理后台 - 异常记录")
|
|
|
-@RestController
|
|
|
-@RequestMapping("/iscs/exception")
|
|
|
-@Validated
|
|
|
-public class ExceptionController {
|
|
|
-
|
|
|
- @Resource
|
|
|
- private ExceptionService exceptionService;
|
|
|
-
|
|
|
- @PostMapping("/insertException")
|
|
|
- @Operation(summary = "创建异常记录")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:exception:create')")
|
|
|
- public CommonResult<Long> insertException(@Valid @RequestBody ExceptionSaveReqVO createReqVO) {
|
|
|
- return success(exceptionService.createException(createReqVO));
|
|
|
- }
|
|
|
-
|
|
|
- @PutMapping("/updateException")
|
|
|
- @Operation(summary = "更新异常记录")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:exception:update')")
|
|
|
- public CommonResult<Boolean> updateException(@Valid @RequestBody ExceptionSaveReqVO updateReqVO) {
|
|
|
- exceptionService.updateException(updateReqVO);
|
|
|
- return success(true);
|
|
|
- }
|
|
|
-
|
|
|
- @DeleteMapping("/deleteExceptionList")
|
|
|
- @Parameter(name = "ids", description = "编号", required = true)
|
|
|
- @Operation(summary = "批量删除异常记录")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:exception:delete')")
|
|
|
- public CommonResult<Boolean> deleteExceptionList(@RequestParam("ids") List<Long> ids) {
|
|
|
- exceptionService.deleteExceptionListByIds(ids);
|
|
|
- return success(true);
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/selectExceptionById")
|
|
|
- @Operation(summary = "获得异常记录")
|
|
|
- @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:exception:query')")
|
|
|
- public CommonResult<ExceptionRespVO> selectExceptionById(@RequestParam("id") Long id) {
|
|
|
- ExceptionDO exception = exceptionService.getException(id);
|
|
|
- return success(BeanUtils.toBean(exception, ExceptionRespVO.class));
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/getExceptionPage")
|
|
|
- @Operation(summary = "获得异常记录分页")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:exception:query')")
|
|
|
- public CommonResult<PageResult<ExceptionRespVO>> getExceptionPage(@Valid ExceptionPageReqVO pageReqVO) {
|
|
|
- PageResult<ExceptionDO> pageResult = exceptionService.getExceptionPage(pageReqVO);
|
|
|
- return success(BeanUtils.toBean(pageResult, ExceptionRespVO.class));
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/exportExceptionExcel")
|
|
|
- @Operation(summary = "导出异常记录 Excel")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:exception:export')")
|
|
|
- @ApiAccessLog(operateType = EXPORT)
|
|
|
- public void exportExceptionExcel(@Valid ExceptionPageReqVO pageReqVO,
|
|
|
- HttpServletResponse response) throws IOException {
|
|
|
- pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
- List<ExceptionDO> list = exceptionService.getExceptionPage(pageReqVO).getList();
|
|
|
- // 导出 Excel
|
|
|
- ExcelUtils.write(response, "异常记录.xls", "数据", ExceptionRespVO.class,
|
|
|
- BeanUtils.toBean(list, ExceptionRespVO.class));
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
+package cn.iocoder.yudao.module.iscs.controller.admin.exception;
|
|
|
+
|
|
|
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
+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.framework.common.util.object.BeanUtils;
|
|
|
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.exception.vo.ExceptionPageReqVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.exception.vo.ExceptionRespVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.exception.vo.ExceptionSaveReqVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.service.exception.ExceptionService;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import jakarta.annotation.Resource;
|
|
|
+import jakarta.servlet.http.HttpServletResponse;
|
|
|
+import jakarta.validation.Valid;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
+
|
|
|
+@Tag(name = "管理后台 - 异常记录")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/iscs/exception")
|
|
|
+@Validated
|
|
|
+public class ExceptionController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private ExceptionService exceptionService;
|
|
|
+
|
|
|
+ @PostMapping("/insertException")
|
|
|
+ @Operation(summary = "创建异常记录")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:exception:create')")
|
|
|
+ public CommonResult<Long> insertException(@Valid @RequestBody ExceptionSaveReqVO createReqVO) {
|
|
|
+ return success(exceptionService.createException(createReqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/updateException")
|
|
|
+ @Operation(summary = "结束异常")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:exception:update')")
|
|
|
+ public CommonResult<Boolean> updateException(@Valid @RequestBody ExceptionSaveReqVO updateReqVO) {
|
|
|
+ exceptionService.updateException(updateReqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/deleteExceptionList")
|
|
|
+ @Parameter(name = "ids", description = "编号", required = true)
|
|
|
+ @Operation(summary = "批量删除异常记录")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:exception:delete')")
|
|
|
+ public CommonResult<Boolean> deleteExceptionList(@RequestParam("ids") List<Long> ids) {
|
|
|
+ exceptionService.deleteExceptionListByIds(ids);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/selectExceptionById")
|
|
|
+ @Operation(summary = "获得异常记录")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:exception:query')")
|
|
|
+ public CommonResult<ExceptionRespVO> selectExceptionById(@RequestParam("id") Long id) {
|
|
|
+ ExceptionRespVO exception = exceptionService.getException(id);
|
|
|
+ return success(exception);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/getExceptionPage")
|
|
|
+ @Operation(summary = "获得异常记录分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:exception:query')")
|
|
|
+ public CommonResult<PageResult<ExceptionRespVO>> getExceptionPage(@Valid ExceptionPageReqVO pageReqVO) {
|
|
|
+ PageResult<ExceptionRespVO> pageResult = exceptionService.getExceptionPage(pageReqVO);
|
|
|
+ return success(pageResult);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/exportExceptionExcel")
|
|
|
+ @Operation(summary = "导出异常记录 Excel")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:exception:export')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportExceptionExcel(@Valid ExceptionPageReqVO pageReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ List<ExceptionRespVO> list = exceptionService.getExceptionPage(pageReqVO).getList();
|
|
|
+ // 导出 Excel
|
|
|
+ ExcelUtils.write(response, "异常记录.xls", "数据", ExceptionRespVO.class,
|
|
|
+ BeanUtils.toBean(list, ExceptionRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|