From a2acf47a43773d5586ed50636794fc145cc4334e Mon Sep 17 00:00:00 2001 From: buaixuexideshitongxue <2936013465@qq.com> Date: Fri, 17 Apr 2026 14:57:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=AE=B0=E5=BD=95=E9=A2=84=E8=AD=A6?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/Negative/NegativeService.java | 8 ++++++++ .../service/Report/ReportFlowService.java | 17 +++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/main/java/com/biutag/supervision/service/Negative/NegativeService.java b/src/main/java/com/biutag/supervision/service/Negative/NegativeService.java index c062d77..c231c51 100644 --- a/src/main/java/com/biutag/supervision/service/Negative/NegativeService.java +++ b/src/main/java/com/biutag/supervision/service/Negative/NegativeService.java @@ -111,6 +111,14 @@ public class NegativeService extends ServiceImpl { negativeDto.setMaxExtensionDuration(dataDistribute.getMaxExtensionDuration()); negativeDto.setCaseNumber(vo.getRecord().getId()); + // 如果 supervisionTime 为空,补充当前时间(预警时间) + WarningRecord record = vo.getRecord(); + if (record.getSupervisionTime() == null) { + warningRecordService.update(new LambdaUpdateWrapper() + .set(WarningRecord::getSupervisionTime, LocalDateTime.now()) + .eq(WarningRecord::getId, record.getId())); + } + //已预警 warningRecordService.update(new LambdaUpdateWrapper().set( WarningRecord::getFlowState,DistributionStateEnum.DISTRIBUTED.getValue() diff --git a/src/main/java/com/biutag/supervision/service/Report/ReportFlowService.java b/src/main/java/com/biutag/supervision/service/Report/ReportFlowService.java index 5498c45..10b38ef 100644 --- a/src/main/java/com/biutag/supervision/service/Report/ReportFlowService.java +++ b/src/main/java/com/biutag/supervision/service/Report/ReportFlowService.java @@ -521,6 +521,23 @@ public class ReportFlowService extends ServiceImpl // endFlow.setType("end"); boolean ok2 = baseMapper.insert(endFlow) > 0; + + // 确保 warning_record 存在且有 supervisionTime(预警时间) + WarningRecord warningRecord = warningRecordMapper.selectOne( + new LambdaQueryWrapper() + .eq(WarningRecord::getReportId, queryParam.getReportId()) + ); + if (warningRecord == null) { + warningRecord = new WarningRecord(); + warningRecord.setReportId(queryParam.getReportId()); + warningRecord.setSupervisionTime(LocalDateTime.now()); + warningRecord.setCreateTime(LocalDateTime.now()); + warningRecordMapper.insert(warningRecord); + } else if (warningRecord.getSupervisionTime() == null) { + warningRecord.setSupervisionTime(LocalDateTime.now()); + warningRecordMapper.updateById(warningRecord); + } + return Result.success(ok1 && ok2); } }