Merge remote-tracking branch 'origin/test-training2' into test-training2
This commit is contained in:
commit
dace38e27c
@ -10,6 +10,8 @@ public class RtsTraining2Rule {
|
|||||||
|
|
||||||
private String simType;
|
private String simType;
|
||||||
|
|
||||||
|
private String lineCode;
|
||||||
|
|
||||||
private String locationRule;
|
private String locationRule;
|
||||||
|
|
||||||
private String deviceRule;
|
private String deviceRule;
|
||||||
|
@ -225,6 +225,66 @@ public class RtsTraining2RuleExample {
|
|||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Criteria andLineCodeIsNull() {
|
||||||
|
addCriterion("line_code is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLineCodeIsNotNull() {
|
||||||
|
addCriterion("line_code is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLineCodeEqualTo(String value) {
|
||||||
|
addCriterion("line_code =", value, "lineCode");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLineCodeNotEqualTo(String value) {
|
||||||
|
addCriterion("line_code <>", value, "lineCode");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLineCodeGreaterThan(String value) {
|
||||||
|
addCriterion("line_code >", value, "lineCode");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLineCodeGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("line_code >=", value, "lineCode");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLineCodeLessThan(String value) {
|
||||||
|
addCriterion("line_code <", value, "lineCode");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLineCodeLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("line_code <=", value, "lineCode");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLineCodeIn(List<String> values) {
|
||||||
|
addCriterion("line_code in", values, "lineCode");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLineCodeNotIn(List<String> values) {
|
||||||
|
addCriterion("line_code not in", values, "lineCode");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLineCodeBetween(String value1, String value2) {
|
||||||
|
addCriterion("line_code between", value1, value2, "lineCode");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLineCodeNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("line_code not between", value1, value2, "lineCode");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
public Criteria andFunctionIdIsNull() {
|
public Criteria andFunctionIdIsNull() {
|
||||||
addCriterion("function_id is null");
|
addCriterion("function_id is null");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
|
@ -60,7 +60,7 @@ public class Training2RuleService {
|
|||||||
runningMapIdSet.add(mapId);
|
runningMapIdSet.add(mapId);
|
||||||
// 规则列表
|
// 规则列表
|
||||||
RtsTraining2RuleExample example = new RtsTraining2RuleExample();
|
RtsTraining2RuleExample example = new RtsTraining2RuleExample();
|
||||||
example.createCriteria().andSimTypeEqualTo(simulation.getBuildParams().getWorkParamVO().getType().name());
|
example.createCriteria().andLineCodeEqualTo(simulation.getBuildParams().getMap().getLineCode());
|
||||||
List<RtsTraining2RuleWithBLOBs> ruleList = rtsTraining2RuleMapper.selectByExampleWithBLOBs(example);
|
List<RtsTraining2RuleWithBLOBs> ruleList = rtsTraining2RuleMapper.selectByExampleWithBLOBs(example);
|
||||||
if (!CollectionUtils.isEmpty(ruleList)) {
|
if (!CollectionUtils.isEmpty(ruleList)) {
|
||||||
// 清除数据库原有数据
|
// 清除数据库原有数据
|
||||||
|
@ -11,9 +11,12 @@ 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.simulation.cbtc.data.support.SectionPosition;
|
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo;
|
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySectionAxleCounter;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySignal;
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySignal;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch;
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||||
import club.joylink.rtss.util.JsonUtils;
|
import club.joylink.rtss.util.JsonUtils;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
@ -69,17 +72,6 @@ public enum BgSceneStatusRule {
|
|||||||
return getBgScene(simulation);
|
return getBgScene(simulation);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
* 道岔封锁背景:将道岔设置为未封锁
|
|
||||||
*/
|
|
||||||
SWITCH_BLOCK_BG_SCENE("道岔封锁背景") {
|
|
||||||
@Override
|
|
||||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
|
||||||
Switch iSwitch = (Switch) mapElement;
|
|
||||||
setBlockSwitch(iSwitch, false);
|
|
||||||
return getBgScene(simulation);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/**
|
/**
|
||||||
* 道岔解封背景:将道岔设置为封锁
|
* 道岔解封背景:将道岔设置为封锁
|
||||||
*/
|
*/
|
||||||
@ -87,18 +79,9 @@ public enum BgSceneStatusRule {
|
|||||||
@Override
|
@Override
|
||||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
Switch iSwitch = (Switch) mapElement;
|
Switch iSwitch = (Switch) mapElement;
|
||||||
setBlockSwitch(iSwitch, true);
|
iSwitch.setBlockade(true);
|
||||||
return getBgScene(simulation);
|
iSwitch.getAllSections().stream().forEach(section -> section.setBlockade(true));
|
||||||
}
|
iSwitch.setInit(false);
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 道岔单锁背景:将道岔设置为未封锁
|
|
||||||
*/
|
|
||||||
SWITCH_SINGLE_BLOCK_BG_SCENE("道岔单锁背景") {
|
|
||||||
@Override
|
|
||||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
|
||||||
Switch iSwitch = (Switch) mapElement;
|
|
||||||
setSingleLockSwitch(iSwitch, false);
|
|
||||||
return getBgScene(simulation);
|
return getBgScene(simulation);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -109,7 +92,39 @@ public enum BgSceneStatusRule {
|
|||||||
@Override
|
@Override
|
||||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
Switch iSwitch = (Switch) mapElement;
|
Switch iSwitch = (Switch) mapElement;
|
||||||
setSingleLockSwitch(iSwitch, true);
|
iSwitch.setSingleLock(true);
|
||||||
|
return getBgScene(simulation);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
SWITCH_FAULT_UNLOCK_BG_SCENE("道岔故障解锁背景") {
|
||||||
|
@Override
|
||||||
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
|
Switch iSwitch = (Switch) mapElement;
|
||||||
|
iSwitch.setRouteLock(true);
|
||||||
|
iSwitch.getAllSections().forEach(section -> section.setRouteLock(true));
|
||||||
|
return getBgScene(simulation);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
SWITCH_AXLE_FAULT_PRE_RESET_BG_SCENE("道岔计轴预复位背景") {
|
||||||
|
@Override
|
||||||
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
|
Switch iSwitch = (Switch) mapElement;
|
||||||
|
Switch.SwitchFault.AXLE_FAULT.apply(iSwitch);
|
||||||
|
return getBgScene(simulation);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
SWITCH_SECTION_ACTIVE_BG_SCENE("道岔区段激活背景") {
|
||||||
|
@Override
|
||||||
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
|
Switch iSwitch = (Switch) mapElement;
|
||||||
|
return SECTION_ACTIVE_BG_SCENE.doHandle(simulation, iSwitch.getA());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
SWITCH_SECTION_LIMIT_SPEED("道岔区段速度限制背景") {
|
||||||
|
@Override
|
||||||
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
|
Switch iSwitch = (Switch) mapElement;
|
||||||
|
iSwitch.getAllSections().forEach(section -> section.setSpeedUpLimit(5));
|
||||||
return getBgScene(simulation);
|
return getBgScene(simulation);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -231,6 +246,19 @@ public enum BgSceneStatusRule {
|
|||||||
return getBgScene(simulation);
|
return getBgScene(simulation);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
SECTION_UNLOCK_BG_SCENE("区段解封背景"){
|
||||||
|
@Override
|
||||||
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
|
Section section = (Section) mapElement;
|
||||||
|
section.setBlockade(true);
|
||||||
|
if (!CollectionUtils.isEmpty(section.getLogicList())) {
|
||||||
|
for (Section logic : section.getLogicList()) {
|
||||||
|
logic.setBlockade(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return getBgScene(simulation);
|
||||||
|
}
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 区段激活背景
|
* 区段激活背景
|
||||||
*/
|
*/
|
||||||
@ -246,7 +274,7 @@ public enum BgSceneStatusRule {
|
|||||||
for (Section logic : axleSection.getLogicList()) {
|
for (Section logic : axleSection.getLogicList()) {
|
||||||
logic.setCutOff(true);
|
logic.setCutOff(true);
|
||||||
}
|
}
|
||||||
return null;
|
return getBgScene(simulation);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@ -260,7 +288,7 @@ public enum BgSceneStatusRule {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
SECTION_CONFIRM_AXIS_VALID_BG_SCENE("") {
|
SECTION_CONFIRM_AXIS_VALID_BG_SCENE("设置计轴生效背景") {
|
||||||
@Override
|
@Override
|
||||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
Section section = (Section) mapElement;
|
Section section = (Section) mapElement;
|
||||||
@ -269,6 +297,34 @@ public enum BgSceneStatusRule {
|
|||||||
} else {
|
} else {
|
||||||
section.judgeAsNctOccupied(simulation);
|
section.judgeAsNctOccupied(simulation);
|
||||||
}
|
}
|
||||||
|
return getBgScene(simulation);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
SECTION_AXIS_PRE_RESET_BG_SCENE("计轴预复位背景") {
|
||||||
|
@Override
|
||||||
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
|
Section section = (Section) mapElement;
|
||||||
|
if(!section.isAxleCounter() && !section.isCross()){
|
||||||
|
throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error);
|
||||||
|
}
|
||||||
|
VirtualRealitySectionAxleCounter virtualAxleCounter = section.findAxleCounterSection().getVirtualAxleCounter();
|
||||||
|
virtualAxleCounter.setOccupy(true);
|
||||||
|
virtualAxleCounter.setPreReset(false);
|
||||||
|
virtualAxleCounter.setLeftCount(2);
|
||||||
|
virtualAxleCounter.setRightCount(2);
|
||||||
|
return getBgScene(simulation);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
SECTION_TURN_BACK_REENTRY_STRATEGY("区段折返策略修改背景"){
|
||||||
|
@Override
|
||||||
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
|
Section section = (Section) mapElement;
|
||||||
|
Stand stand = section.getStandList().get(0);
|
||||||
|
stand.setTypeStrategy(Stand.TurnBackType.AUTO);
|
||||||
|
// 添加信号机
|
||||||
|
VirtualRealityTrain train = (VirtualRealityTrain) simulation.getRepository().getVrDeviceMap().values().stream()
|
||||||
|
.filter(o -> o instanceof VirtualRealityTrain).findFirst().get();
|
||||||
|
BgSceneStatusRule.trainOnline(simulation, train, section, stand.isRight());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -282,7 +338,51 @@ public enum BgSceneStatusRule {
|
|||||||
restartInterlock(simulation, station);
|
restartInterlock(simulation, station);
|
||||||
return getBgScene(simulation);
|
return getBgScene(simulation);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
STAND_EARLY_DEPART_BG_SCENE("提前发车背景") {
|
||||||
|
@Override
|
||||||
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
|
Stand stand = (Stand) mapElement;
|
||||||
|
Section section = stand.getSection();
|
||||||
|
Route route = stand.getSection().getSignalToRight().getRouteList().stream().filter(r ->
|
||||||
|
(section.equals(r.getStart().getSection()) || r.containSection(section) && !r.routeLastSection(section))
|
||||||
|
&& Objects.equals(stand.isRight(), r.getStart().isRight()))
|
||||||
|
.findAny().orElse(null);
|
||||||
|
if (Objects.nonNull(route)) {
|
||||||
|
openRouteDirect(simulation, route);
|
||||||
}
|
}
|
||||||
|
// 添加信号机
|
||||||
|
VirtualRealityTrain train = (VirtualRealityTrain) simulation.getRepository().getVrDeviceMap().values().stream()
|
||||||
|
.filter(o -> o instanceof VirtualRealityTrain).findFirst().get();
|
||||||
|
BgSceneStatusRule.trainOnline(simulation,train,section,route.isRight());
|
||||||
|
return getBgScene(simulation);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
STAND_CANCEL_HOLD_TRAIN_BG_SCENE("站台取消扣车背景") {
|
||||||
|
@Override
|
||||||
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
|
Stand stand = (Stand) mapElement;
|
||||||
|
stand.setTrainLimit(3);
|
||||||
|
return getBgScene(simulation);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
STAND_FORCE_CANCEL_HOLD_TRAIN_BG_SCENE("强制取消扣车背景") {
|
||||||
|
@Override
|
||||||
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
|
Stand stand = (Stand) mapElement;
|
||||||
|
stand.setCenterHoldTrain(true);
|
||||||
|
return getBgScene(simulation);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
STAND_CANCEL_JUMP_STOP_BG_SCENE("站台取消设置跳停") {
|
||||||
|
@Override
|
||||||
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
|
Stand stand = (Stand) mapElement;
|
||||||
|
stand.setAllSkip(true);
|
||||||
|
return getBgScene(simulation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -403,28 +503,6 @@ public enum BgSceneStatusRule {
|
|||||||
signal.setAspect(aspect);
|
signal.setAspect(aspect);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 封锁、解封道岔
|
|
||||||
* @param aSwitch 道岔
|
|
||||||
*/
|
|
||||||
private static void setBlockSwitch(Switch aSwitch, boolean block) {
|
|
||||||
aSwitch.setBlockade(block);
|
|
||||||
aSwitch.getA().setBlockade(block);
|
|
||||||
aSwitch.getB().setBlockade(block);
|
|
||||||
aSwitch.getC().setBlockade(block);
|
|
||||||
if (block) {
|
|
||||||
aSwitch.setInit(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置道岔单锁、单解
|
|
||||||
*/
|
|
||||||
private static void setSingleLockSwitch(Switch aSwitch, boolean block) {
|
|
||||||
aSwitch.setSingleLock(block);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重启联锁机
|
* 重启联锁机
|
||||||
*/
|
*/
|
||||||
@ -458,6 +536,17 @@ public enum BgSceneStatusRule {
|
|||||||
SectionPosition headPosition = new SectionPosition(section, section.getStopPointByDirection(right));
|
SectionPosition headPosition = new SectionPosition(section, section.getStopPointByDirection(right));
|
||||||
train.initManualTrain(headPosition, right);
|
train.initManualTrain(headPosition, right);
|
||||||
SimulationDataRepository repository = simulation.getRepository();
|
SimulationDataRepository repository = simulation.getRepository();
|
||||||
|
//设置列车预选模式、驾驶模式、运行级别
|
||||||
|
if (!headPosition.getSection().anyZcWorking()) {
|
||||||
|
train.initAsRM();
|
||||||
|
} else {
|
||||||
|
MapConfig config = repository.getConfig();
|
||||||
|
if (RunLevel.ITC.equals(config.getRunMode())) {
|
||||||
|
train.initAsAM_I();
|
||||||
|
} else if (RunLevel.IL.equals(config.getRunMode())) {
|
||||||
|
train.initAsRM();
|
||||||
|
}
|
||||||
|
}
|
||||||
TrainInfo trainInfo = TrainInfo.constructManualTrain(train);
|
TrainInfo trainInfo = TrainInfo.constructManualTrain(train);
|
||||||
trainInfo.tracking(train);
|
trainInfo.tracking(train);
|
||||||
repository.addOnlineTrain(train);
|
repository.addOnlineTrain(train);
|
||||||
|
@ -4,42 +4,14 @@ import club.joylink.rtss.simulation.cbtc.Simulation;
|
|||||||
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||||
import club.joylink.rtss.vo.map.graph.MapStationNewVO;
|
import club.joylink.rtss.vo.map.graph.MapStationNewVO;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.function.Predicate;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public enum MapDeviceRule {
|
public enum MapDeviceRule {
|
||||||
METRO_ROUTE_LIST("地铁进路利列表") {
|
|
||||||
@Override
|
|
||||||
public List<Route> filterMapDeviceList(Simulation simulation) {
|
|
||||||
boolean isMETRO = Simulation.Type.METRO.equals(simulation.getBuildParams().getWorkParamVO().getType());
|
|
||||||
if (!isMETRO) {
|
|
||||||
return List.of();
|
|
||||||
}
|
|
||||||
List<Signal> signalList = METRO_DEPARTURE_SIGNAL_LIST.filterMapDeviceList(simulation);
|
|
||||||
List<Route> routeList = new ArrayList<>();
|
|
||||||
signalList.forEach(s -> routeList.addAll(s.getRouteList()));
|
|
||||||
return generateRandomElement(routeList, 2);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
RAILWAY_PICK_ROUTE_LIST("大铁接车进路列表") {
|
|
||||||
@Override
|
|
||||||
public List<Route> filterMapDeviceList(Simulation simulation) {
|
|
||||||
boolean isRailWay = Simulation.Type.RAILWAY.equals(simulation.getBuildParams().getWorkParamVO().getType());
|
|
||||||
if (!isRailWay) {
|
|
||||||
return List.of();
|
|
||||||
}
|
|
||||||
List<Route> routeList = simulation.getRepository().getRouteList().stream()
|
|
||||||
.filter(r -> Objects.equals(r.getType(), Route.Type.RECEIVING)).collect(Collectors.toList());
|
|
||||||
return generateRandomElement(routeList, 2);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
STATION_LIST("车站列表") {
|
STATION_LIST("车站列表") {
|
||||||
@Override
|
@Override
|
||||||
public List<Station> filterMapDeviceList(Simulation simulation) {
|
public List<Station> filterMapDeviceList(Simulation simulation) {
|
||||||
@ -50,62 +22,87 @@ public enum MapDeviceRule {
|
|||||||
return generateRandomElement(stationList, 1);
|
return generateRandomElement(stationList, 1);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
STAND_LIST("站台列表"){
|
||||||
|
@Override
|
||||||
|
public List<Stand> filterMapDeviceList(Simulation simulation) {
|
||||||
|
List<Station> stationList = STATION_LIST.filterMapDeviceList(simulation);
|
||||||
|
Station station = stationList.get(0);
|
||||||
|
return MapDeviceRule.generateRandomElement(station.getAllStandList(), 2);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
ROUTE_LIST("进路列表") {
|
||||||
|
@Override
|
||||||
|
public List<Route> filterMapDeviceList(Simulation simulation) {
|
||||||
|
List<Station> stationList = STATION_LIST.filterMapDeviceList(simulation);
|
||||||
|
Station station = stationList.get(0);
|
||||||
|
List<Route> routeList = new ArrayList<>();
|
||||||
|
station.getAllStandList().stream().filter(stand -> stand.getSection().getSignalToRight() != null)
|
||||||
|
.forEach(stand -> routeList.addAll(stand.getSection().getSignalToRight().getRouteList()));
|
||||||
|
return generateRandomElement(routeList, 2);
|
||||||
|
}
|
||||||
|
},
|
||||||
SWITCH_LIST("道岔列表") {
|
SWITCH_LIST("道岔列表") {
|
||||||
@Override
|
@Override
|
||||||
public List<Switch> filterMapDeviceList(Simulation simulation) {
|
public List<Switch> filterMapDeviceList(Simulation simulation) {
|
||||||
List<Switch> switchList = simulation.getRepository().getSwitchList();
|
List<Station> stationList = STATION_LIST.filterMapDeviceList(simulation);
|
||||||
|
Station station = stationList.get(0);
|
||||||
|
List<Switch> switchList = simulation.getRepository().getSwitchList().stream()
|
||||||
|
.filter(aSwitch -> station.equals(aSwitch.getDeviceStation())).collect(Collectors.toList());
|
||||||
return generateRandomElement(switchList, 2);
|
return generateRandomElement(switchList, 2);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
SIGNAL_LIST("信号机列表") {
|
SIGNAL_LIST("信号机列表") {
|
||||||
@Override
|
@Override
|
||||||
public List<Signal> filterMapDeviceList(Simulation simulation) {
|
public List<Signal> filterMapDeviceList(Simulation simulation) {
|
||||||
List<Signal> signalList = simulation.getRepository().getSignalList();
|
List<Station> stationList = STATION_LIST.filterMapDeviceList(simulation);
|
||||||
|
Station station = stationList.get(0);
|
||||||
|
List<Signal> signalList = new ArrayList<>();
|
||||||
|
station.getAllStandList().stream().filter(stand -> stand.getSection().getSignalToRight() != null)
|
||||||
|
.forEach(stand -> signalList.add(stand.getSection().getSignalToRight()));
|
||||||
return generateRandomElement(signalList, 2);
|
return generateRandomElement(signalList, 2);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
METRO_DEPARTURE_SIGNAL_LIST("地铁信号机列表") {
|
SECTION_LIST("区段列表") {
|
||||||
@Override
|
|
||||||
public List<Signal> filterMapDeviceList(Simulation simulation) {
|
|
||||||
List<Signal> signalList = simulation.getRepository().getStandList().stream().map(s -> s.getSection().getSignalToRight())
|
|
||||||
.filter(s -> s != null && !CollectionUtils.isEmpty(s.getRouteList())).collect(Collectors.toList());
|
|
||||||
return generateRandomElement(signalList, 2);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
RAILWAY_DEPARTURE_SIGNAL_LIST("大铁发车信号机列表") {
|
|
||||||
@Override
|
|
||||||
public List<Signal> filterMapDeviceList(Simulation simulation) {
|
|
||||||
List<Signal> signalList = simulation.getRepository().getSignalList().stream()
|
|
||||||
.filter(s -> Signal.SignalType.DEPARTURE.equals(s.getType())).collect(Collectors.toList());
|
|
||||||
return generateRandomElement(signalList, 2);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
SECTION_LIST("普通区段列表") {
|
|
||||||
@Override
|
@Override
|
||||||
public List<Section> filterMapDeviceList(Simulation simulation) {
|
public List<Section> filterMapDeviceList(Simulation simulation) {
|
||||||
List<Signal> signalList = simulation.getRepository().getStandList().stream().map(s -> s.getSection().getSignalToRight())
|
List<Route> routeList = ROUTE_LIST.filterMapDeviceList(simulation);
|
||||||
.filter(s -> s != null && !CollectionUtils.isEmpty(s.getRouteList())).collect(Collectors.toList());
|
|
||||||
signalList = generateRandomElement(signalList, 2);
|
|
||||||
List<Section> sectionList = new ArrayList<>(100);
|
List<Section> sectionList = new ArrayList<>(100);
|
||||||
signalList.forEach(s -> s.getRouteList().forEach(r -> sectionList.addAll(r.getSectionList())));
|
routeList.forEach(route -> sectionList.addAll(route.getSectionList()));
|
||||||
|
return generateRandomElement(sectionList, 2);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
SECTION_STAND_TURN_BACK_LIST("折返区段列表") {
|
||||||
|
@Override
|
||||||
|
public List<Section> filterMapDeviceList(Simulation simulation) {
|
||||||
|
List<Section> sectionList = simulation.getRepository().getSectionList().stream()
|
||||||
|
.filter(section -> section.isStandTrack() && section.isTurnBackTrack())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return MapDeviceRule.generateRandomElement(sectionList, 2);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
SECTION_NO_AXLE_COUNTER_LIST("非计轴区段列表") {
|
||||||
|
@Override
|
||||||
|
public List<Section> filterMapDeviceList(Simulation simulation) {
|
||||||
|
List<String> stationCodeList = simulation.getBuildParams().getMap().getGraphDataNew().getStationList()
|
||||||
|
.stream().filter(s -> s.isVisible() && s.isCentralized() && s.isCiStation()).map(MapStationNewVO::getCode)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
List<Section> sectionList = simulation.getRepository().getSectionList().stream()
|
||||||
|
.filter(section -> stationCodeList.contains(section.getDeviceStation().getCode()) && !section.isAxleCounter())
|
||||||
|
.collect(Collectors.toList());
|
||||||
return generateRandomElement(sectionList, 2);
|
return generateRandomElement(sectionList, 2);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
SECTION_AXLE_COUNTER_LIST("道岔计轴区段列表") {
|
SECTION_AXLE_COUNTER_LIST("道岔计轴区段列表") {
|
||||||
@Override
|
@Override
|
||||||
public List<Section> filterMapDeviceList(Simulation simulation) {
|
public List<Section> filterMapDeviceList(Simulation simulation) {
|
||||||
|
List<String> stationCodeList = simulation.getBuildParams().getMap().getGraphDataNew().getStationList()
|
||||||
|
.stream().filter(s -> s.isVisible() && s.isCentralized() && s.isCiStation()).map(MapStationNewVO::getCode)
|
||||||
|
.collect(Collectors.toList());
|
||||||
List<Section> sectionList = simulation.getRepository().getSectionList().stream()
|
List<Section> sectionList = simulation.getRepository().getSectionList().stream()
|
||||||
.filter(Section::isSwitchTrack).collect(Collectors.toList());
|
.filter(section -> stationCodeList.contains(section.getDeviceStation().getCode()) && section.isAxleCounter())
|
||||||
|
.collect(Collectors.toList());
|
||||||
return generateRandomElement(sectionList, 2);
|
return generateRandomElement(sectionList, 2);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
SECTION_ROUTE_LIST("") {
|
|
||||||
@Override
|
|
||||||
public List<Section> filterMapDeviceList(Simulation simulation) {
|
|
||||||
List<Signal> signalList = simulation.getRepository().getStandList().stream()
|
|
||||||
.map(s -> s.getSection().getSignalToRight()).filter(s -> s != null && !CollectionUtils.isEmpty(s.getRouteList())).collect(Collectors.toList());
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -36,6 +36,8 @@ public abstract class MapElementRule {
|
|||||||
return ((Switch) mapElement).getDeviceStation();
|
return ((Switch) mapElement).getDeviceStation();
|
||||||
} else if (mapElement instanceof Section) {
|
} else if (mapElement instanceof Section) {
|
||||||
return ((Section) mapElement).getDeviceStation();
|
return ((Section) mapElement).getDeviceStation();
|
||||||
|
} else if (mapElement instanceof Stand) {
|
||||||
|
return ((Stand) mapElement).getDeviceStation();
|
||||||
}
|
}
|
||||||
throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error);
|
throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error);
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.training2.RtsTraining2Rule" >
|
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.training2.RtsTraining2Rule" >
|
||||||
<id column="id" property="id" jdbcType="BIGINT" />
|
<id column="id" property="id" jdbcType="BIGINT" />
|
||||||
<result column="sim_type" property="simType" jdbcType="VARCHAR" />
|
<result column="sim_type" property="simType" jdbcType="VARCHAR" />
|
||||||
|
<result column="line_code" property="lineCode" jdbcType="VARCHAR"/>
|
||||||
<result column="device_rule" property="deviceRule" jdbcType="VARCHAR" />
|
<result column="device_rule" property="deviceRule" jdbcType="VARCHAR" />
|
||||||
<result column="client" property="client" jdbcType="VARCHAR" />
|
<result column="client" property="client" jdbcType="VARCHAR" />
|
||||||
<result column="name" property="name" jdbcType="VARCHAR" />
|
<result column="name" property="name" jdbcType="VARCHAR" />
|
||||||
@ -82,7 +83,7 @@
|
|||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="Base_Column_List" >
|
<sql id="Base_Column_List" >
|
||||||
id, sim_type, device_rule, client, name, description, type, labels, scene_rule, creator_id, create_time, location_rule
|
id, sim_type, line_code, device_rule, client, name, description, type, labels, scene_rule, creator_id, create_time, location_rule
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="Blob_Column_List" >
|
<sql id="Blob_Column_List" >
|
||||||
@ -138,11 +139,11 @@
|
|||||||
|
|
||||||
<insert id="insert" parameterType="club.joylink.rtss.entity.training2.RtsTraining2RuleWithBLOBs" >
|
<insert id="insert" parameterType="club.joylink.rtss.entity.training2.RtsTraining2RuleWithBLOBs" >
|
||||||
insert into rts_training2_rule (
|
insert into rts_training2_rule (
|
||||||
id, sim_type, device_rule, client, name, description, type, labels,
|
id, sim_type, line_code, device_rule, client, name, description, type, labels,
|
||||||
scene_rule, creator_id, create_time, steps, failure_rule, location_rule
|
scene_rule, creator_id, create_time, steps, failure_rule, location_rule
|
||||||
)
|
)
|
||||||
values (
|
values (
|
||||||
#{id,jdbcType=BIGINT}, #{simType,jdbcType=VARCHAR}, #{deviceRule,jdbcType=VARCHAR}, #{client,jdbcType=VARCHAR},
|
#{id,jdbcType=BIGINT}, #{simType,jdbcType=VARCHAR}, #{lineCode,jdbcType=VARCHAR}, #{deviceRule,jdbcType=VARCHAR}, #{client,jdbcType=VARCHAR},
|
||||||
#{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{labels,jdbcType=VARCHAR},
|
#{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{labels,jdbcType=VARCHAR},
|
||||||
#{sceneRule,jdbcType=VARCHAR}, #{creatorId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP},
|
#{sceneRule,jdbcType=VARCHAR}, #{creatorId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP},
|
||||||
#{steps,jdbcType=LONGVARCHAR}, #{failureRule,jdbcType=LONGVARCHAR}, #{locationRule,jdbcType=VARCHAR}
|
#{steps,jdbcType=LONGVARCHAR}, #{failureRule,jdbcType=LONGVARCHAR}, #{locationRule,jdbcType=VARCHAR}
|
||||||
@ -158,6 +159,9 @@
|
|||||||
<if test="simType != null" >
|
<if test="simType != null" >
|
||||||
sim_type,
|
sim_type,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="lineCode != null">
|
||||||
|
line_code,
|
||||||
|
</if>
|
||||||
<if test="deviceRule != null" >
|
<if test="deviceRule != null" >
|
||||||
device_rule,
|
device_rule,
|
||||||
</if>
|
</if>
|
||||||
@ -202,6 +206,9 @@
|
|||||||
<if test="simType != null" >
|
<if test="simType != null" >
|
||||||
#{simType,jdbcType=VARCHAR},
|
#{simType,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="lineCode != null">
|
||||||
|
#{lineCode,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="deviceRule != null" >
|
<if test="deviceRule != null" >
|
||||||
#{deviceRule,jdbcType=VARCHAR},
|
#{deviceRule,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
@ -250,6 +257,9 @@
|
|||||||
<if test="record.simType != null" >
|
<if test="record.simType != null" >
|
||||||
sim_type = #{record.simType,jdbcType=VARCHAR},
|
sim_type = #{record.simType,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="record.lineCode != null">
|
||||||
|
line_code = #{record.lineCode,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="record.deviceRule != null" >
|
<if test="record.deviceRule != null" >
|
||||||
device_rule = #{record.deviceRule,jdbcType=VARCHAR},
|
device_rule = #{record.deviceRule,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
@ -296,6 +306,7 @@
|
|||||||
update rts_training2_rule
|
update rts_training2_rule
|
||||||
set id = #{record.id,jdbcType=BIGINT},
|
set id = #{record.id,jdbcType=BIGINT},
|
||||||
sim_type = #{record.simType,jdbcType=VARCHAR},
|
sim_type = #{record.simType,jdbcType=VARCHAR},
|
||||||
|
line_code = #{record.lineCode,jdbcType=VARCHAR},
|
||||||
device_rule = #{record.deviceRule,jdbcType=VARCHAR},
|
device_rule = #{record.deviceRule,jdbcType=VARCHAR},
|
||||||
client = #{record.client,jdbcType=VARCHAR},
|
client = #{record.client,jdbcType=VARCHAR},
|
||||||
name = #{record.name,jdbcType=VARCHAR},
|
name = #{record.name,jdbcType=VARCHAR},
|
||||||
@ -317,6 +328,7 @@
|
|||||||
update rts_training2_rule
|
update rts_training2_rule
|
||||||
set id = #{record.id,jdbcType=BIGINT},
|
set id = #{record.id,jdbcType=BIGINT},
|
||||||
sim_type = #{record.simType,jdbcType=VARCHAR},
|
sim_type = #{record.simType,jdbcType=VARCHAR},
|
||||||
|
line_code = #{record.lineCode,jdbcType=VARCHAR},
|
||||||
device_rule = #{record.deviceRule,jdbcType=VARCHAR},
|
device_rule = #{record.deviceRule,jdbcType=VARCHAR},
|
||||||
client = #{record.client,jdbcType=VARCHAR},
|
client = #{record.client,jdbcType=VARCHAR},
|
||||||
name = #{record.name,jdbcType=VARCHAR},
|
name = #{record.name,jdbcType=VARCHAR},
|
||||||
@ -338,6 +350,9 @@
|
|||||||
<if test="simType != null" >
|
<if test="simType != null" >
|
||||||
sim_type = #{simType,jdbcType=VARCHAR},
|
sim_type = #{simType,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="lineCode != null">
|
||||||
|
line_code = #{lineCode,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="deviceRule != null" >
|
<if test="deviceRule != null" >
|
||||||
device_rule = #{deviceRule,jdbcType=VARCHAR},
|
device_rule = #{deviceRule,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
@ -381,6 +396,7 @@
|
|||||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.training2.RtsTraining2RuleWithBLOBs" >
|
<update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.training2.RtsTraining2RuleWithBLOBs" >
|
||||||
update rts_training2_rule
|
update rts_training2_rule
|
||||||
set sim_type = #{simType,jdbcType=VARCHAR},
|
set sim_type = #{simType,jdbcType=VARCHAR},
|
||||||
|
line_code = #{lineCode,jdbcType=VARCHAR},
|
||||||
device_rule = #{deviceRule,jdbcType=VARCHAR},
|
device_rule = #{deviceRule,jdbcType=VARCHAR},
|
||||||
client = #{client,jdbcType=VARCHAR},
|
client = #{client,jdbcType=VARCHAR},
|
||||||
name = #{name,jdbcType=VARCHAR},
|
name = #{name,jdbcType=VARCHAR},
|
||||||
@ -399,6 +415,7 @@
|
|||||||
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.training2.RtsTraining2Rule" >
|
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.training2.RtsTraining2Rule" >
|
||||||
update rts_training2_rule
|
update rts_training2_rule
|
||||||
set sim_type = #{simType,jdbcType=VARCHAR},
|
set sim_type = #{simType,jdbcType=VARCHAR},
|
||||||
|
line_code = #{lineCode,jdbcType=VARCHAR},
|
||||||
device_rule = #{deviceRule,jdbcType=VARCHAR},
|
device_rule = #{deviceRule,jdbcType=VARCHAR},
|
||||||
client = #{client,jdbcType=VARCHAR},
|
client = #{client,jdbcType=VARCHAR},
|
||||||
name = #{name,jdbcType=VARCHAR},
|
name = #{name,jdbcType=VARCHAR},
|
||||||
|
Loading…
Reference in New Issue
Block a user