From 1ee76c252f2dbba62e0ec34cccf9eaac51de9083 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期三, 23 七月 2025 16:25:23 +0800 Subject: [PATCH] 修改bug --- ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPExgMsgRealLocation.java | 48 +++++++++++++++++++++++++++++++++++++----------- 1 files changed, 37 insertions(+), 11 deletions(-) diff --git a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPExgMsgRealLocation.java b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPExgMsgRealLocation.java index e19a536..6159e39 100644 --- a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPExgMsgRealLocation.java +++ b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPExgMsgRealLocation.java @@ -1,38 +1,64 @@ 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; /** * 上传车辆实时定位信息 + * * @author zhibing.pu * @Date 2025/2/24 11:53 */ @Data -public class UPExgMsgRealLocation { +@Document(indexName = "up_exg_msg_real_location") +public class UPExgMsgRealLocation 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; /** - * 车辆定位信息 + * 定位数据 */ - @JsonProperty("GNSS_DATA") + @Field(type = FieldType.Object) private GnssData gnssData; + + + /** + * 解析报文 + */ + public UPExgMsgRealLocation 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.gnssData = new GnssData().decode(byteBuf); + }catch (Exception e){ + e.printStackTrace(); + } + return this; + } } -- Gitblit v1.7.1