diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/CtcStationRunPlanOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/CtcStationRunPlanOperateHandler.java index 4a97f76fc..9872f4da5 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/CtcStationRunPlanOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/CtcStationRunPlanOperateHandler.java @@ -216,12 +216,12 @@ public class CtcStationRunPlanOperateHandler { * @param simulation 仿真 * @param stationCode 车站编码 * @param runPlanCode 运行计划编码 - * @param task 任务 + * @param taskKey 任务Key * @param status 是否设置 1 是 , 0 否 */ @OperateHandlerMapping(type = Operation.Type.CTC_LOG_SET_TASK) - public void setTask(Simulation simulation, String stationCode, String runPlanCode, CtcStationRunPlanLog.RunPlanTask task, int status) { - ctcStationRunPlanLogService.setTask(simulation, stationCode, runPlanCode, task, status); + public void setTask(Simulation simulation, String stationCode, String runPlanCode, String taskKey, int status) { + ctcStationRunPlanLogService.setTask(simulation, stationCode, runPlanCode, taskKey, status); } /** @@ -316,7 +316,7 @@ public class CtcStationRunPlanOperateHandler { , LocalTime arriveTime, LocalTime departTime) { ctcStationRunPlanLogService.artificialReportRunPlanActualTime(simulation, stationCode, runPlanCode, arriveTime, departTime); } - + /** * 向调度中心申请股道 * diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/vo/CtcRunPlanParam.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/vo/CtcRunPlanParam.java index 02e5993ef..8bb733626 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/vo/CtcRunPlanParam.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/vo/CtcRunPlanParam.java @@ -131,6 +131,11 @@ public class CtcRunPlanParam implements Cloneable { */ private Boolean departElectrical; + /** + * 超限等级 + */ + private CtcStationRunPlanLog.TransfiniteType transfinite; + /** * 到达超限 */ @@ -166,11 +171,6 @@ public class CtcRunPlanParam implements Cloneable { */ private Boolean entryOutDiscordant; - /** - * 超限等级 - */ - private CtcStationRunPlanLog.TransfiniteType transfinite; - /** * 记事 */ @@ -656,6 +656,15 @@ public class CtcRunPlanParam implements Cloneable { return this.arriveElectrical != null || this.departElectrical != null; } + /** + * 是否指定到达、出发超限等级 + * + * @return 是否存在 + */ + public boolean arriveAndDepartTransfinite() { + return this.arriveTransfinite != null || this.departTransfinite != null; + } + @Override public CtcRunPlanParam clone() { try { 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 748877eef..2e939202d 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 @@ -459,9 +459,11 @@ public class CtcStationRunPlanLogService { * @param simulation 仿真 * @param stationCode 车站编码 * @param runPlanCode 运行计划编码 - * @param task 任务 + * @param taskKey 任务Key */ - public void setTask(Simulation simulation, String stationCode, String runPlanCode, CtcStationRunPlanLog.RunPlanTask task, int status) { + public void setTask(Simulation simulation, String stationCode, String runPlanCode, String taskKey, int status) { + CtcStationRunPlanLog.RunPlanTask task = CtcStationRunPlanLog.RunPlanTask.getTaskByKey(taskKey); + BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(task); CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode); if (status == 1) { // 设置 runPlanLog.getRunPlanTaskItemMap().put(task.getOptionKey(), new CtcStationRunPlanLog.RunPlanTaskItem(task)); @@ -710,7 +712,19 @@ public class CtcStationRunPlanLogService { Boolean electrical = arrive ? paramInfo.getArriveElectrical() : paramInfo.getDepartElectrical(); runPlanItem.setElectrical(electrical); } else { - runPlanItem.setElectrical(paramInfo.getElectrical()); + // 设置默认电力 + if (paramInfo.getElectrical() != null && !Objects.equals(runPlanItem.isElectrical(), paramInfo.getElectrical())) { + runPlanItem.setElectrical(paramInfo.getElectrical()); + } + } + // 超限设置 + if (paramInfo.arriveAndDepartTransfinite()) { + CtcStationRunPlanLog.TransfiniteType transfinite = arrive ? paramInfo.getArriveTransfinite() : paramInfo.getDepartTransfinite(); + runPlanItem.setTransfinite(transfinite); + } else { + if (!Objects.equals(runPlanItem.getTransfinite(), paramInfo.getTransfinite())) { + runPlanItem.setTransfinite(paramInfo.getTransfinite()); + } } } return change; 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 38c07d1fa..1d240814e 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 @@ -436,6 +436,10 @@ public class CtcStationRunPlanLog { */ private boolean finish; + /** + * 超限等级 + */ + private TransfiniteType transfinite; public RunPlanItem(CtcRunPlanParam paramInfo) { this.paramInfo = paramInfo; @@ -447,6 +451,7 @@ public class CtcStationRunPlanLog { this.adjacentMessageTime = ""; this.setOutTypeMap = new HashMap<>(SetOutType.values().length); this.processTypeMap = new HashMap<>(ProcessType.values().length); + this.transfinite = TransfiniteType.NO; } public void initAccessName() { @@ -555,6 +560,13 @@ public class CtcStationRunPlanLog { } else { runPlanItem.setElectrical(paramInfo.getElectrical()); } + // 超限等级 + if (paramInfo.arriveAndDepartTransfinite()) { + TransfiniteType transfinite = arrive ? paramInfo.getArriveTransfinite() : paramInfo.getDepartTransfinite(); + runPlanItem.setTransfinite(transfinite); + } else { + runPlanItem.setTransfinite(paramInfo.getTransfinite()); + } } return runPlanItem; } @@ -613,7 +625,7 @@ public class CtcStationRunPlanLog { * @param key 唯一键 * @return 运行任务 */ - public RunPlanTask getTaskByKey(String key) { + public static RunPlanTask getTaskByKey(String key) { return Arrays.stream(RunPlanTask.values()).filter(r -> r.getOptionKey().equals(key)) .findFirst().orElseGet(null); } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcStationRunPlanLogVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcStationRunPlanLogVO.java index 70a3ee41a..259deed66 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcStationRunPlanLogVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcStationRunPlanLogVO.java @@ -408,6 +408,12 @@ public class CtcStationRunPlanLogVO { changeRunItem.setElectrical(runPlanItem.isElectrical()); change = true; } + // 超限 + if (runPlanItem.getTransfinite() != null && !Objects.equals(paramInfo.getTransfinite(), runPlanItem.getTransfinite().getVal())) { + paramInfo.setTransfinite(runPlanItem.getTransfinite().getVal()); + changeRunItem.setTransfinite(runPlanItem.getTransfinite().getVal()); + change = true; + } return change ? changeRunItem : null; // 没有变化返回null } @@ -474,6 +480,11 @@ public class CtcStationRunPlanLogVO { */ private Boolean electrical; + /** + * 超限等级 + */ + private String transfinite; + public RunPlanItem() { } @@ -495,6 +506,7 @@ public class CtcStationRunPlanLogVO { this.adjacentMessageTime = runPlanItem.getAdjacentMessageTime(); this.finish = runPlanItem.isFinish(); this.electrical = runPlanItem.isElectrical(); + this.transfinite = runPlanItem.getTransfinite().getVal(); } } }