接受occ设备转换设备名称

This commit is contained in:
tiger_zhou 2023-07-19 15:24:23 +08:00
parent 03f9fb4807
commit 43cd1bffb0
5 changed files with 14 additions and 0 deletions

View File

@ -2,6 +2,7 @@ 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.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.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;
@ -116,6 +117,9 @@ public class DeviceStatusBitmapResponse extends MessageResponse {
entity.type = DeviceType.of(buf.readShort()); entity.type = DeviceType.of(buf.readShort());
entity.objCount = buf.readShort(); entity.objCount = buf.readShort();
entity.deviceList = EntityParseUtil.collect(entity.objCount, buf, DeviceEntity.class); entity.deviceList = EntityParseUtil.collect(entity.objCount, buf, DeviceEntity.class);
for (DeviceEntity de : entity.deviceList) {
de.devName = DeviceNameChangerManage.findMatch(entity.type, de.devName);
}
return entity; return entity;
} }
} }

View File

@ -3,6 +3,7 @@ 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.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.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;
@ -81,6 +82,7 @@ public class DeviceStatusChangeResponse extends MessageResponse {
this.devName = EntityParseUtil.convertStr(buf, 24); this.devName = EntityParseUtil.convertStr(buf, 24);
this.deviceStatus = buf.readInt(); this.deviceStatus = buf.readInt();
this.spare = buf.readInt(); this.spare = buf.readInt();
this.devName = DeviceNameChangerManage.findMatch(this.type, this.devName);
} }
@Override @Override

View File

@ -4,6 +4,7 @@ import club.joylink.xiannccda.ats.message.MessageResponse;
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.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;
@ -223,6 +224,8 @@ public class TrainIndicationInitResponse extends MessageResponse {
// //
this.devType = DeviceType.of(devType); this.devType = DeviceType.of(devType);
this.devName = new String(devName, MessageCons.STRING_CHARSET).trim(); this.devName = new String(devName, MessageCons.STRING_CHARSET).trim();
this.devName = DeviceNameChangerManage.findMatch(this.devType, this.devName);
this.trainIndex = new String(trainIndex, MessageCons.STRING_CHARSET).trim(); this.trainIndex = new String(trainIndex, MessageCons.STRING_CHARSET).trim();
this.groupId = new String(groupId, MessageCons.STRING_CHARSET).trim(); this.groupId = new String(groupId, MessageCons.STRING_CHARSET).trim();
this.trainId = new String(trainId, MessageCons.STRING_CHARSET).trim(); this.trainId = new String(trainId, MessageCons.STRING_CHARSET).trim();

View File

@ -2,6 +2,7 @@ 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.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.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;
@ -72,6 +73,7 @@ public class TrainIndicationRemoveResponse extends MessageResponse {
// //
this.devType = DeviceType.of(devType); this.devType = DeviceType.of(devType);
this.devName = new String(devName, MessageCons.STRING_CHARSET).trim(); this.devName = new String(devName, MessageCons.STRING_CHARSET).trim();
this.devName = DeviceNameChangerManage.findMatch(this.devType, this.devName);
this.trainIndex = new String(trainIndex, MessageCons.STRING_CHARSET).trim(); this.trainIndex = new String(trainIndex, MessageCons.STRING_CHARSET).trim();
this.groupId = new String(groupId, MessageCons.STRING_CHARSET).trim(); this.groupId = new String(groupId, MessageCons.STRING_CHARSET).trim();
} }

View File

@ -4,6 +4,7 @@ import club.joylink.xiannccda.ats.message.MessageResponse;
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.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;
@ -211,6 +212,8 @@ public class TrainIndicationUpdateResponse extends MessageResponse {
// //
this.devType = DeviceType.of(devType); this.devType = DeviceType.of(devType);
this.devName = new String(devName, MessageCons.STRING_CHARSET).trim(); this.devName = new String(devName, MessageCons.STRING_CHARSET).trim();
this.devName = DeviceNameChangerManage.findMatch(this.devType, this.devName);
this.trainIndex = new String(trainIndex, MessageCons.STRING_CHARSET).trim(); this.trainIndex = new String(trainIndex, MessageCons.STRING_CHARSET).trim();
this.groupId = new String(groupId, MessageCons.STRING_CHARSET).trim(); this.groupId = new String(groupId, MessageCons.STRING_CHARSET).trim();
this.trainId = new String(trainId, MessageCons.STRING_CHARSET).trim(); this.trainId = new String(trainId, MessageCons.STRING_CHARSET).trim();