diff --git a/src/main/java/club/joylink/xiannccda/ats/message/line3/rep/DeviceStatusChangeResponse.java b/src/main/java/club/joylink/xiannccda/ats/message/line3/rep/DeviceStatusChangeResponse.java index 7eb4c3b..4bbebb7 100644 --- a/src/main/java/club/joylink/xiannccda/ats/message/line3/rep/DeviceStatusChangeResponse.java +++ b/src/main/java/club/joylink/xiannccda/ats/message/line3/rep/DeviceStatusChangeResponse.java @@ -96,9 +96,12 @@ public class DeviceStatusChangeResponse extends MessageResponse { log.error("设备变更状态类型为空:{}", JSON.toJSONString(this)); return Collections.emptyList(); } + String occName = DeviceNameChangerManage.findMatch(this.type, this.devName); +// if (this.type == DeviceType.DEVICE_TYPE_SWITCH && StringUtils.startsWith(occName, "DG")) { +// this.type = DeviceType.DEVICE_TYPE_TRACK; +// } GeneratedMessageV3.Builder builder = DeviceStatusConvertor.convert(this.type, this.deviceStatus); // DeviceStatusConvertor.fillField(builder, "id", this.devName); - String occName = DeviceNameChangerManage.findMatch(this.type, this.devName); DeviceStatusConvertor.fillField(builder, "id", occName); DeviceStatusConvertor.fillField(builder, "dataFrom", MessageId.DEVICE_STATUS_CHANGE.name()); DeviceStatusConvertor.fillField(builder, "rtuId", this.rtuId); diff --git a/src/main/java/club/joylink/xiannccda/ats/warn/AxleSwitchTrackLedAlertListener.java b/src/main/java/club/joylink/xiannccda/ats/warn/AxleSwitchTrackLedAlertListener.java index 367d9c8..b5d33bb 100644 --- a/src/main/java/club/joylink/xiannccda/ats/warn/AxleSwitchTrackLedAlertListener.java +++ b/src/main/java/club/joylink/xiannccda/ats/warn/AxleSwitchTrackLedAlertListener.java @@ -13,17 +13,13 @@ import club.joylink.xiannccda.ats.warn.AxleSwitchTrackLedAlertListener.SwitchAnd import club.joylink.xiannccda.ats.warn.AxleSwitchTrackLedInterlockAreaAlertListener.SwitchAndTrackLedInterlockAreaAlertEvent; import club.joylink.xiannccda.ats.warn.AxleSwitchTrackLedMostAlertListener.SwitchAndTrackLedMostAlertEvent; import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType; -import club.joylink.xiannccda.dto.protos.DeviceInfoProto; 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.Section; -import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.Section.SectionType; 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.Map; import java.util.Objects; import java.util.Optional; import lombok.extern.slf4j.Slf4j; @@ -50,17 +46,32 @@ public class AxleSwitchTrackLedAlertListener implements AlertSourceEventListener 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); - log.info("区段光带检测 线路[{}] 设备[{}] 查找对应的物理区段code[{}] 接受类型[{}]", lineId, id, sectionCode, receiveBuildType); if (StringUtils.isEmpty(sectionCode)) { return; } - - MessageOrBuilder section = LineGraphicDataRepository.getDeviceByCode(lineId, sectionCode); - + section = LineGraphicDataRepository.getDeviceByCode(lineId, sectionCode); TrainDataSource trainDataSource = DeviceDataRepository.findDataSouce(lineId.toString(), DataTypeEnum.TRAIN); String trainGroupId = trainDataSource.findTrainForDeviceName(id); if (o instanceof Switch.Builder switchBuilder) { @@ -70,6 +81,7 @@ public class AxleSwitchTrackLedAlertListener implements AlertSourceEventListener } } + private void switchHandle(Switch.Builder switchBuilder, String trainGroupId, MessageOrBuilder section) { boolean ledRed = switchBuilder.getIpSingleSwitchStusCiOccupied() && !switchBuilder.getIpSingleSwitchStusCbtcOccupied() && Objects.isNull(trainGroupId); boolean orange = switchBuilder.getIpSingleSwitchStusAtcInvalid(); @@ -109,21 +121,6 @@ public class AxleSwitchTrackLedAlertListener implements AlertSourceEventListener } } - private String findSectionId(int lineId, Section section, String deviceCode) { - if (section.getSectionType() == SectionType.TurnoutPhysical) { - return section.getCommon().getId(); - } - Map sectionMaper = LineGraphicDataRepository.getLineSectionBuild(lineId); - for (String childId : section.getChildrenList()) { - Builder builder = sectionMaper.get(childId); - String code = DeviceStatusDataOperate.findFieldVal(builder, "code", String.class); - if (StringUtils.equalsIgnoreCase(code, deviceCode) && builder instanceof DeviceInfoProto.Section.Builder section1) { - return section1.getId(); - } - } - return section.getCommon().getId(); - } - public static class SwitchAndTrackLedAlertEvent extends DeviceAlertEvent { public SwitchAndTrackLedAlertEvent(Builder source) { diff --git a/src/main/java/club/joylink/xiannccda/ats/warn/AxleSwitchTrackLedMostAlertListener.java b/src/main/java/club/joylink/xiannccda/ats/warn/AxleSwitchTrackLedMostAlertListener.java index 9e6a3e1..fcdcac7 100644 --- a/src/main/java/club/joylink/xiannccda/ats/warn/AxleSwitchTrackLedMostAlertListener.java +++ b/src/main/java/club/joylink/xiannccda/ats/warn/AxleSwitchTrackLedMostAlertListener.java @@ -52,8 +52,9 @@ public class AxleSwitchTrackLedMostAlertListener implements AlertSourceEventList if (mostType == AlertType.AXLE_LED_ORANGE_MOST) { overNums = guardConfig.getOrangeLedMostNums(); } + boolean isMost = alertManager.needMostShow(lineId, newName, overNums); alertManager.putAlterDevice(lineId, newName, event.realDeviceCodeId); - if (alertManager.needMostShow(lineId, newName, overNums)) { + 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); diff --git a/src/main/java/club/joylink/xiannccda/ats/warn/SwitchLostAlertMonitoringTask.java b/src/main/java/club/joylink/xiannccda/ats/warn/SwitchLostAlertMonitoringTask.java index ca2a1d6..75fd607 100644 --- a/src/main/java/club/joylink/xiannccda/ats/warn/SwitchLostAlertMonitoringTask.java +++ b/src/main/java/club/joylink/xiannccda/ats/warn/SwitchLostAlertMonitoringTask.java @@ -13,6 +13,7 @@ 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.Map; import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; @@ -46,11 +47,13 @@ public class SwitchLostAlertMonitoringTask implements AlertMonitoringTask { } public void removeSwitch(Switch.Builder switchBuilder) { - Turnout turnout = LineGraphicDataRepository.getDeviceByCode(switchBuilder.getLineId(), switchBuilder.getId(), Turnout.class); - log.info("线路[{}] 道岔[{}] 从监控中移除... 设备状态参数[{}]", switchBuilder.getLineId(), switchBuilder.getId(), switchBuilder); - deviceMap.remove(switchBuilder.getId()); - alertManager.removeAlterDevice(switchBuilder.getLineId(), this.getName(), switchBuilder.getId()); - alertManager.emit(new SwitchLostMostEvent(switchBuilder, false, turnout)); + MessageOrBuilder turnoutBuild = LineGraphicDataRepository.getDeviceByCode(switchBuilder.getLineId(), switchBuilder.getId()); + if (turnoutBuild instanceof Turnout turnout) { + log.info("线路[{}] 道岔[{}] 从监控中移除... 设备状态参数[{}]", switchBuilder.getLineId(), switchBuilder.getId(), switchBuilder); + deviceMap.remove(switchBuilder.getId()); + alertManager.removeAlterDevice(switchBuilder.getLineId(), this.getName(), switchBuilder.getId()); + alertManager.emit(new SwitchLostMostEvent(switchBuilder, false, turnout)); + } } @Override diff --git a/src/main/java/club/joylink/xiannccda/ats/warn/SwitchLostMostAlertListener.java b/src/main/java/club/joylink/xiannccda/ats/warn/SwitchLostMostAlertListener.java index abc7297..d97b76f 100644 --- a/src/main/java/club/joylink/xiannccda/ats/warn/SwitchLostMostAlertListener.java +++ b/src/main/java/club/joylink/xiannccda/ats/warn/SwitchLostMostAlertListener.java @@ -60,7 +60,7 @@ public class SwitchLostMostAlertListener implements AlertSourceEventListener { - return 3670016; - } - case ALERT -> { - return 3735810; - } - } - return 0; - } -} diff --git a/src/main/java/club/joylink/xiannccda/dto/mock/PlatformCantOpenMockDTO.java b/src/main/java/club/joylink/xiannccda/dto/mock/PlatformCantOpenMockDTO.java deleted file mode 100644 index 710302d..0000000 --- a/src/main/java/club/joylink/xiannccda/dto/mock/PlatformCantOpenMockDTO.java +++ /dev/null @@ -1,20 +0,0 @@ -package club.joylink.xiannccda.dto.mock; - -import lombok.Data; - -@Data -public class PlatformCantOpenMockDTO extends NewAlertMockDTO { - - @Override - public Integer deviceStatus() { - switch (this.getStatus()) { - case NORMAL -> { - return 3670016; - } - case ALERT -> { - return 3735554; - } - } - return 0; - } -} diff --git a/src/main/java/club/joylink/xiannccda/dto/mock/AlertMockStatus.java b/src/main/java/club/joylink/xiannccda/dto/mock/show/AlertMockStatus.java similarity index 55% rename from src/main/java/club/joylink/xiannccda/dto/mock/AlertMockStatus.java rename to src/main/java/club/joylink/xiannccda/dto/mock/show/AlertMockStatus.java index 61a5fe6..f7afdac 100644 --- a/src/main/java/club/joylink/xiannccda/dto/mock/AlertMockStatus.java +++ b/src/main/java/club/joylink/xiannccda/dto/mock/show/AlertMockStatus.java @@ -1,4 +1,4 @@ -package club.joylink.xiannccda.dto.mock; +package club.joylink.xiannccda.dto.mock.show; public enum AlertMockStatus { NORMAL, BEGIN, ALERT, diff --git a/src/main/java/club/joylink/xiannccda/dto/mock/show/BlueAlertMockDTO.java b/src/main/java/club/joylink/xiannccda/dto/mock/show/BlueAlertMockDTO.java new file mode 100644 index 0000000..0dd68ed --- /dev/null +++ b/src/main/java/club/joylink/xiannccda/dto/mock/show/BlueAlertMockDTO.java @@ -0,0 +1,21 @@ +package club.joylink.xiannccda.dto.mock.show; + +import club.joylink.xiannccda.ats.message.line3.device.DeviceStatus.RTU; +import lombok.Data; + +@Data +public class BlueAlertMockDTO extends NewAlertMockDTO { + + @Override + public Integer deviceStatus() { + switch (this.getStatus()) { + case NORMAL -> { + return RTU.IP_RTU_STUS_IN_LOCAL_CTRL.getVal(); + } + case ALERT -> { + return RTU.IP_RTU_STUS_DOWN.getVal(); + } + } + return 0; + } +} diff --git a/src/main/java/club/joylink/xiannccda/dto/mock/NewAlertMockDTO.java b/src/main/java/club/joylink/xiannccda/dto/mock/show/NewAlertMockDTO.java similarity index 84% rename from src/main/java/club/joylink/xiannccda/dto/mock/NewAlertMockDTO.java rename to src/main/java/club/joylink/xiannccda/dto/mock/show/NewAlertMockDTO.java index 5b419d9..7217a31 100644 --- a/src/main/java/club/joylink/xiannccda/dto/mock/NewAlertMockDTO.java +++ b/src/main/java/club/joylink/xiannccda/dto/mock/show/NewAlertMockDTO.java @@ -1,10 +1,8 @@ -package club.joylink.xiannccda.dto.mock; +package club.joylink.xiannccda.dto.mock.show; -import club.joylink.xiannccda.alert.core.AlertDeviceType; import club.joylink.xiannccda.ats.message.MessageId; import club.joylink.xiannccda.ats.message.line3.device.DeviceType; import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType; -import com.alibaba.fastjson2.annotation.JSONField; import java.util.List; import lombok.Data; diff --git a/src/main/java/club/joylink/xiannccda/dto/mock/OrangeAlertMockDTO.java b/src/main/java/club/joylink/xiannccda/dto/mock/show/OrangeAlertMockDTO.java similarity index 86% rename from src/main/java/club/joylink/xiannccda/dto/mock/OrangeAlertMockDTO.java rename to src/main/java/club/joylink/xiannccda/dto/mock/show/OrangeAlertMockDTO.java index 89df35f..be4744f 100644 --- a/src/main/java/club/joylink/xiannccda/dto/mock/OrangeAlertMockDTO.java +++ b/src/main/java/club/joylink/xiannccda/dto/mock/show/OrangeAlertMockDTO.java @@ -1,4 +1,4 @@ -package club.joylink.xiannccda.dto.mock; +package club.joylink.xiannccda.dto.mock.show; import lombok.Data; diff --git a/src/main/java/club/joylink/xiannccda/dto/mock/RedAlertMockDTO.java b/src/main/java/club/joylink/xiannccda/dto/mock/show/RedAlertMockDTO.java similarity index 86% rename from src/main/java/club/joylink/xiannccda/dto/mock/RedAlertMockDTO.java rename to src/main/java/club/joylink/xiannccda/dto/mock/show/RedAlertMockDTO.java index af58cb1..9211bd5 100644 --- a/src/main/java/club/joylink/xiannccda/dto/mock/RedAlertMockDTO.java +++ b/src/main/java/club/joylink/xiannccda/dto/mock/show/RedAlertMockDTO.java @@ -1,4 +1,4 @@ -package club.joylink.xiannccda.dto.mock; +package club.joylink.xiannccda.dto.mock.show; import lombok.Data; diff --git a/src/main/java/club/joylink/xiannccda/dto/mock/SwitchAlertMockDTO.java b/src/main/java/club/joylink/xiannccda/dto/mock/show/SwitchAlertMockDTO.java similarity index 86% rename from src/main/java/club/joylink/xiannccda/dto/mock/SwitchAlertMockDTO.java rename to src/main/java/club/joylink/xiannccda/dto/mock/show/SwitchAlertMockDTO.java index d5f3c3c..3fab9fc 100644 --- a/src/main/java/club/joylink/xiannccda/dto/mock/SwitchAlertMockDTO.java +++ b/src/main/java/club/joylink/xiannccda/dto/mock/show/SwitchAlertMockDTO.java @@ -1,4 +1,4 @@ -package club.joylink.xiannccda.dto.mock; +package club.joylink.xiannccda.dto.mock.show; import lombok.Data; diff --git a/src/main/java/club/joylink/xiannccda/dto/mock/TrainSignlaAlertMockDTO.java b/src/main/java/club/joylink/xiannccda/dto/mock/show/TrainSignlaAlertMockDTO.java similarity index 88% rename from src/main/java/club/joylink/xiannccda/dto/mock/TrainSignlaAlertMockDTO.java rename to src/main/java/club/joylink/xiannccda/dto/mock/show/TrainSignlaAlertMockDTO.java index d42e45f..b98f557 100644 --- a/src/main/java/club/joylink/xiannccda/dto/mock/TrainSignlaAlertMockDTO.java +++ b/src/main/java/club/joylink/xiannccda/dto/mock/show/TrainSignlaAlertMockDTO.java @@ -1,4 +1,4 @@ -package club.joylink.xiannccda.dto.mock; +package club.joylink.xiannccda.dto.mock.show; import lombok.Data; diff --git a/src/main/java/club/joylink/xiannccda/dto/AlertMockDTO.java b/src/main/java/club/joylink/xiannccda/dto/mock/test/AlertMockDTO.java similarity index 93% rename from src/main/java/club/joylink/xiannccda/dto/AlertMockDTO.java rename to src/main/java/club/joylink/xiannccda/dto/mock/test/AlertMockDTO.java index eeb29af..2ed2e4a 100644 --- a/src/main/java/club/joylink/xiannccda/dto/AlertMockDTO.java +++ b/src/main/java/club/joylink/xiannccda/dto/mock/test/AlertMockDTO.java @@ -1,4 +1,4 @@ -package club.joylink.xiannccda.dto; +package club.joylink.xiannccda.dto.mock.test; import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType; import com.baomidou.mybatisplus.core.toolkit.StringPool; diff --git a/src/main/java/club/joylink/xiannccda/mock/message/occ/MockOccServer.java b/src/main/java/club/joylink/xiannccda/mock/message/occ/MockOccServer.java index 57a21c1..c36a487 100644 --- a/src/main/java/club/joylink/xiannccda/mock/message/occ/MockOccServer.java +++ b/src/main/java/club/joylink/xiannccda/mock/message/occ/MockOccServer.java @@ -4,8 +4,8 @@ import club.joylink.xiannccda.ats.message.MessageData; import club.joylink.xiannccda.ats.message.MessageId; import club.joylink.xiannccda.ats.message.OccMessageEncoder; import club.joylink.xiannccda.ats.message.line3.device.DeviceType; -import club.joylink.xiannccda.dto.mock.NewAlertMockDTO; -import club.joylink.xiannccda.dto.mock.NewAlertMockDTO.DeviceNameInfo; +import club.joylink.xiannccda.dto.mock.show.NewAlertMockDTO; +import club.joylink.xiannccda.dto.mock.show.NewAlertMockDTO.DeviceNameInfo; import club.joylink.xiannccda.mock.message.occ.req.MockDeviceStatusReq; import club.joylink.xiannccda.mock.message.occ.req.MockTrainUpdateReq; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; @@ -21,7 +21,6 @@ import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioServerSocketChannel; import jakarta.annotation.PostConstruct; import java.time.Instant; -import java.time.LocalDateTime; import java.util.List; import java.util.Objects; import java.util.concurrent.locks.Lock; @@ -31,8 +30,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; @Component //@RestController() diff --git a/src/main/java/club/joylink/xiannccda/service/AlertMockService.java b/src/main/java/club/joylink/xiannccda/service/AlertMockService.java index a5acf76..97abfb6 100644 --- a/src/main/java/club/joylink/xiannccda/service/AlertMockService.java +++ b/src/main/java/club/joylink/xiannccda/service/AlertMockService.java @@ -6,12 +6,13 @@ import club.joylink.xiannccda.alert.core.AlertDeviceType; import club.joylink.xiannccda.alert.core.AlertManager; import club.joylink.xiannccda.ats.cache.LineGraphicDataRepository; import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataOperate; -import club.joylink.xiannccda.dto.AlertMockDTO; -import club.joylink.xiannccda.dto.mock.NewAlertMockDTO; -import club.joylink.xiannccda.dto.mock.OrangeAlertMockDTO; -import club.joylink.xiannccda.dto.mock.RedAlertMockDTO; -import club.joylink.xiannccda.dto.mock.SwitchAlertMockDTO; -import club.joylink.xiannccda.dto.mock.TrainSignlaAlertMockDTO; +import club.joylink.xiannccda.dto.mock.show.BlueAlertMockDTO; +import club.joylink.xiannccda.dto.mock.test.AlertMockDTO; +import club.joylink.xiannccda.dto.mock.show.NewAlertMockDTO; +import club.joylink.xiannccda.dto.mock.show.OrangeAlertMockDTO; +import club.joylink.xiannccda.dto.mock.show.RedAlertMockDTO; +import club.joylink.xiannccda.dto.mock.show.SwitchAlertMockDTO; +import club.joylink.xiannccda.dto.mock.show.TrainSignlaAlertMockDTO; import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType; import club.joylink.xiannccda.dto.protos.DeviceStatusProto; import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Rtu; @@ -29,10 +30,7 @@ import com.alibaba.fastjson2.JSONObject; import com.google.protobuf.GeneratedMessageV3; import com.google.protobuf.MessageOrBuilder; import java.time.LocalDateTime; -import java.util.Arrays; import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; import java.util.List; import java.util.Optional; import java.util.function.Function; @@ -71,7 +69,7 @@ public class AlertMockService { alertManager.emit(alertInfo); } - public void newSetAlert(String json, AlertType alertType) { + public void alertDemoTest(String json, AlertType alertType) { Class clazz = this.findMockDataObj(alertType); NewAlertMockDTO mockDTO = JSONObject.parseObject(json, clazz); mockDTO.setAlertType(alertType); @@ -82,6 +80,9 @@ public class AlertMockService { private Class findMockDataObj(AlertType alertType) { switch (alertType) { + case BLUE_DISPLAY -> { + return BlueAlertMockDTO.class; + } case AXLE_LED_RED -> { return RedAlertMockDTO.class; } diff --git a/src/main/java/club/joylink/xiannccda/service/AlertRecordService.java b/src/main/java/club/joylink/xiannccda/service/AlertRecordService.java index 5ebe67e..fe0625c 100644 --- a/src/main/java/club/joylink/xiannccda/service/AlertRecordService.java +++ b/src/main/java/club/joylink/xiannccda/service/AlertRecordService.java @@ -72,7 +72,7 @@ public class AlertRecordService { return findList.get(0).getId(); }*/ 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 -> { + SWITCH_All_LOST/*, AXLE_LED_ORANGE_MOST, AXLE_LED_RED_MOST, AXLE_LED_ORANGE_INTERLOCK_AREA, AXLE_LED_RED_INTERLOCK_AREA*/ -> { Optional areaConfigVOOptional = this.alertInfoService.findAreaDevice(alertType, AlertDeviceType.valueOf(ar.getAlertDeviceType()), deviceId, ar.getLineId()); log.info("告警数据确认区域线路[{}] 记录id[{}] ", ar.getLineId(), ar.getId()); return areaConfigVOOptional.map(AreaConfigVO::getId).orElse(null); @@ -87,13 +87,14 @@ public class AlertRecordService { private static final List FILTER_LIST = List.of(TipTimeConfig.EVENING_PEARK.name(), TipTimeConfig.MORN_PEAK.name()/*, TipTimeConfig.NORMAL_UNPEARK.name()*/); private AlertTip findTipFromAlertTime(AlertRecord ar, String tipType, Long areaConfigId, boolean hasAreaConfigId) { + if (Objects.isNull(ar)) { + return this.findAlertTip(tipType, areaConfigId, Optional.empty(), hasAreaConfigId); + } Collection collection = this.timeConfigService.getCache(); if (CollectionUtils.isEmpty(collection)) { log.info("高低峰配置数据为空,返回默认的辅助消息"); return this.findAlertTip(tipType, areaConfigId, Optional.empty(), hasAreaConfigId); - } else if (Objects.isNull(ar)) { - return this.findAlertTip(tipType, areaConfigId, Optional.empty(), hasAreaConfigId); } else { int hour = LocalDateTime.now().getHour(); if (Objects.nonNull(ar.getAlertTime())) { @@ -122,14 +123,11 @@ public class AlertRecordService { LambdaQueryWrapper qw = Wrappers.lambdaQuery(AlertTip.class).eq(AlertTip::getAlertType, tipType); qw.eq(hasAreaConfigId, AlertTip::getAreaConfigId, areaConfigId); Long id = tipTimeConfigOptional.map(AlertTipTimeConfig::getId).orElse(null); -// qw.last(Objects.nonNull(id), String.format(" and find_in_set('%s',%s) > 0 ", id, AlertTip.TIP_TIME_REF)); List alertTips = this.alertTipRepository.list(qw); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(CollectionUtils.isNotEmpty(alertTips), "未找到对应的决策辅助信息"); if (Objects.nonNull(id)) { Optional alertTipOptional = alertTips.stream().filter(d -> StringUtils.isNotEmpty(d.getTipTimeRef())) .filter(d -> Splitter.on(StringPool.COMMA).splitToList(d.getTipTimeRef()).contains(id.toString())).findFirst(); - /*BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(alertTipOptional.isPresent(), "未找到对应的决策辅助信息"); - return alertTipOptional.get();*/ return alertTipOptional.orElseGet(() -> alertTips.get(0)); } else { return alertTips.get(0); @@ -157,7 +155,6 @@ public class AlertRecordService { .set(AlertRecord::getAlertType, tipType) .eq(AlertRecord::getId, recordId).isNull(AlertRecord::getAlarmStatus)); } - return tip; } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index c15c79e..4ec109f 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -13,7 +13,7 @@ logging: path: /usr/local/joylink/logs/xianncc occ: host: localhost - realPort: 123 + realPort: 2603 unRealPort: 123 lineId: 3 collectorData: false \ No newline at end of file