From 6c1c90bc81b2dd0d02e7860403b65683a8276086 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Wed, 6 Jul 2022 18:02:29 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E7=BA=A2=E9=97=AA?= =?UTF-8?q?=E9=99=90=E5=88=B6=E6=9D=A1=E4=BB=B6=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../runplan/CtcStationRunPlanLogService.java | 4 +++- .../cbtc/CTC/data/CtcEffectRepository.java | 22 +++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcStationRunPlanLogService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcStationRunPlanLogService.java index a79eccc72..73a497c76 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcStationRunPlanLogService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcStationRunPlanLogService.java @@ -239,7 +239,7 @@ public class CtcStationRunPlanLogService { CtcStationRunPlanLog ctcStationRunPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode); if (!Objects.equals(ctcStationRunPlanLog.getDelete(), Boolean.TRUE)) { ctcStationRunPlanLog.setDelete(Boolean.TRUE); - ctcStationRunPlanLog.setChange(CtcStationRunPlanLog.ChangeType.STATUS_DELETE_CHANGE); + // ctcStationRunPlanLog.setChange(CtcStationRunPlanLog.ChangeType.STATUS_DELETE_CHANGE); } } @@ -379,6 +379,8 @@ public class CtcStationRunPlanLogService { * @param runPlanCode 运行计划编码 */ public void cancelTwinkle(Simulation simulation, String stationCode, String runPlanCode) { + boolean isExist = simulation.getCtcRepository().getCtcEffectRepository().isExistStageRunPlan(stationCode, null); + BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(isExist, "存在未签收的阶段计划"); CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode); runPlanLog.setTwinkle(false); } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcEffectRepository.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcEffectRepository.java index da5261b19..f61f7575c 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcEffectRepository.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcEffectRepository.java @@ -151,13 +151,27 @@ public class CtcEffectRepository { return null; } return this.stationStageRunPlanMap.values().stream() - .filter(r -> { - Integer oldVersion = this.getStageRunPlanVersionMap().get(r.getStationCode()); - return !CollectionUtils.isEmpty(r.getCtcRunPlanVOList()) && (oldVersion == null || oldVersion < r.getVersion().get()); - }) + .filter(r -> isExistStageRunPlan(r.getStationCode(), r)) .map(CtcStageRunPlanRepository::generateStatus).collect(Collectors.toList()); } + /** + * 是否存在阶段计划 + * + * @param stationCode 车站编码 + * @param r 阶段计划 + * @return 是否存在 + */ + public boolean isExistStageRunPlan(String stationCode, CtcStageRunPlanRepository r) { + CtcStageRunPlanRepository repository = r == null ? this.stationStageRunPlanMap.get(stationCode) : r; + if (repository != null) { + Integer oldVersion = this.getStageRunPlanVersionMap().get(repository.getStationCode()); + return !CollectionUtils.isEmpty(repository.getCtcRunPlanVOList()) + && (oldVersion == null || oldVersion < repository.getVersion().get()); + } + return false; + } + /** * 将修改的计划发布至申请区 *