Merge branch 'master' of https://git.code.tencent.com/xian-ncc-da/xian-ncc-da-server
This commit is contained in:
commit
4c1c7ff020
@ -70,21 +70,20 @@ public class LineDeviceMessageServer implements IMessageServer {
|
|||||||
@Override
|
@Override
|
||||||
public List<TopicMessage> onTick() {
|
public List<TopicMessage> onTick() {
|
||||||
if (this.lineIdSet.isEmpty()) {
|
if (this.lineIdSet.isEmpty()) {
|
||||||
return null;
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
List<TopicMessage> messages = Lists.newArrayList();
|
List<TopicMessage> messages = Lists.newArrayList();
|
||||||
for (String lineId : this.lineIdSet) {
|
for (String lineId : this.lineIdSet) {
|
||||||
DeviceStatusData deviceDataSource = DeviceDataRepository.findDataSouce(lineId, DataTypeEnum.DEVICE);
|
DeviceStatusData deviceDataSource = DeviceDataRepository.findDataSouce(lineId, DataTypeEnum.DEVICE);
|
||||||
if (!deviceDataSource.isStatusVOEmpty()) {
|
String destination = this.createPlace("lineId", lineId);
|
||||||
WsLineMessage.Builder msg = WsLineMessage.newBuilder();
|
if (deviceDataSource.isStatusVOEmpty()) {
|
||||||
fillBuilderFunction((field) -> deviceDataSource.getStatusVOMap().get(field), msg);
|
messages.add(new TopicMessage(destination, null));
|
||||||
DeviceStatusDataOperate.clearStatusVOMap(DeviceStatusDataRepository.getDeviceStatusData(lineId));
|
continue;
|
||||||
String destination = this.createPlace("lineId", lineId);
|
|
||||||
messages.add(new TopicMessage(destination, msg.build().toByteArray()));
|
|
||||||
}
|
}
|
||||||
}
|
WsLineMessage.Builder msg = WsLineMessage.newBuilder();
|
||||||
if (CollectionUtils.isEmpty(messages)) {
|
fillBuilderFunction((field) -> deviceDataSource.getStatusVOMap().get(field), msg);
|
||||||
return null;
|
DeviceStatusDataOperate.clearStatusVOMap(DeviceStatusDataRepository.getDeviceStatusData(lineId));
|
||||||
|
messages.add(new TopicMessage(destination, msg.build().toByteArray()));
|
||||||
}
|
}
|
||||||
return messages;
|
return messages;
|
||||||
}
|
}
|
||||||
|
@ -53,37 +53,29 @@ public class LineTrainMessageServer implements IMessageServer {
|
|||||||
@Override
|
@Override
|
||||||
public List<TopicMessage> onTick() {
|
public List<TopicMessage> onTick() {
|
||||||
if (this.lineIdSet.isEmpty()) {
|
if (this.lineIdSet.isEmpty()) {
|
||||||
return null;
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
List<TopicMessage> messages = Lists.newArrayList();
|
List<TopicMessage> messages = Lists.newArrayList();
|
||||||
for (String lineId : this.lineIdSet) {
|
for (String lineId : this.lineIdSet) {
|
||||||
|
String destination = this.createPlace("lineId", lineId);
|
||||||
TrainDataSource trainInfoData = DeviceDataRepository.findDataSouce(lineId, DataTypeEnum.TRAIN);
|
TrainDataSource trainInfoData = DeviceDataRepository.findDataSouce(lineId, DataTypeEnum.TRAIN);
|
||||||
WsLineTrainMessage.Builder trainMessage = WsLineTrainMessage.newBuilder();
|
if (CollectionUtils.isEmpty(trainInfoData.getAllTrain())) {
|
||||||
if (!CollectionUtils.isEmpty(trainInfoData.getAllTrain())) {
|
messages.add(new TopicMessage(destination, null));
|
||||||
for (TrainInfo.Builder trainInfo : trainInfoData.getAllTrain()) {
|
continue;
|
||||||
trainInfoData.fillBlockOrRecordOrRemove(trainInfo, "TrainBlock", "block");
|
|
||||||
trainInfoData.fillBlockOrRecordOrRemove(trainInfo, "TrainRemove", "remove");
|
|
||||||
trainInfoData.fillBlockOrRecordOrRemove(trainInfo, "TrainRecord", "record");
|
|
||||||
trainInfoData.reput(trainInfo);
|
|
||||||
trainMessage.addTrainInfo(trainInfo);
|
|
||||||
}
|
|
||||||
String destination = this.createPlace("lineId", lineId);
|
|
||||||
messages.add(new TopicMessage(destination, trainMessage.build().toByteArray()));
|
|
||||||
}
|
}
|
||||||
}
|
WsLineTrainMessage.Builder trainMessage = WsLineTrainMessage.newBuilder();
|
||||||
if (CollectionUtils.isEmpty(messages)) {
|
for (TrainInfo.Builder trainInfo : trainInfoData.getAllTrain()) {
|
||||||
return null;
|
trainInfoData.fillBlockOrRecordOrRemove(trainInfo, "TrainBlock", "block");
|
||||||
|
trainInfoData.fillBlockOrRecordOrRemove(trainInfo, "TrainRemove", "remove");
|
||||||
|
trainInfoData.fillBlockOrRecordOrRemove(trainInfo, "TrainRecord", "record");
|
||||||
|
trainInfoData.reput(trainInfo);
|
||||||
|
trainMessage.addTrainInfo(trainInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
messages.add(new TopicMessage(destination, trainMessage.build().toByteArray()));
|
||||||
}
|
}
|
||||||
return messages;
|
return messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
WsLineTrainMessage.Builder trainMessage = WsLineTrainMessage.newBuilder();
|
|
||||||
trainMessage.addTrainInfo(TrainInfo.newBuilder());
|
|
||||||
Map<FieldDescriptor, Object> maper = trainMessage.getAllFields();
|
|
||||||
System.out.println(maper);
|
|
||||||
maper.forEach((k, v) -> {
|
|
||||||
System.out.println(k.getName());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 9a7b4b7a3a912970197155a149a9da463d2a68fc
|
Subproject commit 549aa2ec10bffe292a1a68e278ae824a8502db0b
|
Loading…
Reference in New Issue
Block a user