| | |
| | | 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.mes.controller.admin.pd.techconfirm.vo.ProductTechConfirmAuditReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.techconfirm.vo.ProductTechConfirmImportExcelVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.techconfirm.vo.ProductTechConfirmImportRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.techconfirm.vo.ProductTechConfirmPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.techconfirm.vo.ProductTechConfirmRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.techconfirm.vo.ProductTechConfirmSaveReqVO; |
| | |
| | | import cn.iocoder.yudao.module.mes.service.pd.techconfirm.ProductTechConfirmService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.Parameters; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "删除产品技术确认函") |
| | | @Operation(summary = "删除产品技术确认函(仅草稿 / 审核不通过状态可删除)") |
| | | @Parameter(name = "id", description = "编号", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-tech-confirm:delete')") |
| | | public CommonResult<Boolean> deleteTechConfirm(@RequestParam("id") Long id) { |
| | |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/submit-approval") |
| | | @Operation(summary = "提交技术确认函审核(草稿/审核不通过→待审核),审核人由审批配置统一指定") |
| | | @Parameter(name = "id", description = "编号", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-tech-confirm:update')") |
| | | public CommonResult<Boolean> submitTechConfirmAudit(@RequestParam("id") Long id) { |
| | | techConfirmService.submitTechConfirmAudit(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/audit") |
| | | @Operation(summary = "审核技术确认函(待审核→已审核/审核不通过),仅审批人本人可操作") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-tech-confirm:audit')") |
| | | public CommonResult<Boolean> auditTechConfirm(@Valid @RequestBody ProductTechConfirmAuditReqVO auditReqVO) { |
| | | techConfirmService.auditTechConfirm(auditReqVO.getId(), auditReqVO.getPass(), auditReqVO.getReviewRemark()); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/approver-ids") |
| | | @Operation(summary = "获得技术确认函的审核人编号集合,供前端判断是否展示审核按钮") |
| | | public CommonResult<Set<Long>> getApproverUserIds() { |
| | | return success(techConfirmService.getTechConfirmApproverUserIds()); |
| | | } |
| | | |
| | | @PutMapping("/customer-confirm") |
| | | @Operation(summary = "客户确认(已审核→客户已确认)") |
| | | @Parameter(name = "id", description = "编号", required = true) |
| | | @Parameter(name = "customerConfirmUser", description = "客户确认人姓名", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-tech-confirm:update')") |
| | | public CommonResult<Boolean> confirmTechConfirmByCustomer(@RequestParam("id") Long id, |
| | | @RequestParam("customerConfirmUser") String customerConfirmUser) { |
| | | techConfirmService.confirmTechConfirmByCustomer(id, customerConfirmUser); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "获得产品技术确认函") |
| | | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-tech-confirm:query')") |
| | | public CommonResult<ProductTechConfirmRespVO> getTechConfirm(@RequestParam("id") Long id) { |
| | | ProductTechConfirmDO techConfirm = techConfirmService.getTechConfirm(id); |
| | | if (techConfirm == null) { |
| | |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "获得产品技术确认函分页") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-tech-confirm:query')") |
| | | public CommonResult<PageResult<ProductTechConfirmRespVO>> getTechConfirmPage(@Valid ProductTechConfirmPageReqVO pageReqVO) { |
| | | PageResult<ProductTechConfirmDO> pageResult = techConfirmService.getTechConfirmPage(pageReqVO); |
| | | return success(new PageResult<>(BeanUtils.toBean(pageResult.getList(), ProductTechConfirmRespVO.class), |
| | |
| | | BeanUtils.toBean(list, ProductTechConfirmRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/get-import-template") |
| | | @Operation(summary = "获得产品技术确认函导入模板") |
| | | public void importTemplate(HttpServletResponse response) throws IOException { |
| | | List<ProductTechConfirmImportExcelVO> list = Collections.singletonList( |
| | | ProductTechConfirmImportExcelVO.builder() |
| | | .confirmNo("TC20260801001").customerName("江苏华鹏变压器有限公司") |
| | | .productName("漆包扁铜线").specification("QQNB-2/120") |
| | | .techParams("{\"thickness\":\"1.27\"}").templateType("general").remark("").build() |
| | | ); |
| | | ExcelUtils.write(response, "产品技术确认函导入模板.xls", "产品技术确认函列表", ProductTechConfirmImportExcelVO.class, list); |
| | | } |
| | | |
| | | @PostMapping("/import") |
| | | @Operation(summary = "导入产品技术确认函") |
| | | @Parameters({ |
| | | @Parameter(name = "file", description = "Excel 文件", required = true), |
| | | @Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true") |
| | | }) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-tech-confirm:import')") |
| | | public CommonResult<ProductTechConfirmImportRespVO> importExcel(@RequestParam("file") MultipartFile file, |
| | | @RequestParam(value = "updateSupport", required = false, |
| | | defaultValue = "false") Boolean updateSupport) throws Exception { |
| | | List<ProductTechConfirmImportExcelVO> list = ExcelUtils.read(file, ProductTechConfirmImportExcelVO.class); |
| | | return success(techConfirmService.importTechConfirmList(list, updateSupport)); |
| | | } |
| | | |
| | | } |