diff --git a/src/main/java/club/joylink/xiannccda/alert/PlatformDoorAlertMonitoringTask.java b/src/main/java/club/joylink/xiannccda/alert/PlatformDoorAlertMonitoringTask.java deleted file mode 100644 index 5d5ea1a..0000000 --- a/src/main/java/club/joylink/xiannccda/alert/PlatformDoorAlertMonitoringTask.java +++ /dev/null @@ -1,80 +0,0 @@ -package club.joylink.xiannccda.alert; - -import club.joylink.xiannccda.alert.core.AlertMonitoringTask; -import club.joylink.xiannccda.repository.IAlertTipRepository; -import org.springframework.stereotype.Component; - -//@Component -public class PlatformDoorAlertMonitoringTask implements AlertMonitoringTask { - - private IAlertTipRepository alertTipRepository; - private boolean alertTriggered; - - public PlatformDoorAlertMonitoringTask(IAlertTipRepository alertTipRepository) { - this.alertTipRepository = alertTipRepository; - } - - @Override - public String getName() { - return "platform_door"; - } - - @Override - public void run() { -// LocalDateTime now = LocalDateTime.now(); -// if (alertTriggered) { -// if (now.getSecond() % 30 != 0) { -// alertTriggered = false; -// } -// } else { -// if (now.getSecond() % 30 == 0) { -// emitPlatformDoorWithoutLockedSignalAlert(now, alertTipRepository); -// emitPlatformDoorCannotOpenAlert(now, alertTipRepository); -// emitPlatformDoorCannotCloseAlert(now, alertTipRepository); -// alertTriggered = true; -// } -// } - } - -// public void emitPlatformDoorWithoutLockedSignalAlert(LocalDateTime now, -// IAlertTipRepository alertTipRepository) { -// AlertType alertType = AlertType.PLATFORM_DOOR_WITHOUT_LOCKED_SIGNAL; -// LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(AlertTip.class); -// queryWrapper.eq(AlertTip::getAlertType, alertType); -// AlertTip alertTip = alertTipRepository.getOne(queryWrapper); -// Integer alertTipId = alertTip == null ? null : alertTip.getId(); -// -// AlertManager alertManager = AlertManager.getDefault(); -// AlertDetailImpl alert = new AlertDetailImpl(alertType, now, alertTipId, -// "[3号线]站台门无关闭锁紧信号"); -// alertManager.emit(alert); -// } -// -// public void emitPlatformDoorCannotOpenAlert(LocalDateTime now, -// IAlertTipRepository alertTipRepository) { -// AlertType alertType = AlertType.PLATFORM_DOOR_CANNOT_OPEN; -// LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(AlertTip.class); -// queryWrapper.eq(AlertTip::getAlertType, alertType); -// AlertTip alertTip = alertTipRepository.getOne(queryWrapper); -// Integer alertTipId = alertTip == null ? null : alertTip.getId(); -// -// AlertManager alertManager = AlertManager.getDefault(); -// AlertDetailImpl alert = new AlertDetailImpl(alertType, now, alertTipId, -// "[3号线]站台门整侧站台门无法打开"); -// alertManager.emit(alert); -// } -// -// public void emitPlatformDoorCannotCloseAlert(LocalDateTime now, -// IAlertTipRepository alertTipRepository) { -// AlertType alertType = AlertType.PLATFORM_DOOR_CANNOT_CLOSE; -// LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(AlertTip.class); -// queryWrapper.eq(AlertTip::getAlertType, alertType); -// AlertTip alertTip = alertTipRepository.getOne(queryWrapper); -// Integer alertTipId = alertTip == null ? null : alertTip.getId(); -// -// AlertManager alertManager = AlertManager.getDefault(); -// AlertDetailImpl alert = new AlertDetailImpl(alertType, now, alertTipId, -// "[3号线]站台门整侧站台门无法关闭"); -// alertManager.emit(alert); -// } -} diff --git a/src/main/java/club/joylink/xiannccda/alert/TrainDelayAlertMonitoringTask.java b/src/main/java/club/joylink/xiannccda/alert/TrainDelayAlertMonitoringTask.java deleted file mode 100644 index c803c28..0000000 --- a/src/main/java/club/joylink/xiannccda/alert/TrainDelayAlertMonitoringTask.java +++ /dev/null @@ -1,47 +0,0 @@ -package club.joylink.xiannccda.alert; - -import club.joylink.xiannccda.alert.core.AlertMonitoringTask; -import club.joylink.xiannccda.repository.IAlertTipRepository; -import org.springframework.stereotype.Component; - -//@Component -public class TrainDelayAlertMonitoringTask implements AlertMonitoringTask { - - private IAlertTipRepository alertTipRepository; - private boolean alertTriggered; - - public TrainDelayAlertMonitoringTask(IAlertTipRepository alertTipRepository) { - this.alertTipRepository = alertTipRepository; - } - - @Override - public String getName() { - return "Train_Delay"; - } - - @Override - public void run() { -// LocalDateTime now = LocalDateTime.now(); -// if (alertTriggered) { -// if (now.getSecond() % 30 != 0) { -// alertTriggered = false; -// } -// } else { -// if (now.getSecond() % 30 == 0) { -// AlertType alertType = AlertType.PLATFORM_DOOR_CANNOT_OPEN; -// LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(AlertTip.class); -// queryWrapper.eq(AlertTip::getAlertType, alertType) -// .eq(AlertTip::getTimeType, AlertTipTimeType.CLOCK_7_9_AND_19_21); -// AlertTip alertTip = alertTipRepository.getOne(queryWrapper); -// Integer alertTipId = alertTip == null ? null : alertTip.getId(); -// -// AlertManager alertManager = AlertManager.getDefault(); -// AlertDetailImpl alert = new AlertDetailImpl(alertType, now, alertTipId, -// String.format("[3号线]列车[01-1001]按计划应于%s抵达[%s],现因[%s]晚点%s分钟", -// now.minusMinutes(2), "鱼化寨", "道岔P0110失表", "2")); -// alertManager.emit(alert); -// alertTriggered = true; -// } -// } - } -} 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 edeb65a..94276dd 100644 --- a/src/main/java/club/joylink/xiannccda/ats/warn/SwitchLostAlertMonitoringTask.java +++ b/src/main/java/club/joylink/xiannccda/ats/warn/SwitchLostAlertMonitoringTask.java @@ -28,6 +28,7 @@ import org.springframework.stereotype.Component; //@Component @Slf4j +@Deprecated public class SwitchLostAlertMonitoringTask implements AlertMonitoringTask { private DeviceGuardConfigService configService; diff --git a/src/main/java/club/joylink/xiannccda/service/AlertInfoService.java b/src/main/java/club/joylink/xiannccda/service/AlertInfoService.java index ab29435..4359232 100644 --- a/src/main/java/club/joylink/xiannccda/service/AlertInfoService.java +++ b/src/main/java/club/joylink/xiannccda/service/AlertInfoService.java @@ -13,6 +13,7 @@ import java.time.LocalDateTime; import java.time.ZoneId; import java.util.Collections; import java.util.List; +import java.util.Objects; import java.util.Optional; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -39,7 +40,7 @@ public class AlertInfoService { 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 areaConfigOptional = this.findAreaDevice(alertType, areaDeviceType, layoutId, lineId); - return this.createAlert2(areaConfigOptional, alertType, mb, alertMsg, layoutId.toString(), deviceType, mockData); + return this.createAlert2(areaConfigOptional, alertType, mb, alertMsg, (Objects.isNull(layoutId) ? null : layoutId.toString()), deviceType, mockData); } public NccAlertInfo createAlert2(Long areaConfigId, AlertType alertType, MessageOrBuilder mb, String alertMsg, Integer layoutId, AlertDeviceType deviceType, boolean mockData) { diff --git a/src/main/java/club/joylink/xiannccda/vo/AreaConfigVO.java b/src/main/java/club/joylink/xiannccda/vo/AreaConfigVO.java index e341433..e1bada0 100644 --- a/src/main/java/club/joylink/xiannccda/vo/AreaConfigVO.java +++ b/src/main/java/club/joylink/xiannccda/vo/AreaConfigVO.java @@ -6,7 +6,10 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.google.common.base.Splitter; import java.util.Arrays; +import java.util.Collections; import java.util.List; +import java.util.stream.Collector; +import java.util.stream.Collectors; import lombok.Data; import lombok.NoArgsConstructor; import org.apache.commons.lang3.ArrayUtils; @@ -22,10 +25,11 @@ public class AreaConfigVO { this.areaName = areaConfig.getAreaName(); this.deviceType = areaConfig.getDeviceType(); if (StringUtils.isNotEmpty(areaConfig.getData())) { - List tmpList = Splitter.on(StringPool.COMMA).omitEmptyStrings().splitToList(areaConfig.getData()); - if (CollectionUtils.isNotEmpty(tmpList)) { - this.datas = new Integer[tmpList.size()]; - tmpList.toArray(this.datas); + Integer[] tmpList = Splitter.on(StringPool.COMMA).omitEmptyStrings().splitToStream(areaConfig.getData()).mapToInt(Integer::parseInt) + .sorted().boxed().toArray(Integer[]::new); + + if (ArrayUtils.isNotEmpty(tmpList)) { + this.datas = tmpList; Arrays.sort(this.datas); } } diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml index 269dca6..4a7c511 100644 --- a/src/main/resources/application-local.yml +++ b/src/main/resources/application-local.yml @@ -10,7 +10,7 @@ logging: root: info club.joylink.xiannccda.ats: info club.joylink.xiannccda.mapper: debug - com.zaxxer.hikari: debug + com.zaxxer.hikari: info file: path: /usr/xianncc max-size: 40MB @@ -23,7 +23,7 @@ occ: unRealPort: 5703 lineId: 3 collectorData: false -mock-alert-test: false -load-mock-history-data: false +mock-alert-test: true +load-mock-history-data: true #延时加载告警处理 loadAlertTaskDelayMin: 0 \ No newline at end of file diff --git a/src/main/resources/application-master.yml b/src/main/resources/application-master.yml index 2cc28c6..56262d4 100644 --- a/src/main/resources/application-master.yml +++ b/src/main/resources/application-master.yml @@ -16,7 +16,7 @@ logging: max-size: 50MB level: root: "info" - club.joylink.xiannccda.ats: info + club.joylink.xiannccda.ats.message.line3.rep: debug club.joylink.xiannccda.mapper: debug com.zaxxer.hikari: debug occ: diff --git a/src/test/java/club/joylink/xiannccda/device/DeviceStatusCheckTest.java b/src/test/java/club/joylink/xiannccda/device/DeviceStatusCheckTest.java index 3e33113..aeb001a 100644 --- a/src/test/java/club/joylink/xiannccda/device/DeviceStatusCheckTest.java +++ b/src/test/java/club/joylink/xiannccda/device/DeviceStatusCheckTest.java @@ -61,7 +61,7 @@ public class DeviceStatusCheckTest { @Test public void platformTest() { - Platform.Builder p1 = DeviceStatusConvertor.convert(DeviceStatus.PLATFORM.class, 3670016); + Platform.Builder p1 = DeviceStatusConvertor.convert(DeviceStatus.PLATFORM.class, 2555906); System.out.println(p1); System.out.println("-----------------"); Platform.Builder p2 = DeviceStatusConvertor.convert(DeviceStatus.PLATFORM.class, 2686976); diff --git a/xian-ncc-da-message b/xian-ncc-da-message index ee5fb20..2de479c 160000 --- a/xian-ncc-da-message +++ b/xian-ncc-da-message @@ -1 +1 @@ -Subproject commit ee5fb2079424cb1ac7a049ead18e0c50aa98606b +Subproject commit 2de479ce4bf563c50c06c9bff31fa20262e7c51c