puzhibing
2025-04-25 0dcba4fd1cb536ab426622e31213d8a0194449ff
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;
   }
}