From a32c43c66d3d34c8c9cb347a2601ac8d61f65877 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Mon, 26 Dec 2022 15:52:34 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E3=80=90=E8=BD=A6=E7=AB=99=E7=AE=80?= =?UTF-8?q?=E5=86=99=E5=B1=9E=E6=80=A7=EF=BC=8C=E9=81=93=E5=B2=94=E8=AE=A1?= =?UTF-8?q?=E8=BD=B4=E5=8C=BA=E6=AE=B5=E7=AD=9B=E9=80=89=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../joylink/rtss/vo/training2/rule/MapDeviceRule.java | 2 +- .../rtss/vo/training2/rule/PropertyValueRule.java | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java index 95ceb6dab..752d59278 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java @@ -393,7 +393,7 @@ public enum MapDeviceRule { SECTION_SWITCH_AXLE_TRACK_LIST("道岔计轴区段列表") { @Override public List
filterMapDeviceList(Simulation simulation) { - return generateRandomElement(querySectionListByFunction(simulation,s -> s.isAxleCounter() && !s.isSwitchAxleCounterSection()), NUMBER); + return generateRandomElement(querySectionListByFunction(simulation,s -> s.isAxleCounter() && s.isSwitchAxleCounterSection()), NUMBER); } }, SECTION_CROSS_LIST("岔心区段列表") { diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java index 71a298438..81bdf7343 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java @@ -5,6 +5,7 @@ import club.joylink.rtss.simulation.cbtc.data.map.*; import club.joylink.rtss.simulation.cbtc.exception.SimulationException; import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import club.joylink.rtss.vo.map.graph.MapSignalButtonVO; +import club.joylink.rtss.vo.map.graph.MapStationNewVO; import lombok.Getter; import java.util.*; @@ -48,6 +49,15 @@ public enum PropertyValueRule { return MapElementRule.queryStation(mapElement).getCode(); } }, + STATION_JP("地图设备所属车站简拼"){ + @Override + public Object resolve(Simulation simulation, Object mapElement) { + String stationCode = MapElementRule.queryStation(mapElement).getCode(); + MapStationNewVO stationNewVO = simulation.getBuildParams().getMap().getGraphDataNew().getStationList().stream() + .filter(s -> Objects.equals(stationCode, s.getCode())).findFirst().orElse(null); + return stationNewVO.getJp(); + } + }, ROUTE_START_SIGNAL_NAME("进路起始名称") { @Override public String resolve(Simulation simulation, Object mapElement) { From 7cac4046f315158cb463b30ebf44f45189fe1d9e Mon Sep 17 00:00:00 2001 From: weizhihong Date: Tue, 27 Dec 2022 11:00:26 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=EF=BC=9A?= =?UTF-8?q?=E4=B8=8A=E7=94=B5=E6=93=8D=E4=BD=9C=E6=97=B6=E9=97=B4=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E4=BB=BF=E7=9C=9F=E6=97=B6=E9=97=B4=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl2.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a47bff2af..f10555792 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 @@ -543,7 +543,7 @@ public class CiApiServiceImpl2 implements CiApiService { station = station.getDeviceStation(); } Station deviceStation = station; - boolean restartFlag = Objects.nonNull(deviceStation.getRestartTime()) && deviceStation.getRestartTime().isBefore(LocalTime.now()); + boolean restartFlag = Objects.nonNull(deviceStation.getRestartTime()) && deviceStation.getRestartTime().isBefore(simulation.getCorrectSystemTime().toLocalTime()); // 是否大铁设备 boolean hasCTCFlag = simulation.getRepository().getConfig().isRailway(); // 大铁异常提示语 From 0d4d91d9b8706d802b1c66f4ec2f296816027b6d Mon Sep 17 00:00:00 2001 From: weizhihong Date: Tue, 27 Dec 2022 13:34:38 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E3=80=90=E5=A4=A7=E9=93=81=E5=AE=9E?= =?UTF-8?q?=E8=AE=AD=E8=BF=9B=E8=B7=AF=E7=AD=9B=E9=80=89=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rtss/vo/training2/rule/MapDeviceRule.java | 16 +++++++++++++++- .../vo/training2/rule/MapElementRule.java | 7 ++++++- .../vo/training2/rule/PropertyValueRule.java | 19 +++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java index 752d59278..a9ad4b638 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java @@ -2,6 +2,7 @@ package club.joylink.rtss.vo.training2.rule; import club.joylink.rtss.constants.BusinessConsts; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; +import club.joylink.rtss.simulation.cbtc.CI.data.StationDirection; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.data.map.*; import club.joylink.rtss.simulation.cbtc.exception.SimulationException; @@ -583,7 +584,20 @@ public enum MapDeviceRule { ROUTE_DEPARTURE_LIST("发车进路列表") { @Override public List filterMapDeviceList(Simulation simulation) { - return generateRandomElement(queryNormalRouteList(simulation, route -> Objects.equals(Route.Type.DEPARTURE, route.getType())), NUMBER); + List routeList = new ArrayList<>(); + simulation.getRepository().getStationList().forEach(station -> { + station.getStationDirectionMap().forEach((k, v) -> { + if (StationDirection.DirectionRunModel.A.equals(v.getRunModel())) { + if (StationDirection.ReceiveAndDeliverModel.D.equals(v.getDefaultRunStatus())) { + List list = v.getDeliverRouteList().stream() + .filter(route -> !CollectionUtils.isEmpty(route.getSectionList())) + .collect(Collectors.toList()); + routeList.addAll(list); + } + } + }); + }); + return generateRandomElement(routeList, NUMBER); } }, ROUTE_FIRST_STATION_LIST("获取第一个站进路列表") { diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/MapElementRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/MapElementRule.java index ce25fc10a..3dd3d6c9d 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/MapElementRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/MapElementRule.java @@ -33,7 +33,12 @@ public abstract class MapElementRule { } else if (mapElement instanceof Switch) { return ((Switch) mapElement).getDeviceStation(); } else if (mapElement instanceof Route) { - return ((Route) mapElement).getInterlockStation(); + Route route = ((Route) mapElement); + if (route.getInterlockStation() != null) { + return route.getInterlockStation(); + } else { + return route.getStart().getStation() != null ? route.getStart().getStation() : route.getStart().getDeviceStation(); + } } throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error); } diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java index 81bdf7343..ce4520360 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java @@ -124,6 +124,25 @@ public enum PropertyValueRule { return ((Route) mapElement).getDestinationButtonSignal().getShowName(); } }, + ROUTE_END_BUTTON_SIGNAL_CODE("进路终端按钮信号机编码") { + @Override + public Object resolve(Simulation simulation, Object mapElement) { + return ((Route) mapElement).getDestinationButtonSignal().getCode(); + } + }, + ROUTE_END_PICK_BUTTON_CODE("进路终端接车按钮编码") { + @Override + public String resolve(Simulation simulation, Object mapElement) { + Route route = (Route) mapElement; + List signalButtonList = simulation.getBuildParams().getMap().getGraphDataNew().getSignalButtonList(); + MapSignalButtonVO buttonVO = signalButtonList.stream().filter(button -> MapSignalButtonVO.Type.PICK.equals(button.getType()) + && Objects.equals(button.getSignalCode(), route.getDestination().getCode())).findFirst().orElse(null); + if (buttonVO == null) { + throw new SimulationException(SimulationExceptionType.Data_Not_Exist, "错误数据"); + } + return buttonVO.getCode(); + } + }, SIGNAL_BUTTON_CODE("信号机按钮编码") { @Override public String resolve(Simulation simulation, Object mapElement) { From a77a4ecaed5ff331c497e3cdde005fe8535e26b8 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Tue, 27 Dec 2022 14:23:13 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E3=80=90=E5=A4=A7=E9=93=81=E8=BD=A6?= =?UTF-8?q?=E7=AB=99=E9=87=8D=E5=90=AF=E6=97=B6=E9=97=B4=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E4=BB=BF=E7=9C=9F=E6=97=B6=E9=97=B4=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../club/joylink/rtss/vo/training2/rule/BgSceneStatusRule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 5ddf61bbc..37919338b 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 @@ -694,7 +694,7 @@ public enum BgSceneStatusRule { station = station.getDeviceStation(); } station.setInterlockMachineStarting(true); - station.setRestartTime(LocalTime.now()); + station.setRestartTime(simulation.getCorrectSystemTime().toLocalTime()); Station.Fault.INTERLOCK_FAULT.fix(station); //恢复联锁机故障 SimulationDataRepository repository = simulation.getRepository(); //该站范围内区段故障锁闭 From a8677aa4830b53173c31078fc2582598b402c6e3 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Tue, 27 Dec 2022 16:43:51 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E3=80=90=E7=AB=99=E6=8E=A7=E6=B6=88?= =?UTF-8?q?=E6=81=AFSimulation=5FControl=5FTransfer=5FResult=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BASimulation=5FApplyHandle=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cbtc/ATS/service/AtsStationService.java | 30 ++++-------- .../cbtc/data/vo/ControlTransferResultVO.java | 46 ------------------- .../rtss/vo/client/WebSocketMessageType.java | 4 -- .../client/factory/SocketMessageFactory.java | 1 - 4 files changed, 10 insertions(+), 71 deletions(-) delete mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/ControlTransferResultVO.java diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java index 648fb90d3..f98c868c3 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java @@ -11,13 +11,9 @@ import club.joylink.rtss.simulation.cbtc.data.map.*; import club.joylink.rtss.simulation.cbtc.data.status.StationStatus; import club.joylink.rtss.simulation.cbtc.data.support.StationTurnBackStrategyOption; import club.joylink.rtss.simulation.cbtc.data.vo.ControlTransferReplyVO; -import club.joylink.rtss.simulation.cbtc.data.vo.ControlTransferResultVO; import club.joylink.rtss.simulation.cbtc.exception.SimulationException; import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import club.joylink.rtss.simulation.cbtc.member.SimulationMember; -import club.joylink.rtss.vo.client.SocketMessageVO; -import club.joylink.rtss.vo.client.WebSocketMessageType; -import club.joylink.rtss.vo.client.factory.SocketMessageFactory; import club.joylink.rtss.websocket.StompMessageService; import lombok.NonNull; import lombok.extern.slf4j.Slf4j; @@ -186,19 +182,25 @@ public class AtsStationService { if (CollectionUtils.isEmpty(replyVOList)) { throw new SimulationException(SimulationExceptionType.Invalid_Operation, "回复结果列表不能为空"); } - List resultVOList = new ArrayList<>(replyVOList.size()); + List stationCodes = new ArrayList<>(replyVOList.size()); + SimulationMember simulationMember = null; + boolean replyResult = false; for (ControlTransferReplyVO reply : replyVOList) { Station station = simulation.getRepository().getByCode(reply.getStationCode(), Station.class); if (station.isControlTransferApplying()) { if (reply.isAgree()) { station.setControlMode(controlMode); } - resultVOList.add(new ControlTransferResultVO(station, reply.isAgree())); + simulationMember = station.getApplicant(); + replyResult = reply.isAgree(); + stationCodes.add(station.getCode()); station.cancelControlTransferApplication(); } } - if (!CollectionUtils.isEmpty(resultVOList)) { - resultVOList.forEach(vo -> sendHandlerMessage(simulation.getId(), vo)); + if (!CollectionUtils.isEmpty(stationCodes)) { + atsMessageCollectAndDispatcher.handlerOperateMessage(simulation, + new OperationMessage(simulationMember.getId(), new HashSet<>(Collections.singleton(simulationMember)), + Operation.Type.CM_Reply_Station_Control, null, replyResult, stationCodes)); } } @@ -560,16 +562,4 @@ public class AtsStationService { new OperationMessage(fromMember.getId(), new HashSet<>(Collections.singleton(fromMember)), operationType, null, true, Arrays.asList(stationCode))); } - - /** - * 发送车站转换结果 - * - * @param group 仿真 - * @param vo 转换结果 - */ - private void sendHandlerMessage(String group, ControlTransferResultVO vo) { - SocketMessageVO> messageVO = - SocketMessageFactory.build(WebSocketMessageType.Simulation_Control_Transfer_Result, group, vo.getData()); - stompMessageService.sendToUser(Set.of(vo.getUserId()), messageVO); - } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/ControlTransferResultVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/ControlTransferResultVO.java deleted file mode 100644 index 6898982c9..000000000 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/ControlTransferResultVO.java +++ /dev/null @@ -1,46 +0,0 @@ -package club.joylink.rtss.simulation.cbtc.data.vo; - -import club.joylink.rtss.simulation.cbtc.data.map.Station; -import club.joylink.rtss.simulation.cbtc.member.SimulationMember; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import java.util.HashMap; -import java.util.Map; - -/** - * 控制权转换结果信息 - */ -@Getter -@Setter -@NoArgsConstructor -public class ControlTransferResultVO { - - private String stationCode; - - private String applicantId; - - private String userId; - - private Station.ControlMode apply2TheControlMode; - - private boolean status; - - public ControlTransferResultVO(Station station, boolean agree) { - this.status = agree; - this.stationCode = station.getCode(); - this.applicantId = station.getApplicantId(); - this.userId = station.getApplicant().getUserId(); - this.apply2TheControlMode = station.getApply2TheControlMode(); - } - - public Map getData() { - Map resultMap = new HashMap<>(); - resultMap.put("stationCode", stationCode); - resultMap.put("applicantId", applicantId); - resultMap.put("apply2TheControlMode", apply2TheControlMode); - resultMap.put("status", status); - return resultMap; - } -} diff --git a/src/main/java/club/joylink/rtss/vo/client/WebSocketMessageType.java b/src/main/java/club/joylink/rtss/vo/client/WebSocketMessageType.java index a21d26428..5589c3f88 100644 --- a/src/main/java/club/joylink/rtss/vo/client/WebSocketMessageType.java +++ b/src/main/java/club/joylink/rtss/vo/client/WebSocketMessageType.java @@ -162,10 +162,6 @@ public enum WebSocketMessageType { * 仿真-报警 */ Simulation_Alarm, - /** - * 仿真-控制模式转换结果 - */ - Simulation_Control_Transfer_Result, //------------------ 仿真剧本 ------------------ /** diff --git a/src/main/java/club/joylink/rtss/vo/client/factory/SocketMessageFactory.java b/src/main/java/club/joylink/rtss/vo/client/factory/SocketMessageFactory.java index e3039b2eb..9788a7295 100644 --- a/src/main/java/club/joylink/rtss/vo/client/factory/SocketMessageFactory.java +++ b/src/main/java/club/joylink/rtss/vo/client/factory/SocketMessageFactory.java @@ -102,7 +102,6 @@ public class SocketMessageFactory { topicList.add(SimulationSubscribeTopic.Main.buildDestination(group)); break; } - case Simulation_Control_Transfer_Result: case Simulation_DeviceStatus: { topicList.add(SimulationSubscribeTopic.DeviceStatus.buildDestination(group)); break; From fd109d60debce1357d852288cd3b37c701e6c622 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Wed, 28 Dec 2022 17:05:58 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E3=80=90=E5=AE=9E=E8=AE=AD=E8=BF=9B?= =?UTF-8?q?=E8=B7=AF=E7=BB=88=E7=AB=AF=E4=BF=A1=E5=8F=B7=E6=9C=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E3=80=91=20=E3=80=90=E5=9C=B0=E5=9B=BE=E5=AE=9A?= =?UTF-8?q?=E4=BD=8D=E4=BF=A1=E6=81=AF=E3=80=91=20=E3=80=90=E5=AE=9E?= =?UTF-8?q?=E8=AE=AD=E8=BD=AC=E4=B8=AD=E6=8E=A7=E6=B6=88=E6=81=AF=E5=A4=84?= =?UTF-8?q?=E7=90=86=E3=80=91=20=E3=80=90=E5=AE=9E=E8=AE=AD=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E7=AD=9B=E9=80=89=E8=A7=84=E5=88=99=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cbtc/ATS/service/AtsStationService.java | 8 +++-- .../rtss/vo/training2/rule/MapDeviceRule.java | 34 ++++++++++++++++++- .../vo/training2/rule/MapElementRule.java | 29 ++++++++++++++++ .../vo/training2/rule/MapLocationRule.java | 13 +++++-- .../vo/training2/rule/PropertyValueRule.java | 14 ++------ 5 files changed, 80 insertions(+), 18 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java index f98c868c3..4ed9a668d 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java @@ -191,9 +191,11 @@ public class AtsStationService { if (reply.isAgree()) { station.setControlMode(controlMode); } - simulationMember = station.getApplicant(); - replyResult = reply.isAgree(); - stationCodes.add(station.getCode()); + if (!Station.ControlMode.Center.equals(controlMode)) { + simulationMember = station.getApplicant(); + replyResult = reply.isAgree(); + stationCodes.add(station.getCode()); + } station.cancelControlTransferApplication(); } } diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java index a9ad4b638..f0f066f72 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java @@ -424,7 +424,28 @@ public enum MapDeviceRule { if (section.isSwitchTrack() || section.isSwitchAxleCounterSection() || section.isLogicSection() || section.isCross()) { return false; } - return section.getDeviceStation().isCentralized(); + if (section.getStation() != null) { + return section.getStation().isCentralized(); + } else { + return section.getDeviceStation().isCentralized(); + } + }); + return generateRandomElement(sectionList, NUMBER); + } + }, + SECTION_CONTROL_LIST("控制模式车站区段列表") { + @Override + public List
filterMapDeviceList(Simulation simulation) { + List
sectionList = queryNormalSectionList(simulation, section -> { + // 普通区段排除道岔区段 + if (section.isSwitchTrack() || section.isSwitchAxleCounterSection() || section.isLogicSection() || section.isCross()) { + return false; + } + if (section.getStation() != null) { + return section.getStation().isHasControlMode(); + } else { + return section.getDeviceStation().isHasControlMode(); + } }); return generateRandomElement(sectionList, NUMBER); } @@ -565,6 +586,17 @@ public enum MapDeviceRule { }), NUMBER); } }, + ROUTE_CENTRALIZED_LIST("集中站本站进路列表"){ + @Override + public List filterMapDeviceList(Simulation simulation) { + return generateRandomElement(queryNormalRouteList(simulation, route -> { + if (!route.getInterlockStation().isCentralized()) { + return false; + } + return Objects.equals( route.getStart().getDeviceStation(), route.getDestination().getDeviceStation()); + }), NUMBER); + } + }, ROUTE_CONTROL_LIST("控制模式车站进路列表") { @Override public List filterMapDeviceList(Simulation simulation) { diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/MapElementRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/MapElementRule.java index 3dd3d6c9d..755e0b613 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/MapElementRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/MapElementRule.java @@ -1,9 +1,12 @@ package club.joylink.rtss.vo.training2.rule; +import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.data.map.*; import club.joylink.rtss.simulation.cbtc.exception.SimulationException; import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; +import java.util.Objects; + /** * 实训获取元素属性的公共代码,生成实训时使用 */ @@ -61,6 +64,32 @@ public abstract class MapElementRule { throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error); } + /** + * 获取终端信号机 + * + * @param simulation + * @param route + * @return + */ + public static Signal queryEndSignal(Simulation simulation, Route route) { + Signal startSignal = route.getStart(); + Signal endSignal = route.getDestination(); + Signal resultSignal = null; + if (!Objects.equals(startSignal.getDeviceStation(), endSignal.getDeviceStation())) { + resultSignal = simulation.getRepository().getSignalList().stream().filter(signal -> Signal.SignalType.TRANSMISSION.equals(signal.getType()) + && signal.getLinkSignal() != null && signal.getLinkSignal().getCode().equals(endSignal.getCode())) + .findFirst().orElse(null); + } + if (resultSignal != null) { + return resultSignal; + } + if (route.getDestinationButtonSignal() != null) { + return route.getDestinationButtonSignal(); + } else { + return route.getDestination(); + } + } + private static Signal querySectionSignal(Section section) { boolean flag = true; do { diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/MapLocationRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/MapLocationRule.java index 1a8a0710d..445cf5a79 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/MapLocationRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/MapLocationRule.java @@ -1,5 +1,6 @@ package club.joylink.rtss.vo.training2.rule; +import club.joylink.rtss.constants.BusinessConsts; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.constant.SignalAspect; import club.joylink.rtss.simulation.cbtc.constant.SwitchIndication; @@ -69,7 +70,15 @@ public enum MapLocationRule { return calcMapLocation(simulation, () -> { MapGraphDataNewVO mapGraphDataNewVO = simulation.getBuildParams().getMap().getGraphDataNew(); MapSectionNewVO sectionNewVO = mapGraphDataNewVO.getSectionList().stream() - .filter(s -> s.getCode().equals(mapElement.getCode())).findFirst().get(); + .filter(s -> Objects.equals(s.getCode(), mapElement.getCode())).findFirst().get(); + // 道岔区段 + if (Objects.equals(sectionNewVO.getType(), BusinessConsts.Section.SectionType.Type04) + && !CollectionUtils.isEmpty(sectionNewVO.getRelevanceSectionList())) { + String pointCode = sectionNewVO.getRelevanceSectionList().get(0); + MapSectionNewVO pointSectionNew = mapGraphDataNewVO.getSectionList().stream() + .filter(s -> Objects.equals(s.getCode(), pointCode)).findFirst().get(); + return pointSectionNew.getPoints().get(0); + } return sectionNewVO.getPoints().get(0); }); } @@ -110,7 +119,7 @@ public enum MapLocationRule { MapStationNewVO stationNewVO = simulation.getBuildParams().getMap().getGraphDataNew().getStationList().stream() .filter(mapStationNewVO -> !mapStationNewVO.isDepot()).findFirst().get(); // 横向偏差 - int x = point.getX() - 960; // 屏幕一般宽度 + int x = (int) ((point.getX() - 960) * Double.valueOf(s)); // 屏幕一般宽度 // 纵向偏差 Point origin = simulation.getBuildParams().getMap().getGraphDataNew().getOrigin(); int y = (origin == null) ? stationNewVO.getPosition().getY() - 200 : origin.getY(); diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java index ce4520360..ac9f40f74 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java @@ -99,23 +99,13 @@ public enum PropertyValueRule { ROUTE_END_SIGNAL_NAME("进路末端名称") { @Override public String resolve(Simulation simulation, Object mapElement) { - Route route = (Route) mapElement; - if (route.getDestinationButtonSignal() != null) { - return route.getDestinationButtonSignal().getShowName(); - } else { - return route.getDestination().getShowName(); - } + return MapElementRule.queryEndSignal(simulation, (Route) mapElement).getShowName(); } }, ROUTE_END_SIGNAL_CODE("进路末端信号机编码") { @Override public String resolve(Simulation simulation, Object mapElement) { - Route route = (Route) mapElement; - if (route.getDestinationButtonSignal() != null) { - return route.getDestinationButtonSignal().getCode(); - } else { - return route.getDestination().getCode(); - } + return MapElementRule.queryEndSignal(simulation, (Route) mapElement).getCode(); } }, ROUTE_END_BUTTON_SIGNAL_NAME("进路终端按钮信号机名称") { From 695e48fc37016e6225134778e79c3d96e6505540 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Thu, 29 Dec 2022 10:20:15 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E3=80=90=E5=AE=9E=E8=AE=AD=E5=AE=81?= =?UTF-8?q?=E6=B3=A2=E4=B8=80=E4=BA=BA=E8=A7=A3=E5=88=97=E8=BD=A6=E8=BF=9B?= =?UTF-8?q?=E8=B7=AF=E8=83=8C=E6=99=AF=E4=BF=AE=E6=94=B9=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rtss/vo/training2/rule/BgSceneStatusRule.java | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 37919338b..6ad489cc8 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 @@ -314,6 +314,17 @@ public enum BgSceneStatusRule { return getBgScene(simulation); } }, + SIGNAL_HUMAN_RELEASE_NB_BG_SCENE("宁波信号机总人解背景"){ + @Override + public String doHandle(Simulation simulation, MapElement mapElement) { + 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); + } + }, /** * 区段区故解背景 */ From 5f7ff4b07d3553c6a953ec6e22cd14cc87c60f3e Mon Sep 17 00:00:00 2001 From: weizhihong Date: Thu, 29 Dec 2022 14:16:37 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E3=80=90=E5=AE=9E=E8=AE=AD=E8=BF=9B?= =?UTF-8?q?=E8=B7=AF=E7=AD=9B=E9=80=89=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java index f0f066f72..b228d550f 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java @@ -601,7 +601,7 @@ public enum MapDeviceRule { @Override public List filterMapDeviceList(Simulation simulation) { return generateRandomElement(queryNormalRouteList(simulation, route ->{ - return route.getInterlockStation().isHasControlMode() && !route.isGuide(); + return route.getInterlockStation().isHasControlMode() && !route.isGuide() && !route.isTurnBack(); }), NUMBER); } }, From fc2ef5c48171b82bd2a3947069b71d92f3f4d53c Mon Sep 17 00:00:00 2001 From: weizhihong Date: Thu, 29 Dec 2022 16:30:17 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E3=80=90=E5=A4=84=E7=90=86=E5=AE=9E?= =?UTF-8?q?=E8=AE=AD=E5=9C=BA=E6=99=AF=E8=83=8C=E6=99=AF=E5=88=97=E8=BD=A6?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=8F=8D=E5=BA=8F=E5=88=97=E5=8C=96=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E6=8E=88=E6=9D=83=E8=AE=BE=E5=A4=87BUG=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cbtc/data/storage/support/StorageMa.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/support/StorageMa.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/support/StorageMa.java index 5ac473614..985c46bc6 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/support/StorageMa.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/support/StorageMa.java @@ -5,6 +5,8 @@ import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; import club.joylink.rtss.simulation.cbtc.data.map.MapNamedElement; import club.joylink.rtss.simulation.cbtc.data.storage.ato.StorageSpeedCurve; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain; +import club.joylink.rtss.simulation.cbtc.exception.SimulationException; +import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.NonNull; @@ -44,7 +46,15 @@ public class StorageMa { public MaService.Ma convert2SimulationObj(SimulationDataRepository repository) { VirtualRealityTrain train = repository.getVRByCode(trainCode, VirtualRealityTrain.class); - MapNamedElement device = repository.getByCode(deviceCode, MapNamedElement.class); + MapNamedElement device = null; + if (repository.getDeviceMap().containsKey(deviceCode)) { + device = repository.getByCode(deviceCode, MapNamedElement.class); + } else if (repository.getVrDeviceMap().containsKey(deviceCode)) { + device = repository.getVrDeviceMap().get(deviceCode); + } else { + throw new SimulationException(SimulationExceptionType.System_Fault, + String.format("地图数据异常:不存在code为[%s]的数据", deviceCode)); + } MaService.Ma ma = new MaService.Ma(train, device, type); if (eoaPosition != null) { ma.setEoaPosition(eoaPosition.convert2SimulationObj(repository));