liding
6 天以前 3728fa293e1faf4bf4f9bf41105b84ddb43dc82e
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductServiceImpl.java
@@ -77,7 +77,24 @@
            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) {
@@ -88,6 +105,8 @@
                                        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(),