From 0dcba4fd1cb536ab426622e31213d8a0194449ff Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期五, 25 四月 2025 14:12:30 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPWarnMsgAdptInfo.java | 48 ++++++++++++++++++++++++++---------------------- 1 files changed, 26 insertions(+), 22 deletions(-) diff --git a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPWarnMsgAdptInfo.java b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPWarnMsgAdptInfo.java index 8f7756c..ae3245e 100644 --- a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPWarnMsgAdptInfo.java +++ b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPWarnMsgAdptInfo.java @@ -117,28 +117,32 @@ * 解析报文 */ public UPWarnMsgAdptInfo decode(WarnMsg warnMsg) { - byte[] data = warnMsg.getData(); - ByteBuf byteBuf = Unpooled.wrappedBuffer(data); - this.vehicleNo = warnMsg.getVehicleNo(); - this.vehicleColor = warnMsg.getVehicleColor(); - this.dataType = warnMsg.getDataType(); - this.dataLength = warnMsg.getDataLength(); - - //报警信息来源 - this.warnSrc = byteBuf.readByte(); - //报警类型 - this.warnType = byteBuf.readShort(); - byte[] readableBytes = new byte[8]; - byteBuf.readBytes(readableBytes); - String time = ByteArrayUtil.bytes2HexStr(readableBytes); - //报警时间 - this.warnTime = Long.parseLong(time, 16); - //信息ID - this.infoId = byteBuf.readInt(); - //报警数据长度 - this.infoLength = byteBuf.readInt(); - //上报报警信息内容 - this.infoContent = Jtt809Util.readGBKString(byteBuf, this.infoLength); + try { + byte[] data = warnMsg.getData(); + ByteBuf byteBuf = Unpooled.wrappedBuffer(data); + this.vehicleNo = warnMsg.getVehicleNo(); + this.vehicleColor = warnMsg.getVehicleColor(); + this.dataType = warnMsg.getDataType(); + this.dataLength = warnMsg.getDataLength(); + + //报警信息来源 + this.warnSrc = byteBuf.readByte(); + //报警类型 + this.warnType = byteBuf.readShort(); + byte[] readableBytes = new byte[8]; + byteBuf.readBytes(readableBytes); + String time = ByteArrayUtil.bytes2HexStr(readableBytes); + //报警时间 + this.warnTime = Long.parseLong(time, 16); + //信息ID + this.infoId = byteBuf.readInt(); + //报警数据长度 + this.infoLength = byteBuf.readInt(); + //上报报警信息内容 + this.infoContent = Jtt809Util.readGBKString(byteBuf, this.infoLength); + }catch (Exception e){ + e.printStackTrace(); + } return this; } } -- Gitblit v1.7.1