Pu Zhibing
21 小时以前 b554a106bc1b06e0320b642d16c31554ae558301
ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPExgMsgHistoryLocation.java
@@ -1,40 +1,77 @@
package com.ruoyi.dataInterchange.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.ruoyi.dataInterchange.pojo.BaseModel;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import lombok.Data;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import java.util.ArrayList;
import java.util.List;
/**
 * 车辆定位信息自动补报请求
 *
 * @author zhibing.pu
 * @Date 2025/2/24 13:40
 */
@Data
public class UPExgMsgHistoryLocation {
@Document(indexName = "up_exg_msg_history_location")
public class UPExgMsgHistoryLocation extends BaseModel {
   /**
    * 车牌号
    */
   @JsonProperty("VEHICLE_NO")
   @Field(type = FieldType.Text)
   private String vehicleNo;
   /**
    * 车牌颜色
    */
   @JsonProperty("VEHICLE_COLOR")
   private String vehicleColor;
   @Field(type = FieldType.Integer)
   private int vehicleColor;
   /**
    * 子业务类型标识
    */
   @JsonProperty("DATA_TYPE")
   private String dataType;
   @Field(type = FieldType.Integer)
   private int dataType;
   /**
    * 后续数据长度
    */
   @JsonProperty("DATA_LENGTH")
   private Integer dataLength;
   @Field(type = FieldType.Integer)
   private int dataLength;
   /**
    * 改数据包里包含的卫星定位数据个数
    */
   @Field(type = FieldType.Integer)
   private int gnssCnt;
   /**
    * GNSS定位数据
    */
   @JsonProperty("GNSS_CNT")
   private List<GnssData> gnssCnt;
   @Field(type = FieldType.Object)
   private List<GnssData> gnssData;
   /**
    * 解析报文
    */
   public UPExgMsgHistoryLocation decode(UPExgMsg exgMsg) {
      try {
         byte[] data = exgMsg.getData();
         ByteBuf byteBuf = Unpooled.wrappedBuffer(data);
         this.vehicleNo = exgMsg.getVehicleNo();
         this.vehicleColor = exgMsg.getVehicleColor();
         this.dataType = exgMsg.getDataType();
         this.dataLength = exgMsg.getDataLength();
         this.gnssCnt = byteBuf.readByte();
         List<GnssData> gnssData = new ArrayList<>();
         for (int i = 0; i < this.gnssCnt; i++) {
            gnssData.add(new GnssData().decode(byteBuf));
         }
         this.gnssData = gnssData;
      }catch (Exception e){
         e.printStackTrace();
      }
      return this;
   }
}