diff --git a/src/main/java/club/joylink/rtss/controller/draft/DraftMapController.java b/src/main/java/club/joylink/rtss/controller/draft/DraftMapController.java index c0f7aa65e..3b363180b 100644 --- a/src/main/java/club/joylink/rtss/controller/draft/DraftMapController.java +++ b/src/main/java/club/joylink/rtss/controller/draft/DraftMapController.java @@ -768,4 +768,10 @@ public class DraftMapController { public void deleteOperationDefinition(@PathVariable Long mapId, @PathVariable String code){ iDraftMapService.deleteOperationDefinition(mapId, code); } + +// //临时接口 +// @PostMapping("/handle/ctc/{id}") +// public void handle(@PathVariable Long id) { +// iDraftMapService.handle(id); +// } } diff --git a/src/main/java/club/joylink/rtss/services/DraftMapService.java b/src/main/java/club/joylink/rtss/services/DraftMapService.java index 2354dbeb5..3d46f959f 100644 --- a/src/main/java/club/joylink/rtss/services/DraftMapService.java +++ b/src/main/java/club/joylink/rtss/services/DraftMapService.java @@ -5,6 +5,8 @@ import club.joylink.rtss.dao.*; import club.joylink.rtss.entity.*; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.services.draftData.DraftMapOverrunService; +import club.joylink.rtss.services.draftData.DraftMapRouteService; +import club.joylink.rtss.services.draftData.RailwayRouteGenerator; import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder; import club.joylink.rtss.simulation.cbtc.data.CalculateService; import club.joylink.rtss.simulation.cbtc.data.map.Section; @@ -89,7 +91,11 @@ public class DraftMapService implements IDraftMapService { @Autowired private DraftMapOverrunService draftMapOverrunService; + @Autowired + private RailwayRouteGenerator railwayRouteGenerator; + @Autowired + private DraftMapRouteService draftMapRouteService; @Override public List list( AccountVO accountVO) { @@ -1480,6 +1486,22 @@ public class DraftMapService implements IDraftMapService { this.draftMapDAO.updateByPrimaryKeySelective(db); } + @Transactional + @Override + public void handle(Long mapId) { + DraftMapRouteExample example = new DraftMapRouteExample(); + example.createCriteria().andMapIdEqualTo(mapId); + List routes = draftMapRouteDAO.selectByExampleWithBLOBs(example); + draftMapRouteDAO.deleteByExample(example); + + List vos = MapRouteNewVO.convertDraft2VOList(routes); + for (MapRouteNewVO vo : vos) { + if (StringUtils.hasText(vo.getEndSectionCode())) { + draftMapRouteService.createRailwayRoute(mapId, vo); + } + } + } + private DraftMapWithBLOBs findEntity(Long id) { return draftMapDAO.selectByPrimaryKey(id); } diff --git a/src/main/java/club/joylink/rtss/services/IDraftMapService.java b/src/main/java/club/joylink/rtss/services/IDraftMapService.java index daa6b1467..6bb388256 100644 --- a/src/main/java/club/joylink/rtss/services/IDraftMapService.java +++ b/src/main/java/club/joylink/rtss/services/IDraftMapService.java @@ -416,4 +416,6 @@ public interface IDraftMapService { void updateOperationDefinition(Long mapId, MapDestinationCodeDefinitionVO definitionVO); void updateCheckConfig(Long id, MapCheckConfig checkConfig); + + void handle(Long mapId); } diff --git a/src/main/java/club/joylink/rtss/services/draftData/RailwayRouteGenerator.java b/src/main/java/club/joylink/rtss/services/draftData/RailwayRouteGenerator.java index a042d8b60..fb37e8d46 100644 --- a/src/main/java/club/joylink/rtss/services/draftData/RailwayRouteGenerator.java +++ b/src/main/java/club/joylink/rtss/services/draftData/RailwayRouteGenerator.java @@ -101,6 +101,9 @@ public class RailwayRouteGenerator { querySectionPath(clone, pathList, iter + 1); } else { if (nextSection != null) { + if (!nextSection.equals(trackWay.getEnd())) { + trackWay.addSection(nextSection); + } CommonSwitch belongSwitch = lastSection.getBelongSwitch(); if (belongSwitch != null && belongSwitch.equals(nextSection.getBelongSwitch())) { //同一道岔的区段 if (belongSwitch.isB(lastSection)) { @@ -108,13 +111,11 @@ public class RailwayRouteGenerator { } else { trackWay.addSwitchPosition(belongSwitch, false); } - } else { //应该不会选择道岔区段作为终点区段,所以仅在有可能不是道岔区段的这里判断是否是终点区段 - if (nextSection.equals(trackWay.getEnd())) { - pathList.add(trackWay); - return; - } } - trackWay.addSection(nextSection); + if (nextSection.equals(trackWay.getEnd())) { + pathList.add(trackWay); + return; + } querySectionPath(trackWay, pathList, iter + 1); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java index 448fed19c..e7301da3a 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java @@ -446,9 +446,14 @@ public class Operation { //--------------------------- 大铁CTC操作 --------------------------- /** - * CTC接发车流程 + * CTC接预 */ - CTC_RECEIVING_DEPARTURE_PROCESS, + CTC_RECEIVING_NOTICE, + + /** + * CTC发预 + */ + CTC_DEPARTURE_NOTICE, //---------------------------- 改方、辅助操作 ------------------------- /** diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCLogicLoop.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCLogicLoop.java index 589e0fb08..dac199ba2 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCLogicLoop.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCLogicLoop.java @@ -1,40 +1,74 @@ package club.joylink.rtss.simulation.cbtc.CTC; -import club.joylink.rtss.simulation.cbtc.CTC.data.BusyBoard; +import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.simulation.cbtc.CTC.data.CtcRepository; +import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationPlan; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.constant.SimulationModule; -import club.joylink.rtss.simulation.cbtc.data.map.Station; +import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; +import club.joylink.rtss.simulation.cbtc.data.map.Routing; +import club.joylink.rtss.simulation.cbtc.data.map.Section; +import club.joylink.rtss.simulation.cbtc.data.map.Signal; import club.joylink.rtss.simulation.cbtc.data.plan.StationPlan; import club.joylink.rtss.simulation.cbtc.data.plan.TripPlan; +import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition; +import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo; +import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain; import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; @Component public class CTCLogicLoop { public void run(Simulation simulation) { -// if (!simulation.isPlanRunning()) -// return; - CtcRepository ctcRepository = new CtcRepository(); //添加到simulation中 - if (CollectionUtils.isEmpty(ctcRepository.getStationBusyBoardMap())) { - List allTripPlanList = simulation.getRepository().getAllTripPlanList(); - Map> stationPlanMap = allTripPlanList.stream() - .flatMap(tripPlan -> tripPlan.getPlanList().stream()) - .collect(Collectors.groupingBy(StationPlan::getStation)); - for (Map.Entry> entry : stationPlanMap.entrySet()) { - Station station = entry.getKey(); - List plans = entry.getValue(); - BusyBoard busyBoard = new BusyBoard(); - busyBoard.setStationCode(station.getCode()); - - ctcRepository.addBusyBoard(busyBoard); + SimulationDataRepository repository = simulation.getRepository(); + CtcRepository ctcRepository = simulation.getCtcRepository(); + List superviseTrainList = repository.getSuperviseTrainList(); + for (TrainInfo trainInfo : superviseTrainList) { + if (trainInfo.isPlanTrain()) { + if (ctcRepository.isCtcStationPlanExist(trainInfo.getTripNumber())) { + continue; + } + TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(), trainInfo.getTripNumber()); + VirtualRealityTrain train = repository.getOnlineTrainBy(trainInfo.getGroupNumber()); + SectionPosition headPosition = train.getHeadPosition(); + CtcStationPlan ctcStationPlan = new CtcStationPlan(); + ctcStationPlan.setTripNumber(tripPlan.getTripNumber()); + if (trainInfo.isParking()) { + //接车信息(已完成) + Section headSection = headPosition.getSection(); + StationPlan currentStationPlan = tripPlan.queryStationPlan(headSection); + ctcStationPlan.setReceivingPlan(currentStationPlan); + ctcStationPlan.setReceivingRouteLock(true); + ctcStationPlan.setArrive(true); + //发车信息 + StationPlan nextStationPlan = tripPlan.queryNextStationPlan(headSection); + ctcStationPlan.setDeparturePlan(nextStationPlan); + Signal signal = headSection.getSignalOf(tripPlan.isRight()); + List routings = repository.getRoutings(tripPlan.getStartSection(), tripPlan.getEndSection(), tripPlan.isRight()); + BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertCollectionNotEmpty(routings); + Routing routing = routings.get(0); + } } } + +// CtcRepository ctcRepository = new CtcRepository(); //添加到simulation中 +// if (CollectionUtils.isEmpty(ctcRepository.getStationBusyBoardMap())) { +// List allTripPlanList = simulation.getRepository().getAllTripPlanList(); +// Map> stationPlanMap = allTripPlanList.stream() +// .flatMap(tripPlan -> tripPlan.getPlanList().stream()) +// .collect(Collectors.groupingBy(StationPlan::getStation)); +// for (Map.Entry> entry : stationPlanMap.entrySet()) { +// Station station = entry.getKey(); +// List plans = entry.getValue(); +// BusyBoard busyBoard = new BusyBoard(); +// busyBoard.setStationCode(station.getCode()); +// +// ctcRepository.addBusyBoard(busyBoard); +// } +// } + } public void addJobs(Simulation simulation) { diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCMessagePublisher.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCMessagePublisher.java new file mode 100644 index 000000000..251bab306 --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCMessagePublisher.java @@ -0,0 +1,5 @@ +package club.joylink.rtss.simulation.cbtc.CTC; + +public class CTCMessagePublisher { + +} diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCService.java index ec96bbfd4..22648de04 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCService.java @@ -1,5 +1,6 @@ package club.joylink.rtss.simulation.cbtc.CTC; +import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.simulation.cbtc.CTC.data.CtcRepository; import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationPlan; import club.joylink.rtss.simulation.cbtc.Simulation; @@ -7,12 +8,25 @@ import org.springframework.stereotype.Component; @Component public class CTCService { - + /** + * 接预 + */ public void receivingNotice(Simulation simulation, String stationCode, String tripNumber) { + BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(stationCode); + BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(tripNumber); CtcRepository ctcRepository = simulation.getCtcRepository(); CtcStationPlan ctcStationPlan = ctcRepository.findCtcStationPlan(stationCode, tripNumber); - if (!ctcStationPlan.getCompletedProcess().contains(CtcStationPlan.Process.RECEIVING_NOTICE)) { - ctcStationPlan.addCompletedProcess(CtcStationPlan.Process.RECEIVING_NOTICE); - } + ctcStationPlan.setReceivingNotice(true); + } + + /** + * 发预 + */ + public void departureNotice(Simulation simulation, String stationCode, String tripNumber) { + BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(stationCode); + BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(tripNumber); + CtcRepository ctcRepository = simulation.getCtcRepository(); + CtcStationPlan ctcStationPlan = ctcRepository.findCtcStationPlan(stationCode, tripNumber); + ctcStationPlan.setDepartureNotice(true); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcRepository.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcRepository.java index 774a3818f..07569e2c6 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcRepository.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcRepository.java @@ -25,7 +25,7 @@ public class CtcRepository { } public void addCtcStationPlan(CtcStationPlan stationPlan) { - Map map = ctcStationPlanMap.computeIfAbsent(stationPlan.getStationPlan().getStation().getCode(), + Map map = ctcStationPlanMap.computeIfAbsent(stationPlan.getReceivingPlan().getStation().getCode(), (k) -> new ConcurrentHashMap<>()); map.put(stationPlan.getTripNumber(), stationPlan); } @@ -37,4 +37,9 @@ public class CtcRepository { else return map.get(tripNumber); } + + public boolean isCtcStationPlanExist(String tripNumber) { + return ctcStationPlanMap.entrySet().stream() + .anyMatch(entry -> entry.getValue().containsKey(tripNumber)); + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcStationPlan.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcStationPlan.java index 6540709e1..2bee7f582 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcStationPlan.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcStationPlan.java @@ -1,35 +1,60 @@ package club.joylink.rtss.simulation.cbtc.CTC.data; +import club.joylink.rtss.simulation.cbtc.data.map.Route; import club.joylink.rtss.simulation.cbtc.data.plan.StationPlan; import lombok.Getter; - -import java.util.List; +import lombok.Setter; /** - * 大铁CTC的车站计划 + * 大铁CTC的车站计划(接发车)(对应股道视图的一行) */ @Getter +@Setter public class CtcStationPlan { private String tripNumber; - private StationPlan stationPlan; + /** + * 该车站的接车计划 + */ + private StationPlan receivingPlan; /** - * 已完成的流程 + * 该车站的发车计划 */ - private List completedProcess; + private StationPlan departurePlan; - public void addCompletedProcess(Process process) { - completedProcess.add(process); - } + /** + * 邻站的发车预告 + */ + private boolean adjacentDepartureNotice; + + private boolean receivingNotice; + + private Route receivingRoute; + + /** + * 接车进路办理完成(过) + */ + private boolean receivingRouteLock; + + private boolean arrive; + + private boolean departureNotice; + + private Route departureRoute; + + /** + * 发车进路办理完成(过) + */ + private boolean departureRouteLock; + + private boolean departure; @Getter public enum Process { - RECEIVING_BLOCK(""), //办理接车闭塞 RECEIVING_NOTICE("接预"), //接预 RECEIVING_ROUTE("接路"), //接路 ARRIVE("到点"), //到点 - DEPARTURE_BLOCK(""), //办理发车闭塞 DEPARTURE_NOTICE("发预"), //发预 DEPARTURE_ROUTE("发路"), //发路 DEPARTURE("发点"), //发点 diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackView.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackView.java index 80b0f5c78..9f5f264bf 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackView.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackView.java @@ -10,6 +10,7 @@ import java.util.List; @Getter @Setter public class TrackView { + @Getter @Setter @Builder diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/operation/BusyBoardOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/operation/BusyBoardOperateHandler.java index ab390cec8..ea35b67dc 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/operation/BusyBoardOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/operation/BusyBoardOperateHandler.java @@ -16,11 +16,19 @@ public class BusyBoardOperateHandler { private CTCService ctcService; /** - * CTC接发车流程 + * 接预 */ - @OperateHandlerMapping(type = Operation.Type.CTC_RECEIVING_DEPARTURE_PROCESS) - public void receivingNotice(Simulation simulation, String stationCode, String tripNumber, Process process) { + @OperateHandlerMapping(type = Operation.Type.CTC_RECEIVING_NOTICE) + public void receivingNotice(Simulation simulation, String stationCode, String tripNumber) { ctcService.receivingNotice(simulation, stationCode, tripNumber); } + /** + * 发预 + */ + @OperateHandlerMapping(type = Operation.Type.CTC_DEPARTURE_NOTICE) + public void departureNotice(Simulation simulation, String stationCode, String tripNumber) { + ctcService.departureNotice(simulation, stationCode, tripNumber); + } + } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/build/InterlockBuilder2.java b/src/main/java/club/joylink/rtss/simulation/cbtc/build/InterlockBuilder2.java index a2c111246..858257263 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/build/InterlockBuilder2.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/build/InterlockBuilder2.java @@ -2,14 +2,13 @@ package club.joylink.rtss.simulation.cbtc.build; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.services.draftData.RoutingGenerator; +import club.joylink.rtss.simulation.cbtc.constant.SignalAspect; import club.joylink.rtss.simulation.cbtc.data.CalculateService; import club.joylink.rtss.simulation.cbtc.data.map.*; import club.joylink.rtss.simulation.cbtc.data.support.RoutePath; import club.joylink.rtss.simulation.cbtc.data.support.RouteUnit; -import club.joylink.rtss.vo.map.MapCISwitchVO; -import club.joylink.rtss.vo.map.MapLogicDataNewVO; -import club.joylink.rtss.vo.map.MapRoutingSectionNewVO; -import club.joylink.rtss.vo.map.MapSectionPathVO; +import club.joylink.rtss.vo.map.*; +import club.joylink.rtss.vo.map.graph.MapSignalButtonVO; import club.joylink.rtss.vo.map.logic.*; import lombok.extern.slf4j.Slf4j; import org.springframework.util.CollectionUtils; @@ -26,12 +25,11 @@ import java.util.stream.Collectors; public class InterlockBuilder2 { /** * 校验并构建联锁逻辑数据 - * - * @param logicData - * @param mapDataBuildResult */ - static void checkAndBuildMapCILogicData(MapLogicDataNewVO logicData, - SimulationBuilder.SimulationDeviceBuildResult mapDataBuildResult) { + static void checkAndBuildMapCILogicData(MapVO map, SimulationBuilder.SimulationDeviceBuildResult mapDataBuildResult) { + MapLogicDataNewVO logicData = map.getLogicDataNew(); + MapGraphDataNewVO graphData = map.getGraphDataNew(); + Map elementMap = mapDataBuildResult.getDeviceMap(); List errMsgList = mapDataBuildResult.getErrMsgList(); // ------------侧防start------------- @@ -48,9 +46,12 @@ public class InterlockBuilder2 { // 接近区段 buildApproachSections(logicData, elementMap, errMsgList); // ------------进路start------------- - long routeStart = System.currentTimeMillis(); - buildRoute(logicData, elementMap, errMsgList, flsMap); - log.debug("构建进路耗时:" + (System.currentTimeMillis() - routeStart)); + List routeList = logicData.getRouteList(); + if (!CollectionUtils.isEmpty(routeList) && !CollectionUtils.isEmpty(routeList.get(0).getBtnCodeList())) { + buildRailRoute(graphData, logicData, elementMap, errMsgList, flsMap); + } else { + buildRoute(logicData, elementMap, errMsgList, flsMap); + } // ------------进路end------------- // ------------自动信号start------------- @@ -250,6 +251,102 @@ public class InterlockBuilder2 { // buildParkTimes(logicData, elementMap, mapDataBuildResult.getParkTimeMap(), errMsgList); } + /** + * 从大铁数据构建 + */ + private static void buildRailRoute(MapGraphDataNewVO graphData, MapLogicDataNewVO logicData, Map elementMap, List errMsgList, Map flsMap) { + Map signalButtonMap = graphData.getSignalButtonList().stream() + .collect(Collectors.toMap(MapSignalButtonVO::getCode, Function.identity())); + List routeList = logicData.getRouteList(); + Map routeMap = new HashMap<>(); + for (MapRouteNewVO routeVO : routeList) { + if (routeVO.isMultiRoute()) { + continue; + } + BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue(routeMap.containsKey(routeVO.getCode()), + String.format("存在code重复的进路:[%s]", routeVO.getCode())); + Route route = new Route(routeVO.getCode(), routeVO.getName()); + routeMap.put(route.getCode(), route); + route.setTurnBack(routeVO.isTurnBack()); + route.setAtp(routeVO.isAtp()); + route.setGround(routeVO.isGround()); + route.setGuide(routeVO.isGuide()); + route.setArs(routeVO.isArc()); + route.setFlt(routeVO.isFlt()); + Signal start = (Signal) elementMap.get(routeVO.getStartSignalCode()); + BusinessExceptionAssertEnum.DATA_ERROR.assertNotNull(start, + String.format("进路[%s]的始端信号机[%s]不存在", routeVO.getId(), routeVO.getStartSignalCode())); + route.setStart(start); + start.getRouteList().add(route); + for (String bntCode : routeVO.getBtnCodeList()) { + Signal end; + MapSignalButtonVO signalButton = signalButtonMap.get(bntCode); + if (signalButton != null) { + String signalCode = signalButton.getSignalCode(); + end = (Signal) elementMap.get(signalCode); + } else { //选的是信号机 + end = (Signal) elementMap.get(bntCode); + } + if (end.equals(start)) { + route.setDestination(end); + break; + } + } + SignalAspect aspect = null; + switch (routeVO.getSignalAspect()) { + case 1: + aspect = SignalAspect.R; + break; + case 2: + aspect = SignalAspect.G; + break; + case 3: + aspect = SignalAspect.Y; + break; + case 4: + aspect = SignalAspect.RY; + break; + case 5: + aspect = SignalAspect.GG; + break; + case 6: + aspect = SignalAspect.GY; + break; + case 7: + aspect = SignalAspect.YY; + break; + case 11: + aspect = SignalAspect.W; + break; + default: + errMsgList.add(String.format("未知的信号显示[%s]", routeVO.getSignalAspect())); + } + route.setAspect(aspect); + List
sections = routeVO.getRouteSectionList().stream() + .map(sectionCode -> (Section) elementMap.get(sectionCode)) + .collect(Collectors.toList()); + route.setSectionList(sections); + List routeSwitchList = routeVO.getRouteSwitchList().stream().map(switchEle -> { + Switch aSwitch = (Switch) elementMap.get(switchEle.getSwitchCode()); + return new SwitchElement(aSwitch, switchEle.isNormal()); + }).collect(Collectors.toList()); + route.setSwitchList(routeSwitchList); + List flsListVO = routeVO.getFlsList(); + if (!CollectionUtils.isEmpty(flsListVO)) { + List flsList = flsListVO.stream().map(flsMap::get).collect(Collectors.toList()); + route.setFlsList(flsList); + } + } + for (MapRouteNewVO routeVO : routeList) { + Route route = routeMap.get(routeVO.getCode()); + if (!CollectionUtils.isEmpty(routeVO.getConflictRouteList())) { + List conflictRoutes = routeVO.getConflictRouteList().stream() + .map(routeMap::get).collect(Collectors.toList()); + route.setConflictingRouteList(conflictRoutes); + } + } + } + private static void buildParkTimes(MapLogicDataNewVO logicData, Map elementMap, Map parkTimeMap, List errMsgList) { List vos = logicData.getParkingTimeList(); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/build/MapDeviceBuilder.java b/src/main/java/club/joylink/rtss/simulation/cbtc/build/MapDeviceBuilder.java index e49d30756..7d5260c76 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/build/MapDeviceBuilder.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/build/MapDeviceBuilder.java @@ -423,7 +423,7 @@ public class MapDeviceBuilder { !(Objects.nonNull(section.getRightSection()) && section.getRightSection().isTurnBackTrack() && Objects.nonNull(section.getRightSection().getSignalToRight()))) { - errMsgList.add(String.format("区段[%s(%s)]是折返轨,右向信号机却不存在存在", + errMsgList.add(String.format("区段[%s(%s)]是折返轨,右向信号机却不存在", section.getName(), section.getCode())); } if (Objects.isNull(section.getSignalToLeft()) && @@ -432,7 +432,7 @@ public class MapDeviceBuilder { !(Objects.nonNull(section.getLeftSection()) && section.getLeftSection().isTurnBackTrack() && Objects.nonNull(section.getLeftSection().getSignalToLeft()))) { - errMsgList.add(String.format("区段[%s(%s)]是折返轨,左向信号机却不存在存在", + errMsgList.add(String.format("区段[%s(%s)]是折返轨,左向信号机却不存在", section.getName(), section.getCode())); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/build/SimulationBuilder.java b/src/main/java/club/joylink/rtss/simulation/cbtc/build/SimulationBuilder.java index 417261152..f536d6616 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/build/SimulationBuilder.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/build/SimulationBuilder.java @@ -429,7 +429,7 @@ public class SimulationBuilder { MapDeviceBuilder.checkAndBuildMapDeviceData(map.getGraphDataNew(), mapDataBuildResult); if (CollectionUtils.isEmpty(mapDataBuildResult.getErrMsgList())) { // 基础数据没有问题,再构建逻辑数据 // InterlockBuilder.checkAndBuildMapCILogicData(map.getLogicDataNew(), mapDataBuildResult); - InterlockBuilder2.checkAndBuildMapCILogicData(map.getLogicDataNew(), mapDataBuildResult); + InterlockBuilder2.checkAndBuildMapCILogicData(map, mapDataBuildResult); List parkingTimeList = map.getLogicDataNew().getParkingTimeList(); if (CollectionUtils.isEmpty(parkingTimeList)) { mapDataBuildResult.errMsgList.add("无停站时间数据"); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/build/UserConfigDataBuilder.java b/src/main/java/club/joylink/rtss/simulation/cbtc/build/UserConfigDataBuilder.java index 6d562693f..e3aba7ebf 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/build/UserConfigDataBuilder.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/build/UserConfigDataBuilder.java @@ -7,9 +7,9 @@ import club.joylink.rtss.simulation.cbtc.data.map.StationParkTime; import club.joylink.rtss.simulation.cbtc.data.map.StationRunLevel; import club.joylink.rtss.vo.client.runplan.user.RunPlanParkingTimeVO; import club.joylink.rtss.vo.client.runplan.user.RunPlanRunlevelVO; +import club.joylink.rtss.vo.map.MapVO; import club.joylink.rtss.vo.map.logic.MapStationParkingTimeVO; import club.joylink.rtss.vo.map.logic.MapStationRunLevelVO; -import club.joylink.rtss.vo.map.MapVO; import org.springframework.util.CollectionUtils; import java.util.HashMap; @@ -28,8 +28,10 @@ public class UserConfigDataBuilder { Function.identity())); } List runLevelList = map.getLogicDataNew().getRunLevelList(); - if (CollectionUtils.isEmpty(runLevelList)) { - errMsgList.add("无默认运行等级数据"); + if (!repository.getConfig().isHasCTC()) { + if (CollectionUtils.isEmpty(runLevelList)) { + errMsgList.add("无默认运行等级数据"); + } } for (MapStationRunLevelVO vo : runLevelList) { String key = StationRunLevel.buildKey(vo.getStartSectionCode(), vo.getEndSectionCode()); @@ -66,8 +68,10 @@ public class UserConfigDataBuilder { .collect(Collectors.toMap(RunPlanParkingTimeVO::getSectionCode, Function.identity())); } List parkingTimeList = map.getLogicDataNew().getParkingTimeList(); - if (CollectionUtils.isEmpty(parkingTimeList)) { - errMsgList.add("无默认停站时间数据"); + if (!repository.getConfig().isHasCTC()) { + if (CollectionUtils.isEmpty(parkingTimeList)) { + errMsgList.add("无默认停站时间数据"); + } } for (MapStationParkingTimeVO vo : parkingTimeList) { voMap.putIfAbsent(vo.getSectionCode(), new RunPlanParkingTimeVO(vo)); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/SimulationDataRepository.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/SimulationDataRepository.java index e8fe378b8..570f8eb7e 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/SimulationDataRepository.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/SimulationDataRepository.java @@ -887,6 +887,14 @@ public class SimulationDataRepository { return this.getRoutingList().stream().filter(routing -> destinationCode.equals(routing.getDestinationCode())).collect(Collectors.toList()); } + public List getRoutings(Section start, Section end, boolean right) { + return routingList.stream() + .filter(routing -> Objects.equals(start, routing.getStartSection())) + .filter(routing -> Objects.equals(end, routing.getEndSection())) + .filter(routing -> Objects.equals(right, routing.isRight())) + .collect(Collectors.toList()); + } + public List queryRouteByEndSignal(Signal end) { List routeList = new ArrayList<>(); for (Route route : this.getRouteList()) { 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 5ed8fd813..9eddb232e 100644 --- a/src/main/java/club/joylink/rtss/vo/client/WebSocketMessageType.java +++ b/src/main/java/club/joylink/rtss/vo/client/WebSocketMessageType.java @@ -47,6 +47,8 @@ public enum WebSocketMessageType { /** 仿真-设备状态消息 */ Simulation_DeviceStatus, + /** CTC系统的状态消息 */ + Simulation_CtcStatus, /** 仿真-IBP状态消息 */ Simulation_IbpStatus, /** 仿真-PSL盘状态消息 */