【指示灯、操作按钮】初始化
Signed-off-by: weizhihong <weizhihong@joylink.club>
This commit is contained in:
parent
81c9ceb2aa
commit
4a3e4d985a
@ -5,11 +5,33 @@ package club.joylink.rtss.constants;
|
||||
*/
|
||||
public enum ButtonTypeEnum {
|
||||
// 总辅助
|
||||
MAIN,
|
||||
MAIN_ASSIST,
|
||||
// 接辅助
|
||||
RECEIVE,
|
||||
RECEIVE_ASSIST,
|
||||
// 发辅助
|
||||
DELIVER,
|
||||
DELIVER_ASSIST,
|
||||
// 改方
|
||||
CHANGE_DIRECTION
|
||||
CHANGE_DIRECTION,
|
||||
NO;
|
||||
|
||||
/**
|
||||
* 获取枚举信息
|
||||
*
|
||||
* @param type 类型
|
||||
* @return 枚举
|
||||
*/
|
||||
public static ButtonTypeEnum getType(String type) {
|
||||
switch (type) {
|
||||
case "main_assist":
|
||||
return ButtonTypeEnum.MAIN_ASSIST;
|
||||
case "deliver_assist":
|
||||
return ButtonTypeEnum.DELIVER_ASSIST;
|
||||
case "receive_assist":
|
||||
return ButtonTypeEnum.RECEIVE_ASSIST;
|
||||
case "change_direction":
|
||||
return ButtonTypeEnum.CHANGE_DIRECTION;
|
||||
default:
|
||||
return ButtonTypeEnum.NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,5 +11,22 @@ public enum IndicatorTypeEnum {
|
||||
// 区间
|
||||
SECTION,
|
||||
// 辅助
|
||||
ASSIST
|
||||
ASSIST,
|
||||
// 无类型
|
||||
NO;
|
||||
|
||||
public static IndicatorTypeEnum getType(String type) {
|
||||
switch (type) {
|
||||
case "receive":
|
||||
return IndicatorTypeEnum.RECEIVE;
|
||||
case "deliver":
|
||||
return IndicatorTypeEnum.DELIVER;
|
||||
case "section":
|
||||
return IndicatorTypeEnum.SECTION;
|
||||
case "assist":
|
||||
return IndicatorTypeEnum.ASSIST;
|
||||
default:
|
||||
return IndicatorTypeEnum.NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,4 +43,9 @@ public class ButtonStand {
|
||||
* 上一个站台
|
||||
*/
|
||||
private String preStandCode;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private String type;
|
||||
}
|
||||
|
@ -62,6 +62,11 @@ public class IndicatorSection {
|
||||
*/
|
||||
private String routeCode;
|
||||
|
||||
/**
|
||||
* 灯类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
public void generateSectionList() {
|
||||
if (StringUtils.isEmpty(sectionsCode)) {
|
||||
sectionList = new ArrayList<>(0);
|
||||
|
@ -15,6 +15,8 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class AssistButtonIndicatorService implements IAssistButtonIndicatorService {
|
||||
|
||||
@ -73,6 +75,14 @@ public class AssistButtonIndicatorService implements IAssistButtonIndicatorServi
|
||||
assistIndicatorDAO.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IndicatorSection> queryAllIndicatorSectionByMapId(Long mapId) {
|
||||
IndicatorSectionExample indicatorSectionExample = new IndicatorSectionExample();
|
||||
IndicatorSectionExample.Criteria criteria = indicatorSectionExample.createCriteria();
|
||||
criteria.andMapIdEqualTo(mapId);
|
||||
return assistIndicatorDAO.selectByExample(indicatorSectionExample);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageVO<ButtonStand> buttonStandList(Long mapId, String standCode, String buttonCode, PageQueryVO queryVO) {
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
@ -112,4 +122,12 @@ public class AssistButtonIndicatorService implements IAssistButtonIndicatorServi
|
||||
public void deleteButtonStand(Long id) {
|
||||
assistButtonDAO.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ButtonStand> queryAllButtonStandByMapId(Long mapId) {
|
||||
ButtonStandExample buttonStandExample = new ButtonStandExample();
|
||||
ButtonStandExample.Criteria criteria = buttonStandExample.createCriteria();
|
||||
criteria.andMapIdEqualTo(mapId);
|
||||
return assistButtonDAO.selectByExample(buttonStandExample);
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ import club.joylink.rtss.entity.IndicatorSection;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IAssistButtonIndicatorService {
|
||||
|
||||
/**
|
||||
@ -45,6 +47,13 @@ public interface IAssistButtonIndicatorService {
|
||||
*/
|
||||
void deleteIndicatorSection(Long id);
|
||||
|
||||
/**
|
||||
* 查找该地图下的指示灯、区间、站台、进路关系信息列表
|
||||
*
|
||||
* @param mapId 地图Id
|
||||
* @return 关系列表
|
||||
*/
|
||||
List<IndicatorSection> queryAllIndicatorSectionByMapId(Long mapId);
|
||||
|
||||
/**
|
||||
* 查找该地图下的按钮、站台关系信息列表
|
||||
@ -79,4 +88,12 @@ public interface IAssistButtonIndicatorService {
|
||||
* @param id 关系ID
|
||||
*/
|
||||
void deleteButtonStand(Long id);
|
||||
|
||||
/**
|
||||
* 查找该地图下所有的按钮关联信息
|
||||
*
|
||||
* @param mapId 地图信息
|
||||
* @return 关联关系
|
||||
*/
|
||||
List<ButtonStand> queryAllButtonStandByMapId(Long mapId);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package club.joylink.rtss.services.draftData;
|
||||
|
||||
import club.joylink.rtss.dao.*;
|
||||
import club.joylink.rtss.entity.*;
|
||||
import club.joylink.rtss.services.IAssistButtonIndicatorService;
|
||||
import club.joylink.rtss.util.JsonUtils;
|
||||
import club.joylink.rtss.vo.map.MapLogicDataNewVO;
|
||||
import club.joylink.rtss.vo.map.MapVO;
|
||||
@ -53,6 +54,9 @@ public class DraftMapServiceImpl implements DraftMapService {
|
||||
@Autowired
|
||||
private DraftMapSignalApproachSectionService draftMapSignalApproachSectionService;
|
||||
|
||||
@Autowired
|
||||
private IAssistButtonIndicatorService assistButtonIndicatorService;
|
||||
|
||||
@Override
|
||||
public MapVO getDraftMapData(Long mapId) {
|
||||
DraftMapWithBLOBs draftMap = this.draftMapDAO.selectByPrimaryKey(mapId);
|
||||
@ -75,6 +79,11 @@ public class DraftMapServiceImpl implements DraftMapService {
|
||||
// logicDataNew.setAutoReentryList(); 待补
|
||||
// logicDataNew.setRoutingList(); 待补
|
||||
logicDataNew.setSignalApproachSectionList(draftMapSignalApproachSectionService.queryAll(mapId));
|
||||
|
||||
// 获取指示灯、按钮等关联关系
|
||||
logicDataNew.setIndicatorSectionVOList(assistButtonIndicatorService.queryAllIndicatorSectionByMapId(mapId));
|
||||
logicDataNew.setButtonStandVOList(assistButtonIndicatorService.queryAllButtonStandByMapId(mapId));
|
||||
|
||||
map.setLogicDataNew(logicDataNew);
|
||||
return map;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
@ -66,11 +67,7 @@ public class AssistService {
|
||||
public void refreshSectionLightStatus(Simulation simulation, IndicatorSection indicatorSectionVO) {
|
||||
Indicator indicator = simulation.getRepository().getByCode(indicatorSectionVO.getIndicatorCode(), Indicator.class);
|
||||
// 是否被占用,TRUE 占用,FALSE 未占用
|
||||
boolean isOccupied = indicatorSectionVO.getSectionList()
|
||||
.stream()
|
||||
.filter(code -> simulation.getRepository().getByCode(code, Section.class).isCtOccupied())
|
||||
.findAny()
|
||||
.isEmpty();
|
||||
boolean isOccupied = indicator.getSectionList().stream().filter(Section::isCtOccupied).findAny().isEmpty();
|
||||
if (isOccupied) {
|
||||
// 修改区间灯为红色
|
||||
indicator.setAspect(IndicatorStatusEnum.R);
|
||||
@ -97,12 +94,12 @@ public class AssistService {
|
||||
deliverIndicator.setAspect(IndicatorStatusEnum.G);
|
||||
} else {
|
||||
// 接车进路
|
||||
Route receiveRoute = simulation.getRepository().getSettingRouteMap().get(receiveIndicator.getRoute().getCode());
|
||||
Route receiveRoute = receiveIndicator.getRoute();
|
||||
// 发车进路
|
||||
Route deliverRoute = simulation.getRepository().getSettingRouteMap().get(receiveIndicator.getRoute().getCode());
|
||||
Route deliverRoute = deliverIndicator.getRoute();
|
||||
// 两个进路都锁闭存在问题
|
||||
if (receiveRoute.isLock() && deliverRoute.isLock()) {
|
||||
throw new SimulationException(SimulationExceptionType.System_Fault, "操作异常:进路存在问题");
|
||||
throw new SimulationException(SimulationExceptionType.System_Fault, "操作异常:进路锁闭");
|
||||
} else if (receiveRoute.isLock() && !deliverRoute.isLock()) { // 亮接、灭发
|
||||
receiveIndicator.setAspect(IndicatorStatusEnum.Y);
|
||||
deliverIndicator.setAspect(IndicatorStatusEnum.No);
|
||||
@ -120,10 +117,11 @@ public class AssistService {
|
||||
* 改方按钮按下校验
|
||||
*/
|
||||
public ButtonValidInterface turnDirectionPressDownValid = (simulation, button) -> {
|
||||
List<Station> stationList = simulation.getRepository().getStationList();
|
||||
// 当前站位置
|
||||
int index = simulation.getRepository().getStationList().indexOf(button.getStation());
|
||||
int index = stationList.indexOf(button.getStation());
|
||||
// 检查是否是首站
|
||||
if (index == 0 || index == simulation.getRepository().getSectionList().size() - 1) {
|
||||
if (index == 0 || index == stationList.size() - 1) {
|
||||
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:首站不可改方");
|
||||
}
|
||||
// 获取区间指示灯
|
||||
|
@ -1,5 +1,9 @@
|
||||
package club.joylink.rtss.simulation.cbtc.build;
|
||||
|
||||
import club.joylink.rtss.constants.ButtonTypeEnum;
|
||||
import club.joylink.rtss.constants.IndicatorTypeEnum;
|
||||
import club.joylink.rtss.entity.ButtonStand;
|
||||
import club.joylink.rtss.entity.IndicatorSection;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.draftData.RoutingGenerator;
|
||||
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
|
||||
@ -35,22 +39,22 @@ public class InterlockBuilder2 {
|
||||
Map<String, MapElement> elementMap = mapDataBuildResult.getDeviceMap();
|
||||
List<String> errMsgList = mapDataBuildResult.getErrMsgList();
|
||||
// ------------侧防start-------------
|
||||
Map<String, RouteFls> flsMap = checkAndBuildRouteFls(logicData.getFlankProtectionList(), elementMap);
|
||||
Map<String, RouteFls> flsMap = InterlockBuilder2.checkAndBuildRouteFls(logicData.getFlankProtectionList(), elementMap);
|
||||
// ------------侧防end-------------
|
||||
|
||||
// ------------延续保护start-------------
|
||||
long overlapStart = System.currentTimeMillis();
|
||||
buildOverlap(logicData, elementMap, errMsgList, flsMap);
|
||||
log.debug("构建延续保护耗时:" + (System.currentTimeMillis() - overlapStart));
|
||||
InterlockBuilder2.buildOverlap(logicData, elementMap, errMsgList, flsMap);
|
||||
InterlockBuilder2.log.debug("构建延续保护耗时:" + (System.currentTimeMillis() - overlapStart));
|
||||
// ------------延续保护end-------------
|
||||
//超限区段
|
||||
buildOverrun(logicData.getOverrunList(), elementMap, errMsgList);
|
||||
InterlockBuilder2.buildOverrun(logicData.getOverrunList(), elementMap, errMsgList);
|
||||
// 接近区段
|
||||
buildApproachSections(logicData, elementMap, errMsgList);
|
||||
InterlockBuilder2.buildApproachSections(logicData, elementMap, errMsgList);
|
||||
// ------------进路start-------------
|
||||
long routeStart = System.currentTimeMillis();
|
||||
buildRoute(logicData, elementMap, errMsgList, flsMap);
|
||||
log.debug("构建进路耗时:" + (System.currentTimeMillis() - routeStart));
|
||||
InterlockBuilder2.buildRoute(logicData, elementMap, errMsgList, flsMap);
|
||||
InterlockBuilder2.log.debug("构建进路耗时:" + (System.currentTimeMillis() - routeStart));
|
||||
// ------------进路end-------------
|
||||
|
||||
// ------------自动信号start-------------
|
||||
@ -224,30 +228,35 @@ public class InterlockBuilder2 {
|
||||
}
|
||||
// ------------自动折返进路end-------------
|
||||
|
||||
checkBetweenRouteSameDirectionSignal(elementMap, errMsgList);
|
||||
InterlockBuilder2.checkBetweenRouteSameDirectionSignal(elementMap, errMsgList);
|
||||
|
||||
// ------------交路start-------------
|
||||
List<Routing> routingList = checkAndBuildRouting(logicData.getRoutingList(), elementMap, errMsgList);
|
||||
List<Routing> routingList = InterlockBuilder2.checkAndBuildRouting(logicData.getRoutingList(), elementMap, errMsgList);
|
||||
mapDataBuildResult.setRoutingList(routingList);
|
||||
// ------------交路end-------------
|
||||
|
||||
// ------------站间运行等级start-------------
|
||||
List<StationRunLevel> stationRunLevelList = checkAndBuildStationRunLevel(logicData.getRunLevelList(), elementMap, errMsgList);
|
||||
List<StationRunLevel> stationRunLevelList = InterlockBuilder2.checkAndBuildStationRunLevel(logicData.getRunLevelList(), elementMap, errMsgList);
|
||||
mapDataBuildResult.setRunLevelList(stationRunLevelList);
|
||||
// ------------站间运行等级end-------------
|
||||
|
||||
// ------------目的地码start-------------
|
||||
long start = System.currentTimeMillis();
|
||||
checkAndBuildDestinationCodeDefinition(elementMap, logicData.getDestinationCodeDefinitionList(), mapDataBuildResult.getDestinationMap(), errMsgList);
|
||||
log.info("目的地码构建耗时:" + (System.currentTimeMillis() - start));
|
||||
InterlockBuilder2.checkAndBuildDestinationCodeDefinition(elementMap, logicData.getDestinationCodeDefinitionList(), mapDataBuildResult.getDestinationMap(), errMsgList);
|
||||
InterlockBuilder2.log.info("目的地码构建耗时:" + (System.currentTimeMillis() - start));
|
||||
// ------------目的地码end-------------
|
||||
|
||||
// 根据站间运行等级数据构建路径单元
|
||||
if (!errMsgList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
buildRoutePathFromStationRunLevel(stationRunLevelList, mapDataBuildResult, errMsgList);
|
||||
InterlockBuilder2.buildRoutePathFromStationRunLevel(stationRunLevelList, mapDataBuildResult, errMsgList);
|
||||
// buildParkTimes(logicData, elementMap, mapDataBuildResult.getParkTimeMap(), errMsgList);
|
||||
|
||||
// 处理指示灯逻辑信息
|
||||
InterlockBuilder2.buildAssistIndicatorLogic(elementMap, errMsgList, logicData.getIndicatorSectionVOList());
|
||||
// 处理按钮逻辑信息
|
||||
InterlockBuilder2.buildAssistButtonLogic(elementMap, errMsgList, logicData.getButtonStandVOList());
|
||||
}
|
||||
|
||||
private static void buildParkTimes(MapLogicDataNewVO logicData, Map<String, MapElement> elementMap, Map<String, StationParkTime> parkTimeMap,
|
||||
@ -317,7 +326,7 @@ public class InterlockBuilder2 {
|
||||
}
|
||||
MapSectionPathVO sectionPathVO = new MapSectionPathVO(route.getStart().isRight(), mapRouteVO.getRouteSectionList(), mapRouteVO.getRouteSwitchList());
|
||||
List<String> errorList = new ArrayList<>();
|
||||
SectionPath sectionPath = checkAndBuildSectionPath(sectionPathVO, elementMap, errorList);
|
||||
SectionPath sectionPath = InterlockBuilder2.checkAndBuildSectionPath(sectionPathVO, elementMap, errorList);
|
||||
for (String msg : errorList) {
|
||||
errMsgList.add(String.format("进路[%s(%s)]内区段路径数据异常:%s",
|
||||
route.getName(), route.getCode(), msg));
|
||||
@ -446,7 +455,7 @@ public class InterlockBuilder2 {
|
||||
signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
for (MapSectionPathVO sectionPathVO : sectionPathVOList) {
|
||||
SectionPath sectionPath = checkAndBuildSectionPath(sectionPathVO, elementMap, errMsgList);
|
||||
SectionPath sectionPath = InterlockBuilder2.checkAndBuildSectionPath(sectionPathVO, elementMap, errMsgList);
|
||||
sectionPathList.add(sectionPath);
|
||||
}
|
||||
signal.setApproachPathList(sectionPathList);
|
||||
@ -492,7 +501,7 @@ public class InterlockBuilder2 {
|
||||
if (!CollectionUtils.isEmpty(pathVOList)) {
|
||||
for (MapSectionPathVO sectionPathVO : pathVOList) {
|
||||
List<String> errorList = new ArrayList<>();
|
||||
SectionPath sectionPath = checkAndBuildSectionPath(sectionPathVO, elementMap, errorList);
|
||||
SectionPath sectionPath = InterlockBuilder2.checkAndBuildSectionPath(sectionPathVO, elementMap, errorList);
|
||||
for (String errmsg : errorList) {
|
||||
errMsgList.add(String.format("延续保护[%s(%s)]区段数据异常:%s",
|
||||
routeOverlap.getName(), routeOverlap.getCode(), errmsg));
|
||||
@ -517,7 +526,7 @@ public class InterlockBuilder2 {
|
||||
if (!CollectionUtils.isEmpty(triggerPathVOList)) {
|
||||
for (MapSectionPathVO sectionPathVO : triggerPathVOList) {
|
||||
List<String> errorList = new ArrayList<>();
|
||||
SectionPath sectionPath = checkAndBuildSectionPath(sectionPathVO, elementMap, errorList);
|
||||
SectionPath sectionPath = InterlockBuilder2.checkAndBuildSectionPath(sectionPathVO, elementMap, errorList);
|
||||
for (String errmsg : errorList) {
|
||||
errMsgList.add(String.format("延续保护[%s(%s)]触发区段数据异常:%s",
|
||||
routeOverlap.getName(), routeOverlap.getCode(), errmsg));
|
||||
@ -569,13 +578,13 @@ public class InterlockBuilder2 {
|
||||
Map<String, RouteFls> map = new HashMap<>();
|
||||
for (MapRouteFlankProtectionNewVO fpVO : flankProtectionList) {
|
||||
RouteFls routeFls = new RouteFls(fpVO.getCode(), new SwitchElement((Switch) elementMap.get(fpVO.getSource().getSwitchCode()), fpVO.getSource().isNormal()));
|
||||
List<RouteFls.FlsElement> level1List = checkAndBuildFlsElementList(fpVO.getLevel1List(), elementMap);
|
||||
List<RouteFls.FlsElement> level1List = InterlockBuilder2.checkAndBuildFlsElementList(fpVO.getLevel1List(), elementMap);
|
||||
routeFls.setLevel1List(level1List);
|
||||
List<RouteFls.FlsElement> level2List = checkAndBuildFlsElementList(fpVO.getLevel2List(), elementMap);
|
||||
List<RouteFls.FlsElement> level2List = InterlockBuilder2.checkAndBuildFlsElementList(fpVO.getLevel2List(), elementMap);
|
||||
routeFls.setLevel2List(level2List);
|
||||
map.put(routeFls.getCode(), routeFls);
|
||||
}
|
||||
log.debug("构建侧防耗时:" + (System.currentTimeMillis() - start));
|
||||
InterlockBuilder2.log.debug("构建侧防耗时:" + (System.currentTimeMillis() - start));
|
||||
return map;
|
||||
}
|
||||
|
||||
@ -682,13 +691,13 @@ public class InterlockBuilder2 {
|
||||
rightFrontTurnBack = stationBFrontTurnBack;
|
||||
}
|
||||
//从左边车站右行站台站台轨开始,构建运行路径--- (不标准的目的地码定义数据会导致运行路径构建错误)
|
||||
Section startSection4RoutePath = selectSection4DestinationCode(leftStation, leftFrontTurnBack, necessarySectionSet, true); //查询路径的起始区段
|
||||
Section endSection4RoutePath = selectSection4DestinationCode(rightStation, rightFrontTurnBack, necessarySectionSet, false); //查询路径的终点区段
|
||||
Section startSection4RoutePath = InterlockBuilder2.selectSection4DestinationCode(leftStation, leftFrontTurnBack, necessarySectionSet, true); //查询路径的起始区段
|
||||
Section endSection4RoutePath = InterlockBuilder2.selectSection4DestinationCode(rightStation, rightFrontTurnBack, necessarySectionSet, false); //查询路径的终点区段
|
||||
routes = new ArrayList<>();
|
||||
//选择并添加进路
|
||||
selectAndAddRoutes(startSection4RoutePath, endSection4RoutePath, true, stationList, standTrackAdjoinMap, routes, necessaryRoutes, necessarySectionSet);
|
||||
InterlockBuilder2.selectAndAddRoutes(startSection4RoutePath, endSection4RoutePath, true, stationList, standTrackAdjoinMap, routes, necessaryRoutes, necessarySectionSet);
|
||||
//选择并添加反向的进路
|
||||
selectAndAddRoutes(endSection4RoutePath, startSection4RoutePath, false, stationList, standTrackAdjoinMap, routes, necessaryRoutes, necessarySectionSet);
|
||||
InterlockBuilder2.selectAndAddRoutes(endSection4RoutePath, startSection4RoutePath, false, stationList, standTrackAdjoinMap, routes, necessaryRoutes, necessarySectionSet);
|
||||
runPath = routes.stream().flatMap(route -> route.getSectionList().stream()).distinct().collect(Collectors.toList());
|
||||
break;
|
||||
}
|
||||
@ -705,7 +714,7 @@ public class InterlockBuilder2 {
|
||||
}
|
||||
if (startSection != null) {
|
||||
routes = new ArrayList<>();
|
||||
selectAndAddRoutes(startSection, section, true, stationList, standTrackAdjoinMap, routes, necessaryRoutes, necessarySectionSet);
|
||||
InterlockBuilder2.selectAndAddRoutes(startSection, section, true, stationList, standTrackAdjoinMap, routes, necessaryRoutes, necessarySectionSet);
|
||||
runPath = routes.stream().flatMap(route -> route.getSectionList().stream()).distinct().collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@ -940,7 +949,7 @@ public class InterlockBuilder2 {
|
||||
SimulationBuilder.SimulationDeviceBuildResult buildResult,
|
||||
List<String> errMsgList) {
|
||||
long start = System.currentTimeMillis();
|
||||
log.debug("构建进路路径开始:" + start);
|
||||
InterlockBuilder2.log.debug("构建进路路径开始:" + start);
|
||||
if (CollectionUtils.isEmpty(stationRunLevelList)) {
|
||||
return;
|
||||
}
|
||||
@ -974,7 +983,7 @@ public class InterlockBuilder2 {
|
||||
}
|
||||
}
|
||||
System.out.println("用时" + (System.currentTimeMillis() - l));
|
||||
log.debug("构建进路路径耗时:" + (System.currentTimeMillis() - start));
|
||||
InterlockBuilder2.log.debug("构建进路路径耗时:" + (System.currentTimeMillis() - start));
|
||||
}
|
||||
|
||||
// /**
|
||||
@ -1038,7 +1047,7 @@ public class InterlockBuilder2 {
|
||||
}
|
||||
List<Section> midSectionList = new ArrayList<>(); // 若可到达,记录途经进路的最后一个区段
|
||||
List<String> warningList = new ArrayList<>(); // 警告消息
|
||||
boolean reachable = isReachable(startSection, endSection, right, 0, null, midSectionList, warningList);
|
||||
boolean reachable = InterlockBuilder2.isReachable(startSection, endSection, right, 0, null, midSectionList, warningList);
|
||||
if (!reachable) {
|
||||
errMsgList.add(String.format("从区段[%s(%s)]始到区段[%s(%s)]终," +
|
||||
"以进路方式查询无法到达,检测运行图数据或进路/自动信号数据是否有误。辅助信息:【%s】",
|
||||
@ -1180,7 +1189,7 @@ public class InterlockBuilder2 {
|
||||
if (Objects.nonNull(autoSignal)) { // 自动信号,单一路径
|
||||
List<Section> sectionList = autoSignal.getSectionList();
|
||||
if (CollectionUtils.isEmpty(sectionList)) { // 尽头防护信号机
|
||||
log.info(String.format("从区段[%s(%s)]始到区段[%s(%s)]终,查询路径找到尽头防护信号[%s(%s)]也没找到",
|
||||
InterlockBuilder2.log.info(String.format("从区段[%s(%s)]始到区段[%s(%s)]终,查询路径找到尽头防护信号[%s(%s)]也没找到",
|
||||
startSection.getName(), startSection.getCode(),
|
||||
endSection.getName(), endSection.getCode(),
|
||||
startSignal.getName(), startSignal.getCode()));
|
||||
@ -1211,7 +1220,7 @@ public class InterlockBuilder2 {
|
||||
if (!current.isSwitchTrack() && ((startSignal.isRight() && Objects.isNull(current.getRightSection()))
|
||||
||
|
||||
(!startSignal.isRight() && Objects.isNull(current.getLeftSection())))) {
|
||||
log.info(String.format("从区段[%s(%s)]始到区段[%s(%s)]终,查询路径找到尽头区段[%s(%s)]也没找到",
|
||||
InterlockBuilder2.log.info(String.format("从区段[%s(%s)]始到区段[%s(%s)]终,查询路径找到尽头区段[%s(%s)]也没找到",
|
||||
startSection.getName(), startSection.getCode(),
|
||||
endSection.getName(), endSection.getCode(),
|
||||
current.getName(), current.getCode()));
|
||||
@ -1248,7 +1257,7 @@ public class InterlockBuilder2 {
|
||||
}
|
||||
}
|
||||
for (Section section : endSectionSet) { // 未找到,递归查询
|
||||
boolean reachable = isReachable(startSection, endSection, right,
|
||||
boolean reachable = InterlockBuilder2.isReachable(startSection, endSection, right,
|
||||
++count, section, midSectionList, warningList);
|
||||
if (reachable) {
|
||||
midSectionList.add(section);
|
||||
@ -1393,7 +1402,7 @@ public class InterlockBuilder2 {
|
||||
|
||||
private static void checkBetweenRouteSameDirectionSignal(Map<String, MapElement> elementMap, List<String> errMsgList) {
|
||||
long start = System.currentTimeMillis();
|
||||
log.debug("构建自动折返进路开始");
|
||||
InterlockBuilder2.log.debug("构建自动折返进路开始");
|
||||
if (!CollectionUtils.isEmpty(errMsgList)) { // 数据中本身存在错误,不检查
|
||||
return;
|
||||
}
|
||||
@ -1413,19 +1422,81 @@ public class InterlockBuilder2 {
|
||||
}
|
||||
// 对应方向信号机存在
|
||||
if (!CollectionUtils.isEmpty(signal.getRouteList())) {
|
||||
log.debug(String.format("进路[%s(%s)]内区段[%s(%s)]存在同向信号机[%s(%s)]," +
|
||||
InterlockBuilder2.log.debug(String.format("进路[%s(%s)]内区段[%s(%s)]存在同向信号机[%s(%s)]," +
|
||||
"此信号机不能是进路始端信号机,请检查进路是否始端/终端信号机选择错误,或者此信号机是自动信号而非进路始端信号机",
|
||||
route.getName(), route.getCode(),
|
||||
section.getName(), section.getCode(),
|
||||
signal.getName(), signal.getCode()));
|
||||
} else if (Objects.isNull(signal.getAutoSignal())) {
|
||||
log.debug(String.format("进路[%s(%s)]内区段[%s(%s)]存在同向信号机[%s(%s)],此信号机却不是自动信号",
|
||||
InterlockBuilder2.log.debug(String.format("进路[%s(%s)]内区段[%s(%s)]存在同向信号机[%s(%s)],此信号机却不是自动信号",
|
||||
route.getName(), route.getCode(),
|
||||
section.getName(), section.getCode(),
|
||||
signal.getName(), signal.getCode()));
|
||||
}
|
||||
}
|
||||
}
|
||||
log.debug("构建自动折返进路耗时:" + (System.currentTimeMillis() - start));
|
||||
InterlockBuilder2.log.debug("构建自动折返进路耗时:" + (System.currentTimeMillis() - start));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构建指示灯的逻辑信息
|
||||
*
|
||||
* @param elementMap 设备信息
|
||||
* @param errMsgList 错误信息
|
||||
* @param indicatorSectionVOList 逻辑关联关系
|
||||
*/
|
||||
private static void buildAssistIndicatorLogic(Map<String, MapElement> elementMap, List<String> errMsgList, List<IndicatorSection> indicatorSectionVOList) {
|
||||
if (!CollectionUtils.isEmpty(indicatorSectionVOList)) {
|
||||
indicatorSectionVOList.stream().forEach(indicatorSection -> {
|
||||
// 获取指示灯
|
||||
Indicator indicator = (Indicator) elementMap.get(indicatorSection.getIndicatorCode());
|
||||
// 有关联的区间信息
|
||||
if (!CollectionUtils.isEmpty(indicatorSection.getSectionList())) {
|
||||
List<Section> sectionList = indicatorSection.getSectionList()
|
||||
.stream()
|
||||
.map(sectionCode -> (Section) elementMap.get(sectionCode))
|
||||
.collect(Collectors.toList());
|
||||
indicator.setSectionList(sectionList);
|
||||
}
|
||||
// 获取站台信息
|
||||
if (!StringUtils.isEmpty(indicatorSection.getStandCode())) {
|
||||
Stand stand = (Stand) elementMap.get(indicatorSection.getStandCode());
|
||||
indicator.setStand(stand);
|
||||
}
|
||||
// 获取进路信息
|
||||
if (!StringUtils.isEmpty(indicatorSection.getRouteCode())) {
|
||||
Route route = (Route) elementMap.get(indicatorSection.getRouteCode());
|
||||
indicator.setRoute(route);
|
||||
}
|
||||
// 指示灯类型
|
||||
indicator.setType(IndicatorTypeEnum.getType(indicatorSection.getType()));
|
||||
indicator.reset();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建按钮的逻辑信息
|
||||
*
|
||||
* @param elementMap 设备信息
|
||||
* @param errMsgList 错误信息
|
||||
* @param buttonStandVOList 逻辑关联关系
|
||||
*/
|
||||
private static void buildAssistButtonLogic(Map<String, MapElement> elementMap, List<String> errMsgList, List<ButtonStand> buttonStandVOList) {
|
||||
if (!CollectionUtils.isEmpty(buttonStandVOList)) {
|
||||
buttonStandVOList.stream().forEach(buttonStand -> {
|
||||
// 获取指示灯
|
||||
Button button = (Button) elementMap.get(buttonStand.getButtonCode());
|
||||
// 获取站台信息
|
||||
if (!StringUtils.isEmpty(buttonStand.getStandCode())) {
|
||||
Stand stand = (Stand) elementMap.get(buttonStand.getStandCode());
|
||||
button.setStand(stand);
|
||||
}
|
||||
// 指示灯类型
|
||||
button.setType(ButtonTypeEnum.getType(buttonStand.getType()));
|
||||
button.reset();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package club.joylink.rtss.simulation.cbtc.build;
|
||||
|
||||
import club.joylink.rtss.constants.BusinessConsts;
|
||||
import club.joylink.rtss.constants.DirectionLabelEnum;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.SignalModel;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||
@ -45,10 +46,10 @@ public class MapDeviceBuilder {
|
||||
elementMap.put(zc.getCode(), zc);
|
||||
});
|
||||
// 车站
|
||||
buildStation(graphData, elementMap, deviceMap, errMsgList);
|
||||
MapDeviceBuilder.buildStation(graphData, elementMap, deviceMap, errMsgList);
|
||||
// 区段
|
||||
List<MapSectionNewVO> sectionList = graphData.getSectionList();
|
||||
buildSections(elementMap, deviceMap, errMsgList, sectionList);
|
||||
MapDeviceBuilder.buildSections(elementMap, deviceMap, errMsgList, sectionList);
|
||||
// 道岔
|
||||
List<MapSwitchVO> switchList = graphData.getSwitchList();
|
||||
switchList.forEach(switchVO -> {
|
||||
@ -105,7 +106,7 @@ public class MapDeviceBuilder {
|
||||
Section section = (Section) elementMap.get(sectionVO.getCode());
|
||||
if (Objects.equals(BusinessConsts.Section.SectionType.Type02, sectionVO.getType()) ||
|
||||
Objects.equals(BusinessConsts.Section.SectionType.Type03, sectionVO.getType()) ||
|
||||
isCross(sectionVO.getType())) { // 逻辑区段/道岔区段/岔心
|
||||
MapDeviceBuilder.isCross(sectionVO.getType())) { // 逻辑区段/道岔区段/岔心
|
||||
Section parent = (Section) elementMap.get(sectionVO.getParentCode());
|
||||
if (Objects.isNull(parent)) {
|
||||
errMsgList.add(String.format("逻辑区段/道岔区段/岔心[%s(%s)]没用关联(道岔)计轴区段或关联的(道岔)计轴区段不存在",
|
||||
@ -366,7 +367,7 @@ public class MapDeviceBuilder {
|
||||
});
|
||||
}
|
||||
// 站台
|
||||
List<MapStationStandNewVO> standList = buildStand(graphData, elementMap, errMsgList);
|
||||
List<MapStationStandNewVO> standList = MapDeviceBuilder.buildStand(graphData, elementMap, errMsgList);
|
||||
// 站台轨关系数据校验
|
||||
List<Section> standTrackList = elementMap.values().stream()
|
||||
.filter(mapElement -> Objects.equals(mapElement.getDeviceType(), MapElement.DeviceType.SECTION) &&
|
||||
@ -390,9 +391,9 @@ public class MapDeviceBuilder {
|
||||
});
|
||||
}
|
||||
// PSD 站台屏蔽门
|
||||
buildPsd(graphData, elementMap, deviceMap, errMsgList);
|
||||
MapDeviceBuilder.buildPsd(graphData, elementMap, deviceMap, errMsgList);
|
||||
// ESP 紧急停车按钮
|
||||
buildEsp(graphData, elementMap, errMsgList);
|
||||
MapDeviceBuilder.buildEsp(graphData, elementMap, errMsgList);
|
||||
// 站台逻辑关系数据检查
|
||||
standList.forEach(standVO -> {
|
||||
Stand stand = (Stand) elementMap.get(standVO.getCode());
|
||||
@ -407,9 +408,9 @@ public class MapDeviceBuilder {
|
||||
}
|
||||
});
|
||||
// 区段是否站台轨、转换轨检查
|
||||
checkSectionFunctionType(elementMap, errMsgList);
|
||||
MapDeviceBuilder.checkSectionFunctionType(elementMap, errMsgList);
|
||||
// 信号机
|
||||
buildSignal(graphData, elementMap, deviceMap, errMsgList);
|
||||
MapDeviceBuilder.buildSignal(graphData, elementMap, deviceMap, errMsgList);
|
||||
|
||||
// 折返区段左右信号机存在校验
|
||||
for (Section section : physicalSectionList) {
|
||||
@ -692,13 +693,19 @@ public class MapDeviceBuilder {
|
||||
}
|
||||
}
|
||||
// 接触网
|
||||
buildCatenary(graphData, elementMap, errMsgList, mapDataBuildResult.getCatenaryMap());
|
||||
MapDeviceBuilder.buildCatenary(graphData, elementMap, errMsgList, mapDataBuildResult.getCatenaryMap());
|
||||
//应答器
|
||||
buildResponderDataRef(graphData, elementMap, errMsgList, mapDataBuildResult.getSectionRespondersMap());
|
||||
MapDeviceBuilder.buildResponderDataRef(graphData, elementMap, errMsgList, mapDataBuildResult.getSectionRespondersMap());
|
||||
if (mapDataBuildResult.getErrMsgList().isEmpty()) {
|
||||
Map<String, Set<Section>> sectionArriveMap = buildNormalStandTrackAdjoinSections(mapDataBuildResult.getDeviceMap());
|
||||
Map<String, Set<Section>> sectionArriveMap = MapDeviceBuilder.buildNormalStandTrackAdjoinSections(mapDataBuildResult.getDeviceMap());
|
||||
mapDataBuildResult.setSectionArriveNearMap(sectionArriveMap);
|
||||
}
|
||||
|
||||
// 构建接、发、区间、辅助指示灯
|
||||
MapDeviceBuilder.buildAssistIndicator(elementMap, errMsgList, graphData.getIndicatorLightList());
|
||||
|
||||
// 构建辅助、改方按钮
|
||||
MapDeviceBuilder.buildAssistButton(elementMap, errMsgList, graphData.getSignalButtonList());
|
||||
}
|
||||
|
||||
private static List<MapStationStandNewVO> buildStand(MapGraphDataNewVO graphData, Map<String, MapElement> elementMap, List<String> errMsgList) {
|
||||
@ -856,12 +863,12 @@ public class MapDeviceBuilder {
|
||||
Map<String, Set<Section>> sectionDirectionSectionsMap = new HashMap<>();
|
||||
for (Section section : standTrackList) {
|
||||
Set<Section> rightDirectionList = new HashSet<>();
|
||||
sectionDirectionSectionsMap.put(buildSectionDirectionKey(section, true), rightDirectionList);
|
||||
queryAdjoinSections(section, true, rightDirectionList);
|
||||
sectionDirectionSectionsMap.put(MapDeviceBuilder.buildSectionDirectionKey(section, true), rightDirectionList);
|
||||
MapDeviceBuilder.queryAdjoinSections(section, true, rightDirectionList);
|
||||
Set<Section> leftDirectionList = new HashSet<>();
|
||||
sectionDirectionSectionsMap.put(buildSectionDirectionKey(section, false), leftDirectionList);
|
||||
queryAdjoinSections(section, false, leftDirectionList);
|
||||
log.debug(String.format("区段[%s][右向]邻接区段为[%s],[左向]邻接区段为[%s]",
|
||||
sectionDirectionSectionsMap.put(MapDeviceBuilder.buildSectionDirectionKey(section, false), leftDirectionList);
|
||||
MapDeviceBuilder.queryAdjoinSections(section, false, leftDirectionList);
|
||||
MapDeviceBuilder.log.debug(String.format("区段[%s][右向]邻接区段为[%s],[左向]邻接区段为[%s]",
|
||||
section.debugStr(),
|
||||
String.join(",", rightDirectionList.stream().map(Section::debugStr).collect(Collectors.toList())),
|
||||
String.join(",", leftDirectionList.stream().map(Section::debugStr).collect(Collectors.toList()))));
|
||||
@ -889,7 +896,7 @@ public class MapDeviceBuilder {
|
||||
if (next == null) { // 可能到尽头了
|
||||
return;
|
||||
}
|
||||
if (checkAdjoinSectionAndAdd(next, rightDirectionList)) {
|
||||
if (MapDeviceBuilder.checkAdjoinSectionAndAdd(next, rightDirectionList)) {
|
||||
return;
|
||||
}
|
||||
signal = next.getSignalOf(right);
|
||||
@ -902,7 +909,7 @@ public class MapDeviceBuilder {
|
||||
if (signal == null) {
|
||||
return;
|
||||
}
|
||||
queryAdjoinSections(signal, rightDirectionList);
|
||||
MapDeviceBuilder.queryAdjoinSections(signal, rightDirectionList);
|
||||
}
|
||||
|
||||
private static void queryAdjoinSections(Signal signal, Set<Section> rightDirectionList) {
|
||||
@ -915,12 +922,12 @@ public class MapDeviceBuilder {
|
||||
}
|
||||
List<Section> sectionList = autoSignal.getSectionList();
|
||||
for (Section temp : sectionList) {
|
||||
if (checkAdjoinSectionAndAdd(temp, rightDirectionList)) {
|
||||
if (MapDeviceBuilder.checkAdjoinSectionAndAdd(temp, rightDirectionList)) {
|
||||
return;
|
||||
}
|
||||
signal = temp.getSignalOf(right);
|
||||
if (signal != null) {
|
||||
queryAdjoinSections(signal, rightDirectionList);
|
||||
MapDeviceBuilder.queryAdjoinSections(signal, rightDirectionList);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -932,7 +939,7 @@ public class MapDeviceBuilder {
|
||||
List<Section> sectionList = route.getSectionList();
|
||||
boolean finish = false;
|
||||
for (Section section : sectionList) {
|
||||
if (checkAdjoinSectionAndAdd(section, rightDirectionList)) {
|
||||
if (MapDeviceBuilder.checkAdjoinSectionAndAdd(section, rightDirectionList)) {
|
||||
finish = true;
|
||||
break;
|
||||
}
|
||||
@ -942,7 +949,7 @@ public class MapDeviceBuilder {
|
||||
}
|
||||
}
|
||||
for (Signal next : queryList) {
|
||||
queryAdjoinSections(next, rightDirectionList);
|
||||
MapDeviceBuilder.queryAdjoinSections(next, rightDirectionList);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -985,17 +992,17 @@ public class MapDeviceBuilder {
|
||||
}
|
||||
elementMap.put(section.getCode(), section);
|
||||
section.setRoadType(sectionVO.getRoadType());
|
||||
section.setPhysical(isPhysicalSection(sectionVO.getType()));
|
||||
section.setAxleCounter(isAxleCounterSection(sectionVO, sectionList));
|
||||
section.setCross(isCross(sectionVO.getType()));
|
||||
section.setPhysical(MapDeviceBuilder.isPhysicalSection(sectionVO.getType()));
|
||||
section.setAxleCounter(MapDeviceBuilder.isAxleCounterSection(sectionVO, sectionList));
|
||||
section.setCross(MapDeviceBuilder.isCross(sectionVO.getType()));
|
||||
// 计轴区段和道岔区段,校验实际长度
|
||||
if (isPhysicalSection(sectionVO.getType()) &&
|
||||
if (MapDeviceBuilder.isPhysicalSection(sectionVO.getType()) &&
|
||||
(Objects.isNull(sectionVO.getLengthFact()) ||
|
||||
sectionVO.getLengthFact() <= 0 ||
|
||||
Float.isInfinite(sectionVO.getLengthFact()) ||
|
||||
Float.isNaN(sectionVO.getLengthFact()))) {
|
||||
errMsgList.add(String.format("区段[%s(%s)]实际距离未设置或不为正数", sectionVO.getName(), sectionVO.getCode()));
|
||||
} else if (isPhysicalSection(sectionVO.getType())) {
|
||||
} else if (MapDeviceBuilder.isPhysicalSection(sectionVO.getType())) {
|
||||
section.setLen(sectionVO.getLengthFact());
|
||||
}
|
||||
if (Objects.equals(sectionVO.getType(), BusinessConsts.Section.SectionType.Type02)) { // 逻辑区段
|
||||
@ -1411,7 +1418,7 @@ public class MapDeviceBuilder {
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
boolean find = findSectionsOfUnit(unitLeft, unitRight, sectionSet);
|
||||
boolean find = MapDeviceBuilder.findSectionsOfUnit(unitLeft, unitRight, sectionSet);
|
||||
if (!find) {
|
||||
errMsgList.add(String.format("接触网[%s]额外区段配置从区段[%s]向右查找不到区段[%s]",
|
||||
code, leftSection.debugStr(), rightSection.debugStr()));
|
||||
@ -1421,7 +1428,7 @@ public class MapDeviceBuilder {
|
||||
if (error) {
|
||||
continue;
|
||||
}
|
||||
boolean finish = findSectionsOfUnit(leftSection, rightSection, sectionSet);
|
||||
boolean finish = MapDeviceBuilder.findSectionsOfUnit(leftSection, rightSection, sectionSet);
|
||||
if (!finish) {
|
||||
errMsgList.add(String.format("接触网配置从区段[%s]向右查找不到区段[%s]",
|
||||
leftSection.debugStr(), rightSection.debugStr()));
|
||||
@ -1430,7 +1437,7 @@ public class MapDeviceBuilder {
|
||||
SectionPosition rightPosition = new SectionPosition(rightSection, line.getRightOffset());
|
||||
Catenary catenary = new Catenary(code, "", leftPosition, rightPosition, sectionSet);
|
||||
elementMap.put(catenary.getCode(), catenary);
|
||||
catenary.getSectionSet().forEach(s -> addCatenaryMap(s, catenary, catenaryMap));
|
||||
catenary.getSectionSet().forEach(s -> MapDeviceBuilder.addCatenaryMap(s, catenary, catenaryMap));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1491,7 +1498,7 @@ public class MapDeviceBuilder {
|
||||
return true;
|
||||
if (Objects.equals(type, BusinessConsts.Section.SectionType.Type01)) {
|
||||
String parentCode = sectionVO.getParentCode();
|
||||
return sectionList.stream().noneMatch(section -> isCross(section.getType()) && section.getCode().equals(parentCode));
|
||||
return sectionList.stream().noneMatch(section -> MapDeviceBuilder.isCross(section.getType()) && section.getCode().equals(parentCode));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@ -1500,4 +1507,64 @@ public class MapDeviceBuilder {
|
||||
private static boolean isCross(String type) {
|
||||
return Objects.equals(type, BusinessConsts.Section.SectionType.Type05);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建指示灯
|
||||
*
|
||||
* @param elementMap 资源map
|
||||
* @param errMsgList 错误提示
|
||||
* @param indicatorList 指示灯信息
|
||||
*/
|
||||
private static void buildAssistIndicator(Map<String, MapElement> elementMap
|
||||
, List<String> errMsgList, List<MapIndicatorLightVO> indicatorList) {
|
||||
indicatorList
|
||||
.stream()
|
||||
.filter(mapIndicatorLightVO ->
|
||||
Arrays.stream(DirectionLabelEnum.values())
|
||||
.filter(e -> e.equals(mapIndicatorLightVO.getLabelEnum()))
|
||||
.findAny()
|
||||
.isPresent()
|
||||
)
|
||||
.forEach(mapSignalButtonVO -> {
|
||||
if (elementMap.containsKey(mapSignalButtonVO.getCode())) {
|
||||
errMsgList.add(String.format("指示灯[%s]必须唯一", mapSignalButtonVO.getCode()));
|
||||
} else {
|
||||
Indicator indicator = new Indicator(mapSignalButtonVO.getCode(), mapSignalButtonVO.getName());
|
||||
indicator.setLabel(mapSignalButtonVO.getLabelEnum());
|
||||
Station station = (Station) elementMap.get(mapSignalButtonVO.getStationCode());
|
||||
indicator.setStation(station);
|
||||
elementMap.put(indicator.getCode(), indicator);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建按钮设备
|
||||
*
|
||||
* @param elementMap 设备Map
|
||||
* @param errMsgList 错误列表
|
||||
* @param signalButtonList 按钮列表
|
||||
*/
|
||||
private static void buildAssistButton(Map<String, MapElement> elementMap
|
||||
, List<String> errMsgList, List<MapSignalButtonVO> signalButtonList) {
|
||||
signalButtonList
|
||||
.stream()
|
||||
.filter(mapSignalButtonVO ->
|
||||
Arrays.stream(DirectionLabelEnum.values())
|
||||
.filter(e -> e.equals(mapSignalButtonVO.getLabelEnum()))
|
||||
.findAny()
|
||||
.isPresent()
|
||||
)
|
||||
.forEach(mapSignalButtonVO -> {
|
||||
if (elementMap.containsKey(mapSignalButtonVO.getCode())) {
|
||||
errMsgList.add(String.format("按钮[%s]必须唯一", mapSignalButtonVO.getCode()));
|
||||
} else {
|
||||
Button button = new Button(mapSignalButtonVO.getCode(), mapSignalButtonVO.getName());
|
||||
button.setLabel(mapSignalButtonVO.getLabelEnum());
|
||||
Station station = (Station) elementMap.get(mapSignalButtonVO.getStationCode());
|
||||
button.setStation(station);
|
||||
elementMap.put(button.getCode(), button);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package club.joylink.rtss.simulation.cbtc.data.map;
|
||||
|
||||
import club.joylink.rtss.constants.ButtonTypeEnum;
|
||||
import club.joylink.rtss.constants.DirectionLabelEnum;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.SignalAspect;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@ -37,12 +36,17 @@ public class Button extends MapNamedElement {
|
||||
*/
|
||||
private ButtonTypeEnum type;
|
||||
|
||||
public Button(String code, String name) {
|
||||
super(code, name, DeviceType.BUTTON);
|
||||
isPressDown = Boolean.FALSE;
|
||||
}
|
||||
|
||||
protected Button(String code, String name, DeviceType deviceType) {
|
||||
super(code, name, deviceType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
this.isPressDown = Boolean.FALSE;
|
||||
isPressDown = Boolean.FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,11 @@ package club.joylink.rtss.simulation.cbtc.data.map;
|
||||
import club.joylink.rtss.constants.DirectionLabelEnum;
|
||||
import club.joylink.rtss.constants.IndicatorStatusEnum;
|
||||
import club.joylink.rtss.constants.IndicatorTypeEnum;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.SignalAspect;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 指示灯设备
|
||||
*/
|
||||
@ -19,16 +20,6 @@ public class Indicator extends MapNamedElement{
|
||||
*/
|
||||
private Station station;
|
||||
|
||||
/**
|
||||
* 站台
|
||||
*/
|
||||
private Stand stand;
|
||||
|
||||
/**
|
||||
* 进路
|
||||
*/
|
||||
private Route route;
|
||||
|
||||
/**
|
||||
* 当前信号显示
|
||||
*/
|
||||
@ -39,15 +30,35 @@ public class Indicator extends MapNamedElement{
|
||||
*/
|
||||
private DirectionLabelEnum label;
|
||||
|
||||
/**
|
||||
* 是否改方状态
|
||||
*/
|
||||
private boolean isChangeDirection;
|
||||
|
||||
/**
|
||||
* 区段信息
|
||||
*/
|
||||
private List<Section> sectionList;
|
||||
|
||||
/**
|
||||
* 站台
|
||||
*/
|
||||
private Stand stand;
|
||||
|
||||
/**
|
||||
* 进路
|
||||
*/
|
||||
private Route route;
|
||||
|
||||
/**
|
||||
* 灯类型
|
||||
*/
|
||||
private IndicatorTypeEnum type;
|
||||
|
||||
/**
|
||||
* 是否改方状态
|
||||
*/
|
||||
private boolean isChangeDirection;
|
||||
public Indicator(String code, String name) {
|
||||
super(code, name, DeviceType.INDICATOR);
|
||||
isChangeDirection = Boolean.FALSE;
|
||||
}
|
||||
|
||||
protected Indicator(String code, String name, DeviceType deviceType) {
|
||||
super(code, name, deviceType);
|
||||
@ -55,11 +66,12 @@ public class Indicator extends MapNamedElement{
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
this.aspect = getDefaultStatus();
|
||||
aspect = getDefaultStatus();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取默认状态
|
||||
*
|
||||
* @return 默认状态
|
||||
*/
|
||||
public IndicatorStatusEnum getDefaultStatus() {
|
||||
@ -76,6 +88,7 @@ public class Indicator extends MapNamedElement{
|
||||
|
||||
/**
|
||||
* 获取进路办理后的指示灯状态
|
||||
*
|
||||
* @return 办理状态
|
||||
*/
|
||||
public IndicatorStatusEnum setLockRouteStatus() {
|
||||
|
@ -13,68 +13,136 @@ public abstract class MapElement {
|
||||
*/
|
||||
public abstract void reset();
|
||||
|
||||
/** 设备类型 */
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
public enum DeviceType {
|
||||
/** 区段 */
|
||||
/**
|
||||
* 区段
|
||||
*/
|
||||
SECTION,
|
||||
/** 计轴器 */
|
||||
/**
|
||||
* 计轴器
|
||||
*/
|
||||
AXLE_COUNTER,
|
||||
/** 道岔 */
|
||||
/**
|
||||
* 道岔
|
||||
*/
|
||||
SWITCH,
|
||||
/** 信号机 */
|
||||
/**
|
||||
* 信号机
|
||||
*/
|
||||
SIGNAL,
|
||||
/** 车站 */
|
||||
/**
|
||||
* 车站
|
||||
*/
|
||||
STATION,
|
||||
/** 站台 */
|
||||
/**
|
||||
* 站台
|
||||
*/
|
||||
STAND,
|
||||
/** 屏蔽门 */
|
||||
/**
|
||||
* 屏蔽门
|
||||
*/
|
||||
PSD,
|
||||
/** 紧急停车按钮 */
|
||||
/**
|
||||
* 紧急停车按钮
|
||||
*/
|
||||
ESP,
|
||||
/** 区域控制器 */
|
||||
/**
|
||||
* 区域控制器
|
||||
*/
|
||||
ZC,
|
||||
/** 线路控制器 */
|
||||
/**
|
||||
* 线路控制器
|
||||
*/
|
||||
LC,
|
||||
/** 进路 */
|
||||
/**
|
||||
* 进路
|
||||
*/
|
||||
ROUTE,
|
||||
/** 进路延续保护 */
|
||||
/**
|
||||
* 进路延续保护
|
||||
*/
|
||||
OVERLAP,
|
||||
/** 超限区段 */
|
||||
/**
|
||||
* 超限区段
|
||||
*/
|
||||
OVERRUN,
|
||||
/** 侧防 */
|
||||
/**
|
||||
* 侧防
|
||||
*/
|
||||
FLANK_PROTECTION,
|
||||
/** 自动信号 */
|
||||
/**
|
||||
* 自动信号
|
||||
*/
|
||||
AUTO_SIGNAL,
|
||||
/** 自动折返 */
|
||||
/**
|
||||
* 自动折返
|
||||
*/
|
||||
CYCLE,
|
||||
/** 列车 */
|
||||
/**
|
||||
* 列车
|
||||
*/
|
||||
TRAIN,
|
||||
/** 列车门 */
|
||||
/**
|
||||
* 列车门
|
||||
*/
|
||||
TRAIN_DOOR,
|
||||
/** 交路 */
|
||||
/**
|
||||
* 交路
|
||||
*/
|
||||
ROUTING,
|
||||
/** 站间运行等级 */
|
||||
/**
|
||||
* 站间运行等级
|
||||
*/
|
||||
RUN_LEVEL,
|
||||
/** 方向杆 */
|
||||
/**
|
||||
* 方向杆
|
||||
*/
|
||||
DIRECTION_ROD,
|
||||
/** 接触网 */
|
||||
/**
|
||||
* 接触网
|
||||
*/
|
||||
CATENARY,
|
||||
/**应答器*/
|
||||
/**
|
||||
* 应答器
|
||||
*/
|
||||
RESPONDER,
|
||||
/** 综合后备盘 */
|
||||
/**
|
||||
* 综合后备盘
|
||||
*/
|
||||
IBP,
|
||||
/** 就地控制盘 */
|
||||
/**
|
||||
* 就地控制盘
|
||||
*/
|
||||
PSL,
|
||||
/** 服务器 */
|
||||
/**
|
||||
* 服务器
|
||||
*/
|
||||
SERVER,
|
||||
/** 广播 */
|
||||
/**
|
||||
* 广播
|
||||
*/
|
||||
AUDIO,
|
||||
/**
|
||||
* 指示灯
|
||||
*/
|
||||
INDICATOR,
|
||||
/**
|
||||
* 操作按钮
|
||||
*/
|
||||
BUTTON
|
||||
}
|
||||
|
||||
/** 设备唯一编号 */
|
||||
/**
|
||||
* 设备唯一编号
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/** 设备类型 */
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private DeviceType deviceType;
|
||||
|
||||
protected MapElement(String code, DeviceType deviceType) {
|
||||
|
@ -9,6 +9,7 @@
|
||||
<result column="stand_code" jdbcType="VARCHAR" property="standCode"/>
|
||||
<result column="next_stand_code" jdbcType="VARCHAR" property="nextStandCode"/>
|
||||
<result column="pre_stand_code" jdbcType="VARCHAR" property="preStandCode"/>
|
||||
<result column="type" javaType="VARCHAR" property="type"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Example_Where_Clause">
|
||||
@ -74,7 +75,7 @@
|
||||
</sql>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, map_id, button_code, stand_code, next_stand_code, pre_stand_code
|
||||
id, map_id, button_code, stand_code, next_stand_code, pre_stand_code,`type`
|
||||
</sql>
|
||||
|
||||
<select id="selectByExample" parameterType="club.joylink.rtss.entity.ButtonStandExample"
|
||||
@ -121,10 +122,10 @@
|
||||
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.ButtonStand"
|
||||
useGeneratedKeys="true">
|
||||
insert into button_stand_route (map_id, button_code,stand_code,next_stand_code,pre_stand_code)
|
||||
insert into button_stand_route (map_id, button_code,stand_code,next_stand_code,pre_stand_code,type)
|
||||
values (
|
||||
#{mapId,jdbcType=BIGINT}, #{buttonCode,jdbcType=VARCHAR}, #{standCode,jdbcType=VARCHAR},
|
||||
#{nextStandCode,jdbcType=VARCHAR}, #{preStandCode,jdbcType=VARCHAR}
|
||||
#{nextStandCode,jdbcType=VARCHAR}, #{preStandCode,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
|
||||
@ -137,6 +138,7 @@
|
||||
<if test="standCode != null">stand_code,</if>
|
||||
<if test="nextStandCode != null">next_stand_code,</if>
|
||||
<if test="preStandCode != null">pre_stand_code,</if>
|
||||
<if test="type != null">type,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="mapId != null">#{mapId,jdbcType=BIGINT},</if>
|
||||
@ -144,6 +146,7 @@
|
||||
<if test="standCode != null">#{standCode,jdbcType=VARCHAR},</if>
|
||||
<if test="nextStandCode != null">#{nextStandCode,jdbcType=VARCHAR},</if>
|
||||
<if test="preStandCode != null">#{preStandCode,jdbcType=VARCHAR},</if>
|
||||
<if test="type != null">#{type,jdbcType=VARCHAR},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -175,6 +178,9 @@
|
||||
<if test="record.preStandCode != null">
|
||||
pre_stand_code = #{record.preStandCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.type != null">
|
||||
type = #{record.type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause"/>
|
||||
@ -188,7 +194,8 @@
|
||||
button_code = #{record.buttonCode,jdbcType=VARCHAR},
|
||||
stand_code = #{record.standCode,jdbcType=VARCHAR},
|
||||
next_stand_code = #{record.nextStandCode,jdbcType=VARCHAR},
|
||||
pre_stand_code = #{record.preStandCode,jdbcType=VARCHAR}
|
||||
pre_stand_code = #{record.preStandCode,jdbcType=VARCHAR},
|
||||
type = #{record.type,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause"/>
|
||||
</if>
|
||||
@ -212,6 +219,9 @@
|
||||
<if test="preStandCode != null">
|
||||
pre_stand_code = #{preStandCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
type = #{type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
@ -222,7 +232,8 @@
|
||||
button_code = #{buttonCode,jdbcType=VARCHAR},
|
||||
stand_code = #{standCode,jdbcType=VARCHAR},
|
||||
next_stand_code = #{nextStandCode,jdbcType=VARCHAR},
|
||||
pre_stand_code = #{preStandCode,jdbcType=VARCHAR}
|
||||
pre_stand_code = #{preStandCode,jdbcType=VARCHAR},
|
||||
type = #{type,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
@ -10,6 +10,7 @@
|
||||
<result column="next_stand_code" jdbcType="VARCHAR" property="nextStandCode"/>
|
||||
<result column="pre_stand_code" jdbcType="VARCHAR" property="preStandCode"/>
|
||||
<result column="route_code" jdbcType="VARCHAR" property="routeCode"/>
|
||||
<result column="type" jdbcType="VARCHAR" property="type"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Example_Where_Clause">
|
||||
@ -75,7 +76,7 @@
|
||||
</sql>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, map_id, indicator_code, sections_code, stand_code, next_stand_code, pre_stand_code, route_code
|
||||
id, map_id, indicator_code, sections_code, stand_code, next_stand_code, pre_stand_code, route_code, type
|
||||
</sql>
|
||||
|
||||
<select id="selectByExample" parameterType="club.joylink.rtss.entity.IndicatorSectionExample"
|
||||
@ -123,12 +124,12 @@
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.IndicatorSection"
|
||||
useGeneratedKeys="true">
|
||||
insert into indicator_section_stand_route (
|
||||
map_id, indicator_code, sections_code, stand_code, next_stand_code,pre_stand_code, route_code
|
||||
map_id, indicator_code, sections_code, stand_code, next_stand_code,pre_stand_code, route_code,type
|
||||
)
|
||||
values (
|
||||
#{mapId,jdbcType=BIGINT}, #{indicatorCode,jdbcType=VARCHAR}, #{sectionsCode,jdbcType=VARCHAR},
|
||||
#{standCode,jdbcType=VARCHAR},#{nextStandCode,jdbcType=VARCHAR}, #{preStandCode,jdbcType=VARCHAR},
|
||||
#{routeCode,jdbcType=VARCHAR}
|
||||
#{routeCode,jdbcType=VARCHAR},#{type,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
|
||||
@ -144,6 +145,7 @@
|
||||
<if test="nextStandCode != null">next_stand_code,</if>
|
||||
<if test="preStandCode != null">pre_stand_code,</if>
|
||||
<if test="routeCode != null">route_code,</if>
|
||||
<if test="type != null">type,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="mapId != null">#{mapId,jdbcType=BIGINT},</if>
|
||||
@ -153,6 +155,7 @@
|
||||
<if test="nextStandCode != null">#{nextStandCode,jdbcType=VARCHAR},</if>
|
||||
<if test="preStandCode != null">#{preStandCode,jdbcType=VARCHAR},</if>
|
||||
<if test="routeCode != null">#{routeCode,jdbcType=VARCHAR},</if>
|
||||
<if test="type != null">#{type,jdbcType=VARCHAR},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -206,7 +209,8 @@
|
||||
stand_code = #{record.standCode,jdbcType=VARCHAR},
|
||||
next_stand_code = #{record.nextStandCode,jdbcType=VARCHAR},
|
||||
pre_stand_code = #{record.preStandCode,jdbcType=VARCHAR},
|
||||
route_code = #{record.routeCode,jdbcType=VARCHAR}
|
||||
route_code = #{record.routeCode,jdbcType=VARCHAR},
|
||||
type = #{record.type,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause"/>
|
||||
</if>
|
||||
@ -236,6 +240,9 @@
|
||||
<if test="routeCode != null">
|
||||
route_code = #{routeCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
type = #{type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
@ -249,7 +256,8 @@
|
||||
stand_code = #{standCode,jdbcType=VARCHAR},
|
||||
next_stand_code = #{nextStandCode,jdbcType=VARCHAR},
|
||||
pre_stand_code = #{preStandCode,jdbcType=VARCHAR},
|
||||
route_code = #{routeCode,jdbcType=VARCHAR}
|
||||
route_code = #{routeCode,jdbcType=VARCHAR},
|
||||
type = #{type,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user