diff --git a/src/main/java/club/joylink/xiannccda/ats/message/line3/DispatcherReportResponse.java b/src/main/java/club/joylink/xiannccda/ats/message/line3/DispatcherReportResponse.java index 1fbf168..4237760 100644 --- a/src/main/java/club/joylink/xiannccda/ats/message/line3/DispatcherReportResponse.java +++ b/src/main/java/club/joylink/xiannccda/ats/message/line3/DispatcherReportResponse.java @@ -3,6 +3,8 @@ package club.joylink.xiannccda.ats.message.line3; import club.joylink.xiannccda.ats.message.MessageResponse; import io.netty.buffer.ByteBuf; +import java.nio.charset.StandardCharsets; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; @@ -55,20 +57,36 @@ public class DispatcherReportResponse extends MessageResponse { /** * 日期(7) */ - private byte[] reportTime = new byte[7]; + private LocalDateTime reportTime; /** * 调度员(32) */ - private byte[] userName = new byte[32]; + private String userName; /** * 记录内容(256) */ - private byte[] logItem = new byte[256]; + private String logItem; public LogCell decode(final ByteBuf buf) { - buf.readBytes(this.reportTime); - buf.readBytes(this.userName); - buf.readBytes(this.logItem); + /** + * 日期(7) + */ + final byte[] reportTime = new byte[7]; + /** + * 调度员(32) + */ + final byte[] userName = new byte[32]; + /** + * 记录内容(256) + */ + final byte[] logItem = new byte[256]; + buf.readBytes(reportTime); + buf.readBytes(userName); + buf.readBytes(logItem); + // + this.reportTime = DateTimeUtil.convert(reportTime); + this.userName = new String(userName, MessageCons.STRING_CHARSET); + // return this; } } diff --git a/src/main/java/club/joylink/xiannccda/ats/message/line3/MessageCons.java b/src/main/java/club/joylink/xiannccda/ats/message/line3/MessageCons.java new file mode 100644 index 0000000..7751fac --- /dev/null +++ b/src/main/java/club/joylink/xiannccda/ats/message/line3/MessageCons.java @@ -0,0 +1,11 @@ +package club.joylink.xiannccda.ats.message.line3; + +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; + +public class MessageCons { + /** + * 协议中字符串编码 + */ + public static final Charset STRING_CHARSET = StandardCharsets.UTF_8; +}