From 3c4b951c7b44405a32f122c1d1232979dad0979b Mon Sep 17 00:00:00 2001 From: FCL Date: Sun, 4 Jan 2026 08:58:27 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat=EF=BC=9A=E8=AE=BE=E5=A4=87=E5=90=8E?= =?UTF-8?q?=E7=AB=AF=E6=8E=A5=E5=8F=A3-=E4=BD=BF=E7=94=A8=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E3=80=81=E8=AE=BE=E5=A4=87=E7=94=B3=E8=AF=B7=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/qms/enums/ErrorCodeConstants.java | 2 +- .../admin/DeviceApplyController.java | 7 +- .../admin/DeviceConfigFlowController.java | 116 ++++++++++++++++++ .../admin/DeviceUseRecordController.java | 7 +- .../controller/vo/DeviceApplyPageReqVO.java | 20 +-- .../controller/vo/DeviceApplyRespVO.java | 24 ++-- .../controller/vo/DeviceApplySaveReqVO.java | 22 ++-- .../vo/DeviceConfigFlowPageReqVO.java | 49 ++++++++ .../controller/vo/DeviceConfigFlowRespVO.java | 60 +++++++++ .../vo/DeviceConfigFlowSaveReqVO.java | 43 +++++++ .../vo/DeviceUseRecordPageReqVO.java | 2 + .../device/dal/dataobject/DeviceApplyDO.java | 98 ++++++++------- .../dal/dataobject/DeviceConfigFlowDO.java | 82 +++++++++++++ .../dal/mapper/DeviceConfigFlowMapper.java | 49 ++++++++ .../dal/mapper/DeviceInfomationMapper.java | 8 ++ .../service/DeviceConfigFlowService.java | 66 ++++++++++ .../service/DeviceConfigFlowServiceImpl.java | 97 +++++++++++++++ .../service/DeviceInfomationServiceImpl.java | 5 +- .../service/DeviceUseRecordServiceImpl.java | 35 ++++-- .../dal/mapper/DeviceConfigFlowMapper.xml | 12 ++ .../dal/mapper/DeviceInfomationMapper.xml | 38 ++++++ 21 files changed, 758 insertions(+), 84 deletions(-) create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceConfigFlowController.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceConfigFlowPageReqVO.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceConfigFlowRespVO.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceConfigFlowSaveReqVO.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/dataobject/DeviceConfigFlowDO.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceConfigFlowMapper.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceConfigFlowService.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceConfigFlowServiceImpl.java create mode 100644 zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceConfigFlowMapper.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 a102e22..84eeaec 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 @@ -168,7 +168,7 @@ public interface ErrorCodeConstants { ErrorCode DEVICE_AFFILIATION_RELATIVITY_NOT_EXISTS = new ErrorCode(1_032_150_000, "附属设备关系不存在"); ErrorCode DEVICE_APPLY_DETAIL_NOT_EXISTS = new ErrorCode(1_032_150_000, "设备申请明细数据不存在"); ErrorCode DEVICE_APPLY_NOT_EXISTS = new ErrorCode(1_032_150_000, "设备申请数据不存在"); - + ErrorCode DEVICE_CONFIG_FLOW_NOT_EXISTS = new ErrorCode(1_032_150_000, "设备通用流程配置不存在"); // -------------物料试剂------------- ErrorCode MATERIAL_INFOMATION_NOT_EXISTS = new ErrorCode(1_032_150_000, "试剂耗材不存在"); diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceApplyController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceApplyController.java index aa76d74..706e9d1 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceApplyController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceApplyController.java @@ -52,16 +52,17 @@ public class DeviceApplyController extends AbstractFileUploadController implemen @Resource private DeviceApplyService deviceApplyService; + //todo 通过设备通用流程配置创建 @PostMapping("/create") @Operation(summary = "创建设备通用流程,验收、降级、停用、报废、还原、启用") - @PreAuthorize("@ss.hasPermission('qms:device-apply:create')") +// @PreAuthorize("@ss.hasPermission('qms:device-apply:create')") public CommonResult createDeviceApply(@Valid @RequestBody DeviceApplySaveReqVO createReqVO) { return success(deviceApplyService.createDeviceApply(createReqVO)); } @PutMapping("/update") @Operation(summary = "更新设备通用流程,验收、降级、停用、报废、还原、启用") - @PreAuthorize("@ss.hasPermission('qms:device-apply:update')") +// @PreAuthorize("@ss.hasPermission('qms:device-apply:update')") public CommonResult updateDeviceApply(@Valid @RequestBody DeviceApplySaveReqVO updateReqVO) { deviceApplyService.updateDeviceApply(updateReqVO); return success(true); @@ -70,7 +71,7 @@ public class DeviceApplyController extends AbstractFileUploadController implemen @DeleteMapping("/delete") @Operation(summary = "删除设备通用流程,验收、降级、停用、报废、还原、启用") @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('qms:device-apply:delete')") +// @PreAuthorize("@ss.hasPermission('qms:device-apply:delete')") public CommonResult deleteDeviceApply(@RequestParam("id") Long id) { deviceApplyService.deleteDeviceApply(id); return success(true); diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceConfigFlowController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceConfigFlowController.java new file mode 100644 index 0000000..cf1bc1f --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceConfigFlowController.java @@ -0,0 +1,116 @@ +package com.zt.plat.module.qms.resource.device.controller.admin; + +import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowPageReqVO; +import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowRespVO; +import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowSaveReqVO; +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 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.device.dal.dataobject.DeviceConfigFlowDO; +import com.zt.plat.module.qms.resource.device.service.DeviceConfigFlowService; + +@Tag(name = "管理后台 - 设备通用流程配置") +@RestController +@RequestMapping("/qms/resource/device-config-flow") +@Validated +public class DeviceConfigFlowController implements BusinessControllerMarker { + + + @Resource + private DeviceConfigFlowService deviceConfigFlowService; + + @GetMapping("/getEnableList") + @Operation(summary = "获得设备通用流程配置") + public CommonResult> getEnableList(@Valid DeviceConfigFlowPageReqVO pageReqVO) { + PageResult pageResult = deviceConfigFlowService.getDeviceConfigFlowPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, DeviceConfigFlowRespVO.class)); + } + + @PostMapping("/create") + @Operation(summary = "创建设备通用流程配置") + @PreAuthorize("@ss.hasPermission('qms:device-config-flow:create')") + public CommonResult createDeviceConfigFlow(@Valid @RequestBody DeviceConfigFlowSaveReqVO createReqVO) { + return success(deviceConfigFlowService.createDeviceConfigFlow(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新设备通用流程配置") + @PreAuthorize("@ss.hasPermission('qms:device-config-flow:update')") + public CommonResult updateDeviceConfigFlow(@Valid @RequestBody DeviceConfigFlowSaveReqVO updateReqVO) { + deviceConfigFlowService.updateDeviceConfigFlow(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除设备通用流程配置") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('qms:device-config-flow:delete')") + public CommonResult deleteDeviceConfigFlow(@RequestParam("id") Long id) { + deviceConfigFlowService.deleteDeviceConfigFlow(id); + return success(true); + } + + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除设备通用流程配置") + @PreAuthorize("@ss.hasPermission('qms:device-config-flow:delete')") + public CommonResult deleteDeviceConfigFlowList(@RequestBody BatchDeleteReqVO req) { + deviceConfigFlowService.deleteDeviceConfigFlowListByIds(req.getIds()); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得设备通用流程配置") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('qms:device-config-flow:query')") + public CommonResult getDeviceConfigFlow(@RequestParam("id") Long id) { + DeviceConfigFlowDO deviceConfigFlow = deviceConfigFlowService.getDeviceConfigFlow(id); + return success(BeanUtils.toBean(deviceConfigFlow, DeviceConfigFlowRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得设备通用流程配置分页") + @PreAuthorize("@ss.hasPermission('qms:device-config-flow:query')") + public CommonResult> getDeviceConfigFlowPage(@Valid DeviceConfigFlowPageReqVO pageReqVO) { + PageResult pageResult = deviceConfigFlowService.getDeviceConfigFlowPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, DeviceConfigFlowRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出设备通用流程配置 Excel") + @PreAuthorize("@ss.hasPermission('qms:device-config-flow:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportDeviceConfigFlowExcel(@Valid DeviceConfigFlowPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = deviceConfigFlowService.getDeviceConfigFlowPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "设备通用流程配置.xls", "数据", DeviceConfigFlowRespVO.class, + BeanUtils.toBean(list, DeviceConfigFlowRespVO.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/device/controller/admin/DeviceUseRecordController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceUseRecordController.java index b182cf6..f99070d 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceUseRecordController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceUseRecordController.java @@ -96,8 +96,11 @@ public class DeviceUseRecordController extends AbstractFileUploadController impl @PutMapping("/update") @Operation(summary = "更新设备-使用记录") @PreAuthorize("@ss.hasPermission('qms:device-use-record:update')") - public CommonResult updateDeviceUseRecord(@Valid @RequestBody DeviceUseRecordSaveReqVO updateReqVO) { - deviceUseRecordService.updateDeviceUseRecord(updateReqVO); + public CommonResult updateDeviceUseRecord(@Valid @RequestBody DeviceUseRecordSaveReqVO reqVO) { + Long deviceId = reqVO.getDeviceId(); + if(deviceId == null) + return CommonResult.error(DEVICE_USE_RECORD_NOT_EXISTS.getCode(), "设备ID不能为空"); + deviceUseRecordService.updateDeviceUseRecord(reqVO); return success(true); } diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceApplyPageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceApplyPageReqVO.java index b979bfe..7a49d2e 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceApplyPageReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceApplyPageReqVO.java @@ -12,7 +12,7 @@ import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH @Data public class DeviceApplyPageReqVO extends PageParam { - @Schema(description = "业务名称,【字典】【jy_device_lifecycle_bsn_type】验收、降级、停用、报废、还原、启用等", example = "ZT") + @Schema(description = "业务名称,【字典】【jy_device_lifecycle_bsn_type】验收、降级、停用、报废、还原、启用等", example = "王五") private String businessName; @Schema(description = "申请部门", example = "王五") @@ -21,7 +21,7 @@ public class DeviceApplyPageReqVO extends PageParam { @Schema(description = "申请部门ID") private String applyDepartment; - @Schema(description = "申请人", example = "王五") + @Schema(description = "申请人", example = "ZT") private String applyUserName; @Schema(description = "申请人ID") @@ -43,13 +43,13 @@ public class DeviceApplyPageReqVO extends PageParam { @Schema(description = "借用人") private String businessUser; - @Schema(description = "借用人id", example = "14524") + @Schema(description = "借用人id", example = "30865") private Long businessUserId; @Schema(description = "借用部门") private String businessDepartment; - @Schema(description = "借用部门id", example = "894") + @Schema(description = "借用部门id", example = "3852") private Long businessDepartmentId; @Schema(description = "计划归还日期") @@ -59,16 +59,22 @@ public class DeviceApplyPageReqVO extends PageParam { @Schema(description = "归还接收人") private String givebackReceiveUser; - @Schema(description = "归还接收人id", example = "1528") + @Schema(description = "归还接收人id", example = "1499") private Long givebackReceiveUserId; - @Schema(description = "数据集配置ID", example = "12435") + @Schema(description = "表单模板ID", example = "23422") + private String templateId; + + @Schema(description = "表单组件") + private String formComponent; + + @Schema(description = "数据集配置ID", example = "17263") private Long dataCollectionId; @Schema(description = "表单数据") private String formData; - @Schema(description = "流程实例id", example = "15634") + @Schema(description = "流程实例id", example = "289") private String flowInstanceId; @Schema(description = "所属部门") diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceApplyRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceApplyRespVO.java index 33a6440..42ad701 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceApplyRespVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceApplyRespVO.java @@ -11,11 +11,11 @@ import com.alibaba.excel.annotation.*; @ExcelIgnoreUnannotated public class DeviceApplyRespVO { - @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20295") + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "23536") @ExcelProperty("ID") private Long id; - @Schema(description = "业务名称,【字典】【jy_device_lifecycle_bsn_type】验收、降级、停用、报废、还原、启用等", example = "ZT") + @Schema(description = "业务名称,【字典】【jy_device_lifecycle_bsn_type】验收、降级、停用、报废、还原、启用等", example = "王五") @ExcelProperty("业务名称,【字典】【jy_device_lifecycle_bsn_type】验收、降级、停用、报废、还原、启用等") private String businessName; @@ -27,7 +27,7 @@ public class DeviceApplyRespVO { @ExcelProperty("申请部门ID") private String applyDepartment; - @Schema(description = "申请人", example = "王五") + @Schema(description = "申请人", example = "ZT") @ExcelProperty("申请人") private String applyUserName; @@ -55,7 +55,7 @@ public class DeviceApplyRespVO { @ExcelProperty("借用人") private String businessUser; - @Schema(description = "借用人id", example = "14524") + @Schema(description = "借用人id", example = "30865") @ExcelProperty("借用人id") private Long businessUserId; @@ -63,7 +63,7 @@ public class DeviceApplyRespVO { @ExcelProperty("借用部门") private String businessDepartment; - @Schema(description = "借用部门id", example = "894") + @Schema(description = "借用部门id", example = "3852") @ExcelProperty("借用部门id") private Long businessDepartmentId; @@ -75,11 +75,19 @@ public class DeviceApplyRespVO { @ExcelProperty("归还接收人") private String givebackReceiveUser; - @Schema(description = "归还接收人id", example = "1528") + @Schema(description = "归还接收人id", example = "1499") @ExcelProperty("归还接收人id") private Long givebackReceiveUserId; - @Schema(description = "数据集配置ID", example = "12435") + @Schema(description = "表单模板ID", example = "23422") + @ExcelProperty("表单模板ID") + private String templateId; + + @Schema(description = "表单组件") + @ExcelProperty("表单组件") + private String formComponent; + + @Schema(description = "数据集配置ID", example = "17263") @ExcelProperty("数据集配置ID") private Long dataCollectionId; @@ -87,7 +95,7 @@ public class DeviceApplyRespVO { @ExcelProperty("表单数据") private String formData; - @Schema(description = "流程实例id", example = "15634") + @Schema(description = "流程实例id", example = "289") @ExcelProperty("流程实例id") private String flowInstanceId; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceApplySaveReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceApplySaveReqVO.java index f0ee933..f423ba3 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceApplySaveReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceApplySaveReqVO.java @@ -9,10 +9,10 @@ import java.time.LocalDateTime; @Data public class DeviceApplySaveReqVO { - @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20295") + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "23536") private Long id; - @Schema(description = "业务名称,【字典】【jy_device_lifecycle_bsn_type】验收、降级、停用、报废、还原、启用等", example = "ZT") + @Schema(description = "业务名称,【字典】【jy_device_lifecycle_bsn_type】验收、降级、停用、报废、还原、启用等", example = "王五") private String businessName; @Schema(description = "申请部门", example = "王五") @@ -21,7 +21,7 @@ public class DeviceApplySaveReqVO { @Schema(description = "申请部门ID") private String applyDepartment; - @Schema(description = "申请人", example = "王五") + @Schema(description = "申请人", example = "ZT") private String applyUserName; @Schema(description = "申请人ID") @@ -42,13 +42,13 @@ public class DeviceApplySaveReqVO { @Schema(description = "借用人") private String businessUser; - @Schema(description = "借用人id", example = "14524") + @Schema(description = "借用人id", example = "30865") private Long businessUserId; @Schema(description = "借用部门") private String businessDepartment; - @Schema(description = "借用部门id", example = "894") + @Schema(description = "借用部门id", example = "3852") private Long businessDepartmentId; @Schema(description = "计划归还日期") @@ -57,16 +57,22 @@ public class DeviceApplySaveReqVO { @Schema(description = "归还接收人") private String givebackReceiveUser; - @Schema(description = "归还接收人id", example = "1528") + @Schema(description = "归还接收人id", example = "1499") private Long givebackReceiveUserId; - @Schema(description = "数据集配置ID", example = "12435") + @Schema(description = "表单模板ID", example = "23422") + private String templateId; + + @Schema(description = "表单组件") + private String formComponent; + + @Schema(description = "数据集配置ID", example = "17263") private Long dataCollectionId; @Schema(description = "表单数据") private String formData; - @Schema(description = "流程实例id", example = "15634") + @Schema(description = "流程实例id", example = "289") private String flowInstanceId; @Schema(description = "所属部门") diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceConfigFlowPageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceConfigFlowPageReqVO.java new file mode 100644 index 0000000..17e7be0 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceConfigFlowPageReqVO.java @@ -0,0 +1,49 @@ +package com.zt.plat.module.qms.resource.device.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 DeviceConfigFlowPageReqVO extends PageParam { + + @Schema(description = "业务类型", example = "2") + private String businessType; + + @Schema(description = "业务类型名称", example = "王五") + private String businessName; + + @Schema(description = "流程key") + private String flowKey; + + @Schema(description = "数据集配置Key") + private String dataCollectionKey; + + @Schema(description = "表单模板key") + private String templateKey; + + @Schema(description = "表单组件") + private String formComponent; + + @Schema(description = "其他配置") + private String customConfig; + + @Schema(description = "排序号") + private Integer orderNo; + + @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/device/controller/vo/DeviceConfigFlowRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceConfigFlowRespVO.java new file mode 100644 index 0000000..a373f6a --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceConfigFlowRespVO.java @@ -0,0 +1,60 @@ +package com.zt.plat.module.qms.resource.device.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 DeviceConfigFlowRespVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "6744") + @ExcelProperty("主键") + private Long id; + + @Schema(description = "业务类型", example = "2") + @ExcelProperty("业务类型") + private String businessType; + + @Schema(description = "业务类型名称", example = "王五") + @ExcelProperty("业务类型名称") + private String businessName; + + @Schema(description = "流程key") + @ExcelProperty("流程key") + private String flowKey; + + @Schema(description = "数据集配置Key") + @ExcelProperty("数据集配置ID") + private String dataCollectionKey; + + @Schema(description = "表单模板key") + @ExcelProperty("表单模板key") + private String templateKey; + + @Schema(description = "表单组件") + @ExcelProperty("表单组件") + private String formComponent; + + @Schema(description = "其他配置") + private String customConfig;; + + @Schema(description = "排序号") + private Integer orderNo; + + @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/device/controller/vo/DeviceConfigFlowSaveReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceConfigFlowSaveReqVO.java new file mode 100644 index 0000000..e72d4f8 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceConfigFlowSaveReqVO.java @@ -0,0 +1,43 @@ +package com.zt.plat.module.qms.resource.device.controller.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +@Schema(description = "管理后台 - 设备通用流程配置新增/修改 Request VO") +@Data +public class DeviceConfigFlowSaveReqVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "6744") + private Long id; + + @Schema(description = "业务类型", example = "2") + private String businessType; + + @Schema(description = "业务类型名称", example = "王五") + private String businessName; + + @Schema(description = "流程key") + private String flowKey; + + @Schema(description = "数据集配置Key") + private String dataCollectionKey; + + @Schema(description = "表单模板key") + private String templateKey; + + @Schema(description = "表单组件") + private String formComponent; + + @Schema(description = "其他配置") + private String customConfig;; + + @Schema(description = "排序号") + private Integer orderNo; + + @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/device/controller/vo/DeviceUseRecordPageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceUseRecordPageReqVO.java index 03e7778..83de5c3 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceUseRecordPageReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceUseRecordPageReqVO.java @@ -23,9 +23,11 @@ public class DeviceUseRecordPageReqVO extends PageParam { private Long userId; @Schema(description = "开始使用时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) private LocalDateTime[] useTimeStart; @Schema(description = "结束使用时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) private LocalDateTime[] useTimeEnd; @Schema(description = "使用记录") diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/dataobject/DeviceApplyDO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/dataobject/DeviceApplyDO.java index f45d0c7..6ff034f 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/dataobject/DeviceApplyDO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/dataobject/DeviceApplyDO.java @@ -27,113 +27,123 @@ public class DeviceApplyDO extends BusinessBaseDO { /** - * ID - */ + * ID + */ @TableId(type = IdType.ASSIGN_ID) private Long id; /** - * 业务名称,【字典】【jy_device_lifecycle_bsn_type】验收、降级、停用、报废、还原、启用等 - */ + * 业务名称,【字典】【jy_device_lifecycle_bsn_type】验收、降级、停用、报废、还原、启用等 + */ @TableField("BSN_NAME") private String businessName; /** - * 申请部门 - */ + * 申请部门 + */ @TableField("APL_DEPT_NAME") private String applyDepartmentName; /** - * 申请部门ID - */ + * 申请部门ID + */ @TableField("APL_DEPT") private String applyDepartment; /** - * 申请人 - */ + * 申请人 + */ @TableField("APL_USER_NAME") private String applyUserName; /** - * 申请人ID - */ + * 申请人ID + */ @TableField("APL_USER") private String applyUser; /** - * 业务编码 - */ + * 业务编码 + */ @TableField("BSN_CD") private String businessCode; /** - * 业务日期 - */ + * 业务日期 + */ @TableField("BSN_DT") private LocalDateTime businessDate; /** - * 业务原因 - */ + * 业务原因 + */ @TableField("BSN_RSN") private String businessReason; /** - * 业务状态 - */ + * 业务状态 + */ @TableField("BSN_STS") private String businessStatus; /** - * 借用人 - */ + * 借用人 + */ @TableField("BSN_USER") private String businessUser; /** - * 借用人id - */ + * 借用人id + */ @TableField("BSN_USER_ID") private Long businessUserId; /** - * 借用部门 - */ + * 借用部门 + */ @TableField("BSN_DEPT") private String businessDepartment; /** - * 借用部门id - */ + * 借用部门id + */ @TableField("BSN_DEPT_ID") private Long businessDepartmentId; /** - * 计划归还日期 - */ + * 计划归还日期 + */ @TableField("PLN_GIV_DT") private LocalDateTime planGivebackDate; /** - * 归还接收人 - */ + * 归还接收人 + */ @TableField("GIV_RCV_USER") private String givebackReceiveUser; /** - * 归还接收人id - */ + * 归还接收人id + */ @TableField("GIV_RCV_USER_ID") private Long givebackReceiveUserId; /** - * 数据集配置ID - */ + * 表单模板ID + */ + @TableField("TMPL_ID") + private String templateId; + /** + * 表单组件 + */ + @TableField("FORM_CPNT") + private String formComponent; + /** + * 数据集配置ID + */ @TableField("DAT_COLT_ID") private Long dataCollectionId; /** - * 表单数据 - */ + * 表单数据 + */ @TableField("FORM_DAT") private String formData; /** - * 流程实例id - */ + * 流程实例id + */ @TableField("FLW_INSC_ID") private String flowInstanceId; /** - * 所属部门 - */ + * 所属部门 + */ @TableField("SYS_DEPT_CD") private String systemDepartmentCode; /** - * 备注 - */ + * 备注 + */ @TableField("RMK") private String remark; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/dataobject/DeviceConfigFlowDO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/dataobject/DeviceConfigFlowDO.java new file mode 100644 index 0000000..0f58f93 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/dataobject/DeviceConfigFlowDO.java @@ -0,0 +1,82 @@ +package com.zt.plat.module.qms.resource.device.dal.dataobject; + +import lombok.*; +import com.baomidou.mybatisplus.annotation.*; +import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO; +/** +* 设备通用流程配置 DO +* +* @author 后台管理-1 +*/ +@TableName("t_dev_cfg_flw") +@KeySequence("t_dev_cfg_flw_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +/** +* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO +*/ +public class DeviceConfigFlowDO extends BusinessBaseDO { + + + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + private Long id; + /** + * 业务类型 + */ + @TableField("BSN_TP") + private String businessType; + /** + * 业务类型名称 + */ + @TableField("BSN_NAME") + private String businessName; + /** + * 流程key + */ + @TableField("FLW_KY") + private String flowKey; + /** + * 数据集配置Key + */ + @TableField("DAT_COLT_KY") + private String dataCollectionKey; + /** + * 表单模板key + */ + @TableField("TMPL_KY") + private String templateKey; + /** + * 表单组件 + */ + @TableField("FORM_CPNT") + private String formComponent; + /** + * 其他配置 + */ + @TableField("CST_CFG") + private String customConfig; + + //排序号 + @TableField("ORD_NO") + private Integer orderNo; + + /** + * 所属部门 + */ + @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/device/dal/mapper/DeviceConfigFlowMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceConfigFlowMapper.java new file mode 100644 index 0000000..c06932f --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceConfigFlowMapper.java @@ -0,0 +1,49 @@ +package com.zt.plat.module.qms.resource.device.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.device.dal.dataobject.DeviceConfigFlowDO; +import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowPageReqVO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 设备通用流程配置 Mapper + * + * @author 后台管理-1 + */ +@Mapper +public interface DeviceConfigFlowMapper extends BaseMapperX { + + default PageResult selectPage(DeviceConfigFlowPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(DeviceConfigFlowDO::getBusinessType, reqVO.getBusinessType()) + .likeIfPresent(DeviceConfigFlowDO::getBusinessName, reqVO.getBusinessName()) + .eqIfPresent(DeviceConfigFlowDO::getFlowKey, reqVO.getFlowKey()) + .eqIfPresent(DeviceConfigFlowDO::getDataCollectionKey, reqVO.getDataCollectionKey()) + .eqIfPresent(DeviceConfigFlowDO::getTemplateKey, reqVO.getTemplateKey()) + .eqIfPresent(DeviceConfigFlowDO::getFormComponent, reqVO.getFormComponent()) + .eqIfPresent(DeviceConfigFlowDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode()) + .eqIfPresent(DeviceConfigFlowDO::getRemark, reqVO.getRemark()) + .betweenIfPresent(DeviceConfigFlowDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(DeviceConfigFlowDO::getId)); + } + + default List selectList(DeviceConfigFlowPageReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(DeviceConfigFlowDO::getBusinessType, reqVO.getBusinessType()) + .likeIfPresent(DeviceConfigFlowDO::getBusinessName, reqVO.getBusinessName()) + .eqIfPresent(DeviceConfigFlowDO::getFlowKey, reqVO.getFlowKey()) + .eqIfPresent(DeviceConfigFlowDO::getDataCollectionKey, reqVO.getDataCollectionKey()) + .eqIfPresent(DeviceConfigFlowDO::getTemplateKey, reqVO.getTemplateKey()) + .eqIfPresent(DeviceConfigFlowDO::getFormComponent, reqVO.getFormComponent()) + .eqIfPresent(DeviceConfigFlowDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode()) + .eqIfPresent(DeviceConfigFlowDO::getRemark, reqVO.getRemark()) + .betweenIfPresent(DeviceConfigFlowDO::getCreateTime, reqVO.getCreateTime()) + .orderByAsc(DeviceConfigFlowDO::getOrderNo) + ); + } + +} \ 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/device/dal/mapper/DeviceInfomationMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceInfomationMapper.java index 00ceabe..2fba698 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceInfomationMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceInfomationMapper.java @@ -4,8 +4,13 @@ import com.zt.plat.framework.common.pojo.PageResult; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationPageReqVO; +import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfoWithBizConfigVO; import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfomationDO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; /** * 设备-设备信息 Mapper @@ -56,4 +61,7 @@ public interface DeviceInfomationMapper extends BaseMapperX .orderByDesc(DeviceInfomationDO::getId)); } + //查询需要“某个业务类型”的设备列表 + List getListNeedByRule(@Param("param") Map param); + } \ 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/device/service/DeviceConfigFlowService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceConfigFlowService.java new file mode 100644 index 0000000..1977e0f --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceConfigFlowService.java @@ -0,0 +1,66 @@ +package com.zt.plat.module.qms.resource.device.service; + +import java.util.*; + +import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowPageReqVO; +import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowRespVO; +import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowSaveReqVO; +import jakarta.validation.*; +import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceConfigFlowDO; +import com.zt.plat.framework.common.pojo.PageResult; + +/** + * 设备通用流程配置 Service 接口 + * + * @author 后台管理-1 + */ +public interface DeviceConfigFlowService { + + List getEnableList(DeviceConfigFlowPageReqVO pageReqVO); + + /** + * 创建设备通用流程配置 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + DeviceConfigFlowRespVO createDeviceConfigFlow(@Valid DeviceConfigFlowSaveReqVO createReqVO); + + /** + * 更新设备通用流程配置 + * + * @param updateReqVO 更新信息 + */ + void updateDeviceConfigFlow(@Valid DeviceConfigFlowSaveReqVO updateReqVO); + + /** + * 删除设备通用流程配置 + * + * @param id 编号 + */ + void deleteDeviceConfigFlow(Long id); + + /** + * 批量删除设备通用流程配置 + * + * @param ids 编号 + */ + void deleteDeviceConfigFlowListByIds(List ids); + + /** + * 获得设备通用流程配置 + * + * @param id 编号 + * @return 设备通用流程配置 + */ + DeviceConfigFlowDO getDeviceConfigFlow(Long id); + + /** + * 获得设备通用流程配置分页 + * + * @param pageReqVO 分页查询 + * @return 设备通用流程配置分页 + */ + PageResult getDeviceConfigFlowPage(DeviceConfigFlowPageReqVO 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/device/service/DeviceConfigFlowServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceConfigFlowServiceImpl.java new file mode 100644 index 0000000..e6a07b3 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceConfigFlowServiceImpl.java @@ -0,0 +1,97 @@ +package com.zt.plat.module.qms.resource.device.service; + +import cn.hutool.core.collection.CollUtil; +import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowPageReqVO; +import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowRespVO; +import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowSaveReqVO; +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.device.dal.dataobject.DeviceConfigFlowDO; +import com.zt.plat.framework.common.pojo.PageResult; +import com.zt.plat.framework.common.util.object.BeanUtils; + +import com.zt.plat.module.qms.resource.device.dal.mapper.DeviceConfigFlowMapper; + +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 后台管理-1 + */ +@Service +@Validated +public class DeviceConfigFlowServiceImpl implements DeviceConfigFlowService { + + @Resource + private DeviceConfigFlowMapper deviceConfigFlowMapper; + + @Override + public List getEnableList(DeviceConfigFlowPageReqVO pageReqVO) { + return deviceConfigFlowMapper.selectList(pageReqVO); + } + + @Override + public DeviceConfigFlowRespVO createDeviceConfigFlow(DeviceConfigFlowSaveReqVO createReqVO) { + // 插入 + DeviceConfigFlowDO deviceConfigFlow = BeanUtils.toBean(createReqVO, DeviceConfigFlowDO.class); + deviceConfigFlowMapper.insert(deviceConfigFlow); + // 返回 + return BeanUtils.toBean(deviceConfigFlow, DeviceConfigFlowRespVO.class); + } + + @Override + public void updateDeviceConfigFlow(DeviceConfigFlowSaveReqVO updateReqVO) { + // 校验存在 + validateDeviceConfigFlowExists(updateReqVO.getId()); + // 更新 + DeviceConfigFlowDO updateObj = BeanUtils.toBean(updateReqVO, DeviceConfigFlowDO.class); + deviceConfigFlowMapper.updateById(updateObj); + } + + @Override + public void deleteDeviceConfigFlow(Long id) { + // 校验存在 + validateDeviceConfigFlowExists(id); + // 删除 + deviceConfigFlowMapper.deleteById(id); + } + + @Override + public void deleteDeviceConfigFlowListByIds(List ids) { + // 校验存在 + validateDeviceConfigFlowExists(ids); + // 删除 + deviceConfigFlowMapper.deleteByIds(ids); + } + + private void validateDeviceConfigFlowExists(List ids) { + List list = deviceConfigFlowMapper.selectByIds(ids); + if (CollUtil.isEmpty(list) || list.size() != ids.size()) { + throw exception(DEVICE_CONFIG_FLOW_NOT_EXISTS); + } + } + + private void validateDeviceConfigFlowExists(Long id) { + if (deviceConfigFlowMapper.selectById(id) == null) { + throw exception(DEVICE_CONFIG_FLOW_NOT_EXISTS); + } + } + + @Override + public DeviceConfigFlowDO getDeviceConfigFlow(Long id) { + return deviceConfigFlowMapper.selectById(id); + } + + @Override + public PageResult getDeviceConfigFlowPage(DeviceConfigFlowPageReqVO pageReqVO) { + return deviceConfigFlowMapper.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/device/service/DeviceInfomationServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceInfomationServiceImpl.java index 4c744ea..0d67841 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceInfomationServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceInfomationServiceImpl.java @@ -88,11 +88,10 @@ public class DeviceInfomationServiceImpl implements DeviceInfomationService { return CommonResult.error( DEVICE_INFOMATION_NOT_EXISTS.getCode(), "设备在维修中"); return CommonResult.success( true); } - /*todo 查询需要“某个业务类型”的设备列表*/ + /*查询需要“某个业务类型”的设备列表*/ @Override public List getListNeedByRule(JSONObject params) { - - return null; + return deviceInfomationMapper.getListNeedByRule(params); } /* diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceUseRecordServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceUseRecordServiceImpl.java index d56e646..fddb3f2 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceUseRecordServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceUseRecordServiceImpl.java @@ -1,15 +1,15 @@ package com.zt.plat.module.qms.resource.device.service; import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.zt.plat.framework.common.pojo.CommonResult; import com.zt.plat.framework.security.core.LoginUser; import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils; -import com.zt.plat.module.qms.resource.device.controller.vo.DeviceUseRecordPageReqVO; -import com.zt.plat.module.qms.resource.device.controller.vo.DeviceUseRecordRespVO; -import com.zt.plat.module.qms.resource.device.controller.vo.DeviceUseRecordSaveReqVO; -import com.zt.plat.module.qms.resource.device.controller.vo.DeviceUseRecordVO; +import com.zt.plat.module.qms.resource.device.controller.vo.*; import org.springframework.stereotype.Service; import jakarta.annotation.Resource; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.ObjectUtils; import org.springframework.validation.annotation.Validated; @@ -36,14 +36,27 @@ import static com.zt.plat.module.qms.enums.ErrorCodeConstants.DEVICE_USE_RECORD_ public class DeviceUseRecordServiceImpl implements DeviceUseRecordService { @Resource private DeviceInfomationService deviceInfomationService; + @Resource private DeviceProductService deviceProductService; @Resource private DeviceUseRecordMapper deviceUseRecordMapper; @Override public PageResult queryPageListWithCount(DeviceUseRecordPageReqVO reqVO) { - return null; + Long productId = reqVO.getProductId(); + if(productId != null){ + List productIds = deviceProductService.getIdListByIdPath(productId); + List deviceIds = deviceInfomationService.getIdListByProductIdList(productIds); + if(!deviceIds.isEmpty()){ + reqVO.setProductId(null); + reqVO.setDeviceIdList(deviceIds); + } + } + Page page = new Page<>(reqVO.getPageNo(), reqVO.getPageSize()); + IPage pageList = deviceUseRecordMapper.queryPageListWithCount(page, reqVO); + return new PageResult<>(pageList.getRecords(), pageList.getTotal()); } @Override + @Transactional(rollbackFor = Exception.class) public CommonResult createDeviceUseRecord(DeviceUseRecordSaveReqVO reqVO) { Long deviceId = reqVO.getDeviceId(); if(ObjectUtils.isEmpty(reqVO.getUserName())){ @@ -66,11 +79,17 @@ public class DeviceUseRecordServiceImpl implements DeviceUseRecordService { } @Override - public void updateDeviceUseRecord(DeviceUseRecordSaveReqVO updateReqVO) { + @Transactional(rollbackFor = Exception.class) + public void updateDeviceUseRecord(DeviceUseRecordSaveReqVO reqVO) { // 校验存在 - validateDeviceUseRecordExists(updateReqVO.getId()); + validateDeviceUseRecordExists(reqVO.getId()); + Long deviceId = reqVO.getDeviceId(); + if(reqVO.getUseTimeEnd() == null) + deviceInfomationService.updateDeviceInUseFlag(deviceId, 1); + else + deviceInfomationService.updateDeviceInUseFlag(deviceId, 0); // 更新 - DeviceUseRecordDO updateObj = BeanUtils.toBean(updateReqVO, DeviceUseRecordDO.class); + DeviceUseRecordDO updateObj = BeanUtils.toBean(reqVO, DeviceUseRecordDO.class); deviceUseRecordMapper.updateById(updateObj); } diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceConfigFlowMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceConfigFlowMapper.xml new file mode 100644 index 0000000..e443caa --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceConfigFlowMapper.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/device/dal/mapper/DeviceInfomationMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceInfomationMapper.xml index 2453564..a175453 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceInfomationMapper.xml +++ b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceInfomationMapper.xml @@ -9,4 +9,42 @@ 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ --> + + + \ No newline at end of file From 3ea0b06cc3cb0051b16c2236695d36d43f089858 Mon Sep 17 00:00:00 2001 From: FCL Date: Sun, 4 Jan 2026 10:32:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=E6=8A=A5=E5=91=8A=E7=AD=BE=E5=90=8D?= =?UTF-8?q?=E7=BC=BA=E5=A4=B1=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../reportdoc/service/ReportDocumentDataServiceImpl.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataServiceImpl.java index e03b720..7b72e2c 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataServiceImpl.java @@ -814,8 +814,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService sigIds.add(Long.parseLong(signatureId)); }); if(sigIds.isEmpty()) - return ""; - + return docSigJson.toJSONString(); List sigList = configUserSignatureService.getByIdList(sigIds); docSigJson.forEach((key, value) -> { JSONObject obj = docSigJson.getJSONObject( key);