结构调整
This commit is contained in:
parent
dfdc33b313
commit
11ae9ea755
@ -50,7 +50,6 @@ public class SystemEventAspect {
|
|||||||
Jwt jwt = jwtDecoder.decode(obj.toString());
|
Jwt jwt = jwtDecoder.decode(obj.toString());
|
||||||
String userId = jwt.getClaimAsString("sub");
|
String userId = jwt.getClaimAsString("sub");
|
||||||
oe.setUserId(Long.parseLong(userId));
|
oe.setUserId(Long.parseLong(userId));
|
||||||
|
|
||||||
}
|
}
|
||||||
SystemContext.publishEvent(oe);
|
SystemContext.publishEvent(oe);
|
||||||
}
|
}
|
||||||
@ -61,7 +60,6 @@ public class SystemEventAspect {
|
|||||||
OperateEvent oe = this.parseOperateEvent(joinPoint);
|
OperateEvent oe = this.parseOperateEvent(joinPoint);
|
||||||
if (Objects.nonNull(oe)) {
|
if (Objects.nonNull(oe)) {
|
||||||
oe.setRequestSuccess(0);
|
oe.setRequestSuccess(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
SystemContext.publishEvent(oe);
|
SystemContext.publishEvent(oe);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package club.joylink.xiannccda.ats.cache;
|
package club.joylink.xiannccda.ats.cache;
|
||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.MessageId;
|
import club.joylink.xiannccda.ats.message.MessageId;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.DeviceNameChangerManage;
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository;
|
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository;
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataOperate;
|
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataOperate;
|
||||||
@ -195,7 +196,7 @@ public class LineGraphicDataRepository {
|
|||||||
statusChange.setType(dt);
|
statusChange.setType(dt);
|
||||||
statusChange.setDeviceStatus(0);
|
statusChange.setDeviceStatus(0);
|
||||||
statusChange.setRtuId(rtuId);
|
statusChange.setRtuId(rtuId);
|
||||||
return statusChange.generateProto();
|
return statusChange.generateProto(DeviceNameChangerManage.findNameChanger(lineId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Integer getStationCenterById(Integer lineId, String deviceId) {
|
public static Integer getStationCenterById(Integer lineId, String deviceId) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package club.joylink.xiannccda.ats.message;
|
package club.joylink.xiannccda.ats.message;
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto;
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto;
|
||||||
import com.alibaba.fastjson2.annotation.JSONField;
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
@ -92,7 +93,7 @@ public abstract class MessageData {
|
|||||||
*/
|
*/
|
||||||
public abstract void decode2(ByteBuf buf) throws Exception;
|
public abstract void decode2(ByteBuf buf) throws Exception;
|
||||||
|
|
||||||
public abstract List<GeneratedMessageV3.Builder> generateProto();
|
public abstract List<GeneratedMessageV3.Builder> generateProto(NameChangerEnum nameChanger);
|
||||||
|
|
||||||
|
|
||||||
public void encode(ByteBuf buf) {
|
public void encode(ByteBuf buf) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package club.joylink.xiannccda.ats.message;
|
package club.joylink.xiannccda.ats.message;
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -18,7 +19,7 @@ public abstract class MessageRequest extends MessageData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Builder> generateProto() {
|
public List<Builder> generateProto(NameChangerEnum nameChanger) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package club.joylink.xiannccda.ats.message;
|
package club.joylink.xiannccda.ats.message;
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -13,8 +14,9 @@ public abstract class MessageResponse extends MessageData {
|
|||||||
|
|
||||||
public abstract Short getLineId();
|
public abstract Short getLineId();
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Builder> generateProto() {
|
public List<Builder> generateProto(NameChangerEnum nameChanger) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public class OccMessageHandler extends SimpleChannelInboundHandler<List<MessageD
|
|||||||
DeviceStatusConvertorManager.addStatusConvertor(new TrainInitConvertor());
|
DeviceStatusConvertorManager.addStatusConvertor(new TrainInitConvertor());
|
||||||
DeviceStatusConvertorManager.addStatusConvertor(new TrainRecordConvertor());
|
DeviceStatusConvertorManager.addStatusConvertor(new TrainRecordConvertor());
|
||||||
DeviceStatusConvertorManager.addStatusConvertor(new TrainRemoveConvertor());
|
DeviceStatusConvertorManager.addStatusConvertor(new TrainRemoveConvertor());
|
||||||
DeviceStatusConvertorManager.addStatusConvertor(new TrainRecordConvertor());
|
// DeviceStatusConvertorManager.addStatusConvertor(new TrainRecordConvertor());
|
||||||
DeviceStatusConvertorManager.addStatusConvertor(new TrainUpdateConvertor());
|
DeviceStatusConvertorManager.addStatusConvertor(new TrainUpdateConvertor());
|
||||||
DeviceStatusConvertorManager.addStatusConvertor(new PlanScheduleConvertor());
|
DeviceStatusConvertorManager.addStatusConvertor(new PlanScheduleConvertor());
|
||||||
DeviceStatusConvertorManager.addStatusConvertor(new InterLockDeviceBitMapConvertor());
|
DeviceStatusConvertorManager.addStatusConvertor(new InterLockDeviceBitMapConvertor());
|
||||||
@ -67,7 +67,7 @@ public class OccMessageHandler extends SimpleChannelInboundHandler<List<MessageD
|
|||||||
if (this.collectorData) {
|
if (this.collectorData) {
|
||||||
MockAppContext.publish(msg);
|
MockAppContext.publish(msg);
|
||||||
}
|
}
|
||||||
DeviceStatusConvertorManager.doConvertor(msg);
|
DeviceStatusConvertorManager.doConvertor(this.connection.getNameChanger(), msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,43 +1,31 @@
|
|||||||
package club.joylink.xiannccda.ats.message;
|
package club.joylink.xiannccda.ats.message;
|
||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.line3.changer.DeviceNameChangerManage;
|
import club.joylink.xiannccda.ats.message.changer.DeviceNameChangerManage;
|
||||||
import com.google.common.collect.Maps;
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.Setter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.boot.ApplicationArguments;
|
import org.springframework.boot.ApplicationArguments;
|
||||||
import org.springframework.boot.ApplicationRunner;
|
import org.springframework.boot.ApplicationRunner;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import oshi.SystemInfo;
|
|
||||||
import oshi.software.os.OSProcess;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OCC客户端管理
|
* OCC客户端管理
|
||||||
*/
|
*/
|
||||||
@Component
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@Setter
|
||||||
|
@ConfigurationProperties(prefix = "occ-client")
|
||||||
public class OccMessageManage implements ApplicationRunner {
|
public class OccMessageManage implements ApplicationRunner {
|
||||||
|
|
||||||
|
|
||||||
@Value("${occ.host}")
|
private Map<Integer, OccClientMessage> clientInfoMap;
|
||||||
private String serverHost;
|
|
||||||
@Value("${occ.realPort}")
|
|
||||||
private Integer realPort;
|
|
||||||
@Value("${occ.unRealPort}")
|
|
||||||
private Integer unRealPort;
|
|
||||||
@Value("${occ.lineId}")
|
|
||||||
private Integer lineId;
|
|
||||||
@Value("${occ.collectorData:false}")
|
|
||||||
private Boolean collectorData;
|
|
||||||
@Value("${receive-msg-timeout:6}")
|
|
||||||
private Integer receiveMsgTimeout;
|
|
||||||
|
|
||||||
@Value("${monitor-handware-change:false}")
|
|
||||||
private boolean monitorHandwareChange;
|
|
||||||
Map<Integer, XianOccMessagingClient> clientMap = new HashMap<>();
|
Map<Integer, XianOccMessagingClient> clientMap = new HashMap<>();
|
||||||
|
|
||||||
public void sendMsg(Integer lineId, MessageData md, boolean isRealTime) {
|
public void sendMsg(Integer lineId, MessageData md, boolean isRealTime) {
|
||||||
@ -48,6 +36,20 @@ public class OccMessageManage implements ApplicationRunner {
|
|||||||
client.send(md, isRealTime);
|
client.send(md, isRealTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean notMatchHandle(Integer lineId, Integer rtuId) {
|
||||||
|
OccClientMessage clientMessage = this.clientInfoMap.get(lineId);
|
||||||
|
if (Objects.isNull(clientMessage)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isEmpty(clientMessage.filterRtuIds)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (clientMessage.filterRtuIds.contains(rtuId)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void registerClient(XianOccMessagingClient client) {
|
public void registerClient(XianOccMessagingClient client) {
|
||||||
clientMap.put(client.lineId, client);
|
clientMap.put(client.lineId, client);
|
||||||
@ -61,13 +63,36 @@ public class OccMessageManage implements ApplicationRunner {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(ApplicationArguments args) throws Exception {
|
public void run(ApplicationArguments args) throws Exception {
|
||||||
log.info("初始化 occ tcp连接.... 是否监控cpu,内存信息:{}", this.monitorHandwareChange);
|
|
||||||
|
|
||||||
DeviceNameChangerManage.init();
|
DeviceNameChangerManage.init();
|
||||||
// 读取数据配置,创建客户端
|
|
||||||
this.registerClient(new XianOccMessagingClient(this.lineId, this.realPort, this.unRealPort, this.serverHost, this.collectorData, receiveMsgTimeout));
|
this.clientInfoMap.forEach((k, v) -> {
|
||||||
for (XianOccMessagingClient client : this.clientMap.values()) {
|
log.info("初始化 occ tcp连接.... 是否监控cpu,lineId:{} 内存信息:{}", k, v.monitorHandwareChange);
|
||||||
client.connect(this.monitorHandwareChange);
|
DeviceNameChangerManage.initLineIdNameCHanger(k, v.getNameChanger());
|
||||||
|
XianOccMessagingClient client = new XianOccMessagingClient(k, v);
|
||||||
|
this.registerClient(client);
|
||||||
|
client.connect(v.monitorHandwareChange);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class OccClientMessage {
|
||||||
|
|
||||||
|
private String serverHost;
|
||||||
|
|
||||||
|
private Integer realPort;
|
||||||
|
|
||||||
|
private Integer unRealPort;
|
||||||
|
|
||||||
|
private Boolean collectorData;
|
||||||
|
|
||||||
|
private Integer receiveMsgTimeout;
|
||||||
|
|
||||||
|
private boolean monitorHandwareChange;
|
||||||
|
|
||||||
|
private List<Integer> filterRtuIds;
|
||||||
|
private NameChangerEnum nameChanger;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package club.joylink.xiannccda.ats.message;
|
package club.joylink.xiannccda.ats.message;
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import club.joylink.xiannccda.constants.SystemContext;
|
import club.joylink.xiannccda.constants.SystemContext;
|
||||||
import club.joylink.xiannccda.ws.msg.SystemWarnEvent;
|
import club.joylink.xiannccda.ws.msg.SystemWarnEvent;
|
||||||
import club.joylink.xiannccda.ws.msg.SystemWarnEvent.SystemWarnConnStateEvent;
|
import club.joylink.xiannccda.ws.msg.SystemWarnEvent.SystemWarnConnStateEvent;
|
||||||
@ -54,13 +55,16 @@ public class OccTcpClientConnection {
|
|||||||
@Getter
|
@Getter
|
||||||
final boolean isRealPort;
|
final boolean isRealPort;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
final NameChangerEnum nameChanger;
|
||||||
|
|
||||||
public void write(MessageData messageData) {
|
public void write(MessageData messageData) {
|
||||||
if (Objects.nonNull(this.channel)) {
|
if (Objects.nonNull(this.channel)) {
|
||||||
this.channel.writeAndFlush(List.of(messageData));
|
this.channel.writeAndFlush(List.of(messageData));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public OccTcpClientConnection(XianOccMessagingClient client, String host, int port, boolean collectorData, boolean isRealPort) {
|
public OccTcpClientConnection(XianOccMessagingClient client, String host, int port, boolean collectorData, boolean isRealPort, NameChangerEnum nameChanger) {
|
||||||
|
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.host = host;
|
this.host = host;
|
||||||
@ -68,6 +72,7 @@ public class OccTcpClientConnection {
|
|||||||
this.group = new NioEventLoopGroup(1);
|
this.group = new NioEventLoopGroup(1);
|
||||||
this.bootstrap = new Bootstrap();
|
this.bootstrap = new Bootstrap();
|
||||||
this.isRealPort = isRealPort;
|
this.isRealPort = isRealPort;
|
||||||
|
this.nameChanger = nameChanger;
|
||||||
OccTcpClientConnection self = this;
|
OccTcpClientConnection self = this;
|
||||||
bootstrap.group(group)
|
bootstrap.group(group)
|
||||||
.channel(NioSocketChannel.class)
|
.channel(NioSocketChannel.class)
|
||||||
@ -117,7 +122,6 @@ public class OccTcpClientConnection {
|
|||||||
this.connected = false;
|
this.connected = false;
|
||||||
this.channel = null;
|
this.channel = null;
|
||||||
this.client.resetRequestBaseDataFlag();
|
this.client.resetRequestBaseDataFlag();
|
||||||
|
|
||||||
}
|
}
|
||||||
SystemContext.publishEvent(new SystemWarnConnStateEvent(this.client.getLineId(), this));
|
SystemContext.publishEvent(new SystemWarnConnStateEvent(this.client.getLineId(), this));
|
||||||
this.reconnectState.resetState();
|
this.reconnectState.resetState();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package club.joylink.xiannccda.ats.message;
|
package club.joylink.xiannccda.ats.message;
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.ats.message.OccMessageManage.OccClientMessage;
|
||||||
import club.joylink.xiannccda.ats.message.line3.req.LoadHistoryTGDataRequest;
|
import club.joylink.xiannccda.ats.message.line3.req.LoadHistoryTGDataRequest;
|
||||||
import club.joylink.xiannccda.ats.message.line3.req.LoadHistoryTGDataRequest.ApplyTypeEnum;
|
import club.joylink.xiannccda.ats.message.line3.req.LoadHistoryTGDataRequest.ApplyTypeEnum;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@ -21,8 +22,6 @@ import oshi.hardware.GlobalMemory;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class XianOccMessagingClient {
|
public class XianOccMessagingClient {
|
||||||
|
|
||||||
// final int realTimePortBase = 2600;
|
|
||||||
// final int nonRealTimePortBase = 2700;
|
|
||||||
/**
|
/**
|
||||||
* 线路号 实时信息的侦听端口号为2600+line_id,非实时信息的侦听端口号为2700+line_id。 (如对于地铁1号线来说,实时信息的侦听端口号为2601,非实时信息的侦听端口号为2701)
|
* 线路号 实时信息的侦听端口号为2600+line_id,非实时信息的侦听端口号为2700+line_id。 (如对于地铁1号线来说,实时信息的侦听端口号为2601,非实时信息的侦听端口号为2701)
|
||||||
*/
|
*/
|
||||||
@ -58,7 +57,7 @@ public class XianOccMessagingClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public XianOccMessagingClient(int lineId, Integer realPort, Integer unRealPort, String host, boolean collectorData, Integer receiveMsgTimeout) {
|
/* public XianOccMessagingClient(int lineId, Integer realPort, Integer unRealPort, String host, boolean collectorData, Integer receiveMsgTimeout) {
|
||||||
this.host = host;
|
this.host = host;
|
||||||
this.lineId = lineId;
|
this.lineId = lineId;
|
||||||
this.requestBaseTime = TimeUnit.HOURS.toMillis(receiveMsgTimeout);
|
this.requestBaseTime = TimeUnit.HOURS.toMillis(receiveMsgTimeout);
|
||||||
@ -67,6 +66,17 @@ public class XianOccMessagingClient {
|
|||||||
this.nrtConnection = new OccTcpClientConnection(this, host, unRealPort, false, false);
|
this.nrtConnection = new OccTcpClientConnection(this, host, unRealPort, false, false);
|
||||||
this.timeOutHandler.addConnection(this.rtConnection);
|
this.timeOutHandler.addConnection(this.rtConnection);
|
||||||
this.timeOutHandler.addConnection(this.nrtConnection);
|
this.timeOutHandler.addConnection(this.nrtConnection);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
public XianOccMessagingClient(Integer lineId, OccClientMessage clientMessage) {
|
||||||
|
this.host = clientMessage.getServerHost();
|
||||||
|
this.lineId = lineId;
|
||||||
|
this.requestBaseTime = TimeUnit.HOURS.toMillis(clientMessage.getReceiveMsgTimeout());
|
||||||
|
// 创建实时和非实时消息连接
|
||||||
|
this.rtConnection = new OccTcpClientConnection(this, host, clientMessage.getRealPort(), clientMessage.getCollectorData(), true, clientMessage.getNameChanger());
|
||||||
|
this.nrtConnection = new OccTcpClientConnection(this, host, clientMessage.getUnRealPort(), false, false, clientMessage.getNameChanger());
|
||||||
|
this.timeOutHandler.addConnection(this.rtConnection);
|
||||||
|
this.timeOutHandler.addConnection(this.nrtConnection);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,20 +174,6 @@ public class XianOccMessagingClient {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
/* GlobalMemory memory = systemInfo.getHardware().getMemory();
|
|
||||||
long totalMemory = memory.getTotal();
|
|
||||||
long availableMemory = memory.getAvailable();
|
|
||||||
long usedMemory = totalMemory - availableMemory;
|
|
||||||
if (Objects.isNull(this.osProcess)) {
|
|
||||||
return String.format("内存总内存:%s(MB) 使用:%s(MB) 可用:%s(MB)", (totalMemory / 1024 / 1024), (usedMemory / 1024 / 1024),
|
|
||||||
(availableMemory / 1024 / 1024));
|
|
||||||
} else {
|
|
||||||
OSProcess osp = this.systemInfo.getOperatingSystem().getProcess(this.processId);
|
|
||||||
|
|
||||||
double d2 = this.osProcess.getProcessCpuLoadBetweenTicks(osp);
|
|
||||||
return String.format("当前CPU使用:%d%% 内存总内存:%s(MB) 使用:%s(MB) 可用:%s(MB)", Math.round(d2 * 100), (totalMemory / 1024 / 1024), (usedMemory / 1024 / 1024),
|
|
||||||
(availableMemory / 1024 / 1024));
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package club.joylink.xiannccda.ats.message.line3.changer;
|
package club.joylink.xiannccda.ats.message.changer;
|
||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||||
import com.google.common.collect.HashBasedTable;
|
import com.google.common.collect.HashBasedTable;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Table;
|
import com.google.common.collect.Table;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -24,10 +25,11 @@ import org.springframework.util.CollectionUtils;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class DeviceNameChangerManage {
|
public class DeviceNameChangerManage {
|
||||||
|
|
||||||
final static Table<Integer, DeviceType, List<NameChangerFilter>> CHANGER_TABLE = HashBasedTable.create();
|
final static Table<NameChangerEnum, DeviceType, List<NameChangerFilter>> CHANGER_TABLE2 = HashBasedTable.create();
|
||||||
private final static Integer TMP_DEFAULT_LINEID = 3;
|
final static Map<Integer, NameChangerEnum> LINEID_NAMECHANGER_MAP = Maps.newHashMap();
|
||||||
|
|
||||||
public static String findMatch(DeviceType deviceType, String occName) {
|
|
||||||
|
public static String findMatch(NameChangerEnum nameChanger, DeviceType deviceType, String occName) {
|
||||||
if (Objects.isNull(deviceType)) {
|
if (Objects.isNull(deviceType)) {
|
||||||
log.debug("错误的设备类型 type[{}]", deviceType);
|
log.debug("错误的设备类型 type[{}]", deviceType);
|
||||||
return occName;
|
return occName;
|
||||||
@ -36,7 +38,7 @@ public class DeviceNameChangerManage {
|
|||||||
log.debug("错误的设备名称 occName[{}]", occName);
|
log.debug("错误的设备名称 occName[{}]", occName);
|
||||||
return occName;
|
return occName;
|
||||||
}
|
}
|
||||||
List<NameChangerFilter> filters = CHANGER_TABLE.get(TMP_DEFAULT_LINEID, deviceType);
|
List<NameChangerFilter> filters = CHANGER_TABLE2.get(nameChanger, deviceType);
|
||||||
if (CollectionUtils.isEmpty(filters)) {
|
if (CollectionUtils.isEmpty(filters)) {
|
||||||
log.debug("未找到对应的转换的occName:[{}] deviceType[{}]", occName, deviceType);
|
log.debug("未找到对应的转换的occName:[{}] deviceType[{}]", occName, deviceType);
|
||||||
return occName;
|
return occName;
|
||||||
@ -51,8 +53,41 @@ public class DeviceNameChangerManage {
|
|||||||
return occName;
|
return occName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static NameChangerEnum findNameChanger(Integer lineId) {
|
||||||
|
NameChangerEnum nameChanger = LINEID_NAMECHANGER_MAP.get(lineId);
|
||||||
|
if (Objects.isNull(nameChanger)) {
|
||||||
|
|
||||||
|
return NameChangerEnum.UNIVERSAL;
|
||||||
|
}
|
||||||
|
return nameChanger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String findMatch(Integer lineId, DeviceType deviceType, String occName) {
|
||||||
|
NameChangerEnum nameChanger = LINEID_NAMECHANGER_MAP.get(lineId);
|
||||||
|
if (Objects.isNull(nameChanger)) {
|
||||||
|
log.debug("错误的设备类型 type[{}]", deviceType);
|
||||||
|
return occName;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<NameChangerFilter> filters = CHANGER_TABLE2.get(nameChanger, deviceType);
|
||||||
|
if (CollectionUtils.isEmpty(filters)) {
|
||||||
|
log.debug("未找到对应的转换的occName:[{}] deviceType[{}]", occName, deviceType);
|
||||||
|
return occName;
|
||||||
|
}
|
||||||
|
for (NameChangerFilter filter : filters) {
|
||||||
|
String newName = filter.changeDeviceName(occName);
|
||||||
|
if (Objects.nonNull(newName)) {
|
||||||
|
return newName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.debug("不能转换的occName:[{}] deviceType[{}]", occName, deviceType);
|
||||||
|
|
||||||
|
return occName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void init() throws Exception {
|
public static void init() throws Exception {
|
||||||
List<Class> classes = getClassFQName("club.joylink.xiannccda.ats.message.line3.changer", NameChangerFilter.class);
|
List<Class> classes = getClassFQName("club.joylink.xiannccda.ats.message.changer.universal", NameChangerFilter.class);
|
||||||
List<NameChangerFilter> filters = Lists.newArrayList();
|
List<NameChangerFilter> filters = Lists.newArrayList();
|
||||||
for (Class clazz : classes) {
|
for (Class clazz : classes) {
|
||||||
Object obj = clazz.getDeclaredConstructor().newInstance();
|
Object obj = clazz.getDeclaredConstructor().newInstance();
|
||||||
@ -61,10 +96,14 @@ public class DeviceNameChangerManage {
|
|||||||
Map<DeviceType, List<NameChangerFilter>> filteMaper = filters.stream().collect(Collectors.groupingBy(NameChangerFilter::deviceType));
|
Map<DeviceType, List<NameChangerFilter>> filteMaper = filters.stream().collect(Collectors.groupingBy(NameChangerFilter::deviceType));
|
||||||
filteMaper.forEach((k, v) -> {
|
filteMaper.forEach((k, v) -> {
|
||||||
Collections.sort(v, Comparator.comparingInt(NameChangerFilter::filterIndex));
|
Collections.sort(v, Comparator.comparingInt(NameChangerFilter::filterIndex));
|
||||||
CHANGER_TABLE.put(TMP_DEFAULT_LINEID, k, v);
|
CHANGER_TABLE2.put(NameChangerEnum.UNIVERSAL, k, v);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void initLineIdNameCHanger(Integer lineId, NameChangerEnum nameChanger) {
|
||||||
|
LINEID_NAMECHANGER_MAP.put(lineId, nameChanger);
|
||||||
|
}
|
||||||
|
|
||||||
private static List<Class> getClassFQName(String packgeName, Class clz) {
|
private static List<Class> getClassFQName(String packgeName, Class clz) {
|
||||||
// final String BASE_PACKAGE = packgeName;
|
// final String BASE_PACKAGE = packgeName;
|
||||||
final String RESOURCE_PATTERN = "/**/*.class";
|
final String RESOURCE_PATTERN = "/**/*.class";
|
||||||
@ -101,18 +140,18 @@ public class DeviceNameChangerManage {
|
|||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
DeviceNameChangerManage.init();
|
DeviceNameChangerManage.init();
|
||||||
String d = DeviceNameChangerManage.findMatch(DeviceType.DEVICE_TYPE_TRACK, "T13301C");
|
String d = DeviceNameChangerManage.findMatch(NameChangerEnum.UNIVERSAL, DeviceType.DEVICE_TYPE_TRACK, "T13301C");
|
||||||
System.out.println(d);
|
System.out.println(d);
|
||||||
d = DeviceNameChangerManage.findMatch(DeviceType.DEVICE_TYPE_TRACK, "T06301C");
|
d = DeviceNameChangerManage.findMatch(NameChangerEnum.UNIVERSAL, DeviceType.DEVICE_TYPE_TRACK, "T06301C");
|
||||||
System.out.println(d);
|
System.out.println(d);
|
||||||
d = DeviceNameChangerManage.findMatch(DeviceType.DEVICE_TYPE_TRACK, "T04325G");
|
d = DeviceNameChangerManage.findMatch(NameChangerEnum.UNIVERSAL, DeviceType.DEVICE_TYPE_TRACK, "T04325G");
|
||||||
System.out.println(d);
|
System.out.println(d);
|
||||||
/*d = DeviceNameChangerManage.findMatch(DeviceType.DEVICE_TYPE_TRACK, "TD_2DG");
|
/*d = DeviceNameChangerManage.findMatch(DeviceType.DEVICE_TYPE_TRACK, "TD_2DG");
|
||||||
System.out.println(d);
|
System.out.println(d);
|
||||||
|
|
||||||
d = DeviceNameChangerManage.findMatch(DeviceType.DEVICE_TYPE_SWITCH, "P02309");
|
d = DeviceNameChangerManage.findMatch(DeviceType.DEVICE_TYPE_SWITCH, "P02309");
|
||||||
System.out.println(d);*/
|
System.out.println(d);*/
|
||||||
d = DeviceNameChangerManage.findMatch(DeviceType.DEVICE_TYPE_SIGNAL, "S03305");
|
d = DeviceNameChangerManage.findMatch(NameChangerEnum.UNIVERSAL, DeviceType.DEVICE_TYPE_SIGNAL, "S03305");
|
||||||
System.out.println(d);
|
System.out.println(d);
|
||||||
/* d = DeviceNameChangerManage.findMatch(DeviceType.DEVICE_TYPE_SIGNAL, "XR");
|
/* d = DeviceNameChangerManage.findMatch(DeviceType.DEVICE_TYPE_SIGNAL, "XR");
|
||||||
System.out.println(d);
|
System.out.println(d);
|
@ -0,0 +1,7 @@
|
|||||||
|
package club.joylink.xiannccda.ats.message.changer;
|
||||||
|
|
||||||
|
public enum NameChangerEnum {
|
||||||
|
//通用
|
||||||
|
UNIVERSAL,
|
||||||
|
;
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package club.joylink.xiannccda.ats.message.line3.changer;
|
package club.joylink.xiannccda.ats.message.changer;
|
||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||||
|
|
@ -1,5 +1,6 @@
|
|||||||
package club.joylink.xiannccda.ats.message.line3.changer;
|
package club.joylink.xiannccda.ats.message.changer.universal;
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerFilter;
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
@ -1,5 +1,6 @@
|
|||||||
package club.joylink.xiannccda.ats.message.line3.changer;
|
package club.joylink.xiannccda.ats.message.changer.universal;
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerFilter;
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
@ -1,5 +1,6 @@
|
|||||||
package club.joylink.xiannccda.ats.message.line3.changer;
|
package club.joylink.xiannccda.ats.message.changer.universal;
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerFilter;
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
@ -2,9 +2,13 @@ package club.joylink.xiannccda.ats.message.collect;
|
|||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.MessageData;
|
import club.joylink.xiannccda.ats.message.MessageData;
|
||||||
import club.joylink.xiannccda.ats.message.MessageId;
|
import club.joylink.xiannccda.ats.message.MessageId;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerFilter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/** 消息数据额外转换时间,比如:线路的数据转换为线网数据 */
|
/**
|
||||||
|
* 消息数据额外转换时间,比如:线路的数据转换为线网数据
|
||||||
|
*/
|
||||||
public abstract class DeviceStatusConvertor {
|
public abstract class DeviceStatusConvertor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -14,6 +18,8 @@ public abstract class DeviceStatusConvertor {
|
|||||||
*/
|
*/
|
||||||
public abstract MessageId getMessageId();
|
public abstract MessageId getMessageId();
|
||||||
|
|
||||||
/** 任务执行逻辑 */
|
/**
|
||||||
public abstract void run(List<MessageData> messageDataList);
|
* 任务执行逻辑
|
||||||
|
*/
|
||||||
|
public abstract void run(NameChangerEnum nameChanger, List<MessageData> messageDataList);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package club.joylink.xiannccda.ats.message.collect;
|
|||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.MessageData;
|
import club.joylink.xiannccda.ats.message.MessageData;
|
||||||
import club.joylink.xiannccda.ats.message.MessageId;
|
import club.joylink.xiannccda.ats.message.MessageId;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -48,14 +49,14 @@ public class DeviceStatusConvertorManager {
|
|||||||
*
|
*
|
||||||
* @param dataList 消息数据列表
|
* @param dataList 消息数据列表
|
||||||
*/
|
*/
|
||||||
public static void doConvertor(List<MessageData> dataList) {
|
public static void doConvertor(NameChangerEnum nameChanger, List<MessageData> dataList) {
|
||||||
dataList.stream()
|
dataList.stream()
|
||||||
.filter(m -> CONVERTOR_MAP.containsKey(m.getMsgId()))
|
.filter(m -> CONVERTOR_MAP.containsKey(m.getMsgId()))
|
||||||
.collect(Collectors.groupingBy(MessageData::getMsgId))
|
.collect(Collectors.groupingBy(MessageData::getMsgId))
|
||||||
.forEach((k, v) -> CONVERTOR_MAP.get(k).values().forEach(c -> c.run(v)));
|
.forEach((k, v) -> CONVERTOR_MAP.get(k).values().forEach(c -> c.run(nameChanger, v)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void doConvertor(MessageData md) {
|
public static void doConvertor(NameChangerEnum nameChanger, MessageData md) {
|
||||||
doConvertor(Collections.singletonList(md));
|
doConvertor(nameChanger, Collections.singletonList(md));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,11 +60,9 @@ public abstract class DeviceStatusDataOperate {
|
|||||||
.forEach(
|
.forEach(
|
||||||
(k, v) -> {
|
(k, v) -> {
|
||||||
// 当前的设备状态
|
// 当前的设备状态
|
||||||
Map<String, Builder> deviceStatusMap =
|
Map<String, Builder> deviceStatusMap = allDeviceMap.computeIfAbsent(k, key -> new ConcurrentHashMap<>(v.size()));
|
||||||
allDeviceMap.computeIfAbsent(k, key -> new ConcurrentHashMap<>(v.size()));
|
|
||||||
// 新的设备状态
|
// 新的设备状态
|
||||||
Map<String, Builder> newDeviceMap =
|
Map<String, Builder> newDeviceMap = v.stream().collect(Collectors.toMap(DeviceStatusDataOperate::getIdVal, b -> b, (v1, v2) -> {
|
||||||
v.stream().collect(Collectors.toMap(DeviceStatusDataOperate::getIdVal, b -> b, (v1, v2) -> {
|
|
||||||
Long curTime = DeviceStatusDataOperate.findFieldVal(v1, "timestamp", Long.class);
|
Long curTime = DeviceStatusDataOperate.findFieldVal(v1, "timestamp", Long.class);
|
||||||
Long collTime = DeviceStatusDataOperate.findFieldVal(v2, "timestamp", Long.class);
|
Long collTime = DeviceStatusDataOperate.findFieldVal(v2, "timestamp", Long.class);
|
||||||
if (Objects.nonNull(curTime) && Objects.nonNull(collTime)) {
|
if (Objects.nonNull(curTime) && Objects.nonNull(collTime)) {
|
||||||
|
@ -2,6 +2,7 @@ package club.joylink.xiannccda.ats.message.collect.convertor;
|
|||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.MessageData;
|
import club.joylink.xiannccda.ats.message.MessageData;
|
||||||
import club.joylink.xiannccda.ats.message.MessageResponse;
|
import club.joylink.xiannccda.ats.message.MessageResponse;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository;
|
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository;
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceStatusConvertor;
|
import club.joylink.xiannccda.ats.message.collect.DeviceStatusConvertor;
|
||||||
@ -46,10 +47,10 @@ public abstract class DefaultConvertor extends DeviceStatusConvertor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(List<MessageData> messageDataList) {
|
public void run(NameChangerEnum nameChanger, List<MessageData> messageDataList) {
|
||||||
Map<Short, List<MessageResponse>> lineMapper = this.groupByLineId(messageDataList);
|
Map<Short, List<MessageResponse>> lineMapper = this.groupByLineId(messageDataList);
|
||||||
lineMapper.forEach((k, v) -> {
|
lineMapper.forEach((k, v) -> {
|
||||||
List<GeneratedMessageV3.Builder> builders = v.stream().map(MessageResponse::generateProto)
|
List<GeneratedMessageV3.Builder> builders = v.stream().map(d -> d.generateProto(nameChanger))
|
||||||
.flatMap(Collection::stream).filter(d -> {
|
.flatMap(Collection::stream).filter(d -> {
|
||||||
Integer lineId = DeviceStatusDataOperate.findFieldVal(d, "lineId", Integer.class);
|
Integer lineId = DeviceStatusDataOperate.findFieldVal(d, "lineId", Integer.class);
|
||||||
Integer rtuId = DeviceStatusDataOperate.findFieldVal(d, "rtuId", Integer.class);
|
Integer rtuId = DeviceStatusDataOperate.findFieldVal(d, "rtuId", Integer.class);
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
package club.joylink.xiannccda.ats.message.collect.convertor;
|
package club.joylink.xiannccda.ats.message.collect.convertor;
|
||||||
|
|
||||||
import club.joylink.xiannccda.ats.cache.LineGraphicDataRepository;
|
import club.joylink.xiannccda.ats.cache.LineGraphicDataRepository;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataOperate;
|
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataOperate;
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataRepository;
|
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataRepository;
|
||||||
import club.joylink.xiannccda.ats.message.collect.datasource.DeviceStatusData;
|
import club.joylink.xiannccda.ats.message.collect.datasource.DeviceStatusData;
|
||||||
import club.joylink.xiannccda.ats.message.line3.changer.DeviceNameChangerManage;
|
import club.joylink.xiannccda.ats.message.changer.DeviceNameChangerManage;
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceInfoProto;
|
import club.joylink.xiannccda.dto.protos.DeviceInfoProto;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceInfoProto.DeviceKilometer;
|
import club.joylink.xiannccda.dto.protos.DeviceInfoProto.DeviceKilometer;
|
||||||
@ -56,10 +57,10 @@ public abstract class LineNetTrainComMethod {
|
|||||||
* @param type 所在设备类型
|
* @param type 所在设备类型
|
||||||
* @param deviceName 设备名称
|
* @param deviceName 设备名称
|
||||||
*/
|
*/
|
||||||
public static void setUpKilometerCode(
|
public static void setUpKilometerCode(NameChangerEnum nameChanger,
|
||||||
WsMessageProto.WsLineNetTrainOffsetMessage.Builder obj, DeviceType type, String deviceName) {
|
WsMessageProto.WsLineNetTrainOffsetMessage.Builder obj, DeviceType type, String deviceName) {
|
||||||
// 获取到当前区段公里标
|
// 获取到当前区段公里标
|
||||||
DeviceKilometer.Builder km = getDeviceKM(obj.getLineId(), type, deviceName);
|
DeviceKilometer.Builder km = getDeviceKM(nameChanger, obj.getLineId(), type, deviceName);
|
||||||
if (km != null) {
|
if (km != null) {
|
||||||
obj.setKilometerCode(selectDeviceKilometerCode(obj.getDir(), km));
|
obj.setKilometerCode(selectDeviceKilometerCode(obj.getDir(), km));
|
||||||
} else {
|
} else {
|
||||||
@ -76,14 +77,14 @@ public abstract class LineNetTrainComMethod {
|
|||||||
* @param type 设备类型
|
* @param type 设备类型
|
||||||
* @param name 设备名称
|
* @param name 设备名称
|
||||||
*/
|
*/
|
||||||
public static void setTrainDirectionAndKilometerCode(
|
public static void setTrainDirectionAndKilometerCode(NameChangerEnum nameChanger,
|
||||||
WsMessageProto.WsLineNetTrainOffsetMessage.Builder obj,
|
WsMessageProto.WsLineNetTrainOffsetMessage.Builder obj,
|
||||||
String globalId,
|
String globalId,
|
||||||
String destinationCode,
|
String destinationCode,
|
||||||
DeviceType type,
|
DeviceType type,
|
||||||
String name) {
|
String name) {
|
||||||
TrainRunDirection direction = null;
|
TrainRunDirection direction = null;
|
||||||
DeviceKilometer.Builder deviceKm = getDeviceKM(obj.getLineId(), type, name);
|
DeviceKilometer.Builder deviceKm = getDeviceKM(nameChanger, obj.getLineId(), type, name);
|
||||||
if (deviceKm != null && StringUtils.isNoneEmpty(destinationCode)) {
|
if (deviceKm != null && StringUtils.isNoneEmpty(destinationCode)) {
|
||||||
DeviceKilometer.Builder destinationKm = getDirectionCodeKM(obj.getLineId(), destinationCode);
|
DeviceKilometer.Builder destinationKm = getDirectionCodeKM(obj.getLineId(), destinationCode);
|
||||||
// 目的地最大公里标大于设备最大公里标,上行
|
// 目的地最大公里标大于设备最大公里标,上行
|
||||||
@ -120,13 +121,13 @@ public abstract class LineNetTrainComMethod {
|
|||||||
* @param name 设备名称
|
* @param name 设备名称
|
||||||
* @return 公里标列表
|
* @return 公里标列表
|
||||||
*/
|
*/
|
||||||
private static DeviceKilometer.Builder getDeviceKM(int lineId, DeviceType type, String name) {
|
private static DeviceKilometer.Builder getDeviceKM(NameChangerEnum nameChanger, int lineId, DeviceType type, String name) {
|
||||||
// 非区段、道岔直接返回
|
// 非区段、道岔直接返回
|
||||||
if (!DeviceType.DEVICE_TYPE_TRACK.equals(type) && !DeviceType.DEVICE_TYPE_SWITCH.equals(type)) {
|
if (!DeviceType.DEVICE_TYPE_TRACK.equals(type) && !DeviceType.DEVICE_TYPE_SWITCH.equals(type)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// 转换成程序中的名称
|
// 转换成程序中的名称
|
||||||
String convertName = DeviceNameChangerManage.findMatch(type, name);
|
String convertName = DeviceNameChangerManage.findMatch(nameChanger, type, name);
|
||||||
// 获取到当前区段公里标
|
// 获取到当前区段公里标
|
||||||
return LineGraphicDataRepository.getKilometerCodeList(lineId, convertName);
|
return LineGraphicDataRepository.getKilometerCodeList(lineId, convertName);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package club.joylink.xiannccda.ats.message.collect.convertor;
|
|||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.MessageData;
|
import club.joylink.xiannccda.ats.message.MessageData;
|
||||||
import club.joylink.xiannccda.ats.message.MessageId;
|
import club.joylink.xiannccda.ats.message.MessageId;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceStatusConvertor;
|
import club.joylink.xiannccda.ats.message.collect.DeviceStatusConvertor;
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataOperate;
|
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataOperate;
|
||||||
import club.joylink.xiannccda.ats.message.line3.rep.TrainIndicationInitResponse;
|
import club.joylink.xiannccda.ats.message.line3.rep.TrainIndicationInitResponse;
|
||||||
@ -13,16 +14,19 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
/** 接收列车初始化消息,就收转换线网的列车数据 */
|
/**
|
||||||
|
* 接收列车初始化消息,就收转换线网的列车数据
|
||||||
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class LineNetTrainInitConvertor extends DeviceStatusConvertor {
|
public class LineNetTrainInitConvertor extends DeviceStatusConvertor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessageId getMessageId() {
|
public MessageId getMessageId() {
|
||||||
return MessageId.TRAIN_INDICATION_INIT;
|
return MessageId.TRAIN_INDICATION_INIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(List<MessageData> messageDataList) {
|
public void run(NameChangerEnum nameChanger, List<MessageData> messageDataList) {
|
||||||
List<Builder> buildList = Lists.newArrayList();
|
List<Builder> buildList = Lists.newArrayList();
|
||||||
try {
|
try {
|
||||||
for (MessageData data : messageDataList) {
|
for (MessageData data : messageDataList) {
|
||||||
@ -35,7 +39,7 @@ public class LineNetTrainInitConvertor extends DeviceStatusConvertor {
|
|||||||
offset.setLineId(response.getLineId()); // 线路id
|
offset.setLineId(response.getLineId()); // 线路id
|
||||||
offset.setTrainIndex(trainCell.getTrainIndex()); // 列车标示号,全线唯一
|
offset.setTrainIndex(trainCell.getTrainIndex()); // 列车标示号,全线唯一
|
||||||
offset.setGroupId(trainCell.getGroupId()); // 车组号
|
offset.setGroupId(trainCell.getGroupId()); // 车组号
|
||||||
LineNetTrainComMethod.setTrainDirectionAndKilometerCode(
|
LineNetTrainComMethod.setTrainDirectionAndKilometerCode(nameChanger,
|
||||||
offset,
|
offset,
|
||||||
trainCell.getGlobalId(),
|
trainCell.getGlobalId(),
|
||||||
trainCell.getDestinationId(),
|
trainCell.getDestinationId(),
|
||||||
|
@ -2,6 +2,7 @@ package club.joylink.xiannccda.ats.message.collect.convertor;
|
|||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.MessageData;
|
import club.joylink.xiannccda.ats.message.MessageData;
|
||||||
import club.joylink.xiannccda.ats.message.MessageId;
|
import club.joylink.xiannccda.ats.message.MessageId;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceStatusConvertor;
|
import club.joylink.xiannccda.ats.message.collect.DeviceStatusConvertor;
|
||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataOperate;
|
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataOperate;
|
||||||
@ -23,7 +24,7 @@ public class LineNetTrainRecordConvertor extends DeviceStatusConvertor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(List<MessageData> messageDataList) {
|
public void run(NameChangerEnum nameChanger, List<MessageData> messageDataList) {
|
||||||
try {
|
try {
|
||||||
List<Builder> buildList = Lists.newArrayList();
|
List<Builder> buildList = Lists.newArrayList();
|
||||||
// 已存在的设备信息
|
// 已存在的设备信息
|
||||||
@ -37,7 +38,7 @@ public class LineNetTrainRecordConvertor extends DeviceStatusConvertor {
|
|||||||
LineNetTrainComMethod.getDeviceStatusById(offset); // 合并老旧数据
|
LineNetTrainComMethod.getDeviceStatusById(offset); // 合并老旧数据
|
||||||
offset.setDir(response.getDirection().getValue()); // 初始设置无运行方向
|
offset.setDir(response.getDirection().getValue()); // 初始设置无运行方向
|
||||||
// 设置公里标信息
|
// 设置公里标信息
|
||||||
LineNetTrainComMethod.setUpKilometerCode(
|
LineNetTrainComMethod.setUpKilometerCode(nameChanger,
|
||||||
offset, DeviceType.DEVICE_TYPE_TRACK, response.getTrackName());
|
offset, DeviceType.DEVICE_TYPE_TRACK, response.getTrackName());
|
||||||
offset.setShow(offset.getKilometerCode() != 0);
|
offset.setShow(offset.getKilometerCode() != 0);
|
||||||
buildList.add(offset);
|
buildList.add(offset);
|
||||||
|
@ -3,6 +3,7 @@ package club.joylink.xiannccda.ats.message.collect.convertor;
|
|||||||
import club.joylink.xiannccda.ats.cache.LineGraphicDataRepository;
|
import club.joylink.xiannccda.ats.cache.LineGraphicDataRepository;
|
||||||
import club.joylink.xiannccda.ats.message.MessageData;
|
import club.joylink.xiannccda.ats.message.MessageData;
|
||||||
import club.joylink.xiannccda.ats.message.MessageId;
|
import club.joylink.xiannccda.ats.message.MessageId;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceStatusConvertor;
|
import club.joylink.xiannccda.ats.message.collect.DeviceStatusConvertor;
|
||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataOperate;
|
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataOperate;
|
||||||
@ -17,7 +18,9 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
/** 列车信息移除时,线网信息处理 */
|
/**
|
||||||
|
* 列车信息移除时,线网信息处理
|
||||||
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class LineNetTrainRemoveConvertor extends DeviceStatusConvertor {
|
public class LineNetTrainRemoveConvertor extends DeviceStatusConvertor {
|
||||||
|
|
||||||
@ -27,7 +30,7 @@ public class LineNetTrainRemoveConvertor extends DeviceStatusConvertor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(List<MessageData> messageDataList) {
|
public void run(NameChangerEnum nameChanger, List<MessageData> messageDataList) {
|
||||||
try {
|
try {
|
||||||
List<Builder> buildList = Lists.newArrayList();
|
List<Builder> buildList = Lists.newArrayList();
|
||||||
for (MessageData data : messageDataList) {
|
for (MessageData data : messageDataList) {
|
||||||
@ -39,7 +42,7 @@ public class LineNetTrainRemoveConvertor extends DeviceStatusConvertor {
|
|||||||
offset.setGroupId(response.getGroupId());
|
offset.setGroupId(response.getGroupId());
|
||||||
offset.setTrainIndex(response.getTrainIndex());
|
offset.setTrainIndex(response.getTrainIndex());
|
||||||
LineNetTrainComMethod.getDeviceStatusById(offset); // 合并老旧数据
|
LineNetTrainComMethod.getDeviceStatusById(offset); // 合并老旧数据
|
||||||
LineNetTrainComMethod.setUpKilometerCode(
|
LineNetTrainComMethod.setUpKilometerCode(nameChanger,
|
||||||
offset, response.getDevType(), response.getDevName());
|
offset, response.getDevType(), response.getDevName());
|
||||||
offset.setShow(false);
|
offset.setShow(false);
|
||||||
buildList.add(offset);
|
buildList.add(offset);
|
||||||
|
@ -2,6 +2,7 @@ package club.joylink.xiannccda.ats.message.collect.convertor;
|
|||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.MessageData;
|
import club.joylink.xiannccda.ats.message.MessageData;
|
||||||
import club.joylink.xiannccda.ats.message.MessageId;
|
import club.joylink.xiannccda.ats.message.MessageId;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceStatusConvertor;
|
import club.joylink.xiannccda.ats.message.collect.DeviceStatusConvertor;
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataOperate;
|
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataOperate;
|
||||||
import club.joylink.xiannccda.ats.message.line3.rep.TrainIndicationUpdateResponse;
|
import club.joylink.xiannccda.ats.message.line3.rep.TrainIndicationUpdateResponse;
|
||||||
@ -12,7 +13,9 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
/** 列车信息更新时,信息转换 */
|
/**
|
||||||
|
* 列车信息更新时,信息转换
|
||||||
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class LineNetTrainUpdateConvertor extends DeviceStatusConvertor {
|
public class LineNetTrainUpdateConvertor extends DeviceStatusConvertor {
|
||||||
|
|
||||||
@ -22,7 +25,7 @@ public class LineNetTrainUpdateConvertor extends DeviceStatusConvertor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(List<MessageData> messageDataList) {
|
public void run(NameChangerEnum nameChanger, List<MessageData> messageDataList) {
|
||||||
try {
|
try {
|
||||||
List<Builder> buildList = Lists.newArrayList();
|
List<Builder> buildList = Lists.newArrayList();
|
||||||
for (MessageData data : messageDataList) {
|
for (MessageData data : messageDataList) {
|
||||||
@ -34,7 +37,7 @@ public class LineNetTrainUpdateConvertor extends DeviceStatusConvertor {
|
|||||||
offset.setTrainIndex(response.getTrainIndex()); // 列车标示号,全线唯一
|
offset.setTrainIndex(response.getTrainIndex()); // 列车标示号,全线唯一
|
||||||
offset.setGroupId(response.getGroupId()); // 车组号
|
offset.setGroupId(response.getGroupId()); // 车组号
|
||||||
LineNetTrainComMethod.getDeviceStatusById(offset); // 合并老旧数据
|
LineNetTrainComMethod.getDeviceStatusById(offset); // 合并老旧数据
|
||||||
LineNetTrainComMethod.setTrainDirectionAndKilometerCode(
|
LineNetTrainComMethod.setTrainDirectionAndKilometerCode(nameChanger,
|
||||||
offset,
|
offset,
|
||||||
response.getGlobalId(),
|
response.getGlobalId(),
|
||||||
response.getDestinationId(),
|
response.getDestinationId(),
|
||||||
|
@ -39,6 +39,12 @@ public class TrainDataSource extends AbstractData {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 增量的设备更新信息
|
* 增量的设备更新信息
|
||||||
|
* <p>
|
||||||
|
* k1 数据类型
|
||||||
|
* <p>
|
||||||
|
* k2 车组号
|
||||||
|
* <p>
|
||||||
|
* v 列车数据
|
||||||
*/
|
*/
|
||||||
private Table<String, String, Message> trainUpdate = Tables.synchronizedTable(HashBasedTable.create());
|
private Table<String, String, Message> trainUpdate = Tables.synchronizedTable(HashBasedTable.create());
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package club.joylink.xiannccda.ats.message.line3;
|
|||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.MessageData;
|
import club.joylink.xiannccda.ats.message.MessageData;
|
||||||
import club.joylink.xiannccda.ats.message.MessageId;
|
import club.joylink.xiannccda.ats.message.MessageId;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -18,7 +19,7 @@ public class HeartBeatMsg extends MessageData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Builder> generateProto() {
|
public List<Builder> generateProto(NameChangerEnum nameChanger) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,8 +2,9 @@ package club.joylink.xiannccda.ats.message.line3.rep;
|
|||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.MessageId;
|
import club.joylink.xiannccda.ats.message.MessageId;
|
||||||
import club.joylink.xiannccda.ats.message.MessageResponse;
|
import club.joylink.xiannccda.ats.message.MessageResponse;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import club.joylink.xiannccda.ats.message.convertor.DeviceStatusConvertor;
|
import club.joylink.xiannccda.ats.message.convertor.DeviceStatusConvertor;
|
||||||
import club.joylink.xiannccda.ats.message.line3.changer.DeviceNameChangerManage;
|
import club.joylink.xiannccda.ats.message.changer.DeviceNameChangerManage;
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceStatus;
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceStatus;
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||||
import club.joylink.xiannccda.ats.message.line3.rep.EntityParseUtil.ReadData;
|
import club.joylink.xiannccda.ats.message.line3.rep.EntityParseUtil.ReadData;
|
||||||
@ -69,14 +70,14 @@ public class DeviceStatusBitmapResponse extends MessageResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Builder> generateProto() {
|
public List<Builder> generateProto(NameChangerEnum nameChanger) {
|
||||||
List<GeneratedMessageV3.Builder> msgBuildList = Lists.newArrayList();
|
List<GeneratedMessageV3.Builder> msgBuildList = Lists.newArrayList();
|
||||||
for (DeviceTypeEntity deviceTypeEntity : this.entityList) {
|
for (DeviceTypeEntity deviceTypeEntity : this.entityList) {
|
||||||
DeviceType dt = deviceTypeEntity.getType();
|
DeviceType dt = deviceTypeEntity.getType();
|
||||||
for (DeviceEntity deviceEntity : deviceTypeEntity.deviceList) {
|
for (DeviceEntity deviceEntity : deviceTypeEntity.deviceList) {
|
||||||
GeneratedMessageV3.Builder builder = DeviceStatusConvertor.convert(dt, deviceEntity.status);
|
GeneratedMessageV3.Builder builder = DeviceStatusConvertor.convert(dt, deviceEntity.status);
|
||||||
// DeviceStatusConvertor.fillField(builder, "id", deviceEntity.devName);
|
// DeviceStatusConvertor.fillField(builder, "id", deviceEntity.devName);
|
||||||
String newOccName = DeviceNameChangerManage.findMatch(dt, deviceEntity.devName);
|
String newOccName = DeviceNameChangerManage.findMatch(nameChanger, dt, deviceEntity.devName);
|
||||||
DeviceStatusConvertor.fillField(builder, "id", newOccName);
|
DeviceStatusConvertor.fillField(builder, "id", newOccName);
|
||||||
DeviceStatusConvertor.fillField(builder, "rtuId", this.rtuId);
|
DeviceStatusConvertor.fillField(builder, "rtuId", this.rtuId);
|
||||||
DeviceStatusConvertor.fillField(builder, "timestamp", this.getTime());
|
DeviceStatusConvertor.fillField(builder, "timestamp", this.getTime());
|
||||||
|
@ -2,25 +2,21 @@ package club.joylink.xiannccda.ats.message.line3.rep;
|
|||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.MessageId;
|
import club.joylink.xiannccda.ats.message.MessageId;
|
||||||
import club.joylink.xiannccda.ats.message.MessageResponse;
|
import club.joylink.xiannccda.ats.message.MessageResponse;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import club.joylink.xiannccda.ats.message.convertor.DeviceStatusConvertor;
|
import club.joylink.xiannccda.ats.message.convertor.DeviceStatusConvertor;
|
||||||
import club.joylink.xiannccda.ats.message.line3.changer.DeviceNameChangerManage;
|
import club.joylink.xiannccda.ats.message.changer.DeviceNameChangerManage;
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceStatus;
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceStatus;
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto;
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.protobuf.Descriptors.FieldDescriptor;
|
|
||||||
import com.google.protobuf.GeneratedMessageV3;
|
import com.google.protobuf.GeneratedMessageV3;
|
||||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 2.7.5 设备状态变化消息
|
* 2.7.5 设备状态变化消息
|
||||||
@ -91,12 +87,12 @@ public class DeviceStatusChangeResponse extends MessageResponse {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Builder> generateProto() {
|
public List<Builder> generateProto(NameChangerEnum nameChanger) {
|
||||||
if (Objects.isNull(this.type)) {
|
if (Objects.isNull(this.type)) {
|
||||||
log.error("设备变更状态类型为空:{}", JSON.toJSONString(this));
|
log.error("设备变更状态类型为空:{}", JSON.toJSONString(this));
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
String occName = DeviceNameChangerManage.findMatch(this.type, this.devName);
|
String occName = DeviceNameChangerManage.findMatch(nameChanger, this.type, this.devName);
|
||||||
// if (this.type == DeviceType.DEVICE_TYPE_SWITCH && StringUtils.startsWith(occName, "DG")) {
|
// if (this.type == DeviceType.DEVICE_TYPE_SWITCH && StringUtils.startsWith(occName, "DG")) {
|
||||||
// this.type = DeviceType.DEVICE_TYPE_TRACK;
|
// this.type = DeviceType.DEVICE_TYPE_TRACK;
|
||||||
// }
|
// }
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package club.joylink.xiannccda.ats.message.line3.rep;
|
package club.joylink.xiannccda.ats.message.line3.rep;
|
||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.MessageResponse;
|
import club.joylink.xiannccda.ats.message.MessageResponse;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import club.joylink.xiannccda.ats.message.line3.DateTimeUtil;
|
import club.joylink.xiannccda.ats.message.line3.DateTimeUtil;
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.ScheduleSubIdType;
|
import club.joylink.xiannccda.ats.message.line3.device.ScheduleSubIdType;
|
||||||
import club.joylink.xiannccda.ats.message.line3.rep.EntityParseUtil.ReadData;
|
import club.joylink.xiannccda.ats.message.line3.rep.EntityParseUtil.ReadData;
|
||||||
@ -83,7 +84,7 @@ public class InusedScheduleResponse extends MessageResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<GeneratedMessageV3.Builder> generateProto() {
|
public List<GeneratedMessageV3.Builder> generateProto(NameChangerEnum nameChanger) {
|
||||||
List<GeneratedMessageV3.Builder> planBuilds = Lists.newArrayList();
|
List<GeneratedMessageV3.Builder> planBuilds = Lists.newArrayList();
|
||||||
if (CollectionUtils.isEmpty(this.entityList)) {
|
if (CollectionUtils.isEmpty(this.entityList)) {
|
||||||
Plan.Builder planBuild = Plan.newBuilder();
|
Plan.Builder planBuild = Plan.newBuilder();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package club.joylink.xiannccda.ats.message.line3.rep;
|
package club.joylink.xiannccda.ats.message.line3.rep;
|
||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.MessageResponse;
|
import club.joylink.xiannccda.ats.message.MessageResponse;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import club.joylink.xiannccda.ats.message.line3.MessageCons;
|
import club.joylink.xiannccda.ats.message.line3.MessageCons;
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto;
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto;
|
||||||
@ -48,7 +49,7 @@ public class TrainBlockInfoResponse extends MessageResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Builder> generateProto() {
|
public List<Builder> generateProto(NameChangerEnum nameChanger) {
|
||||||
List<GeneratedMessageV3.Builder> builders = Lists.newArrayList();
|
List<GeneratedMessageV3.Builder> builders = Lists.newArrayList();
|
||||||
for (TrainCell train : this.trains) {
|
for (TrainCell train : this.trains) {
|
||||||
TrainBlock.Builder builder = TrainBlock.newBuilder();
|
TrainBlock.Builder builder = TrainBlock.newBuilder();
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
package club.joylink.xiannccda.ats.message.line3.rep;
|
package club.joylink.xiannccda.ats.message.line3.rep;
|
||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.MessageResponse;
|
import club.joylink.xiannccda.ats.message.MessageResponse;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import club.joylink.xiannccda.ats.message.convertor.DeviceStatusConvertor;
|
import club.joylink.xiannccda.ats.message.convertor.DeviceStatusConvertor;
|
||||||
import club.joylink.xiannccda.ats.message.line3.DateTimeUtil;
|
import club.joylink.xiannccda.ats.message.line3.DateTimeUtil;
|
||||||
import club.joylink.xiannccda.ats.message.line3.MessageCons;
|
import club.joylink.xiannccda.ats.message.line3.MessageCons;
|
||||||
import club.joylink.xiannccda.ats.message.line3.changer.DeviceNameChangerManage;
|
import club.joylink.xiannccda.ats.message.changer.DeviceNameChangerManage;
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceStatus;
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceStatus;
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto;
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto;
|
||||||
@ -54,7 +55,7 @@ public class TrainIndicationInitResponse extends MessageResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Builder> generateProto() {
|
public List<Builder> generateProto(NameChangerEnum nameChanger) {
|
||||||
List<Builder> msgBuildList = Lists.newArrayList();
|
List<Builder> msgBuildList = Lists.newArrayList();
|
||||||
for (TrainCell trainCell : this.trains) {
|
for (TrainCell trainCell : this.trains) {
|
||||||
TrainInfo.Builder builder = TrainInfo.newBuilder();
|
TrainInfo.Builder builder = TrainInfo.newBuilder();
|
||||||
@ -75,7 +76,7 @@ public class TrainIndicationInitResponse extends MessageResponse {
|
|||||||
|
|
||||||
}
|
}
|
||||||
// builder.setDevName(StringUtils.defaultString(trainCell.getDevName(), ""));
|
// builder.setDevName(StringUtils.defaultString(trainCell.getDevName(), ""));
|
||||||
String occName = DeviceNameChangerManage.findMatch(trainCell.getDevType(), trainCell.getDevName());
|
String occName = DeviceNameChangerManage.findMatch(nameChanger, trainCell.getDevType(), trainCell.getDevName());
|
||||||
builder.setDevName(occName);
|
builder.setDevName(occName);
|
||||||
if (trainCell.devType == DeviceType.DEVICE_TYPE_SWITCH) {
|
if (trainCell.devType == DeviceType.DEVICE_TYPE_SWITCH) {
|
||||||
//车辆在道岔时,转换对应的设备类型
|
//车辆在道岔时,转换对应的设备类型
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package club.joylink.xiannccda.ats.message.line3.rep;
|
package club.joylink.xiannccda.ats.message.line3.rep;
|
||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.MessageResponse;
|
import club.joylink.xiannccda.ats.message.MessageResponse;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import club.joylink.xiannccda.ats.message.line3.MessageCons;
|
import club.joylink.xiannccda.ats.message.line3.MessageCons;
|
||||||
import club.joylink.xiannccda.ats.message.line3.changer.DeviceNameChangerManage;
|
import club.joylink.xiannccda.ats.message.changer.DeviceNameChangerManage;
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto;
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto;
|
||||||
import club.joylink.xiannccda.dto.protos.TrainProto.NccWindow;
|
import club.joylink.xiannccda.dto.protos.TrainProto.NccWindow;
|
||||||
@ -79,7 +80,7 @@ public class TrainIndicationRemoveResponse extends MessageResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Builder> generateProto() {
|
public List<Builder> generateProto(NameChangerEnum nameChanger) {
|
||||||
TrainRemove.Builder trainRemove = TrainRemove.newBuilder();
|
TrainRemove.Builder trainRemove = TrainRemove.newBuilder();
|
||||||
trainRemove.setReceiveTime(System.currentTimeMillis());
|
trainRemove.setReceiveTime(System.currentTimeMillis());
|
||||||
if (Objects.nonNull(this.lineId)) {
|
if (Objects.nonNull(this.lineId)) {
|
||||||
@ -100,7 +101,7 @@ public class TrainIndicationRemoveResponse extends MessageResponse {
|
|||||||
trainRemove.setDeviceType(DeviceStatusProto.DeviceType.forNumber(this.devType.getVal()));
|
trainRemove.setDeviceType(DeviceStatusProto.DeviceType.forNumber(this.devType.getVal()));
|
||||||
}
|
}
|
||||||
// trainRemove.setDevName(StringUtils.defaultString(this.devName, ""));
|
// trainRemove.setDevName(StringUtils.defaultString(this.devName, ""));
|
||||||
String occName = DeviceNameChangerManage.findMatch(this.devType, this.devName);
|
String occName = DeviceNameChangerManage.findMatch(nameChanger, this.devType, this.devName);
|
||||||
trainRemove.setDevName(occName);
|
trainRemove.setDevName(occName);
|
||||||
if (this.devType == DeviceType.DEVICE_TYPE_SWITCH) {
|
if (this.devType == DeviceType.DEVICE_TYPE_SWITCH) {
|
||||||
//车辆在道岔时,转换对应的设备类型
|
//车辆在道岔时,转换对应的设备类型
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
package club.joylink.xiannccda.ats.message.line3.rep;
|
package club.joylink.xiannccda.ats.message.line3.rep;
|
||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.MessageResponse;
|
import club.joylink.xiannccda.ats.message.MessageResponse;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import club.joylink.xiannccda.ats.message.convertor.DeviceStatusConvertor;
|
import club.joylink.xiannccda.ats.message.convertor.DeviceStatusConvertor;
|
||||||
import club.joylink.xiannccda.ats.message.line3.DateTimeUtil;
|
import club.joylink.xiannccda.ats.message.line3.DateTimeUtil;
|
||||||
import club.joylink.xiannccda.ats.message.line3.MessageCons;
|
import club.joylink.xiannccda.ats.message.line3.MessageCons;
|
||||||
import club.joylink.xiannccda.ats.message.line3.changer.DeviceNameChangerManage;
|
import club.joylink.xiannccda.ats.message.changer.DeviceNameChangerManage;
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceStatus;
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceStatus;
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto;
|
import club.joylink.xiannccda.dto.protos.DeviceStatusProto;
|
||||||
@ -20,7 +21,6 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -127,7 +127,7 @@ public class TrainIndicationUpdateResponse extends MessageResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Builder> generateProto() {
|
public List<Builder> generateProto(NameChangerEnum nameChanger) {
|
||||||
TrainProto.TrainInfo.Builder train = TrainInfo.newBuilder();
|
TrainProto.TrainInfo.Builder train = TrainInfo.newBuilder();
|
||||||
train.setReceiveTime(System.currentTimeMillis());
|
train.setReceiveTime(System.currentTimeMillis());
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ public class TrainIndicationUpdateResponse extends MessageResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// train.setDevName(StringUtils.defaultString(this.devName, ""));
|
// train.setDevName(StringUtils.defaultString(this.devName, ""));
|
||||||
String occName = DeviceNameChangerManage.findMatch(this.devType, this.devName);
|
String occName = DeviceNameChangerManage.findMatch(nameChanger, this.devType, this.devName);
|
||||||
train.setDevName(occName);
|
train.setDevName(occName);
|
||||||
if (this.devType == DeviceType.DEVICE_TYPE_SWITCH) {
|
if (this.devType == DeviceType.DEVICE_TYPE_SWITCH) {
|
||||||
//车辆在道岔时,转换对应的设备类型
|
//车辆在道岔时,转换对应的设备类型
|
||||||
|
@ -1,16 +1,13 @@
|
|||||||
package club.joylink.xiannccda.ats.message.line3.rep;
|
package club.joylink.xiannccda.ats.message.line3.rep;
|
||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.MessageResponse;
|
import club.joylink.xiannccda.ats.message.MessageResponse;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import club.joylink.xiannccda.ats.message.line3.DateTimeUtil;
|
import club.joylink.xiannccda.ats.message.line3.DateTimeUtil;
|
||||||
import club.joylink.xiannccda.ats.message.line3.MessageCons;
|
import club.joylink.xiannccda.ats.message.line3.MessageCons;
|
||||||
import club.joylink.xiannccda.ats.message.line3.changer.DeviceNameChangerManage;
|
import club.joylink.xiannccda.ats.message.changer.DeviceNameChangerManage;
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||||
import club.joylink.xiannccda.ats.message.line3.rep.TrainIndicationInitResponse.TrainCell;
|
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto;
|
|
||||||
import club.joylink.xiannccda.dto.protos.TrainProto.TrainInfo;
|
|
||||||
import club.joylink.xiannccda.dto.protos.TrainProto.TrainRecord;
|
import club.joylink.xiannccda.dto.protos.TrainProto.TrainRecord;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.protobuf.GeneratedMessageV3;
|
|
||||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
@ -133,7 +130,7 @@ public class TrainRecordResponse extends MessageResponse {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Builder> generateProto() {
|
public List<Builder> generateProto(NameChangerEnum nameChanger) {
|
||||||
TrainRecord.Builder builder = TrainRecord.newBuilder();
|
TrainRecord.Builder builder = TrainRecord.newBuilder();
|
||||||
builder.setReceiveTime(System.currentTimeMillis());
|
builder.setReceiveTime(System.currentTimeMillis());
|
||||||
|
|
||||||
@ -164,7 +161,7 @@ public class TrainRecordResponse extends MessageResponse {
|
|||||||
builder.setSideId(this.getSideId());
|
builder.setSideId(this.getSideId());
|
||||||
}
|
}
|
||||||
builder.setTrackName(StringUtils.defaultString(this.trackName, ""));
|
builder.setTrackName(StringUtils.defaultString(this.trackName, ""));
|
||||||
String deviceName = DeviceNameChangerManage.findMatch(DeviceType.DEVICE_TYPE_TRACK, builder.getTrackName());
|
String deviceName = DeviceNameChangerManage.findMatch(nameChanger, DeviceType.DEVICE_TYPE_TRACK, builder.getTrackName());
|
||||||
builder.setTrackName(deviceName);
|
builder.setTrackName(deviceName);
|
||||||
if (this.getRecordType() != null) {
|
if (this.getRecordType() != null) {
|
||||||
builder.setRecordType(this.getRecordType());
|
builder.setRecordType(this.getRecordType());
|
||||||
|
@ -4,7 +4,7 @@ import club.joylink.xiannccda.alert.core.AlertSourceEventListener;
|
|||||||
import club.joylink.xiannccda.ats.message.line3.rep.TrainRecordResponse.DirectionEnum;
|
import club.joylink.xiannccda.ats.message.line3.rep.TrainRecordResponse.DirectionEnum;
|
||||||
import club.joylink.xiannccda.ats.warn.DeviceAlertEvent;
|
import club.joylink.xiannccda.ats.warn.DeviceAlertEvent;
|
||||||
import club.joylink.xiannccda.ats.warn.platform.TrainReacrdAlertListener.TrainRecordAlertEvent;
|
import club.joylink.xiannccda.ats.warn.platform.TrainReacrdAlertListener.TrainRecordAlertEvent;
|
||||||
import club.joylink.xiannccda.configuration.pros.OccNotHandlePros;
|
|
||||||
import club.joylink.xiannccda.dto.protos.TrainProto.TrainRecord;
|
import club.joylink.xiannccda.dto.protos.TrainProto.TrainRecord;
|
||||||
import club.joylink.xiannccda.dto.protos.TrainProto.TrainRecord.Builder;
|
import club.joylink.xiannccda.dto.protos.TrainProto.TrainRecord.Builder;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -17,8 +17,7 @@ import org.springframework.stereotype.Component;
|
|||||||
public class TrainReacrdAlertListener implements AlertSourceEventListener<TrainRecordAlertEvent> {
|
public class TrainReacrdAlertListener implements AlertSourceEventListener<TrainRecordAlertEvent> {
|
||||||
|
|
||||||
private final PlatformAlertMonitoringTask platformAlertMonitoringTask;
|
private final PlatformAlertMonitoringTask platformAlertMonitoringTask;
|
||||||
@Autowired
|
|
||||||
private OccNotHandlePros notHandlePros;
|
|
||||||
|
|
||||||
public TrainReacrdAlertListener(PlatformAlertMonitoringTask platformAlertMonitoringTask) {
|
public TrainReacrdAlertListener(PlatformAlertMonitoringTask platformAlertMonitoringTask) {
|
||||||
this.platformAlertMonitoringTask = platformAlertMonitoringTask;
|
this.platformAlertMonitoringTask = platformAlertMonitoringTask;
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
package club.joylink.xiannccda.configuration.pros;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Component
|
|
||||||
@ConfigurationProperties(prefix = "occ-not-handle")
|
|
||||||
public class OccNotHandlePros {
|
|
||||||
|
|
||||||
private Integer lineId;
|
|
||||||
private List<Integer> filterRtuIds;
|
|
||||||
private Map<Integer, List<String>> trainRecordStation;
|
|
||||||
|
|
||||||
public boolean notMatchHandle(Integer lineId, Integer rtuId) {
|
|
||||||
if (Objects.isNull(lineId) || Objects.isNull(rtuId)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (CollectionUtils.isEmpty(this.filterRtuIds)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (this.filterRtuIds.contains(rtuId)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
package club.joylink.xiannccda.constants;
|
package club.joylink.xiannccda.constants;
|
||||||
|
|
||||||
import club.joylink.xiannccda.configuration.pros.OccNotHandlePros;
|
import club.joylink.xiannccda.ats.message.OccMessageManage;
|
||||||
import club.joylink.xiannccda.ws.msg.SystemWarnEvent;
|
import club.joylink.xiannccda.ws.msg.SystemWarnEvent;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.springframework.beans.BeansException;
|
import org.springframework.beans.BeansException;
|
||||||
@ -26,7 +26,7 @@ public class SystemContext implements ApplicationContextAware {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean notMatchRtu(Integer lineId, Integer rtuId) {
|
public static boolean notMatchRtu(Integer lineId, Integer rtuId) {
|
||||||
OccNotHandlePros cu = SystemContext.getAppContext().getBean(OccNotHandlePros.class);
|
OccMessageManage cu = SystemContext.getAppContext().getBean(OccMessageManage.class);
|
||||||
return cu.notMatchHandle(lineId, rtuId);
|
return cu.notMatchHandle(lineId, rtuId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package club.joylink.xiannccda.mock.message;
|
|||||||
import club.joylink.xiannccda.ats.message.MessageData;
|
import club.joylink.xiannccda.ats.message.MessageData;
|
||||||
import club.joylink.xiannccda.ats.message.MessageId;
|
import club.joylink.xiannccda.ats.message.MessageId;
|
||||||
import club.joylink.xiannccda.ats.message.MessageResponse;
|
import club.joylink.xiannccda.ats.message.MessageResponse;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceStatusConvertorManager;
|
import club.joylink.xiannccda.ats.message.collect.DeviceStatusConvertorManager;
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
@ -64,7 +65,7 @@ public class MockLoadData implements ApplicationRunner {
|
|||||||
// .ne(NccMockData::getIsDelete, 1)
|
// .ne(NccMockData::getIsDelete, 1)
|
||||||
.orderBy(true, true, NccMockData::getId);
|
.orderBy(true, true, NccMockData::getId);
|
||||||
List<MessageResponse> dataList = this.nccMockDataService.loadALLData(wrapper);
|
List<MessageResponse> dataList = this.nccMockDataService.loadALLData(wrapper);
|
||||||
DeviceStatusConvertorManager.doConvertor(dataList.stream().map(d -> (MessageData) d).collect(Collectors.toList()));
|
DeviceStatusConvertorManager.doConvertor(NameChangerEnum.UNIVERSAL, dataList.stream().map(d -> (MessageData) d).collect(Collectors.toList()));
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
|
@ -14,12 +14,22 @@ logging:
|
|||||||
com.zaxxer.hikari: debug
|
com.zaxxer.hikari: debug
|
||||||
file:
|
file:
|
||||||
path: /usr/local/joylink/logs/xianncc
|
path: /usr/local/joylink/logs/xianncc
|
||||||
occ:
|
|
||||||
host: localhost
|
occ-client:
|
||||||
realPort: 2603
|
clientInfoMap:
|
||||||
unRealPort: 123
|
3:
|
||||||
lineId: 3
|
server-host: 127.0.0.1
|
||||||
collectorData: false
|
real-port: 2603
|
||||||
|
un-real-port: 5703
|
||||||
|
line-id: 3
|
||||||
|
collector-data: false
|
||||||
|
monitor-handware-change: false
|
||||||
|
receiveMsgTimeout: 6
|
||||||
|
filterRtuIds:
|
||||||
|
- 81
|
||||||
|
- 82
|
||||||
|
nameChanger: UNIVERSAL
|
||||||
|
|
||||||
#故障测试
|
#故障测试
|
||||||
mock-alert-test: false
|
mock-alert-test: false
|
||||||
#加载历史模拟数据
|
#加载历史模拟数据
|
||||||
|
@ -13,11 +13,19 @@ logging:
|
|||||||
file:
|
file:
|
||||||
path: /usr/local/joylink/logs/xianncc
|
path: /usr/local/joylink/logs/xianncc
|
||||||
occ:
|
occ:
|
||||||
host: localhost
|
clientInfoMap:
|
||||||
realPort: 2603
|
3:
|
||||||
unRealPort: 123
|
nameChanger: UNIVERSAL
|
||||||
lineId: 3
|
server-host: 127.0.0.1
|
||||||
collectorData: false
|
real-port: 2603
|
||||||
|
un-real-port: 5703
|
||||||
|
line-id: 3
|
||||||
|
collector-data: false
|
||||||
|
monitor-handware-change: false
|
||||||
|
receiveMsgTimeout: 6
|
||||||
|
filterRtuIds:
|
||||||
|
- 81
|
||||||
|
- 82
|
||||||
#故障测试
|
#故障测试
|
||||||
mock-alert-test: true
|
mock-alert-test: true
|
||||||
#加载历史模拟数据
|
#加载历史模拟数据
|
||||||
|
@ -15,14 +15,22 @@ logging:
|
|||||||
path: /usr/xianncc
|
path: /usr/xianncc
|
||||||
max-size: 40MB
|
max-size: 40MB
|
||||||
|
|
||||||
occ:
|
occ-client:
|
||||||
host: 127.0.0.1
|
clientInfoMap:
|
||||||
realPort: 2603
|
3:
|
||||||
# host: 10.255.11.15
|
server-host: 127.0.0.1
|
||||||
# realPort: 5603
|
real-port: 2603
|
||||||
unRealPort: 5703
|
un-real-port: 5703
|
||||||
lineId: 3
|
line-id: 3
|
||||||
collectorData: false
|
collector-data: false
|
||||||
|
monitor-handware-change: false
|
||||||
|
receiveMsgTimeout: 6
|
||||||
|
filterRtuIds:
|
||||||
|
- 81
|
||||||
|
- 82
|
||||||
|
nameChanger: UNIVERSAL
|
||||||
|
|
||||||
|
|
||||||
mock-alert-test: true
|
mock-alert-test: true
|
||||||
load-mock-history-data: false
|
load-mock-history-data: false
|
||||||
#延时加载告警处理
|
#延时加载告警处理
|
||||||
|
@ -19,12 +19,20 @@ logging:
|
|||||||
club.joylink.xiannccda.ats.message.line3.rep: debug
|
club.joylink.xiannccda.ats.message.line3.rep: debug
|
||||||
club.joylink.xiannccda.mapper: debug
|
club.joylink.xiannccda.mapper: debug
|
||||||
com.zaxxer.hikari: debug
|
com.zaxxer.hikari: debug
|
||||||
occ:
|
occ-client:
|
||||||
host: 10.255.11.15
|
clientInfoMap:
|
||||||
realPort: 5603
|
3:
|
||||||
unRealPort: 5703
|
nameChanger: UNIVERSAL
|
||||||
lineId: 3
|
server-host: 10.255.11.15
|
||||||
collectorData: false
|
real-port: 5603
|
||||||
|
un-real-port: 5703
|
||||||
|
collector-data: false
|
||||||
|
monitor-handware-change: false
|
||||||
|
receiveMsgTimeout: 6
|
||||||
|
filterRtuIds:
|
||||||
|
- 81
|
||||||
|
- 82
|
||||||
|
|
||||||
mock-alert-test: false
|
mock-alert-test: false
|
||||||
load-mock-history-data: false
|
load-mock-history-data: false
|
||||||
#延时加载告警处理
|
#延时加载告警处理
|
||||||
|
@ -16,12 +16,20 @@ logging:
|
|||||||
level:
|
level:
|
||||||
root: "info"
|
root: "info"
|
||||||
|
|
||||||
occ:
|
occ-client:
|
||||||
host: 10.255.11.15
|
clientInfoMap:
|
||||||
realPort: 5603
|
3:
|
||||||
unRealPort: 5703
|
nameChanger: UNIVERSAL
|
||||||
lineId: 3
|
server-host: 10.255.11.15
|
||||||
collectorData: false
|
real-port: 5603
|
||||||
|
un-real-port: 5703
|
||||||
|
collector-data: false
|
||||||
|
monitor-handware-change: false
|
||||||
|
receiveMsgTimeout: 6
|
||||||
|
filterRtuIds:
|
||||||
|
- 81
|
||||||
|
- 82
|
||||||
|
|
||||||
mock-alert-test: false
|
mock-alert-test: false
|
||||||
load-mock-history-data: false
|
load-mock-history-data: false
|
||||||
#延时加载告警处理
|
#延时加载告警处理
|
||||||
|
@ -3,6 +3,7 @@ package club.joylink.xiannccda.device;
|
|||||||
import club.joylink.xiannccda.ats.message.MessageData;
|
import club.joylink.xiannccda.ats.message.MessageData;
|
||||||
import club.joylink.xiannccda.ats.message.MessageId;
|
import club.joylink.xiannccda.ats.message.MessageId;
|
||||||
import club.joylink.xiannccda.ats.message.MessageResponse;
|
import club.joylink.xiannccda.ats.message.MessageResponse;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataOperate;
|
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataOperate;
|
||||||
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataRepository;
|
import club.joylink.xiannccda.ats.message.collect.DeviceStatusDataRepository;
|
||||||
import club.joylink.xiannccda.ats.message.convertor.DeviceStatusConvertor;
|
import club.joylink.xiannccda.ats.message.convertor.DeviceStatusConvertor;
|
||||||
@ -136,7 +137,7 @@ public class DeviceStatusTest {
|
|||||||
Set<Integer> rtuSet = new HashSet<>();
|
Set<Integer> rtuSet = new HashSet<>();
|
||||||
|
|
||||||
for (MessageResponse messageDatum : messageData) {
|
for (MessageResponse messageDatum : messageData) {
|
||||||
List<? extends GeneratedMessageV3.Builder> msgs = messageDatum.generateProto();
|
List<? extends GeneratedMessageV3.Builder> msgs = messageDatum.generateProto(NameChangerEnum.UNIVERSAL);
|
||||||
for (Builder msg : msgs) {
|
for (Builder msg : msgs) {
|
||||||
Integer rtuId = DeviceStatusDataOperate.findFieldVal(msg, "rtuId", Integer.class);
|
Integer rtuId = DeviceStatusDataOperate.findFieldVal(msg, "rtuId", Integer.class);
|
||||||
rtuSet.add(rtuId);
|
rtuSet.add(rtuId);
|
||||||
|
@ -3,6 +3,7 @@ package club.joylink.xiannccda.device;
|
|||||||
import club.joylink.xiannccda.ats.message.MessageData;
|
import club.joylink.xiannccda.ats.message.MessageData;
|
||||||
import club.joylink.xiannccda.ats.message.MessageId;
|
import club.joylink.xiannccda.ats.message.MessageId;
|
||||||
import club.joylink.xiannccda.ats.message.MessageResponse;
|
import club.joylink.xiannccda.ats.message.MessageResponse;
|
||||||
|
import club.joylink.xiannccda.ats.message.changer.NameChangerEnum;
|
||||||
import club.joylink.xiannccda.ats.message.convertor.DeviceStatusConvertor;
|
import club.joylink.xiannccda.ats.message.convertor.DeviceStatusConvertor;
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceStatus;
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceStatus;
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceStatus.PLATFORM;
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceStatus.PLATFORM;
|
||||||
@ -205,9 +206,9 @@ public class TrainDataTest {
|
|||||||
|
|
||||||
List<MessageResponse> messageData = this.dataService.loadALLData(wrapper);
|
List<MessageResponse> messageData = this.dataService.loadALLData(wrapper);
|
||||||
for (MessageResponse messageDatum : messageData) {
|
for (MessageResponse messageDatum : messageData) {
|
||||||
List<? extends GeneratedMessageV3.Builder> msgs = messageDatum.generateProto();
|
List<? extends GeneratedMessageV3.Builder> msgs = messageDatum.generateProto(NameChangerEnum.UNIVERSAL);
|
||||||
System.out.println(messageDatum);
|
System.out.println(messageDatum);
|
||||||
System.out.println(messageDatum.generateProto());
|
System.out.println(messageDatum.generateProto(NameChangerEnum.UNIVERSAL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package club.joylink.xiannccda.util;
|
package club.joylink.xiannccda.util;
|
||||||
|
|
||||||
import club.joylink.xiannccda.ats.message.line3.changer.DeviceNameChangerManage;
|
import club.joylink.xiannccda.ats.message.changer.DeviceNameChangerManage;
|
||||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||||
import com.alibaba.fastjson2.JSONArray;
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
@ -86,7 +86,7 @@ public abstract class Device {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String changeDeviceName(String nccDeviceName) {
|
public String changeDeviceName(String nccDeviceName) {
|
||||||
return DeviceNameChangerManage.findMatch(DeviceType.DEVICE_TYPE_SWITCH, nccDeviceName);
|
return DeviceNameChangerManage.findMatch(3, DeviceType.DEVICE_TYPE_SWITCH, nccDeviceName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,10 +114,8 @@ public abstract class Device {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
String changeDeviceName(String nccDeviceName) {
|
String changeDeviceName(String nccDeviceName) {
|
||||||
if (StringUtils.equals(nccDeviceName, "T13301C")) {
|
|
||||||
System.out.println("aaaaaaaaaaaaaa");
|
return DeviceNameChangerManage.findMatch(3, DeviceType.DEVICE_TYPE_TRACK, nccDeviceName);
|
||||||
}
|
|
||||||
return DeviceNameChangerManage.findMatch(DeviceType.DEVICE_TYPE_TRACK, nccDeviceName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +129,7 @@ public abstract class Device {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
String changeDeviceName(String nccDeviceName) {
|
String changeDeviceName(String nccDeviceName) {
|
||||||
return DeviceNameChangerManage.findMatch(DeviceType.DEVICE_TYPE_SIGNAL, nccDeviceName);
|
return DeviceNameChangerManage.findMatch(3, DeviceType.DEVICE_TYPE_SIGNAL, nccDeviceName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user