Pu Zhibing
2025-04-07 4109495b9c51a4bbd8b0a7c3c69093909d2e33e1
ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNBaseMsgVehicleAdded.java
@@ -1,10 +1,14 @@
package com.ruoyi.dataInterchange.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import io.netty.buffer.Unpooled;
import lombok.Data;
/**
 * 补报车辆静态信息请求
 *
 * @author zhibing.pu
 * @Date 2025/3/3 17:24
 */
@@ -19,15 +23,37 @@
    * 车牌颜色
    */
   @JsonProperty("VEHICLE_COLOR")
   private String vehicleColor;
   private int vehicleColor;
   /**
    * 子业务类型标识
    */
   @JsonProperty("DATA_TYPE")
   private String dataType;
   private int dataType;
   /**
    * 后续数据长度
    */
   @JsonProperty("DATA_LENGTH")
   private String dataLength;
   private int dataLength;
   /**
    * 编码报文
    */
   public byte[] encode() {
      ByteBuf byteBuf = Unpooled.buffer(28);
      byte[] bytes1 = this.getVehicleNo().getBytes();
      for (int i = 0; i < 21; i++) {
         if (i < bytes1.length) {
            byteBuf.writeByte(bytes1[i]);
         } else {
            byteBuf.writeByte(0x00);
         }
      }
      byteBuf.writeByte(this.getVehicleColor());
      byteBuf.writeShort(this.getDataType());
      byteBuf.writeInt(this.getDataLength());
      byte[] bytes = ByteBufUtil.getBytes(byteBuf);
      byteBuf.release();
      return bytes;
   }
}