代码调整
This commit is contained in:
parent
8792ae9fb6
commit
6e83c145da
9
sql/update.sql
Normal file
9
sql/update.sql
Normal file
@ -0,0 +1,9 @@
|
||||
-- 2023.11.1 begin 已经执行
|
||||
alter table alert_record add index alert_time_index(alert_time);
|
||||
-- 2023.11.1 end
|
||||
|
||||
|
||||
-- 2023.11.03 begin
|
||||
update alert_record set alarm_status = -1 where alarm_status is null;
|
||||
alter table alert_record add index alarm_status_index(alarm_status);
|
||||
-- 2023.11.03 end
|
@ -1,5 +1,6 @@
|
||||
package club.joylink.xiannccda.alert;
|
||||
|
||||
import club.joylink.xiannccda.alert.NccAlertInfo.AlertStatus;
|
||||
import club.joylink.xiannccda.alert.core.AlertManager;
|
||||
import club.joylink.xiannccda.entity.AlertRecord;
|
||||
import club.joylink.xiannccda.event.Listener;
|
||||
@ -68,6 +69,7 @@ public class AlertListenerJob implements ApplicationRunner {
|
||||
record.setAlertDeviceType(nccAlertInfo.getAlertDeviceType().name());
|
||||
record.setAlertDeviceId(nccAlertInfo.getLocatorDeviceId());
|
||||
record.setMock(nccAlertInfo.isMock());
|
||||
record.setAlarmStatus(AlertStatus.NOT_DO);
|
||||
// record.setAlertLocation(nccAlertInfo.getAlertLocationName());
|
||||
return record;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import lombok.Setter;
|
||||
@Getter
|
||||
public class NccAlertInfo implements AlertInfo {
|
||||
|
||||
|
||||
@Setter
|
||||
private Integer id;
|
||||
private String level;
|
||||
@ -119,4 +120,12 @@ public class NccAlertInfo implements AlertInfo {
|
||||
default -> throw new IllegalStateException("Unexpected value: " + alertType);
|
||||
}
|
||||
}
|
||||
|
||||
public static class AlertStatus {
|
||||
|
||||
public final static int NOT_DO = -1;
|
||||
public final static int CONFIRM_DO = 1;
|
||||
public final static int FAIL_DO = 0;
|
||||
public final static int PERSON_WARN_DO = 2;
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import club.joylink.xiannccda.dto.config.relieve.DeviceRelieveDTO;
|
||||
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
||||
import club.joylink.xiannccda.entity.RelieveDeviceShere;
|
||||
import club.joylink.xiannccda.entity.RelieveTimeShere;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.google.common.base.Splitter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@ -67,28 +68,33 @@ public class RelieveVO {
|
||||
super(ds);
|
||||
this.relieveName = ds.getRelieveName();
|
||||
if (StringUtils.isNotEmpty(ds.getRelieveDeviceIds())) {
|
||||
this.relieveDeviceIds = Splitter.on(StringPool.COMMA).omitEmptyStrings().splitToStream(ds.getRelieveDeviceIds()).sorted().toArray(String[]::new);
|
||||
// this.relieveDeviceIds = Splitter.on(StringPool.COMMA).omitEmptyStrings().splitToStream(ds.getRelieveDeviceIds()).sorted().toArray(String[]::new);
|
||||
this.relieveDeviceIds = Splitter.on(StringPool.COMMA).omitEmptyStrings().splitToList(ds.getRelieveDeviceIds());
|
||||
}
|
||||
}
|
||||
|
||||
@Schema(description = "设备类型")
|
||||
private String relieveName;
|
||||
@Schema(description = "设备ids")
|
||||
private String[] relieveDeviceIds;
|
||||
private List<String> relieveDeviceIds;
|
||||
|
||||
public int findExistIndex(String layoutId) {
|
||||
/*public int findExistIndex(String layoutId) {
|
||||
if (ArrayUtils.isEmpty(this.relieveDeviceIds)) {
|
||||
return -1;
|
||||
}
|
||||
return Arrays.binarySearch(this.relieveDeviceIds, layoutId);
|
||||
}
|
||||
}*/
|
||||
|
||||
public boolean isExist(String layoutId) {
|
||||
int d = this.findExistIndex(layoutId);
|
||||
if (CollectionUtils.isEmpty(this.relieveDeviceIds)) {
|
||||
return false;
|
||||
}
|
||||
return this.relieveDeviceIds.contains(layoutId);
|
||||
/*int d = this.findExistIndex(layoutId);
|
||||
if (d < 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return true;*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -169,6 +169,7 @@ public class PlatformAlertMonitoringTask implements AlertMonitoringTask {
|
||||
for (Builder record : this.trainRecordMap.values()) {
|
||||
boolean isUpWay = record.getDir() == DirectionEnum.Up.getValue();
|
||||
Platform.Builder platformBuild = this.parsePlatform(record, isUpWay);
|
||||
|
||||
if (Objects.nonNull(platformBuild)) {
|
||||
int lineId = record.getLineId();
|
||||
boolean isOpen = alertManager.deviceIsExist(lineId, PLATFORM_IS_OPEN, platformBuild.getId());
|
||||
@ -202,6 +203,8 @@ public class PlatformAlertMonitoringTask implements AlertMonitoringTask {
|
||||
}
|
||||
Plan.Builder planBuild = planBuildOpt.get();
|
||||
this.handle(record, isUpWay, platformBuild, isOpen, isClose, planBuild);
|
||||
} else {
|
||||
this.removeTrainRecord(record);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,9 @@ public class SwitchLostMostAlertListener implements AlertSourceEventListener<Swi
|
||||
switchBuild.getLineId());
|
||||
String mostName = alertInfoMostOpt.map(AreaConfigVO::getAreaName).orElse(null);
|
||||
if (StringUtils.isEmpty(mostName)) {
|
||||
log.info("线路[{}] 设备[{}] 未找到大面失表的区域配置", lineId, switchBuild.getId());
|
||||
if (log.isDebugEnabled()) {
|
||||
log.info("线路[{}] 设备[{}] 未找到大面失表的区域配置", lineId, switchBuild.getId());
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (event.alert) {
|
||||
|
@ -14,5 +14,6 @@ public class AlertRecordQueryDTO extends PageDTO<AlertRecord> {
|
||||
private Integer lineId;
|
||||
private LocalDateTime beginDateTime;
|
||||
private LocalDateTime endDateTime;
|
||||
|
||||
|
||||
private Integer alertStatus;
|
||||
}
|
||||
|
@ -11,5 +11,5 @@ public class AlertRecordReportDTO {
|
||||
private List<AlertType> alertTypes;
|
||||
private LocalDateTime beginDateTime;
|
||||
private LocalDateTime endDateTime;
|
||||
|
||||
private Integer alertStatus;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public class AlertRecord {
|
||||
// private String alertLocation;
|
||||
private Long alertLocationId;
|
||||
private Long alertTipId;
|
||||
|
||||
// 报告状态 null=未处理,0=误报,1=确认
|
||||
private Integer alarmStatus;
|
||||
|
||||
private String alertDeviceType;
|
||||
|
@ -34,7 +34,7 @@ public class MockLoadData implements ApplicationRunner {
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
this.nccMockDataService.reset(20);
|
||||
this.nccMockDataService.reset(10);
|
||||
AtomicInteger ai = new AtomicInteger(0);
|
||||
CIRCLE_QUERY_THREAD.scheduleAtFixedRate(() -> {
|
||||
// this.nccMockDataService.skip(170L, 1100L, 1180L);
|
||||
@ -42,7 +42,7 @@ public class MockLoadData implements ApplicationRunner {
|
||||
// return;
|
||||
// }
|
||||
loadData();
|
||||
}, 300, 300, TimeUnit.MILLISECONDS);
|
||||
}, 1500, 1500, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
private void loadData() {
|
||||
|
@ -36,7 +36,11 @@ public class AlertRecordRepository extends ServiceImpl<AlertRecordMapper, AlertR
|
||||
queryWrapper.eq(Objects.nonNull(queryDTO.getLineId()), AlertRecord::getLineId, queryDTO.getLineId());
|
||||
queryWrapper.ge(Objects.nonNull(queryDTO.getBeginDateTime()), AlertRecord::getAlertTime, queryDTO.getBeginDateTime());
|
||||
queryWrapper.le(Objects.nonNull(queryDTO.getEndDateTime()), AlertRecord::getAlertTime, queryDTO.getEndDateTime());
|
||||
queryWrapper.le(Objects.nonNull(queryDTO.getAlertStatus()), AlertRecord::getAlarmStatus, queryDTO.getAlertStatus());
|
||||
|
||||
queryWrapper.orderByDesc(AlertRecord::getId);
|
||||
queryWrapper.orderByAsc(AlertRecord::getAlarmStatus);
|
||||
|
||||
return page(queryDTO, queryWrapper);
|
||||
}
|
||||
|
||||
|
@ -15,10 +15,10 @@ logging:
|
||||
max-size: 40MB
|
||||
|
||||
occ:
|
||||
host: 127.0.0.1
|
||||
realPort: 2603
|
||||
# host: 10.255.11.15
|
||||
# realPort: 5603
|
||||
# host: 127.0.0.1
|
||||
# realPort: 2603
|
||||
host: 10.255.11.15
|
||||
realPort: 5603
|
||||
unRealPort: 5703
|
||||
lineId: 3
|
||||
collectorData: false
|
||||
|
@ -12,6 +12,9 @@
|
||||
#{t}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.alertStatus != null">
|
||||
and alarm_status = #{dto.alertStatus}
|
||||
</if>
|
||||
<choose>
|
||||
<when test="dto.beginDateTime != null">
|
||||
and alert_time <![CDATA[>=]]> #{dto.beginDateTime}
|
||||
|
Loading…
Reference in New Issue
Block a user