新的proto id变更

This commit is contained in:
tiger_zhou 2023-12-19 16:19:46 +08:00
parent 01b440646b
commit a94f303f28
9 changed files with 17 additions and 138 deletions

View File

@ -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<AlertTip> 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<AlertTip> 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<AlertTip> 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);
// }
}

View File

@ -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<AlertTip> 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;
// }
// }
}
}

View File

@ -28,6 +28,7 @@ import org.springframework.stereotype.Component;
//@Component
@Slf4j
@Deprecated
public class SwitchLostAlertMonitoringTask implements AlertMonitoringTask {
private DeviceGuardConfigService configService;

View File

@ -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<AreaConfigVO> 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) {

View File

@ -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<String> 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);
}
}

View File

@ -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

View File

@ -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:

View File

@ -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);

@ -1 +1 @@
Subproject commit ee5fb2079424cb1ac7a049ead18e0c50aa98606b
Subproject commit 2de479ce4bf563c50c06c9bff31fa20262e7c51c