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

This commit is contained in:
walker-sheng 2021-02-03 09:41:37 +08:00
commit 616ce791fd
9 changed files with 87 additions and 34 deletions

View File

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

View File

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

View File

@ -38,7 +38,9 @@ public class SignalGeneratorNew implements GeneratorNew {
.stream().filter(mapCycleButtonVO -> mapCycleButtonVO.getCycleCode().equals(cycle.getCode()))
.forEach(button -> {
trainingVOList.add(this.build(config, simulation, cycle,button, operateDefinitionVO));
simulation.reset();
});
continue;
}else {
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()))
.forEach(button -> {
trainingVOList.add(this.build(config, simulation, cycle,button, operateDefinitionVO));
simulation.reset();
});
continue;
}else{
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()))
.forEach(button -> {
trainingVOList.add(this.build(config, simulation, route.getStart(), button, operateDefinitionVO));
simulation.reset();
});
continue;
} else {
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()))
.forEach(button -> {
trainingVOList.add(this.build(config, simulation,signal, button, operateDefinitionVO));
simulation.reset();
});
continue;
} else {
trainingVOList.add(this.build(config, simulation, signal,null, operateDefinitionVO));
}

View File

@ -66,19 +66,7 @@ public class StandGeneratorNew implements GeneratorNew {
break;
}
case Stand_Whole_Line_Cancel_Hold_Train:{
stand.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);
}
}
standList.forEach(stand1 -> stand1.setCenterHoldTrain(true));
break;
}
case Stand_Early_Depart:{

View File

@ -89,6 +89,28 @@ public class StationGeneratorNew implements GeneratorNew {
// if (!signal.isBlockade()) {
// 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;
default:
@ -99,18 +121,18 @@ public class StationGeneratorNew implements GeneratorNew {
// 仿真重置
simulation.reset();
}
List<Station> tbStationList = simulation.getRepository().getStationList()
.stream()
.filter(station -> station.isTurnBack())
.collect(Collectors.toList());
tbStationList.forEach(station -> {
if (Objects.equals(Operation.Type.Station_Set_Turn_Back_Strategy.name(), operateDefinitionVO.getOperateType())) {
station.setControlMode(Station.ControlMode.Center);
trainingVOList.add(build(config, simulation, station,null, operateDefinitionVO));
// 仿真重置
simulation.reset();
}
});
// List<Station> tbStationList = simulation.getRepository().getStationList()
// .stream()
// .filter(station -> station.isTurnBack())
// .collect(Collectors.toList());
// tbStationList.forEach(station -> {
// if (Objects.equals(Operation.Type.Station_Set_Turn_Back_Strategy.name(), operateDefinitionVO.getOperateType())) {
// station.setControlMode(Station.ControlMode.Center);
// trainingVOList.add(build(config, simulation, station,null, operateDefinitionVO));
// // 仿真重置
// simulation.reset();
// }
// });
return trainingVOList;
}
}

View File

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

View File

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

View File

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