From 145bc63540ed4741959df00dd95ae74f8a788124 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Sat, 20 May 2023 13:31:57 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E5=8D=95=E6=93=8D?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=97=B6=E8=83=8C=E6=99=AF=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vo/training2/rule/BgSceneStatusRule.java | 150 +++++++----------- .../rtss/vo/training2/rule/Training2Rule.java | 12 +- 2 files changed, 58 insertions(+), 104 deletions(-) diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/BgSceneStatusRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/BgSceneStatusRule.java index a79ef37c3..7d42008b5 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/BgSceneStatusRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/BgSceneStatusRule.java @@ -33,25 +33,22 @@ public enum BgSceneStatusRule { */ ROUTE_SET_BG_SCENE("排列进路背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Route route = (Route) mapElement; route.getSwitchList().forEach(switchElement -> switchElement.getASwitch().setSingleLock(false)); - return getBgScene(simulation); } }, ROUTE_CANCEL_BG_SCENE("取消进路背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { openRouteDirect(simulation, (Route) mapElement); - return getBgScene(simulation); } }, ROUTE_OPEN_AUTO_SETTING_BG_SCENE("进路交自动控背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Route route = (Route) mapElement; route.setAtsControl(false); - return getBgScene(simulation); } }, /** @@ -59,10 +56,9 @@ public enum BgSceneStatusRule { */ BUTTON_BLOCK_BG_SCENE("解封按钮背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Signal signal = (Signal) mapElement; signal.setBlockade(true); - return getBgScene(simulation); } }, /** @@ -70,10 +66,9 @@ public enum BgSceneStatusRule { */ SWITCH_NP_BG_SCENE("道岔定位背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Switch iSwitch = (Switch) mapElement; setSingleSwitchPositionDirectly(iSwitch, false); - return getBgScene(simulation); } }, /** @@ -81,20 +76,18 @@ public enum BgSceneStatusRule { */ SWITCH_RP_BG_SCENE("道岔反位背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Switch iSwitch = (Switch) mapElement; setSingleSwitchPositionDirectly(iSwitch, true); - return getBgScene(simulation); } }, SWITCH_NP_NB_BG_SCENE("宁波道岔定位背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Switch iSwitch = (Switch) mapElement; iSwitch.setAuto(false); iSwitch.setDispatcherReserve(true); setSingleSwitchPositionDirectly(iSwitch, false); - return getBgScene(simulation); } }, /** @@ -102,12 +95,11 @@ public enum BgSceneStatusRule { */ SWITCH_UNBLOCK_BG_SCENE("道岔解封背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Switch iSwitch = (Switch) mapElement; iSwitch.setBlockade(true); - iSwitch.getAllSections().stream().forEach(section -> section.setBlockade(true)); + iSwitch.getAllSections().forEach(section -> section.setBlockade(true)); iSwitch.setInit(false); - return getBgScene(simulation); } }, /** @@ -115,57 +107,52 @@ public enum BgSceneStatusRule { */ SWITCH_SINGLE_BLOCK_BG_SCENE("道岔单锁背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Switch iSwitch = (Switch) mapElement; iSwitch.setSingleLock(false); - return getBgScene(simulation); } }, SWITCH_SINGLE_UNBLOCK_BG_SCENE("道岔单解背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Switch iSwitch = (Switch) mapElement; iSwitch.setSingleLock(true); - return getBgScene(simulation); } }, SWITCH_FAULT_UNLOCK_BG_SCENE("道岔故障解锁背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Switch iSwitch = (Switch) mapElement; iSwitch.setRouteLock(true); iSwitch.getAllSections().forEach(section -> section.setRouteLock(true)); - return getBgScene(simulation); } }, SWITCH_AXLE_FAULT_PRE_RESET_BG_SCENE("道岔计轴预复位背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Switch iSwitch = (Switch) mapElement; Switch.SwitchFault.AXLE_FAULT.apply(iSwitch); - return getBgScene(simulation); } }, SWITCH_SECTION_ACTIVE_BG_SCENE("道岔区段激活背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Switch iSwitch = (Switch) mapElement; - return SECTION_ACTIVE_BG_SCENE.doHandle(simulation, iSwitch.getA(), client); + SECTION_ACTIVE_BG_SCENE.doHandle(simulation, iSwitch.getA(), client); } }, SWITCH_SECTION_LIMIT_SPEED("道岔区段速度限制背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Switch iSwitch = (Switch) mapElement; iSwitch.getAllSections().forEach(section -> section.setSpeedUpLimit(5)); - return getBgScene(simulation); } }, SWITCH_ACTIVE_BG_SCENE("道岔区段激活背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Switch iSwitch = (Switch) mapElement; - return BgSceneStatusRule.SECTION_ACTIVE_BG_SCENE.doHandle(simulation,iSwitch.getA(), client); + BgSceneStatusRule.SECTION_ACTIVE_BG_SCENE.doHandle(simulation,iSwitch.getA(), client); } }, /** @@ -173,12 +160,11 @@ public enum BgSceneStatusRule { */ SIGNAL_TURN_ON_BG_SCENE("信号机点灯背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Signal signal = (Signal) mapElement; signal.setAspect(SignalAspect.No); VirtualRealitySignal vrSignal = signal.getVirtualSignal(); vrSignal.setAspect(SignalAspect.No); - return getBgScene(simulation); } }, /** @@ -186,12 +172,11 @@ public enum BgSceneStatusRule { */ SIGNAL_TURN_OFF_BG_SCENE("信号机灭灯背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Signal signal = (Signal) mapElement; VirtualRealitySignal vrSignal = signal.getVirtualSignal(); signal.setAspect(vrSignal.getModel().getDefaultAspect()); vrSignal.setAspect(vrSignal.getModel().getDefaultAspect()); - return getBgScene(simulation); } }, /** @@ -199,7 +184,7 @@ public enum BgSceneStatusRule { */ SIGNAL_REOPEN_BG_SCENE("信号机重开背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Signal signal = (Signal) mapElement; Route route = signal.getRouteList().get(0); openRouteDirect(simulation, route); @@ -207,7 +192,6 @@ public enum BgSceneStatusRule { signal.setForbidden(true); signal.setAspect(signal.getDefaultAspect()); vrSignal.setAspect(signal.getDefaultAspect()); - return getBgScene(simulation); } }, /** @@ -215,7 +199,7 @@ public enum BgSceneStatusRule { */ SIGNAL_CLOSE_BG_SCENE("信号机关灯背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Signal signal = (Signal) mapElement; Route route = signal.getRouteList().stream() // .filter(r -> r.getSwitchList().stream().allMatch(switchElement -> switchElement.isNormal())) @@ -224,7 +208,6 @@ public enum BgSceneStatusRule { throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error); } openRouteDirect(simulation, route); - return getBgScene(simulation); } }, /** @@ -232,7 +215,7 @@ public enum BgSceneStatusRule { */ SIGNAL_GUIDE_BG_SCENE("信号机引导背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Signal signal = (Signal) mapElement; // 开放进路 Route route = signal.getRouteList().get(0); @@ -247,7 +230,6 @@ public enum BgSceneStatusRule { .filter(o -> o instanceof VirtualRealityTrain).findFirst().get(); Section section = route.getStart().getSection(); trainOnline(simulation, train, section, route.isRight()); - return getBgScene(simulation); } }, /** @@ -255,25 +237,23 @@ public enum BgSceneStatusRule { */ SIGNAL_ROUTE_AUTO_SET_BG_SCENE("进路交自动控背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Signal signal = (Signal) mapElement; Route route = signal.getRouteList().get(0); route.setAtsControl(false); - return getBgScene(simulation); } }, SIGNAL_ROUTE_CANCEL_AUTO_SET_BG_SCENE("取消联锁自动触发背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Signal signal = (Signal) mapElement; Route route = signal.getRouteList().get(0); route.setCiControl(true); - return getBgScene(simulation); } }, SIGNAL_SET_CI_AUTO_BG_SCENE("联锁自动进路背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Signal signal = (Signal) mapElement; List fltRouteList = signal.getRouteList().stream().filter(Route::isFlt).collect(Collectors.toList()); boolean isSetFlt = simulation.getRepository().getConfig().isSetRouteBeforeSetFlt(); @@ -282,30 +262,27 @@ public enum BgSceneStatusRule { openRouteDirect(simulation, route); } } - return getBgScene(simulation); } }, SIGNAL_CANCEL_SET_CI_AUTO_BG_SCENE("取消联锁自动进路背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Signal signal = (Signal) mapElement; Route route = signal.getRouteList().get(0); openRouteDirect(simulation, route); route.setFleetMode(true); - return getBgScene(simulation); } }, SIGNAL_UN_BLOCK_BG_SCENE("信号机解封锁背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Signal signal = (Signal) mapElement; signal.setBlockade(true); - return getBgScene(simulation); } }, SIGNAL_HUMAN_RELEASE_BG_SCENE("信号机总人解背景"){ @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Signal signal = (Signal) mapElement; Route route = signal.getRouteList().get(0); openRouteDirect(simulation, route); @@ -315,18 +292,16 @@ public enum BgSceneStatusRule { .filter(o -> o instanceof VirtualRealityTrain).findFirst().get(); Section section = route.getStart().getSection(); trainOnline(simulation, train, section, route.isRight()); - return getBgScene(simulation); } }, SIGNAL_HUMAN_RELEASE_NB_BG_SCENE("宁波信号机总人解背景"){ @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Signal signal = (Signal) mapElement; Route route = signal.getRouteList().get(0); openRouteDirect(simulation, route); closeSignalDirectly(route.getStart()); Section.AxleFault.FAULT.apply(route.getStart().getSection()); - return getBgScene(simulation); } }, /** @@ -334,10 +309,9 @@ public enum BgSceneStatusRule { */ SECTION_FAULT_LOCK_BG_SCENE("区段区故解背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Section section = (Section) mapElement; Section.AxleFault.FAULT_LOCK.apply(section); - return getBgScene(simulation); } }, /** @@ -345,7 +319,7 @@ public enum BgSceneStatusRule { */ SECTION_FAULT_UNLOCK_BG_SCENE("区段故障解锁背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Section section = (Section) mapElement; section.setRouteLock(true); if (section.isCross()) { @@ -353,12 +327,11 @@ public enum BgSceneStatusRule { } else if (section.isShowLogic()) { section.getLogicList().forEach(s -> s.setRouteLock(true)); } - return getBgScene(simulation); } }, SECTION_UNLOCK_BG_SCENE("区段解封背景"){ @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Section section = (Section) mapElement; section.setBlockade(true); if (!CollectionUtils.isEmpty(section.getLogicList())) { @@ -366,7 +339,6 @@ public enum BgSceneStatusRule { logic.setBlockade(true); } } - return getBgScene(simulation); } }, /** @@ -374,7 +346,7 @@ public enum BgSceneStatusRule { */ SECTION_ACTIVE_BG_SCENE("区段激活背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Section section = (Section) mapElement; Section axleSection = section; if (Objects.nonNull(section.getParent())) { @@ -384,7 +356,6 @@ public enum BgSceneStatusRule { for (Section logic : axleSection.getLogicList()) { logic.setCutOff(true); } - return getBgScene(simulation); } }, /** @@ -392,27 +363,25 @@ public enum BgSceneStatusRule { */ SECTION_CANCEL_LIMIT_SPEED_BG_SCENE("区段取消限速背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Section section = (Section) mapElement; section.setSpeedUpLimit(5); - return getBgScene(simulation); } }, SECTION_CONFIRM_AXIS_VALID_BG_SCENE("设置计轴生效背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Section section = (Section) mapElement; if (Objects.nonNull(section.getParent())) { section.getParent().judgeAsNctOccupied(simulation); } else { section.judgeAsNctOccupied(simulation); } - return getBgScene(simulation); } }, SECTION_AXIS_PRE_RESET_BG_SCENE("计轴预复位背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Section section = (Section) mapElement; if(!section.isAxleCounter() && !section.isCross()){ throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error); @@ -422,12 +391,11 @@ public enum BgSceneStatusRule { virtualAxleCounter.setPreReset(false); virtualAxleCounter.setLeftCount(2); virtualAxleCounter.setRightCount(2); - return getBgScene(simulation); } }, SECTION_TURN_BACK_REENTRY_STRATEGY("区段折返策略修改背景"){ @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Section section = (Section) mapElement; Stand stand = section.getStandList().get(0); stand.setTypeStrategy(Stand.TurnBackType.AUTO); @@ -435,16 +403,14 @@ public enum BgSceneStatusRule { VirtualRealityTrain train = (VirtualRealityTrain) simulation.getRepository().getVrDeviceMap().values().stream() .filter(o -> o instanceof VirtualRealityTrain).findFirst().get(); BgSceneStatusRule.trainOnline(simulation, train, section, stand.isRight()); - return getBgScene(simulation); } }, SECTION_CLOSE_BG_SCENE("轨道开放背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Section section = (Section) mapElement; section.setCloseInit(false); section.setClosed(true); - return getBgScene(simulation); } }, /** @@ -452,15 +418,14 @@ public enum BgSceneStatusRule { */ STATION_POWER_ON_UNLOCK("车站上电解锁背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Station station = MapElementRule.queryStation(mapElement); restartInterlock(simulation, station); - return getBgScene(simulation); } }, STATION_OPEN_AUTO_SETTING_BG_SCENE("全站进路交ATS自动控背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Station station = MapElementRule.queryStation(mapElement); if(!station.isInterlock()) { throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error); @@ -480,12 +445,11 @@ public enum BgSceneStatusRule { } } } - return getBgScene(simulation); } }, STATION_CLOSE_AUTO_SETTING_BG_SCENE("全站进路交人工控背景"){ @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Station station = (Station) mapElement; if(!station.isInterlock()) { throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error); @@ -505,28 +469,25 @@ public enum BgSceneStatusRule { } } } - return getBgScene(simulation); } }, - STATION_CENTER_CONTROL_BG_SCENE ("车站设置中控背景") { + STATION_CENTER_CONTROL_BG_SCENE ("车站转换中控设置的背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Station station = MapElementRule.queryStation(mapElement); station.setControlMode(Station.ControlMode.Local); - return getBgScene(simulation); } }, - STATION_STATION_CONTROL_BG_SCENE("车站转为站控背景") { + STATION_STATION_CONTROL_BG_SCENE("车站转为站控设置的背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Station station = MapElementRule.queryStation(mapElement); station.setControlMode(Station.ControlMode.Center); - return getBgScene(simulation); } }, STAND_EARLY_DEPART_BG_SCENE("提前发车背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Stand stand = (Stand) mapElement; Section section = stand.getSection(); Route route = stand.getSection().getSignalToRight().getRouteList().stream().filter(r -> @@ -540,12 +501,11 @@ public enum BgSceneStatusRule { VirtualRealityTrain train = (VirtualRealityTrain) simulation.getRepository().getVrDeviceMap().values().stream() .filter(o -> o instanceof VirtualRealityTrain).findFirst().get(); BgSceneStatusRule.trainOnline(simulation,train,section,route.isRight()); - return getBgScene(simulation); } }, STAND_CANCEL_HOLD_TRAIN_BG_SCENE("站台取消扣车背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Stand stand = (Stand) mapElement; if ("localWork".equals(client)) { // 现地,设置背景为现地扣车 @@ -554,31 +514,27 @@ public enum BgSceneStatusRule { // 行调,设置背景为中心扣车 stand.setCenterHoldTrain(true); } - return getBgScene(simulation); } }, STAND_FORCE_CANCEL_HOLD_TRAIN_BG_SCENE("强制取消扣车背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Stand stand = (Stand) mapElement; stand.setCenterHoldTrain(true); - return getBgScene(simulation); } }, STAND_CANCEL_JUMP_STOP_BG_SCENE("站台取消设置跳停背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Stand stand = (Stand) mapElement; stand.setAllSkip(true); - return getBgScene(simulation); } }, STAND_STRATEGY_BG_SCENE("人工折返策略设置背景") { @Override - public String doHandle(Simulation simulation, MapElement mapElement, String client) { + public void doHandle(Simulation simulation, MapElement mapElement, String client) { Stand stand = (Stand) mapElement; stand.setTypeStrategy(Stand.TurnBackType.AUTO); - return getBgScene(simulation); } } ; @@ -595,7 +551,7 @@ public enum BgSceneStatusRule { /** * 操作 */ - public abstract String doHandle(Simulation simulation, MapElement mapElement, String client); + public abstract void doHandle(Simulation simulation, MapElement mapElement, String client); /** * 直接开放进路 @@ -644,7 +600,7 @@ public enum BgSceneStatusRule { /** * 获取仿真背景 */ - public String getBgScene(Simulation simulation) { + public static String getBgScene(Simulation simulation) { return JsonUtils.writeValueAsString(new StorageSimulation(simulation, false)); } diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/Training2Rule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/Training2Rule.java index f8a575688..70b11ffb4 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/Training2Rule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/Training2Rule.java @@ -19,10 +19,7 @@ import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; @Getter @@ -65,7 +62,7 @@ public class Training2Rule { /** * 设置状态处理方法 */ - private BgSceneStatusRule sceneRule; + private List sceneRule; /** * 步骤列表 @@ -101,7 +98,7 @@ public class Training2Rule { this.labels = JsonUtils.readCollection(rule.getLabels(), List.class, String.class); } if (StringUtils.hasText(rule.getSceneRule())) { - this.sceneRule = BgSceneStatusRule.valueOf(rule.getSceneRule()); + this.sceneRule = Arrays.stream(rule.getSceneRule().split(",")).map(BgSceneStatusRule::valueOf).collect(Collectors.toList()); } if (StringUtils.hasText(rule.getSteps())) { this.steps = JsonUtils.readCollection(rule.getSteps(), List.class, StepRule.class); @@ -139,7 +136,8 @@ public class Training2Rule { } // 背景设置 if (sceneRule != null) { - copyTraining2.setBgSceneJson(sceneRule.doHandle(simulation, mapElement, this.client)); + sceneRule.forEach(rule -> rule.doHandle(simulation, mapElement, this.client)); + copyTraining2.setBgSceneJson(BgSceneStatusRule.getBgScene(simulation)); } List step2VOList = null; // 步骤