From 2fdda0a4d1f19d62fdece17cbb8c260c1fcba5eb Mon Sep 17 00:00:00 2001 From: DU Date: Thu, 28 Jan 2021 17:57:38 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=BF=9B=E8=B7=AF=E5=92=8C?= =?UTF-8?q?=E6=8A=98=E8=BF=94=20=E6=8C=89=E9=92=AE=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../training/generatornew/GeneratorNew.java | 82 +++++-------------- .../base/ControlGeneratorNew.java | 2 +- .../base/SectionGeneratorNew.java | 20 ++--- .../generatornew/base/SignalGeneratorNew.java | 72 +++++++++++----- .../generatornew/base/StandGeneratorNew.java | 2 +- .../base/StationGeneratorNew.java | 4 +- .../generatornew/base/SwitchGeneratorNew.java | 2 +- .../simulation/cbtc/data/map/Section.java | 62 +++++++------- .../rtss/vo/client/OperateDefinitionVO.java | 16 ++++ .../client/generate/RouteSettingConfig.java | 18 ++++ 10 files changed, 156 insertions(+), 124 deletions(-) diff --git a/src/main/java/club/joylink/rtss/services/training/generatornew/GeneratorNew.java b/src/main/java/club/joylink/rtss/services/training/generatornew/GeneratorNew.java index febeb1d8c..5c33c5ed4 100644 --- a/src/main/java/club/joylink/rtss/services/training/generatornew/GeneratorNew.java +++ b/src/main/java/club/joylink/rtss/services/training/generatornew/GeneratorNew.java @@ -11,6 +11,8 @@ import club.joylink.rtss.vo.client.OperateDefinitionVO; import club.joylink.rtss.vo.client.OperatePlaceholderVO; import club.joylink.rtss.vo.client.OperateStepVO; import club.joylink.rtss.vo.client.map.MapVO; +import club.joylink.rtss.vo.client.map.newmap.MapAutomaticRouteButtonVO; +import club.joylink.rtss.vo.client.map.newmap.MapCycleButtonVO; import club.joylink.rtss.vo.client.training.TrainingNewVO; import club.joylink.rtss.vo.client.training.TrainingStepVO; import org.springframework.util.StringUtils; @@ -34,8 +36,9 @@ public interface GeneratorNew { * @param operateDefinitionVO * @return */ - default TrainingNewVO build(GenerateConfig config, Simulation simulation, MapElement mapDevice, + default TrainingNewVO build(GenerateConfig config, Simulation simulation, MapElement mapDevice, Object mapButton, OperateDefinitionVO operateDefinitionVO) { + // 现地设置站控 if (BusinessConsts.MapPrd.PrdType.Type01.equals(config.getPrdType())) { switch (mapDevice.getDeviceType()) { @@ -97,71 +100,29 @@ public interface GeneratorNew { // 设置定位 if (MapElement.DeviceType.ROUTE.equals(mapDevice.getDeviceType())) { trainingVO.setLocateDeviceCode(((Route) mapDevice).getStart().getCode()); -// stepList.get(0).setDeviceCode(((Route) mapDevice).getStart().getCode()); -// //哈尔滨线路特殊操作特别设置 -// if (BusinessConsts.MapPrd.PrdType.Type01.equals(config.getPrdType()) && RealLineEnum.HarBin_Line1.getCode().equals(simulation.getBuildParams().getMap().getLineCode())) { -// switch (Operation.Type.valueOf(operateDefinitionVO.getOperateType())) { -// case Signal_Set_Route: -// case Signal_Cancel_Route: -// case Signal_Set_Guide: -// case Signal_Cancel_Guide: -// stepList.get(1).setDeviceCode(((Route) mapDevice).getDestination().getCode()); -// break; -// } -// } -// if (BusinessConsts.MapPrd.PrdType.Type01.equals(config.getPrdType()) && RealLineEnum.BeiJing_Line1.getCode().equals(simulation.getBuildParams().getMap().getLineCode())) { -// switch (Operation.Type.valueOf(operateDefinitionVO.getOperateType())) { -// case Signal_Set_Route: -// stepList.get(0).setDeviceCode(null); -// stepList.get(1).setDeviceCode(((Route) mapDevice).getStart().getCode()); -// stepList.get(2).setDeviceCode(((Route) mapDevice).getDestination().getCode()); -// break; -// case Signal_Cancel_Route: -// stepList.get(0).setDeviceCode(null); -// stepList.get(1).setDeviceCode(((Route) mapDevice).getStart().getCode()); -// break; -// } -// } // -// if (BusinessConsts.MapPrd.PrdType.Type01.equals(config.getPrdType()) && RealLineEnum.Foshan_Tram.getCode().equals(simulation.getBuildParams().getMap().getLineCode())) { -// switch (Operation.Type.valueOf(operateDefinitionVO.getOperateType())) { -// case Signal_Cancel_Route: -// case Signal_Total_Cancel: -// stepList.get(0).setDeviceCode(null); -// stepList.get(1).setDeviceCode(((Route) mapDevice).getStart().getCode()); -// break; -// } -// } -// -// if (BusinessConsts.MapPrd.PrdType.Type01.equals(config.getPrdType()) && RealLineEnum.ChengDu_Line3.getCode().equals(simulation.getBuildParams().getMap().getLineCode())) { -// switch (Operation.Type.valueOf(operateDefinitionVO.getOperateType())) { -// case Signal_Set_Route: -// case Signal_Cancel_Route: -// case Signal_Set_Guide: -// stepList.get(0).setDeviceCode(null); -// stepList.get(1).setDeviceCode(((Route) mapDevice).getStart().getCode()); -// break; -// } -// } } else { - trainingVO.setLocateDeviceCode(mapDevice.getCode()); + if(Objects.isNull(mapButton)){ + trainingVO.setLocateDeviceCode(mapDevice.getCode()); + }else{ + if(mapButton instanceof MapCycleButtonVO){ + trainingVO.setLocateDeviceCode(((MapCycleButtonVO)mapButton).getCode()); + }else if(mapButton instanceof MapAutomaticRouteButtonVO){ + trainingVO.setLocateDeviceCode(((MapAutomaticRouteButtonVO)mapButton).getCode()); + } + } } // 替换占位符 if (containPlaceholder(trainingVO.getName())) { - trainingVO.setName(replacePlaceholder(trainingVO.getName(), placeholderVOMap, mapDevice, simulation.getBuildParams().getMap())); + trainingVO.setName(replacePlaceholder(trainingVO.getName(), placeholderVOMap, mapDevice, mapButton,simulation.getBuildParams().getMap())); } if (containPlaceholder(trainingVO.getRemarks())) { - trainingVO.setRemarks(replacePlaceholder(trainingVO.getRemarks(), placeholderVOMap, mapDevice, simulation.getBuildParams().getMap())); + trainingVO.setRemarks(replacePlaceholder(trainingVO.getRemarks(), placeholderVOMap, mapDevice,mapButton, simulation.getBuildParams().getMap())); } // 添加步骤 List steps = new ArrayList<>(stepList.size()); stepList.forEach(operateStepVO -> { - - TrainingStepVO stepVO = new TrainingStepVO(operateStepVO); -// if(StringUtils.hasText(stepVO.getCode()) && MapElement.DeviceType.ROUTE.equals(mapDevice.getDeviceType())) { -// stepVO.setCode(((Route)mapDevice).getStart().getCode()); -// } if (containPlaceholder(stepVO.getTip())) { if (StringUtils.hasText(operateStepVO.getCodeType())) { TrainingConsts.CodeType codeType = TrainingConsts.CodeType.valueOf(operateStepVO.getCodeType()); @@ -175,13 +136,13 @@ public interface GeneratorNew { operSignal = ((Route) mapDevice).getStart(); } } - stepVO.setTip(replacePlaceholder(stepVO.getTip(), placeholderVOMap, Objects.isNull(operSignal) ? mapDevice : operSignal, simulation.getBuildParams().getMap())); + stepVO.setTip(replacePlaceholder(stepVO.getTip(), placeholderVOMap, Objects.isNull(operSignal) ? mapDevice : operSignal,null, simulation.getBuildParams().getMap())); } else { - stepVO.setTip(replacePlaceholder(stepVO.getTip(), placeholderVOMap, mapDevice, simulation.getBuildParams().getMap())); + stepVO.setTip(replacePlaceholder(stepVO.getTip(), placeholderVOMap, mapDevice, null,simulation.getBuildParams().getMap())); } } if (containPlaceholder(stepVO.getVal())) { - stepVO.setVal(replacePlaceholder(stepVO.getVal(), placeholderVOMap,mapDevice, simulation.getBuildParams().getMap())); + stepVO.setVal(replacePlaceholder(stepVO.getVal(), placeholderVOMap,mapDevice,null, simulation.getBuildParams().getMap())); } steps.add(stepVO); }); @@ -190,13 +151,14 @@ public interface GeneratorNew { return trainingVO; } + /** * 是否包含占位符 * * @param string * @return */ - default boolean containPlaceholder(String string) { + private boolean containPlaceholder(String string) { if (StringUtils.hasText(string)) { return Pattern.matches(".*\\{\\d+}.*", string); } @@ -211,7 +173,7 @@ public interface GeneratorNew { * @param mapDevice * @return */ - default String replacePlaceholder(String str, Map placeholderVOMap, MapElement mapDevice, MapVO map) { + private String replacePlaceholder(String str, Map placeholderVOMap, MapElement mapDevice,Object mapButton, MapVO map) { Pattern pattern = Pattern.compile(".*?(\\{(\\d+)}).*?"); Matcher matcher = pattern.matcher(str); while (matcher.find()) { @@ -219,7 +181,7 @@ public interface GeneratorNew { OperatePlaceholderVO operatePlaceholderVO = placeholderVOMap.get(group); switch (operatePlaceholderVO.getType()) { case PlaceholderType.Type01: - String replace = ReflectionUtils.invokeGetter(mapDevice, operatePlaceholderVO.getValNew()).toString(); + String replace = ReflectionUtils.invokeGetter(Objects.isNull(mapButton)?mapDevice:mapButton, operatePlaceholderVO.getValNew()).toString(); str = str.replace(matcher.group(1), replace); break; case PlaceholderType.Type02: { diff --git a/src/main/java/club/joylink/rtss/services/training/generatornew/base/ControlGeneratorNew.java b/src/main/java/club/joylink/rtss/services/training/generatornew/base/ControlGeneratorNew.java index 1a0859b49..21b76e12e 100644 --- a/src/main/java/club/joylink/rtss/services/training/generatornew/base/ControlGeneratorNew.java +++ b/src/main/java/club/joylink/rtss/services/training/generatornew/base/ControlGeneratorNew.java @@ -41,7 +41,7 @@ public class ControlGeneratorNew implements GeneratorNew { // 其他操作,不生成 continue; } - trainingVOList.add(build(config, simulation, station, operateDefinitionVO)); + trainingVOList.add(build(config, simulation, station, null,operateDefinitionVO)); // 仿真重置 simulation.reset(); } diff --git a/src/main/java/club/joylink/rtss/services/training/generatornew/base/SectionGeneratorNew.java b/src/main/java/club/joylink/rtss/services/training/generatornew/base/SectionGeneratorNew.java index 98c007276..532afafc5 100644 --- a/src/main/java/club/joylink/rtss/services/training/generatornew/base/SectionGeneratorNew.java +++ b/src/main/java/club/joylink/rtss/services/training/generatornew/base/SectionGeneratorNew.java @@ -91,7 +91,7 @@ public class SectionGeneratorNew implements GeneratorNew { // 其他操作,不生成 continue; } - trainingVOList.add(this.build(config, simulation, section, operateDefinitionVO)); + trainingVOList.add(this.build(config, simulation, section,null, operateDefinitionVO)); // 仿真重置 simulation.reset(); } @@ -105,7 +105,7 @@ public class SectionGeneratorNew implements GeneratorNew { section.setOverlapLock(true); section.setRouteLock(true); // settingDirectly(simulation, route); - TrainingNewVO build = build(config, simulation, section, operateDefinitionVO); + TrainingNewVO build = build(config, simulation, section,null, operateDefinitionVO); //恢复背景 section.setFaultLock(false); @@ -118,7 +118,7 @@ public class SectionGeneratorNew implements GeneratorNew { protected TrainingNewVO sectionCutOff(Section section, GenerateConfig config, Simulation simulation, OperateDefinitionVO operateDefinitionVO) { // 无背景 - return build(config, simulation, section, operateDefinitionVO); + return build(config, simulation, section, null,operateDefinitionVO); } protected TrainingNewVO sectionActive(Section section, GenerateConfig config, Simulation simulation, @@ -134,7 +134,7 @@ public class SectionGeneratorNew implements GeneratorNew { parentSection.setCutOff(true); parentSection.getLogicList().forEach(ls -> ls.setCutOff(true)); } - TrainingNewVO build = build(config, simulation, section, operateDefinitionVO); + TrainingNewVO build = build(config, simulation, section,null, operateDefinitionVO); // 区段切除 if(section.isPhysical()){ section.setCutOff(true); @@ -154,13 +154,13 @@ public class SectionGeneratorNew implements GeneratorNew { OperateDefinitionVO operateDefinitionVO) { // 设置故障 // TODO - return build(config, simulation, section, operateDefinitionVO); + return build(config, simulation, section,null, operateDefinitionVO); } protected TrainingNewVO sectionBlock(Section section, GenerateConfig config, Simulation simulation, OperateDefinitionVO operateDefinitionVO) { // 无背景 - return build(config, simulation, section, operateDefinitionVO); + return build(config, simulation, section,null, operateDefinitionVO); } protected TrainingNewVO sectionUnblock(Section section, GenerateConfig config, Simulation simulation, @@ -176,7 +176,7 @@ public class SectionGeneratorNew implements GeneratorNew { } } // sectionService.blockade(section); - TrainingNewVO build = build(config, simulation, section, operateDefinitionVO); + TrainingNewVO build = build(config, simulation, section,null, operateDefinitionVO); section.setBlockade(false); if (Objects.nonNull(section.getParent())) { // 取计轴区段 @@ -200,7 +200,7 @@ public class SectionGeneratorNew implements GeneratorNew { } else { section.setSpeedUpLimit(-1); } - TrainingNewVO build = build(config, simulation, section, operateDefinitionVO); + TrainingNewVO build = build(config, simulation, section, null,operateDefinitionVO); // 区段设置限速 if (section.isSwitchTrack()) { @@ -226,7 +226,7 @@ public class SectionGeneratorNew implements GeneratorNew { } else { section.setSpeedUpLimit(LIMITED_SPEED); } - TrainingNewVO build = build(config, simulation, section, operateDefinitionVO); + TrainingNewVO build = build(config, simulation, section, null,operateDefinitionVO); if (section.isSwitchTrack()) { Switch relSwitch = section.getRelSwitch(); @@ -241,7 +241,7 @@ public class SectionGeneratorNew implements GeneratorNew { protected TrainingNewVO sectionDetail(Section section, GenerateConfig config, Simulation simulation, OperateDefinitionVO operateDefinitionVO) { //区段详情 - return build(config, simulation, section, operateDefinitionVO); + return build(config, simulation, section, null,operateDefinitionVO); } } diff --git a/src/main/java/club/joylink/rtss/services/training/generatornew/base/SignalGeneratorNew.java b/src/main/java/club/joylink/rtss/services/training/generatornew/base/SignalGeneratorNew.java index 59f97b6ff..f3b953fe3 100644 --- a/src/main/java/club/joylink/rtss/services/training/generatornew/base/SignalGeneratorNew.java +++ b/src/main/java/club/joylink/rtss/services/training/generatornew/base/SignalGeneratorNew.java @@ -33,7 +33,15 @@ public class SignalGeneratorNew implements GeneratorNew { case Signal_Set_Auto_Turn_Back: { List cycleList = simulation.getRepository().getCycleList(); for (Cycle cycle : cycleList) { - trainingVOList.add(this.build(config, simulation, cycle, operateDefinitionVO)); + if(operateDefinitionVO.autoCycleButton()){ + simulation.getBuildParams().getMap().getGraphDataNew().getCycleButtonList() + .stream().filter(mapCycleButtonVO -> mapCycleButtonVO.getCycleCode().equals(cycle.getCode())) + .forEach(button -> { + trainingVOList.add(this.build(config, simulation, cycle,button, operateDefinitionVO)); + }); + }else { + trainingVOList.add(this.build(config, simulation, cycle,null, operateDefinitionVO)); + } // 仿真重置 simulation.reset(); } @@ -44,7 +52,15 @@ public class SignalGeneratorNew implements GeneratorNew { List cycleList = simulation.getRepository().getCycleList(); for (Cycle cycle : cycleList) { cycle.setSetUp(true); - trainingVOList.add(this.build(config, simulation, cycle, operateDefinitionVO)); + if(operateDefinitionVO.autoCycleButton()){ + simulation.getBuildParams().getMap().getGraphDataNew().getCycleButtonList() + .stream().filter(mapCycleButtonVO -> mapCycleButtonVO.getCycleCode().equals(cycle.getCode())) + .forEach(button -> { + trainingVOList.add(this.build(config, simulation, cycle,button, operateDefinitionVO)); + }); + }else{ + trainingVOList.add(this.build(config, simulation, cycle,null, operateDefinitionVO)); + } // 仿真重置 simulation.reset(); } @@ -73,7 +89,7 @@ public class SignalGeneratorNew implements GeneratorNew { if (route.isGuide()) { // 引导进路跳过 continue; } - trainingVOList.add(this.build(config, simulation, route, operateDefinitionVO)); + trainingVOList.add(this.build(config, simulation, route,null, operateDefinitionVO)); // 仿真重置 simulation.reset(); } @@ -83,7 +99,7 @@ public class SignalGeneratorNew implements GeneratorNew { case Signal_Set_CI_Auto_Trigger: { if (!CollectionUtils.isEmpty(routeList)) { if (routeLikeHa1) { - trainingVOList.add(this.build(config, simulation, signal, operateDefinitionVO)); + trainingVOList.add(this.build(config, simulation, signal,null, operateDefinitionVO)); simulation.reset(); continue; } else { @@ -96,7 +112,7 @@ public class SignalGeneratorNew implements GeneratorNew { if (route.isGuide()) { // 引导进路跳过 continue; } - trainingVOList.add(this.build(config, simulation, signal, operateDefinitionVO)); + trainingVOList.add(this.build(config, simulation, signal,null, operateDefinitionVO)); // 仿真重置 simulation.reset(); } @@ -107,7 +123,7 @@ public class SignalGeneratorNew implements GeneratorNew { case Signal_Close_Auto_Setting: { if (!CollectionUtils.isEmpty(routeList)) { if (routeLikeHa1 || operateDefinitionVO.onlyOperateSignal()) { - trainingVOList.add(this.build(config, simulation, signal, operateDefinitionVO)); + trainingVOList.add(this.build(config, simulation, signal, null, operateDefinitionVO)); simulation.reset(); continue; } else { @@ -120,7 +136,7 @@ public class SignalGeneratorNew implements GeneratorNew { if (route.isGuide()) { // 引导进路跳过 continue; } - trainingVOList.add(this.build(config, simulation, route, operateDefinitionVO)); + trainingVOList.add(this.build(config, simulation, route,null, operateDefinitionVO)); // 仿真重置 simulation.reset(); } @@ -142,7 +158,7 @@ public class SignalGeneratorNew implements GeneratorNew { continue; } deviceStatusModifyTool.openRouteDirect(simulation, route); - trainingVOList.add(this.build(config, simulation, route, operateDefinitionVO)); + trainingVOList.add(this.build(config, simulation, route, null, operateDefinitionVO)); // 仿真重置 simulation.reset(); } @@ -172,7 +188,7 @@ public class SignalGeneratorNew implements GeneratorNew { continue; } this.deviceStatusModifyTool.openRouteDirect(simulation, route); - trainingVOList.add(this.build(config, simulation, signal, operateDefinitionVO)); + trainingVOList.add(this.build(config, simulation, signal,null, operateDefinitionVO)); // 仿真重置 simulation.reset(); } @@ -188,7 +204,7 @@ public class SignalGeneratorNew implements GeneratorNew { } this.deviceStatusModifyTool.openRouteDirect(simulation, route); this.deviceStatusModifyTool.closeSignalDirectly(route.getStart()); - trainingVOList.add(this.build(config, simulation, signal, operateDefinitionVO)); + trainingVOList.add(this.build(config, simulation, signal,null, operateDefinitionVO)); // 仿真重置 simulation.reset(); } @@ -207,7 +223,7 @@ public class SignalGeneratorNew implements GeneratorNew { for (Route route : routeList) { route.setAtsControl(false); } - trainingVOList.add(this.build(config, simulation, signal, operateDefinitionVO)); + trainingVOList.add(this.build(config, simulation, signal, null, operateDefinitionVO)); // 仿真重置 simulation.reset(); } else { @@ -216,7 +232,7 @@ public class SignalGeneratorNew implements GeneratorNew { continue; } route.setAtsControl(false); - trainingVOList.add(this.build(config, simulation, route, operateDefinitionVO)); + trainingVOList.add(this.build(config, simulation, route,null, operateDefinitionVO)); // 仿真重置 simulation.reset(); } @@ -232,7 +248,15 @@ public class SignalGeneratorNew implements GeneratorNew { .collect(Collectors.toList()); for (Route route : fltRouteList) { deviceStatusModifyTool.openRouteDirect(simulation, route); - trainingVOList.add(this.build(config, simulation, route.getStart(), operateDefinitionVO)); + if (operateDefinitionVO.autoRouteButton()) { + simulation.getBuildParams().getMap().getGraphDataNew().getAutomaticRouteButtonList() + .stream().filter(automaticRouteButtonVO -> automaticRouteButtonVO.getAutomaticRouteCode().equals(route.getCode())) + .forEach(button -> { + trainingVOList.add(this.build(config, simulation, route.getStart(), button, operateDefinitionVO)); + }); + } else { + trainingVOList.add(this.build(config, simulation, route.getStart(), null, operateDefinitionVO)); + } // 仿真重置 simulation.reset(); } @@ -248,7 +272,15 @@ public class SignalGeneratorNew implements GeneratorNew { for (Route route : fltRouteList) { deviceStatusModifyTool.openRouteDirect(simulation, route); route.setFleetMode(true); - trainingVOList.add(this.build(config, simulation, signal, operateDefinitionVO)); + if (operateDefinitionVO.autoRouteButton()) { + simulation.getBuildParams().getMap().getGraphDataNew().getAutomaticRouteButtonList() + .stream().filter(automaticRouteButtonVO -> automaticRouteButtonVO.getAutomaticRouteCode().equals(route.getCode())) + .forEach(button -> { + trainingVOList.add(this.build(config, simulation,signal, button, operateDefinitionVO)); + }); + } else { + trainingVOList.add(this.build(config, simulation, signal,null, operateDefinitionVO)); + } // 仿真重置 simulation.reset(); } @@ -265,13 +297,13 @@ public class SignalGeneratorNew implements GeneratorNew { for (Route route : arcRouteList) { route.setCiControl(true); } - trainingVOList.add(this.build(config, simulation, signal, operateDefinitionVO)); + trainingVOList.add(this.build(config, simulation, signal, null, operateDefinitionVO)); // 仿真重置 simulation.reset(); } else { for (Route route : arcRouteList) { route.setCiControl(true); - trainingVOList.add(this.build(config, simulation, signal, operateDefinitionVO)); + trainingVOList.add(this.build(config, simulation, signal,null, operateDefinitionVO)); // 仿真重置 simulation.reset(); } @@ -310,14 +342,14 @@ public class SignalGeneratorNew implements GeneratorNew { for (Route route : routeList) { if (!route.isTurnBack()) { this.deviceStatusModifyTool.openGuideRouteDirect(simulation, route); - trainingVOList.add(this.build(config, simulation, signal, operateDefinitionVO)); + trainingVOList.add(this.build(config, simulation, signal, null, operateDefinitionVO)); // 仿真重置 simulation.reset(); } } } else if (Objects.nonNull(signal.getAutoSignal())) { // 信号机是自动信号 this.deviceStatusModifyTool.openGuideSignalDirectly(signal); - trainingVOList.add(this.build(config, simulation, signal, operateDefinitionVO)); + trainingVOList.add(this.build(config, simulation, signal, null, operateDefinitionVO)); // 仿真重置 simulation.reset(); } @@ -336,7 +368,7 @@ public class SignalGeneratorNew implements GeneratorNew { } if (!route.isTurnBack()) { this.deviceStatusModifyTool.openGuideRouteDirect(simulation, route); - trainingVOList.add(this.build(config, simulation, route, operateDefinitionVO)); + trainingVOList.add(this.build(config, simulation, route,null, operateDefinitionVO)); // 仿真重置 simulation.reset(); } @@ -355,7 +387,7 @@ public class SignalGeneratorNew implements GeneratorNew { // 其他操作,不生成 continue; } - trainingVOList.add(this.build(config, simulation, signal, operateDefinitionVO)); + trainingVOList.add(this.build(config, simulation, signal,null, operateDefinitionVO)); // 仿真重置 simulation.reset(); } diff --git a/src/main/java/club/joylink/rtss/services/training/generatornew/base/StandGeneratorNew.java b/src/main/java/club/joylink/rtss/services/training/generatornew/base/StandGeneratorNew.java index 7c9eadbe8..0a7519104 100644 --- a/src/main/java/club/joylink/rtss/services/training/generatornew/base/StandGeneratorNew.java +++ b/src/main/java/club/joylink/rtss/services/training/generatornew/base/StandGeneratorNew.java @@ -92,7 +92,7 @@ public class StandGeneratorNew implements GeneratorNew { // 其他操作,不生成 continue; } - trainingVOList.add(this.build(config, simulation, stand, operateDefinitionVO)); + trainingVOList.add(this.build(config, simulation, stand,null, operateDefinitionVO)); // 仿真重置 simulation.reset(); } diff --git a/src/main/java/club/joylink/rtss/services/training/generatornew/base/StationGeneratorNew.java b/src/main/java/club/joylink/rtss/services/training/generatornew/base/StationGeneratorNew.java index a498ede0e..4c51212e6 100644 --- a/src/main/java/club/joylink/rtss/services/training/generatornew/base/StationGeneratorNew.java +++ b/src/main/java/club/joylink/rtss/services/training/generatornew/base/StationGeneratorNew.java @@ -99,7 +99,7 @@ public class StationGeneratorNew implements GeneratorNew { // 其他操作,不生成 continue; } - trainingVOList.add(build(config, simulation, station, operateDefinitionVO)); + trainingVOList.add(build(config, simulation, station,null, operateDefinitionVO)); // 仿真重置 simulation.reset(); } @@ -110,7 +110,7 @@ public class StationGeneratorNew implements GeneratorNew { tbStationList.forEach(station -> { if (Objects.equals(Operation.Type.Station_Set_Turn_Back_Strategy.name(), operateDefinitionVO.getOperateType())) { station.setControlMode(Station.ControlMode.Center); - trainingVOList.add(build(config, simulation, station, operateDefinitionVO)); + trainingVOList.add(build(config, simulation, station,null, operateDefinitionVO)); // 仿真重置 simulation.reset(); } diff --git a/src/main/java/club/joylink/rtss/services/training/generatornew/base/SwitchGeneratorNew.java b/src/main/java/club/joylink/rtss/services/training/generatornew/base/SwitchGeneratorNew.java index 8c36d14a6..d878d7524 100644 --- a/src/main/java/club/joylink/rtss/services/training/generatornew/base/SwitchGeneratorNew.java +++ b/src/main/java/club/joylink/rtss/services/training/generatornew/base/SwitchGeneratorNew.java @@ -108,7 +108,7 @@ public class SwitchGeneratorNew implements GeneratorNew { // 其他操作,不生成 continue; } - trainingVOList.add(this.build(config, simulation, aSwitch, operateDefinitionVO)); + trainingVOList.add(this.build(config, simulation, aSwitch, null,operateDefinitionVO)); // 仿真重置 simulation.reset(); } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Section.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Section.java index 9a3cc69f7..09236bb18 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Section.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Section.java @@ -373,24 +373,26 @@ public class Section extends MayOutOfOrderDevice { * 区段列车出清 */ public void clearOccupy() { - this.ctOccupied = false; - if (this.isAxleCounter()) { - // 是计轴区段 - if (this.getVirtualAxleCounter().isOccupy()) { - if (!CollectionUtils.isEmpty(this.logicList)) { - this.logicList.forEach(logic -> { - logic.setCtOccupied(false); - }); + synchronized (this){ + this.ctOccupied = false; + if (this.isAxleCounter()) { + // 是计轴区段 + if (this.getVirtualAxleCounter().isOccupy()) { + if (!CollectionUtils.isEmpty(this.logicList)) { + this.logicList.forEach(logic -> { + logic.setCtOccupied(false); + }); + } + return; } - return; } - } - this.nctOccupied = false; - if (!CollectionUtils.isEmpty(this.logicList)) { - this.logicList.forEach(logic -> { - logic.setCtOccupied(false); - logic.setNctOccupied(false); - }); + this.nctOccupied = false; + if (!CollectionUtils.isEmpty(this.logicList)) { + this.logicList.forEach(logic -> { + logic.setCtOccupied(false); + logic.setNctOccupied(false); + }); + } } } @@ -401,8 +403,8 @@ public class Section extends MayOutOfOrderDevice { */ public void axleCounterOccupy(boolean right) { if (!this.isInvalid()) { - this.trainRight = right; - this.nctOccupied = true; + this.trainRight = right; + this.nctOccupied = true; // if (!CollectionUtils.isEmpty(logicList)) { // logicList.forEach(logic -> logic.axleCounterOccupy(right)); // } @@ -413,10 +415,10 @@ public class Section extends MayOutOfOrderDevice { * 计轴占用出清 */ public void axleCounterClear() { - this.nctOccupied = false; - if (!CollectionUtils.isEmpty(logicList)) { - logicList.forEach(Section::axleCounterClear); - } + this.nctOccupied = false; + if (!CollectionUtils.isEmpty(logicList)) { + logicList.forEach(Section::axleCounterClear); + } } /** @@ -489,16 +491,18 @@ public class Section extends MayOutOfOrderDevice { * @return */ public boolean isNonCbtcOccupy() { - boolean ctOcc = this.ctOccupied; - if (!CollectionUtils.isEmpty(this.logicList)) { - for (Section logic : this.logicList) { - if (logic.isCtOccupied()) { - ctOcc = true; - break; + synchronized (this){ + boolean ctOcc = this.ctOccupied; + if (!CollectionUtils.isEmpty(this.logicList)) { + for (Section logic : this.logicList) { + if (logic.isCtOccupied()) { + ctOcc = true; + break; + } } } + return !ctOcc && this.nctOccupied; } - return !ctOcc && this.nctOccupied; } public List
getAtpSectionListBy(float offset1, float offset2) { diff --git a/src/main/java/club/joylink/rtss/vo/client/OperateDefinitionVO.java b/src/main/java/club/joylink/rtss/vo/client/OperateDefinitionVO.java index 3165939e0..419a1c79b 100644 --- a/src/main/java/club/joylink/rtss/vo/client/OperateDefinitionVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/OperateDefinitionVO.java @@ -160,4 +160,20 @@ public class OperateDefinitionVO { } return false; } + + public boolean autoRouteButton() { + RouteSettingConfig routeSettingConfig = this.getRouteSettingConfig(); + if (Objects.nonNull(routeSettingConfig)) { + return routeSettingConfig.autoRouteButton(); + } + return false; + } + + public boolean autoCycleButton() { + RouteSettingConfig routeSettingConfig = this.getRouteSettingConfig(); + if (Objects.nonNull(routeSettingConfig)) { + return routeSettingConfig.autoCycleButton(); + } + return false; + } } diff --git a/src/main/java/club/joylink/rtss/vo/client/generate/RouteSettingConfig.java b/src/main/java/club/joylink/rtss/vo/client/generate/RouteSettingConfig.java index 44d58b0dd..79921fcba 100644 --- a/src/main/java/club/joylink/rtss/vo/client/generate/RouteSettingConfig.java +++ b/src/main/java/club/joylink/rtss/vo/client/generate/RouteSettingConfig.java @@ -12,6 +12,12 @@ public class RouteSettingConfig { private RouteType routeType; private Boolean onlySignalOP;//成都三现地 自动控人工控只一个始端信号机,实训生成名字走信号机策略 + //自动进路按钮 MapAutomaticRouteButtonVO Route MapRouteNewVO + private Boolean autoRouteBT; + //自动折返按钮 MapCycleButtonVO Cycle MapAutoReentryVO + private Boolean autoCycleBT; + //引导总锁 + public boolean isAtp() { return RouteType.ATP.equals(this.routeType); } @@ -32,4 +38,16 @@ public class RouteSettingConfig { } return false; } + public boolean autoRouteButton(){ + if(Objects.nonNull(autoRouteBT)){ + return autoRouteBT; + } + return false; + } + public boolean autoCycleButton(){ + if(Objects.nonNull(autoCycleBT)){ + return autoCycleBT; + } + return false; + } }