From 21f02c218b67cac52348b60926f7640e1153c631 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Tue, 19 Jul 2022 17:12:12 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E8=A1=8C=E8=BD=A6=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E5=8F=98=E5=8C=96=E5=90=8E=EF=BC=8C=E5=9B=9E=E8=B0=83=E5=8D=A0?= =?UTF-8?q?=E7=BA=BF=E6=9D=BF=E6=96=B9=E6=B3=95=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../runplan/CtcStationRunPlanLogService.java | 57 +++++-------------- 1 file changed, 13 insertions(+), 44 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 85e16b2ad..16dbb4cb5 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 @@ -19,8 +19,10 @@ import org.springframework.util.StringUtils; import java.time.LocalDateTime; import java.time.LocalTime; -import java.util.*; -import java.util.function.BiConsumer; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Objects; import java.util.stream.Collectors; @Component @@ -69,8 +71,12 @@ public class CtcStationRunPlanLogService { createList.add(runPlanLog); } }); - changeList.forEach(r -> runPlanCallBack.get(CtcStationRunPlanLog.ChangeType.STATUS_MODIFY_CHANGE).accept(simulation, r)); - createList.forEach(r -> runPlanCallBack.get(CtcStationRunPlanLog.ChangeType.STATUS_ADD_CHANGE).accept(simulation, r)); + if (!CollectionUtils.isEmpty(changeList) || !CollectionUtils.isEmpty(createList)) { + changeList.forEach(r -> r.clearChange()); + createList.forEach(r -> r.clearChange()); + Station station = simulation.getRepository().getByCode(stationCode, Station.class); + ctcService.regenerateRouteSequenceAndTrackView(simulation, station); + } } /** @@ -352,15 +358,9 @@ public class CtcStationRunPlanLogService { public void doSendOutRunPlan(Simulation simulation, String stationCode) { Map ctcRunPlanMap = simulation.getCtcRepository().getSimulationRunPlanMap().get(stationCode); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(ctcRunPlanMap); - ctcRunPlanMap.values().stream() - .filter(r -> r.getChangeType() != null && (r.getArriveRunPlan() != null || r.getDepartRunPlan() != null)) - .forEach(r -> { - BiConsumer callBack = runPlanCallBack.get(r.getChangeType()); - if (callBack != null) { - callBack.accept(simulation, r); - } - r.clearChange(); // 签收完,清除变化类型 - }); + ctcRunPlanMap.values().stream().filter(r -> r.getChangeType() != null).forEach(r -> r.clearChange()); // 签收完,清除变化类型 + Station station = simulation.getRepository().getByCode(stationCode, Station.class); + ctcService.regenerateRouteSequenceAndTrackView(simulation, station); } /** @@ -769,35 +769,4 @@ public class CtcStationRunPlanLogService { } return change; } - - /** - * 行车日志变化后,占线板回调方法 - */ - private final Map> runPlanCallBack = new HashMap<>() { - { - put(CtcStationRunPlanLog.ChangeType.STATUS_MODIFY_CHANGE, (simulation, r) -> { // 修改股道后 - if (r.getArriveRunPlan() != null && r.getArriveRunPlan().getTrackSection() != null) { - ctcService.runPlanItemUpdate(simulation, r.getStation(), r.getArriveRunPlan(), false); - } - if (r.getDepartRunPlan() != null && r.getDepartRunPlan().getTrackSection() != null) { - ctcService.runPlanItemUpdate(simulation, r.getStation(), r.getDepartRunPlan(), true); - } - - }); - - put(CtcStationRunPlanLog.ChangeType.STATUS_ADD_CHANGE, (simulation, r) -> { // 创建 - if (r.getArriveRunPlan() != null && r.getArriveRunPlan().getTrackSection() != null) { - ctcService.runPlanItemCreate(simulation, r.getStation(), r.getArriveRunPlan(), false); - } - if (r.getDepartRunPlan() != null && r.getDepartRunPlan().getTrackSection() != null) { - ctcService.runPlanItemCreate(simulation, r.getStation(), r.getDepartRunPlan(), true); - } - r.clearChange(); // 签收完,清除变化类型 - }); - - put(CtcStationRunPlanLog.ChangeType.STATUS_DELETE_CHANGE, (simulation, r) -> { // 删除操作 - - }); - } - }; }