diff --git a/src/main/java/club/joylink/rtss/constants/ButtonTypeEnum.java b/src/main/java/club/joylink/rtss/constants/ButtonTypeEnum.java index 57125c490..293b449aa 100644 --- a/src/main/java/club/joylink/rtss/constants/ButtonTypeEnum.java +++ b/src/main/java/club/joylink/rtss/constants/ButtonTypeEnum.java @@ -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; + } + } } diff --git a/src/main/java/club/joylink/rtss/constants/IndicatorTypeEnum.java b/src/main/java/club/joylink/rtss/constants/IndicatorTypeEnum.java index 9acf02e01..61359f686 100644 --- a/src/main/java/club/joylink/rtss/constants/IndicatorTypeEnum.java +++ b/src/main/java/club/joylink/rtss/constants/IndicatorTypeEnum.java @@ -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; + } + } } diff --git a/src/main/java/club/joylink/rtss/entity/ButtonStand.java b/src/main/java/club/joylink/rtss/entity/ButtonStand.java index a59bc2607..b31a44f8d 100644 --- a/src/main/java/club/joylink/rtss/entity/ButtonStand.java +++ b/src/main/java/club/joylink/rtss/entity/ButtonStand.java @@ -43,4 +43,9 @@ public class ButtonStand { * 上一个站台 */ private String preStandCode; + + /** + * 类型 + */ + private String type; } diff --git a/src/main/java/club/joylink/rtss/entity/IndicatorSection.java b/src/main/java/club/joylink/rtss/entity/IndicatorSection.java index fc90034c7..399ca140b 100644 --- a/src/main/java/club/joylink/rtss/entity/IndicatorSection.java +++ b/src/main/java/club/joylink/rtss/entity/IndicatorSection.java @@ -62,6 +62,11 @@ public class IndicatorSection { */ private String routeCode; + /** + * 灯类型 + */ + private String type; + public void generateSectionList() { if (StringUtils.isEmpty(sectionsCode)) { sectionList = new ArrayList<>(0); diff --git a/src/main/java/club/joylink/rtss/services/AssistButtonIndicatorService.java b/src/main/java/club/joylink/rtss/services/AssistButtonIndicatorService.java index 59c4cf2ab..c54e87bc0 100644 --- a/src/main/java/club/joylink/rtss/services/AssistButtonIndicatorService.java +++ b/src/main/java/club/joylink/rtss/services/AssistButtonIndicatorService.java @@ -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 queryAllIndicatorSectionByMapId(Long mapId) { + IndicatorSectionExample indicatorSectionExample = new IndicatorSectionExample(); + IndicatorSectionExample.Criteria criteria = indicatorSectionExample.createCriteria(); + criteria.andMapIdEqualTo(mapId); + return assistIndicatorDAO.selectByExample(indicatorSectionExample); + } + @Override public PageVO 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 queryAllButtonStandByMapId(Long mapId) { + ButtonStandExample buttonStandExample = new ButtonStandExample(); + ButtonStandExample.Criteria criteria = buttonStandExample.createCriteria(); + criteria.andMapIdEqualTo(mapId); + return assistButtonDAO.selectByExample(buttonStandExample); + } } diff --git a/src/main/java/club/joylink/rtss/services/IAssistButtonIndicatorService.java b/src/main/java/club/joylink/rtss/services/IAssistButtonIndicatorService.java index aed16d042..1b80dc9aa 100644 --- a/src/main/java/club/joylink/rtss/services/IAssistButtonIndicatorService.java +++ b/src/main/java/club/joylink/rtss/services/IAssistButtonIndicatorService.java @@ -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 queryAllIndicatorSectionByMapId(Long mapId); /** * 查找该地图下的按钮、站台关系信息列表 @@ -79,4 +88,12 @@ public interface IAssistButtonIndicatorService { * @param id 关系ID */ void deleteButtonStand(Long id); + + /** + * 查找该地图下所有的按钮关联信息 + * + * @param mapId 地图信息 + * @return 关联关系 + */ + List queryAllButtonStandByMapId(Long mapId); } diff --git a/src/main/java/club/joylink/rtss/services/draftData/DraftMapServiceImpl.java b/src/main/java/club/joylink/rtss/services/draftData/DraftMapServiceImpl.java index cf890efc3..30a07532a 100644 --- a/src/main/java/club/joylink/rtss/services/draftData/DraftMapServiceImpl.java +++ b/src/main/java/club/joylink/rtss/services/draftData/DraftMapServiceImpl.java @@ -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; } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/assist/AssistService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/assist/AssistService.java index b94a7ec76..fed69ba2a 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/assist/AssistService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/assist/AssistService.java @@ -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 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, "操作异常:首站不可改方"); } // 获取区间指示灯 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..dd32f3db8 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 @@ -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 elementMap = mapDataBuildResult.getDeviceMap(); List errMsgList = mapDataBuildResult.getErrMsgList(); // ------------侧防start------------- - Map flsMap = checkAndBuildRouteFls(logicData.getFlankProtectionList(), elementMap); + Map 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 routingList = checkAndBuildRouting(logicData.getRoutingList(), elementMap, errMsgList); + List routingList = InterlockBuilder2.checkAndBuildRouting(logicData.getRoutingList(), elementMap, errMsgList); mapDataBuildResult.setRoutingList(routingList); // ------------交路end------------- // ------------站间运行等级start------------- - List stationRunLevelList = checkAndBuildStationRunLevel(logicData.getRunLevelList(), elementMap, errMsgList); + List 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 elementMap, Map parkTimeMap, @@ -317,7 +326,7 @@ public class InterlockBuilder2 { } MapSectionPathVO sectionPathVO = new MapSectionPathVO(route.getStart().isRight(), mapRouteVO.getRouteSectionList(), mapRouteVO.getRouteSwitchList()); List 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 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 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 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 level1List = checkAndBuildFlsElementList(fpVO.getLevel1List(), elementMap); + List level1List = InterlockBuilder2.checkAndBuildFlsElementList(fpVO.getLevel1List(), elementMap); routeFls.setLevel1List(level1List); - List level2List = checkAndBuildFlsElementList(fpVO.getLevel2List(), elementMap); + List 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 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
midSectionList = new ArrayList<>(); // 若可到达,记录途经进路的最后一个区段 List 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
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 elementMap, List 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 elementMap, List errMsgList, List indicatorSectionVOList) { + if (!CollectionUtils.isEmpty(indicatorSectionVOList)) { + indicatorSectionVOList.stream().forEach(indicatorSection -> { + // 获取指示灯 + Indicator indicator = (Indicator) elementMap.get(indicatorSection.getIndicatorCode()); + // 有关联的区间信息 + if (!CollectionUtils.isEmpty(indicatorSection.getSectionList())) { + List
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 elementMap, List errMsgList, List 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(); + }); + } } } 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..2e76365aa 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 @@ -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 sectionList = graphData.getSectionList(); - buildSections(elementMap, deviceMap, errMsgList, sectionList); + MapDeviceBuilder.buildSections(elementMap, deviceMap, errMsgList, sectionList); // 道岔 List 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 standList = buildStand(graphData, elementMap, errMsgList); + List standList = MapDeviceBuilder.buildStand(graphData, elementMap, errMsgList); // 站台轨关系数据校验 List
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> sectionArriveMap = buildNormalStandTrackAdjoinSections(mapDataBuildResult.getDeviceMap()); + Map> sectionArriveMap = MapDeviceBuilder.buildNormalStandTrackAdjoinSections(mapDataBuildResult.getDeviceMap()); mapDataBuildResult.setSectionArriveNearMap(sectionArriveMap); } + + // 构建接、发、区间、辅助指示灯 + MapDeviceBuilder.buildAssistIndicator(elementMap, errMsgList, graphData.getIndicatorLightList()); + + // 构建辅助、改方按钮 + MapDeviceBuilder.buildAssistButton(elementMap, errMsgList, graphData.getSignalButtonList()); } private static List buildStand(MapGraphDataNewVO graphData, Map elementMap, List errMsgList) { @@ -856,12 +863,12 @@ public class MapDeviceBuilder { Map> sectionDirectionSectionsMap = new HashMap<>(); for (Section section : standTrackList) { Set
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
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
rightDirectionList) { @@ -915,12 +922,12 @@ public class MapDeviceBuilder { } List
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
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 elementMap + , List errMsgList, List 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 elementMap + , List errMsgList, List 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); + } + }); + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Button.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Button.java index 3bbefa899..8f4c2d223 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Button.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Button.java @@ -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; } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Indicator.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Indicator.java index bd0fc00a2..5fab7bb6b 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Indicator.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Indicator.java @@ -4,20 +4,41 @@ 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; + /** * 指示灯设备 */ @Setter @Getter -public class Indicator extends MapNamedElement{ +public class Indicator extends MapNamedElement { /** * 车站 */ private Station station; + + /** + * 当前信号显示 + */ + private IndicatorStatusEnum aspect; + + /** + * 方向标签 + */ + private DirectionLabelEnum label; + + /** + * 是否改方状态 + */ + private boolean isChangeDirection; + + /** + * 区段信息 + */ + private List
sectionList; /** * 站台 @@ -29,25 +50,15 @@ public class Indicator extends MapNamedElement{ */ private Route route; - /** - * 当前信号显示 - */ - private IndicatorStatusEnum aspect; - - /** - * 方向标签 - */ - private DirectionLabelEnum label; - /** * 灯类型 */ 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,19 +66,20 @@ public class Indicator extends MapNamedElement{ @Override public void reset() { - this.aspect = getDefaultStatus(); + aspect = getDefaultStatus(); } /** * 获取默认状态 + * * @return 默认状态 */ - public IndicatorStatusEnum getDefaultStatus(){ + public IndicatorStatusEnum getDefaultStatus() { // 接 if (DirectionLabelEnum.S.equals(label) && IndicatorTypeEnum.RECEIVE.equals(type)) { return IndicatorStatusEnum.Y; - // 发 - } else if(DirectionLabelEnum.XF.equals(label) && IndicatorTypeEnum.DELIVER.equals(type)) { + // 发 + } else if (DirectionLabelEnum.XF.equals(label) && IndicatorTypeEnum.DELIVER.equals(type)) { return IndicatorStatusEnum.G; } else { return IndicatorStatusEnum.No; @@ -76,6 +88,7 @@ public class Indicator extends MapNamedElement{ /** * 获取进路办理后的指示灯状态 + * * @return 办理状态 */ public IndicatorStatusEnum setLockRouteStatus() { diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapElement.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapElement.java index f774c8473..55f2ee850 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapElement.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapElement.java @@ -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) { diff --git a/src/main/resources/mybatis/mapper/AssistButtonDAO.xml b/src/main/resources/mybatis/mapper/AssistButtonDAO.xml index 7f13518d9..e5ca66a15 100644 --- a/src/main/resources/mybatis/mapper/AssistButtonDAO.xml +++ b/src/main/resources/mybatis/mapper/AssistButtonDAO.xml @@ -9,6 +9,7 @@ + @@ -74,7 +75,7 @@ - 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` 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} ) @@ -144,6 +145,7 @@ next_stand_code, pre_stand_code, route_code, + type, #{mapId,jdbcType=BIGINT}, @@ -153,6 +155,7 @@ #{nextStandCode,jdbcType=VARCHAR}, #{preStandCode,jdbcType=VARCHAR}, #{routeCode,jdbcType=VARCHAR}, + #{type,jdbcType=VARCHAR}, @@ -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} @@ -236,6 +240,9 @@ route_code = #{routeCode,jdbcType=VARCHAR}, + + type = #{type,jdbcType=VARCHAR}, + where id = #{id,jdbcType=BIGINT} @@ -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} \ No newline at end of file