From 267003cd1a5ae9e15211a834091b294f2b286d60 Mon Sep 17 00:00:00 2001 From: Jade Date: Thu, 4 Nov 2021 17:31:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E8=BF=91=E9=94=81=E9=97=AD=E8=BF=9B?= =?UTF-8?q?=E8=B7=AF=E9=85=8D=E7=BD=AE=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rtss/exception/ExceptionAssert.java | 8 +++++++ .../handler/SignalOperateHandler.java | 21 +++++++++++++++---- .../rtss/simulation/cbtc/CI/CiApiService.java | 2 +- .../simulation/cbtc/CI/CiApiServiceImpl2.java | 6 +----- .../simulation/cbtc/data/map/MapConfig.java | 19 +++++++++++++++-- .../joylink/rtss/vo/map/RealLineConfigVO.java | 3 ++- 6 files changed, 46 insertions(+), 13 deletions(-) diff --git a/src/main/java/club/joylink/rtss/exception/ExceptionAssert.java b/src/main/java/club/joylink/rtss/exception/ExceptionAssert.java index 4d0112adc..01ae5712b 100644 --- a/src/main/java/club/joylink/rtss/exception/ExceptionAssert.java +++ b/src/main/java/club/joylink/rtss/exception/ExceptionAssert.java @@ -17,6 +17,14 @@ public interface ExceptionAssert { BaseException exception(String message, Throwable t); + default void fail() { + throw exception(); + } + + default void fail(String message) { + throw exception(message); + } + default void assertNotNull(Object object) { if (object == null) { throw exception(); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/SignalOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/SignalOperateHandler.java index 459aea039..2edfa1315 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/SignalOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/SignalOperateHandler.java @@ -51,12 +51,25 @@ public class SignalOperateHandler { public void cancelRoute(Simulation simulation, String signalCode) { //是否接近区段占用仍执行取消进路 Route route = this.ciApiService.findLockedRouteByStartSignal(simulation, signalCode); - if (route != null && route.isApproachLock() && - simulation.getRepository().getConfig().isSignalForceCancelRoute()) { - this.ciApiService.humanCancel(simulation, route.getCode()); + if (route == null) { return; } - this.atsRouteService.cancelRoute(simulation, signalCode); + if (route.isApproachLock()) { + switch (simulation.getRepository().getConfig().getSingleApproachLockCancelRoute()) { + case DELAY: + this.ciApiService.humanCancel(simulation, route.getCode()); + break; + case DIRECT: + this.ciApiService.forceUnlockRoute(simulation, route.getCode()); + break; + case NOT: + default: + BusinessExceptionAssertEnum.OPERATION_FAIL.fail("无法取消接近锁闭进路"); + break; + } + } else { + this.atsRouteService.cancelRoute(simulation, signalCode); + } } @OperateHandlerMapping(type = Operation.Type.Signal_Set_Overlap) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiService.java index a8092e2f4..f412be508 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiService.java @@ -140,7 +140,7 @@ public interface CiApiService { void unlockRoute(Simulation simulation, String routeCode); /** - * 解锁进路/取消进路(强制取消进路,无论接近区段是否占用,如果占用延时取消) + * 解锁进路/取消进路(强制取消进路,无论接近区段是否占用) * @param simulation * @param routeCode */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl2.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl2.java index ffbf926e0..640225691 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl2.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl2.java @@ -199,11 +199,7 @@ public class CiApiServiceImpl2 implements CiApiService { Route route = simulation.getRepository().getByCode(routeCode, Route.class); BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(route.isFleetMode(), String.format("进路[%s]已开启自动通过进路,无法取消", route.debugStr())); - if (route.isApproachLock()) { - this.routeService.delayUnlockStart(simulation, route, route.getStart()); - } else { - this.routeService.unlockRoute(simulation, route); - } + this.routeService.unlockRoute(simulation, route); } @Override diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapConfig.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapConfig.java index 63aaf408d..2fa1e63df 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapConfig.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapConfig.java @@ -100,7 +100,7 @@ public class MapConfig { /** * 取消进路命令能否取消引导或接近锁闭的进路 */ - private boolean signalForceCancelRoute; + private ApproachLockCancel singleApproachLockCancelRoute; /** @@ -239,7 +239,7 @@ public class MapConfig { setSwitchNRTurnChain(configVO.getSwitchNRTurnChain()); setSwitchSingleLockChain(configVO.getSwitchSingleLockChain()); setSwitchLossChain(configVO.getSwitchLossChain()); - setSignalForceCancelRoute(configVO.getSignalForceCancelRoute()); + setSingleApproachLockCancelRoute(configVO.getSingleApproachLockCancelRoute()); setRunMode(RunLevel.valueOf(configVO.getRunMode())); setInitSingleLockSwitch(configVO.isInitSingleLockSwitch()); setNoParkingSM(configVO.getNoParkingSM()); @@ -324,4 +324,19 @@ public class MapConfig { } return false; } + + public enum ApproachLockCancel { + /** + * 不能取消 + */ + NOT, + /** + * 延时取消 + */ + DELAY, + /** + * 直接取消 + */ + DIRECT,; + } } diff --git a/src/main/java/club/joylink/rtss/vo/map/RealLineConfigVO.java b/src/main/java/club/joylink/rtss/vo/map/RealLineConfigVO.java index 03a23be5e..d3ac26e3d 100644 --- a/src/main/java/club/joylink/rtss/vo/map/RealLineConfigVO.java +++ b/src/main/java/club/joylink/rtss/vo/map/RealLineConfigVO.java @@ -1,6 +1,7 @@ package club.joylink.rtss.vo.map; import club.joylink.rtss.simulation.cbtc.constant.RunLevel; +import club.joylink.rtss.simulation.cbtc.data.map.MapConfig; import club.joylink.rtss.util.JsonUtils; import lombok.Getter; import lombok.NoArgsConstructor; @@ -83,7 +84,7 @@ public class RealLineConfigVO { /** *是否强制取消进路/在接近区段占用时是否依旧强制执行取消进路 */ - private Boolean signalForceCancelRoute = false; + private MapConfig.ApproachLockCancel singleApproachLockCancelRoute = MapConfig.ApproachLockCancel.NOT; /** *列车控制模式/级别