From 297512bc22b179b7038d96a1ff033eceaed38c4b Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期五, 07 三月 2025 19:44:31 +0800
Subject: [PATCH] 新增加809对接逻辑

---
 ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPExgMsgRegister.java |   66 +++++++++++++++++++++++---------
 1 files changed, 47 insertions(+), 19 deletions(-)

diff --git a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPExgMsgRegister.java b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPExgMsgRegister.java
index 219e9c1..81e07f7 100644
--- a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPExgMsgRegister.java
+++ b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPExgMsgRegister.java
@@ -1,63 +1,91 @@
 package com.ruoyi.dataInterchange.model;
 
-import com.fasterxml.jackson.annotation.JsonProperty;
+import com.ruoyi.dataInterchange.pojo.BaseModel;
+import com.ruoyi.dataInterchange.util.jtt809.common.Jtt809Util;
+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:47
  */
 @Data
-public class UPExgMsgRegister {
+@Document(indexName = "up_exg_msg_register")
+public class UPExgMsgRegister 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")
+	@Field(type = FieldType.Integer)
 	private Integer dataLength;
 	/**
 	 * 平台唯一编号,由平台所在地行政区划代码和平台编号组成
 	 */
-	@JsonProperty("PLATFORM_ID")
+	@Field(type = FieldType.Text)
 	private String platformId;
 	/**
 	 * 车载终端厂商唯一编码,由车载终端厂商所在地行政区划代码和厂商ID组成
 	 */
-	@JsonProperty("PRODUCER_ID")
+	@Field(type = FieldType.Text)
 	private String producerId;
 	/**
 	 * 车载终端型号
 	 */
-	@JsonProperty("TERMINAL_MODEL_TYPE")
+	@Field(type = FieldType.Text)
 	private String terminalModelType;
-	/**
-	 * 车载终端通讯模块IMEI码
-	 */
-	@JsonProperty("IMEI_ID")
-	private String imeiId;
 	/**
 	 * 车载终端编号
 	 */
-	@JsonProperty("TERMINAL_ID")
+	@Field(type = FieldType.Text)
 	private String terminalId;
 	/**
 	 * 车载终端SIM卡电话号码
 	 */
-	@JsonProperty("TERMINAL_SIMCODE")
-	private String terminalSimcode;
+	@Field(type = FieldType.Text)
+	private String terminalSIMCode;
+	
+	
+	/**
+	 * 解析报文
+	 */
+	public UPExgMsgRegister decode(UPExgMsg exgMsg) {
+		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.platformId = Jtt809Util.readGBKString(byteBuf, 11);
+		//车载终端厂商唯一编码
+		this.producerId = Jtt809Util.readGBKString(byteBuf, 11);
+		//车载终端型号
+		this.terminalModelType = Jtt809Util.readGBKString(byteBuf, 8);
+		//车载终端编号
+		this.terminalId = Jtt809Util.readGBKString(byteBuf, 7);
+		//车载终端SIM卡电话号码
+		this.terminalSIMCode = Jtt809Util.readGBKString(byteBuf, 12);
+		return this;
+	}
 }

--
Gitblit v1.7.1