新的proto id变更
This commit is contained in:
parent
cf75ce5f89
commit
01b440646b
@ -119,7 +119,7 @@ public class AlertDetailFactory {
|
||||
|
||||
private String getPlatformDesc(int lineId, Platform platform) {
|
||||
Station station = LineGraphicDataRepository.getDeviceByCode(lineId,
|
||||
platform.getRefStation(), Station.class);
|
||||
String.valueOf(platform.getRefStation()), Station.class);
|
||||
return String.format("[%s][%s行站台]", station.getName(), platform.getUp() ? "上" : "下");
|
||||
}
|
||||
|
||||
|
@ -29,9 +29,9 @@ public class RelieveFilterManager implements ApplicationRunner {
|
||||
* @param deviceLayoutId
|
||||
* @return true = 解除告警,false = 需要告警
|
||||
*/
|
||||
public boolean relieveAlertMatch(Integer lineId, AlertDeviceType deviceType, AlertType alertType, String deviceLayoutId) {
|
||||
public boolean relieveAlertMatch(Integer lineId, AlertDeviceType deviceType, AlertType alertType, Integer deviceLayoutId) {
|
||||
for (RelieveFilter filter : RELIEVE_FILTER_LIST) {
|
||||
MatcherResult result = filter.isMatch(lineId, deviceType, alertType, deviceLayoutId);
|
||||
MatcherResult result = filter.isMatch(lineId, deviceType, alertType, deviceLayoutId.toString());
|
||||
if (result.nextFilter) {
|
||||
if (Objects.equals(false, result.result)) {
|
||||
return false;
|
||||
|
@ -15,10 +15,7 @@ import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Section.SectionType
|
||||
import club.joylink.xiannccda.entity.PublishedGi;
|
||||
import club.joylink.xiannccda.exception.BusinessExceptionAssertEnum;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBasedTable;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Table;
|
||||
import com.google.protobuf.Descriptors.FieldDescriptor;
|
||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||
@ -42,9 +39,13 @@ import org.apache.commons.lang3.StringUtils;
|
||||
public class LineGraphicDataRepository {
|
||||
|
||||
/**
|
||||
* 线路数据信息
|
||||
* 线路数据信息 k1 = 线路id
|
||||
* <p>
|
||||
* k2 = 设备类型
|
||||
* <p>
|
||||
* k3 = 设备图中的id
|
||||
*/
|
||||
private static final Map<Integer, Map<String, Map<String, Builder>>> lineGraphMap =
|
||||
private static final Map<Integer, Map<String, Map<Integer, Builder>>> lineGraphMap =
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
@ -54,7 +55,7 @@ public class LineGraphicDataRepository {
|
||||
new HashMap<>();
|
||||
|
||||
/**
|
||||
* 线路-设备code-设备
|
||||
* 线路-设备code(包含设备id)-设备
|
||||
*/
|
||||
private static final HashBasedTable<Integer, String, MessageOrBuilder> line_code_table =
|
||||
HashBasedTable.create();
|
||||
@ -85,7 +86,7 @@ public class LineGraphicDataRepository {
|
||||
LayoutGraphicsProto.RtssGraphicStorage storage =
|
||||
LayoutGraphicsProto.RtssGraphicStorage.parseFrom(publishGi.getProto());
|
||||
// DeviceNameChanger.init(storage);
|
||||
Map<String, Map<String, Builder>> lineDataMap = new HashMap<>();
|
||||
Map<String, Map<Integer, Builder>> lineDataMap = new HashMap<>();
|
||||
// 构建区段
|
||||
physicalSectionInitLineGraph(lineDataMap, storage);
|
||||
// 构建道岔
|
||||
@ -103,29 +104,27 @@ public class LineGraphicDataRepository {
|
||||
// 填充line_code_table
|
||||
fillLineCodeTable(publishGi.getLineId(), storage);
|
||||
|
||||
Map<String, Map<String, Builder>> tmpMaper = lineGraphMap.get(publishGi.getLineId());
|
||||
Map<String, Map<Integer, Builder>> tmpMaper = lineGraphMap.get(publishGi.getLineId());
|
||||
if (CollectionUtils.isEmpty(tmpMaper)) {
|
||||
return;
|
||||
}
|
||||
Map<String, Builder> turnoutMap = tmpMaper.get(DeviceType.Turnout.name());
|
||||
Map<Integer, Builder> turnoutMap = tmpMaper.get(DeviceType.Turnout.name());
|
||||
|
||||
Map<String, Builder> builderMap = tmpMaper.get(DeviceType.Section.name());
|
||||
/*if (CollectionUtils.isEmpty(builderMap)) {
|
||||
return;
|
||||
}*/
|
||||
Map<Integer, Builder> builderMap = tmpMaper.get(DeviceType.Section.name());
|
||||
|
||||
for (Section section : storage.getSectionList()) {
|
||||
if (section.getSectionType() == SectionType.TurnoutPhysical) {
|
||||
for (String s : section.getChildrenList()) {
|
||||
Builder b = turnoutMap.get(s);
|
||||
|
||||
for (Integer childId : section.getChildrenList()) {
|
||||
Builder b = turnoutMap.get(childId);
|
||||
if (b instanceof DeviceInfoProto.Turnout.Builder logicSection) {
|
||||
LOGIC_SECTION_TO_SECTION_TABLE.put(publishGi.getLineId(), logicSection.getCode(), section.getCode());
|
||||
LOGIC_SECTION_TO_AXLE_TABLE.put(publishGi.getLineId(), section.getCode(), logicSection.getCode());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (String s : section.getChildrenList()) {
|
||||
Builder b = builderMap.get(s);
|
||||
for (Integer childId : section.getChildrenList()) {
|
||||
Builder b = builderMap.get(childId);
|
||||
if (b instanceof DeviceInfoProto.Section.Builder logicSection) {
|
||||
LOGIC_SECTION_TO_SECTION_TABLE.put(publishGi.getLineId(), logicSection.getCode(), logicSection.getCode());
|
||||
LOGIC_SECTION_TO_AXLE_TABLE.put(publishGi.getLineId(), logicSection.getCode(), section.getCode());
|
||||
@ -146,7 +145,7 @@ public class LineGraphicDataRepository {
|
||||
}
|
||||
if (sectionMsg instanceof Section section) {
|
||||
Stream<LayoutGraphicsProto.Platform> platformStream = LineGraphicDataRepository.getDevices(lineId, LayoutGraphicsProto.Platform.class);
|
||||
return platformStream.filter(d -> StringUtils.equals(d.getRefSectionId(), section.getCommon().getId())).findFirst();
|
||||
return platformStream.filter(d -> d.getRefSectionId() == section.getCommon().getId()).findFirst();
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
@ -164,9 +163,9 @@ public class LineGraphicDataRepository {
|
||||
* @return 公里标
|
||||
*/
|
||||
public static DeviceKilometer.Builder getKilometerCodeList(int lineId, String sectionName) {
|
||||
Map<String, Map<String, Builder>> lineDataMap = lineGraphMap.get(lineId);
|
||||
Map<String, Map<Integer, Builder>> lineDataMap = lineGraphMap.get(lineId);
|
||||
if (CollectionUtils.isNotEmpty(lineDataMap)) {
|
||||
Map<String, Builder> sectionMap = lineDataMap.get(DeviceType.Section.name());
|
||||
Map<Integer, Builder> sectionMap = lineDataMap.get(DeviceType.Section.name());
|
||||
for (Builder v : sectionMap.values()) {
|
||||
DeviceInfoProto.Section.Builder builder = (DeviceInfoProto.Section.Builder) v;
|
||||
if (Objects.equals(builder.getCode(), sectionName)) {
|
||||
@ -174,7 +173,7 @@ public class LineGraphicDataRepository {
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Builder> turnoutMap = lineDataMap.get(DeviceType.Turnout.name());
|
||||
Map<Integer, Builder> turnoutMap = lineDataMap.get(DeviceType.Turnout.name());
|
||||
for (Builder v : turnoutMap.values()) {
|
||||
DeviceInfoProto.Turnout.Builder builder = (DeviceInfoProto.Turnout.Builder) v;
|
||||
if (Objects.equals(builder.getCode(), sectionName)) {
|
||||
@ -260,9 +259,14 @@ public class LineGraphicDataRepository {
|
||||
continue;
|
||||
}
|
||||
MessageOrBuilder common = (MessageOrBuilder) builder.getField(commonField);
|
||||
|
||||
String id = (String) common.getField(idField);
|
||||
line_code_table.put(lineId, id, builder);
|
||||
Object idObjVal = common.getField(idField);
|
||||
String idTmpVal = "";
|
||||
if (idObjVal instanceof String idVal) {
|
||||
idTmpVal = idVal;
|
||||
} else if (idObjVal instanceof Integer idVal) {
|
||||
idTmpVal = String.valueOf(idVal);
|
||||
}
|
||||
line_code_table.put(lineId, idTmpVal, builder);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -274,8 +278,8 @@ public class LineGraphicDataRepository {
|
||||
* @param lineId 线路ID
|
||||
* @return 区段集合
|
||||
*/
|
||||
public static Map<String, Builder> getLineSectionBuild(int lineId) {
|
||||
Map<String, Map<String, Builder>> lineDataMap = lineGraphMap.get(lineId);
|
||||
public static Map<Integer, Builder> getLineSectionBuild(int lineId) {
|
||||
Map<String, Map<Integer, Builder>> lineDataMap = lineGraphMap.get(lineId);
|
||||
if (CollectionUtils.isNotEmpty(lineDataMap)) {
|
||||
return lineDataMap.get(DeviceType.Section.name());
|
||||
}
|
||||
@ -289,20 +293,20 @@ public class LineGraphicDataRepository {
|
||||
* @param storage 地图构建数据
|
||||
*/
|
||||
private static void physicalSectionInitLineGraph(
|
||||
Map<String, Map<String, Builder>> dataMap, LayoutGraphicsProto.RtssGraphicStorage storage) {
|
||||
Map<String, Map<Integer, Builder>> dataMap, LayoutGraphicsProto.RtssGraphicStorage storage) {
|
||||
// 先初始化物理区段信息
|
||||
List<Section> sectionList =
|
||||
storage.getSectionList().stream()
|
||||
.filter(s -> Objects.equals(s.getSectionType(), SectionType.Physical))
|
||||
.toList();
|
||||
// 物理区段数据 + 逻辑区段数据(预设值[物理section数量 * 【ABCD】])
|
||||
Map<String, Builder> sectionMap = new HashMap<>(sectionList.size() * 5);
|
||||
Map<Integer, Builder> sectionMap = new HashMap<>(sectionList.size() * 5);
|
||||
sectionList.stream()
|
||||
// 目前数据中还存在 区段类型为 逻辑区段类型暂时先过滤掉错误
|
||||
.filter(section -> !SectionType.UNRECOGNIZED.equals(section.getSectionType()))
|
||||
.forEach(
|
||||
section -> {
|
||||
String sid = section.getCommon().getId();
|
||||
Integer sid = section.getCommon().getId();
|
||||
DeviceInfoProto.Section.Builder sectionBuilder = initSection(sectionMap, sid);
|
||||
sectionBuilder.setCode(section.getCode());
|
||||
sectionBuilder.setDestinationCode(section.getDestinationCode());
|
||||
@ -326,11 +330,11 @@ public class LineGraphicDataRepository {
|
||||
*/
|
||||
private static void turnoutInitLineGraph(
|
||||
Integer lineId,
|
||||
Map<String, Map<String, Builder>> dataMap,
|
||||
Map<String, Map<Integer, Builder>> dataMap,
|
||||
LayoutGraphicsProto.RtssGraphicStorage storage) {
|
||||
Map<String, CoordinateConvertor> convertorMap =
|
||||
lineCoordinateMain.computeIfAbsent(lineId, id -> new HashMap<>());
|
||||
Map<String, Builder> cacheSwitchMap = new HashMap<>(storage.getTurnoutsList().size());
|
||||
Map<Integer, Builder> cacheSwitchMap = new HashMap<>(storage.getTurnoutsList().size());
|
||||
storage.getTurnoutsList().stream()
|
||||
.forEach(
|
||||
t -> {
|
||||
@ -355,19 +359,19 @@ public class LineGraphicDataRepository {
|
||||
* @param storage
|
||||
*/
|
||||
private static void setUpTurnoutPhysicalSectionInfo(
|
||||
Map<String, Map<String, Builder>> dataMap, LayoutGraphicsProto.RtssGraphicStorage storage) {
|
||||
Map<String, Builder> curSectionMap = dataMap.getOrDefault(DeviceType.Section.name(), Map.of());
|
||||
Map<String, Builder> turnoutMap = dataMap.getOrDefault(DeviceType.Turnout.name(), Map.of());
|
||||
Map<String, Map<Integer, Builder>> dataMap, LayoutGraphicsProto.RtssGraphicStorage storage) {
|
||||
Map<Integer, Builder> curSectionMap = dataMap.getOrDefault(DeviceType.Section.name(), Map.of());
|
||||
Map<Integer, Builder> turnoutMap = dataMap.getOrDefault(DeviceType.Turnout.name(), Map.of());
|
||||
// 先初始化物理区段信息
|
||||
List<Section> sectionList =
|
||||
storage.getSectionList().stream()
|
||||
.filter(s -> Objects.equals(s.getSectionType(), SectionType.TurnoutPhysical))
|
||||
.toList();
|
||||
// 道岔区段数据
|
||||
Map<String, Builder> sectionMap = new HashMap<>(sectionList.size());
|
||||
Map<Integer, Builder> sectionMap = new HashMap<>(sectionList.size());
|
||||
sectionList.forEach(
|
||||
section -> {
|
||||
String sid = section.getCommon().getId();
|
||||
Integer sid = section.getCommon().getId();
|
||||
DeviceInfoProto.Section.Builder s = initSection(sectionMap, sid);
|
||||
s.setCode(section.getCode());
|
||||
s.setDestinationCode(section.getDestinationCode());
|
||||
@ -396,12 +400,12 @@ public class LineGraphicDataRepository {
|
||||
*/
|
||||
private static void setUpKilometerCode(
|
||||
Integer lineId,
|
||||
Map<String, Map<String, Builder>> dataMap,
|
||||
Map<String, Map<Integer, Builder>> dataMap,
|
||||
LayoutGraphicsProto.RtssGraphicStorage storage) {
|
||||
// 初始化转换信息
|
||||
initConvertorCoordinate(lineId, dataMap, storage);
|
||||
Map<String, Builder> sectionMap = dataMap.getOrDefault(DeviceType.Section.name(), Map.of());
|
||||
Map<String, Builder> turnoutMap = dataMap.getOrDefault(DeviceType.Turnout.name(), Map.of());
|
||||
Map<Integer, Builder> sectionMap = dataMap.getOrDefault(DeviceType.Section.name(), Map.of());
|
||||
Map<Integer, Builder> turnoutMap = dataMap.getOrDefault(DeviceType.Turnout.name(), Map.of());
|
||||
storage.getAxleCountingsList().stream()
|
||||
.filter(ac -> StringUtils.isNotEmpty(ac.getKilometerSystem().getCoordinateSystem()))
|
||||
.forEach(
|
||||
@ -443,10 +447,10 @@ public class LineGraphicDataRepository {
|
||||
*/
|
||||
private static void initConvertorCoordinate(
|
||||
Integer lineId,
|
||||
Map<String, Map<String, Builder>> dataMap,
|
||||
Map<String, Map<Integer, Builder>> dataMap,
|
||||
LayoutGraphicsProto.RtssGraphicStorage storage) {
|
||||
// 强制转换道岔
|
||||
Map<String, Builder> turnoutMap = dataMap.get(DeviceType.Turnout.name());
|
||||
Map<Integer, Builder> turnoutMap = dataMap.get(DeviceType.Turnout.name());
|
||||
if (CollectionUtils.isEmpty(turnoutMap)) {
|
||||
return;
|
||||
}
|
||||
@ -580,8 +584,9 @@ public class LineGraphicDataRepository {
|
||||
* @param storage 地图信息
|
||||
*/
|
||||
private static void setUpLogicSectionInfo(
|
||||
Map<String, Map<String, Builder>> dataMap, LayoutGraphicsProto.RtssGraphicStorage storage) {
|
||||
Map<String, Builder> sectionMap = dataMap.getOrDefault(DeviceType.Section.name(), Map.of());
|
||||
Map<String, Map<Integer, Builder>> dataMap, LayoutGraphicsProto.RtssGraphicStorage storage) {
|
||||
|
||||
Map<Integer, Builder> sectionMap = dataMap.getOrDefault(DeviceType.Section.name(), Map.of());
|
||||
if (sectionMap.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@ -589,13 +594,13 @@ public class LineGraphicDataRepository {
|
||||
.getLogicSectionsList()
|
||||
.forEach(
|
||||
section -> {
|
||||
String sid = section.getCommon().getId();
|
||||
Integer sid = section.getCommon().getId();
|
||||
if (sectionMap.containsKey(sid)) {
|
||||
DeviceInfoProto.Section.Builder sectionBuilder = findSection(sectionMap, sid);
|
||||
sectionBuilder.setCode(section.getCode());
|
||||
// 获取到物理区段信息
|
||||
DeviceInfoProto.Section.Builder physicalSection =
|
||||
findSection(sectionMap, sectionBuilder.getPhysicalSectionId());
|
||||
findSection(sectionMap, Integer.valueOf(sectionBuilder.getPhysicalSectionId()));
|
||||
DeviceKilometer.Builder deviceKilometer = sectionBuilder.getKilometerBuilder();
|
||||
DeviceKilometer.Builder parentKilometer = physicalSection.getKilometerBuilder();
|
||||
if (parentKilometer.getKilometerSystemCount() > 0) {
|
||||
@ -678,7 +683,7 @@ public class LineGraphicDataRepository {
|
||||
* @param id 区段ID
|
||||
* @return 区段实体信息
|
||||
*/
|
||||
private static DeviceInfoProto.Section.Builder initSection(Map<String, Builder> map, String id) {
|
||||
private static DeviceInfoProto.Section.Builder initSection(Map<Integer, Builder> map, Integer id) {
|
||||
if (map.containsKey(id)) {
|
||||
return (DeviceInfoProto.Section.Builder) map.get(id);
|
||||
} else {
|
||||
@ -697,7 +702,7 @@ public class LineGraphicDataRepository {
|
||||
* @param id 区段ID
|
||||
* @return 区段信息
|
||||
*/
|
||||
private static DeviceInfoProto.Section.Builder findSection(Map<String, Builder> map, String id) {
|
||||
private static DeviceInfoProto.Section.Builder findSection(Map<Integer, Builder> map, Integer id) {
|
||||
if (map.containsKey(id)) {
|
||||
return (DeviceInfoProto.Section.Builder) map.get(id);
|
||||
}
|
||||
@ -711,7 +716,7 @@ public class LineGraphicDataRepository {
|
||||
* @param id 道岔ID
|
||||
* @return 道岔信息
|
||||
*/
|
||||
private static DeviceInfoProto.Turnout.Builder findTurnout(Map<String, Builder> map, String id) {
|
||||
private static DeviceInfoProto.Turnout.Builder findTurnout(Map<Integer, Builder> map, Integer id) {
|
||||
if (map.containsKey(id)) {
|
||||
return (DeviceInfoProto.Turnout.Builder) map.get(id);
|
||||
}
|
||||
|
@ -18,7 +18,9 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
|
||||
/** 线网的列车数据,一些公共方法 */
|
||||
/**
|
||||
* 线网的列车数据,一些公共方法
|
||||
*/
|
||||
@Slf4j
|
||||
public abstract class LineNetTrainComMethod {
|
||||
|
||||
@ -137,7 +139,7 @@ public abstract class LineNetTrainComMethod {
|
||||
* @return 公里标列表
|
||||
*/
|
||||
private static DeviceKilometer.Builder getDirectionCodeKM(int lineId, String code) {
|
||||
Map<String, Builder> map = LineGraphicDataRepository.getLineSectionBuild(lineId);
|
||||
Map<Integer, Builder> map = LineGraphicDataRepository.getLineSectionBuild(lineId);
|
||||
Optional<Builder> destination =
|
||||
map.values().stream()
|
||||
.filter(
|
||||
|
@ -66,10 +66,10 @@ public class InterLockData extends AbstractData {
|
||||
// this.handleLevelOne(AlertType.INTERLOCK_LEVEL_TWO, alertTypeListMap, builder, lineId);
|
||||
}
|
||||
|
||||
private List<Station> sortRtu(String[] datas, Integer lineId) {
|
||||
private List<Station> sortRtu(Integer[] datas, Integer lineId) {
|
||||
List<Station> stationList = Lists.newArrayList();
|
||||
for (String data : datas) {
|
||||
Station stationS = LineGraphicDataRepository.getDeviceByCode(lineId, data, Station.class);
|
||||
for (Integer data : datas) {
|
||||
Station stationS = LineGraphicDataRepository.getDeviceByCode(lineId, data.toString(), Station.class);
|
||||
stationList.add(stationS);
|
||||
}
|
||||
stationList.sort((o1, o2) -> String.CASE_INSENSITIVE_ORDER.compare(o1.getCode(), o2.getCode()));
|
||||
@ -116,7 +116,7 @@ public class InterLockData extends AbstractData {
|
||||
detail.setRtuId(deviceRtuId);
|
||||
INTER_LOCK_TABLE.put(names, tableColumn, detail);
|
||||
}
|
||||
detail.addDevice(commonInfo.getId());
|
||||
detail.addDevice(commonInfo.getOldid());
|
||||
}
|
||||
|
||||
private String interLockMapName(AlertType alertType, AlertDeviceType deviceTyp) {
|
||||
|
@ -32,8 +32,7 @@ public class AllLineBlueAlertListener implements AlertSourceEventListener<AllLin
|
||||
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,
|
||||
event.station.getCommon().getId(),
|
||||
AlertDeviceType.DEVICE_TYPE_RTU, false);
|
||||
String.valueOf(event.station.getCommon().getId()), AlertDeviceType.DEVICE_TYPE_RTU, false);
|
||||
alertManager.emit(alertInfo);
|
||||
}
|
||||
}
|
||||
|
@ -85,8 +85,8 @@ public class AxleLedAlertListener implements AlertSourceEventListener<AxleLedAle
|
||||
List<Boolean> orangeList = Lists.newArrayList();
|
||||
|
||||
DeviceStatusData deviceStatusData = DeviceDataRepository.findDataSouce(String.valueOf(trackBuild.getLineId()), DataTypeEnum.DEVICE);
|
||||
for (String childId : axleSection.getChildrenList()) {
|
||||
LogicSection childSection = LineGraphicDataRepository.getDeviceByCode(trackBuild.getLineId(), childId, LogicSection.class);
|
||||
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);
|
||||
@ -115,7 +115,7 @@ public class AxleLedAlertListener implements AlertSourceEventListener<AxleLedAle
|
||||
Integer rtuId = DeviceStatusDataOperate.findFieldVal(build, "rtuId", Integer.class);
|
||||
String deviceCodeId = DeviceStatusDataOperate.findFieldVal(turnoutOrLogicSection, "code", String.class);
|
||||
CommonInfo commonInfo = DeviceStatusDataOperate.findFieldVal(turnoutOrLogicSection, "common", CommonInfo.class);
|
||||
String layoutDeviceId = commonInfo.getId();
|
||||
Integer layoutDeviceId = commonInfo.getId();
|
||||
String ledName = alertType == AlertType.AXLE_LED_RED ? "红光带" : "橙光带";
|
||||
String ledPutName = this.getDefaultName(alertType, lineId, rtuId);
|
||||
if (light) {
|
||||
@ -123,7 +123,7 @@ public class AxleLedAlertListener implements AlertSourceEventListener<AxleLedAle
|
||||
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, layoutDeviceId, AlertDeviceType.DEVICE_TYPE_TRACK, false);
|
||||
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));
|
||||
|
@ -104,14 +104,14 @@ public class AxleSwitchTrackLedAlertListener implements AlertSourceEventListener
|
||||
Integer rtuId = DeviceStatusDataOperate.findFieldVal(build, "rtuId", Integer.class);
|
||||
String deviceCodeId = DeviceStatusDataOperate.findFieldVal(turnoutOrLogicSection, "code", String.class);
|
||||
CommonInfo commonInfo = DeviceStatusDataOperate.findFieldVal(turnoutOrLogicSection, "common", CommonInfo.class);
|
||||
String layoutDeviceId = commonInfo.getId();
|
||||
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, layoutDeviceId, AlertDeviceType.DEVICE_TYPE_TRACK, false);
|
||||
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));
|
||||
|
@ -67,11 +67,11 @@ public class AxleSwitchTrackLedMostAlertListener implements AlertSourceEventList
|
||||
|
||||
private AlertType alertType;
|
||||
private int lineId;
|
||||
private String layoutDeviceId;
|
||||
private Integer layoutDeviceId;
|
||||
private boolean alert;
|
||||
private String realDeviceCodeId;
|
||||
|
||||
public SwitchAndTrackLedMostAlertEvent(Builder source, AlertType alertType, int lineId, String layoutDeviceId, String realDeviceCodeId, boolean alert) {
|
||||
public SwitchAndTrackLedMostAlertEvent(Builder source, AlertType alertType, int lineId, Integer layoutDeviceId, String realDeviceCodeId, boolean alert) {
|
||||
super(source);
|
||||
this.alertType = alertType;
|
||||
this.lineId = lineId;
|
||||
|
@ -65,7 +65,8 @@ public class BlueAlertListener implements AlertSourceEventListener<BlueDisplayAl
|
||||
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, station.getCommon().getId(), AlertDeviceType.DEVICE_TYPE_RTU,
|
||||
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));
|
||||
|
@ -79,9 +79,9 @@ public class PlatformAlertMonitoringTask implements AlertMonitoringTask {
|
||||
return "PLATFORM_CLOSE_OR_OPEN_ALTER";
|
||||
}
|
||||
|
||||
private String findRefStationName(int lineId, String stationId) {
|
||||
private String findRefStationName(int lineId, Integer stationId) {
|
||||
Stream<Station> stream = LineGraphicDataRepository.getDevices(lineId, Station.class);
|
||||
Optional<Station> stationOptional = stream.filter(d -> StringUtils.equalsIgnoreCase(d.getCommon().getId(), stationId)).findAny();
|
||||
Optional<Station> stationOptional = stream.filter(d -> d.getCommon().getId() == stationId).findAny();
|
||||
return stationOptional.map(Station::getName).orElse(null);
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ public class SwitchLostAlertMonitoringTask implements AlertMonitoringTask {
|
||||
//失表超时
|
||||
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, turnout.getCommon().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));
|
||||
|
@ -107,7 +107,7 @@ public class SwitchLostAlertMonitoringTask2 implements AlertMonitoringTask {
|
||||
log.info("道岔失表超时,准备报警 线路[{}] 设备[{}] 接受时间[{}] 发送时间[{}] 对应地图设备id[{}]"
|
||||
, lineId, switchBuild.getId(), switchBuild.getReceiveTime(), switchBuild.getTimestamp(), turnout.getCommon().getId());
|
||||
String alertMsg = String.format("设备[%s]失表", switchBuild.getId());
|
||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(Optional.empty(), AlertType.SWITCH_LOST, switchBuild, alertMsg, turnout.getCommon().getId(),
|
||||
NccAlertInfo alertInfo = this.alertInfoService.createAlert2(Optional.empty(), AlertType.SWITCH_LOST, switchBuild, alertMsg, String.valueOf(turnout.getCommon().getId()),
|
||||
AlertDeviceType.DEVICE_TYPE_SWITCH, false);
|
||||
alertManager.emit(alertInfo);
|
||||
alertManager.emit(new SwitchLostMostEvent(switchBuild, true, turnout));
|
||||
|
@ -36,8 +36,8 @@ public class SwitchLostMostAlertListener implements AlertSourceEventListener<Swi
|
||||
|
||||
private final AlertManager alertManager = AlertManager.getDefault();
|
||||
|
||||
private List<String> findDeviceIdFormCode(Integer lineId, List<String> deviceCodes) {
|
||||
List<String> list = Lists.newArrayList();
|
||||
private List<Integer> findDeviceIdFormCode(Integer lineId, List<String> deviceCodes) {
|
||||
List<Integer> list = Lists.newArrayList();
|
||||
for (String deviceCode : deviceCodes) {
|
||||
Turnout turnout = LineGraphicDataRepository.getDeviceByCode(lineId, deviceCode, Turnout.class);
|
||||
list.add(turnout.getCommon().getId());
|
||||
|
@ -102,7 +102,7 @@ public class TrainAtpCutAlertMonitoringTask implements AlertMonitoringTask {
|
||||
MessageOrBuilder turnoutOrLogicSection = LineGraphicDataRepository.getDeviceByCode(trainInfo.getLineId(), sectionCode);
|
||||
CommonInfo commonInfo = DeviceStatusDataOperate.findFieldVal(turnoutOrLogicSection, "common", CommonInfo.class);
|
||||
String deviceCode = DeviceStatusDataOperate.findFieldVal(turnoutOrLogicSection, "code", String.class);
|
||||
String layoutDeviceId = commonInfo.getId();
|
||||
Integer layoutDeviceId = commonInfo.getId();
|
||||
if (alertManager.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);
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -36,17 +36,17 @@ public class AlertInfoService {
|
||||
}
|
||||
|
||||
|
||||
public NccAlertInfo createAlert(AlertType alertType, AlertDeviceType areaDeviceType, String layoutId, MessageOrBuilder mb, String alertMsg, AlertDeviceType deviceType, boolean mockData) {
|
||||
public NccAlertInfo createAlert(AlertType alertType, AlertDeviceType areaDeviceType, Integer layoutId, MessageOrBuilder mb, String alertMsg, AlertDeviceType deviceType, boolean mockData) {
|
||||
Integer lineId = DeviceStatusDataOperate.findFieldVal(mb, "lineId", Integer.class);
|
||||
Optional<AreaConfigVO> areaConfigOptional = this.findAreaDevice(alertType, areaDeviceType, layoutId, lineId);
|
||||
return this.createAlert2(areaConfigOptional, alertType, mb, alertMsg, layoutId, deviceType, mockData);
|
||||
return this.createAlert2(areaConfigOptional, alertType, mb, alertMsg, layoutId.toString(), deviceType, mockData);
|
||||
}
|
||||
|
||||
public NccAlertInfo createAlert2(Long areaConfigId, AlertType alertType, MessageOrBuilder mb, String alertMsg, String layoutId, AlertDeviceType deviceType, boolean mockData) {
|
||||
public NccAlertInfo createAlert2(Long areaConfigId, AlertType alertType, MessageOrBuilder mb, String alertMsg, Integer layoutId, AlertDeviceType deviceType, boolean mockData) {
|
||||
Long timestamp = DeviceStatusDataOperate.findFieldVal(mb, "timestamp", Long.class);
|
||||
Integer lineId = DeviceStatusDataOperate.findFieldVal(mb, "lineId", Integer.class);
|
||||
LocalDateTime createTime = LocalDateTime.ofInstant(Instant.ofEpochSecond(timestamp), ZoneId.of("+8"));
|
||||
return this.createAlert2(areaConfigId, alertType, lineId, createTime, alertMsg, layoutId, deviceType, mockData);
|
||||
return this.createAlert2(areaConfigId, alertType, lineId, createTime, alertMsg, layoutId.toString(), deviceType, mockData);
|
||||
}
|
||||
|
||||
public NccAlertInfo createAlert2(Long areaConfigId, AlertType alertType, Integer lineId, LocalDateTime localDateTime, String alertMsg, String layoutId, AlertDeviceType deviceType,
|
||||
@ -64,12 +64,12 @@ public class AlertInfoService {
|
||||
}
|
||||
|
||||
|
||||
public Optional<AreaConfigVO> findAreaDevice(AlertType alertType, AlertDeviceType dt, String layoutId, int lineId) {
|
||||
public Optional<AreaConfigVO> findAreaDevice(AlertType alertType, AlertDeviceType dt, Integer layoutId, int lineId) {
|
||||
List<AreaConfigVO> areaConfigList = this.findDevice2(alertType, dt, lineId);
|
||||
return this.findAreaDevice(areaConfigList, layoutId);
|
||||
}
|
||||
|
||||
private Optional<AreaConfigVO> findAreaDevice(List<AreaConfigVO> areaConfigList, String layoutId) {
|
||||
private Optional<AreaConfigVO> findAreaDevice(List<AreaConfigVO> areaConfigList, Integer layoutId) {
|
||||
if (CollectionUtils.isEmpty(areaConfigList)) {
|
||||
//TODO
|
||||
return Optional.empty();
|
||||
|
@ -74,7 +74,7 @@ public class AlertRecordService {
|
||||
}*/
|
||||
case BLUE_DISPLAY, AXLE_LED_RED, AXLE_LED_ORANGE, SWITCH_DW_LOST, SWITCH_FW_LOST, TRAIN_EB_ATP,
|
||||
SWITCH_All_LOST/*, AXLE_LED_ORANGE_MOST, AXLE_LED_RED_MOST, AXLE_LED_ORANGE_INTERLOCK_AREA, AXLE_LED_RED_INTERLOCK_AREA*/ -> {
|
||||
Optional<AreaConfigVO> areaConfigVOOptional = this.alertInfoService.findAreaDevice(alertType, AlertDeviceType.valueOf(ar.getAlertDeviceType()), deviceId, ar.getLineId());
|
||||
Optional<AreaConfigVO> areaConfigVOOptional = this.alertInfoService.findAreaDevice(alertType, AlertDeviceType.valueOf(ar.getAlertDeviceType()), Integer.parseInt(deviceId), ar.getLineId());
|
||||
log.info("告警数据确认区域线路[{}] 记录id[{}] ", ar.getLineId(), ar.getId());
|
||||
return areaConfigVOOptional.map(AreaConfigVO::getId).orElse(null);
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class AreaConfigVO {
|
||||
if (StringUtils.isNotEmpty(areaConfig.getData())) {
|
||||
List<String> tmpList = Splitter.on(StringPool.COMMA).omitEmptyStrings().splitToList(areaConfig.getData());
|
||||
if (CollectionUtils.isNotEmpty(tmpList)) {
|
||||
this.datas = new String[tmpList.size()];
|
||||
this.datas = new Integer[tmpList.size()];
|
||||
tmpList.toArray(this.datas);
|
||||
Arrays.sort(this.datas);
|
||||
}
|
||||
@ -36,7 +36,7 @@ public class AreaConfigVO {
|
||||
|
||||
|
||||
private Long id;
|
||||
private String[] datas;
|
||||
private Integer[] datas;
|
||||
private String areaName;
|
||||
private AlertDeviceType deviceType;
|
||||
private List<String> alertTypes;
|
||||
@ -48,7 +48,7 @@ public class AreaConfigVO {
|
||||
return this.alertTypes.contains(alertType);
|
||||
}
|
||||
|
||||
public int findDataIndex(String deviceId) {
|
||||
public int findDataIndex(Integer deviceId) {
|
||||
if (ArrayUtils.isEmpty(this.datas)) {
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user