Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
6e740fc924
@ -17,4 +17,5 @@ public abstract class MessageResponse extends MessageData {
|
||||
public List<Builder> generateProto() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ public class OccTcpClientConnection {
|
||||
log.info("发送OCC心跳失败(为与occ连接),尝试断开重连");
|
||||
connection.reconnect();
|
||||
}
|
||||
}, 0, 0, TimeUnit.SECONDS);
|
||||
}, 0, 8, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,9 @@ import club.joylink.xiannccda.ats.message.MessageResponse;
|
||||
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository;
|
||||
import club.joylink.xiannccda.ats.message.collect.DeviceDataRepository.DataTypeEnum;
|
||||
import club.joylink.xiannccda.ats.message.collect.DeviceStatusConvertor;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.google.protobuf.GeneratedMessageV3;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
@ -14,7 +16,9 @@ import java.util.Collection;
|
||||
public abstract class DefaultConvertor extends DeviceStatusConvertor {
|
||||
|
||||
public List<MessageResponse> convertToResponse(List<MessageData> messageDataList) {
|
||||
return messageDataList.stream().filter(d -> d instanceof MessageResponse).map(d -> (MessageResponse) d).toList();
|
||||
return messageDataList.stream()
|
||||
// .filter(d -> d.getMsgId() == this.getMessageId())
|
||||
.filter(d -> d instanceof MessageResponse).map(d -> (MessageResponse) d).toList();
|
||||
}
|
||||
|
||||
public abstract DataTypeEnum dataType();
|
||||
@ -26,8 +30,8 @@ public abstract class DefaultConvertor extends DeviceStatusConvertor {
|
||||
Map<Short, List<MessageResponse>> lineMapper = responseList.stream().collect(Collectors.groupingBy(MessageResponse::getLineId));
|
||||
lineMapper.forEach((k, v) -> {
|
||||
List<GeneratedMessageV3.Builder> builders = v.stream().map(MessageResponse::generateProto).flatMap(Collection::stream).collect(Collectors.toList());
|
||||
|
||||
DeviceDataRepository.add(k.toString(), builders, this.dataType());
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,11 @@
|
||||
package club.joylink.xiannccda.ats.message.line3.rep;
|
||||
|
||||
|
||||
import club.joylink.xiannccda.ats.message.MessageId;
|
||||
import club.joylink.xiannccda.ats.message.MessageResponse;
|
||||
import club.joylink.xiannccda.ats.message.line3.DateTimeUtil;
|
||||
import club.joylink.xiannccda.ats.message.line3.rep.EntityParseUtil.ReadData;
|
||||
import club.joylink.xiannccda.dto.protos.CollectMsgAppend.DeportPlan;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.protobuf.GeneratedMessageV3;
|
||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import java.nio.charset.Charset;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@ -70,64 +62,64 @@ public class DepotPlanResponse extends MessageResponse {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Builder> generateProto() {
|
||||
List<GeneratedMessageV3.Builder> builders = Lists.newArrayList();
|
||||
ZoneOffset zo = ZoneOffset.ofHours(+8);
|
||||
for (DepotPlanEntity entity : this.entityList) {
|
||||
DeportPlan.Builder builder = DeportPlan.newBuilder();
|
||||
builder.setDate(this.date.toEpochSecond(zo));
|
||||
builder.setDepotStation(entity.depotStation);
|
||||
builder.setGroupId(entity.groupId);
|
||||
builder.setDriverId(entity.driverId);
|
||||
builder.setOutFlag(entity.outFlag);
|
||||
builder.setOutSchedule(entity.outSchedule);
|
||||
// 上线时间
|
||||
builder.setOutTime(entity.outTime.toEpochSecond(zo));
|
||||
// 上线车站编号(转换轨所在车站)
|
||||
builder.setOutStation(entity.outStation);
|
||||
// 上线车站站台编号(上线转换轨对应的站台)
|
||||
builder.setOutSide(entity.outSide);
|
||||
// 上线转换轨名称(左对齐,其它空字符填\0)
|
||||
builder.setOutName(entity.outName);
|
||||
// 上线表号
|
||||
builder.setOutName(entity.outName);
|
||||
builder.setOutTrainid(entity.outTrainid);
|
||||
// 上线目的地号
|
||||
builder.setOutTrainid(entity.outTrainid);
|
||||
builder.setOutDestination(entity.outDestination);
|
||||
// 上线车次号
|
||||
builder.setOutGlobalid(entity.outGlobalid);
|
||||
// 上线序列号
|
||||
builder.setOutLocalSubid(entity.outLocalSubid);
|
||||
// 回库状态
|
||||
// 0表示未回库;
|
||||
// 1表示已回库
|
||||
builder.setInFlag(entity.inFlag);
|
||||
// 是否计划车下线属性
|
||||
// 0:否
|
||||
// 1:是
|
||||
builder.setInSchedule(entity.inSchedule);
|
||||
// 下线时间
|
||||
builder.setInTime(entity.inTime.toEpochSecond(zo));
|
||||
// 下线车站编号(转换轨所在车站)
|
||||
builder.setInStation(entity.inStation);
|
||||
// 下线车站站台编号(下线转换轨对应的站台)
|
||||
builder.setInSide(entity.inSide);
|
||||
// 下线转换轨名称
|
||||
builder.setInName(entity.inName);
|
||||
// 下线表号
|
||||
builder.setInTrainid(entity.inTrainid);
|
||||
// 下线目的地号
|
||||
builder.setInDestination(entity.inDestination);
|
||||
// 下线车次号
|
||||
builder.setInGlobalid(entity.inGlobalid);
|
||||
// 下线序列号
|
||||
builder.setInLocalSubid(entity.inLocalSubid);
|
||||
builders.add(builder);
|
||||
}
|
||||
return builders;
|
||||
}
|
||||
// @Override
|
||||
// public List<Builder> generateProto() {
|
||||
// List<GeneratedMessageV3.Builder> builders = Lists.newArrayList();
|
||||
// ZoneOffset zo = ZoneOffset.ofHours(+8);
|
||||
// for (DepotPlanEntity entity : this.entityList) {
|
||||
// DeportPlan.Builder builder = DeportPlan.newBuilder();
|
||||
// builder.setDate(this.date.toEpochSecond(zo));
|
||||
// builder.setDepotStation(entity.depotStation);
|
||||
// builder.setGroupId(entity.groupId);
|
||||
// builder.setDriverId(entity.driverId);
|
||||
// builder.setOutFlag(entity.outFlag);
|
||||
// builder.setOutSchedule(entity.outSchedule);
|
||||
// // 上线时间
|
||||
// builder.setOutTime(entity.outTime.toEpochSecond(zo));
|
||||
// // 上线车站编号(转换轨所在车站)
|
||||
// builder.setOutStation(entity.outStation);
|
||||
// // 上线车站站台编号(上线转换轨对应的站台)
|
||||
// builder.setOutSide(entity.outSide);
|
||||
// // 上线转换轨名称(左对齐,其它空字符填\0)
|
||||
// builder.setOutName(entity.outName);
|
||||
// // 上线表号
|
||||
// builder.setOutName(entity.outName);
|
||||
// builder.setOutTrainid(entity.outTrainid);
|
||||
// // 上线目的地号
|
||||
// builder.setOutTrainid(entity.outTrainid);
|
||||
// builder.setOutDestination(entity.outDestination);
|
||||
// // 上线车次号
|
||||
// builder.setOutGlobalid(entity.outGlobalid);
|
||||
// // 上线序列号
|
||||
// builder.setOutLocalSubid(entity.outLocalSubid);
|
||||
// // 回库状态
|
||||
// // 0表示未回库;
|
||||
// // 1表示已回库
|
||||
// builder.setInFlag(entity.inFlag);
|
||||
// // 是否计划车下线属性
|
||||
// // 0:否
|
||||
// // 1:是
|
||||
// builder.setInSchedule(entity.inSchedule);
|
||||
// // 下线时间
|
||||
// builder.setInTime(entity.inTime.toEpochSecond(zo));
|
||||
// // 下线车站编号(转换轨所在车站)
|
||||
// builder.setInStation(entity.inStation);
|
||||
// // 下线车站站台编号(下线转换轨对应的站台)
|
||||
// builder.setInSide(entity.inSide);
|
||||
// // 下线转换轨名称
|
||||
// builder.setInName(entity.inName);
|
||||
// // 下线表号
|
||||
// builder.setInTrainid(entity.inTrainid);
|
||||
// // 下线目的地号
|
||||
// builder.setInDestination(entity.inDestination);
|
||||
// // 下线车次号
|
||||
// builder.setInGlobalid(entity.inGlobalid);
|
||||
// // 下线序列号
|
||||
// builder.setInLocalSubid(entity.inLocalSubid);
|
||||
// builders.add(builder);
|
||||
// }
|
||||
// return builders;
|
||||
// }
|
||||
|
||||
|
||||
@Getter
|
||||
|
@ -82,7 +82,6 @@ public class DeviceStatusBitmapResponse extends MessageResponse {
|
||||
}
|
||||
}
|
||||
return msgBuildList;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,7 +1,10 @@
|
||||
package club.joylink.xiannccda.ats.message.line3.rep;
|
||||
|
||||
import club.joylink.xiannccda.ats.message.line3.MessageCons;
|
||||
import club.joylink.xiannccda.ats.message.line3.device.DeviceType;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.protobuf.Descriptors.FieldDescriptor;
|
||||
import com.google.protobuf.GeneratedMessageV3;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.util.List;
|
||||
|
||||
@ -34,4 +37,37 @@ public class EntityParseUtil {
|
||||
|
||||
T read(ByteBuf buf);
|
||||
}
|
||||
|
||||
/* public static void fill(GeneratedMessageV3.Builder builder, String name, Object val) {
|
||||
FieldDescriptor fieldDescriptor = builder.getDescriptorForType().findFieldByName(name);
|
||||
builder.setField(fieldDescriptor, val);
|
||||
}
|
||||
|
||||
public static GeneratedMessageV3.Builder switchDeviceType(DeviceType dt) {
|
||||
switch (dt) {
|
||||
case DEVICE_TYPE_SWITCH:
|
||||
return Switch.newBuilder();
|
||||
case DEVICE_TYPE_RTU:
|
||||
return Rtu.newBuilder();
|
||||
case DEVICE_TYPE_PLATFORM:
|
||||
return Platform.newBuilder();
|
||||
case DEVICE_TYPE_TRACK:
|
||||
return Track.newBuilder();
|
||||
case DEVICE_TYPE_ENTRY:
|
||||
return Entry.newBuilder();
|
||||
case DEVICE_TYPE_WATERPROOF_DOOR:
|
||||
return WaterProofDoor.newBuilder();
|
||||
case DEVICE_TYPE_WORK_AREA:
|
||||
return WorkArea.newBuilder();
|
||||
case DEVICE_TYPE_GAMA:
|
||||
return Gama.newBuilder();
|
||||
case DEVICE_TYPE_SIGNAL:
|
||||
return Signal.newBuilder();
|
||||
case DEVICE_TYPE_STATION:
|
||||
return Station.newBuilder();
|
||||
case DEVICE_TYPE_SCADA:
|
||||
return Scada.newBuilder();
|
||||
}
|
||||
return null;
|
||||
}*/
|
||||
}
|
||||
|
@ -3,16 +3,9 @@ package club.joylink.xiannccda.ats.message.line3.rep;
|
||||
import club.joylink.xiannccda.ats.message.MessageResponse;
|
||||
import club.joylink.xiannccda.ats.message.line3.DateTimeUtil;
|
||||
import club.joylink.xiannccda.ats.message.line3.MessageCons;
|
||||
import club.joylink.xiannccda.dto.protos.CollectMsgAppend.InUsedScheduleParameter;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.protobuf.GeneratedMessageV3;
|
||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
@ -63,13 +56,4 @@ public class InUsedScheduleParameterResponse extends MessageResponse {
|
||||
this.inUsedScheduleName = new String(inUsedScheduleName, MessageCons.STRING_CHARSET).trim();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Builder> generateProto() {
|
||||
InUsedScheduleParameter.Builder builder = InUsedScheduleParameter.newBuilder();
|
||||
builder.setLineId(this.lineId);
|
||||
builder.setDate(this.date.toEpochSecond(ZoneOffset.ofHours(+8)));
|
||||
builder.setValid(this.valid);
|
||||
builder.setInusedScheduleName(this.inUsedScheduleName);
|
||||
return List.of(builder);
|
||||
}
|
||||
}
|
||||
|
@ -3,10 +3,6 @@ package club.joylink.xiannccda.ats.message.line3.rep;
|
||||
import club.joylink.xiannccda.ats.message.MessageId;
|
||||
import club.joylink.xiannccda.ats.message.MessageResponse;
|
||||
import club.joylink.xiannccda.ats.message.line3.rep.EntityParseUtil.ReadData;
|
||||
import club.joylink.xiannccda.dto.protos.CollectMsgAppend.SignalRouteStatus;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.protobuf.GeneratedMessageV3;
|
||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@ -60,7 +56,7 @@ public class SignalRouteStatusResponse extends MessageResponse {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
/* @Override
|
||||
public List<Builder> generateProto() {
|
||||
List<GeneratedMessageV3.Builder> builders = Lists.newArrayList();
|
||||
for (SignalStatusEntity signal : this.signals) {
|
||||
@ -75,7 +71,7 @@ public class SignalRouteStatusResponse extends MessageResponse {
|
||||
}
|
||||
}
|
||||
return builders;
|
||||
}
|
||||
}*/
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
@ -129,6 +129,7 @@ public class TrainRecordResponse extends MessageResponse {
|
||||
this.recordTime = DateTimeUtil.convert(recordTime);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Builder> generateProto() {
|
||||
TrainRecord.Builder builder = TrainRecord.newBuilder();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -6384,7 +6384,7 @@ public final class DeviceStatusProto {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 连锁报告道岔占用
|
||||
* 连锁报告道岔占用(非通信车占用- 红色)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusCiOccupied = 1;</code>
|
||||
@ -6394,7 +6394,7 @@ public final class DeviceStatusProto {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* CBTC报告道岔占用
|
||||
* CBTC报告道岔占用(粉)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusCbtcOccupied = 2;</code>
|
||||
@ -6404,7 +6404,7 @@ public final class DeviceStatusProto {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 道岔锁闭
|
||||
* 道岔锁闭(白)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusLocked = 3;</code>
|
||||
@ -6414,7 +6414,7 @@ public final class DeviceStatusProto {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 道岔故障锁闭
|
||||
* 道岔故障锁闭(棕)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusFailLocked = 4;</code>
|
||||
@ -6634,7 +6634,7 @@ public final class DeviceStatusProto {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 道岔封锁
|
||||
* 道岔封锁(单封)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusBlocked2 = 26;</code>
|
||||
@ -6722,7 +6722,7 @@ public final class DeviceStatusProto {
|
||||
private boolean ipSingleSwitchStusCiOccupied_ = false;
|
||||
/**
|
||||
* <pre>
|
||||
* 连锁报告道岔占用
|
||||
* 连锁报告道岔占用(非通信车占用- 红色)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusCiOccupied = 1;</code>
|
||||
@ -6737,7 +6737,7 @@ public final class DeviceStatusProto {
|
||||
private boolean ipSingleSwitchStusCbtcOccupied_ = false;
|
||||
/**
|
||||
* <pre>
|
||||
* CBTC报告道岔占用
|
||||
* CBTC报告道岔占用(粉)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusCbtcOccupied = 2;</code>
|
||||
@ -6752,7 +6752,7 @@ public final class DeviceStatusProto {
|
||||
private boolean ipSingleSwitchStusLocked_ = false;
|
||||
/**
|
||||
* <pre>
|
||||
* 道岔锁闭
|
||||
* 道岔锁闭(白)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusLocked = 3;</code>
|
||||
@ -6767,7 +6767,7 @@ public final class DeviceStatusProto {
|
||||
private boolean ipSingleSwitchStusFailLocked_ = false;
|
||||
/**
|
||||
* <pre>
|
||||
* 道岔故障锁闭
|
||||
* 道岔故障锁闭(棕)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusFailLocked = 4;</code>
|
||||
@ -7097,7 +7097,7 @@ public final class DeviceStatusProto {
|
||||
private boolean ipSingleSwitchStusBlocked2_ = false;
|
||||
/**
|
||||
* <pre>
|
||||
* 道岔封锁
|
||||
* 道岔封锁(单封)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusBlocked2 = 26;</code>
|
||||
@ -8153,7 +8153,7 @@ public final class DeviceStatusProto {
|
||||
private boolean ipSingleSwitchStusCiOccupied_ ;
|
||||
/**
|
||||
* <pre>
|
||||
* 连锁报告道岔占用
|
||||
* 连锁报告道岔占用(非通信车占用- 红色)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusCiOccupied = 1;</code>
|
||||
@ -8165,7 +8165,7 @@ public final class DeviceStatusProto {
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* 连锁报告道岔占用
|
||||
* 连锁报告道岔占用(非通信车占用- 红色)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusCiOccupied = 1;</code>
|
||||
@ -8181,7 +8181,7 @@ public final class DeviceStatusProto {
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* 连锁报告道岔占用
|
||||
* 连锁报告道岔占用(非通信车占用- 红色)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusCiOccupied = 1;</code>
|
||||
@ -8197,7 +8197,7 @@ public final class DeviceStatusProto {
|
||||
private boolean ipSingleSwitchStusCbtcOccupied_ ;
|
||||
/**
|
||||
* <pre>
|
||||
* CBTC报告道岔占用
|
||||
* CBTC报告道岔占用(粉)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusCbtcOccupied = 2;</code>
|
||||
@ -8209,7 +8209,7 @@ public final class DeviceStatusProto {
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* CBTC报告道岔占用
|
||||
* CBTC报告道岔占用(粉)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusCbtcOccupied = 2;</code>
|
||||
@ -8225,7 +8225,7 @@ public final class DeviceStatusProto {
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* CBTC报告道岔占用
|
||||
* CBTC报告道岔占用(粉)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusCbtcOccupied = 2;</code>
|
||||
@ -8241,7 +8241,7 @@ public final class DeviceStatusProto {
|
||||
private boolean ipSingleSwitchStusLocked_ ;
|
||||
/**
|
||||
* <pre>
|
||||
* 道岔锁闭
|
||||
* 道岔锁闭(白)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusLocked = 3;</code>
|
||||
@ -8253,7 +8253,7 @@ public final class DeviceStatusProto {
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* 道岔锁闭
|
||||
* 道岔锁闭(白)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusLocked = 3;</code>
|
||||
@ -8269,7 +8269,7 @@ public final class DeviceStatusProto {
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* 道岔锁闭
|
||||
* 道岔锁闭(白)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusLocked = 3;</code>
|
||||
@ -8285,7 +8285,7 @@ public final class DeviceStatusProto {
|
||||
private boolean ipSingleSwitchStusFailLocked_ ;
|
||||
/**
|
||||
* <pre>
|
||||
* 道岔故障锁闭
|
||||
* 道岔故障锁闭(棕)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusFailLocked = 4;</code>
|
||||
@ -8297,7 +8297,7 @@ public final class DeviceStatusProto {
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* 道岔故障锁闭
|
||||
* 道岔故障锁闭(棕)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusFailLocked = 4;</code>
|
||||
@ -8313,7 +8313,7 @@ public final class DeviceStatusProto {
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* 道岔故障锁闭
|
||||
* 道岔故障锁闭(棕)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusFailLocked = 4;</code>
|
||||
@ -9253,7 +9253,7 @@ public final class DeviceStatusProto {
|
||||
private boolean ipSingleSwitchStusBlocked2_ ;
|
||||
/**
|
||||
* <pre>
|
||||
* 道岔封锁
|
||||
* 道岔封锁(单封)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusBlocked2 = 26;</code>
|
||||
@ -9265,7 +9265,7 @@ public final class DeviceStatusProto {
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* 道岔封锁
|
||||
* 道岔封锁(单封)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusBlocked2 = 26;</code>
|
||||
@ -9281,7 +9281,7 @@ public final class DeviceStatusProto {
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* 道岔封锁
|
||||
* 道岔封锁(单封)
|
||||
* </pre>
|
||||
*
|
||||
* <code>bool ipSingleSwitchStusBlocked2 = 26;</code>
|
||||
|
@ -1,22 +0,0 @@
|
||||
package club.joylink.xiannccda.mapper;
|
||||
|
||||
import club.joylink.xiannccda.mock.message.NccMockData;
|
||||
import club.joylink.xiannccda.mock.message.NccMockDataProtobuf;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author walker-sheng
|
||||
* @since 2023-06-13
|
||||
*/
|
||||
@Mapper
|
||||
public interface NccMockDataProtobufMapper extends BaseMapper<NccMockDataProtobuf> {
|
||||
|
||||
// @Options(resultSetType = ResultSetType.FORWARD_ONLY, fetchSize = 2)
|
||||
// @Select("select * from ncc_mock_data ")
|
||||
// Cursor<NccMockData> findAllForCursor222(@Param("limit") int limit);
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
package club.joylink.xiannccda.mock.message;
|
||||
|
||||
import club.joylink.xiannccda.ats.message.MessageData;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author walker-sheng
|
||||
* @since 2023-06-13
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Accessors(chain = true)
|
||||
@TableName("ncc_mock_data_protobuf")
|
||||
@Schema(name = "NccMockDataProtobuf", description = "$!{table.comment}")
|
||||
public class NccMockDataProtobuf {
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private byte[] mockData;
|
||||
|
||||
private LocalDateTime mockReceiveTime;
|
||||
|
||||
private String msgType;
|
||||
|
||||
private String actionType;
|
||||
|
||||
private String msgId;
|
||||
|
||||
private Short lineId;
|
||||
private String builderType;
|
||||
public static final String ID = "id";
|
||||
|
||||
public static final String MOCK_DATA = "mock_data";
|
||||
|
||||
public static final String MOCK_RECEIVE_TIME = "mock_receive_time";
|
||||
|
||||
public static final String MSG_TYPE = "msg_type";
|
||||
public static final String ACTION_TYPE = "action_type";
|
||||
|
||||
public static final String MSG_ID = "msg_id";
|
||||
|
||||
public static final String line_id = "line_id";
|
||||
public static final String BUILDER_TYPE = "builder_type";
|
||||
|
||||
public enum MsgTypeEnum {
|
||||
REAL_TIME,
|
||||
UNREAL_TIME
|
||||
}
|
||||
|
||||
public enum ActionTypeEnum {
|
||||
ALL,
|
||||
UPDATES
|
||||
}
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<MessageData> datas;
|
||||
}
|
@ -7,10 +7,9 @@ import club.joylink.xiannccda.mock.message.NccMockData.ActionTypeEnum;
|
||||
import club.joylink.xiannccda.mock.message.NccMockData.MsgTypeEnum;
|
||||
import club.joylink.xiannccda.repository.impl.NccMockDataRepository;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONReader;
|
||||
import com.alibaba.fastjson2.JSONReader.Feature;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.google.common.collect.Lists;
|
||||
|
@ -20,7 +20,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
//@Component
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class MockMessageDataHandle {
|
||||
|
||||
|
@ -1,116 +0,0 @@
|
||||
package club.joylink.xiannccda.mock.message.event;
|
||||
|
||||
|
||||
import club.joylink.xiannccda.ats.message.MessageData;
|
||||
import club.joylink.xiannccda.ats.message.MessageId;
|
||||
import club.joylink.xiannccda.ats.message.MessageResponse;
|
||||
import club.joylink.xiannccda.dto.protos.DeviceStatusProto.Switch;
|
||||
import club.joylink.xiannccda.mock.message.NccMockData;
|
||||
import club.joylink.xiannccda.mock.message.NccMockData.ActionTypeEnum;
|
||||
import club.joylink.xiannccda.mock.message.NccMockData.MsgTypeEnum;
|
||||
import club.joylink.xiannccda.mock.message.NccMockDataProtobuf;
|
||||
import club.joylink.xiannccda.repository.INccMockDataProtobufRepository;
|
||||
import club.joylink.xiannccda.repository.INccMockDataRepository;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONWriter.Feature;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.google.protobuf.GeneratedMessageV3;
|
||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||
import com.google.protobuf.Message;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class MockMessageDataProtobufHandle {
|
||||
|
||||
private final INccMockDataProtobufRepository iNccMockDataProtobufRepository;
|
||||
|
||||
@EventListener
|
||||
public void mockData(MockMessageDataEvent event) {
|
||||
Object obj = event.getSource();
|
||||
|
||||
if (obj instanceof List) {
|
||||
List<MessageData> datas = (List<MessageData>) obj;
|
||||
for (MessageData data : datas) {
|
||||
this.insertData(data, event.getTimestamp());
|
||||
}
|
||||
} else if (obj instanceof MessageData data) {
|
||||
this.insertData(data, event.getTimestamp());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void insertData(MessageData data, long timeStamp) {
|
||||
LocalDateTime localDateTime = Instant.ofEpochMilli(timeStamp).atZone(ZoneOffset.ofHours(8)).toLocalDateTime();
|
||||
if (data instanceof MessageResponse response) {
|
||||
List<GeneratedMessageV3.Builder> builders = data.generateProto();
|
||||
if (CollectionUtils.isNotEmpty(builders)) {
|
||||
for (Builder builder : builders) {
|
||||
NccMockDataProtobuf td = new NccMockDataProtobuf();
|
||||
Message message = builder.build();
|
||||
td.setMockData(builder.build().toByteArray());
|
||||
td.setMockReceiveTime(localDateTime);
|
||||
td.setMsgId(data.getMsgId().name());
|
||||
td.setLineId(response.getLineId());
|
||||
this.setMsgType(td, data);
|
||||
td.setBuilderType(message.getClass().getSimpleName());
|
||||
// iNccMockDataRepository.save(td);
|
||||
iNccMockDataProtobufRepository.save(td);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setMsgType(NccMockDataProtobuf td, MessageData md) {
|
||||
if (md.getMsgId() == MessageId.DEVICE_STATUS_BITMAP || md.getMsgId() == MessageId.TRAIN_INDICATION_INIT) {
|
||||
td.setActionType(ActionTypeEnum.ALL.name());
|
||||
}
|
||||
switch (md.getMsgId()) {
|
||||
case NETWORK_ALIVE_STATUS:
|
||||
// case LOAD_DEVICE_STATUS:
|
||||
case DEVICE_STATUS_BITMAP:
|
||||
case DEVICE_STATUS_CHANGE:
|
||||
case SIGNAL_ROUTE_STATUS:
|
||||
case DEPOT_PLAN:
|
||||
case TRAIN_RECORD:
|
||||
case TRAIN_INDICATION_INIT:
|
||||
case TRAIN_INDICATION_UPDATE:
|
||||
case TRAIN_INDICATION_REMOVE:
|
||||
case MESSAGE_ALARM:
|
||||
case TRAIN_BLOCK_INFO:
|
||||
case INUSED_SCHEDULE_PARAMETER:
|
||||
td.setMsgType(MsgTypeEnum.REAL_TIME.name());
|
||||
if (Objects.isNull(td.getActionType())) {
|
||||
td.setActionType(ActionTypeEnum.UPDATES.name());
|
||||
}
|
||||
break;
|
||||
case REPORT_ASK:
|
||||
case REPORT_BEGIN:
|
||||
case REPORT_END:
|
||||
case GROUP_RUNNING_REPORT:
|
||||
case DRIVER_DISTANCE_REPORT:
|
||||
case DISPATCHER_REPORT:
|
||||
case GROUP_BAK_REPORT:
|
||||
case GROUP_STATUS_REPORT:
|
||||
case ALARM_ASK:
|
||||
case ACTION_REPORT:
|
||||
case ALARM_REPORT:
|
||||
case REPORT_NACK:
|
||||
// case LOAD_HISTORY_TG_DATA:
|
||||
case INUSED_SCHEDULE:
|
||||
case LOAD_DEVICE_STATUS:
|
||||
case HISTORY_SCHEDULE:
|
||||
td.setMsgType(MsgTypeEnum.UNREAL_TIME.name());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package club.joylink.xiannccda.repository;
|
||||
|
||||
import club.joylink.xiannccda.mock.message.NccMockDataProtobuf;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface INccMockDataProtobufRepository extends IService<NccMockDataProtobuf> {
|
||||
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package club.joylink.xiannccda.repository.impl;
|
||||
|
||||
import club.joylink.xiannccda.mapper.NccMockDataMapper;
|
||||
import club.joylink.xiannccda.mapper.NccMockDataProtobufMapper;
|
||||
import club.joylink.xiannccda.mock.message.NccMockData;
|
||||
import club.joylink.xiannccda.mock.message.NccMockDataProtobuf;
|
||||
import club.joylink.xiannccda.repository.INccMockDataProtobufRepository;
|
||||
import club.joylink.xiannccda.repository.INccMockDataRepository;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author walker-sheng
|
||||
* @since 2023-06-13
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
public class NccMockDataProtobufRepository extends ServiceImpl<NccMockDataProtobufMapper, NccMockDataProtobuf> implements INccMockDataProtobufRepository {
|
||||
|
||||
|
||||
/* @Override
|
||||
public void dd() {
|
||||
*//*List<NccMockData> ddd = this.getBaseMapper().selectList(new QueryWrapper<>());
|
||||
for (NccMockData mockData : ddd) {
|
||||
System.out.println(mockData.getId() + " -------->");
|
||||
}*//*
|
||||
Cursor<NccMockData> cursor = this.getBaseMapper().findAllForCursor222(10100);
|
||||
for (NccMockData mockData : cursor) {
|
||||
System.out.println(mockData.getId() + " --- >");
|
||||
}
|
||||
System.out.println(cursor.isConsumed());
|
||||
System.out.println(cursor.isOpen());
|
||||
|
||||
}*/
|
||||
}
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
Subproject commit 7567e2953eae654a6de703b6b1dfaedcc53d0e84
|
||||
Subproject commit ec5889fd030d15bc93efdaf8f73d62039bde31a9
|
Loading…
Reference in New Issue
Block a user