大铁进路生成逻辑修改;大铁CTC(未完)
This commit is contained in:
parent
61ba7c0e3d
commit
a5f787c0f4
@ -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);
|
||||
// }
|
||||
}
|
||||
|
@ -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<DraftMapVO> 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<DraftMapRoute> routes = draftMapRouteDAO.selectByExampleWithBLOBs(example);
|
||||
draftMapRouteDAO.deleteByExample(example);
|
||||
|
||||
List<MapRouteNewVO> 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);
|
||||
}
|
||||
|
@ -416,4 +416,6 @@ public interface IDraftMapService {
|
||||
void updateOperationDefinition(Long mapId, MapDestinationCodeDefinitionVO definitionVO);
|
||||
|
||||
void updateCheckConfig(Long id, MapCheckConfig checkConfig);
|
||||
|
||||
void handle(Long mapId);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -446,9 +446,14 @@ public class Operation {
|
||||
|
||||
//--------------------------- 大铁CTC操作 ---------------------------
|
||||
/**
|
||||
* CTC接发车流程
|
||||
* CTC接预
|
||||
*/
|
||||
CTC_RECEIVING_DEPARTURE_PROCESS,
|
||||
CTC_RECEIVING_NOTICE,
|
||||
|
||||
/**
|
||||
* CTC发预
|
||||
*/
|
||||
CTC_DEPARTURE_NOTICE,
|
||||
|
||||
//---------------------------- 改方、辅助操作 -------------------------
|
||||
/**
|
||||
|
@ -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<TripPlan> allTripPlanList = simulation.getRepository().getAllTripPlanList();
|
||||
Map<Station, List<StationPlan>> stationPlanMap = allTripPlanList.stream()
|
||||
.flatMap(tripPlan -> tripPlan.getPlanList().stream())
|
||||
.collect(Collectors.groupingBy(StationPlan::getStation));
|
||||
for (Map.Entry<Station, List<StationPlan>> entry : stationPlanMap.entrySet()) {
|
||||
Station station = entry.getKey();
|
||||
List<StationPlan> plans = entry.getValue();
|
||||
BusyBoard busyBoard = new BusyBoard();
|
||||
busyBoard.setStationCode(station.getCode());
|
||||
|
||||
ctcRepository.addBusyBoard(busyBoard);
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
CtcRepository ctcRepository = simulation.getCtcRepository();
|
||||
List<TrainInfo> 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<Routing> 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<TripPlan> allTripPlanList = simulation.getRepository().getAllTripPlanList();
|
||||
// Map<Station, List<StationPlan>> stationPlanMap = allTripPlanList.stream()
|
||||
// .flatMap(tripPlan -> tripPlan.getPlanList().stream())
|
||||
// .collect(Collectors.groupingBy(StationPlan::getStation));
|
||||
// for (Map.Entry<Station, List<StationPlan>> entry : stationPlanMap.entrySet()) {
|
||||
// Station station = entry.getKey();
|
||||
// List<StationPlan> plans = entry.getValue();
|
||||
// BusyBoard busyBoard = new BusyBoard();
|
||||
// busyBoard.setStationCode(station.getCode());
|
||||
//
|
||||
// ctcRepository.addBusyBoard(busyBoard);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
public void addJobs(Simulation simulation) {
|
||||
|
@ -0,0 +1,5 @@
|
||||
package club.joylink.rtss.simulation.cbtc.CTC;
|
||||
|
||||
public class CTCMessagePublisher {
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public class CtcRepository {
|
||||
}
|
||||
|
||||
public void addCtcStationPlan(CtcStationPlan stationPlan) {
|
||||
Map<String, CtcStationPlan> map = ctcStationPlanMap.computeIfAbsent(stationPlan.getStationPlan().getStation().getCode(),
|
||||
Map<String, CtcStationPlan> 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));
|
||||
}
|
||||
}
|
||||
|
@ -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<Process> 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("发点"), //发点
|
||||
|
@ -10,6 +10,7 @@ import java.util.List;
|
||||
@Getter
|
||||
@Setter
|
||||
public class TrackView {
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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<String, MapElement> elementMap = mapDataBuildResult.getDeviceMap();
|
||||
List<String> 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<MapRouteNewVO> 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<String, MapElement> elementMap, List<String> errMsgList, Map<String, RouteFls> flsMap) {
|
||||
Map<String, MapSignalButtonVO> signalButtonMap = graphData.getSignalButtonList().stream()
|
||||
.collect(Collectors.toMap(MapSignalButtonVO::getCode, Function.identity()));
|
||||
List<MapRouteNewVO> routeList = logicData.getRouteList();
|
||||
Map<String, Route> 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<Section> sections = routeVO.getRouteSectionList().stream()
|
||||
.map(sectionCode -> (Section) elementMap.get(sectionCode))
|
||||
.collect(Collectors.toList());
|
||||
route.setSectionList(sections);
|
||||
List<SwitchElement> 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<String> flsListVO = routeVO.getFlsList();
|
||||
if (!CollectionUtils.isEmpty(flsListVO)) {
|
||||
List<RouteFls> 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<Route> conflictRoutes = routeVO.getConflictRouteList().stream()
|
||||
.map(routeMap::get).collect(Collectors.toList());
|
||||
route.setConflictingRouteList(conflictRoutes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void buildParkTimes(MapLogicDataNewVO logicData, Map<String, MapElement> elementMap, Map<String, StationParkTime> parkTimeMap,
|
||||
List<String> errMsgList) {
|
||||
List<MapStationParkingTimeVO> vos = logicData.getParkingTimeList();
|
||||
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
@ -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<MapStationParkingTimeVO> parkingTimeList = map.getLogicDataNew().getParkingTimeList();
|
||||
if (CollectionUtils.isEmpty(parkingTimeList)) {
|
||||
mapDataBuildResult.errMsgList.add("无停站时间数据");
|
||||
|
@ -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<MapStationRunLevelVO> 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<MapStationParkingTimeVO> 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));
|
||||
|
@ -887,6 +887,14 @@ public class SimulationDataRepository {
|
||||
return this.getRoutingList().stream().filter(routing -> destinationCode.equals(routing.getDestinationCode())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<Routing> 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<Route> queryRouteByEndSignal(Signal end) {
|
||||
List<Route> routeList = new ArrayList<>();
|
||||
for (Route route : this.getRouteList()) {
|
||||
|
@ -47,6 +47,8 @@ public enum WebSocketMessageType {
|
||||
|
||||
/** 仿真-设备状态消息 */
|
||||
Simulation_DeviceStatus,
|
||||
/** CTC系统的状态消息 */
|
||||
Simulation_CtcStatus,
|
||||
/** 仿真-IBP状态消息 */
|
||||
Simulation_IbpStatus,
|
||||
/** 仿真-PSL盘状态消息 */
|
||||
|
Loading…
Reference in New Issue
Block a user