代码调整
This commit is contained in:
parent
2e485d0de1
commit
7323a6fede
@ -69,8 +69,9 @@ public class AxleLedInterlockTask implements AlertMonitoringTask {
|
||||
for (Entry<String, InterLockDetail> interLockDetail : detailMap.entrySet()) {
|
||||
String rtuIdJoinStr = interLockDetail.getKey();
|
||||
InterLockDetail detail = interLockDetail.getValue();
|
||||
Optional<AxleInterLockSource> redOpt = this.handle(lineId, detail, AlertType.AXLE_LED_RED, rtuIdJoinStr);
|
||||
Optional<AxleInterLockSource> orangeOpt = this.handle(lineId, detail, AlertType.AXLE_LED_ORANGE, rtuIdJoinStr);
|
||||
|
||||
Optional<AxleInterLockSource> redOpt = this.handle(lineId, detail, AlertType.AXLE_LED_RED, AlertType.AXLE_LED_RED_INTERLOCK_AREA, rtuIdJoinStr);
|
||||
Optional<AxleInterLockSource> orangeOpt = this.handle(lineId, detail, AlertType.AXLE_LED_ORANGE, AlertType.AXLE_LED_ORANGE_INTERLOCK_AREA, rtuIdJoinStr);
|
||||
|
||||
redOpt.ifPresent(axleInterLockSource -> this.alertManager.emit(new LedMostEvent(axleInterLockSource)));
|
||||
orangeOpt.ifPresent(axleInterLockSource -> this.alertManager.emit(new LedMostEvent(axleInterLockSource)));
|
||||
@ -81,27 +82,27 @@ public class AxleLedInterlockTask implements AlertMonitoringTask {
|
||||
}
|
||||
}
|
||||
|
||||
private Optional<AxleInterLockSource> handle(String lineId, InterLockDetail detail, AlertType alertType, String rtuIdJoinStr) {
|
||||
private Optional<AxleInterLockSource> handle(String lineId, InterLockDetail detail, AlertType findWarnAlertType, AlertType warnAlertType, String rtuIdJoinStr) {
|
||||
int deviceCount = detail.getDevices().size();
|
||||
Integer lineIdInt = Integer.parseInt(lineId);
|
||||
//收集联锁下的所有所有区段设备
|
||||
List<TrackOccupiedStatus> resultList = this.collectorLedWarDevices(alertType, lineId, detail.getDevices());
|
||||
List<TrackOccupiedStatus> resultList = this.collectorLedWarDevices(findWarnAlertType, lineId, detail.getDevices());
|
||||
int occupidedSzie = (int) resultList.stream().filter(d -> d.occupied).count();
|
||||
String customName = String.format("%s-%s", alertType.name(), detail.getAreaConfigId());
|
||||
String customName = String.format("%s-%s", findWarnAlertType.name(), detail.getAreaConfigId());
|
||||
if (occupidedSzie >= deviceCount) {
|
||||
//联锁报警
|
||||
if (alertDataSource.putAlterDevice(lineIdInt, customName, alertType.name())) {
|
||||
NccAlertInfo alertInfoMost = this.alertInfoService.createAlert2(detail.getAreaConfigId(), alertType, lineIdInt, LocalDateTime.now(), detail.getAreaConfigName(), null,
|
||||
if (alertDataSource.putAlterDevice(lineIdInt, customName, warnAlertType.name())) {
|
||||
NccAlertInfo alertInfoMost = this.alertInfoService.createAlert2(detail.getAreaConfigId(), warnAlertType, lineIdInt, LocalDateTime.now(), detail.getAreaConfigName(), null,
|
||||
AlertDeviceType.DEVICE_TYPE_TRACK,
|
||||
false);
|
||||
alertManager.emit(alertInfoMost);
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
alertDataSource.removeAlterDevice(lineIdInt, customName, alertType.name());
|
||||
alertDataSource.removeAlterDevice(lineIdInt, customName, warnAlertType.name());
|
||||
if (CollectionUtils.isNotEmpty(resultList)) {
|
||||
//大面积或单个告警
|
||||
AxleInterLockSource source = new AxleInterLockSource(lineId, rtuIdJoinStr, resultList, alertType);
|
||||
AxleInterLockSource source = new AxleInterLockSource(lineId, rtuIdJoinStr, resultList, findWarnAlertType);
|
||||
return Optional.of(source);
|
||||
}
|
||||
return Optional.empty();
|
||||
|
Loading…
Reference in New Issue
Block a user