修改NCC报警bug
This commit is contained in:
parent
19f63f8f38
commit
ffe8927892
@ -3,7 +3,9 @@ package club.joylink.rtss.simulation.cbtc.ATS.service.alarm;
|
|||||||
import club.joylink.rtss.simulation.cbtc.ATS.data.AtsAlarm;
|
import club.joylink.rtss.simulation.cbtc.ATS.data.AtsAlarm;
|
||||||
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.MapElement;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice;
|
import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice.DeviceFault;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Station;
|
import club.joylink.rtss.simulation.cbtc.data.map.Station;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Switch.SwitchFault;
|
import club.joylink.rtss.simulation.cbtc.data.map.Switch.SwitchFault;
|
||||||
@ -123,23 +125,32 @@ public class NccAlarmService {
|
|||||||
|
|
||||||
private String analyzeReason(SimulationDataRepository repository, TrainInfo trainInfo) {
|
private String analyzeReason(SimulationDataRepository repository, TrainInfo trainInfo) {
|
||||||
List<AtsAlarm> alarmList = repository.getAlarmList();
|
List<AtsAlarm> alarmList = repository.getAlarmList();
|
||||||
if (!CollectionUtils.isEmpty(alarmList)) {
|
String defaultReason = "其它原因";
|
||||||
|
if (CollectionUtils.isEmpty(alarmList)) {
|
||||||
|
return defaultReason;
|
||||||
|
}
|
||||||
Optional<AtsAlarm> deviceFaultAlarm = alarmList.stream()
|
Optional<AtsAlarm> deviceFaultAlarm = alarmList.stream()
|
||||||
.filter(alarm -> AtsAlarm.HandleMethod.ATS.equals(alarm.getHandleMethod()))
|
.filter(alarm -> AtsAlarm.HandleMethod.ATS.equals(alarm.getHandleMethod()))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
if (deviceFaultAlarm.isPresent()) {
|
if (deviceFaultAlarm.isEmpty()) {
|
||||||
|
return defaultReason;
|
||||||
|
}
|
||||||
AtsAlarm atsAlarm = deviceFaultAlarm.get();
|
AtsAlarm atsAlarm = deviceFaultAlarm.get();
|
||||||
|
MapElement element = repository.getByCode(atsAlarm.getCode());
|
||||||
|
if (!(element instanceof MayOutOfOrderDevice)) {
|
||||||
|
return defaultReason;
|
||||||
|
}
|
||||||
MayOutOfOrderDevice device = repository.getByCode(atsAlarm.getDeviceCode(),
|
MayOutOfOrderDevice device = repository.getByCode(atsAlarm.getDeviceCode(),
|
||||||
MayOutOfOrderDevice.class);
|
MayOutOfOrderDevice.class);
|
||||||
String fault = device.getFault().toString();
|
DeviceFault deviceFault = device.getFault();
|
||||||
|
if (deviceFault == null) {
|
||||||
|
return defaultReason;
|
||||||
|
}
|
||||||
|
String fault = deviceFault.toString();
|
||||||
if (SwitchFault.SPLIT.name().equals(fault)) {
|
if (SwitchFault.SPLIT.name().equals(fault)) {
|
||||||
fault = "失表";
|
fault = "失表";
|
||||||
}
|
}
|
||||||
return String.format("%s(%s):%s", device.getDeviceType().getName(), device.getName(),
|
return String.format("%s(%s):%s", device.getDeviceType().getName(), device.getName(), fault);
|
||||||
fault);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "其它原因";
|
|
||||||
|
|
||||||
// //列车故障
|
// //列车故障
|
||||||
// VirtualRealityTrain train = repository.queryOnlineTrainBy(trainInfo.getGroupNumber());
|
// VirtualRealityTrain train = repository.queryOnlineTrainBy(trainInfo.getGroupNumber());
|
||||||
|
Loading…
Reference in New Issue
Block a user