修改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.Simulation;
|
||||
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.DeviceFault;
|
||||
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.Switch.SwitchFault;
|
||||
|
@ -123,23 +125,32 @@ public class NccAlarmService {
|
|||
|
||||
private String analyzeReason(SimulationDataRepository repository, TrainInfo trainInfo) {
|
||||
List<AtsAlarm> alarmList = repository.getAlarmList();
|
||||
if (!CollectionUtils.isEmpty(alarmList)) {
|
||||
Optional<AtsAlarm> deviceFaultAlarm = alarmList.stream()
|
||||
.filter(alarm -> AtsAlarm.HandleMethod.ATS.equals(alarm.getHandleMethod()))
|
||||
.findFirst();
|
||||
if (deviceFaultAlarm.isPresent()) {
|
||||
AtsAlarm atsAlarm = deviceFaultAlarm.get();
|
||||
MayOutOfOrderDevice device = repository.getByCode(atsAlarm.getDeviceCode(),
|
||||
MayOutOfOrderDevice.class);
|
||||
String fault = device.getFault().toString();
|
||||
if (SwitchFault.SPLIT.name().equals(fault)) {
|
||||
fault = "失表";
|
||||
}
|
||||
return String.format("%s(%s):%s", device.getDeviceType().getName(), device.getName(),
|
||||
fault);
|
||||
}
|
||||
String defaultReason = "其它原因";
|
||||
if (CollectionUtils.isEmpty(alarmList)) {
|
||||
return defaultReason;
|
||||
}
|
||||
return "其它原因";
|
||||
Optional<AtsAlarm> deviceFaultAlarm = alarmList.stream()
|
||||
.filter(alarm -> AtsAlarm.HandleMethod.ATS.equals(alarm.getHandleMethod()))
|
||||
.findFirst();
|
||||
if (deviceFaultAlarm.isEmpty()) {
|
||||
return defaultReason;
|
||||
}
|
||||
AtsAlarm atsAlarm = deviceFaultAlarm.get();
|
||||
MapElement element = repository.getByCode(atsAlarm.getCode());
|
||||
if (!(element instanceof MayOutOfOrderDevice)) {
|
||||
return defaultReason;
|
||||
}
|
||||
MayOutOfOrderDevice device = repository.getByCode(atsAlarm.getDeviceCode(),
|
||||
MayOutOfOrderDevice.class);
|
||||
DeviceFault deviceFault = device.getFault();
|
||||
if (deviceFault == null) {
|
||||
return defaultReason;
|
||||
}
|
||||
String fault = deviceFault.toString();
|
||||
if (SwitchFault.SPLIT.name().equals(fault)) {
|
||||
fault = "失表";
|
||||
}
|
||||
return String.format("%s(%s):%s", device.getDeviceType().getName(), device.getName(), fault);
|
||||
|
||||
// //列车故障
|
||||
// VirtualRealityTrain train = repository.queryOnlineTrainBy(trainInfo.getGroupNumber());
|
||||
|
|
Loading…
Reference in New Issue