Merge remote-tracking branch 'origin/master_new_bule_loop_task'
This commit is contained in:
commit
ba1df4a21b
@ -0,0 +1,174 @@
|
||||
package club.joylink.xiannccda.alert.core;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.collect.HashBasedTable;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Table;
|
||||
import com.google.common.collect.Tables;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* 事件任务管理器
|
||||
*/
|
||||
@Slf4j
|
||||
public class AlertDataSource {
|
||||
|
||||
|
||||
/**
|
||||
* 保存已经报警的设备
|
||||
* <p>
|
||||
* row = lineid
|
||||
* <p>
|
||||
* column = 设备类型,也可是自定义的类型
|
||||
* <p>
|
||||
* val = 设备code
|
||||
*/
|
||||
private static final Table<Integer, String, AlertTableDetail> DEVICE_ALTER_TABLE = Tables.synchronizedTable(HashBasedTable.create());
|
||||
|
||||
private volatile static AlertDataSource dataSource;
|
||||
|
||||
public synchronized static AlertDataSource getInstance() {
|
||||
if (Objects.isNull(dataSource)) {
|
||||
return new AlertDataSource();
|
||||
}
|
||||
return dataSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* 报警监控任务(循环监测式报警)
|
||||
*/
|
||||
Map<String, AlertMonitoringTask> amtMap = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
public void clearAlertDataMsg(Integer lineId) {
|
||||
DEVICE_ALTER_TABLE.clear();
|
||||
}
|
||||
|
||||
public boolean putAlterDevice(Integer lineId, String customName, String deviceName) {
|
||||
AlertTableDetail detail = DEVICE_ALTER_TABLE.get(lineId, customName);
|
||||
if (Objects.isNull(detail)) {
|
||||
detail = new AlertTableDetail(false);
|
||||
DEVICE_ALTER_TABLE.put(lineId, customName, detail);
|
||||
}
|
||||
return detail.add(deviceName);
|
||||
}
|
||||
|
||||
public boolean deviceIsExist(Integer lineId, String customName, String deviceName) {
|
||||
AlertTableDetail detail = DEVICE_ALTER_TABLE.get(lineId, customName);
|
||||
if (Objects.isNull(detail)) {
|
||||
return false;
|
||||
}
|
||||
return detail.contains(deviceName);
|
||||
|
||||
}
|
||||
|
||||
public void removeAlertDevicePrefixName(Integer lineId, String prefixName, String deviceCode) {
|
||||
Map<String, AlertTableDetail> detailMap = DEVICE_ALTER_TABLE.row(lineId);
|
||||
for (Entry<String, AlertTableDetail> entry : detailMap.entrySet()) {
|
||||
if (StringUtils.startsWith(entry.getKey(), prefixName)) {
|
||||
entry.getValue().remove(deviceCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removeAlterDevice(Integer lineId, String customName, String deviceName) {
|
||||
AlertTableDetail detail = DEVICE_ALTER_TABLE.get(lineId, customName);
|
||||
if (Objects.isNull(detail)) {
|
||||
detail = new AlertTableDetail(false);
|
||||
DEVICE_ALTER_TABLE.put(lineId, customName, detail);
|
||||
}
|
||||
detail.remove(deviceName);
|
||||
}
|
||||
|
||||
public boolean needMostShow(Integer lineId, String customName, int val) {
|
||||
if (StringUtils.isEmpty(customName)) {
|
||||
return false;
|
||||
}
|
||||
AlertTableDetail detail = DEVICE_ALTER_TABLE.get(lineId, customName);
|
||||
if (Objects.isNull(detail)) {
|
||||
detail = new AlertTableDetail(false);
|
||||
DEVICE_ALTER_TABLE.put(lineId, customName, detail);
|
||||
}
|
||||
// if (detail.mostShower && detail.mostSize() >= val) {
|
||||
// //已经报警过了且超过了阈值
|
||||
// return false;
|
||||
// } else
|
||||
if (detail.mostShower && detail.mostSize() < val) {
|
||||
//已经报警过了,但小于阈值
|
||||
detail.setMostShower(false);
|
||||
return false;
|
||||
} else if (detail.mostSize() >= val) {
|
||||
//超过阈值
|
||||
detail.setMostShower(true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String findAllWarnDevice(Integer lineId, String customName) {
|
||||
AlertTableDetail detail = DEVICE_ALTER_TABLE.get(lineId, customName);
|
||||
if (Objects.isNull(detail)) {
|
||||
return null;
|
||||
}
|
||||
return detail.getAllDeviceCodes();
|
||||
}
|
||||
|
||||
public List<String> findAllWarnDeviceForList(Integer lineId, String customeName) {
|
||||
AlertTableDetail detail = DEVICE_ALTER_TABLE.get(lineId, customeName);
|
||||
if (Objects.isNull(detail)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return detail.getDeviceCodes();
|
||||
}
|
||||
|
||||
|
||||
public static class AlertTableDetail {
|
||||
|
||||
public AlertTableDetail(boolean shower) {
|
||||
this.mostShower = shower;
|
||||
this.deviceCodes = Lists.newArrayList();
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean mostShower;
|
||||
@Getter
|
||||
private List<String> deviceCodes;
|
||||
|
||||
public int mostSize() {
|
||||
return this.deviceCodes.size();
|
||||
}
|
||||
|
||||
public boolean add(String deviceCode) {
|
||||
if (this.contains(deviceCode)) {
|
||||
return false;
|
||||
|
||||
}
|
||||
this.deviceCodes.add(deviceCode);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public String getAllDeviceCodes() {
|
||||
return Joiner.on(StringPool.COMMA).skipNulls().join(this.deviceCodes);
|
||||
}
|
||||
|
||||
public boolean contains(String deviceCode) {
|
||||
return this.deviceCodes.contains(deviceCode);
|
||||
}
|
||||
|
||||
public void remove(String deviceCode) {
|
||||
this.deviceCodes.remove(deviceCode);
|
||||
}
|
||||
}
|
||||
}
|
@ -28,16 +28,6 @@ import org.apache.commons.lang3.StringUtils;
|
||||
public class AlertManager extends EventEmitter {
|
||||
|
||||
private static final Map<String, AlertManager> MANAGER_MAP = new ConcurrentHashMap<>();
|
||||
/**
|
||||
* 保存已经报警的设备
|
||||
* <p>
|
||||
* row = lineid
|
||||
* <p>
|
||||
* column = 设备类型,也可是自定义的类型
|
||||
* <p>
|
||||
* val = 设备code
|
||||
*/
|
||||
private static final Table<Integer, String, AlertTableDetail> DEVICE_ALTER_TABLE = Tables.synchronizedTable(HashBasedTable.create());
|
||||
/**
|
||||
* 报警监控任务(循环监测式报警)
|
||||
*/
|
||||
@ -58,78 +48,6 @@ public class AlertManager extends EventEmitter {
|
||||
return getInstance("default");
|
||||
}
|
||||
|
||||
public void clearAlertDataMsg(Integer lineId) {
|
||||
DEVICE_ALTER_TABLE.clear();
|
||||
}
|
||||
|
||||
public boolean putAlterDevice(Integer lineId, String customName, String deviceName) {
|
||||
AlertTableDetail detail = DEVICE_ALTER_TABLE.get(lineId, customName);
|
||||
if (Objects.isNull(detail)) {
|
||||
detail = new AlertTableDetail(false);
|
||||
DEVICE_ALTER_TABLE.put(lineId, customName, detail);
|
||||
}
|
||||
return detail.add(deviceName);
|
||||
}
|
||||
|
||||
public boolean deviceIsExist(Integer lineId, String customName, String deviceName) {
|
||||
AlertTableDetail detail = DEVICE_ALTER_TABLE.get(lineId, customName);
|
||||
if (Objects.isNull(detail)) {
|
||||
return false;
|
||||
}
|
||||
return detail.contains(deviceName);
|
||||
|
||||
}
|
||||
|
||||
public void removeAlterDevice(Integer lineId, String customName, String deviceName) {
|
||||
AlertTableDetail detail = DEVICE_ALTER_TABLE.get(lineId, customName);
|
||||
if (Objects.isNull(detail)) {
|
||||
detail = new AlertTableDetail(false);
|
||||
DEVICE_ALTER_TABLE.put(lineId, customName, detail);
|
||||
}
|
||||
detail.remove(deviceName);
|
||||
}
|
||||
|
||||
public boolean needMostShow(Integer lineId, String customName, int val) {
|
||||
if (StringUtils.isEmpty(customName)) {
|
||||
return false;
|
||||
}
|
||||
AlertTableDetail detail = DEVICE_ALTER_TABLE.get(lineId, customName);
|
||||
if (Objects.isNull(detail)) {
|
||||
detail = new AlertTableDetail(false);
|
||||
DEVICE_ALTER_TABLE.put(lineId, customName, detail);
|
||||
}
|
||||
// if (detail.mostShower && detail.mostSize() >= val) {
|
||||
// //已经报警过了且超过了阈值
|
||||
// return false;
|
||||
// } else
|
||||
if (detail.mostShower && detail.mostSize() < val) {
|
||||
//已经报警过了,但小于阈值
|
||||
detail.setMostShower(false);
|
||||
return false;
|
||||
} else if (detail.mostSize() >= val) {
|
||||
//超过阈值
|
||||
detail.setMostShower(true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String findAllWarnDevice(Integer lineId, String customName) {
|
||||
AlertTableDetail detail = DEVICE_ALTER_TABLE.get(lineId, customName);
|
||||
if (Objects.isNull(detail)) {
|
||||
return null;
|
||||
}
|
||||
return detail.getAllDeviceCodes();
|
||||
}
|
||||
|
||||
public List<String> findAllWarnDeviceForList(Integer lineId, String customeName) {
|
||||
AlertTableDetail detail = DEVICE_ALTER_TABLE.get(lineId, customeName);
|
||||
if (Objects.isNull(detail)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return detail.getDeviceCodes();
|
||||
}
|
||||
|
||||
public static AlertManager getInstance(String id) {
|
||||
return MANAGER_MAP.computeIfAbsent(id, k -> new AlertManager(id));
|
||||
}
|
||||
@ -167,43 +85,5 @@ public class AlertManager extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
public static class AlertTableDetail {
|
||||
|
||||
public AlertTableDetail(boolean shower) {
|
||||
this.mostShower = shower;
|
||||
this.deviceCodes = Lists.newArrayList();
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean mostShower;
|
||||
@Getter
|
||||
private List<String> deviceCodes;
|
||||
|
||||
public int mostSize() {
|
||||
return this.deviceCodes.size();
|
||||
}
|
||||
|
||||
public boolean add(String deviceCode) {
|
||||
if (this.contains(deviceCode)) {
|
||||
return false;
|
||||
|
||||
}
|
||||
this.deviceCodes.add(deviceCode);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public String getAllDeviceCodes() {
|
||||
return Joiner.on(StringPool.COMMA).skipNulls().join(this.deviceCodes);
|
||||
}
|
||||
|
||||
public boolean contains(String deviceCode) {
|
||||
return this.deviceCodes.contains(deviceCode);
|
||||
}
|
||||
|
||||
public void remove(String deviceCode) {
|
||||
this.deviceCodes.remove(deviceCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
public abstract class RelieveDataService implements DataService {
|
||||
|
||||
private final static Cache<String, List<RelieveVO>> CACHE = CacheBuilder.newBuilder().expireAfterAccess(10, TimeUnit.MINUTES).build();
|
||||
private final static Cache<String, List<RelieveVO>> CACHE = CacheBuilder.newBuilder().build();
|
||||
|
||||
private List<RelieveVO> getCache(Integer lineId, AlertDeviceType deviceType) {
|
||||
try {
|
||||
|
@ -180,6 +180,7 @@ public class LineGraphicDataRepository {
|
||||
String deviceCode_ = DeviceStatusDataOperate.findFieldVal(childMB, "code", String.class);
|
||||
|
||||
dsd.addDevice(createMsg(lineId, club.joylink.xiannccda.ats.message.line3.device.DeviceType.DEVICE_TYPE_TRACK, deviceCode_, rtuId.shortValue()));
|
||||
interLock.addDevice(createMsg(lineId, club.joylink.xiannccda.ats.message.line3.device.DeviceType.DEVICE_TYPE_TRACK, deviceCode_, rtuId.shortValue()));
|
||||
}
|
||||
}
|
||||
} else if (mb instanceof LayoutGraphicsProto.Signal) {
|
||||
|
@ -3,15 +3,11 @@ package club.joylink.xiannccda.ats.message.collect.convertor;
|
||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||
import club.joylink.xiannccda.ats.message.MessageId;
|
||||
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
||||
import club.joylink.xiannccda.ats.warn.AxleLedAlertListener.AxleLedAlertEvent;
|
||||
import club.joylink.xiannccda.ats.warn.AxleSwitchTrackLedAlertListener.SwitchAndTrackLedAlertEvent;
|
||||
import club.joylink.xiannccda.ats.warn.axle.AxleLedAlertListener.AxleLedAlertEvent;
|
||||
|
||||
|
||||
import club.joylink.xiannccda.ats.warn.BlueAlertListener.BlueDisplayAlertEvent;
|
||||
import club.joylink.xiannccda.ats.warn.SwitchLostAlertListener.SwitchLostAlertEvent;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Switch;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Track;
|
||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||
import java.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -36,11 +32,12 @@ public class DeviceChangeStatusConvertor extends DefaultConvertor {
|
||||
/* if (builder instanceof Rtu.Builder rtuBuild) {
|
||||
alertManager.emit(new BlueDisplayAlertEvent(rtuBuild));
|
||||
} else*/
|
||||
if (builder instanceof Track.Builder trackBuild) {
|
||||
// if (builder instanceof Track.Builder trackBuild) {
|
||||
// alertManager.emit(new SwitchAndTrackLedAlertEvent(trackBuild));
|
||||
alertManager.emit(new AxleLedAlertEvent(trackBuild));
|
||||
// alertManager.emit(new AxleLedAlertEvent(trackBuild));
|
||||
|
||||
} else if (builder instanceof Switch.Builder switchBuild) {
|
||||
// } else
|
||||
if (builder instanceof Switch.Builder switchBuild) {
|
||||
alertManager.emit(new SwitchLostAlertEvent(switchBuild));
|
||||
// alertManager.emit(new SwitchAndTrackLedAlertEvent(switchBuild));
|
||||
alertManager.emit(new AxleLedAlertEvent(switchBuild));
|
||||
|
@ -3,15 +3,11 @@ package club.joylink.xiannccda.ats.message.collect.convertor;
|
||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||
import club.joylink.xiannccda.ats.message.MessageId;
|
||||
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
||||
import club.joylink.xiannccda.ats.warn.AxleLedAlertListener.AxleLedAlertEvent;
|
||||
import club.joylink.xiannccda.ats.warn.AxleSwitchTrackLedAlertListener.SwitchAndTrackLedAlertEvent;
|
||||
import club.joylink.xiannccda.ats.warn.axle.AxleLedAlertListener.AxleLedAlertEvent;
|
||||
|
||||
|
||||
import club.joylink.xiannccda.ats.warn.BlueAlertListener.BlueDisplayAlertEvent;
|
||||
import club.joylink.xiannccda.ats.warn.SwitchLostAlertListener.SwitchLostAlertEvent;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Switch;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Track;
|
||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||
import java.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -36,10 +32,11 @@ public class DeviceInitConvertor extends DefaultConvertor {
|
||||
/* if (builder instanceof Rtu.Builder rtuBuild) {
|
||||
alertManager.emit(new BlueDisplayAlertEvent(rtuBuild));
|
||||
} else */
|
||||
if (builder instanceof Track.Builder trackBuild) {
|
||||
// if (builder instanceof Track.Builder trackBuild) {
|
||||
// alertManager.emit(new SwitchAndTrackLedAlertEvent(trackBuild));
|
||||
alertManager.emit(new AxleLedAlertEvent(trackBuild));
|
||||
} else if (builder instanceof Switch.Builder switchBuild) {
|
||||
// alertManager.emit(new AxleLedAlertEvent(trackBuild));
|
||||
// } else
|
||||
if (builder instanceof Switch.Builder switchBuild) {
|
||||
// alertManager.emit(new SwitchAndTrackLedAlertEvent(switchBuild));
|
||||
alertManager.emit(new AxleLedAlertEvent(switchBuild));
|
||||
alertManager.emit(new SwitchLostAlertEvent(switchBuild));
|
||||
|
@ -19,6 +19,7 @@ import com.google.common.collect.Table;
|
||||
import com.google.common.collect.Tables;
|
||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||
import com.google.protobuf.MessageOrBuilder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@ -85,7 +86,6 @@ public class InterLockData extends AbstractData {
|
||||
|
||||
Integer min = Integer.parseInt(sortStationList.get(0).getCode());
|
||||
Integer max = Integer.parseInt(sortStationList.get(sortStationList.size() - 1).getCode());
|
||||
|
||||
if (rtuId >= min && rtuId <= max) {
|
||||
if (builder instanceof Track.Builder track) {
|
||||
String axleCode = LineGraphicDataRepository.findAxleCodeFromLogicCode(lineId, track.getId());
|
||||
@ -94,8 +94,8 @@ public class InterLockData extends AbstractData {
|
||||
MessageOrBuilder section = LineGraphicDataRepository.getDeviceByCode(lineId, axleCode);
|
||||
this.put(section, alertType, AlertDeviceType.DEVICE_TYPE_TRACK, interlockArea, min, max, rtuId);
|
||||
} else if (builder instanceof Switch.Builder switchs) {
|
||||
MessageOrBuilder section = LineGraphicDataRepository.getDeviceByCode(lineId, switchs.getId());
|
||||
this.put(section, alertType, AlertDeviceType.DEVICE_TYPE_SWITCH, interlockArea, min, max, rtuId);
|
||||
// MessageOrBuilder section = LineGraphicDataRepository.getDeviceByCode(lineId, switchs.getId());
|
||||
// this.put(section, alertType, AlertDeviceType.DEVICE_TYPE_SWITCH, interlockArea, min, max, rtuId);
|
||||
//获取对应的道岔物理区段
|
||||
String sectionCode = LineGraphicDataRepository.findSectionFromLogicCode(lineId, switchs.getId());
|
||||
if (StringUtils.isNotEmpty(sectionCode)) {
|
||||
@ -115,10 +115,10 @@ public class InterLockData extends AbstractData {
|
||||
InterLockDetail detail = INTER_LOCK_TABLE.get(names, tableColumn);
|
||||
if (Objects.isNull(detail)) {
|
||||
detail = new InterLockDetail(configVO);
|
||||
detail.setRtuId(deviceRtuId);
|
||||
INTER_LOCK_TABLE.put(names, tableColumn, detail);
|
||||
}
|
||||
detail.addDevice(commonInfo.getOldid());
|
||||
detail.addRtuId(deviceRtuId);
|
||||
detail.addDevice(commonInfo.getId());
|
||||
}
|
||||
|
||||
private String interLockMapName(AlertType alertType, AlertDeviceType deviceTyp) {
|
||||
@ -139,10 +139,10 @@ public class InterLockData extends AbstractData {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
public boolean contains(AlertType alertType, AlertDeviceType deviceType, Integer rtuId, String deviceLayoutId) {
|
||||
Optional<InterLockDetail> opt = this.findDevices(alertType, deviceType, rtuId);
|
||||
return opt.map(interLockDetail -> interLockDetail.contains(deviceLayoutId)).orElse(false);
|
||||
}
|
||||
// public boolean contains(AlertType alertType, AlertDeviceType deviceType, Integer rtuId, String deviceLayoutId) {
|
||||
// Optional<InterLockDetail> opt = this.findDevices(alertType, deviceType, rtuId);
|
||||
// return opt.map(interLockDetail -> interLockDetail.contains(deviceLayoutId)).orElse(false);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void addDevice(List<Builder> dataList) {
|
||||
@ -179,7 +179,7 @@ public class InterLockData extends AbstractData {
|
||||
public InterLockDetail(AreaConfigVO areaConfigVO) {
|
||||
this.areaConfigId = areaConfigVO.getId();
|
||||
this.areaConfigName = areaConfigVO.getAreaName();
|
||||
this.devices = new TreeSet<>();
|
||||
this.devices = Lists.newArrayList();
|
||||
}
|
||||
|
||||
@Getter
|
||||
@ -187,15 +187,22 @@ public class InterLockData extends AbstractData {
|
||||
@Getter
|
||||
private String areaConfigName;
|
||||
@Getter
|
||||
private Set<String> devices;
|
||||
private List<Integer> devices;
|
||||
@Getter
|
||||
@Setter
|
||||
private Integer rtuId;
|
||||
private List<Integer> rtuIds = new ArrayList<>();
|
||||
|
||||
public void addRtuId(Integer rtuId) {
|
||||
if (!this.rtuIds.contains(rtuId)) {
|
||||
this.rtuIds.add(rtuId);
|
||||
}
|
||||
}
|
||||
// private AtomicInteger deviceCount = new AtomicInteger(0);
|
||||
|
||||
protected void addDevice(String deviceCodeOrRtuId) {
|
||||
protected void addDevice(Integer deviceCodeOrRtuId) {
|
||||
if (!devices.contains(deviceCodeOrRtuId)) {
|
||||
this.devices.add(deviceCodeOrRtuId);
|
||||
}
|
||||
// this.deviceCount.incrementAndGet();
|
||||
}
|
||||
|
||||
@ -203,7 +210,7 @@ public class InterLockData extends AbstractData {
|
||||
// return this.deviceCount.get();
|
||||
// }
|
||||
|
||||
public boolean contains(String deviceLayOutId) {
|
||||
public boolean contains(Integer deviceLayOutId) {
|
||||
return this.devices.contains(deviceLayOutId);
|
||||
}
|
||||
|
||||
|
@ -1,54 +0,0 @@
|
||||
package club.joylink.xiannccda.ats.warn;
|
||||
|
||||
import club.joylink.xiannccda.alert.NccAlertInfo;
|
||||
import club.joylink.xiannccda.alert.core.AlertDeviceType;
|
||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||
import club.joylink.xiannccda.alert.core.AlertSourceEventListener;
|
||||
import club.joylink.xiannccda.ats.warn.AllLineBlueAlertListener.AllLineBlueDisplayAlertEvent;
|
||||
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu.Builder;
|
||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Station;
|
||||
import club.joylink.xiannccda.service.AlertInfoService;
|
||||
import java.util.Optional;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
//@Component
|
||||
@Slf4j
|
||||
@Deprecated
|
||||
public class AllLineBlueAlertListener implements AlertSourceEventListener<AllLineBlueDisplayAlertEvent> {
|
||||
|
||||
@Autowired
|
||||
private AlertInfoService alertInfoService;
|
||||
|
||||
|
||||
private final static AlertManager alertManager = AlertManager.getDefault();
|
||||
|
||||
@Override
|
||||
public void accept(AllLineBlueDisplayAlertEvent event) {
|
||||
Rtu.Builder rtu = event.getSource();
|
||||
if (alertManager.needMostShow(rtu.getLineId(), BlueAlertListener.BLUE_DISPLAY_NAME, event.allControlStationSize)
|
||||
&& alertManager.putAlterDevice(rtu.getLineId(), BlueAlertListener.BLUE_DISPLAY_NAME, BlueAlertListener.ALL_BLUE_DISPLAY_VAL_FLAG)) {
|
||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(Optional.empty(), AlertType.ALL_LINE_BLUE_DISPLAY, rtu, BlueAlertListener.ALL_BLUE_DISPLAY_VAL_FLAG,
|
||||
String.valueOf(event.station.getCommon().getId()), AlertDeviceType.DEVICE_TYPE_RTU, false);
|
||||
alertManager.emit(alertInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class AllLineBlueDisplayAlertEvent extends DeviceAlertEvent<Builder> {
|
||||
|
||||
private Station station;
|
||||
private Integer allControlStationSize;
|
||||
|
||||
public AllLineBlueDisplayAlertEvent(Builder source, Station station, Integer allControlStationSize) {
|
||||
super(source);
|
||||
this.station = station;
|
||||
this.allControlStationSize = allControlStationSize;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,148 +0,0 @@
|
||||
package club.joylink.xiannccda.ats.warn;
|
||||
|
||||
import club.joylink.xiannccda.alert.NccAlertInfo;
|
||||
import club.joylink.xiannccda.alert.core.AlertDeviceType;
|
||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||
import club.joylink.xiannccda.alert.core.AlertSourceEventListener;
|
||||
import club.joylink.xiannccda.alert.core.relieve.RelieveFilterManager;
|
||||
import club.joylink.xiannccda.ats.cache.LineGraphicDataRepository;
|
||||
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository;
|
||||
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
||||
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataOperate;
|
||||
import club.joylink.xiannccda.ats.message.collect.datasource.DeviceStatusData;
|
||||
import club.joylink.xiannccda.ats.message.collect.datasource.TrainDataSource;
|
||||
import club.joylink.xiannccda.ats.warn.AxleLedAlertListener.AxleLedAlertEvent;
|
||||
import club.joylink.xiannccda.ats.warn.AxleSwitchTrackLedMostAlertListener.SwitchAndTrackLedMostAlertEvent;
|
||||
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Switch;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Track;
|
||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.CommonInfo;
|
||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.LogicSection;
|
||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Section;
|
||||
import club.joylink.xiannccda.service.AlertInfoService;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||
import com.google.protobuf.MessageOrBuilder;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class AxleLedAlertListener implements AlertSourceEventListener<AxleLedAlertEvent> {
|
||||
|
||||
private final AlertInfoService alertInfoService;
|
||||
private final AlertManager alertManager = AlertManager.getDefault();
|
||||
@Autowired
|
||||
private RelieveFilterManager relieveFilterManager;
|
||||
|
||||
public AxleLedAlertListener(AlertInfoService alertInfoService) {
|
||||
this.alertInfoService = alertInfoService;
|
||||
}
|
||||
|
||||
private String getDefaultName(AlertType alertType, Integer lineId, Integer rtuId) {
|
||||
return String.format("%s-%s-%s", alertType.name(), lineId, rtuId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(AxleLedAlertEvent event) {
|
||||
Builder o = event.getSource();
|
||||
// String receiveBuildType = o.getDescriptorForType().getName();
|
||||
Integer lineId = DeviceStatusDataOperate.findFieldVal(o, "lineId", Integer.class);
|
||||
String id = DeviceStatusDataOperate.findFieldVal(o, "id", String.class);
|
||||
// log.info("区段光带检测 线路[{}] 设备[{}] 接受类型[{}]", lineId, id, receiveBuildType);
|
||||
|
||||
TrainDataSource trainDataSource = DeviceDataRepository.findDataSouce(lineId.toString(), DataTypeEnum.TRAIN);
|
||||
|
||||
if (o instanceof Switch.Builder switchBuilder) {
|
||||
String sectionCode = LineGraphicDataRepository.findSectionFromLogicCode(lineId, id);
|
||||
MessageOrBuilder section = LineGraphicDataRepository.getDeviceByCode(lineId, sectionCode);
|
||||
this.switchHandle(switchBuilder, section, trainDataSource);
|
||||
} else if (o instanceof Track.Builder trackBuilder) {
|
||||
String axleSectionCode = LineGraphicDataRepository.findAxleCodeFromLogicCode(lineId, id);
|
||||
MessageOrBuilder section = LineGraphicDataRepository.getDeviceByCode(lineId, axleSectionCode);
|
||||
this.trackHandle(trackBuilder, (Section) section, trainDataSource);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void switchHandle(Switch.Builder switchBuilder, MessageOrBuilder section, TrainDataSource trainDataSource) {
|
||||
String trainGroupId = trainDataSource.findTrainForDeviceName(switchBuilder.getId());
|
||||
boolean ledRed = switchBuilder.getIpSingleSwitchStusCiOccupied() && !switchBuilder.getIpSingleSwitchStusCbtcOccupied() && Objects.isNull(trainGroupId);
|
||||
boolean orange = switchBuilder.getIpSingleSwitchStusAtcInvalid();
|
||||
log.info("区段光带 道轨区段 线路[{}] 区段[{}] 红光带占用[{}] 橙光带占用[{}]", switchBuilder.getLineId(), switchBuilder.getId(), ledRed, orange);
|
||||
this.emit(ledRed, switchBuilder, section, AlertType.AXLE_LED_RED);
|
||||
this.emit(orange, switchBuilder, section, AlertType.AXLE_LED_ORANGE);
|
||||
}
|
||||
|
||||
private void trackHandle(Track.Builder trackBuild, Section axleSection, TrainDataSource trainDataSource) {
|
||||
List<Boolean> redList = Lists.newArrayList();
|
||||
List<Boolean> orangeList = Lists.newArrayList();
|
||||
|
||||
DeviceStatusData deviceStatusData = DeviceDataRepository.findDataSouce(String.valueOf(trackBuild.getLineId()), DataTypeEnum.DEVICE);
|
||||
for (Integer childId : axleSection.getChildrenList()) {
|
||||
LogicSection childSection = LineGraphicDataRepository.getDeviceByCode(trackBuild.getLineId(), childId.toString(), LogicSection.class);
|
||||
String trainGroupId = trainDataSource.findTrainForDeviceName(childSection.getCode());
|
||||
if (StringUtils.isNotEmpty(trainGroupId)) {
|
||||
redList.add(false);
|
||||
orangeList.add(false);
|
||||
break;
|
||||
}
|
||||
MessageOrBuilder trackMB = deviceStatusData.getDeviceBuild(Track.getDescriptor().getName(), childSection.getCode());
|
||||
if (Objects.nonNull(trackMB)) {
|
||||
Track.Builder saveTrackBuild = (Track.Builder) trackMB;
|
||||
redList.add(saveTrackBuild.getCiOccupied() && !saveTrackBuild.getCbtcOccupied());
|
||||
orangeList.add(saveTrackBuild.getAtcInvalid());
|
||||
}
|
||||
}
|
||||
boolean ledRed = redList.size() == axleSection.getChildrenList().size() && redList.stream().allMatch(d -> d);
|
||||
boolean orange = orangeList.size() == axleSection.getChildrenList().size() && orangeList.stream().allMatch(d -> d);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.info("区段光带 区段 线路[{}] 区段[{}] 红光带占用[{}] 橙光带占用[{}]", trackBuild.getLineId(), trackBuild.getId(), ledRed, orange);
|
||||
}
|
||||
|
||||
this.emit(ledRed, trackBuild, axleSection, AlertType.AXLE_LED_RED);
|
||||
this.emit(orange, trackBuild, axleSection, AlertType.AXLE_LED_ORANGE);
|
||||
}
|
||||
|
||||
private void emit(boolean light, Builder build, MessageOrBuilder turnoutOrLogicSection, AlertType alertType) {
|
||||
Integer lineId = DeviceStatusDataOperate.findFieldVal(build, "lineId", Integer.class);
|
||||
Integer rtuId = DeviceStatusDataOperate.findFieldVal(build, "rtuId", Integer.class);
|
||||
String deviceCodeId = DeviceStatusDataOperate.findFieldVal(turnoutOrLogicSection, "code", String.class);
|
||||
CommonInfo commonInfo = DeviceStatusDataOperate.findFieldVal(turnoutOrLogicSection, "common", CommonInfo.class);
|
||||
Integer layoutDeviceId = commonInfo.getId();
|
||||
String ledName = alertType == AlertType.AXLE_LED_RED ? "红光带" : "橙光带";
|
||||
String ledPutName = this.getDefaultName(alertType, lineId, rtuId);
|
||||
if (light) {
|
||||
// log.info("光带检测到[{}] 线路[{}] 设备[{}] 告警[{}]", ledName, lineId, deviceCodeId, alertType.name());
|
||||
if (alertManager.putAlterDevice(lineId, ledPutName, deviceCodeId) && Objects.equals(false,
|
||||
relieveFilterManager.relieveAlertMatch(lineId, AlertDeviceType.DEVICE_TYPE_TRACK, alertType, layoutDeviceId))) {
|
||||
String alertMsg = String.format("出现%s设备[%s]", ledName, deviceCodeId);
|
||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(Optional.empty(), alertType, build, alertMsg, String.valueOf(layoutDeviceId), AlertDeviceType.DEVICE_TYPE_TRACK, false);
|
||||
alertManager.emit(alertInfo);
|
||||
alertManager.emit(new SwitchAndTrackLedMostAlertEvent(build, alertType, lineId, layoutDeviceId, deviceCodeId, true));
|
||||
// alertManager.emit(new SwitchAndTrackLedInterLockL2AlertEvent(build, alertType, lineId, layoutDeviceId, deviceCodeId, true, rtuId));
|
||||
// alertManager.emit(new SwitchAndTrackLedInterlockAreaAlertEvent(build, alertType, lineId, layoutDeviceId, deviceCodeId, true));
|
||||
}
|
||||
} else {
|
||||
alertManager.removeAlterDevice(lineId, ledPutName, deviceCodeId);
|
||||
alertManager.emit(new SwitchAndTrackLedMostAlertEvent(build, alertType, lineId, layoutDeviceId, deviceCodeId, false));
|
||||
// alertManager.emit(new SwitchAndTrackLedInterLockL2AlertEvent(build, alertType, lineId, layoutDeviceId, deviceCodeId, false, rtuId));
|
||||
// alertManager.emit(new SwitchAndTrackLedInterlockAreaAlertEvent(build, alertType, lineId, layoutDeviceId, deviceCodeId, false));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static class AxleLedAlertEvent extends DeviceAlertEvent<Builder> {
|
||||
|
||||
public AxleLedAlertEvent(Builder source) {
|
||||
super(source);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,136 +0,0 @@
|
||||
package club.joylink.xiannccda.ats.warn;
|
||||
|
||||
import club.joylink.xiannccda.alert.NccAlertInfo;
|
||||
import club.joylink.xiannccda.alert.core.AlertDeviceType;
|
||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||
import club.joylink.xiannccda.alert.core.AlertSourceEventListener;
|
||||
import club.joylink.xiannccda.ats.cache.LineGraphicDataRepository;
|
||||
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository;
|
||||
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
||||
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataOperate;
|
||||
import club.joylink.xiannccda.ats.message.collect.datasource.TrainDataSource;
|
||||
import club.joylink.xiannccda.ats.warn.AxleSwitchTrackLedAlertListener.SwitchAndTrackLedAlertEvent;
|
||||
import club.joylink.xiannccda.ats.warn.AxleSwitchTrackLedMostAlertListener.SwitchAndTrackLedMostAlertEvent;
|
||||
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Switch;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Track;
|
||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.CommonInfo;
|
||||
import club.joylink.xiannccda.service.AlertInfoService;
|
||||
import com.google.protobuf.GeneratedMessageV3;
|
||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||
import com.google.protobuf.MessageOrBuilder;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
//@Component
|
||||
@Deprecated
|
||||
@Slf4j
|
||||
public class AxleSwitchTrackLedAlertListener implements AlertSourceEventListener<SwitchAndTrackLedAlertEvent> {
|
||||
|
||||
private final AlertInfoService alertInfoService;
|
||||
private final AlertManager alertManager = AlertManager.getDefault();
|
||||
|
||||
public AxleSwitchTrackLedAlertListener(AlertInfoService alertInfoService) {
|
||||
this.alertInfoService = alertInfoService;
|
||||
}
|
||||
|
||||
private String getDefaultName(AlertType alertType, Integer lineId, Integer rtuId) {
|
||||
return String.format("%s-%s-%s", alertType.name(), lineId, rtuId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(SwitchAndTrackLedAlertEvent event) {
|
||||
GeneratedMessageV3.Builder o = event.getSource();
|
||||
String receiveBuildType = o.getDescriptorForType().getName();
|
||||
Integer lineId = DeviceStatusDataOperate.findFieldVal(o, "lineId", Integer.class);
|
||||
String id = DeviceStatusDataOperate.findFieldVal(o, "id", String.class);
|
||||
log.info("区段光带检测 线路[{}] 设备[{}] 接受类型[{}]", lineId, id, receiveBuildType);
|
||||
/* MessageOrBuilder section;
|
||||
|
||||
// 考虑 可能 光带道岔可能会传道轨的code 也就是PT开头,先保留
|
||||
if (o instanceof Switch.Builder) {
|
||||
if (StringUtils.startsWith(id, "DG")) {
|
||||
section = LineGraphicDataRepository.getDeviceByCode(lineId, id);
|
||||
MessageOrBuilder mm = LineGraphicDataRepository.getDeviceByCode(lineId, "31");
|
||||
System.out.println(mm);
|
||||
} else {
|
||||
String sectionCode = LineGraphicDataRepository.findSectionFromLogicCode(lineId, id);
|
||||
if (StringUtils.isEmpty(sectionCode)) {
|
||||
return;
|
||||
}
|
||||
section = LineGraphicDataRepository.getDeviceByCode(lineId, sectionCode);
|
||||
}
|
||||
} else {
|
||||
section = LineGraphicDataRepository.getDeviceByCode(lineId, id);
|
||||
}*/
|
||||
|
||||
String sectionCode = LineGraphicDataRepository.findSectionFromLogicCode(lineId, id);
|
||||
if (StringUtils.isEmpty(sectionCode)) {
|
||||
return;
|
||||
}
|
||||
MessageOrBuilder section = LineGraphicDataRepository.getDeviceByCode(lineId, sectionCode);
|
||||
TrainDataSource trainDataSource = DeviceDataRepository.findDataSouce(lineId.toString(), DataTypeEnum.TRAIN);
|
||||
String trainGroupId = trainDataSource.findTrainForDeviceName(id);
|
||||
if (o instanceof Switch.Builder switchBuilder) {
|
||||
this.switchHandle(switchBuilder, trainGroupId, section);
|
||||
} else if (o instanceof Track.Builder trackBuilder) {
|
||||
this.trackHandle(trackBuilder, trainGroupId, section);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void switchHandle(Switch.Builder switchBuilder, String trainGroupId, MessageOrBuilder section) {
|
||||
boolean ledRed = switchBuilder.getIpSingleSwitchStusCiOccupied() && !switchBuilder.getIpSingleSwitchStusCbtcOccupied() && Objects.isNull(trainGroupId);
|
||||
boolean orange = switchBuilder.getIpSingleSwitchStusAtcInvalid();
|
||||
log.info("区段光带 道轨区段 线路[{}] 区段[{}] 红光带占用[{}] 橙光带占用[{}]", switchBuilder.getLineId(), switchBuilder.getId(), ledRed, orange);
|
||||
this.emit(ledRed, switchBuilder, section, AlertType.AXLE_LED_RED);
|
||||
this.emit(orange, switchBuilder, section, AlertType.AXLE_LED_ORANGE);
|
||||
}
|
||||
|
||||
private void trackHandle(Track.Builder trackBuild, String trainGroupId, MessageOrBuilder section) {
|
||||
boolean ledRed = trackBuild.getCiOccupied() && !trackBuild.getCbtcOccupied() && Objects.isNull(trainGroupId);
|
||||
boolean orange = trackBuild.getAtcInvalid();
|
||||
log.info("区段光带 区段 线路[{}] 区段[{}] 红光带占用[{}] 橙光带占用[{}]", trackBuild.getLineId(), trackBuild.getId(), ledRed, orange);
|
||||
this.emit(ledRed, trackBuild, section, AlertType.AXLE_LED_RED);
|
||||
this.emit(orange, trackBuild, section, AlertType.AXLE_LED_ORANGE);
|
||||
}
|
||||
|
||||
private void emit(boolean light, Builder build, MessageOrBuilder turnoutOrLogicSection, AlertType alertType) {
|
||||
Integer lineId = DeviceStatusDataOperate.findFieldVal(build, "lineId", Integer.class);
|
||||
Integer rtuId = DeviceStatusDataOperate.findFieldVal(build, "rtuId", Integer.class);
|
||||
String deviceCodeId = DeviceStatusDataOperate.findFieldVal(turnoutOrLogicSection, "code", String.class);
|
||||
CommonInfo commonInfo = DeviceStatusDataOperate.findFieldVal(turnoutOrLogicSection, "common", CommonInfo.class);
|
||||
Integer layoutDeviceId = commonInfo.getId();
|
||||
String ledName = alertType == AlertType.AXLE_LED_RED ? "红光带" : "橙光带";
|
||||
String ledPutName = this.getDefaultName(alertType, lineId, rtuId);
|
||||
if (light) {
|
||||
log.info("光带检测到[{}] 线路[{}] 设备[{}] 告警[{}]", ledName, lineId, deviceCodeId, alertType.name());
|
||||
if (alertManager.putAlterDevice(lineId, ledPutName, deviceCodeId)) {
|
||||
String alertMsg = String.format("出现%s设备[%s]", ledName, deviceCodeId);
|
||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(Optional.empty(), alertType, build, alertMsg, String.valueOf(layoutDeviceId), AlertDeviceType.DEVICE_TYPE_TRACK, false);
|
||||
alertManager.emit(alertInfo);
|
||||
alertManager.emit(new SwitchAndTrackLedMostAlertEvent(build, alertType, lineId, layoutDeviceId, deviceCodeId, true));
|
||||
// alertManager.emit(new SwitchAndTrackLedInterLockL2AlertEvent(build, alertType, lineId, layoutDeviceId, deviceCodeId, true, rtuId));
|
||||
// alertManager.emit(new SwitchAndTrackLedInterlockAreaAlertEvent(build, alertType, lineId, layoutDeviceId, deviceCodeId, true));
|
||||
}
|
||||
} else {
|
||||
alertManager.removeAlterDevice(lineId, ledPutName, deviceCodeId);
|
||||
alertManager.emit(new SwitchAndTrackLedMostAlertEvent(build, alertType, lineId, layoutDeviceId, deviceCodeId, false));
|
||||
// alertManager.emit(new SwitchAndTrackLedInterLockL2AlertEvent(build, alertType, lineId, layoutDeviceId, deviceCodeId, false, rtuId));
|
||||
// alertManager.emit(new SwitchAndTrackLedInterlockAreaAlertEvent(build, alertType, lineId, layoutDeviceId, deviceCodeId, false));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static class SwitchAndTrackLedAlertEvent extends DeviceAlertEvent<GeneratedMessageV3.Builder> {
|
||||
|
||||
public SwitchAndTrackLedAlertEvent(Builder source) {
|
||||
super(source);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
package club.joylink.xiannccda.ats.warn;
|
||||
|
||||
import club.joylink.xiannccda.alert.NccAlertInfo;
|
||||
import club.joylink.xiannccda.alert.core.AlertDeviceType;
|
||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||
import club.joylink.xiannccda.alert.core.AlertSourceEventListener;
|
||||
import club.joylink.xiannccda.ats.warn.AxleSwitchTrackLedMostAlertListener.SwitchAndTrackLedMostAlertEvent;
|
||||
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
||||
import club.joylink.xiannccda.dto.protos.GuardConfigProto.GuardConfig;
|
||||
import club.joylink.xiannccda.service.AlertInfoService;
|
||||
import club.joylink.xiannccda.service.config.DeviceGuardConfigService;
|
||||
import club.joylink.xiannccda.vo.AreaConfigVO;
|
||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||
import java.util.Optional;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class AxleSwitchTrackLedMostAlertListener implements AlertSourceEventListener<SwitchAndTrackLedMostAlertEvent> {
|
||||
|
||||
|
||||
private final DeviceGuardConfigService configService;
|
||||
private final AlertInfoService alertInfoService;
|
||||
private final AlertManager alertManager = AlertManager.getDefault();
|
||||
|
||||
public AxleSwitchTrackLedMostAlertListener(DeviceGuardConfigService configService, AlertInfoService alertInfoService) {
|
||||
this.configService = configService;
|
||||
this.alertInfoService = alertInfoService;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void accept(SwitchAndTrackLedMostAlertEvent event) {
|
||||
int lineId = event.lineId;
|
||||
AlertType mostType = event.alertType == AlertType.AXLE_LED_RED ? AlertType.AXLE_LED_RED_MOST : AlertType.AXLE_LED_ORANGE_MOST;
|
||||
Optional<AreaConfigVO> alertInfoMostOptional = this.alertInfoService.findAreaDevice(mostType, AlertDeviceType.DEVICE_TYPE_TRACK, event.layoutDeviceId, lineId);
|
||||
String alertInfoMostName = alertInfoMostOptional.map(AreaConfigVO::getAreaName).orElse(null);
|
||||
String newName = StringUtils.isNotEmpty(alertInfoMostName) ? String.format("%s-%s", mostType.name(), alertInfoMostName) : null;
|
||||
if (StringUtils.isEmpty(newName)) {
|
||||
log.info("线路[{}] 大面积[{}] 设备[{}] 未找到对应的区域配置", lineId, mostType.name(), event.realDeviceCodeId);
|
||||
return;
|
||||
}
|
||||
if (event.alert) {
|
||||
GuardConfig guardConfig = configService.getGuardConfig(lineId);
|
||||
int overNums = guardConfig.getRedLedMostNums();
|
||||
if (mostType == AlertType.AXLE_LED_ORANGE_MOST) {
|
||||
overNums = guardConfig.getOrangeLedMostNums();
|
||||
}
|
||||
boolean isMost = alertManager.needMostShow(lineId, newName, overNums);
|
||||
alertManager.putAlterDevice(lineId, newName, event.realDeviceCodeId);
|
||||
if (!isMost && alertManager.needMostShow(lineId, newName, overNums)) {
|
||||
String ledName = event.alertType == AlertType.AXLE_LED_RED ? "红光带" : "橙光带";
|
||||
String warnDevices = alertManager.findAllWarnDevice(lineId, newName);
|
||||
String alertMsg = String.format("%s-出现大面积%s设备[%s]", alertInfoMostOptional.get().getAreaName(), ledName, warnDevices);
|
||||
NccAlertInfo alertInfoMost = this.alertInfoService.createAlert2(alertInfoMostOptional, mostType, event.getSource(), alertMsg, null, AlertDeviceType.DEVICE_TYPE_TRACK, false);
|
||||
alertManager.emit(alertInfoMost);
|
||||
}
|
||||
} else {
|
||||
alertManager.removeAlterDevice(lineId, newName, event.realDeviceCodeId);
|
||||
}
|
||||
}
|
||||
|
||||
public static class SwitchAndTrackLedMostAlertEvent extends DeviceAlertEvent<Builder> {
|
||||
|
||||
private AlertType alertType;
|
||||
private int lineId;
|
||||
private Integer layoutDeviceId;
|
||||
private boolean alert;
|
||||
private String realDeviceCodeId;
|
||||
|
||||
public SwitchAndTrackLedMostAlertEvent(Builder source, AlertType alertType, int lineId, Integer layoutDeviceId, String realDeviceCodeId, boolean alert) {
|
||||
super(source);
|
||||
this.alertType = alertType;
|
||||
this.lineId = lineId;
|
||||
this.layoutDeviceId = layoutDeviceId;
|
||||
this.alert = alert;
|
||||
this.realDeviceCodeId = realDeviceCodeId;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,104 +0,0 @@
|
||||
package club.joylink.xiannccda.ats.warn;
|
||||
|
||||
import club.joylink.xiannccda.alert.NccAlertInfo;
|
||||
import club.joylink.xiannccda.alert.core.AlertDeviceType;
|
||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||
import club.joylink.xiannccda.alert.core.AlertSourceEventListener;
|
||||
import club.joylink.xiannccda.ats.cache.LineGraphicDataRepository;
|
||||
import club.joylink.xiannccda.ats.warn.AllLineBlueAlertListener.AllLineBlueDisplayAlertEvent;
|
||||
import club.joylink.xiannccda.ats.warn.BlueAlertListener.BlueDisplayAlertEvent;
|
||||
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu.Builder;
|
||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Station;
|
||||
import club.joylink.xiannccda.service.AlertInfoService;
|
||||
import club.joylink.xiannccda.vo.AreaConfigVO;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.google.common.base.Strings;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
//@Component
|
||||
@Slf4j
|
||||
@Deprecated
|
||||
public class BlueAlertListener implements AlertSourceEventListener<BlueDisplayAlertEvent> {
|
||||
|
||||
|
||||
@Autowired
|
||||
private AlertInfoService alertInfoService;
|
||||
protected final static String BLUE_DISPLAY_NAME = Rtu.getDescriptor().getName();
|
||||
protected final static String ALL_BLUE_DISPLAY_VAL_FLAG = "全线蓝显";
|
||||
private final static AlertManager alertManager = AlertManager.getDefault();
|
||||
|
||||
/**
|
||||
* 集中站集合
|
||||
* <p>
|
||||
* key= 线路id, val=集中站
|
||||
*/
|
||||
private final static Map<Integer, List<Station>> CONTROL_STATION_MAPER = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
@Override
|
||||
public void accept(BlueDisplayAlertEvent event) {
|
||||
Rtu.Builder rtu = event.getSource();
|
||||
Station station = findAllStation(rtu.getLineId(), rtu.getId());
|
||||
if (Objects.isNull(station)) {
|
||||
log.error("rtuId[{}] 未找到对应的集中站数据", rtu.getId());
|
||||
return;
|
||||
}
|
||||
if (rtu.getIpRtuStusDown()) {
|
||||
log.info("线路[{}] 车站[{}] rtu[{}] 通信中断", rtu.getLineId(), station.getName(), rtu.getId());
|
||||
//保存蓝显联锁id
|
||||
if (alertManager.putAlterDevice(rtu.getLineId(), BLUE_DISPLAY_NAME, rtu.getId())) {
|
||||
Optional<AreaConfigVO> alertInfoMostOptional = this.alertInfoService.findAreaDevice(AlertType.BLUE_DISPLAY, AlertDeviceType.DEVICE_TYPE_RTU, station.getCommon().getId(), rtu.getLineId());
|
||||
String alertInfoMostName = alertInfoMostOptional.map(AreaConfigVO::getAreaName).orElse(String.format("%s 集中站中断连接 ", station.getName()));
|
||||
int allControlStationSize = CONTROL_STATION_MAPER.get(rtu.getLineId()).size();
|
||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(Optional.empty(), AlertType.BLUE_DISPLAY, rtu, alertInfoMostName, String.valueOf(station.getCommon().getId()),
|
||||
AlertDeviceType.DEVICE_TYPE_RTU,
|
||||
false);
|
||||
alertManager.emit(alertInfo);
|
||||
alertManager.emit(new AllLineBlueDisplayAlertEvent(rtu, station, allControlStationSize));
|
||||
}
|
||||
} else {
|
||||
alertManager.removeAlterDevice(rtu.getLineId(), BLUE_DISPLAY_NAME, rtu.getId());
|
||||
alertManager.removeAlterDevice(rtu.getLineId(), BLUE_DISPLAY_NAME, ALL_BLUE_DISPLAY_VAL_FLAG);
|
||||
}
|
||||
}
|
||||
|
||||
private static synchronized Station findAllStation(int lineId, String rtuId) {
|
||||
if (CollectionUtils.isEmpty(CONTROL_STATION_MAPER)) {
|
||||
Stream<Station> stream = LineGraphicDataRepository.getDevices(lineId, Station.class);
|
||||
Collection<Station> stationList = stream.filter(Station::getConcentrationStations)
|
||||
.collect(Collectors.toMap(d -> d.getCommon().getId(), Function.identity(), (o1, o2) -> o2)).values();
|
||||
CONTROL_STATION_MAPER.put(lineId, new ArrayList<>(stationList));
|
||||
}
|
||||
List<Station> stationList = CONTROL_STATION_MAPER.get(lineId);
|
||||
if (CollectionUtils.isEmpty(stationList)) {
|
||||
return null;
|
||||
}
|
||||
String rtuName = Strings.padStart(rtuId, 2, '0');
|
||||
Optional<Station> optionalStation = stationList.stream().filter(d -> StringUtils.equalsIgnoreCase(d.getCode(), rtuName)).findAny();
|
||||
return optionalStation.orElse(null);
|
||||
}
|
||||
|
||||
public static class BlueDisplayAlertEvent extends DeviceAlertEvent<Rtu.Builder> {
|
||||
|
||||
public BlueDisplayAlertEvent(Builder source) {
|
||||
super(source);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package club.joylink.xiannccda.ats.warn;
|
||||
|
||||
import club.joylink.xiannccda.alert.NccAlertInfo;
|
||||
import club.joylink.xiannccda.alert.core.AlertDataSource;
|
||||
import club.joylink.xiannccda.alert.core.AlertDeviceType;
|
||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||
import club.joylink.xiannccda.alert.core.AlertMonitoringTask;
|
||||
@ -9,6 +10,7 @@ import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository;
|
||||
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
||||
import club.joylink.xiannccda.ats.message.collect.datasource.DeviceStatusData;
|
||||
import club.joylink.xiannccda.ats.message.collect.datasource.InUsedScheduleData;
|
||||
import club.joylink.xiannccda.ats.message.collect.datasource.InterLockData;
|
||||
import club.joylink.xiannccda.ats.message.line3.changer.DeviceNameChangerManage;
|
||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||
import club.joylink.xiannccda.ats.message.line3.rep.TrainRecordResponse.DirectionEnum;
|
||||
@ -52,6 +54,7 @@ public class PlatformAlertMonitoringTask implements AlertMonitoringTask {
|
||||
}
|
||||
|
||||
private final AlertManager alertManager = AlertManager.getDefault();
|
||||
private final AlertDataSource alertDataSource = AlertDataSource.getInstance();
|
||||
|
||||
private final Map<String, TrainRecord.Builder> trainRecordMap = new ConcurrentHashMap<>();
|
||||
|
||||
@ -68,8 +71,8 @@ public class PlatformAlertMonitoringTask implements AlertMonitoringTask {
|
||||
Platform.Builder platformBuild = this.parsePlatform(trainRecord, isUpWay);
|
||||
if (Objects.nonNull(platformBuild)) {
|
||||
int lineId = trainRecord.getLineId();
|
||||
alertManager.removeAlterDevice(lineId, PLATFORM_IS_OPEN, platformBuild.getId());
|
||||
alertManager.removeAlterDevice(lineId, PLATFORM_IS_CLOSE, platformBuild.getId());
|
||||
alertDataSource.removeAlterDevice(lineId, PLATFORM_IS_OPEN, platformBuild.getId());
|
||||
alertDataSource.removeAlterDevice(lineId, PLATFORM_IS_CLOSE, platformBuild.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,10 +128,10 @@ public class PlatformAlertMonitoringTask implements AlertMonitoringTask {
|
||||
platformBuild.getReceiveTime(), planBuild.getATime(),
|
||||
planBuild.getDTime(), isOpen, isClose, stayTimeSecond);
|
||||
if (!isOpen && platformBuild.getTrainberth() && platformBuild.getPsdOpen()) {
|
||||
alertManager.putAlterDevice(platformBuild.getLineId(), PLATFORM_IS_OPEN, platformBuild.getId());
|
||||
alertDataSource.putAlterDevice(platformBuild.getLineId(), PLATFORM_IS_OPEN, platformBuild.getId());
|
||||
} else if (isOpen && Objects.equals(false, platformBuild.getPsdOpen())) {
|
||||
//开门后,在阈值内关门
|
||||
alertManager.putAlterDevice(platformBuild.getLineId(), PLATFORM_IS_CLOSE, platformBuild.getId());
|
||||
alertDataSource.putAlterDevice(platformBuild.getLineId(), PLATFORM_IS_CLOSE, platformBuild.getId());
|
||||
} else if (isOpen /*&& !isClose*/ && this.timeOver(platformBuild.getReceiveTime(), (int) stayTimeSecond + guardConfig.getCanNotCloseTimes())) {
|
||||
//车辆停靠,只开门 超过等待时间+阈值时间
|
||||
this.alert(platformBuild, AlertType.PLATFORM_DOOR_CANNOT_CLOSE, PLATFORM_IS_CLOSE, isUpWay, record);
|
||||
@ -140,7 +143,7 @@ public class PlatformAlertMonitoringTask implements AlertMonitoringTask {
|
||||
|
||||
private void alert(Platform.Builder platformBuild, AlertType alertType, String customName, boolean isUpWay, TrainRecord.Builder record) {
|
||||
int lineId = platformBuild.getLineId();
|
||||
boolean alertAdd = alertManager.putAlterDevice(lineId, customName, platformBuild.getId());
|
||||
boolean alertAdd = alertDataSource.putAlterDevice(lineId, customName, platformBuild.getId());
|
||||
if (alertAdd) {
|
||||
log.info("列车开关门是否已经报警检测,线路[{}] 列车表号[{}] 列车车次号[{}] 车站id[{}] 站台门id[{}] 上下行[{}] 解析屏蔽门code[{}],接收时间[{}], 告警类型[{}] 告警名称[{}]",
|
||||
record.getLineId(), record.getTrainId(), record.getGlobalId(), record.getStationId(), record.getSideId(), isUpWay, platformBuild.getId(), platformBuild.getReceiveTime(), alertType,
|
||||
@ -185,8 +188,8 @@ public class PlatformAlertMonitoringTask implements AlertMonitoringTask {
|
||||
}
|
||||
Plan.Builder planBuild = planBuildOpt.get();
|
||||
|
||||
boolean isOpen = alertManager.deviceIsExist(lineId, PLATFORM_IS_OPEN, platformBuild.getId());
|
||||
boolean isClose = alertManager.deviceIsExist(lineId, PLATFORM_IS_CLOSE, platformBuild.getId());
|
||||
boolean isOpen = alertDataSource.deviceIsExist(lineId, PLATFORM_IS_OPEN, platformBuild.getId());
|
||||
boolean isClose = alertDataSource.deviceIsExist(lineId, PLATFORM_IS_CLOSE, platformBuild.getId());
|
||||
if (isOpen && isClose && Objects.equals(false, platformBuild.getTrainberth())) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.info(
|
||||
|
@ -1,89 +0,0 @@
|
||||
package club.joylink.xiannccda.ats.warn;
|
||||
|
||||
import club.joylink.xiannccda.alert.NccAlertInfo;
|
||||
import club.joylink.xiannccda.alert.core.AlertDeviceType;
|
||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||
import club.joylink.xiannccda.alert.core.AlertMonitoringTask;
|
||||
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository;
|
||||
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
||||
import club.joylink.xiannccda.ats.message.collect.datasource.InterLockData;
|
||||
import club.joylink.xiannccda.ats.message.collect.datasource.InterLockData.InterLockDetail;
|
||||
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
||||
import club.joylink.xiannccda.service.AlertInfoService;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class SwitchAndLedInterlockTask implements AlertMonitoringTask {
|
||||
|
||||
private final AlertManager alertManager = AlertManager.getDefault();
|
||||
private final AlertInfoService alertInfoService;
|
||||
|
||||
public SwitchAndLedInterlockTask(AlertInfoService alertInfoService) {
|
||||
this.alertInfoService = alertInfoService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return AlertType.INTERLOCK_LEVEL_ONE.name();
|
||||
}
|
||||
|
||||
private String getDefaultName(AlertType alertType, Integer lineId, Integer rtuId) {
|
||||
return String.format("%s-%s-%s", alertType.name(), lineId, rtuId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Set<String> lineCollSet = DeviceDataRepository.getAllLines();
|
||||
if (CollectionUtils.isEmpty(lineCollSet)) {
|
||||
return;
|
||||
}
|
||||
for (String lineId : lineCollSet) {
|
||||
InterLockData interLockData = DeviceDataRepository.findDataSouce(String.valueOf(lineId), DataTypeEnum.INTER_LOCK);
|
||||
Integer lineIdInt = Integer.parseInt(lineId);
|
||||
|
||||
List<String> interlockOneList = interLockData.findKeysStart(AlertType.INTERLOCK_LEVEL_ONE.name());
|
||||
for (String interlockLevel : interlockOneList) {
|
||||
Map<String, InterLockDetail> detailMap = interLockData.getDetailByInterlockKey(interlockLevel);
|
||||
for (InterLockDetail detail : detailMap.values()) {
|
||||
/*if (StringUtils.endsWith(interlockLevel, AlertDeviceType.DEVICE_TYPE_SWITCH.name())) {
|
||||
int total = this.handle2(AlertType.SWITCH_LOST, lineIdInt, detail.getRtuId());
|
||||
this.validateAlert(detail, total, AlertType.SWITCH_LOST_INTERLOCK_AREA, AlertDeviceType.DEVICE_TYPE_SWITCH, lineIdInt);
|
||||
} else*/
|
||||
if (StringUtils.endsWith(interlockLevel, AlertDeviceType.DEVICE_TYPE_TRACK.name())) {
|
||||
int redTotal = this.handle2(AlertType.AXLE_LED_RED, lineIdInt, detail.getRtuId());
|
||||
int orangeTotal = this.handle2(AlertType.AXLE_LED_ORANGE, lineIdInt, detail.getRtuId());
|
||||
this.validateAlert(detail, redTotal, AlertType.AXLE_LED_RED_INTERLOCK_AREA, AlertDeviceType.DEVICE_TYPE_TRACK, lineIdInt);
|
||||
this.validateAlert(detail, orangeTotal, AlertType.AXLE_LED_ORANGE_INTERLOCK_AREA, AlertDeviceType.DEVICE_TYPE_TRACK, lineIdInt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void validateAlert(InterLockDetail detail, int total, AlertType alertType, AlertDeviceType deviceType, Integer lineId) {
|
||||
String customName = String.format("%s-%s", alertType.name(), detail.getAreaConfigId());
|
||||
if (total >= detail.getDevices().size()) {
|
||||
if (alertManager.putAlterDevice(lineId, customName, alertType.name())) {
|
||||
NccAlertInfo alertInfoMost = this.alertInfoService.createAlert2(detail.getAreaConfigId(), alertType, lineId, LocalDateTime.now(), detail.getAreaConfigName(), null, deviceType,
|
||||
false);
|
||||
alertManager.emit(alertInfoMost);
|
||||
}
|
||||
} else {
|
||||
alertManager.removeAlterDevice(lineId, customName, alertType.name());
|
||||
}
|
||||
}
|
||||
|
||||
private int handle2(AlertType alertType, Integer lineId, Integer rtuId) {
|
||||
String name = this.getDefaultName(alertType, lineId, rtuId);
|
||||
List<String> tmpList = alertManager.findAllWarnDeviceForList(lineId, name);
|
||||
return tmpList.size();
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,114 +0,0 @@
|
||||
package club.joylink.xiannccda.ats.warn;
|
||||
|
||||
import club.joylink.xiannccda.alert.NccAlertInfo;
|
||||
import club.joylink.xiannccda.alert.core.AlertDeviceType;
|
||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||
import club.joylink.xiannccda.alert.core.AlertMonitoringTask;
|
||||
import club.joylink.xiannccda.ats.cache.LineGraphicDataRepository;
|
||||
import club.joylink.xiannccda.ats.warn.SwitchLostMostAlertListener.SwitchLostMostEvent;
|
||||
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Switch;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Switch.Builder;
|
||||
import club.joylink.xiannccda.dto.protos.GuardConfigProto.GuardConfig;
|
||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Turnout;
|
||||
import club.joylink.xiannccda.service.AlertInfoService;
|
||||
import club.joylink.xiannccda.service.config.DeviceGuardConfigService;
|
||||
import com.google.protobuf.MessageOrBuilder;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedDeque;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.ConcurrentSkipListSet;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
//@Component
|
||||
@Slf4j
|
||||
@Deprecated
|
||||
public class SwitchLostAlertMonitoringTask implements AlertMonitoringTask {
|
||||
|
||||
private DeviceGuardConfigService configService;
|
||||
|
||||
private AlertInfoService alertInfoService;
|
||||
|
||||
public SwitchLostAlertMonitoringTask(DeviceGuardConfigService configService, AlertInfoService alertInfoService) {
|
||||
|
||||
this.configService = configService;
|
||||
this.alertInfoService = alertInfoService;
|
||||
}
|
||||
|
||||
|
||||
private final AlertManager alertManager = AlertManager.getDefault();
|
||||
|
||||
private final Map<String, Switch.Builder> deviceMap = new ConcurrentHashMap<>();
|
||||
|
||||
public void putSwitchIfNotExist(Switch.Builder switchBuilder) {
|
||||
/*if (!deviceMap.containsKey(switchBuilder.getId())) {
|
||||
deviceMap.put(switchBuilder.getId(), switchBuilder);
|
||||
log.info("线路[{}] 道岔[{}] 添加到道岔失表监控中... 设备状态参数[{}]", switchBuilder.getLineId(), switchBuilder.getId(), switchBuilder.getIpSingleSwitchStusLostIndication());
|
||||
}*/
|
||||
deviceMap.put(switchBuilder.getId(), switchBuilder);
|
||||
log.info("线路[{}] 道岔[{}] 添加到道岔失表监控中... 设备状态参数[{}]", switchBuilder.getLineId(), switchBuilder.getId(), switchBuilder.getIpSingleSwitchStusLostIndication());
|
||||
}
|
||||
|
||||
public void removeSwitch(Switch.Builder switchBuilder) {
|
||||
String switchPutName = this.getDefaultName(AlertType.SWITCH_LOST, switchBuilder.getLineId(), switchBuilder.getRtuId());
|
||||
log.info("线路[{}] 道岔[{}] 从监控中移除... 设备状态参数[{}]", switchBuilder.getLineId(), switchBuilder.getId(), switchBuilder);
|
||||
deviceMap.remove(switchBuilder.getId());
|
||||
alertManager.removeAlterDevice(switchBuilder.getLineId(), switchPutName, switchBuilder.getId());
|
||||
|
||||
MessageOrBuilder turnoutBuild = LineGraphicDataRepository.getDeviceByCodeNotException(switchBuilder.getLineId(), switchBuilder.getId());
|
||||
if (Objects.nonNull(turnoutBuild) && turnoutBuild instanceof Turnout turnout) {
|
||||
//大面积失表移除
|
||||
alertManager.emit(new SwitchLostMostEvent(switchBuilder, false, turnout));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "SWITCH_LOST_ALTER";
|
||||
}
|
||||
|
||||
private String getDefaultName(AlertType alertType, Integer lineId, Integer rtuId) {
|
||||
return String.format("%s-%s-%s", alertType.name(), lineId, rtuId);
|
||||
}
|
||||
|
||||
private void checkDevice(Builder savedSwitchBuild) {
|
||||
int lineId = savedSwitchBuild.getLineId();
|
||||
Turnout turnout = LineGraphicDataRepository.getDeviceByCode(lineId, savedSwitchBuild.getId(), Turnout.class);
|
||||
GuardConfig guardConfig = configService.getGuardConfig(lineId);
|
||||
boolean saveIsLost = savedSwitchBuild.getIpSingleSwitchStusLostIndication();
|
||||
boolean timeOver = this.timeOver(savedSwitchBuild.getReceiveTime(), guardConfig.getSwitchLostTimes());
|
||||
String switchPutName = this.getDefaultName(AlertType.SWITCH_LOST, lineId, savedSwitchBuild.getRtuId());
|
||||
if (saveIsLost && timeOver) {
|
||||
log.info("道岔失表超时,准备报警 线路[{}] 设备[{}] 接受时间[{}] 发送时间[{}] 对应地图设备id[{}]"
|
||||
, lineId, savedSwitchBuild.getId(), savedSwitchBuild.getReceiveTime(), savedSwitchBuild.getTimestamp(), turnout.getCommon().getId());
|
||||
//失表超时
|
||||
if (alertManager.putAlterDevice(lineId, switchPutName, savedSwitchBuild.getId())) {
|
||||
String alertMsg = String.format("设备[%s]失表", savedSwitchBuild.getId());
|
||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(Optional.empty(), AlertType.SWITCH_LOST, savedSwitchBuild, alertMsg, String.valueOf(turnout.getCommon().getId()),
|
||||
AlertDeviceType.DEVICE_TYPE_SWITCH, false);
|
||||
alertManager.emit(alertInfo);
|
||||
alertManager.emit(new SwitchLostMostEvent(savedSwitchBuild, true, turnout));
|
||||
// alertManager.emit(new SwitchLostMostInterLockL2Event(savedSwitchBuild, true, turnout));
|
||||
}
|
||||
this.deviceMap.remove(savedSwitchBuild.getId());
|
||||
} else if (!saveIsLost) {
|
||||
this.removeSwitch(savedSwitchBuild);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (Builder savedSwitchBuild : this.deviceMap.values()) {
|
||||
// log.info("道岔失表检测 线路[{}] 设备[{}] 查找对应的地图道岔id[{}]", lineId, savedSwitchBuild.getId(), turnout.getCommon().getId());
|
||||
this.checkDevice(savedSwitchBuild);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package club.joylink.xiannccda.ats.warn;
|
||||
|
||||
import club.joylink.xiannccda.alert.NccAlertInfo;
|
||||
import club.joylink.xiannccda.alert.core.AlertDataSource;
|
||||
import club.joylink.xiannccda.alert.core.AlertDeviceType;
|
||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||
import club.joylink.xiannccda.alert.core.AlertMonitoringTask;
|
||||
@ -45,6 +46,7 @@ public class SwitchLostAlertMonitoringTask2 implements AlertMonitoringTask {
|
||||
|
||||
|
||||
private final AlertManager alertManager = AlertManager.getDefault();
|
||||
private final AlertDataSource alertDataSource = AlertDataSource.getInstance();
|
||||
|
||||
private final Map<String, Integer> deviceCodeMap = new ConcurrentHashMap<>();
|
||||
|
||||
@ -59,7 +61,7 @@ public class SwitchLostAlertMonitoringTask2 implements AlertMonitoringTask {
|
||||
String switchPutName = this.getDefaultName(AlertType.SWITCH_LOST, switchBuilder.getLineId(), switchBuilder.getRtuId());
|
||||
log.info("线路[{}] 道岔[{}] 从监控中移除... 设备状态参数[{}]", switchBuilder.getLineId(), switchBuilder.getId(), switchBuilder);
|
||||
deviceCodeMap.remove(switchBuilder.getId());
|
||||
alertManager.removeAlterDevice(switchBuilder.getLineId(), switchPutName, switchBuilder.getId());
|
||||
alertDataSource.removeAlterDevice(switchBuilder.getLineId(), switchPutName, switchBuilder.getId());
|
||||
|
||||
Optional<Turnout> turnoutOpt = LineGraphicDataRepository.getDeviceOptByCode(switchBuilder.getLineId(), switchBuilder.getId(), Turnout.class);
|
||||
Turnout turnout = turnoutOpt.orElse(null);
|
||||
@ -103,7 +105,7 @@ public class SwitchLostAlertMonitoringTask2 implements AlertMonitoringTask {
|
||||
String switchPutName = this.getDefaultName(AlertType.SWITCH_LOST, lineId, switchBuild.getRtuId());
|
||||
if (saveIsLost && timeOver) {
|
||||
//失表超时
|
||||
if (alertManager.putAlterDevice(lineId, switchPutName, switchBuild.getId())) {
|
||||
if (alertDataSource.putAlterDevice(lineId, switchPutName, switchBuild.getId())) {
|
||||
log.info("道岔失表超时,准备报警 线路[{}] 设备[{}] 接受时间[{}] 发送时间[{}] 对应地图设备id[{}]"
|
||||
, lineId, switchBuild.getId(), switchBuild.getReceiveTime(), switchBuild.getTimestamp(), turnout.getCommon().getId());
|
||||
String alertMsg = String.format("设备[%s]失表", switchBuild.getId());
|
||||
|
@ -1,6 +1,7 @@
|
||||
package club.joylink.xiannccda.ats.warn;
|
||||
|
||||
import club.joylink.xiannccda.alert.NccAlertInfo;
|
||||
import club.joylink.xiannccda.alert.core.AlertDataSource;
|
||||
import club.joylink.xiannccda.alert.core.AlertDeviceType;
|
||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||
import club.joylink.xiannccda.alert.core.AlertSourceEventListener;
|
||||
@ -35,6 +36,7 @@ public class SwitchLostMostAlertListener implements AlertSourceEventListener<Swi
|
||||
}
|
||||
|
||||
private final AlertManager alertManager = AlertManager.getDefault();
|
||||
private final AlertDataSource alertDataSource = AlertDataSource.getInstance();
|
||||
|
||||
private List<Integer> findDeviceIdFormCode(Integer lineId, List<String> deviceCodes) {
|
||||
List<Integer> list = Lists.newArrayList();
|
||||
@ -62,18 +64,18 @@ public class SwitchLostMostAlertListener implements AlertSourceEventListener<Swi
|
||||
}
|
||||
if (event.alert) {
|
||||
//检测大面积失表
|
||||
boolean isMost = alertManager.needMostShow(lineId, mostName, guardConfig.getSwitchLostMostNums());
|
||||
alertManager.putAlterDevice(lineId, mostName, switchBuild.getId());
|
||||
if (!isMost && alertManager.needMostShow(lineId, mostName, guardConfig.getSwitchLostMostNums())) {
|
||||
String warnDevices = alertManager.findAllWarnDevice(lineId, mostName);
|
||||
this.findDeviceIdFormCode(lineId, alertManager.findAllWarnDeviceForList(lineId, mostName));
|
||||
boolean isMost = alertDataSource.needMostShow(lineId, mostName, guardConfig.getSwitchLostMostNums());
|
||||
alertDataSource.putAlterDevice(lineId, mostName, switchBuild.getId());
|
||||
if (!isMost && alertDataSource.needMostShow(lineId, mostName, guardConfig.getSwitchLostMostNums())) {
|
||||
String warnDevices = alertDataSource.findAllWarnDevice(lineId, mostName);
|
||||
this.findDeviceIdFormCode(lineId, alertDataSource.findAllWarnDeviceForList(lineId, mostName));
|
||||
String alertMsg = String.format("%s-大面积失表设备[%s]", mostName, warnDevices);
|
||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(alertInfoMostOpt, AlertType.SWITCH_LOST_MOST, switchBuild, alertMsg, warnDevices,
|
||||
AlertDeviceType.DEVICE_TYPE_SWITCH, false);
|
||||
alertManager.emit(alertInfo);
|
||||
}
|
||||
} else {
|
||||
alertManager.removeAlterDevice(lineId, mostName, switchBuild.getId());
|
||||
alertDataSource.removeAlterDevice(lineId, mostName, switchBuild.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package club.joylink.xiannccda.ats.warn;
|
||||
|
||||
import club.joylink.xiannccda.alert.NccAlertInfo;
|
||||
import club.joylink.xiannccda.alert.core.AlertDataSource;
|
||||
import club.joylink.xiannccda.alert.core.AlertDeviceType;
|
||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||
import club.joylink.xiannccda.alert.core.AlertMonitoringTask;
|
||||
@ -36,7 +37,7 @@ public class TrainAtpCutAlertMonitoringTask implements AlertMonitoringTask {
|
||||
}
|
||||
|
||||
private final AlertManager alertManager = AlertManager.getDefault();
|
||||
|
||||
private final AlertDataSource alertDataSource = AlertDataSource.getInstance();
|
||||
private final Map<String, TrainInfo.Builder> trainInfoMap = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
@ -69,7 +70,7 @@ public class TrainAtpCutAlertMonitoringTask implements AlertMonitoringTask {
|
||||
public void recoverAtpCut(TrainInfo.Builder train) {
|
||||
if (trainInfoMap.containsKey(train.getGroupId())) {
|
||||
//之前发生过紧制
|
||||
boolean exist = alertManager.deviceIsExist(train.getLineId(), this.getName(), train.getGroupId());
|
||||
boolean exist = alertDataSource.deviceIsExist(train.getLineId(), this.getName(), train.getGroupId());
|
||||
if (exist) {
|
||||
//判断之前是否发生过atp切除
|
||||
this.removeTrainInfo(train.getLineId(), train.getGroupId());
|
||||
@ -85,7 +86,7 @@ public class TrainAtpCutAlertMonitoringTask implements AlertMonitoringTask {
|
||||
|
||||
private void removeTrainInfo(int lineId, String trainGroupId) {
|
||||
this.trainInfoMap.remove(trainGroupId);
|
||||
alertManager.removeAlterDevice(lineId, this.getName(), trainGroupId);
|
||||
alertDataSource.removeAlterDevice(lineId, this.getName(), trainGroupId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -103,7 +104,7 @@ public class TrainAtpCutAlertMonitoringTask implements AlertMonitoringTask {
|
||||
CommonInfo commonInfo = DeviceStatusDataOperate.findFieldVal(turnoutOrLogicSection, "common", CommonInfo.class);
|
||||
String deviceCode = DeviceStatusDataOperate.findFieldVal(turnoutOrLogicSection, "code", String.class);
|
||||
Integer layoutDeviceId = commonInfo.getId();
|
||||
if (alertManager.putAlterDevice(trainInfo.getLineId(), this.getName(), trainInfo.getGroupId())) {
|
||||
if (alertDataSource.putAlterDevice(trainInfo.getLineId(), this.getName(), trainInfo.getGroupId())) {
|
||||
log.info("列车紧制ATP检测告警 线路[{}] 列车车组号[{}] 所在设备[{}]", trainInfo.getLineId(), trainInfo.getGroupId(), trainInfo.getDevName());
|
||||
String alertMsg = String.format("列车[%s] 紧制导致ATP切除所在区段[%s]", trainInfo.getGroupId(), deviceCode);
|
||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert(AlertType.TRAIN_EB_ATP, AlertDeviceType.DEVICE_TYPE_TRACK, layoutDeviceId, trainInfo, alertMsg,
|
||||
|
@ -1,14 +1,10 @@
|
||||
package club.joylink.xiannccda.ats.warn;
|
||||
|
||||
import club.joylink.xiannccda.alert.core.AlertSourceEventListener;
|
||||
import club.joylink.xiannccda.ats.message.line3.changer.DeviceNameChangerManage;
|
||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||
import club.joylink.xiannccda.ats.message.line3.rep.TrainRecordResponse.DirectionEnum;
|
||||
import club.joylink.xiannccda.ats.message.line3.rep.TrainRecordResponse.TrainTypeEnum;
|
||||
import club.joylink.xiannccda.ats.warn.TrainReacrdAlertListener.TrainRecordAlertEvent;
|
||||
import club.joylink.xiannccda.configuration.pros.OccNotHandlePros;
|
||||
import club.joylink.xiannccda.dto.protos.TrainProto.TrainRecord;
|
||||
import java.util.Objects;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -0,0 +1,200 @@
|
||||
package club.joylink.xiannccda.ats.warn.axle;
|
||||
|
||||
import club.joylink.xiannccda.alert.NccAlertInfo;
|
||||
import club.joylink.xiannccda.alert.core.AlertDataSource;
|
||||
import club.joylink.xiannccda.alert.core.AlertDeviceType;
|
||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||
import club.joylink.xiannccda.alert.core.AlertMonitoringTask;
|
||||
import club.joylink.xiannccda.ats.cache.LineGraphicDataRepository;
|
||||
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository;
|
||||
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
||||
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataOperate;
|
||||
import club.joylink.xiannccda.ats.message.collect.datasource.DeviceStatusData;
|
||||
import club.joylink.xiannccda.ats.message.collect.datasource.InterLockData;
|
||||
import club.joylink.xiannccda.ats.message.collect.datasource.InterLockData.InterLockDetail;
|
||||
import club.joylink.xiannccda.ats.message.collect.datasource.TrainDataSource;
|
||||
import club.joylink.xiannccda.ats.warn.axle.event.LedMostEvent;
|
||||
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Switch;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Track;
|
||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Section;
|
||||
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.StringUtils;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.protobuf.MessageOrBuilder;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class AxleLedInterlockTask implements AlertMonitoringTask {
|
||||
|
||||
private final AlertInfoService alertInfoService;
|
||||
|
||||
public AxleLedInterlockTask(AlertInfoService alertInfoService) {
|
||||
this.alertInfoService = alertInfoService;
|
||||
}
|
||||
|
||||
private final AlertManager alertManager = AlertManager.getDefault();
|
||||
private final AlertDataSource alertDataSource = AlertDataSource.getInstance();
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return AlertType.INTERLOCK_LEVEL_ONE.name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Set<String> lineCollSet = DeviceDataRepository.getAllLines();
|
||||
if (CollectionUtils.isEmpty(lineCollSet)) {
|
||||
return;
|
||||
}
|
||||
for (String lineId : lineCollSet) {
|
||||
InterLockData interLockData = DeviceDataRepository.findDataSouce(lineId, DataTypeEnum.INTER_LOCK);
|
||||
List<String> interlockOneList = interLockData.findKeysStart(AlertType.INTERLOCK_LEVEL_ONE.name());
|
||||
for (String lockLevel : interlockOneList) {
|
||||
if (StringUtils.endsWith(lockLevel, AlertDeviceType.DEVICE_TYPE_TRACK.name())) {
|
||||
Map<String, InterLockDetail> detailMap = interLockData.getDetailByInterlockKey(lockLevel);
|
||||
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);
|
||||
|
||||
redOpt.ifPresent(axleInterLockSource -> this.alertManager.emit(new LedMostEvent(axleInterLockSource)));
|
||||
orangeOpt.ifPresent(axleInterLockSource -> this.alertManager.emit(new LedMostEvent(axleInterLockSource)));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Optional<AxleInterLockSource> handle(String lineId, InterLockDetail detail, AlertType alertType, String rtuIdJoinStr) {
|
||||
int deviceCount = detail.getDevices().size();
|
||||
Integer lineIdInt = Integer.parseInt(lineId);
|
||||
//收集联锁下的所有所有区段设备
|
||||
List<TrackOccupiedStatus> resultList = this.collectorLedWarDevices(alertType, lineId, detail.getDevices());
|
||||
int occupidedSzie = (int) resultList.stream().filter(d -> d.occupied).count();
|
||||
String customName = String.format("%s-%s", alertType.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,
|
||||
AlertDeviceType.DEVICE_TYPE_TRACK,
|
||||
false);
|
||||
alertManager.emit(alertInfoMost);
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
alertDataSource.removeAlterDevice(lineIdInt, customName, alertType.name());
|
||||
if (CollectionUtils.isNotEmpty(resultList)) {
|
||||
//大面积或单个告警
|
||||
AxleInterLockSource source = new AxleInterLockSource(lineId, rtuIdJoinStr, resultList, alertType);
|
||||
return Optional.of(source);
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
private List<TrackOccupiedStatus> collectorLedWarDevices(AlertType alertType, String lineId, List<Integer> deviceLayoutIds) {
|
||||
Integer lineIdInt = Integer.parseInt(lineId);
|
||||
DeviceStatusData deviceStatusData = DeviceDataRepository.findDataSouce(lineId, DataTypeEnum.DEVICE);
|
||||
TrainDataSource trainDataSource = DeviceDataRepository.findDataSouce(lineId, DataTypeEnum.TRAIN);
|
||||
List<TrackOccupiedStatus> warnResultList = Lists.newArrayList();
|
||||
for (Integer deviceLayoutId : deviceLayoutIds) {
|
||||
MessageOrBuilder mb = LineGraphicDataRepository.getDeviceByCode(lineIdInt, deviceLayoutId.toString());
|
||||
if (mb instanceof Section section) {
|
||||
boolean result = this.checkTrackOccupiedStatus(alertType, section, lineIdInt, deviceStatusData, trainDataSource);
|
||||
warnResultList.add(new TrackOccupiedStatus(section.getCode(), result, section.getCommon().getId()));
|
||||
}
|
||||
}
|
||||
return warnResultList;
|
||||
}
|
||||
|
||||
private boolean checkTrackOccupiedStatus(AlertType alertType, Section section, Integer lineId, DeviceStatusData deviceStatusData, TrainDataSource trainDataSource) {
|
||||
List<Boolean> alertList = Lists.newArrayList();
|
||||
if (section.getSectionType() == SectionType.Physical) {
|
||||
for (Integer childId : section.getChildrenList()) {
|
||||
MessageOrBuilder childMB = LineGraphicDataRepository.getDeviceByCode(lineId, childId.toString());
|
||||
String deviceCode = DeviceStatusDataOperate.findFieldVal(childMB, "code", String.class);
|
||||
MessageOrBuilder deviceStatus = deviceStatusData.getDeviceBuild(Track.getDescriptor().getName(), deviceCode);
|
||||
String trainGroupId = trainDataSource.findTrainForDeviceName(deviceCode);
|
||||
if (StringUtils.isNotEmpty(trainGroupId)) {
|
||||
//TODO 车辆占用区段
|
||||
return false;
|
||||
}
|
||||
if (deviceStatus instanceof Track.Builder track) {
|
||||
if (alertType == AlertType.AXLE_LED_RED) {
|
||||
boolean red = track.getCiOccupied() && !track.getCbtcOccupied();
|
||||
alertList.add(red);
|
||||
} else {
|
||||
boolean orange = track.getAtcInvalid();
|
||||
alertList.add(orange);
|
||||
}
|
||||
}
|
||||
}
|
||||
} 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)) {
|
||||
return false;
|
||||
}
|
||||
return alertList.stream().allMatch(d -> d);
|
||||
}
|
||||
|
||||
|
||||
@Getter
|
||||
public static class AxleInterLockSource {
|
||||
|
||||
String lineId;
|
||||
String rtuIdStr;
|
||||
List<TrackOccupiedStatus> deviceCodes;
|
||||
AlertType alertType;
|
||||
|
||||
public AxleInterLockSource(String lineId, String rtuIdStr, List<TrackOccupiedStatus> deviceCodes, AlertType alertType) {
|
||||
this.lineId = lineId;
|
||||
this.rtuIdStr = rtuIdStr;
|
||||
this.deviceCodes = deviceCodes;
|
||||
this.alertType = alertType;
|
||||
}
|
||||
}
|
||||
|
||||
public static class TrackOccupiedStatus {
|
||||
|
||||
String deviceCode;
|
||||
Boolean occupied;
|
||||
Integer layoutId;
|
||||
boolean saveAlertDataSouce;
|
||||
|
||||
public TrackOccupiedStatus(String deviceCode, Boolean occupied, Integer layoutId) {
|
||||
this.deviceCode = deviceCode;
|
||||
this.occupied = occupied;
|
||||
this.layoutId = layoutId;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,129 @@
|
||||
package club.joylink.xiannccda.ats.warn.axle;
|
||||
|
||||
import club.joylink.xiannccda.alert.NccAlertInfo;
|
||||
import club.joylink.xiannccda.alert.core.AlertDataSource;
|
||||
import club.joylink.xiannccda.alert.core.AlertDeviceType;
|
||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||
import club.joylink.xiannccda.alert.core.AlertSourceEventListener;
|
||||
import club.joylink.xiannccda.alert.core.relieve.RelieveFilterManager;
|
||||
import club.joylink.xiannccda.ats.warn.axle.AxleLedInterlockTask.AxleInterLockSource;
|
||||
import club.joylink.xiannccda.ats.warn.axle.AxleLedInterlockTask.TrackOccupiedStatus;
|
||||
import club.joylink.xiannccda.ats.warn.axle.event.LedMostEvent;
|
||||
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
||||
import club.joylink.xiannccda.dto.protos.GuardConfigProto.GuardConfig;
|
||||
import club.joylink.xiannccda.service.AlertInfoService;
|
||||
import club.joylink.xiannccda.service.config.DeviceGuardConfigService;
|
||||
import club.joylink.xiannccda.vo.AreaConfigVO;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class AxleLedMostMonitorListener implements AlertSourceEventListener<LedMostEvent> {
|
||||
|
||||
private final DeviceGuardConfigService configService;
|
||||
private final AlertInfoService alertInfoService;
|
||||
private final RelieveFilterManager relieveFilterManager;
|
||||
|
||||
|
||||
public AxleLedMostMonitorListener(DeviceGuardConfigService configService, AlertInfoService alertInfoService, RelieveFilterManager relieveFilterManager) {
|
||||
this.configService = configService;
|
||||
this.alertInfoService = alertInfoService;
|
||||
this.relieveFilterManager = relieveFilterManager;
|
||||
}
|
||||
|
||||
private final AlertManager alertManager = AlertManager.getDefault();
|
||||
private final AlertDataSource alertDataSource = AlertDataSource.getInstance();
|
||||
|
||||
private String getAlertName(AlertType mostType, String areaName) {
|
||||
return String.format("%s-%s", mostType.name(), areaName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(LedMostEvent event) {
|
||||
AxleInterLockSource lockSource = event.getSource();
|
||||
Integer lineIdInt = Integer.parseInt(lockSource.getLineId());
|
||||
GuardConfig guardConfig = this.configService.getGuardConfig(lineIdInt);
|
||||
|
||||
AlertType mostType = lockSource.getAlertType() == AlertType.AXLE_LED_RED ? AlertType.AXLE_LED_RED_MOST : AlertType.AXLE_LED_ORANGE_MOST;
|
||||
int ledThreshold = mostType == AlertType.AXLE_LED_RED_MOST ? guardConfig.getRedLedMostNums() : guardConfig.getOrangeLedMostNums();
|
||||
|
||||
this.removeAlert(lineIdInt, lockSource.getDeviceCodes(), mostType);
|
||||
//查找大面下的所有区段设备(包含不在任何大面积的计轴区段,key为null)
|
||||
Map<AreaConfigVO, List<TrackOccupiedStatus>> areaDataListMap = this.findOccupiedData(lineIdInt, mostType, lockSource.deviceCodes);
|
||||
for (Entry<AreaConfigVO, List<TrackOccupiedStatus>> occupiedEntry : areaDataListMap.entrySet()) {
|
||||
AreaConfigVO areaConfigVO = occupiedEntry.getKey();
|
||||
String customName = this.getAlertName(mostType, Objects.nonNull(areaConfigVO) ? areaConfigVO.getAreaName() : "");
|
||||
List<TrackOccupiedStatus> deviceStatusList = occupiedEntry.getValue();
|
||||
for (TrackOccupiedStatus device : occupiedEntry.getValue()) {
|
||||
device.saveAlertDataSouce = alertDataSource.putAlterDevice(lineIdInt, customName, device.deviceCode);
|
||||
// if (Objects.equals(device.saveAlertDataSouce, false)) {
|
||||
// alertDataSource.removeAlterDevice(lineIdInt, customName, device.deviceCode);
|
||||
// }
|
||||
}
|
||||
String ledName = lockSource.alertType == AlertType.AXLE_LED_RED ? "红光带" : "橙光带";
|
||||
List<String> warnDeviceList = alertDataSource.findAllWarnDeviceForList(lineIdInt, customName);
|
||||
if (Objects.nonNull(areaConfigVO) && deviceStatusList.stream().anyMatch(d -> d.saveAlertDataSouce) && warnDeviceList.size() >= ledThreshold) {
|
||||
//发布大面积
|
||||
String warnDevices = String.join(",", warnDeviceList);
|
||||
String alertMsg = String.format("%s-出现大面积%s设备[%s]", areaConfigVO.getAreaName(), ledName, warnDevices);
|
||||
NccAlertInfo alertInfoMost = this.alertInfoService.createAlert2(areaConfigVO.getId(), mostType, lineIdInt, LocalDateTime.now(), alertMsg, null, AlertDeviceType.DEVICE_TYPE_TRACK, false);
|
||||
alertManager.emit(alertInfoMost);
|
||||
} else {
|
||||
deviceStatusList.stream().filter(d -> d.saveAlertDataSouce).forEach(d -> {
|
||||
String alertMsg = String.format("出现%s设备[%s]", ledName, d.deviceCode);
|
||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(null, lockSource.alertType, lineIdInt, LocalDateTime.now(), alertMsg, String.valueOf(d.layoutId),
|
||||
AlertDeviceType.DEVICE_TYPE_TRACK, false);
|
||||
alertManager.emit(alertInfo);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Map<AreaConfigVO, List<TrackOccupiedStatus>> findOccupiedData(Integer lineId, AlertType alertType, List<TrackOccupiedStatus> statusList) {
|
||||
Map<AreaConfigVO, List<TrackOccupiedStatus>> resultMap = Maps.newHashMap();
|
||||
List<TrackOccupiedStatus> occupiedDeviceList = this.findOccupiedData(statusList, true);
|
||||
List<AreaConfigVO> areaConfigVOS = this.alertInfoService.findDevice2(alertType, AlertDeviceType.DEVICE_TYPE_TRACK, lineId);
|
||||
Object[] allDeviceLayIdList = areaConfigVOS.stream().flatMap(d -> Arrays.stream(d.getDatas())).sorted().toArray();
|
||||
resultMap.computeIfAbsent(null, k -> Lists.newArrayList());//初始化没有在任何大面设备
|
||||
|
||||
for (TrackOccupiedStatus occupiedDevice : occupiedDeviceList) {
|
||||
AlertType newType = alertType == AlertType.AXLE_LED_RED_MOST ? AlertType.AXLE_LED_RED : AlertType.AXLE_LED_ORANGE;
|
||||
if (!this.relieveFilterManager.relieveAlertMatch(lineId, AlertDeviceType.DEVICE_TYPE_TRACK, newType, occupiedDevice.layoutId)) {
|
||||
if (Arrays.binarySearch(allDeviceLayIdList, occupiedDevice.layoutId) >= 0) {
|
||||
for (AreaConfigVO areaConfigVO : areaConfigVOS) {
|
||||
List<TrackOccupiedStatus> valList = resultMap.computeIfAbsent(areaConfigVO, k -> Lists.newArrayList());
|
||||
if (areaConfigVO.findDataIndex(occupiedDevice.layoutId) >= 0) {
|
||||
valList.add(occupiedDevice);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//不属于任何大面的设备
|
||||
resultMap.get(null).add(occupiedDevice);
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
private List<TrackOccupiedStatus> findOccupiedData(List<TrackOccupiedStatus> statusList, boolean occupied2) {
|
||||
return statusList.stream().filter(d -> d.occupied == occupied2).toList();
|
||||
}
|
||||
|
||||
private void removeAlert(Integer lineIdInt, List<TrackOccupiedStatus> statusList, AlertType signleType) {
|
||||
List<TrackOccupiedStatus> notOccupiedCodes = this.findOccupiedData(statusList, false);
|
||||
for (TrackOccupiedStatus notOccupiedCode : notOccupiedCodes) {
|
||||
|
||||
alertDataSource.removeAlertDevicePrefixName(lineIdInt, signleType.name(), notOccupiedCode.deviceCode);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package club.joylink.xiannccda.ats.warn.axle.event;
|
||||
|
||||
import club.joylink.xiannccda.ats.warn.DeviceAlertEvent;
|
||||
import club.joylink.xiannccda.ats.warn.axle.AxleLedInterlockTask.AxleInterLockSource;
|
||||
|
||||
public class LedMostEvent extends DeviceAlertEvent<AxleInterLockSource> {
|
||||
|
||||
public LedMostEvent(AxleInterLockSource newSource) {
|
||||
super(newSource);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package club.joylink.xiannccda.ats.warn;
|
||||
package club.joylink.xiannccda.ats.warn.bule;
|
||||
|
||||
import club.joylink.xiannccda.alert.NccAlertInfo;
|
||||
import club.joylink.xiannccda.alert.core.AlertDataSource;
|
||||
import club.joylink.xiannccda.alert.core.AlertDeviceType;
|
||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||
import club.joylink.xiannccda.alert.core.AlertMonitoringTask;
|
||||
@ -14,14 +15,11 @@ import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu;
|
||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto;
|
||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Station;
|
||||
import club.joylink.xiannccda.service.AlertInfoService;
|
||||
import club.joylink.xiannccda.service.config.DeviceGuardConfigService;
|
||||
import club.joylink.xiannccda.vo.AreaConfigVO;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.protobuf.GeneratedMessageV3;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@ -29,13 +27,9 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@ -51,6 +45,7 @@ public class BuleDisplayMonitoringTask implements AlertMonitoringTask {
|
||||
|
||||
private final AlertManager alertManager = AlertManager.getDefault();
|
||||
|
||||
private final AlertDataSource alertDataSource = AlertDataSource.getInstance();
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
@ -95,7 +90,7 @@ public class BuleDisplayMonitoringTask implements AlertMonitoringTask {
|
||||
int interLockCount = rtuVOMapList.keySet().size();
|
||||
List<Boolean> allShutdownList = rtuVOMapList.values().stream().map(Collection::stream).map(ls -> ls.anyMatch(r -> Objects.nonNull(r.rtu) && r.rtu.getIpRtuStusDown())).toList();
|
||||
if (allShutdownList.size() == interLockCount && allShutdownList.stream().allMatch(d -> d)) {
|
||||
if (alertManager.putAlterDevice(lineId, ALL_BULE_DISPLAY_NAME, "All")) {
|
||||
if (alertDataSource.putAlterDevice(lineId, ALL_BULE_DISPLAY_NAME, "All")) {
|
||||
|
||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(null, AlertType.ALL_LINE_BLUE_DISPLAY, lineId, LocalDateTime.now(), "全线蓝线", null,
|
||||
AlertDeviceType.DEVICE_TYPE_RTU, false);
|
||||
@ -106,7 +101,7 @@ public class BuleDisplayMonitoringTask implements AlertMonitoringTask {
|
||||
Optional<RtuWarnVO> rwVO = rwvVOist.stream().filter(d -> Objects.nonNull(d.rtu) && d.rtu.getIpRtuStusDown()).findAny();
|
||||
if (rwVO.isPresent()) {
|
||||
RtuWarnVO rtuVO = rwVO.get();
|
||||
if (alertManager.putAlterDevice(lineId, this.getName(), rtuVO.areaConfigVO.getAreaName())) {
|
||||
if (alertDataSource.putAlterDevice(lineId, this.getName(), rtuVO.areaConfigVO.getAreaName())) {
|
||||
String alertInfoMostName = rtuVO.areaConfigVO.getAreaName();
|
||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(rtuVO.areaConfigVO.getId(), AlertType.BLUE_DISPLAY, rtuVO.rtu, alertInfoMostName,
|
||||
rtuVO.station.getCommon().getId(),
|
||||
@ -114,8 +109,8 @@ public class BuleDisplayMonitoringTask implements AlertMonitoringTask {
|
||||
alertManager.emit(alertInfo);
|
||||
}
|
||||
} else {
|
||||
alertManager.removeAlterDevice(lineId, this.getName(), rwvVOist.get(0).areaConfigVO.getAreaName());
|
||||
alertManager.removeAlterDevice(lineId, ALL_BULE_DISPLAY_NAME, "All");
|
||||
alertDataSource.removeAlterDevice(lineId, this.getName(), rwvVOist.get(0).areaConfigVO.getAreaName());
|
||||
alertDataSource.removeAlterDevice(lineId, ALL_BULE_DISPLAY_NAME, "All");
|
||||
}
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ package club.joylink.xiannccda.service;
|
||||
|
||||
import club.joylink.xiannccda.alert.AlertDetailFactory;
|
||||
import club.joylink.xiannccda.alert.NccAlertInfo;
|
||||
import club.joylink.xiannccda.alert.core.AlertDataSource;
|
||||
import club.joylink.xiannccda.alert.core.AlertDeviceType;
|
||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||
import club.joylink.xiannccda.ats.cache.LineGraphicDataRepository;
|
||||
@ -90,8 +91,9 @@ public class AlertMockService {
|
||||
trainData.clear();
|
||||
AbstractData planData = DeviceDataRepository.findDataSouce(lineId.toString(), DataTypeEnum.TRAIN_PLAN);
|
||||
planData.clear();
|
||||
AlertManager alertManager = AlertManager.getDefault();
|
||||
alertManager.clearAlertDataMsg(lineId);
|
||||
|
||||
AlertDataSource dataSource = AlertDataSource.getInstance();
|
||||
dataSource.clearAlertDataMsg(lineId);
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,7 +44,7 @@ public class DeviceAreaConfigService {
|
||||
@Autowired
|
||||
private DeviceAreaConfigRepository deviceAreaConfigRepository;
|
||||
|
||||
private final static Cache<Integer, Map<AlertDeviceType, List<AreaConfigVO>>> AREA_CONFIG_CACHE = CacheBuilder.newBuilder().expireAfterWrite(5 * 60, TimeUnit.MINUTES).build();
|
||||
private final static Cache<Integer, Map<AlertDeviceType, List<AreaConfigVO>>> AREA_CONFIG_CACHE = CacheBuilder.newBuilder().build();
|
||||
|
||||
public List<AreaConfigVO> getCache(int lineId, AlertDeviceType dt) {
|
||||
try {
|
||||
|
@ -26,7 +26,7 @@ public class DeviceGuardConfigService {
|
||||
@Autowired
|
||||
private IDeviceGuardConfigRepository configRepository;
|
||||
|
||||
private final static Cache<Integer, GuardConfig> GUARD_CONFIG_CACHE = CacheBuilder.newBuilder().expireAfterWrite(10 * 60, TimeUnit.MINUTES).build();
|
||||
private final static Cache<Integer, GuardConfig> GUARD_CONFIG_CACHE = CacheBuilder.newBuilder().build();
|
||||
|
||||
public GuardConfig getGuardConfig(int lineId) {
|
||||
try {
|
||||
|
@ -8,6 +8,7 @@ import com.google.common.base.Splitter;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collector;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.Data;
|
||||
@ -38,6 +39,22 @@ public class AreaConfigVO {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
AreaConfigVO configVO = (AreaConfigVO) o;
|
||||
return Objects.equals(id, configVO.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id);
|
||||
}
|
||||
|
||||
private Long id;
|
||||
private Integer[] datas;
|
||||
|
@ -5,22 +5,17 @@ import club.joylink.xiannccda.ats.message.line3.device.DeviceStatus;
|
||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceStatus.SWITCH;
|
||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceStatus.TRACK;
|
||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceStatus.TRAIN_MODE;
|
||||
import club.joylink.xiannccda.ats.warn.BuleDisplayMonitoringTask.RtuWarnVO;
|
||||
import club.joylink.xiannccda.ats.warn.bule.BuleDisplayMonitoringTask.RtuWarnVO;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Platform;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu;
|
||||
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo;
|
||||
import club.joylink.xiannccda.vo.AreaConfigVO;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mysql.cj.x.protobuf.MysqlxDatatypes;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.sql.SQLOutput;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
Loading…
Reference in New Issue
Block a user