From 3f21cddda071af37e902c98c8e6b0f82dd9dd303 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期三, 04 六月 2025 18:34:01 +0800
Subject: [PATCH] 优化报警附件逻辑

---
 ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPWarnMsgAdptInfo.java |  194 ++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 154 insertions(+), 40 deletions(-)

diff --git a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPWarnMsgAdptInfo.java b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPWarnMsgAdptInfo.java
index 8f7756c..4a1a6f5 100644
--- a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPWarnMsgAdptInfo.java
+++ b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/UPWarnMsgAdptInfo.java
@@ -70,8 +70,70 @@
 	/**
 	 * 信息ID
 	 */
+	@Field(type = FieldType.Text)
+	private String infoId;
+	/**
+	 * 驾驶员姓名长度
+	 */
 	@Field(type = FieldType.Integer)
-	private int infoId;
+	private int driverLength;
+	/**
+	 * 驾驶员姓名
+	 */
+	@Field(type = FieldType.Text)
+	private String driver;
+	/**
+	 * 驾驶员驾照号码长度
+	 */
+	@Field(type = FieldType.Integer)
+	private int driverNoLength;
+	/**
+	 * 驾驶员驾照号码
+	 */
+	@Field(type = FieldType.Text)
+	private String driverNo;
+	/**
+	 * 报警级别 0x001:一级报警,0x002: 二级报警
+	 */
+	@Field(type = FieldType.Integer)
+	private int level;
+	/**
+	 * 经度
+	 */
+	@Field(type = FieldType.Integer)
+	private int longitude;
+	/**
+	 * 纬度
+	 */
+	@Field(type = FieldType.Integer)
+	private int latitude;
+	/**
+	 * 海拔
+	 */
+	@Field(type = FieldType.Integer)
+	private int altitude;
+	/**
+	 * 行车速度
+	 */
+	@Field(type = FieldType.Integer)
+	private int speed;
+	/**
+	 * 行驶记录速度
+	 */
+	@Field(type = FieldType.Integer)
+	private int vec2;
+	/**
+	 * 报警状态
+	 * 1:报警开始
+	 * 2:报警结束
+	 */
+	@Field(type = FieldType.Integer)
+	private int status;
+	/**
+	 * 方向
+	 */
+	@Field(type = FieldType.Integer)
+	private int direction;
 	/**
 	 * 报警数据长度
 	 */
@@ -82,21 +144,6 @@
 	 */
 	@Field(type = FieldType.Text)
 	private String infoContent;
-	/**
-	 * 速度
-	 */
-	@Field(type = FieldType.Integer)
-	private Integer speed;
-	/**
-	 * 经度
-	 */
-	@Field(type = FieldType.Integer)
-	private Integer longitude;
-	/**
-	 * 纬度
-	 */
-	@Field(type = FieldType.Integer)
-	private Integer latitude;
 	/**
 	 * 报警处理结果
 	 * 0x00:处理中
@@ -111,34 +158,101 @@
 	 */
 	@Field(type = FieldType.Long)
 	private long pushTime;
-	
+	/**
+	 * 抓拍图片
+	 */
+	@Field(type = FieldType.Text)
+	private String picUrl;
+
 	
 	/**
 	 * 解析报文
 	 */
-	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);
+	public UPWarnMsgAdptInfo decode1(WarnMsg warnMsg) {
+		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 = Integer.valueOf(byteBuf.readInt()).toString();
+			//报警数据长度
+			this.infoLength = byteBuf.readInt();
+			//上报报警信息内容
+			this.infoContent = Jtt809Util.readGBKString(byteBuf, this.infoLength);
+		}catch (Exception e){
+			e.printStackTrace();
+		}
+		return this;
+	}
+
+	/**
+	 * 解析报文(川标)
+	 */
+	public UPWarnMsgAdptInfo decode2(WarnMsg warnMsg) {
+		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 = Jtt809Util.readGBKString(byteBuf,32);
+			//驾驶员姓名长度
+			this.driverLength = byteBuf.readByte();
+			//驾驶员姓名
+			this.driver = Jtt809Util.readGBKString(byteBuf,this.driverLength);
+			//驾驶员驾照号码长度
+			this.driverNoLength = byteBuf.readByte();
+			//驾驶员驾照号码
+			this.driverNo = Jtt809Util.readGBKString(byteBuf,this.driverNoLength);
+			//报警级别
+			this.level = byteBuf.readByte();
+			//经度
+			this.longitude = byteBuf.readInt();
+			//纬度
+			this.latitude = byteBuf.readInt();
+			//海拔高度
+			this.altitude = byteBuf.readShort();
+			//行车速度
+			this.speed = byteBuf.readShort();
+			//行驶记录速度
+			this.vec2 = byteBuf.readShort();
+			//报警状态
+			this.status = byteBuf.readByte();
+			//方向
+			this.direction = byteBuf.readShort();
+			//报警数据长度
+			this.infoLength = byteBuf.readShort();
+			//报警信息内容
+			this.infoContent = Jtt809Util.readGBKString(byteBuf,this.infoLength);
+		}catch (Exception e){
+			e.printStackTrace();
+		}
 		return this;
 	}
 }

--
Gitblit v1.7.1