| | |
| | | if (snapshot == null) { |
| | | throw new ErrorException("未找到当前模板的原始记录快照"); |
| | | } |
| | | boolean hasSnapshotField = dto.isTemperaturePresent() || dto.isDetectionTimePresent() |
| | | boolean hasDetectionRange = dto.isDetectionTimePresent() || dto.isDetectionEndTimePresent(); |
| | | if (hasDetectionRange) { |
| | | if (!dto.isDetectionTimePresent()) { |
| | | throw new ErrorException("请选择完整的检测时间范围"); |
| | | } |
| | | // 兼容旧客户端只提交单个日期;新客户端必须同时提交起止日期或同时清空。 |
| | | if (!dto.isDetectionEndTimePresent()) { |
| | | dto.setDetectionEndTime(dto.getDetectionTime()); |
| | | } |
| | | if ((dto.getDetectionTime() == null) != (dto.getDetectionEndTime() == null)) { |
| | | throw new ErrorException("请选择完整的检测时间范围"); |
| | | } |
| | | if (dto.getDetectionTime() != null |
| | | && dto.getDetectionEndTime().isBefore(dto.getDetectionTime())) { |
| | | throw new ErrorException("检测结束日期不能早于开始日期"); |
| | | } |
| | | } |
| | | boolean hasSnapshotField = dto.isTemperaturePresent() || hasDetectionRange |
| | | || dto.isDetectionPlacePresent() |
| | | || dto.isInsResultPresent(); |
| | | if (hasSnapshotField) { |
| | |
| | | InsOrderStandardTemplate::getTemperature, dto.getTemperature()) |
| | | .set(dto.isDetectionTimePresent(), |
| | | InsOrderStandardTemplate::getDetectionTime, dto.getDetectionTime()) |
| | | .set(hasDetectionRange, |
| | | InsOrderStandardTemplate::getDetectionEndTime, dto.getDetectionEndTime()) |
| | | .set(dto.isDetectionPlacePresent(), |
| | | InsOrderStandardTemplate::getDetectionPlace, dto.getDetectionPlace()) |
| | | .set(dto.isInsResultPresent(), |