Merge remote-tracking branch 'origin/test' into ci-restruct

This commit is contained in:
walker-sheng 2021-09-15 11:00:36 +08:00
commit 061ed998fd
2 changed files with 39 additions and 29 deletions

View File

@ -133,22 +133,31 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
.filter(signal -> signal.getInterlockStation().getCode().equals(stationCode))
.collect(Collectors.toList());
log.info(String.format("共有信号机[%s]个", signalList.size()));
signalList.sort((signal1, signal2) -> {
String s1 = signal1.getShowName();
String s2 = signal2.getShowName();
return s1.length() != s2.length() ? s1.length() - s2.length() : s1.compareTo(s2);
});
for (Signal signal : signalList) {
// 信号机接近区段构建
// this.generateApproachSection(signal, generateConfig);
// 列车兼调车信号机调车信号机
if (signal.getType().equals(Signal.SignalType.SHUNTING2)) {
signal.setType(Signal.SignalType.SHUNTING);
generatedRouteList.addAll(this.generateRouteDepot(signal, routeCodeGenerator, generateConfig, errorList));
signal.setType(Signal.SignalType.SHUNTING2);
generatedRouteList.addAll(this.generateRouteDepot(signal, routeCodeGenerator, generateConfig, errorList));
} else if (signal.getType().equals(Signal.SignalType.SHUNTING)) {
generatedRouteList.addAll(this.generateRouteDepot(signal, routeCodeGenerator, generateConfig, errorList));
}
}
log.info(String.format("生成一般进路[%s]条", generatedRouteList.size()));
// 进路敌对关系构建
// this.buildRouteConflict(generatedRouteList);
this.buildRouteConflict(generatedRouteList);
if (!CollectionUtils.isEmpty(errorList)) {
for (String errMsg : errorList) {
log.warn(String.format("联锁数据生成警告信息:[%s]", errMsg));
}
}
// // 清除不需要的基本进路
// this.deleteBaseRoute(signalList, generatedRouteList);
// 删除旧数据保存新数据
this.draftMapRouteService.deleteRoutes(deletingList);
this.draftMapRouteService.createRoutes(mapId, generatedRouteList.stream()
@ -713,9 +722,6 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
MapCiGenerateConfig config, List<String> errorList) {
boolean right = start.isRight();
Section startSection = start.getSection().getSectionOf(right);
if (Objects.isNull(startSection)) {
System.out.println(start.getShowName());
}
List<SectionPath> routePathList = new ArrayList<>();
getRoutePathOfDepot(start, startSection, new SectionPath(right), routePathList, config, errorList);
return buildRouteFromPathDepot(start, routeCodeGenerator, routePathList, config, errorList);
@ -729,23 +735,17 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
for (SectionPath sectionPath : routePathList) {
Section lastSection = sectionPath.getLastSection();
Signal end = lastSection.getSignalOf(right);
// 根据配置取进路终端信号机名称
Signal clickEnd = Objects.nonNull(end) ? end : null;
String endName = Objects.nonNull(end) ? end.getShowName() : lastSection.getName();
Signal clickEnd = null;
if (config.isRouteButton() && config.isGetNearlySignal()) {
// 进路按钮取最近的信号机
clickEnd = this.queryNearlySignalOf(start, sectionPath);
}
// 构建进路
String code = routeCodeGenerator.next();
String name = String.format("%s-%s", start.getShowName(), endName);
Route route = this.buildRoute(code, name, start, end, clickEnd, sectionPath,
null, config.isRouteSignalAlwaysGreen(), config.isRouteInterlockDoNotIncludeStandHoldTrain());
routeList.add(route);
}
} else {
errorList.add(String.format("以[%s(%s)]为始端信号的进路未搜索到", start.getName(), start.getCode()));
errorList.add(String.format("以[%s(%s)]为始端信号的进路未搜索到", start.getShowName(), start.getCode()));
}
return routeList;
}
@ -1873,16 +1873,29 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
MapCiGenerateConfig config, List<String> errorList) {
boolean right = startSignal.isRight();
if (!CollectionUtils.isEmpty(tempPath.getSectionList())) {
if (Objects.isNull(section)) {
// if (routePathList.size() > 1) {
Signal signal = tempPath.getLastSection().getSignalOf(right);
if (startSignal.getType().equals(Signal.SignalType.SHUNTING2)) {
// 同向类型相同信号机
if (Objects.nonNull(signal) && signal.getType().equals(startSignal.getType())) {
routePathList.add(tempPath);
// }
return;
}
// 兼容在道岔区段的信号机
Signal signal = tempPath.getLastSection().getSignalOf(right);
if (Objects.isNull(section)) {
Signal lastSignal = tempPath.getLastSection().getSignalOf(!right);
if (Objects.nonNull(lastSignal) && lastSignal.getType().equals(startSignal.getType())) {
routePathList.add(tempPath);
}
return;
}
} else {
// 同向类型相同信号机
if (Objects.nonNull(signal)) { // 找到添加路径返回
if (signal.isDepotSameSignal(startSignal)) {
if (signal.getType().equals(startSignal.getType()) || signal.getType().equals(Signal.SignalType.SHUNTING2)) {
routePathList.add(tempPath);
return;
}
}
if (Objects.isNull(section)) {
routePathList.add(tempPath);
return;
}

View File

@ -452,9 +452,6 @@ public class Signal extends DelayUnlockDevice {
public boolean isDepotSameSignal(Signal signal) {
return this.type.equals(signal.getType())
|| (this.type.equals(SignalType.PROTECTION) && signal.getType().equals(SignalType.SHUNTING2))
|| (this.type.equals(SignalType.SHUNTING) && signal.getType().equals(SignalType.SHUNTING2))
|| (this.type.equals(SignalType.SHUNTING2) && signal.getType().equals(SignalType.PROTECTION))
|| (this.type.equals(SignalType.SHUNTING2) && signal.getType().equals(SignalType.SHUNTING));
}