设置/取消强制点灯操作合并
This commit is contained in:
parent
c977e4c90d
commit
a3b89f9125
@ -243,10 +243,8 @@ public class Operation {
|
||||
Station_Set_CI_Auto,
|
||||
/** 全站取消自动通过 */
|
||||
Station_Cancel_CI_Auto,
|
||||
/** 强制点灯 */
|
||||
Station_Force_Set_Signal_Physical,
|
||||
/** 取消强制点灯 */
|
||||
Station_Force_Cancel_Signal_Physical,
|
||||
/** 设置/取消强制点灯 */
|
||||
Station_Set_Or_Cancel_Force_Physical_Signal,
|
||||
|
||||
//--------------------------- 列车 ---------------------------
|
||||
/** 在指定区段加载一辆计划列车(本地开发使用) */
|
||||
|
@ -219,15 +219,9 @@ public class StationOperateHandler {
|
||||
this.atsStationService.cancelCIAuto(simulation, repository.getByCode(stationCode, Station.class));
|
||||
}
|
||||
|
||||
@OperateHandlerMapping(type = Operation.Type.Station_Force_Set_Signal_Physical)
|
||||
public void forceSetSignalPhysical(Simulation simulation, String stationCode) {
|
||||
@OperateHandlerMapping(type = Operation.Type.Station_Set_Or_Cancel_Force_Physical_Signal)
|
||||
public void setOrCancelForcePhysicalSignal(Simulation simulation, String stationCode) {
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
this.atsStationService.forceSetSignalPhysical(simulation, repository.getByCode(stationCode, Station.class));
|
||||
}
|
||||
|
||||
@OperateHandlerMapping(type = Operation.Type.Station_Force_Cancel_Signal_Physical)
|
||||
public void forceCancelSignalPhysical(Simulation simulation, String stationCode) {
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
this.atsStationService.forceCancelSignalPhysical(simulation, repository.getByCode(stationCode, Station.class));
|
||||
this.atsStationService.setOrCancelForcePhysicalSignal(simulation, repository.getByCode(stationCode, Station.class));
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import club.joylink.rtss.simulation.cbtc.command.OperationMessage;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
|
||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Route;
|
||||
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.map.Switch;
|
||||
import club.joylink.rtss.simulation.cbtc.data.status.StationStatus;
|
||||
@ -23,6 +24,7 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Component
|
||||
@ -402,18 +404,17 @@ public class AtsStationService {
|
||||
.forEach(signal -> atsRouteService.cancelCiAuto(simulation, signal.getCode()));
|
||||
}
|
||||
|
||||
public void forceSetSignalPhysical(Simulation simulation, @NonNull Station station) {
|
||||
simulation.getRepository().getSignalList().stream()
|
||||
.filter(signal -> station.equals(signal.getInterlockStation()))
|
||||
.forEach(signal -> {
|
||||
signal.changeLightType(false);
|
||||
signal.setForcePhysical(true);
|
||||
});
|
||||
}
|
||||
|
||||
public void forceCancelSignalPhysical(Simulation simulation, Station station) {
|
||||
simulation.getRepository().getSignalList().stream()
|
||||
.filter(signal -> station.equals(signal.getInterlockStation()))
|
||||
.forEach(signal -> signal.setForcePhysical(false));
|
||||
public void setOrCancelForcePhysicalSignal(Simulation simulation, @NonNull Station station) {
|
||||
List<Signal> signalList = simulation.getRepository().getSignalList().stream()
|
||||
.filter(signal -> station.equals(signal.getInterlockStation())).collect(Collectors.toList());
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(signalList, station.debugStr() + "下无信号机");
|
||||
if (!signalList.get(0).isForcePhysical()) {
|
||||
signalList.forEach(signal -> {
|
||||
signal.changeLightType(false);
|
||||
signal.setForcePhysical(true);
|
||||
});
|
||||
} else {
|
||||
signalList.forEach(signal -> signal.setForcePhysical(false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user