|
|
@@ -0,0 +1,94 @@
|
|
|
+package cn.iocoder.yudao.module.iscs.controller.admin.sop;
|
|
|
+
|
|
|
+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.sop.vo.SopExecutionPlanPageReqVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.sop.vo.SopExecutionPlanRespVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.sop.vo.SopExecutionPlanSaveReqVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.dal.dataobject.sop.SopExecutionPlanDO;
|
|
|
+import cn.iocoder.yudao.module.iscs.service.sop.SopExecutionPlanService;
|
|
|
+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 = "管理后台 - SOP计划执行")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/iscs/sop-execution-plan")
|
|
|
+@Validated
|
|
|
+public class SopExecutionPlanController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private SopExecutionPlanService sopExecutionPlanService;
|
|
|
+
|
|
|
+ @PostMapping("/insertSopExecutionPlan")
|
|
|
+ @Operation(summary = "创建SOP计划执行")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:sop-execution-plan:create')")
|
|
|
+ public CommonResult<Long> insertSopExecutionPlan(@Valid @RequestBody SopExecutionPlanSaveReqVO createReqVO) {
|
|
|
+ return success(sopExecutionPlanService.createSopExecutionPlan(createReqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/updateSopExecutionPlan")
|
|
|
+ @Operation(summary = "更新SOP计划执行")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:sop-execution-plan:update')")
|
|
|
+ public CommonResult<Boolean> updateSopExecutionPlan(@Valid @RequestBody SopExecutionPlanSaveReqVO updateReqVO) {
|
|
|
+ sopExecutionPlanService.updateSopExecutionPlan(updateReqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/deleteSopExecutionPlanList")
|
|
|
+ @Parameter(name = "ids", description = "编号", required = true)
|
|
|
+ @Operation(summary = "批量删除SOP计划执行")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:sop-execution-plan:delete')")
|
|
|
+ public CommonResult<Boolean> deleteSopExecutionPlanList(@RequestParam("ids") List<Long> ids) {
|
|
|
+ sopExecutionPlanService.deleteSopExecutionPlanListByIds(ids);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/selectSopExecutionPlanById")
|
|
|
+ @Operation(summary = "获得SOP计划执行")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:sop-execution-plan:query')")
|
|
|
+ public CommonResult<SopExecutionPlanRespVO> selectSopExecutionPlanById(@RequestParam("id") Long id) {
|
|
|
+ SopExecutionPlanDO sopExecutionPlan = sopExecutionPlanService.getSopExecutionPlan(id);
|
|
|
+ return success(BeanUtils.toBean(sopExecutionPlan, SopExecutionPlanRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/getSopExecutionPlanPage")
|
|
|
+ @Operation(summary = "获得SOP计划执行分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:sop-execution-plan:query')")
|
|
|
+ public CommonResult<PageResult<SopExecutionPlanRespVO>> getSopExecutionPlanPage(@Valid SopExecutionPlanPageReqVO pageReqVO) {
|
|
|
+ PageResult<SopExecutionPlanDO> pageResult = sopExecutionPlanService.getSopExecutionPlanPage(pageReqVO);
|
|
|
+ return success(BeanUtils.toBean(pageResult, SopExecutionPlanRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/exportSopExecutionPlanExcel")
|
|
|
+ @Operation(summary = "导出SOP计划执行 Excel")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:sop-execution-plan:export')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportSopExecutionPlanExcel(@Valid SopExecutionPlanPageReqVO pageReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ List<SopExecutionPlanDO> list = sopExecutionPlanService.getSopExecutionPlanPage(pageReqVO).getList();
|
|
|
+ // 导出 Excel
|
|
|
+ ExcelUtils.write(response, "SOP计划执行.xls", "数据", SopExecutionPlanRespVO.class,
|
|
|
+ BeanUtils.toBean(list, SopExecutionPlanRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|