From 927731c217ab587331c6798675380dec3c7a451f Mon Sep 17 00:00:00 2001 From: yd Date: Tue, 2 Dec 2025 16:42:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E7=89=A9=E6=96=99=E9=80=9A=E7=94=A8?= =?UTF-8?q?=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/qms/enums/ErrorCodeConstants.java | 3 + .../admin/MaterialLifecycleController.java | 118 ++++++++++++++++++ .../MaterialLifecycleDetailController.java | 118 ++++++++++++++++++ .../vo/MaterialLifecycleDetailPageReqVO.java | 52 ++++++++ .../vo/MaterialLifecycleDetailRespVO.java | 74 +++++++++++ .../vo/MaterialLifecycleDetailSaveReqVO.java | 49 ++++++++ .../vo/MaterialLifecyclePageReqVO.java | 59 +++++++++ .../vo/MaterialLifecycleRespVO.java | 74 +++++++++++ .../vo/MaterialLifecycleSaveReqVO.java | 54 ++++++++ .../dal/dataobject/MaterialLifecycleDO.java | 100 +++++++++++++++ .../dataobject/MaterialLifecycleDetailDO.java | 82 ++++++++++++ .../mapper/MaterialLifecycleDetailMapper.java | 35 ++++++ .../dal/mapper/MaterialLifecycleMapper.java | 37 ++++++ .../MaterialLifecycleDetailService.java | 64 ++++++++++ .../MaterialLifecycleDetailServiceImpl.java | 92 ++++++++++++++ .../service/MaterialLifecycleService.java | 64 ++++++++++ .../service/MaterialLifecycleServiceImpl.java | 92 ++++++++++++++ .../mapper/MaterialLifecycleDetailMapper.xml | 12 ++ .../dal/mapper/MaterialLifecycleMapper.xml | 12 ++ 19 files changed, 1191 insertions(+) create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialLifecycleController.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialLifecycleDetailController.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecycleDetailPageReqVO.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecycleDetailRespVO.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecycleDetailSaveReqVO.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecyclePageReqVO.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecycleRespVO.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecycleSaveReqVO.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/dataobject/MaterialLifecycleDO.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/dataobject/MaterialLifecycleDetailDO.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialLifecycleDetailMapper.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialLifecycleMapper.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleDetailService.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleDetailServiceImpl.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleService.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleServiceImpl.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/material/data/dal/mapper/MaterialLifecycleDetailMapper.xml create mode 100644 zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/material/data/dal/mapper/MaterialLifecycleMapper.xml diff --git a/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/ErrorCodeConstants.java b/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/ErrorCodeConstants.java index f816868..c51cadd 100644 --- a/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/ErrorCodeConstants.java +++ b/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/ErrorCodeConstants.java @@ -149,6 +149,9 @@ public interface ErrorCodeConstants { ErrorCode MATERIAL_INFOMATION_NOT_EXISTS = new ErrorCode(1_032_150_000, "试剂耗材不存在"); ErrorCode MATERIAL_PRODUCT_NOT_EXISTS = new ErrorCode(1_032_150_000, "试剂耗材大类不存在"); + ErrorCode MATERIAL_LIFECYCLE_DETAIL_NOT_EXISTS = new ErrorCode(1_032_150_000, "物料通用流程明细不存在"); + ErrorCode MATERIAL_LIFECYCLE_NOT_EXISTS = new ErrorCode(1_032_150_000, "物料通用流程不存在"); + /*================================= tx 1_032_200_000 ~ 1_032_249_999 ==================================*/ diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialLifecycleController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialLifecycleController.java new file mode 100644 index 0000000..9558127 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialLifecycleController.java @@ -0,0 +1,118 @@ +package com.zt.plat.module.qms.resource.material.controller.admin; + +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecyclePageReqVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleRespVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleSaveReqVO; +import org.springframework.web.bind.annotation.*; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import com.zt.plat.framework.business.interceptor.BusinessControllerMarker; +import com.zt.plat.framework.business.annotation.FileUploadController; +import com.zt.plat.framework.business.controller.AbstractFileUploadController; + +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.*; +import jakarta.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO; +import com.zt.plat.framework.common.pojo.PageParam; +import com.zt.plat.framework.common.pojo.PageResult; +import com.zt.plat.framework.common.pojo.CommonResult; +import com.zt.plat.framework.common.util.object.BeanUtils; +import static com.zt.plat.framework.common.pojo.CommonResult.success; + +import com.zt.plat.framework.excel.core.util.ExcelUtils; + +import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog; +import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*; + +import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDO; +import com.zt.plat.module.qms.resource.material.service.MaterialLifecycleService; + +@Tag(name = "管理后台 - 物料通用流程") +@RestController +@RequestMapping("/qms/material-lifecycle") +@Validated +@FileUploadController(source = "qms.materiallifecycle") +public class MaterialLifecycleController extends AbstractFileUploadController implements BusinessControllerMarker{ + + static { + FileUploadController annotation = MaterialLifecycleController.class.getAnnotation(FileUploadController.class); + if (annotation != null) { + setFileUploadInfo(annotation); + } + } + + @Resource + private MaterialLifecycleService materialLifecycleService; + + @PostMapping("/create") + @Operation(summary = "创建物料通用流程") + @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:create')") + public CommonResult createMaterialLifecycle(@Valid @RequestBody MaterialLifecycleSaveReqVO createReqVO) { + return success(materialLifecycleService.createMaterialLifecycle(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新物料通用流程") + @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:update')") + public CommonResult updateMaterialLifecycle(@Valid @RequestBody MaterialLifecycleSaveReqVO updateReqVO) { + materialLifecycleService.updateMaterialLifecycle(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除物料通用流程") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:delete')") + public CommonResult deleteMaterialLifecycle(@RequestParam("id") Long id) { + materialLifecycleService.deleteMaterialLifecycle(id); + return success(true); + } + + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除物料通用流程") + @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:delete')") + public CommonResult deleteMaterialLifecycleList(@RequestBody BatchDeleteReqVO req) { + materialLifecycleService.deleteMaterialLifecycleListByIds(req.getIds()); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得物料通用流程") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:query')") + public CommonResult getMaterialLifecycle(@RequestParam("id") Long id) { + MaterialLifecycleDO materialLifecycle = materialLifecycleService.getMaterialLifecycle(id); + return success(BeanUtils.toBean(materialLifecycle, MaterialLifecycleRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得物料通用流程分页") + @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:query')") + public CommonResult> getMaterialLifecyclePage(@Valid MaterialLifecyclePageReqVO pageReqVO) { + PageResult pageResult = materialLifecycleService.getMaterialLifecyclePage(pageReqVO); + return success(BeanUtils.toBean(pageResult, MaterialLifecycleRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出物料通用流程 Excel") + @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportMaterialLifecycleExcel(@Valid MaterialLifecyclePageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = materialLifecycleService.getMaterialLifecyclePage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "物料通用流程.xls", "数据", MaterialLifecycleRespVO.class, + BeanUtils.toBean(list, MaterialLifecycleRespVO.class)); + } + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialLifecycleDetailController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialLifecycleDetailController.java new file mode 100644 index 0000000..e9a4e38 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/admin/MaterialLifecycleDetailController.java @@ -0,0 +1,118 @@ +package com.zt.plat.module.qms.resource.material.controller.admin; + +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailPageReqVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailRespVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailSaveReqVO; +import org.springframework.web.bind.annotation.*; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import com.zt.plat.framework.business.interceptor.BusinessControllerMarker; +import com.zt.plat.framework.business.annotation.FileUploadController; +import com.zt.plat.framework.business.controller.AbstractFileUploadController; + +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.*; +import jakarta.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO; +import com.zt.plat.framework.common.pojo.PageParam; +import com.zt.plat.framework.common.pojo.PageResult; +import com.zt.plat.framework.common.pojo.CommonResult; +import com.zt.plat.framework.common.util.object.BeanUtils; +import static com.zt.plat.framework.common.pojo.CommonResult.success; + +import com.zt.plat.framework.excel.core.util.ExcelUtils; + +import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog; +import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*; + +import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDetailDO; +import com.zt.plat.module.qms.resource.material.service.MaterialLifecycleDetailService; + +@Tag(name = "管理后台 - 物料通用流程明细,对应生命周期的明细") +@RestController +@RequestMapping("/qms/material-lifecycle-detail") +@Validated +@FileUploadController(source = "qms.materiallifecycledetail") +public class MaterialLifecycleDetailController extends AbstractFileUploadController implements BusinessControllerMarker{ + + static { + FileUploadController annotation = MaterialLifecycleDetailController.class.getAnnotation(FileUploadController.class); + if (annotation != null) { + setFileUploadInfo(annotation); + } + } + + @Resource + private MaterialLifecycleDetailService materialLifecycleDetailService; + + @PostMapping("/create") + @Operation(summary = "创建物料通用流程明细,对应生命周期的明细") + @PreAuthorize("@ss.hasPermission('qms:material-lifecycle-detail:create')") + public CommonResult createMaterialLifecycleDetail(@Valid @RequestBody MaterialLifecycleDetailSaveReqVO createReqVO) { + return success(materialLifecycleDetailService.createMaterialLifecycleDetail(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新物料通用流程明细,对应生命周期的明细") + @PreAuthorize("@ss.hasPermission('qms:material-lifecycle-detail:update')") + public CommonResult updateMaterialLifecycleDetail(@Valid @RequestBody MaterialLifecycleDetailSaveReqVO updateReqVO) { + materialLifecycleDetailService.updateMaterialLifecycleDetail(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除物料通用流程明细,对应生命周期的明细") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('qms:material-lifecycle-detail:delete')") + public CommonResult deleteMaterialLifecycleDetail(@RequestParam("id") Long id) { + materialLifecycleDetailService.deleteMaterialLifecycleDetail(id); + return success(true); + } + + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除物料通用流程明细,对应生命周期的明细") + @PreAuthorize("@ss.hasPermission('qms:material-lifecycle-detail:delete')") + public CommonResult deleteMaterialLifecycleDetailList(@RequestBody BatchDeleteReqVO req) { + materialLifecycleDetailService.deleteMaterialLifecycleDetailListByIds(req.getIds()); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得物料通用流程明细,对应生命周期的明细") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('qms:material-lifecycle-detail:query')") + public CommonResult getMaterialLifecycleDetail(@RequestParam("id") Long id) { + MaterialLifecycleDetailDO materialLifecycleDetail = materialLifecycleDetailService.getMaterialLifecycleDetail(id); + return success(BeanUtils.toBean(materialLifecycleDetail, MaterialLifecycleDetailRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得物料通用流程明细,对应生命周期的明细分页") + @PreAuthorize("@ss.hasPermission('qms:material-lifecycle-detail:query')") + public CommonResult> getMaterialLifecycleDetailPage(@Valid MaterialLifecycleDetailPageReqVO pageReqVO) { + PageResult pageResult = materialLifecycleDetailService.getMaterialLifecycleDetailPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, MaterialLifecycleDetailRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出物料通用流程明细,对应生命周期的明细 Excel") + @PreAuthorize("@ss.hasPermission('qms:material-lifecycle-detail:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportMaterialLifecycleDetailExcel(@Valid MaterialLifecycleDetailPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = materialLifecycleDetailService.getMaterialLifecycleDetailPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "物料通用流程明细,对应生命周期的明细.xls", "数据", MaterialLifecycleDetailRespVO.class, + BeanUtils.toBean(list, MaterialLifecycleDetailRespVO.class)); + } + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecycleDetailPageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecycleDetailPageReqVO.java new file mode 100644 index 0000000..3c76d1d --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecycleDetailPageReqVO.java @@ -0,0 +1,52 @@ +package com.zt.plat.module.qms.resource.material.controller.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.zt.plat.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 物料通用流程明细,对应生命周期的明细分页 Request VO") +@Data +public class MaterialLifecycleDetailPageReqVO extends PageParam { + + @Schema(description = "父ID", example = "24095") + private Long materialLifecycleId; + + @Schema(description = "物料批次编号", example = "30393") + private Long batchId; + + @Schema(description = "物料大类编号", example = "1020") + private String categoryProductId; + + @Schema(description = "物料实例编号", example = "11872") + private Long infomationId; + + @Schema(description = "影响数量", example = "28166") + private String influenceCount; + + @Schema(description = "明细操作类型", example = "2") + private String businessType; + + @Schema(description = "处理状态", example = "1") + private Integer treatmentStatus; + + @Schema(description = "表单数据,表单数据") + private String formData; + + @Schema(description = "所属部门") + private String systemDepartmentCode; + + @Schema(description = "公司名称", example = "赵六") + private String companyName; + + @Schema(description = "备注") + private String remark; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecycleDetailRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecycleDetailRespVO.java new file mode 100644 index 0000000..bfa9230 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecycleDetailRespVO.java @@ -0,0 +1,74 @@ +package com.zt.plat.module.qms.resource.material.controller.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 物料通用流程明细,对应生命周期的明细 Response VO") +@Data +@ExcelIgnoreUnannotated +public class MaterialLifecycleDetailRespVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "30686") + @ExcelProperty("主键") + private Long id; + + @Schema(description = "父ID", example = "24095") + @ExcelProperty("父ID") + private Long materialLifecycleId; + + @Schema(description = "物料批次编号", example = "30393") + @ExcelProperty("物料批次编号") + private Long batchId; + + @Schema(description = "物料大类编号", example = "1020") + @ExcelProperty("物料大类编号") + private String categoryProductId; + + @Schema(description = "物料实例编号", example = "11872") + @ExcelProperty("物料实例编号") + private Long infomationId; + + @Schema(description = "影响数量", example = "28166") + @ExcelProperty("影响数量") + private String influenceCount; + + @Schema(description = "明细操作类型", example = "2") + @ExcelProperty("明细操作类型") + private String businessType; + + @Schema(description = "处理状态", example = "1") + @ExcelProperty("处理状态") + private Integer treatmentStatus; + + @Schema(description = "表单数据,表单数据") + @ExcelProperty("表单数据,表单数据") + private String formData; + + @Schema(description = "所属部门") + @ExcelProperty("所属部门") + private String systemDepartmentCode; + + @Schema(description = "公司编号", example = "2613") + @ExcelProperty("公司编号") + private Long companyId; + + @Schema(description = "公司名称", example = "赵六") + @ExcelProperty("公司名称") + private String companyName; + + @Schema(description = "部门编号", example = "32413") + @ExcelProperty("部门编号") + private Long deptId; + + @Schema(description = "备注") + @ExcelProperty("备注") + private String remark; + + @Schema(description = "创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecycleDetailSaveReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecycleDetailSaveReqVO.java new file mode 100644 index 0000000..f10eff0 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecycleDetailSaveReqVO.java @@ -0,0 +1,49 @@ +package com.zt.plat.module.qms.resource.material.controller.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +@Schema(description = "管理后台 - 物料通用流程明细,对应生命周期的明细新增/修改 Request VO") +@Data +public class MaterialLifecycleDetailSaveReqVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "30686") + private Long id; + + @Schema(description = "父ID", example = "24095") + private Long materialLifecycleId; + + @Schema(description = "物料批次编号", example = "30393") + private Long batchId; + + @Schema(description = "物料大类编号", example = "1020") + private String categoryProductId; + + @Schema(description = "物料实例编号", example = "11872") + private Long infomationId; + + @Schema(description = "影响数量", example = "28166") + private String influenceCount; + + @Schema(description = "明细操作类型", example = "2") + private String businessType; + + @Schema(description = "处理状态", example = "1") + private Integer treatmentStatus; + + @Schema(description = "表单数据,表单数据") + private String formData; + + @Schema(description = "所属部门") + private String systemDepartmentCode; + + @Schema(description = "公司编号", example = "2613") + private Long companyId; + + @Schema(description = "公司名称", example = "赵六") + private String companyName; + + @Schema(description = "备注") + private String remark; + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecyclePageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecyclePageReqVO.java new file mode 100644 index 0000000..1eee388 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecyclePageReqVO.java @@ -0,0 +1,59 @@ +package com.zt.plat.module.qms.resource.material.controller.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.zt.plat.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 物料通用流程分页 Request VO") +@Data +public class MaterialLifecyclePageReqVO extends PageParam { + + @Schema(description = "标题") + private String title; + + @Schema(description = "业务类型,【字典】【jy_material_lifecycle_bsn_type】验收、退换货、配置申请", example = "2") + private String businessType; + + @Schema(description = "业务类型编码") + private String businessTypeCode; + + @Schema(description = "申请人") + private String applyUser; + + @Schema(description = "申请人id", example = "29846") + private Long applyUserId; + + @Schema(description = "申请部门") + private String applyDepartment; + + @Schema(description = "申请部门id", example = "7174") + private Long applyDepartmentId; + + @Schema(description = "申请时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] applyTime; + + @Schema(description = "表单数据,表单数据") + private String formData; + + @Schema(description = "流程实例id", example = "28688") + private String flowInstanceId; + + @Schema(description = "流程审批状态", example = "2") + private String flowStatus; + + @Schema(description = "所属部门") + private String systemDepartmentCode; + + @Schema(description = "备注") + private String remark; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecycleRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecycleRespVO.java new file mode 100644 index 0000000..10c00c1 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecycleRespVO.java @@ -0,0 +1,74 @@ +package com.zt.plat.module.qms.resource.material.controller.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 物料通用流程 Response VO") +@Data +@ExcelIgnoreUnannotated +public class MaterialLifecycleRespVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "4561") + @ExcelProperty("主键") + private Long id; + + @Schema(description = "标题") + @ExcelProperty("标题") + private String title; + + @Schema(description = "业务类型,【字典】【jy_material_lifecycle_bsn_type】验收、退换货、配置申请", example = "2") + @ExcelProperty("业务类型,【字典】【jy_material_lifecycle_bsn_type】验收、退换货、配置申请") + private String businessType; + + @Schema(description = "业务类型编码") + @ExcelProperty("业务类型编码") + private String businessTypeCode; + + @Schema(description = "申请人") + @ExcelProperty("申请人") + private String applyUser; + + @Schema(description = "申请人id", example = "29846") + @ExcelProperty("申请人id") + private Long applyUserId; + + @Schema(description = "申请部门") + @ExcelProperty("申请部门") + private String applyDepartment; + + @Schema(description = "申请部门id", example = "7174") + @ExcelProperty("申请部门id") + private Long applyDepartmentId; + + @Schema(description = "申请时间") + @ExcelProperty("申请时间") + private LocalDateTime applyTime; + + @Schema(description = "表单数据,表单数据") + @ExcelProperty("表单数据,表单数据") + private String formData; + + @Schema(description = "流程实例id", example = "28688") + @ExcelProperty("流程实例id") + private String flowInstanceId; + + @Schema(description = "流程审批状态", example = "2") + @ExcelProperty("流程审批状态") + private String flowStatus; + + @Schema(description = "所属部门") + @ExcelProperty("所属部门") + private String systemDepartmentCode; + + @Schema(description = "备注") + @ExcelProperty("备注") + private String remark; + + @Schema(description = "创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecycleSaveReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecycleSaveReqVO.java new file mode 100644 index 0000000..d3a28c0 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/controller/vo/MaterialLifecycleSaveReqVO.java @@ -0,0 +1,54 @@ +package com.zt.plat.module.qms.resource.material.controller.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 物料通用流程新增/修改 Request VO") +@Data +public class MaterialLifecycleSaveReqVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "4561") + private Long id; + + @Schema(description = "标题") + private String title; + + @Schema(description = "业务类型,【字典】【jy_material_lifecycle_bsn_type】验收、退换货、配置申请", example = "2") + private String businessType; + + @Schema(description = "业务类型编码") + private String businessTypeCode; + + @Schema(description = "申请人") + private String applyUser; + + @Schema(description = "申请人id", example = "29846") + private Long applyUserId; + + @Schema(description = "申请部门") + private String applyDepartment; + + @Schema(description = "申请部门id", example = "7174") + private Long applyDepartmentId; + + @Schema(description = "申请时间") + private LocalDateTime applyTime; + + @Schema(description = "表单数据,表单数据") + private String formData; + + @Schema(description = "流程实例id", example = "28688") + private String flowInstanceId; + + @Schema(description = "流程审批状态", example = "2") + private String flowStatus; + + @Schema(description = "所属部门") + private String systemDepartmentCode; + + @Schema(description = "备注") + private String remark; + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/dataobject/MaterialLifecycleDO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/dataobject/MaterialLifecycleDO.java new file mode 100644 index 0000000..a5af068 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/dataobject/MaterialLifecycleDO.java @@ -0,0 +1,100 @@ +package com.zt.plat.module.qms.resource.material.dal.dataobject; + +import lombok.*; + +import java.time.LocalDateTime; + +import com.baomidou.mybatisplus.annotation.*; +import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO; +/** +* 物料通用流程 DO +* +* @author 后台管理 +*/ +@TableName("t_mtrl_lfc") +@KeySequence("t_mtrl_lfc_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +/** +* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO +*/ +public class MaterialLifecycleDO extends BusinessBaseDO { + + + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + private Long id; + /** + * 标题 + */ + @TableField("TTL") + private String title; + /** + * 业务类型,【字典】【jy_material_lifecycle_bsn_type】验收、退换货、配置申请 + */ + @TableField("BSN_TP") + private String businessType; + /** + * 业务类型编码 + */ + @TableField("BSN_TP_CD") + private String businessTypeCode; + /** + * 申请人 + */ + @TableField("APL_USER") + private String applyUser; + /** + * 申请人id + */ + @TableField("APL_USER_ID") + private Long applyUserId; + /** + * 申请部门 + */ + @TableField("APL_DEPT") + private String applyDepartment; + /** + * 申请部门id + */ + @TableField("APL_DEPT_ID") + private Long applyDepartmentId; + /** + * 申请时间 + */ + @TableField("APL_TM") + private LocalDateTime applyTime; + /** + * 表单数据,表单数据 + */ + @TableField("FORM_DAT") + private String formData; + /** + * 流程实例id + */ + @TableField("FLW_INSC_ID") + private String flowInstanceId; + /** + * 流程审批状态 + */ + @TableField("FLW_STS") + private String flowStatus; + /** + * 所属部门 + */ + @TableField("SYS_DEPT_CD") + private String systemDepartmentCode; + /** + * 备注 + */ + @TableField("RMK") + private String remark; + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/dataobject/MaterialLifecycleDetailDO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/dataobject/MaterialLifecycleDetailDO.java new file mode 100644 index 0000000..05ed59f --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/dataobject/MaterialLifecycleDetailDO.java @@ -0,0 +1,82 @@ +package com.zt.plat.module.qms.resource.material.dal.dataobject; + +import lombok.*; +import com.baomidou.mybatisplus.annotation.*; +import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO; +/** +* 物料通用流程明细,对应生命周期的明细 DO +* +* @author 后台管理 +*/ +@TableName("t_mtrl_lfc_dtl") +@KeySequence("t_mtrl_lfc_dtl_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +/** +* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO +*/ +public class MaterialLifecycleDetailDO extends BusinessBaseDO { + + + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + private Long id; + /** + * 父ID + */ + @TableField("MTRL_LFC_ID") + private Long materialLifecycleId; + /** + * 物料批次编号 + */ + @TableField("BAT_ID") + private Long batchId; + /** + * 物料大类编号 + */ + @TableField("CTGR_PDT_ID") + private String categoryProductId; + /** + * 物料实例编号 + */ + @TableField("INF_ID") + private Long infomationId; + /** + * 影响数量 + */ + @TableField("INFL_CNT") + private String influenceCount; + /** + * 明细操作类型 + */ + @TableField("BSN_TP") + private String businessType; + /** + * 处理状态 + */ + @TableField("TMT_STS") + private Integer treatmentStatus; + /** + * 表单数据,表单数据 + */ + @TableField("FORM_DAT") + private String formData; + /** + * 所属部门 + */ + @TableField("SYS_DEPT_CD") + private String systemDepartmentCode; + /** + * 备注 + */ + @TableField("RMK") + private String remark; + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialLifecycleDetailMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialLifecycleDetailMapper.java new file mode 100644 index 0000000..ce42a1d --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialLifecycleDetailMapper.java @@ -0,0 +1,35 @@ +package com.zt.plat.module.qms.resource.material.dal.mapper; + +import com.zt.plat.framework.common.pojo.PageResult; +import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; +import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDetailDO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailPageReqVO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 物料通用流程明细,对应生命周期的明细 Mapper + * + * @author 后台管理 + */ +@Mapper +public interface MaterialLifecycleDetailMapper extends BaseMapperX { + + default PageResult selectPage(MaterialLifecycleDetailPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(MaterialLifecycleDetailDO::getMaterialLifecycleId, reqVO.getMaterialLifecycleId()) + .eqIfPresent(MaterialLifecycleDetailDO::getBatchId, reqVO.getBatchId()) + .eqIfPresent(MaterialLifecycleDetailDO::getCategoryProductId, reqVO.getCategoryProductId()) + .eqIfPresent(MaterialLifecycleDetailDO::getInfomationId, reqVO.getInfomationId()) + .eqIfPresent(MaterialLifecycleDetailDO::getInfluenceCount, reqVO.getInfluenceCount()) + .eqIfPresent(MaterialLifecycleDetailDO::getBusinessType, reqVO.getBusinessType()) + .eqIfPresent(MaterialLifecycleDetailDO::getTreatmentStatus, reqVO.getTreatmentStatus()) + .eqIfPresent(MaterialLifecycleDetailDO::getFormData, reqVO.getFormData()) + .eqIfPresent(MaterialLifecycleDetailDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode()) + .likeIfPresent(MaterialLifecycleDetailDO::getCompanyName, reqVO.getCompanyName()) + .eqIfPresent(MaterialLifecycleDetailDO::getRemark, reqVO.getRemark()) + .betweenIfPresent(MaterialLifecycleDetailDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(MaterialLifecycleDetailDO::getId)); + } + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialLifecycleMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialLifecycleMapper.java new file mode 100644 index 0000000..0241370 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/dal/mapper/MaterialLifecycleMapper.java @@ -0,0 +1,37 @@ +package com.zt.plat.module.qms.resource.material.dal.mapper; + +import com.zt.plat.framework.common.pojo.PageResult; +import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecyclePageReqVO; +import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 物料通用流程 Mapper + * + * @author 后台管理 + */ +@Mapper +public interface MaterialLifecycleMapper extends BaseMapperX { + + default PageResult selectPage(MaterialLifecyclePageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(MaterialLifecycleDO::getTitle, reqVO.getTitle()) + .eqIfPresent(MaterialLifecycleDO::getBusinessType, reqVO.getBusinessType()) + .eqIfPresent(MaterialLifecycleDO::getBusinessTypeCode, reqVO.getBusinessTypeCode()) + .eqIfPresent(MaterialLifecycleDO::getApplyUser, reqVO.getApplyUser()) + .eqIfPresent(MaterialLifecycleDO::getApplyUserId, reqVO.getApplyUserId()) + .eqIfPresent(MaterialLifecycleDO::getApplyDepartment, reqVO.getApplyDepartment()) + .eqIfPresent(MaterialLifecycleDO::getApplyDepartmentId, reqVO.getApplyDepartmentId()) + .betweenIfPresent(MaterialLifecycleDO::getApplyTime, reqVO.getApplyTime()) + .eqIfPresent(MaterialLifecycleDO::getFormData, reqVO.getFormData()) + .eqIfPresent(MaterialLifecycleDO::getFlowInstanceId, reqVO.getFlowInstanceId()) + .eqIfPresent(MaterialLifecycleDO::getFlowStatus, reqVO.getFlowStatus()) + .eqIfPresent(MaterialLifecycleDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode()) + .eqIfPresent(MaterialLifecycleDO::getRemark, reqVO.getRemark()) + .betweenIfPresent(MaterialLifecycleDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(MaterialLifecycleDO::getId)); + } + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleDetailService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleDetailService.java new file mode 100644 index 0000000..e6ce97c --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleDetailService.java @@ -0,0 +1,64 @@ +package com.zt.plat.module.qms.resource.material.service; + +import java.util.*; + +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailPageReqVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailRespVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailSaveReqVO; +import jakarta.validation.*; +import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDetailDO; +import com.zt.plat.framework.common.pojo.PageResult; + +/** + * 物料通用流程明细,对应生命周期的明细 Service 接口 + * + * @author 后台管理 + */ +public interface MaterialLifecycleDetailService { + + /** + * 创建物料通用流程明细,对应生命周期的明细 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + MaterialLifecycleDetailRespVO createMaterialLifecycleDetail(@Valid MaterialLifecycleDetailSaveReqVO createReqVO); + + /** + * 更新物料通用流程明细,对应生命周期的明细 + * + * @param updateReqVO 更新信息 + */ + void updateMaterialLifecycleDetail(@Valid MaterialLifecycleDetailSaveReqVO updateReqVO); + + /** + * 删除物料通用流程明细,对应生命周期的明细 + * + * @param id 编号 + */ + void deleteMaterialLifecycleDetail(Long id); + + /** + * 批量删除物料通用流程明细,对应生命周期的明细 + * + * @param ids 编号 + */ + void deleteMaterialLifecycleDetailListByIds(List ids); + + /** + * 获得物料通用流程明细,对应生命周期的明细 + * + * @param id 编号 + * @return 物料通用流程明细,对应生命周期的明细 + */ + MaterialLifecycleDetailDO getMaterialLifecycleDetail(Long id); + + /** + * 获得物料通用流程明细,对应生命周期的明细分页 + * + * @param pageReqVO 分页查询 + * @return 物料通用流程明细,对应生命周期的明细分页 + */ + PageResult getMaterialLifecycleDetailPage(MaterialLifecycleDetailPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleDetailServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleDetailServiceImpl.java new file mode 100644 index 0000000..aee89af --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleDetailServiceImpl.java @@ -0,0 +1,92 @@ +package com.zt.plat.module.qms.resource.material.service; + +import cn.hutool.core.collection.CollUtil; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailPageReqVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailRespVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailSaveReqVO; +import org.springframework.stereotype.Service; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; + +import java.util.*; + +import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDetailDO; +import com.zt.plat.framework.common.pojo.PageResult; +import com.zt.plat.framework.common.util.object.BeanUtils; + +import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialLifecycleDetailMapper; + +import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.zt.plat.framework.common.util.collection.CollectionUtils.convertList; +import static com.zt.plat.module.qms.enums.ErrorCodeConstants.MATERIAL_LIFECYCLE_DETAIL_NOT_EXISTS; + +/** + * 物料通用流程明细,对应生命周期的明细 Service 实现类 + * + * @author 后台管理 + */ +@Service +@Validated +public class MaterialLifecycleDetailServiceImpl implements MaterialLifecycleDetailService { + + @Resource + private MaterialLifecycleDetailMapper materialLifecycleDetailMapper; + + @Override + public MaterialLifecycleDetailRespVO createMaterialLifecycleDetail(MaterialLifecycleDetailSaveReqVO createReqVO) { + // 插入 + MaterialLifecycleDetailDO materialLifecycleDetail = BeanUtils.toBean(createReqVO, MaterialLifecycleDetailDO.class); + materialLifecycleDetailMapper.insert(materialLifecycleDetail); + // 返回 + return BeanUtils.toBean(materialLifecycleDetail, MaterialLifecycleDetailRespVO.class); + } + + @Override + public void updateMaterialLifecycleDetail(MaterialLifecycleDetailSaveReqVO updateReqVO) { + // 校验存在 + validateMaterialLifecycleDetailExists(updateReqVO.getId()); + // 更新 + MaterialLifecycleDetailDO updateObj = BeanUtils.toBean(updateReqVO, MaterialLifecycleDetailDO.class); + materialLifecycleDetailMapper.updateById(updateObj); + } + + @Override + public void deleteMaterialLifecycleDetail(Long id) { + // 校验存在 + validateMaterialLifecycleDetailExists(id); + // 删除 + materialLifecycleDetailMapper.deleteById(id); + } + + @Override + public void deleteMaterialLifecycleDetailListByIds(List ids) { + // 校验存在 + validateMaterialLifecycleDetailExists(ids); + // 删除 + materialLifecycleDetailMapper.deleteByIds(ids); + } + + private void validateMaterialLifecycleDetailExists(List ids) { + List list = materialLifecycleDetailMapper.selectByIds(ids); + if (CollUtil.isEmpty(list) || list.size() != ids.size()) { + throw exception(MATERIAL_LIFECYCLE_DETAIL_NOT_EXISTS); + } + } + + private void validateMaterialLifecycleDetailExists(Long id) { + if (materialLifecycleDetailMapper.selectById(id) == null) { + throw exception(MATERIAL_LIFECYCLE_DETAIL_NOT_EXISTS); + } + } + + @Override + public MaterialLifecycleDetailDO getMaterialLifecycleDetail(Long id) { + return materialLifecycleDetailMapper.selectById(id); + } + + @Override + public PageResult getMaterialLifecycleDetailPage(MaterialLifecycleDetailPageReqVO pageReqVO) { + return materialLifecycleDetailMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleService.java new file mode 100644 index 0000000..930593a --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleService.java @@ -0,0 +1,64 @@ +package com.zt.plat.module.qms.resource.material.service; + +import java.util.*; + +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecyclePageReqVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleRespVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleSaveReqVO; +import jakarta.validation.*; +import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDO; +import com.zt.plat.framework.common.pojo.PageResult; + +/** + * 物料通用流程 Service 接口 + * + * @author 后台管理 + */ +public interface MaterialLifecycleService { + + /** + * 创建物料通用流程 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + MaterialLifecycleRespVO createMaterialLifecycle(@Valid MaterialLifecycleSaveReqVO createReqVO); + + /** + * 更新物料通用流程 + * + * @param updateReqVO 更新信息 + */ + void updateMaterialLifecycle(@Valid MaterialLifecycleSaveReqVO updateReqVO); + + /** + * 删除物料通用流程 + * + * @param id 编号 + */ + void deleteMaterialLifecycle(Long id); + + /** + * 批量删除物料通用流程 + * + * @param ids 编号 + */ + void deleteMaterialLifecycleListByIds(List ids); + + /** + * 获得物料通用流程 + * + * @param id 编号 + * @return 物料通用流程 + */ + MaterialLifecycleDO getMaterialLifecycle(Long id); + + /** + * 获得物料通用流程分页 + * + * @param pageReqVO 分页查询 + * @return 物料通用流程分页 + */ + PageResult getMaterialLifecyclePage(MaterialLifecyclePageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleServiceImpl.java new file mode 100644 index 0000000..05a8579 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/material/service/MaterialLifecycleServiceImpl.java @@ -0,0 +1,92 @@ +package com.zt.plat.module.qms.resource.material.service; + +import cn.hutool.core.collection.CollUtil; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecyclePageReqVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleRespVO; +import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleSaveReqVO; +import org.springframework.stereotype.Service; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; + +import java.util.*; + +import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDO; +import com.zt.plat.framework.common.pojo.PageResult; +import com.zt.plat.framework.common.util.object.BeanUtils; + +import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialLifecycleMapper; + +import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.zt.plat.framework.common.util.collection.CollectionUtils.convertList; +import static com.zt.plat.module.qms.enums.ErrorCodeConstants.*; + +/** + * 物料通用流程 Service 实现类 + * + * @author 后台管理 + */ +@Service +@Validated +public class MaterialLifecycleServiceImpl implements MaterialLifecycleService { + + @Resource + private MaterialLifecycleMapper materialLifecycleMapper; + + @Override + public MaterialLifecycleRespVO createMaterialLifecycle(MaterialLifecycleSaveReqVO createReqVO) { + // 插入 + MaterialLifecycleDO materialLifecycle = BeanUtils.toBean(createReqVO, MaterialLifecycleDO.class); + materialLifecycleMapper.insert(materialLifecycle); + // 返回 + return BeanUtils.toBean(materialLifecycle, MaterialLifecycleRespVO.class); + } + + @Override + public void updateMaterialLifecycle(MaterialLifecycleSaveReqVO updateReqVO) { + // 校验存在 + validateMaterialLifecycleExists(updateReqVO.getId()); + // 更新 + MaterialLifecycleDO updateObj = BeanUtils.toBean(updateReqVO, MaterialLifecycleDO.class); + materialLifecycleMapper.updateById(updateObj); + } + + @Override + public void deleteMaterialLifecycle(Long id) { + // 校验存在 + validateMaterialLifecycleExists(id); + // 删除 + materialLifecycleMapper.deleteById(id); + } + + @Override + public void deleteMaterialLifecycleListByIds(List ids) { + // 校验存在 + validateMaterialLifecycleExists(ids); + // 删除 + materialLifecycleMapper.deleteByIds(ids); + } + + private void validateMaterialLifecycleExists(List ids) { + List list = materialLifecycleMapper.selectByIds(ids); + if (CollUtil.isEmpty(list) || list.size() != ids.size()) { + throw exception(MATERIAL_LIFECYCLE_NOT_EXISTS); + } + } + + private void validateMaterialLifecycleExists(Long id) { + if (materialLifecycleMapper.selectById(id) == null) { + throw exception(MATERIAL_LIFECYCLE_NOT_EXISTS); + } + } + + @Override + public MaterialLifecycleDO getMaterialLifecycle(Long id) { + return materialLifecycleMapper.selectById(id); + } + + @Override + public PageResult getMaterialLifecyclePage(MaterialLifecyclePageReqVO pageReqVO) { + return materialLifecycleMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/material/data/dal/mapper/MaterialLifecycleDetailMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/material/data/dal/mapper/MaterialLifecycleDetailMapper.xml new file mode 100644 index 0000000..5e1e665 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/material/data/dal/mapper/MaterialLifecycleDetailMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/material/data/dal/mapper/MaterialLifecycleMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/material/data/dal/mapper/MaterialLifecycleMapper.xml new file mode 100644 index 0000000..27a70af --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/material/data/dal/mapper/MaterialLifecycleMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file