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

This commit is contained in:
thesai 2021-11-25 17:19:50 +08:00
commit b97969ab47
7 changed files with 90 additions and 7 deletions

View File

@ -9,6 +9,7 @@ import club.joylink.rtss.services.training.generatornew.GeneratorNew;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuildParams;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
import club.joylink.rtss.simulation.cbtc.data.map.Signal;
import club.joylink.rtss.vo.client.CommandDefinitionVO;
import club.joylink.rtss.vo.client.LessonChapterTrainingRelVO;
import club.joylink.rtss.vo.client.LessonVO;
@ -77,6 +78,18 @@ public class GenerateTask {
// 构造仿真数据
// 根据操作定义生成实训
definitionVOList.forEach(operateDefinitionVO -> {
if (operateDefinitionVO.useReplaceSignal()) {
mapVO.getGraphDataNew().getSignalList().stream()
.filter(signalVO -> Signal.SignalType.TRANSMISSION.equals(signalVO.getType()))
.forEach(signalVO -> {
Signal signal = new Signal(signalVO.getCode(), signalVO.getUniqueName());
signal.setShowName(signalVO.getName());
Signal linkSignal = simulation.getRepository().getByCode(signalVO.getLinkSignalCode(), Signal.class);
signal.setLinkSignal(linkSignal);
linkSignal.addReplaceSignal(signal);
simulation.getRepository().getSignalList().add(signal);
});
}
try {
List<TrainingNewVO> trainingVOList = generator.generate(config, simulation, operateDefinitionVO);
if (CollectionUtils.isEmpty(trainingVOList)) {

View File

@ -48,7 +48,10 @@ public interface TrainingConsts {
/** 终端按钮信号机 */
END_BUTTON_SIGNAL,
/** 终端按钮信号机 */
BUTTON;
BUTTON,
/** 终端替代信号机 */
END_REPLACE_SIGNAL,
;
}
}

View File

@ -1,6 +1,7 @@
package club.joylink.rtss.services.training.generatornew;
import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.constants.MapPrdTypeEnum;
import club.joylink.rtss.services.training.constant.TrainingConsts;
import club.joylink.rtss.services.training.data.GenerateConfig;
import club.joylink.rtss.simulation.cbtc.Simulation;
@ -91,6 +92,23 @@ public interface GeneratorNew {
case END_SIGNAL:
s.setDeviceCode(((Route) mapDevice).getDestination().getCode());
break;
case END_REPLACE_SIGNAL:
Route route = (Route) mapDevice;
List<Signal> replaceSignals = route.getDestination().getReplaceSignals();
if (replaceSignals != null) {
Signal signal;
if (MapPrdTypeEnum.LOCAL.equals(MapPrdTypeEnum.getMapPrdTypeEnumByCode(config.getPrdType()))) {
signal = replaceSignals.stream().filter(ss -> ss.getShowName().startsWith("F")).findFirst().orElse(null);
} else {
signal = replaceSignals.stream().filter(ss -> ss.getShowName().startsWith("T")).findFirst().orElse(null);
}
if (signal != null) {
s.setDeviceCode(signal.getCode());
break;
}
}
s.setDeviceCode(route.getDestination().getCode());
break;
case END_BUTTON_SIGNAL:
s.setDeviceCode(((Route) mapDevice).getDestinationButtonSignal().getCode());
break;

View File

@ -41,8 +41,12 @@ public class StationGeneratorNew implements GeneratorNew {
switch (Operation.Type.valueOf (operateDefinitionVO.getOperateType())) {
case Station_Set_CI_Auto_Trigger:
if(!station.isInterlock())continue;
if (MapPrdTypeEnum.LOCAL.equals(MapPrdTypeEnum.getMapPrdTypeEnumByCode(config.getPrdType()))) {
if (BusinessConsts.MapPrd.PrdType.Type01.equals(config.getPrdType())) {
if(station.isCentralized()) {
station.setControlMode(Station.ControlMode.Local);
}else{
station.getDeviceStation().setControlMode(Station.ControlMode.Local);
}
}
simulation.getRepository().getRouteList().stream()
.filter(route -> route.getInterlockStation().equals(station))
@ -56,8 +60,12 @@ public class StationGeneratorNew implements GeneratorNew {
break;
case Station_Cancel_CI_Auto_Trigger:
if(!station.isInterlock())continue;
if (MapPrdTypeEnum.LOCAL.equals(MapPrdTypeEnum.getMapPrdTypeEnumByCode(config.getPrdType()))) {
if (BusinessConsts.MapPrd.PrdType.Type01.equals(config.getPrdType())) {
if(station.isCentralized()) {
station.setControlMode(Station.ControlMode.Local);
}else{
station.getDeviceStation().setControlMode(Station.ControlMode.Local);
}
}
List<Route> routeList2 = simulation.getRepository().getRouteList();
for (Route route : routeList2) {
@ -69,7 +77,13 @@ public class StationGeneratorNew implements GeneratorNew {
break;
case Station_Open_Auto_Setting:
if(!station.isInterlock())continue;
station.setControlMode(Station.ControlMode.Center);
if (BusinessConsts.MapPrd.PrdType.Type01.equals(config.getPrdType())) {
if(station.isCentralized()) {
station.setControlMode(Station.ControlMode.Local);
}else{
station.getDeviceStation().setControlMode(Station.ControlMode.Local);
}
}
List<Route> routeList3 = simulation.getRepository().getRouteList();
for (Route route : routeList3) {
if (Objects.equals(route.getInterlockStation(), station)) {
@ -81,8 +95,14 @@ public class StationGeneratorNew implements GeneratorNew {
break;
case Station_Close_Auto_Setting:
if(!station.isInterlock())continue;
if (BusinessConsts.MapPrd.PrdType.Type01.equals(config.getPrdType())) {
if(station.isCentralized()) {
station.setControlMode(Station.ControlMode.Local);
}else{
station.getDeviceStation().setControlMode(Station.ControlMode.Local);
}
}
List<Route> routeList4 = simulation.getRepository().getRouteList();
station.setControlMode(Station.ControlMode.Center);
for (Route route : routeList4) {
if (Objects.equals(route.getInterlockStation(), station)) {
if (!route.isAtsControl()) {
@ -261,6 +281,13 @@ public class StationGeneratorNew implements GeneratorNew {
}
case Station_Release: {
if(!station.isInterlock())continue;
if (BusinessConsts.MapPrd.PrdType.Type01.equals(config.getPrdType())) {
if(station.isCentralized()) {
station.setControlMode(Station.ControlMode.Local);
}else{
station.getDeviceStation().setControlMode(Station.ControlMode.Local);
}
}
SimulationMember member = new SimulationMember("", SimulationMember.Type.DISPATCHER, null);
String operate = Operation.Type.Server_ATP_Restart.name();
Map<String, Object> param = new HashMap<>();

View File

@ -147,6 +147,11 @@ public class Signal extends DelayUnlockDevice {
*/
private Signal linkSignal;
/**
* 替代信号机
*/
private List<Signal> replaceSignals;
// ------------------状态属性---------------------
private int mode;
@ -615,6 +620,13 @@ public class Signal extends DelayUnlockDevice {
return this.signalModel.getGuideAspect();
}
public void addReplaceSignal(Signal signal) {
if (replaceSignals == null) {
replaceSignals = new ArrayList<>();
}
replaceSignals.add(signal);
}
public enum LightColor {
RED,
YELLOW,

View File

@ -26,6 +26,8 @@ public class OperateDefinitionConfig {
private List<String> sectionTypes;//区段生成指定类型
public Boolean useReplaceSignal;
public boolean isAtp() {
return RouteType.ATP.equals(this.routeType);
}

View File

@ -198,4 +198,12 @@ public class OperateDefinitionVO {
}
return null;
}
public boolean useReplaceSignal() {
OperateDefinitionConfig routeSettingConfig = this.getRouteSettingConfig();
if (Objects.nonNull(routeSettingConfig)) {
return routeSettingConfig.getUseReplaceSignal() != null && routeSettingConfig.getUseReplaceSignal();
}
return false;
}
}