| | |
| | | } |
| | | } |
| | | validateInspectionInput(inspectionTaskDto, oldInspectionTask); |
| | | validateDeviceExists(inspectionTaskDto, oldInspectionTask); |
| | | |
| | | InspectionTask inspectionTask = new InspectionTask(); |
| | | BeanUtils.copyProperties(inspectionTaskDto, inspectionTask); |
| | |
| | | return i; |
| | | } |
| | | |
| | | private void validateDeviceExists(InspectionTaskDto inspectionTaskDto, InspectionTask oldInspectionTask) { |
| | | Integer taskId = inspectionTaskDto.getTaskId(); |
| | | if (taskId == null && oldInspectionTask != null) { |
| | | taskId = oldInspectionTask.getTaskId(); |
| | | } |
| | | if (taskId == null || taskId <= 0) { |
| | | return; |
| | | } |
| | | DeviceLedger deviceLedger = deviceLedgerMapper.selectById(taskId.longValue()); |
| | | if (deviceLedger == null) { |
| | | throw new IllegalArgumentException("所选设备不存在,请重新选择"); |
| | | } |
| | | } |
| | | |
| | | private void validateInspectionInput(InspectionTaskDto inspectionTaskDto, InspectionTask oldInspectionTask) { |
| | | String inspectionResult = inspectionTaskDto.getInspectionResult(); |
| | | if (StringUtils.isBlank(inspectionResult) && oldInspectionTask != null) { |