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 449da4b80..914f843e7 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 @@ -203,13 +203,13 @@ public class CtcStationRunPlanLogService { } /** - * 将变更运行计划刷新至行车日志 + * 将变更运行计划刷新至行车日志,这里需要加锁避免重复处理 * * @param simulation 仿真 * @param stationCode 车站编码 * @param ctcRunPlanVOList 变更的运行计划列表 */ - public void doUpdateRunPlanLog(Simulation simulation, String stationCode, List ctcRunPlanVOList) { + public synchronized void doUpdateRunPlanLog(Simulation simulation, String stationCode, List ctcRunPlanVOList) { if (CollectionUtils.isEmpty(ctcRunPlanVOList)) { return; } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcZoneService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcZoneService.java index 21134ca8a..7c65ba9d9 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcZoneService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcZoneService.java @@ -168,15 +168,18 @@ public class CtcZoneService { .findFirst().orElse(null); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(ctcZone); CtcEffectRepository effectRepository = simulation.getCtcRepository().getCtcEffectRepository(); - Set stationCodeSet = new HashSet<>(); - ctcZone.getStationList().forEach(station -> { - stationCodeSet.add(station.getCode()); - CtcManageRepository.StationRunPlanRepository runPlanRepository = zoneRepository.getStationRunPlanMap().get(station.getCode()); - if (runPlanRepository != null) { - effectRepository.releaseRunPlanByStationCode(runPlanRepository, simulation.getCorrectSystemTime()); - } - }); - updateStageRunPlan(simulation, stationCodeSet); + if (ctcZone.getStationList() != null) { + Set stationCodeSet = new HashSet<>(); + ctcZone.getStationList().forEach(station -> { + stationCodeSet.add(station.getCode()); + CtcManageRepository.StationRunPlanRepository runPlanRepository + = zoneRepository.getStationRunPlanMap().get(station.getCode()); + if (runPlanRepository != null) { + effectRepository.releaseRunPlanByStationCode(runPlanRepository, simulation.getCorrectSystemTime()); + } + }); + updateStageRunPlan(simulation, stationCodeSet); + } } /**