实训修改

This commit is contained in:
DU 2021-02-02 18:40:37 +08:00
parent f504f457ed
commit d2e3a42304
9 changed files with 87 additions and 34 deletions

View File

@ -131,7 +131,7 @@ public class RaceTheoryService implements IRaceTheoryService {
@Override @Override
@Transactional @Transactional
public List<RaceResultDetailVO> submitProjectTheory(UserVO user, String projectCode, Integer companyId, ProjectTheoryAnswerVO theoryAnswers) { public List<RaceResultDetailVO> submitProjectTheory(UserVO user, String projectCode, Integer companyId, ProjectTheoryAnswerVO theoryAnswers) {
List<Float> scores = new ArrayList<Float>() {{ List<Float> scores = new ArrayList<>() {{
add(0f); add(0f);
}}; }};
boolean isDefault = Project.isDefault(Project.valueOf(projectCode)); boolean isDefault = Project.isDefault(Project.valueOf(projectCode));

View File

@ -7,6 +7,7 @@ import club.joylink.rtss.simulation.cbtc.data.map.*;
import club.joylink.rtss.simulation.cbtc.data.storage.StorageSimulation; import club.joylink.rtss.simulation.cbtc.data.storage.StorageSimulation;
import club.joylink.rtss.constants.BusinessConsts; import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.util.ReflectionUtils; import club.joylink.rtss.util.ReflectionUtils;
import club.joylink.rtss.vo.client.map.newmap.MapTurnBackStrategyVO;
import club.joylink.rtss.vo.client.training.definition.OperateDefinitionVO; import club.joylink.rtss.vo.client.training.definition.OperateDefinitionVO;
import club.joylink.rtss.vo.client.training.definition.OperatePlaceholderVO; import club.joylink.rtss.vo.client.training.definition.OperatePlaceholderVO;
import club.joylink.rtss.vo.client.training.definition.OperateStepVO; import club.joylink.rtss.vo.client.training.definition.OperateStepVO;
@ -15,6 +16,7 @@ import club.joylink.rtss.vo.client.map.newmap.MapAutomaticRouteButtonVO;
import club.joylink.rtss.vo.client.map.newmap.MapCycleButtonVO; import club.joylink.rtss.vo.client.map.newmap.MapCycleButtonVO;
import club.joylink.rtss.vo.client.training.TrainingNewVO; import club.joylink.rtss.vo.client.training.TrainingNewVO;
import club.joylink.rtss.vo.client.training.TrainingStepVO; import club.joylink.rtss.vo.client.training.TrainingStepVO;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
@ -92,6 +94,9 @@ public interface GeneratorNew {
} else if (mapButton instanceof MapAutomaticRouteButtonVO) { } else if (mapButton instanceof MapAutomaticRouteButtonVO) {
s.setDeviceCode(((MapAutomaticRouteButtonVO) mapButton).getCode()); s.setDeviceCode(((MapAutomaticRouteButtonVO) mapButton).getCode());
break; break;
} else if (mapButton instanceof MapTurnBackStrategyVO) {
s.setDeviceCode(((MapTurnBackStrategyVO) mapButton).getCode());
break;
} }
} }
case NULL: case NULL:
@ -121,6 +126,8 @@ public interface GeneratorNew {
trainingVO.setLocateDeviceCode(((MapCycleButtonVO) mapButton).getCode()); trainingVO.setLocateDeviceCode(((MapCycleButtonVO) mapButton).getCode());
} else if (mapButton instanceof MapAutomaticRouteButtonVO) { } else if (mapButton instanceof MapAutomaticRouteButtonVO) {
trainingVO.setLocateDeviceCode(((MapAutomaticRouteButtonVO) mapButton).getCode()); trainingVO.setLocateDeviceCode(((MapAutomaticRouteButtonVO) mapButton).getCode());
} else if (mapButton instanceof MapTurnBackStrategyVO) {
trainingVO.setLocateDeviceCode(((MapTurnBackStrategyVO) mapButton).getCode());
} }
} }
} }
@ -236,7 +243,6 @@ public interface GeneratorNew {
String[] split = operatePlaceholderVO.getValNew().split("::"); String[] split = operatePlaceholderVO.getValNew().split("::");
String right = ReflectionUtils.invokeMethodByName(mapDevice, split[0], null).toString(); String right = ReflectionUtils.invokeMethodByName(mapDevice, split[0], null).toString();
Boolean upRight = map.getConfigVO().getUpRight(); Boolean upRight = map.getConfigVO().getUpRight();
if (right.equals(split[1])) { if (right.equals(split[1])) {
if (upRight) { if (upRight) {
str = str.replace(matcher.group(1), split[4]); str = str.replace(matcher.group(1), split[4]);
@ -256,7 +262,6 @@ public interface GeneratorNew {
} }
case PlaceholderType.Type06: { case PlaceholderType.Type06: {
String[] split = operatePlaceholderVO.getValNew().split("::"); String[] split = operatePlaceholderVO.getValNew().split("::");
String name = ReflectionUtils.invokeGetter(mapDevice, split[0]).toString(); String name = ReflectionUtils.invokeGetter(mapDevice, split[0]).toString();
boolean flag = (boolean) ReflectionUtils.invokeMethodByName(mapDevice, split[1], null); boolean flag = (boolean) ReflectionUtils.invokeMethodByName(mapDevice, split[1], null);
str = str.replace(matcher.group(1), name); str = str.replace(matcher.group(1), name);
@ -265,6 +270,13 @@ public interface GeneratorNew {
} }
break; break;
} }
case PlaceholderType.Type07: {
String[] split = operatePlaceholderVO.getValNew().split("::");
List list = (List) ReflectionUtils.invokeGetter(Objects.isNull(mapButton) ? mapDevice : mapButton, split[0]);
String s = ReflectionUtils.invokeGetter(list.get(0), split[1]).toString();
str = str.replace(matcher.group(1), s);
break;
}
} }
} }
return str; return str;
@ -297,6 +309,11 @@ public interface GeneratorNew {
* 通过方法判断,boolean方法判断是否加上后缀符 * 通过方法判断,boolean方法判断是否加上后缀符
*/ */
String Type06 = "06"; String Type06 = "06";
/**
* 获取属性为list的第一个元素的某个属性
*/
String Type07 = "07";
} }
} }

View File

@ -83,13 +83,13 @@ public class SectionGeneratorNew implements GeneratorNew {
break; break;
case Section_Cancel_Limit_Speed: case Section_Cancel_Limit_Speed:
// 设置区段限速 // 设置区段限速
if (Objects.nonNull(section.getParent())) { // if (Objects.nonNull(section.getParent()) && CollectionUtils.isEmpty(operateDefinitionVO.getSectionTypes())) {
for (Section logic : section.getParent().getLogicList()) { // for (Section logic : section.getParent().getLogicList()) {
logic.setSpeedUpLimit(LIMITED_SPEED); // logic.setSpeedUpLimit(LIMITED_SPEED);
} // }
} else { // } else {
section.setSpeedUpLimit(LIMITED_SPEED); section.setSpeedUpLimit(LIMITED_SPEED);
} // }
break; break;
case Section_Confirm_Axis_Valid: case Section_Confirm_Axis_Valid:
// 设置计轴失效ARB // 设置计轴失效ARB

View File

@ -38,7 +38,9 @@ public class SignalGeneratorNew implements GeneratorNew {
.stream().filter(mapCycleButtonVO -> mapCycleButtonVO.getCycleCode().equals(cycle.getCode())) .stream().filter(mapCycleButtonVO -> mapCycleButtonVO.getCycleCode().equals(cycle.getCode()))
.forEach(button -> { .forEach(button -> {
trainingVOList.add(this.build(config, simulation, cycle,button, operateDefinitionVO)); trainingVOList.add(this.build(config, simulation, cycle,button, operateDefinitionVO));
simulation.reset();
}); });
continue;
}else { }else {
trainingVOList.add(this.build(config, simulation, cycle,null, operateDefinitionVO)); trainingVOList.add(this.build(config, simulation, cycle,null, operateDefinitionVO));
} }
@ -57,7 +59,9 @@ public class SignalGeneratorNew implements GeneratorNew {
.stream().filter(mapCycleButtonVO -> mapCycleButtonVO.getCycleCode().equals(cycle.getCode())) .stream().filter(mapCycleButtonVO -> mapCycleButtonVO.getCycleCode().equals(cycle.getCode()))
.forEach(button -> { .forEach(button -> {
trainingVOList.add(this.build(config, simulation, cycle,button, operateDefinitionVO)); trainingVOList.add(this.build(config, simulation, cycle,button, operateDefinitionVO));
simulation.reset();
}); });
continue;
}else{ }else{
trainingVOList.add(this.build(config, simulation, cycle,null, operateDefinitionVO)); trainingVOList.add(this.build(config, simulation, cycle,null, operateDefinitionVO));
} }
@ -260,7 +264,9 @@ public class SignalGeneratorNew implements GeneratorNew {
.stream().filter(automaticRouteButtonVO -> automaticRouteButtonVO.getAutomaticRouteCode().equals(route.getCode())) .stream().filter(automaticRouteButtonVO -> automaticRouteButtonVO.getAutomaticRouteCode().equals(route.getCode()))
.forEach(button -> { .forEach(button -> {
trainingVOList.add(this.build(config, simulation, route.getStart(), button, operateDefinitionVO)); trainingVOList.add(this.build(config, simulation, route.getStart(), button, operateDefinitionVO));
simulation.reset();
}); });
continue;
} else { } else {
trainingVOList.add(this.build(config, simulation, route.getStart(), null, operateDefinitionVO)); trainingVOList.add(this.build(config, simulation, route.getStart(), null, operateDefinitionVO));
} }
@ -284,7 +290,9 @@ public class SignalGeneratorNew implements GeneratorNew {
.stream().filter(automaticRouteButtonVO -> automaticRouteButtonVO.getAutomaticRouteCode().equals(route.getCode())) .stream().filter(automaticRouteButtonVO -> automaticRouteButtonVO.getAutomaticRouteCode().equals(route.getCode()))
.forEach(button -> { .forEach(button -> {
trainingVOList.add(this.build(config, simulation,signal, button, operateDefinitionVO)); trainingVOList.add(this.build(config, simulation,signal, button, operateDefinitionVO));
simulation.reset();
}); });
continue;
} else { } else {
trainingVOList.add(this.build(config, simulation, signal,null, operateDefinitionVO)); trainingVOList.add(this.build(config, simulation, signal,null, operateDefinitionVO));
} }

View File

@ -66,19 +66,7 @@ public class StandGeneratorNew implements GeneratorNew {
break; break;
} }
case Stand_Whole_Line_Cancel_Hold_Train:{ case Stand_Whole_Line_Cancel_Hold_Train:{
stand.setCenterHoldTrain(true); standList.forEach(stand1 -> stand1.setCenterHoldTrain(true));
if(i >= 1) {
standList.get(i - 1).setCenterHoldTrain(true);
if(i >= 2) {
standList.get(i - 2).setCenterHoldTrain(true);
}
}
if(i < standList.size() - 1) {
standList.get(i + 1).setCenterHoldTrain(true);
if(i < standList.size() - 2) {
standList.get(i + 2).setCenterHoldTrain(true);
}
}
break; break;
} }
case Stand_Early_Depart:{ case Stand_Early_Depart:{

View File

@ -89,6 +89,28 @@ public class StationGeneratorNew implements GeneratorNew {
// if (!signal.isBlockade()) { // if (!signal.isBlockade()) {
// signal.setBlockade(false); // signal.setBlockade(false);
// } // }
// });
break;
case Station_Set_Turn_Back_Strategy:
if(!station.isTurnBack()) {
continue;
}
station.setControlMode(Station.ControlMode.Center);
if(operateDefinitionVO.turnBackStrategyButton()){
simulation.getBuildParams().getMap().getGraphDataNew().getTbStrategyList()
.stream().filter(turnBackStrategyO -> turnBackStrategyO.getStationCode().equals(station.getCode()))
.forEach(button -> {
trainingVOList.add(this.build(config, simulation, station,button, operateDefinitionVO));
simulation.reset();
});
continue;
}
// simulation.getRepository().getSignalList().stream()
// .filter(s -> Objects.equals(station.getCode(), s.getDeviceStation().getCode()))
// .forEach(signal -> {
// if (!signal.isBlockade()) {
// signal.setBlockade(false);
// }
// }); // });
break; break;
default: default:
@ -99,18 +121,18 @@ public class StationGeneratorNew implements GeneratorNew {
// 仿真重置 // 仿真重置
simulation.reset(); simulation.reset();
} }
List<Station> tbStationList = simulation.getRepository().getStationList() // List<Station> tbStationList = simulation.getRepository().getStationList()
.stream() // .stream()
.filter(station -> station.isTurnBack()) // .filter(station -> station.isTurnBack())
.collect(Collectors.toList()); // .collect(Collectors.toList());
tbStationList.forEach(station -> { // tbStationList.forEach(station -> {
if (Objects.equals(Operation.Type.Station_Set_Turn_Back_Strategy.name(), operateDefinitionVO.getOperateType())) { // if (Objects.equals(Operation.Type.Station_Set_Turn_Back_Strategy.name(), operateDefinitionVO.getOperateType())) {
station.setControlMode(Station.ControlMode.Center); // station.setControlMode(Station.ControlMode.Center);
trainingVOList.add(build(config, simulation, station,null, operateDefinitionVO)); // trainingVOList.add(build(config, simulation, station,null, operateDefinitionVO));
// 仿真重置 // // 仿真重置
simulation.reset(); // simulation.reset();
} // }
}); // });
return trainingVOList; return trainingVOList;
} }
} }

View File

@ -23,4 +23,5 @@ public class MapTurnBackStrategyVO {
private List<MapTurnBackStrategyOptionVO> optionList; private List<MapTurnBackStrategyOptionVO> optionList;
private Integer initId; private Integer initId;
} }

View File

@ -19,6 +19,9 @@ public class OperateDefinitionConfig {
private Boolean autoCycleBT; private Boolean autoCycleBT;
//引导总锁 //引导总锁
//折返策略按钮
private Boolean tbStrategyBT;
private List<String> sectionTypes;//区段生成指定类型 private List<String> sectionTypes;//区段生成指定类型
public boolean isAtp() { public boolean isAtp() {
@ -53,4 +56,10 @@ public class OperateDefinitionConfig {
} }
return false; return false;
} }
public boolean turnBackStrategyButton(){
if(Objects.nonNull(tbStrategyBT)){
return tbStrategyBT;
}
return false;
}
} }

View File

@ -181,6 +181,14 @@ public class OperateDefinitionVO {
return false; return false;
} }
public boolean turnBackStrategyButton() {
OperateDefinitionConfig routeSettingConfig = this.getRouteSettingConfig();
if (Objects.nonNull(routeSettingConfig)) {
return routeSettingConfig.turnBackStrategyButton();
}
return false;
}
public List<String> getSectionTypes() { public List<String> getSectionTypes() {
OperateDefinitionConfig routeSettingConfig = this.getRouteSettingConfig(); OperateDefinitionConfig routeSettingConfig = this.getRouteSettingConfig();
if (Objects.nonNull(routeSettingConfig)) { if (Objects.nonNull(routeSettingConfig)) {