This commit is contained in:
tiger_zhou 2024-01-05 17:20:01 +08:00
parent e1c168a82e
commit c561e51a17

View File

@ -22,7 +22,9 @@ import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Section.SectionType
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Turnout;
import club.joylink.xiannccda.service.AlertInfoService;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.google.protobuf.MessageOrBuilder;
import java.time.LocalDateTime;
@ -82,18 +84,18 @@ public class AxleLedInterlockTask implements AlertMonitoringTask {
Integer lineIdInt = Integer.parseInt(lineId);
//收集联锁下的所有所有区段设备
List<TrackOccupiedStatus> resultList = this.collectorLedWarDevices(findWarnAlertType, lineId, detail.getDevices());
List<String> occupidedDeviceList = resultList.stream().filter(d -> d.occupied).map(d -> d.deviceCode).toList();
if (resultList.stream().anyMatch(d -> d.occupied)) {
log.info("线路[{}] 联锁区[{}] 需要加载设备数量[{}] 实际加载数量[{}] 区段被占用情况[{}]", lineId, rtuIdJoinStr, deviceCount, resultList.size(),
resultList.stream().filter(d -> d.occupied).map(d -> d.deviceCode).collect(Collectors.joining(",")));
String occupedDevices = Joiner.on(StringPool.COMMA).join(occupidedDeviceList);
log.info("线路[{}] 联锁区[{}] 需要加载设备数量[{}] 实际加载数量[{}] 区段被占用情况[{}]", lineId, rtuIdJoinStr, deviceCount, resultList.size(), occupedDevices);
}
int occupidedSzie = (int) resultList.stream().filter(d -> d.occupied).count();
int occupidedSzie = occupidedDeviceList.size();
String customName = String.format("%s-%s", findWarnAlertType.name(), detail.getAreaConfigId());
if (occupidedSzie >= deviceCount) {
//联锁报警
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);
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();