diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/iot/tcpserver/device/RedisSessionComponent.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/iot/tcpserver/device/RedisSessionComponent.java index 89a0fc4..87b0595 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/iot/tcpserver/device/RedisSessionComponent.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/iot/tcpserver/device/RedisSessionComponent.java @@ -105,7 +105,7 @@ public class RedisSessionComponent { context.setDeviceType(deviceType); context.setDeviceCode(deviceCode); if(deviceInfo != null){ - context.setDeviceName(deviceInfo.getProductName()); + context.setDeviceName(deviceInfo.getDeviceName()); context.setTenantId(deviceInfo.getTenantId().toString()); deviceInfo.setIsConnect("1"); deviceInfo.setLastConnectTime(LocalDateTime.now()); diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/common/DeviceUtil.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/common/DeviceUtil.java new file mode 100644 index 0000000..76f2395 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/common/DeviceUtil.java @@ -0,0 +1,140 @@ +package com.zt.plat.module.qms.resource.device.common; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import org.springframework.util.ObjectUtils; + +import java.time.DayOfWeek; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.temporal.TemporalAdjusters; +import java.util.ArrayList; +import java.util.List; + +public class DeviceUtil { + + + /*** + * 根据频率类型,获取当前频率周期的开始时间和结束时间 + * @param date 上次执行日期 + * @param frequencyType 频率类型 + * @param frequency 频率 + * @return + */ + public static LocalDateTime[] getDateRangeByFrequency(LocalDate date, boolean nextFlag, String frequencyType, String frequency) { + LocalDate referenceDate = (date != null) ? date : LocalDate.now(); + LocalDate startDate = null; + LocalDate endDate = null; + int frequencyInt = Integer.parseInt(frequency); + if(!nextFlag) + frequencyInt --; + switch (frequencyType.toLowerCase()) { + case "day": + startDate = referenceDate.plusDays(frequencyInt); + endDate = startDate.plusDays(frequencyInt + 1); + break; +// case "day_before_use": //每天第一次使用前,与按天相同。 截止2025-4-19,未启用此项 +// startDate = referenceDate.plusDays(frequencyInt); +// endDate = startDate.plusDays(frequencyInt + 1); +// break; + case "week": + startDate = referenceDate.plusWeeks(frequencyInt); + startDate = startDate.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)); + endDate = startDate.plusWeeks(1).minusDays(1); + break; + case "month": + startDate = referenceDate.plusMonths(frequencyInt).withDayOfMonth(1); + endDate = startDate.plusMonths(1).minusDays(1); + break; + case "year": + startDate = referenceDate.plusYears(frequencyInt); + endDate = startDate.plusYears(1).minusDays(1); + break; + default: + return null; + } + + return new LocalDateTime[]{ + LocalDateTime.of(startDate, LocalTime.of(0, 0, 0)), + LocalDateTime.of(endDate, LocalTime.of(23, 59, 59)) + }; + } + + + public static String assembleCommentJson(JSONArray flow){ + if(flow == null) + return ""; + JSONArray entity = new JSONArray(); +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + for(int i = flow.size() - 1; i >= 0; i--){ + JSONObject flowItem = flow.getJSONObject(i); + String historyActivityId = flowItem.getString("historyActivityId"); + String historyActivityName = flowItem.getString("historyActivityName"); + if(checkContains(entity, historyActivityId)) + continue; + String assigneeName = flowItem.getString("assigneeName"); + String assignee = flowItem.getString("assignee"); + String endTime = flowItem.getString("endTime"); + JSONArray comments = flowItem.getJSONArray("comments"); + String comment = ""; + if(comments != null && comments.size() > 0){ + comment = comments.getJSONObject(0).getString("message"); + } + if(!historyActivityId.toLowerCase().startsWith("activity_")) + continue; + if(!ObjectUtils.isEmpty(endTime)){ + JSONObject commentObj = new JSONObject(); + commentObj.put("nodeId", historyActivityId); + commentObj.put("nodeName", historyActivityName); + commentObj.put("comment", comment); + commentObj.put("userName", assigneeName); + commentObj.put("userId", assignee); + commentObj.put("time", endTime); + entity.add(commentObj); + } + } + return entity.toJSONString(); + } + + public static void transCommentToValue(JSONObject voJson, String commentJsonStr){ + List hasActivityList = new ArrayList<>(); + if(!ObjectUtils.isEmpty(commentJsonStr)){ + JSONArray arr = JSONArray.parseArray(commentJsonStr); + for(int i=0;i getByProductId(@RequestParam("productId") Long productId) { + DeviceConfigBusinessRuleDO entity = deviceConfigBusinessRuleService.getByProductId(productId); + if(entity == null) + return success(null); + return success(BeanUtils.toBean(entity, DeviceConfigBusinessRuleRespVO.class)); + } + @PutMapping("/update") @Operation(summary = "更新设备-业务配置") @PreAuthorize("@ss.hasPermission('qms:device-config-business-rule:update')") diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceInfomationController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceInfomationController.java index df744d5..1f27db8 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceInfomationController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceInfomationController.java @@ -51,6 +51,13 @@ public class DeviceInfomationController extends AbstractFileUploadController imp @Resource private DeviceInfomationService deviceInfomationService; @Resource private DeviceProductService deviceProductService; + @PostMapping("/saveDevice") + @Operation(summary = "创建设备-设备信息") +// @PreAuthorize("@ss.hasPermission('resource:device-infomation:create')") + public CommonResult saveDevice(@Valid @RequestBody DeviceInfomationSaveReqVO reqVO) { + return deviceInfomationService.saveDevice(reqVO); + } + @PostMapping("/create") @Operation(summary = "创建设备-设备信息") @PreAuthorize("@ss.hasPermission('resource:device-infomation:create')") @@ -99,10 +106,11 @@ public class DeviceInfomationController extends AbstractFileUploadController imp public CommonResult> getDeviceInfomationPage(@Valid DeviceInfomationPageReqVO pageReqVO) { Long productId = pageReqVO.getProductId(); if(productId != null){ - List productDOList = deviceProductService.listByIdPath(productId, DataTypeConstant.DATA_TYPE_DATA); - List productIds = productDOList.stream().map(DeviceProductDO::getId).toList(); - pageReqVO.setProductIds(productIds); - pageReqVO.setProductId(null); + List productIds = deviceProductService.getIdListByIdPath(productId); + if(!productIds.isEmpty()){ + pageReqVO.setProductIds(productIds); + pageReqVO.setProductId(null); + } } PageResult pageResult = deviceInfomationService.getDeviceInfomationPage(pageReqVO); return success(BeanUtils.toBean(pageResult, DeviceInfomationRespVO.class)); diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceMaintainController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceMaintainController.java index d0e3939..0bc1972 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceMaintainController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceMaintainController.java @@ -1,8 +1,12 @@ package com.zt.plat.module.qms.resource.device.controller.admin; +import com.alibaba.fastjson.JSONObject; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceMaintainPageReqVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceMaintainRespVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceMaintainSaveReqVO; +import com.zt.plat.module.qms.resource.device.controller.vo.DeviceMaintainVO; +import com.zt.plat.module.qms.resource.device.service.DeviceInfomationService; +import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.*; import jakarta.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -17,6 +21,8 @@ import io.swagger.v3.oas.annotations.Operation; import jakarta.validation.*; import jakarta.servlet.http.*; + +import java.text.SimpleDateFormat; import java.util.*; import java.io.IOException; @@ -31,13 +37,14 @@ 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 static com.zt.plat.module.qms.enums.ErrorCodeConstants.DEVICE_MAINTAIN_NOT_EXISTS; import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceMaintainDO; import com.zt.plat.module.qms.resource.device.service.DeviceMaintainService; @Tag(name = "管理后台 - 设备-点检、保养记录") @RestController -@RequestMapping("/qms/device-maintain") +@RequestMapping("/qms/resource/device-maintain") @Validated @FileUploadController(source = "qms.devicemaintain") public class DeviceMaintainController extends AbstractFileUploadController implements BusinessControllerMarker{ @@ -49,8 +56,43 @@ public class DeviceMaintainController extends AbstractFileUploadController imple } } - @Resource - private DeviceMaintainService deviceMaintainService; + @Resource private DeviceMaintainService deviceMaintainService; + @Resource private DeviceInfomationService deviceInfomationService; + + @PostMapping("/createOrGet") + @Operation(summary = "创建或获取维护数据") + public CommonResult createOrGet(@RequestBody JSONObject jsonObject) { + Long deviceId = jsonObject.getLong("deviceId"); + String dataType = jsonObject.getString("dataType"); + String dateStr = jsonObject.getString("date"); + if (deviceId == null || dataType == null) { + return CommonResult.error(DEVICE_MAINTAIN_NOT_EXISTS.getCode(), "参数错误"); + } + //检查设备状态 + CommonResult checkResult = deviceInfomationService.checkDeviceUsable(deviceId); + if(!checkResult.isSuccess()){ + return checkResult.error(checkResult.getCode(), checkResult.getMsg()); + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + if(ObjectUtils.isEmpty(dateStr)) + dateStr = sdf.format(new Date()); + return deviceMaintainService.createOrGet(deviceId, dateStr, dataType); + } + + + @GetMapping("/getMaintainDetail") + @Operation(summary = "查询维护记录详情") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + public CommonResult getMaintainDetail(@RequestParam("id") Long id) { + return deviceMaintainService.getMaintainDetail(id); + } + + @GetMapping("/queryPageListWithCount") + @Operation(summary = "维护-分页列表查询") + public CommonResult> queryPageListWithCount(@Valid DeviceMaintainPageReqVO pageReqVO) { + PageResult pageResult = deviceMaintainService.queryPageListWithCount(pageReqVO); + return success(pageResult); + } @PostMapping("/create") @Operation(summary = "创建设备-点检、保养记录") @@ -88,7 +130,6 @@ public class DeviceMaintainController extends AbstractFileUploadController imple @GetMapping("/get") @Operation(summary = "获得设备-点检、保养记录") @Parameter(name = "id", description = "编号", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('qms:device-maintain:query')") public CommonResult getDeviceMaintain(@RequestParam("id") Long id) { DeviceMaintainDO deviceMaintain = deviceMaintainService.getDeviceMaintain(id); return success(BeanUtils.toBean(deviceMaintain, DeviceMaintainRespVO.class)); diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceMaintainItemController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceMaintainItemController.java index 7f60a03..f66768e 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceMaintainItemController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceMaintainItemController.java @@ -37,7 +37,7 @@ import com.zt.plat.module.qms.resource.device.service.DeviceMaintainItemService; @Tag(name = "管理后台 - 设备-保养分项") @RestController -@RequestMapping("/qms/device-maintain-item") +@RequestMapping("/qms/resource/device-maintain-item") @Validated @FileUploadController(source = "qms.devicemaintainitem") public class DeviceMaintainItemController extends AbstractFileUploadController implements BusinessControllerMarker{ diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DevicePeriodCheckController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DevicePeriodCheckController.java index 2c25d94..ba78280 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DevicePeriodCheckController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DevicePeriodCheckController.java @@ -37,7 +37,7 @@ import com.zt.plat.module.qms.resource.device.service.DevicePeriodCheckService; @Tag(name = "管理后台 - 设备-期间核查") @RestController -@RequestMapping("/qms/device-period-check") +@RequestMapping("/qms/resource/device-period-check") @Validated @FileUploadController(source = "qms.deviceperiodcheck") public class DevicePeriodCheckController extends AbstractFileUploadController implements BusinessControllerMarker{ diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DevicePeriodCheckPlanController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DevicePeriodCheckPlanController.java index d6ce09e..5200e70 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DevicePeriodCheckPlanController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DevicePeriodCheckPlanController.java @@ -37,7 +37,7 @@ import com.zt.plat.module.qms.resource.device.service.DevicePeriodCheckPlanServi @Tag(name = "管理后台 - 设备-期间核查计划") @RestController -@RequestMapping("/qms/device-period-check-plan") +@RequestMapping("/qms/resource/device-period-check-plan") @Validated @FileUploadController(source = "qms.deviceperiodcheckplan") public class DevicePeriodCheckPlanController extends AbstractFileUploadController implements BusinessControllerMarker{ diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceRepairApplyController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceRepairApplyController.java index 5210ead..b10728f 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceRepairApplyController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceRepairApplyController.java @@ -37,7 +37,7 @@ import com.zt.plat.module.qms.resource.device.service.DeviceRepairApplyService; @Tag(name = "管理后台 - 维修申请") @RestController -@RequestMapping("/qms/device-repair-apply") +@RequestMapping("/qms/resource/device-repair-apply") @Validated @FileUploadController(source = "qms.devicerepairapply") public class DeviceRepairApplyController extends AbstractFileUploadController implements BusinessControllerMarker{ diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceRepairDetailController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceRepairDetailController.java index 395895c..4bd19f4 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceRepairDetailController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceRepairDetailController.java @@ -37,7 +37,7 @@ import com.zt.plat.module.qms.resource.device.service.DeviceRepairDetailService; @Tag(name = "管理后台 - 设备维修明细") @RestController -@RequestMapping("/qms/device-repair-detail") +@RequestMapping("/qms/resource/device-repair-detail") @Validated @FileUploadController(source = "qms.devicerepairdetail") public class DeviceRepairDetailController extends AbstractFileUploadController implements BusinessControllerMarker{ diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceRepairResultDetailController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceRepairResultDetailController.java index 8a74c6c..0432fee 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceRepairResultDetailController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/admin/DeviceRepairResultDetailController.java @@ -37,7 +37,7 @@ import com.zt.plat.module.qms.resource.device.service.DeviceRepairResultDetailSe @Tag(name = "管理后台 - 故障处理明细") @RestController -@RequestMapping("/qms/device-repair-result-detail") +@RequestMapping("/qms/resource/device-repair-result-detail") @Validated @FileUploadController(source = "qms.devicerepairresultdetail") public class DeviceRepairResultDetailController extends AbstractFileUploadController implements BusinessControllerMarker{ 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 cc23bc0..04aa9f4 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 @@ -37,7 +37,7 @@ import com.zt.plat.module.qms.resource.device.service.DeviceUseRecordService; @Tag(name = "管理后台 - 设备-使用记录") @RestController -@RequestMapping("/qms/device-use-record") +@RequestMapping("/qms/resource/device-use-record") @Validated @FileUploadController(source = "qms.deviceuserecord") public class DeviceUseRecordController extends AbstractFileUploadController implements BusinessControllerMarker{ diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceInfomationPageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceInfomationPageReqVO.java index 341ebc7..dbb3db7 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceInfomationPageReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceInfomationPageReqVO.java @@ -19,7 +19,7 @@ public class DeviceInfomationPageReqVO extends PageParam { private Long productId; @Schema(description = "设备名称", example = "张三") - private String productName; + private String deviceName; @Schema(description = "别名") private String alias; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceInfomationRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceInfomationRespVO.java index 44ea0d7..cc6549a 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceInfomationRespVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceInfomationRespVO.java @@ -23,7 +23,7 @@ public class DeviceInfomationRespVO { @Schema(description = "设备名称", example = "张三") @ExcelProperty("设备名称") - private String productName; + private String deviceName; @Schema(description = "别名") @ExcelProperty("别名") diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceInfomationSaveReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceInfomationSaveReqVO.java index 0b72082..7c087f3 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceInfomationSaveReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceInfomationSaveReqVO.java @@ -1,11 +1,12 @@ package com.zt.plat.module.qms.resource.device.controller.vo; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import lombok.Data; import java.math.BigDecimal; import java.time.LocalDateTime; -import java.util.Date; @Schema(description = "管理后台 - 设备-设备信息新增/修改 Request VO") @Data @@ -15,10 +16,11 @@ public class DeviceInfomationSaveReqVO { private Long id; @Schema(description = "设备大类id", example = "32101") + @NotNull(message = "请选择设备大类!") private Long productId; @Schema(description = "设备名称", example = "张三") - private String productName; + private String deviceName; @Schema(description = "别名") private String alias; @@ -54,6 +56,7 @@ public class DeviceInfomationSaveReqVO { private String deviceNumber; @Schema(description = "管理编号") + @NotEmpty (message = "管理编号不能为空!") private String deviceCode; @Schema(description = "资产编号") diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceMaintainItemPageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceMaintainItemPageReqVO.java index 506a08a..5289d2f 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceMaintainItemPageReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceMaintainItemPageReqVO.java @@ -1,7 +1,6 @@ package com.zt.plat.module.qms.resource.device.controller.vo; import lombok.*; -import java.util.*; import io.swagger.v3.oas.annotations.media.Schema; import com.zt.plat.framework.common.pojo.PageParam; import org.springframework.format.annotation.DateTimeFormat; @@ -51,10 +50,10 @@ public class DeviceMaintainItemPageReqVO extends PageParam { private String frequency; @Schema(description = "所属周期开始日期") - private LocalDateTime frequencyItemStart; + private LocalDateTime frequencyTimeStart; @Schema(description = "所属周期截止日期") - private LocalDateTime frequencyItemEnd; + private LocalDateTime frequencyTimeEnd; @Schema(description = "检查标准") private String standard; @@ -69,7 +68,7 @@ public class DeviceMaintainItemPageReqVO extends PageParam { private String dutyRemark; @Schema(description = "排序号") - private Integer periodNo; + private Integer sortNo; @Schema(description = "所属部门") private String systemDepartmentCode; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceMaintainItemRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceMaintainItemRespVO.java index 0639c90..5c0d03d 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceMaintainItemRespVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceMaintainItemRespVO.java @@ -2,8 +2,7 @@ package com.zt.plat.module.qms.resource.device.controller.vo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; -import java.util.*; -import org.springframework.format.annotation.DateTimeFormat; + import java.time.LocalDateTime; import com.alibaba.excel.annotation.*; @@ -66,11 +65,11 @@ public class DeviceMaintainItemRespVO { @Schema(description = "所属周期开始日期") @ExcelProperty("所属周期开始日期") - private LocalDateTime frequencyItemStart; + private LocalDateTime frequencyTimeStart; @Schema(description = "所属周期截止日期") @ExcelProperty("所属周期截止日期") - private LocalDateTime frequencyItemEnd; + private LocalDateTime frequencyTimeEnd; @Schema(description = "检查标准") @ExcelProperty("检查标准") @@ -90,7 +89,7 @@ public class DeviceMaintainItemRespVO { @Schema(description = "排序号") @ExcelProperty("排序号") - private Integer periodNo; + private Integer sortNo; @Schema(description = "所属部门") @ExcelProperty("所属部门") diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceMaintainItemSaveReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceMaintainItemSaveReqVO.java index 814a7bd..87f6f4e 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceMaintainItemSaveReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceMaintainItemSaveReqVO.java @@ -2,9 +2,7 @@ package com.zt.plat.module.qms.resource.device.controller.vo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; -import java.util.*; -import jakarta.validation.constraints.*; -import org.springframework.format.annotation.DateTimeFormat; + import java.time.LocalDateTime; @Schema(description = "管理后台 - 设备-保养分项新增/修改 Request VO") @@ -51,10 +49,10 @@ public class DeviceMaintainItemSaveReqVO { private String frequency; @Schema(description = "所属周期开始日期") - private LocalDateTime frequencyItemStart; + private LocalDateTime frequencyTimeStart; @Schema(description = "所属周期截止日期") - private LocalDateTime frequencyItemEnd; + private LocalDateTime frequencyTimeEnd; @Schema(description = "检查标准") private String standard; @@ -69,7 +67,7 @@ public class DeviceMaintainItemSaveReqVO { private String dutyRemark; @Schema(description = "排序号") - private Integer periodNo; + private Integer sortNo; @Schema(description = "所属部门") private String systemDepartmentCode; diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceMaintainPageReqVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceMaintainPageReqVO.java index 99607a3..5b52081 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceMaintainPageReqVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceMaintainPageReqVO.java @@ -63,4 +63,23 @@ public class DeviceMaintainPageReqVO extends PageParam { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) private LocalDateTime[] createTime; + + //=====================================扩展字段=============================================== + @Schema(description = "产品id") + private Long productId; + + @Schema(description = "设备名称") + private String deviceName; + + @Schema(description = "管理编号") + private String deviceCode; + + @Schema(description = "使用部门") + private String deptName; + + @Schema(description = "产品id查询") + private List productIdList; + + @Schema(description = "设备ID列表") + private List deviceIdList; } \ 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/DeviceMaintainRespVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceMaintainRespVO.java index 31a3948..a69221a 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceMaintainRespVO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceMaintainRespVO.java @@ -80,4 +80,9 @@ public class DeviceMaintainRespVO { @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/DeviceMaintainVO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceMaintainVO.java new file mode 100644 index 0000000..8ee21d8 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/controller/vo/DeviceMaintainVO.java @@ -0,0 +1,84 @@ +package com.zt.plat.module.qms.resource.device.controller.vo; + +import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceMaintainDO; +import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceMaintainItemDO; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; +@Schema(description = "管理后台 - 设备维护VO") +@Data +public class DeviceMaintainVO extends DeviceMaintainRespVO { + + + //============大类字段============ + @Schema(description = "产品id") + private Long productId; + + @Schema(description = "规格") + private String specification; + + @Schema(description = "型号") + private String modelNo; + + @Schema(description = "制造商") + private String manufacturer; + + //============设备字段============ + @Schema(description = "设备名称") + private String deviceName; + + @Schema(description = "别名") + private String alias; + + @Schema(description = "管理编号") + private String deviceCode; + + @Schema(description = "资产编号") + private String assetCode; + + @Schema(description = "出厂编号") + private String factoryCode; + + @Schema(description = "所属部门名称") + private String deptName; + + @Schema(description = "维修状态: 1-维修;0-正常") + private Integer repairFlag; + + @Schema(description = "降级状态") + private Integer demoteFlag; + + @Schema(description = "报废状态") + private Integer scrapFlag; + + @Schema(description = "停用状态") + private Integer disableFlag; + + @Schema(description = "外借状态") + private Integer lendFlag; + + @Schema(description = "使用中状态") + private Integer inUseFlag; + + @Schema(description = "验收状态") + private String acceptFlag; + + + //============维护信息字段============ + @Schema(description = "维护项目列表") + List maintainItemList; + + @Schema(description = "未提交数据量") + private Integer runningCount; + + @Schema(description = "已提交数据量") + private Integer finishedCount; + + //导出报表时使用 + @Schema(description = "维护保养内") + private String maintainContent; + + //============其他字段============ + +} diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/dataobject/DeviceInfomationDO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/dataobject/DeviceInfomationDO.java index 8c5895c..6345191 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/dataobject/DeviceInfomationDO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/dataobject/DeviceInfomationDO.java @@ -6,7 +6,6 @@ import lombok.*; import java.math.BigDecimal; import java.time.LocalDateTime; -import java.util.Date; /** * 设备-设备信息 DO @@ -41,8 +40,8 @@ public class DeviceInfomationDO extends BusinessBaseDO { /** * 设备名称 */ - @TableField("PDT_NAME") - private String productName; + @TableField("DEV_NAME") + private String deviceName; /** * 别名 */ diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/dataobject/DeviceMaintainItemDO.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/dataobject/DeviceMaintainItemDO.java index 4e987a8..5d23f4a 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/dataobject/DeviceMaintainItemDO.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/dataobject/DeviceMaintainItemDO.java @@ -95,12 +95,12 @@ public class DeviceMaintainItemDO extends BusinessBaseDO { * 所属周期开始日期 */ @TableField("FREQ_ITM_STRT") - private LocalDateTime frequencyItemStart; + private LocalDateTime frequencyTimeStart; /** * 所属周期截止日期 */ @TableField("FREQ_ITM_END") - private LocalDateTime frequencyItemEnd; + private LocalDateTime frequencyTimeEnd; /** * 检查标准 */ @@ -124,8 +124,8 @@ public class DeviceMaintainItemDO extends BusinessBaseDO { /** * 排序号 */ - @TableField("PRD_NO") - private Integer periodNo; + @TableField("SRT_NO") + private Integer sortNo; /** * 所属部门 */ 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 b67c198..00ceabe 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 @@ -19,7 +19,7 @@ public interface DeviceInfomationMapper extends BaseMapperX return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(DeviceInfomationDO::getProductId, reqVO.getProductId()) .inIfPresent(DeviceInfomationDO::getProductId, reqVO.getProductIds()) - .likeIfPresent(DeviceInfomationDO::getProductName, reqVO.getProductName()) + .likeIfPresent(DeviceInfomationDO::getDeviceName, reqVO.getDeviceName()) .eqIfPresent(DeviceInfomationDO::getAlias, reqVO.getAlias()) .eqIfPresent(DeviceInfomationDO::getDeviceStatus, reqVO.getDeviceStatus()) .eqIfPresent(DeviceInfomationDO::getRepairFlag, reqVO.getRepairFlag()) diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceMaintainItemMapper.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceMaintainItemMapper.java index 8d6d135..676cec6 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceMaintainItemMapper.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceMaintainItemMapper.java @@ -29,13 +29,13 @@ public interface DeviceMaintainItemMapper extends BaseMapperX { .orderByDesc(DeviceMaintainDO::getId)); } + IPage queryPageListWithCount(Page page, @Param("param") DeviceMaintainPageReqVO param); + DeviceMaintainVO queryMaintainVoById(@Param("id") Long id); + } \ 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/DeviceConfigBusinessItemService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceConfigBusinessItemService.java index 9b7ef73..b8394a1 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceConfigBusinessItemService.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceConfigBusinessItemService.java @@ -16,6 +16,9 @@ import com.zt.plat.framework.common.pojo.PageResult; */ public interface DeviceConfigBusinessItemService { + List listByRuleId(Long ruleId); + List getByIdList(List ruleId); + /** * 创建设备-检查项目配置 * diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceConfigBusinessItemServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceConfigBusinessItemServiceImpl.java index 9f24c0a..ed9613b 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceConfigBusinessItemServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceConfigBusinessItemServiceImpl.java @@ -1,6 +1,7 @@ package com.zt.plat.module.qms.resource.device.service; import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessItemPageReqVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessItemRespVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessItemSaveReqVO; @@ -32,6 +33,18 @@ public class DeviceConfigBusinessItemServiceImpl implements DeviceConfigBusiness @Resource private DeviceConfigBusinessItemMapper deviceConfigBusinessItemMapper; + @Override + public List listByRuleId(Long ruleId) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(DeviceConfigBusinessItemDO::getRuleId, ruleId); + return deviceConfigBusinessItemMapper.selectList(query); + } + + @Override + public List getByIdList(List ruleId) { + return deviceConfigBusinessItemMapper.selectByIds(ruleId); + } + @Override public DeviceConfigBusinessItemRespVO createDeviceConfigBusinessItem(DeviceConfigBusinessItemSaveReqVO createReqVO) { // 插入 diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceConfigBusinessRuleService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceConfigBusinessRuleService.java index 7f002fc..4ad437d 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceConfigBusinessRuleService.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceConfigBusinessRuleService.java @@ -2,6 +2,7 @@ package com.zt.plat.module.qms.resource.device.service; import java.util.*; +import com.zt.plat.framework.common.pojo.CommonResult; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessRulePageReqVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessRuleRespVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessRuleSaveReqVO; @@ -16,6 +17,12 @@ import com.zt.plat.framework.common.pojo.PageResult; */ public interface DeviceConfigBusinessRuleService { + DeviceConfigBusinessRuleDO getByProductId(Long productId); + + CommonResult getRuleByDeviceIdAndType(Long deviceId, String type); + + List getByProductIdListAndBusinessDomain(List productIdList, String businessDomain); + /** * 创建设备-业务配置 * diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceConfigBusinessRuleServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceConfigBusinessRuleServiceImpl.java index 1e492a7..36037d7 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceConfigBusinessRuleServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceConfigBusinessRuleServiceImpl.java @@ -1,9 +1,13 @@ package com.zt.plat.module.qms.resource.device.service; import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.zt.plat.framework.common.pojo.CommonResult; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessRulePageReqVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessRuleRespVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessRuleSaveReqVO; +import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfomationDO; +import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceProductDO; import org.springframework.stereotype.Service; import jakarta.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -17,6 +21,7 @@ import com.zt.plat.framework.common.util.object.BeanUtils; import com.zt.plat.module.qms.resource.device.dal.mapper.DeviceConfigBusinessRuleMapper; import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception0; import static com.zt.plat.framework.common.util.collection.CollectionUtils.convertList; import static com.zt.plat.module.qms.enums.ErrorCodeConstants.DEVICE_CONFIG_BUSINESS_RULE_NOT_EXISTS; @@ -29,8 +34,58 @@ import static com.zt.plat.module.qms.enums.ErrorCodeConstants.DEVICE_CONFIG_BUSI @Validated public class DeviceConfigBusinessRuleServiceImpl implements DeviceConfigBusinessRuleService { - @Resource - private DeviceConfigBusinessRuleMapper deviceConfigBusinessRuleMapper; + @Resource private DeviceConfigBusinessRuleMapper deviceConfigBusinessRuleMapper; + @Resource private DeviceInfomationService deviceInfomationService; + @Resource private DeviceProductService deviceProductService; + + @Override + public DeviceConfigBusinessRuleDO getByProductId(Long productId) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(DeviceConfigBusinessRuleDO::getProductId, productId); + List list = deviceConfigBusinessRuleMapper.selectList(queryWrapper); + if(list.size() > 1) + throw exception0(DEVICE_CONFIG_BUSINESS_RULE_NOT_EXISTS.getCode(), "业务配置数据有" + list.size() + "行, 请联系管理员处理!"); + if(list.isEmpty()) + return null; + return list.get(0); + } + + @Override + public CommonResult getRuleByDeviceIdAndType(Long deviceId, String type) { + DeviceInfomationDO deviceDO = deviceInfomationService.getDeviceInfomation(deviceId); + DeviceProductDO productDO = deviceProductService.getDeviceProduct(deviceDO.getProductId()); + String path = productDO.getIdPath(); + String[] split = path.split("/"); + List productIdList = new ArrayList<>(); + for (String s : split) { + String id = s.replaceAll("/", ""); + if(id.equals("0")) + continue; + productIdList.add(s); + } + List ruleList = getByProductIdListAndBusinessDomain(productIdList, type); + if(ruleList.isEmpty()) + return CommonResult.error(DEVICE_CONFIG_BUSINESS_RULE_NOT_EXISTS); + if(ruleList.size() == 1) + return CommonResult.success(ruleList.get(0)); + //取最底层的配置 + for(int i = productIdList.size() - 1; i > 0; i--){ + String id = productIdList.get(i); + for(DeviceConfigBusinessRuleDO rule : ruleList){ + if(Objects.equals(rule.getProductId(), Long.valueOf(id))) + return CommonResult.success(rule); + } + } + return CommonResult.error(DEVICE_CONFIG_BUSINESS_RULE_NOT_EXISTS); + } + + @Override + public List getByProductIdListAndBusinessDomain(List productIdList, String businessDomain) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.in(DeviceConfigBusinessRuleDO::getProductId, productIdList); + query.eq(DeviceConfigBusinessRuleDO::getBusinessDomain, businessDomain); + return deviceConfigBusinessRuleMapper.selectList( query); + } @Override public DeviceConfigBusinessRuleRespVO createDeviceConfigBusinessRule(DeviceConfigBusinessRuleSaveReqVO createReqVO) { diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceInfomationService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceInfomationService.java index 5adbbf7..1175b99 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceInfomationService.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceInfomationService.java @@ -1,5 +1,6 @@ package com.zt.plat.module.qms.resource.device.service; +import com.zt.plat.framework.common.pojo.CommonResult; import com.zt.plat.framework.common.pojo.PageResult; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationPageReqVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationRespVO; @@ -16,6 +17,16 @@ import java.util.List; */ public interface DeviceInfomationService { + CommonResult saveDevice(@Valid DeviceInfomationSaveReqVO reqVO); + + CommonResult checkDeviceUsable(Long id ); + + DeviceInfomationDO getByCode(String code); + + List getListByProductIdList(List productIds); + + List getIdListByProductIdList(List productIds); + /** * 创建设备-设备信息 * 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 eb8da8e..a6bc827 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 @@ -1,21 +1,30 @@ package com.zt.plat.module.qms.resource.device.service; import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.zt.plat.framework.common.pojo.CommonResult; import com.zt.plat.framework.common.pojo.PageResult; import com.zt.plat.framework.common.util.object.BeanUtils; +import com.zt.plat.module.qms.core.constant.DataTypeConstant; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationPageReqVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationRespVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationSaveReqVO; +import com.zt.plat.module.qms.resource.device.controller.vo.DeviceProductRespVO; import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfomationDO; +import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceProductDO; import com.zt.plat.module.qms.resource.device.dal.mapper.DeviceInfomationMapper; import jakarta.annotation.Resource; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.ObjectUtils; import org.springframework.validation.annotation.Validated; import java.util.List; import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception0; import static com.zt.plat.module.qms.enums.ErrorCodeConstants.DEVICE_INFOMATION_NOT_EXISTS; +import static com.zt.plat.module.qms.enums.ErrorCodeConstants.DEVICE_PRODUCT_NOT_EXISTS; /** @@ -27,8 +36,70 @@ import static com.zt.plat.module.qms.enums.ErrorCodeConstants.DEVICE_INFOMATION_ @Validated public class DeviceInfomationServiceImpl implements DeviceInfomationService { - @Resource - private DeviceInfomationMapper deviceInfomationMapper; + @Resource private DeviceInfomationMapper deviceInfomationMapper; + @Resource private DeviceProductService deviceProductService; + + @Override + @Transactional(rollbackFor = Exception.class) + public CommonResult saveDevice(DeviceInfomationSaveReqVO reqVO) { + Long productId = reqVO.getProductId(); + String deviceCode = reqVO.getDeviceCode(); + if(productId == null) + throw exception0(DEVICE_INFOMATION_NOT_EXISTS.getCode(), "请选择所属设备大类!"); + DeviceProductDO productDO = deviceProductService.getDeviceProduct(productId); + if(productDO == null) + throw exception(DEVICE_PRODUCT_NOT_EXISTS); + if(!DataTypeConstant.DATA_TYPE_DATA.equals(productDO.getNodeType())) + throw exception0(DEVICE_INFOMATION_NOT_EXISTS.getCode(), "您选择的是“分类”,请选择“产品”!"); + DeviceInfomationDO checkData = getByCode(deviceCode); + if(reqVO.getId() == null){ + if(checkData != null && !checkData.getId().equals(reqVO.getId())) + throw exception0(DEVICE_INFOMATION_NOT_EXISTS.getCode(), "管理编号已存在,请重新填写!"); + DeviceInfomationRespVO respVO = this.createDeviceInfomation(reqVO); + return CommonResult.success(respVO); + } + if(checkData != null) + throw exception0(DEVICE_INFOMATION_NOT_EXISTS.getCode(), "管理编号已存在,请重新填写!"); + reqVO.setDeviceParameter(productDO.getParameter()); + this.updateDeviceInfomation(reqVO); + return CommonResult.success(BeanUtils.toBean(reqVO, DeviceInfomationRespVO.class)); + } + + @Override + public CommonResult checkDeviceUsable(Long id) { + DeviceInfomationDO deviceDO = this.getDeviceInfomation(id); + if(ObjectUtils.isEmpty(deviceDO)) + return CommonResult.error(DEVICE_INFOMATION_NOT_EXISTS.getCode(), "设备不存在,请刷新后重试!"); + if("1".equals(deviceDO.getDisableFlag())) + return CommonResult.error(DEVICE_INFOMATION_NOT_EXISTS.getCode(), "设备已停用!"); + if("1".equals(deviceDO.getScrapFlag())) + return CommonResult.error(DEVICE_INFOMATION_NOT_EXISTS.getCode(), "设备已报废!"); + if("1".equals(deviceDO.getLendFlag())) + return CommonResult.error(DEVICE_INFOMATION_NOT_EXISTS.getCode(), "设备已外借!"); + if("1".equals(deviceDO.getRepairFlag())) + return CommonResult.error( DEVICE_INFOMATION_NOT_EXISTS.getCode(), "设备在维修中"); + return CommonResult.success( true); + } + + @Override + public DeviceInfomationDO getByCode(String code) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(DeviceInfomationDO::getDeviceCode, code); + return deviceInfomationMapper.selectOne(query); + } + + @Override + public List getListByProductIdList(List productIds) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.in(DeviceInfomationDO::getProductId, productIds); + return deviceInfomationMapper.selectList(query); + } + + @Override + public List getIdListByProductIdList(List productIds) { + List list = getListByProductIdList(productIds); + return list.stream().map(DeviceInfomationDO::getId).toList(); + } @Override public DeviceInfomationRespVO createDeviceInfomation(DeviceInfomationSaveReqVO createReqVO) { diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceMaintainItemService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceMaintainItemService.java index fd97b78..a64f325 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceMaintainItemService.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceMaintainItemService.java @@ -2,9 +2,11 @@ package com.zt.plat.module.qms.resource.device.service; import java.util.*; +import com.zt.plat.framework.common.pojo.CommonResult; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceMaintainItemPageReqVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceMaintainItemRespVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceMaintainItemSaveReqVO; +import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceMaintainDO; import jakarta.validation.*; import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceMaintainItemDO; import com.zt.plat.framework.common.pojo.PageResult; @@ -16,6 +18,11 @@ import com.zt.plat.framework.common.pojo.PageResult; */ public interface DeviceMaintainItemService { + + CommonResult createItems(DeviceMaintainDO maintain, Long ruleId); + + List getListByParId(Long maintainId); + /** * 创建设备-保养分项 * diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceMaintainItemServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceMaintainItemServiceImpl.java index 26bcb5c..51a5b49 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceMaintainItemServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceMaintainItemServiceImpl.java @@ -1,14 +1,20 @@ package com.zt.plat.module.qms.resource.device.service; import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.zt.plat.framework.common.pojo.CommonResult; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceMaintainItemPageReqVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceMaintainItemRespVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceMaintainItemSaveReqVO; +import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceConfigBusinessItemDO; +import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceMaintainDO; import org.springframework.stereotype.Service; import jakarta.annotation.Resource; +import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; import java.util.*; +import java.util.stream.Collectors; import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceMaintainItemDO; import com.zt.plat.framework.common.pojo.PageResult; @@ -18,6 +24,7 @@ import com.zt.plat.module.qms.resource.device.dal.mapper.DeviceMaintainItemMappe 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.DEVICE_CONFIG_BUSINESS_ITEM_NOT_EXISTS; import static com.zt.plat.module.qms.enums.ErrorCodeConstants.DEVICE_MAINTAIN_ITEM_NOT_EXISTS; /** @@ -29,8 +36,51 @@ import static com.zt.plat.module.qms.enums.ErrorCodeConstants.DEVICE_MAINTAIN_IT @Validated public class DeviceMaintainItemServiceImpl implements DeviceMaintainItemService { - @Resource - private DeviceMaintainItemMapper deviceMaintainItemMapper; + @Resource private DeviceMaintainItemMapper deviceMaintainItemMapper; + @Resource private DeviceConfigBusinessItemService deviceConfigBusinessItemService;; + + @Override + @Transactional(rollbackFor = Exception.class) + public CommonResult createItems(DeviceMaintainDO maintain, Long ruleId) { + List itemList = deviceConfigBusinessItemService.listByRuleId(ruleId); //配置的所有明细项 + List itemIdList = itemList.stream().map(DeviceConfigBusinessItemDO::getId).toList(); + if(itemIdList.isEmpty()) + return CommonResult.error(DEVICE_CONFIG_BUSINESS_ITEM_NOT_EXISTS.getCode(), "没有配置检查项,请联系管理员处理!"); + //查询各明细项的最新数据 +// List lastDataList = queryLastestData(itemIdList, maintain.getDeviceId()); + + //循环检查当前维护 + List insertList = new ArrayList<>(); + for(DeviceConfigBusinessItemDO library : itemList){ +// if(!checkItemNeeded(maintain, library, lastDataList)) +// continue; + DeviceMaintainItemDO item = new DeviceMaintainItemDO(); + item.setParentId(maintain.getId()); + item.setFrequencyTimeStart(maintain.getFrequencyTimeStart()); + item.setFrequencyTimeEnd(maintain.getFrequencyTimeEnd()); + item.setCheckItemId(library.getId()); + item.setItemKey(library.getItemKey()); + item.setItemName(library.getItemName()); + item.setFrequencyType(library.getFrequencyType()); + item.setFrequency(library.getFrequency()); + item.setStandard(library.getStandard()); + item.setItemMethod(library.getItemMethod()); + item.setFrequencyRemark(library.getFrequencyRemark()); + item.setSortNo(library.getOrderNo()); + insertList.add(item); + } + if(!insertList.isEmpty()) + deviceMaintainItemMapper.insertBatch(insertList); + return CommonResult.success(""); + } + + @Override + public List getListByParId(Long maintainId) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(DeviceMaintainItemDO::getParentId, maintainId); + query.orderByAsc(DeviceMaintainItemDO::getSortNo); + return deviceMaintainItemMapper.selectList(query); + } @Override public DeviceMaintainItemRespVO createDeviceMaintainItem(DeviceMaintainItemSaveReqVO createReqVO) { diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceMaintainService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceMaintainService.java index 1a402ca..ecf33b8 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceMaintainService.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceMaintainService.java @@ -1,10 +1,14 @@ package com.zt.plat.module.qms.resource.device.service; +import java.text.ParseException; +import java.time.LocalDate; import java.util.*; +import com.zt.plat.framework.common.pojo.CommonResult; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceMaintainPageReqVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceMaintainRespVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceMaintainSaveReqVO; +import com.zt.plat.module.qms.resource.device.controller.vo.DeviceMaintainVO; import jakarta.validation.*; import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceMaintainDO; import com.zt.plat.framework.common.pojo.PageResult; @@ -16,6 +20,17 @@ import com.zt.plat.framework.common.pojo.PageResult; */ public interface DeviceMaintainService { + CommonResult createOrGet(Long deviceId, String date, String dataType); + + CommonResult create(Long deviceId, LocalDate lastDate, String dataType); + + PageResult queryPageListWithCount(DeviceMaintainPageReqVO pageReqVO); + + CommonResult getMaintainDetail(Long id); + + CommonResult getLastData(Long deviceId, String dataType, String date); + + /** * 创建设备-点检、保养记录 * diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceMaintainServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceMaintainServiceImpl.java index 66e56c5..ffd72c4 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceMaintainServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceMaintainServiceImpl.java @@ -1,13 +1,31 @@ package com.zt.plat.module.qms.resource.device.service; import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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.common.DeviceUtil; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceMaintainPageReqVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceMaintainRespVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceMaintainSaveReqVO; +import com.zt.plat.module.qms.resource.device.controller.vo.DeviceMaintainVO; +import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceConfigBusinessRuleDO; +import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceMaintainItemDO; +import org.springframework.beans.factory.annotation.Autowired; 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; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.ZoneId; import java.util.*; import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceMaintainDO; @@ -29,8 +47,119 @@ import static com.zt.plat.module.qms.enums.ErrorCodeConstants.DEVICE_MAINTAIN_NO @Validated public class DeviceMaintainServiceImpl implements DeviceMaintainService { - @Resource - private DeviceMaintainMapper deviceMaintainMapper; + @Resource private DeviceMaintainMapper deviceMaintainMapper; + @Resource private DeviceMaintainItemService deviceMaintainItemService; + @Resource private DeviceProductService deviceProductService; + @Resource private DeviceInfomationService deviceInfomationService; + @Autowired private DeviceConfigBusinessRuleService deviceConfigBusinessRuleService; + + + @Override + @Transactional(rollbackFor = Exception.class) + public CommonResult createOrGet(Long deviceId, String date, String dataType){ + LocalDateTime curDate = LocalDateTime.now(); + if(!ObjectUtils.isEmpty(date)) + curDate = LocalDateTime.parse( date + " 00:00:00"); + String dateStr = curDate.toLocalDate().toString(); + //查询上一个点检记录 + DeviceMaintainDO lastData = getLastData(deviceId, dataType, dateStr).getData(); + if(lastData != null && (lastData.getFrequencyTimeStart() == null || lastData.getFrequencyTimeEnd() == null)) + return getMaintainDetail(lastData.getId()); + if(lastData != null && curDate.compareTo(lastData.getFrequencyTimeStart()) >=0 && curDate.compareTo(lastData.getFrequencyTimeEnd()) <=0 ){ + return getMaintainDetail(lastData.getId()); + } + LocalDate lastDate = null; + if(lastData != null) + lastDate = lastData.getFrequencyTimeEnd().toLocalDate(); + + //比较lastDate与curDate + if(lastDate != null ){ + if(lastDate.isBefore(curDate.toLocalDate())) + lastDate = curDate.toLocalDate(); + } + return create(deviceId, lastDate, dataType); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public CommonResult create(Long deviceId, LocalDate lastDate, String dataType) { + //当前登录人 + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); + //当前登录用户昵称 + String nickName = SecurityFrameworkUtils.getLoginUserNickname(); + //获取配置 + CommonResult ruleRet = deviceConfigBusinessRuleService.getRuleByDeviceIdAndType(deviceId, dataType); + if(!ruleRet.isSuccess()) + return CommonResult.error(ruleRet.getCode(), ruleRet.getMsg()); + DeviceConfigBusinessRuleDO rule = ruleRet.getData(); + //根据周期判断当前日期是否存在数据 + LocalDateTime[] dateRange = null; + if(lastDate != null){ + dateRange = DeviceUtil.getDateRangeByFrequency(lastDate, false, rule.getFrequencyType(), rule.getFrequency()); + } + DeviceMaintainDO data = new DeviceMaintainDO(); + data.setDeviceId(deviceId); + data.setDataType(dataType); + data.setCheckDate(LocalDateTime.now()); + data.setRuleId(rule.getId()); + data.setCheckUserId(loginUser.getId()); + data.setCheckUserName(nickName); + data.setFrequencyType(rule.getFrequencyType()); + data.setFrequency(rule.getFrequency()); + data.setFrequencyRemark(rule.getFrequencyRemark()); + if(dateRange != null){ + data.setFrequencyTimeStart(dateRange[0]); + data.setFrequencyTimeEnd(dateRange[1]); + } + deviceMaintainMapper.insert(data); + + //创建明细项 + deviceMaintainItemService.createItems(data, rule.getId()); + + return getMaintainDetail(data.getId()); + } + + @Override + public CommonResult getMaintainDetail(Long id) { + DeviceMaintainVO vo = deviceMaintainMapper.queryMaintainVoById( id); + if(vo == null) + throw exception(DEVICE_MAINTAIN_NOT_EXISTS); + List itemList = deviceMaintainItemService.getListByParId( id); + vo.setMaintainItemList(itemList); + return CommonResult.success( vo); + } + + @Override + public CommonResult getLastData(Long deviceId, String dataType, String date) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(DeviceMaintainDO::getDeviceId, deviceId); + query.eq(DeviceMaintainDO::getDataType, dataType); + if(!ObjectUtils.isEmpty(date)){ + query.ge(DeviceMaintainDO::getCheckDate, date); + query.le(DeviceMaintainDO::getCheckDate, date + " 23:59:59"); + } + query.orderByDesc(DeviceMaintainDO::getCheckDate); + query.last("limit 1"); + DeviceMaintainDO maintainDO = deviceMaintainMapper.selectOne(query); + return CommonResult.success(maintainDO); + } + + @Override + public PageResult queryPageListWithCount(DeviceMaintainPageReqVO reqVO) { + 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 = deviceMaintainMapper.queryPageListWithCount(page, reqVO); + return new PageResult<>(pageList.getRecords(), pageList.getTotal()); + } @Override public DeviceMaintainRespVO createDeviceMaintain(DeviceMaintainSaveReqVO createReqVO) { diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceProductService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceProductService.java index 6f716b5..3ecffd2 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceProductService.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceProductService.java @@ -26,6 +26,7 @@ public interface DeviceProductService { /*获取分类树数据*/ List getTreeData(String nodeType); + List getIdListByIdPath(Long id); List listByIdPath(Long id, String nodeType); List listByParId(Long parId, String nodeType); diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceProductServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceProductServiceImpl.java index 01d5dbe..cbb6a77 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceProductServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/resource/device/service/DeviceProductServiceImpl.java @@ -98,6 +98,13 @@ public class DeviceProductServiceImpl implements DeviceProductService { return CommonResult.success( vo); } + @Override + public List getIdListByIdPath(Long id) { + List productDOList = this.listByIdPath(id, DataTypeConstant.DATA_TYPE_DATA); + List productIds = productDOList.stream().map(DeviceProductDO::getId).toList(); + return productIds; + } + @Override public List listByIdPath(Long id, String nodeType) { LambdaQueryWrapper query = new LambdaQueryWrapper<>(); diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceAffiliationRelativityMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceAffiliationRelativityMapper.xml similarity index 100% rename from zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceAffiliationRelativityMapper.xml rename to zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceAffiliationRelativityMapper.xml diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceApplyDetailMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceApplyDetailMapper.xml similarity index 100% rename from zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceApplyDetailMapper.xml rename to zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceApplyDetailMapper.xml diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceApplyMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceApplyMapper.xml similarity index 100% rename from zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceApplyMapper.xml rename to zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceApplyMapper.xml diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceCalibrationMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceCalibrationMapper.xml similarity index 100% rename from zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceCalibrationMapper.xml rename to zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceCalibrationMapper.xml diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceCalibrationPlanMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceCalibrationPlanMapper.xml similarity index 100% rename from zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceCalibrationPlanMapper.xml rename to zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceCalibrationPlanMapper.xml diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceConfigBusinessItemMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceConfigBusinessItemMapper.xml similarity index 100% rename from zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceConfigBusinessItemMapper.xml rename to zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceConfigBusinessItemMapper.xml diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceConfigBusinessRuleMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceConfigBusinessRuleMapper.xml similarity index 100% rename from zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceConfigBusinessRuleMapper.xml rename to zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceConfigBusinessRuleMapper.xml diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/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 similarity index 100% rename from zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceInfomationMapper.xml rename to zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceInfomationMapper.xml diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceMaintainItemMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceMaintainItemMapper.xml similarity index 100% rename from zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceMaintainItemMapper.xml rename to zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceMaintainItemMapper.xml diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceMaintainMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceMaintainMapper.xml new file mode 100644 index 0000000..bb467f2 --- /dev/null +++ b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceMaintainMapper.xml @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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/data/dal/mapper/DevicePeriodCheckMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DevicePeriodCheckMapper.xml similarity index 100% rename from zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DevicePeriodCheckMapper.xml rename to zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DevicePeriodCheckMapper.xml diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DevicePeriodCheckPlanMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DevicePeriodCheckPlanMapper.xml similarity index 100% rename from zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DevicePeriodCheckPlanMapper.xml rename to zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DevicePeriodCheckPlanMapper.xml diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceProductMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceProductMapper.xml similarity index 100% rename from zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceProductMapper.xml rename to zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceProductMapper.xml diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceRepairApplyMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceRepairApplyMapper.xml similarity index 100% rename from zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceRepairApplyMapper.xml rename to zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceRepairApplyMapper.xml diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceRepairAtMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceRepairAtMapper.xml similarity index 100% rename from zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceRepairAtMapper.xml rename to zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceRepairAtMapper.xml diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceRepairDetailMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceRepairDetailMapper.xml similarity index 100% rename from zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceRepairDetailMapper.xml rename to zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceRepairDetailMapper.xml diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceRepairResultDetailMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceRepairResultDetailMapper.xml similarity index 100% rename from zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceRepairResultDetailMapper.xml rename to zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceRepairResultDetailMapper.xml diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceUseRecordMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceUseRecordMapper.xml similarity index 100% rename from zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceUseRecordMapper.xml rename to zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/dal/mapper/DeviceUseRecordMapper.xml diff --git a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceMaintainMapper.xml b/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceMaintainMapper.xml deleted file mode 100644 index ef64805..0000000 --- a/zt-module-qms/zt-module-qms-server/src/main/resources/com/zt/plat/module/qms/resource/device/data/dal/mapper/DeviceMaintainMapper.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - \ No newline at end of file