Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/rtss-server into test
This commit is contained in:
commit
07e700f064
@ -5,9 +5,7 @@ import club.joylink.rtss.simulation.cbtc.CI.CiApiService;
|
|||||||
import club.joylink.rtss.simulation.cbtc.CTC.data.*;
|
import club.joylink.rtss.simulation.cbtc.CTC.data.*;
|
||||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Signal;
|
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Station;
|
|
||||||
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.VirtualRealityTrain;
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||||
@ -62,14 +60,19 @@ public class CTCLogicLoop {
|
|||||||
LocalDateTime correctSystemTime = simulation.getCorrectSystemTime();
|
LocalDateTime correctSystemTime = simulation.getCorrectSystemTime();
|
||||||
for (RouteSequence routeSequence : simulation.getCtcRepository().getRouteSequenceMap().values()) {
|
for (RouteSequence routeSequence : simulation.getCtcRepository().getRouteSequenceMap().values()) {
|
||||||
for (RouteSequence.Line line : routeSequence.getLines()) {
|
for (RouteSequence.Line line : routeSequence.getLines()) {
|
||||||
if (line.isAutoTrigger()) {
|
Route route = line.getRoute();
|
||||||
if (line.getRoute() != null && correctSystemTime.toLocalTime().isAfter(line.getPlanTime())) {
|
if (!line.isTriggered()) {
|
||||||
|
if (route != null) {
|
||||||
|
if (route.isLock()) {
|
||||||
|
line.setTriggered(true);
|
||||||
|
} else if (line.isAutoTrigger() && correctSystemTime.toLocalTime().isAfter(line.getPlanTime())) {
|
||||||
ciApiService.settingRoute(simulation, line.getRouteCode());
|
ciApiService.settingRoute(simulation, line.getRouteCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新行车日志状态
|
* 更新行车日志状态
|
||||||
@ -111,19 +114,33 @@ public class CTCLogicLoop {
|
|||||||
map.put("trackView", vo);
|
map.put("trackView", vo);
|
||||||
list.add(map);
|
list.add(map);
|
||||||
}
|
}
|
||||||
SocketMessageVO<Object> message = SocketMessageFactory.buildCtcRouteSequenceMessage(simulation.getId(), list);
|
SocketMessageVO<Object> message = SocketMessageFactory.buildCtcBusyBoardMessage(simulation.getId(), list);
|
||||||
stompMessageService.sendToUser(simulation.getSimulationUserIds(), message);
|
stompMessageService.sendToUser(simulation.getSimulationUserIds(), message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendTrackViewMessage(Simulation simulation) {
|
private void sendTrackViewMessage(Simulation simulation) {
|
||||||
// CtcRepository ctcRepository = simulation.getCtcRepository();
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
// for (CtcStationRunPlanLog runPlan : ctcRepository.getAllRunPlanList()) {
|
CtcRepository ctcRepository = simulation.getCtcRepository();
|
||||||
// CtcStationRunPlanLog.RunPlanItem arriveRunPlan = runPlan.getArriveRunPlan();
|
for (RouteSequence routeSequence : ctcRepository.getRouteSequenceMap().values()) {
|
||||||
// if (arriveRunPlan != null) {
|
TrackViewVO trackViewVO = new TrackViewVO(routeSequence.getStationCode());
|
||||||
// RouteSequence.Line routeSequenceLine = ctcRepository.getRouteSequenceLine(runPlan.getStation().getCode(), arriveRunPlan.getTripNumber(), false);
|
Map<String, Object> map = new HashMap<>();
|
||||||
//
|
map.put("stationCode", routeSequence.getStationCode());
|
||||||
// }
|
map.put("trackView", trackViewVO);
|
||||||
// }
|
for (RouteSequence.Line line : routeSequence.getLines()) {
|
||||||
|
if (line.isDeparture()) {
|
||||||
|
trackViewVO.addDepartureLine(line);
|
||||||
|
} else {
|
||||||
|
trackViewVO.addReceivingLine(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Station station = routeSequence.getStation();
|
||||||
|
Map<String, Boolean> sectionOccupiedMap = station.getAllStandList().stream().map(Stand::getSection)
|
||||||
|
.collect(Collectors.toMap(MapElement::getCode, Section::isOccupied));
|
||||||
|
trackViewVO.getSectionOccupiedMap().putAll(sectionOccupiedMap);
|
||||||
|
list.add(map);
|
||||||
|
}
|
||||||
|
SocketMessageVO<Object> message = SocketMessageFactory.buildCtcBusyBoardMessage(simulation.getId(), list);
|
||||||
|
stompMessageService.sendToUser(simulation.getSimulationUserIds(), message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendAllRouteSequenceMessage(Simulation simulation) {
|
private void sendAllRouteSequenceMessage(Simulation simulation) {
|
||||||
@ -135,7 +152,7 @@ public class CTCLogicLoop {
|
|||||||
map.put("routeSequence", vo);
|
map.put("routeSequence", vo);
|
||||||
list.add(map);
|
list.add(map);
|
||||||
}
|
}
|
||||||
SocketMessageVO<Object> message = SocketMessageFactory.buildCtcRouteSequenceMessage(simulation.getId(), list);
|
SocketMessageVO<Object> message = SocketMessageFactory.buildCtcBusyBoardMessage(simulation.getId(), list);
|
||||||
stompMessageService.sendToUser(simulation.getSimulationUserIds(), message);
|
stompMessageService.sendToUser(simulation.getSimulationUserIds(), message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +185,7 @@ public class CTCLogicLoop {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SocketMessageVO<Object> message = SocketMessageFactory.buildCtcRouteSequenceMessage(simulation.getId(), list);
|
SocketMessageVO<Object> message = SocketMessageFactory.buildCtcBusyBoardMessage(simulation.getId(), list);
|
||||||
stompMessageService.sendToUser(simulation.getSimulationUserIds(), message);
|
stompMessageService.sendToUser(simulation.getSimulationUserIds(), message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,12 +16,10 @@ public class CTCService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CTCLogicLoop ctcLogicLoop;
|
private CTCLogicLoop ctcLogicLoop;
|
||||||
|
|
||||||
|
|
||||||
public void runPlanItemUpdate(Simulation simulation, Station station, CtcStationRunPlanLog.RunPlanItem item, boolean departure) {
|
public void runPlanItemUpdate(Simulation simulation, Station station, CtcStationRunPlanLog.RunPlanItem item, boolean departure) {
|
||||||
CtcRepository ctcRepository = simulation.getCtcRepository();
|
CtcRepository ctcRepository = simulation.getCtcRepository();
|
||||||
ctcRepository.deleteRouteSequenceLine(station.getCode(), item);
|
RouteSequence.Line routeSequenceLine = ctcRepository.getRouteSequenceLine(station.getCode(), item.getTripNumber(), departure);
|
||||||
RouteSequence.Line line = RouteSequence.buildLine(item, departure);
|
routeSequenceLine.updateRoute();
|
||||||
ctcRepository.addRouteSequenceLine(station.getCode(), line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,6 +77,7 @@ public class CtcRepository {
|
|||||||
public void reset() {
|
public void reset() {
|
||||||
routeSequenceMap.clear();
|
routeSequenceMap.clear();
|
||||||
routeSequenceVOMap.clear();
|
routeSequenceVOMap.clear();
|
||||||
|
trackViewVOMap.clear();
|
||||||
// 编辑区清空
|
// 编辑区清空
|
||||||
this.simulationRunPlanEditAreaMap.clear();
|
this.simulationRunPlanEditAreaMap.clear();
|
||||||
// 仿真运行数据直接清空
|
// 仿真运行数据直接清空
|
||||||
@ -205,4 +206,8 @@ public class CtcRepository {
|
|||||||
RouteSequence routeSequence = routeSequenceMap.get(stationCode);
|
RouteSequence routeSequence = routeSequenceMap.get(stationCode);
|
||||||
routeSequence.addLine(line);
|
routeSequence.addLine(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TrackViewVO getTrackViewVO(String stationCode) {
|
||||||
|
return trackViewVOMap.computeIfAbsent(stationCode, k -> new TrackViewVO());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ public class RouteSequence {
|
|||||||
}
|
}
|
||||||
int id = idGenerator.getAndIncrement();
|
int id = idGenerator.getAndIncrement();
|
||||||
LocalTime planTime = item.getPlanTime().minusMinutes(9);
|
LocalTime planTime = item.getPlanTime().minusMinutes(9);
|
||||||
return new Line(String.valueOf(id), item, false, departure, planTime, planTime, route);
|
return new Line(String.valueOf(id), item, departure, planTime, planTime, route);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Line findLine(String id) {
|
public Line findLine(String id) {
|
||||||
@ -189,10 +189,32 @@ public class RouteSequence {
|
|||||||
private LocalTime planTime;
|
private LocalTime planTime;
|
||||||
private Route route;
|
private Route route;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进路是否已经触发过
|
||||||
|
*/
|
||||||
|
@Setter
|
||||||
|
private boolean triggered;
|
||||||
|
|
||||||
|
public Line(String id, CtcStationRunPlanLog.RunPlanItem item, boolean departure, LocalTime startTime, LocalTime planTime, Route route) {
|
||||||
|
this.id = id;
|
||||||
|
this.item = item;
|
||||||
|
this.departure = departure;
|
||||||
|
this.startTime = startTime;
|
||||||
|
this.planTime = planTime;
|
||||||
|
this.route = route;
|
||||||
|
}
|
||||||
|
|
||||||
public String getTripNumber() {
|
public String getTripNumber() {
|
||||||
return this.item.getTripNumber();
|
return this.item.getTripNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSetting() {
|
||||||
|
if (route != null) {
|
||||||
|
return route.isSetting();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public Section getTrack() {
|
public Section getTrack() {
|
||||||
return this.item.getTrackSection();
|
return this.item.getTrackSection();
|
||||||
}
|
}
|
||||||
@ -206,6 +228,15 @@ public class RouteSequence {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTrackCode() {
|
||||||
|
Section track = getTrack();
|
||||||
|
if (track == null) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return track.getCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isRight() {
|
private boolean isRight() {
|
||||||
return this.item.isRight();
|
return this.item.isRight();
|
||||||
}
|
}
|
||||||
@ -213,5 +244,36 @@ public class RouteSequence {
|
|||||||
public String getRouteCode() {
|
public String getRouteCode() {
|
||||||
return route == null ? null : route.getCode();
|
return route == null ? null : route.getCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateRoute() {
|
||||||
|
boolean right = isRight();
|
||||||
|
Signal startSignal;
|
||||||
|
Signal endSignal;
|
||||||
|
Route route = null;
|
||||||
|
Section trackSection = getTrack();
|
||||||
|
if (trackSection != null) {
|
||||||
|
if (departure) { //发车
|
||||||
|
startSignal = trackSection.getSignalOf(right); //股道的同向信号机作为发车进路的起始信号机
|
||||||
|
if (startSignal == null || !startSignal.isShunting2()) //没有出站信号机的股道不生成进路序列
|
||||||
|
startSignal = null;
|
||||||
|
endSignal = item.getStationDirection().getSignal();
|
||||||
|
} else { //接车
|
||||||
|
startSignal = item.getStationDirection().getSignal();
|
||||||
|
Signal tempEndSignal = trackSection.getSignalOf(!right);
|
||||||
|
if (tempEndSignal == null || !tempEndSignal.isShunting2())
|
||||||
|
endSignal = null;
|
||||||
|
else
|
||||||
|
endSignal = tempEndSignal; //股道的反向信号机作为接车进路终点信号机
|
||||||
|
}
|
||||||
|
if (startSignal != null && endSignal != null) {
|
||||||
|
route = startSignal.getRouteList().stream()
|
||||||
|
.filter(r -> Objects.equals(r.getDestination(), endSignal))
|
||||||
|
.findAny().orElse(null);
|
||||||
|
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(route,
|
||||||
|
String.format("车次[%s]的[%s]进路找不到", item.getTripNumber(), departure ? "发车" : "接车"));
|
||||||
|
this.route = route;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,6 +97,11 @@ public class RouteSequenceVO {
|
|||||||
*/
|
*/
|
||||||
private boolean autoTrigger;
|
private boolean autoTrigger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否发车
|
||||||
|
*/
|
||||||
|
private boolean departure;
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * 方向
|
// * 方向
|
||||||
// */
|
// */
|
||||||
@ -117,14 +122,30 @@ public class RouteSequenceVO {
|
|||||||
*/
|
*/
|
||||||
private String routeCode;
|
private String routeCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态。(0/1/2分别代表等待、正在触发、触发完成)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
private static final String WAIT = "0";
|
||||||
|
private static final String SETTING = "1";
|
||||||
|
private static final String TRIGGERED = "2";
|
||||||
|
|
||||||
public LineVO(RouteSequence.Line line) {
|
public LineVO(RouteSequence.Line line) {
|
||||||
id = line.getId();
|
id = line.getId();
|
||||||
tripNumber = line.getTripNumber();
|
tripNumber = line.getTripNumber();
|
||||||
trackName = line.getTrackName();
|
trackName = line.getTrackName();
|
||||||
autoTrigger = line.isAutoTrigger();
|
autoTrigger = line.isAutoTrigger();
|
||||||
|
departure = line.isDeparture();
|
||||||
startTime = line.getStartTime();
|
startTime = line.getStartTime();
|
||||||
planTime = line.getPlanTime();
|
planTime = line.getPlanTime();
|
||||||
routeCode = line.getRouteCode();
|
routeCode = line.getRouteCode();
|
||||||
|
if (line.isTriggered()) {
|
||||||
|
status = TRIGGERED;
|
||||||
|
} else if (line.isSetting()) {
|
||||||
|
status = SETTING;
|
||||||
|
} else {
|
||||||
|
status = WAIT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -144,6 +165,10 @@ public class RouteSequenceVO {
|
|||||||
autoTrigger = line.isAutoTrigger();
|
autoTrigger = line.isAutoTrigger();
|
||||||
map.put("autoTrigger", autoTrigger);
|
map.put("autoTrigger", autoTrigger);
|
||||||
}
|
}
|
||||||
|
if (!Objects.equals(departure, line.isDeparture())) {
|
||||||
|
departure = line.isDeparture();
|
||||||
|
map.put("departure", departure);
|
||||||
|
}
|
||||||
if (!Objects.equals(startTime, line.getStartTime())) {
|
if (!Objects.equals(startTime, line.getStartTime())) {
|
||||||
startTime = line.getStartTime();
|
startTime = line.getStartTime();
|
||||||
map.put("startTime", startTime);
|
map.put("startTime", startTime);
|
||||||
@ -156,8 +181,17 @@ public class RouteSequenceVO {
|
|||||||
routeCode = line.getRouteCode();
|
routeCode = line.getRouteCode();
|
||||||
map.put("routeCode", line.getRouteCode());
|
map.put("routeCode", line.getRouteCode());
|
||||||
}
|
}
|
||||||
|
if (line.isTriggered()) {
|
||||||
|
status = TRIGGERED;
|
||||||
|
} else if (line.isSetting()) {
|
||||||
|
status = SETTING;
|
||||||
|
} else {
|
||||||
|
status = WAIT;
|
||||||
|
}
|
||||||
|
|
||||||
if (!CollectionUtils.isEmpty(map)) {
|
if (!CollectionUtils.isEmpty(map)) {
|
||||||
|
map.put("id", id);
|
||||||
|
map.put("status", status);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -5,32 +5,54 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 股道视图。
|
||||||
|
* 注意:里面看起来没有被调用的方法不要删,用于序列化
|
||||||
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class TrackViewVO {
|
public class TrackViewVO {
|
||||||
private String stationCode;
|
private String stationCode;
|
||||||
|
|
||||||
private final Map<String, TrackInfo> sectionAndTrackInfo = new HashMap<>();
|
private final Map<String, Boolean> sectionOccupiedMap = new HashMap<>();
|
||||||
|
|
||||||
|
private final Map<String, List<Line>> trackLineMap = new HashMap<>();
|
||||||
|
|
||||||
|
public TrackViewVO(String stationCode) {
|
||||||
|
this.stationCode = stationCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addLine(Line line) {
|
||||||
|
String trackCode = line.getTrackCode();
|
||||||
|
List<Line> lines = trackLineMap.computeIfAbsent(trackCode, k -> new ArrayList<>());
|
||||||
|
lines.add(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TrackViewVO.Line findLine(String trackCode, String tripNumber) {
|
||||||
|
List<Line> lines = trackLineMap.get(trackCode);
|
||||||
|
if (CollectionUtils.isEmpty(lines))
|
||||||
|
return null;
|
||||||
|
return lines.stream()
|
||||||
|
.filter(line -> Objects.equals(line.getTripNumber(), tripNumber))
|
||||||
|
.findAny().orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
public void addReceivingLine(RouteSequence.Line receivingRoute) {
|
public void addReceivingLine(RouteSequence.Line receivingRoute) {
|
||||||
Section track = receivingRoute.getTrack();
|
Section track = receivingRoute.getTrack();
|
||||||
if (track == null)
|
if (track == null)
|
||||||
return;
|
return;
|
||||||
TrackInfo trackInfo = sectionAndTrackInfo.computeIfAbsent(track.getCode(), k -> new TrackInfo(track));
|
Line line = findLine(track.getCode(), receivingRoute.getTripNumber());
|
||||||
Line trackViewLine = trackInfo.findLine(receivingRoute.getTripNumber());
|
if (line != null) {
|
||||||
if (trackViewLine == null) {
|
line.setReceivingRoute(receivingRoute);
|
||||||
Line line = Line.buildReceivingLine(receivingRoute);
|
|
||||||
trackInfo.addLine(line);
|
|
||||||
} else {
|
} else {
|
||||||
trackViewLine.setReceivingRoute(receivingRoute);
|
Line newLine = Line.buildReceivingLine(receivingRoute);
|
||||||
|
addLine(newLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,57 +60,57 @@ public class TrackViewVO {
|
|||||||
Section track = departureRoute.getTrack();
|
Section track = departureRoute.getTrack();
|
||||||
if (track == null)
|
if (track == null)
|
||||||
return;
|
return;
|
||||||
TrackInfo trackInfo = sectionAndTrackInfo.computeIfAbsent(track.getCode(), k -> new TrackInfo(track));
|
Line line = findLine(track.getCode(), departureRoute.getTripNumber());
|
||||||
Line trackViewLine = trackInfo.findLine(departureRoute.getTripNumber());
|
if (line != null) {
|
||||||
if (trackViewLine == null) {
|
line.setDepartureRoute(departureRoute);
|
||||||
Line line = Line.buildDepartureLine(departureRoute);
|
|
||||||
trackInfo.addLine(line);
|
|
||||||
} else {
|
} else {
|
||||||
trackViewLine.setDepartureRoute(departureRoute);
|
Line newLine = Line.buildDepartureLine(departureRoute);
|
||||||
|
addLine(newLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TrackInfo {
|
// @Getter
|
||||||
@JsonIgnore
|
// public static class TrackInfo {
|
||||||
private Section track;
|
// @JsonIgnore
|
||||||
|
// private Section track;
|
||||||
private final List<Line> lines = new ArrayList<>();
|
//
|
||||||
|
// private final List<Line> lines = new ArrayList<>();
|
||||||
@JsonIgnore
|
//
|
||||||
private final Map<String, Line> tripLineMap = new HashMap<>();
|
// @JsonIgnore
|
||||||
|
// private final Map<String, Line> tripLineMap = new HashMap<>();
|
||||||
public TrackInfo(Section track) {
|
//
|
||||||
this.track = track;
|
// public TrackInfo(Section track) {
|
||||||
}
|
// this.track = track;
|
||||||
|
// }
|
||||||
public boolean isOccupied() {
|
//
|
||||||
return this.track.isOccupied();
|
// public boolean isOccupied() {
|
||||||
}
|
// return this.track.isOccupied();
|
||||||
|
// }
|
||||||
public Line findLine(String tripNumber) {
|
//
|
||||||
return tripLineMap.get(tripNumber);
|
// public Line findLine(String tripNumber) {
|
||||||
}
|
// return tripLineMap.get(tripNumber);
|
||||||
|
// }
|
||||||
public void addLine(Line line) {
|
//
|
||||||
lines.add(line);
|
// public void addLine(Line line) {
|
||||||
tripLineMap.put(line.getTripNumber(), line);
|
// lines.add(line);
|
||||||
}
|
// tripLineMap.put(line.getTripNumber(), line);
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public static class Line {
|
public static class Line {
|
||||||
private String tripNumber;
|
// private String tripNumber;
|
||||||
|
//
|
||||||
private String trainType;
|
// private String trainType;
|
||||||
|
//
|
||||||
private String trainDistanceInfo;
|
// private String trainDistanceInfo;
|
||||||
|
|
||||||
// private Process process;
|
// private Process process;
|
||||||
|
|
||||||
// private boolean receivingNotice;
|
// private boolean receivingNotice;
|
||||||
|
|
||||||
private boolean receivingRouteLock;
|
// private boolean receivingRouteLock;
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
private RouteSequence.Line receivingRoute;
|
private RouteSequence.Line receivingRoute;
|
||||||
@ -97,7 +119,7 @@ public class TrackViewVO {
|
|||||||
|
|
||||||
// private boolean departureNotice;
|
// private boolean departureNotice;
|
||||||
|
|
||||||
private boolean departureRouteLock;
|
// private boolean departureRouteLock;
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
private RouteSequence.Line departureRoute;
|
private RouteSequence.Line departureRoute;
|
||||||
@ -114,36 +136,56 @@ public class TrackViewVO {
|
|||||||
|
|
||||||
public static Line buildReceivingLine(RouteSequence.Line receivingRoute) {
|
public static Line buildReceivingLine(RouteSequence.Line receivingRoute) {
|
||||||
Line line = new Line();
|
Line line = new Line();
|
||||||
line.setTripNumber(receivingRoute.getTripNumber());
|
|
||||||
line.setReceivingRoute(receivingRoute);
|
line.setReceivingRoute(receivingRoute);
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Line buildDepartureLine(RouteSequence.Line departureRoute) {
|
public static Line buildDepartureLine(RouteSequence.Line departureRoute) {
|
||||||
Line line = new Line();
|
Line line = new Line();
|
||||||
line.setTripNumber(departureRoute.getTripNumber());
|
|
||||||
line.setDepartureRoute(departureRoute);
|
line.setDepartureRoute(departureRoute);
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateRouteLock() {
|
public String getTripNumber() {
|
||||||
if (!receivingRouteLock) {
|
if (receivingRoute != null) {
|
||||||
if (receivingRoute != null && receivingRoute.getRoute().isLock()) {
|
return receivingRoute.getTripNumber();
|
||||||
receivingRouteLock = true;
|
|
||||||
}
|
}
|
||||||
|
if (departureRoute != null) {
|
||||||
|
return departureRoute.getTripNumber();
|
||||||
}
|
}
|
||||||
if (!departureRouteLock) {
|
return null;
|
||||||
if (departureRoute != null && departureRoute.getRoute().isLock()) {
|
|
||||||
departureRouteLock = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isReceivingRouteLock() {
|
||||||
|
if (receivingRoute != null) {
|
||||||
|
return receivingRoute.isTriggered();
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDepartureRouteLock() {
|
||||||
|
if (departureRoute != null) {
|
||||||
|
return departureRoute.isTriggered();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
public String getTrackCode() {
|
||||||
|
if (receivingRoute != null) {
|
||||||
|
return receivingRoute.getTrackCode();
|
||||||
|
}
|
||||||
|
if (departureRoute != null) {
|
||||||
|
return departureRoute.getTrackCode();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Process getProcess() {
|
public Process getProcess() {
|
||||||
if (isDeparture()) {
|
if (isDeparture()) {
|
||||||
return Process.FINISH;
|
return Process.FINISH;
|
||||||
}
|
}
|
||||||
if (departureRouteLock) {
|
if (isDepartureRouteLock()) {
|
||||||
return Process.DEPARTURE;
|
return Process.DEPARTURE;
|
||||||
}
|
}
|
||||||
if (isDepartureNotice()) {
|
if (isDepartureNotice()) {
|
||||||
@ -152,7 +194,7 @@ public class TrackViewVO {
|
|||||||
if (isArrive()) {
|
if (isArrive()) {
|
||||||
return Process.DEPARTURE_BLOCK;
|
return Process.DEPARTURE_BLOCK;
|
||||||
}
|
}
|
||||||
if (receivingRouteLock) {
|
if (isReceivingRouteLock()) {
|
||||||
return Process.ARRIVE;
|
return Process.ARRIVE;
|
||||||
}
|
}
|
||||||
if (isReceivingNotice()) {
|
if (isReceivingNotice()) {
|
||||||
|
@ -415,7 +415,7 @@ public class SocketMessageFactory {
|
|||||||
/**
|
/**
|
||||||
* CTC进路序列消息
|
* CTC进路序列消息
|
||||||
*/
|
*/
|
||||||
public static SocketMessageVO<Object> buildCtcRouteSequenceMessage(String simulationId,
|
public static SocketMessageVO<Object> buildCtcBusyBoardMessage(String simulationId,
|
||||||
Object message) {
|
Object message) {
|
||||||
return build(WebSocketMessageType.Simulation_RailCtcStatus, simulationId, message);
|
return build(WebSocketMessageType.Simulation_RailCtcStatus, simulationId, message);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user