This commit is contained in:
tiger_zhou 2023-12-27 15:32:56 +08:00
parent 72c163b9a0
commit cec85ded93
2 changed files with 30 additions and 43 deletions

View File

@ -94,14 +94,14 @@ public class InterLockData extends AbstractData {
MessageOrBuilder section = LineGraphicDataRepository.getDeviceByCode(lineId, axleCode); MessageOrBuilder section = LineGraphicDataRepository.getDeviceByCode(lineId, axleCode);
this.put(section, alertType, AlertDeviceType.DEVICE_TYPE_TRACK, interlockArea, min, max, rtuId); this.put(section, alertType, AlertDeviceType.DEVICE_TYPE_TRACK, interlockArea, min, max, rtuId);
} else if (builder instanceof Switch.Builder switchs) { } else if (builder instanceof Switch.Builder switchs) {
MessageOrBuilder section = LineGraphicDataRepository.getDeviceByCode(lineId, switchs.getId()); // MessageOrBuilder section = LineGraphicDataRepository.getDeviceByCode(lineId, switchs.getId());
this.put(section, alertType, AlertDeviceType.DEVICE_TYPE_SWITCH, interlockArea, min, max, rtuId); // this.put(section, alertType, AlertDeviceType.DEVICE_TYPE_SWITCH, interlockArea, min, max, rtuId);
//获取对应的道岔物理区段 //获取对应的道岔物理区段
// String sectionCode = LineGraphicDataRepository.findSectionFromLogicCode(lineId, switchs.getId()); String sectionCode = LineGraphicDataRepository.findTurnoutSectionFromTurnoutCode(lineId, switchs.getId());
// if (StringUtils.isNotEmpty(sectionCode)) { if (StringUtils.isNotEmpty(sectionCode)) {
// MessageOrBuilder switchSection = LineGraphicDataRepository.getDeviceByCode(lineId, sectionCode); MessageOrBuilder switchSection = LineGraphicDataRepository.getDeviceByCode(lineId, sectionCode);
// this.put(switchSection, alertType, AlertDeviceType.DEVICE_TYPE_TRACK, interlockArea, min, max, rtuId); this.put(switchSection, alertType, AlertDeviceType.DEVICE_TYPE_TRACK, interlockArea, min, max, rtuId);
// } }
} }
} }
} }

View File

@ -115,22 +115,23 @@ public class AxleLedInterlockTask implements AlertMonitoringTask {
List<TrackOccupiedStatus> warnResultList = Lists.newArrayList(); List<TrackOccupiedStatus> warnResultList = Lists.newArrayList();
for (Integer deviceLayoutId : deviceLayoutIds) { for (Integer deviceLayoutId : deviceLayoutIds) {
MessageOrBuilder mb = LineGraphicDataRepository.getDeviceByCode(lineIdInt, deviceLayoutId.toString()); MessageOrBuilder mb = LineGraphicDataRepository.getDeviceByCode(lineIdInt, deviceLayoutId.toString());
if (mb instanceof Section section) { /* if (mb instanceof Section section) {
boolean result = this.checkTrackOccupiedSectionStatus(alertType, section, lineIdInt, deviceStatusData, trainDataSource); boolean result = this.checkTrackOccupiedSectionStatus(alertType, section, lineIdInt, deviceStatusData, trainDataSource);
warnResultList.add(new TrackOccupiedStatus(section.getCode(), result, section.getCommon().getId())); warnResultList.add(new TrackOccupiedStatus(section.getCode(), result, section.getCommon().getId()));
} else if (mb instanceof Turnout turnout) { } else if (mb instanceof Turnout turnout) {
String dgCode = LineGraphicDataRepository.findTurnoutSectionFromTurnoutCode(lineIdInt, turnout.getCode()); String dgCode = LineGraphicDataRepository.findTurnoutSectionFromTurnoutCode(lineIdInt, turnout.getCode());
boolean result = this.checkTrackOccupiedTurnoutStatus(alertType, turnout, deviceStatusData, trainDataSource); boolean result = this.checkTrackOccupiedTurnoutStatus(alertType, turnout, deviceStatusData, trainDataSource);
warnResultList.add(new TrackOccupiedStatus(dgCode, result, turnout.getCommon().getId())); warnResultList.add(new TrackOccupiedStatus(dgCode, result, turnout.getCommon().getId()));
} }*/
/*if (mb instanceof Section section) { if (mb instanceof Section section) {
boolean result = this.checkTrackOccupiedStatus(alertType, section, lineIdInt, deviceStatusData, trainDataSource); boolean result = this.checkTrackOccupiedStatus(alertType, section, lineIdInt, deviceStatusData, trainDataSource);
warnResultList.add(new TrackOccupiedStatus(section.getCode(), result, section.getCommon().getId())); warnResultList.add(new TrackOccupiedStatus(section.getCode(), result, section.getCommon().getId()));
}*/ }
} }
return warnResultList; return warnResultList;
} }
@Deprecated
private boolean checkTrackOccupiedTurnoutStatus(AlertType alertType, Turnout turnout, DeviceStatusData deviceStatusData, TrainDataSource trainDataSource) { private boolean checkTrackOccupiedTurnoutStatus(AlertType alertType, Turnout turnout, DeviceStatusData deviceStatusData, TrainDataSource trainDataSource) {
MessageOrBuilder deviceStatus = deviceStatusData.getDeviceBuild(Switch.getDescriptor().getName(), turnout.getCode()); MessageOrBuilder deviceStatus = deviceStatusData.getDeviceBuild(Switch.getDescriptor().getName(), turnout.getCode());
@ -148,6 +149,7 @@ public class AxleLedInterlockTask implements AlertMonitoringTask {
return false; return false;
} }
@Deprecated
private boolean checkTrackOccupiedSectionStatus(AlertType alertType, Section section, Integer lineId, DeviceStatusData deviceStatusData, TrainDataSource trainDataSource) { private boolean checkTrackOccupiedSectionStatus(AlertType alertType, Section section, Integer lineId, DeviceStatusData deviceStatusData, TrainDataSource trainDataSource) {
List<Boolean> alertList = Lists.newArrayList(); List<Boolean> alertList = Lists.newArrayList();
if (section.getSectionType() == SectionType.Physical) { if (section.getSectionType() == SectionType.Physical) {
@ -170,30 +172,14 @@ public class AxleLedInterlockTask implements AlertMonitoringTask {
} }
} }
} }
}/* else if (section.getSectionType() == SectionType.TurnoutPhysical) { }
Integer turnoutId = section.getChildren(0);
Turnout turnout = LineGraphicDataRepository.getDeviceByCode(lineId, turnoutId.toString(), Turnout.class);
MessageOrBuilder deviceStatus = deviceStatusData.getDeviceBuild(Switch.getDescriptor().getName(), turnout.getCode());
String trainGroupId = trainDataSource.findTrainForDeviceName(section.getCode());
if (deviceStatus instanceof Switch.Builder switchBuild) {
boolean ledRed = switchBuild.getIpSingleSwitchStusCiOccupied() && !switchBuild.getIpSingleSwitchStusCbtcOccupied() && Objects.isNull(trainGroupId);
boolean orange = switchBuild.getIpSingleSwitchStusAtcInvalid();
if (alertType == AlertType.AXLE_LED_RED) {
alertList.add(ledRed);
} else {
alertList.add(orange);
}
}
}*/
if (CollectionUtils.isEmpty(alertList)) { if (CollectionUtils.isEmpty(alertList)) {
return false; return false;
} }
return alertList.stream().allMatch(d -> d); return alertList.stream().allMatch(d -> d);
} }
/* @Deprecated
private boolean checkTrackOccupiedStatus(AlertType alertType, Section section, Integer lineId, DeviceStatusData deviceStatusData, TrainDataSource trainDataSource) { private boolean checkTrackOccupiedStatus(AlertType alertType, Section section, Integer lineId, DeviceStatusData deviceStatusData, TrainDataSource trainDataSource) {
List<Boolean> alertList = Lists.newArrayList(); List<Boolean> alertList = Lists.newArrayList();
if (section.getSectionType() == SectionType.Physical) { if (section.getSectionType() == SectionType.Physical) {
@ -217,27 +203,28 @@ public class AxleLedInterlockTask implements AlertMonitoringTask {
} }
} }
} else if (section.getSectionType() == SectionType.TurnoutPhysical) { } else if (section.getSectionType() == SectionType.TurnoutPhysical) {
Integer turnoutId = section.getChildren(0); List<Boolean> turnoutOccLList = Lists.newArrayListWithCapacity(section.getChildrenList().size());
Turnout turnout = LineGraphicDataRepository.getDeviceByCode(lineId, turnoutId.toString(), Turnout.class); for (Integer refTuronoutId : section.getChildrenList()) {
Turnout turnout = LineGraphicDataRepository.getDeviceByCode(lineId, refTuronoutId.toString(), Turnout.class);
MessageOrBuilder deviceStatus = deviceStatusData.getDeviceBuild(Switch.getDescriptor().getName(), turnout.getCode()); MessageOrBuilder deviceStatus = deviceStatusData.getDeviceBuild(Switch.getDescriptor().getName(), turnout.getCode());
String trainGroupId = trainDataSource.findTrainForDeviceName(section.getCode());
String trainGroupId = trainDataSource.findTrainForDeviceName(section.getCode()); if (deviceStatus instanceof Switch.Builder switchBuild) {
if (deviceStatus instanceof Switch.Builder switchBuild) { boolean ledRed = switchBuild.getIpSingleSwitchStusCiOccupied() && !switchBuild.getIpSingleSwitchStusCbtcOccupied() && Objects.isNull(trainGroupId);
boolean ledRed = switchBuild.getIpSingleSwitchStusCiOccupied() && !switchBuild.getIpSingleSwitchStusCbtcOccupied() && Objects.isNull(trainGroupId); boolean orange = switchBuild.getIpSingleSwitchStusAtcInvalid();
boolean orange = switchBuild.getIpSingleSwitchStusAtcInvalid(); if (alertType == AlertType.AXLE_LED_RED) {
if (alertType == AlertType.AXLE_LED_RED) { turnoutOccLList.add(ledRed);
alertList.add(ledRed); } else {
} else { turnoutOccLList.add(orange);
alertList.add(orange); }
} }
} }
alertList.add(turnoutOccLList.stream().anyMatch(d -> d));
} }
if (CollectionUtils.isEmpty(alertList)) { if (CollectionUtils.isEmpty(alertList)) {
return false; return false;
} }
return alertList.stream().allMatch(d -> d); return alertList.stream().allMatch(d -> d);
}*/ }
@Getter @Getter