From 75f5c2b592cb4d94a92f26e5cfc46c7a73c09b82 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Mon, 25 Jul 2022 15:24:06 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=89=A7=E6=9C=AC=E5=8F=8D=E5=BA=8F?= =?UTF-8?q?=E5=88=97=E5=8C=96BUG=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cbtc/CTC/data/CtcStationRunPlanLog.java | 13 +++++++++---- .../storage/plan/StorageCtcRunPlanLog.java | 18 +++++++++++------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcStationRunPlanLog.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcStationRunPlanLog.java index 949ed2c9b..3d326d336 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcStationRunPlanLog.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcStationRunPlanLog.java @@ -205,10 +205,15 @@ public class CtcStationRunPlanLog { this.transfinite = paramInfo.getTransfinite(); } this.runPlanTaskItemMap = new HashMap<>(RunPlanTask.values().length); // 运行计划任务 - RunPlanTask.getOptionKeyList().forEach(key -> this.runPlanTaskItemMap.put(key, new RunPlanTaskItem(RunPlanTask.NO))); + RunPlanTask.getOptionKeyList().stream().filter(k -> !RunPlanTask.NO.equals(k)) + .forEach(key -> this.runPlanTaskItemMap.put(key, new RunPlanTaskItem(RunPlanTask.NO))); paramInfo.getRunPlanTaskMap().forEach((k, v) -> { - if (v != null && v > 0) { - this.runPlanTaskItemMap.get(k.getOptionKey()).setType(k); + if (v != null && v > 0 && !RunPlanTask.NO.equals(k)) { + if (this.runPlanTaskItemMap.containsKey(k.getOptionKey())) { + this.runPlanTaskItemMap.get(k.getOptionKey()).setType(k); + } else { + this.runPlanTaskItemMap.put(k.getOptionKey(), new RunPlanTaskItem(k)); + } } }); // 删除状态 @@ -648,7 +653,7 @@ public class CtcStationRunPlanLog { if (paramInfo.arriveAndDepartElectrical()) { // 存在指定电力设置,则获取指定 Boolean electrical = arrive ? paramInfo.getArriveElectrical() : paramInfo.getDepartElectrical(); runPlanItem.setElectrical(electrical); - } else { + } else if (paramInfo.getElectrical() != null) { runPlanItem.setElectrical(paramInfo.getElectrical()); } // 超限等级 diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/plan/StorageCtcRunPlanLog.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/plan/StorageCtcRunPlanLog.java index 8702bebc6..2ab0d2246 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/plan/StorageCtcRunPlanLog.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/plan/StorageCtcRunPlanLog.java @@ -4,8 +4,7 @@ import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam; import club.joylink.rtss.simulation.cbtc.CTC.data.CtcRepository; import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLog; import club.joylink.rtss.simulation.cbtc.Simulation; -import lombok.Getter; -import lombok.Setter; +import lombok.*; import java.time.LocalDateTime; import java.util.Map; @@ -98,8 +97,12 @@ public class StorageCtcRunPlanLog { if (sign != null) { ctcStationRunPlanLog.setSign(sign); } - this.departItemOtherInfo.convertToObj(ctcStationRunPlanLog.getDepartRunPlan()); - this.arriveItemOtherInfo.convertToObj(ctcStationRunPlanLog.getArriveRunPlan()); + if (this.departItemOtherInfo != null) { + this.departItemOtherInfo.convertToObj(ctcStationRunPlanLog.getDepartRunPlan()); + } + if (this.arriveItemOtherInfo != null) { + this.arriveItemOtherInfo.convertToObj(ctcStationRunPlanLog.getArriveRunPlan()); + } } private void setDepartAndArrive(CtcRunPlanParam ctcRunPlanParam, CtcStationRunPlanLog.RunPlanItem runPlanItem, boolean arrive) { @@ -166,9 +169,10 @@ public class StorageCtcRunPlanLog { } - @Getter - @Setter - private class ItemOtherInfo { + @Data + @AllArgsConstructor + @NoArgsConstructor + public static class ItemOtherInfo { /** * 实际时间 */