From 4ad32c37e3317fb6cb7cbfb034b53d3220c27db4 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期五, 30 五月 2025 17:59:16 +0800
Subject: [PATCH] 优化报警

---
 ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/GnssData.java |   44 ++++++++++++++++++++++++--------------------
 1 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/GnssData.java b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/GnssData.java
index 7ecd796..1d720e1 100644
--- a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/GnssData.java
+++ b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/GnssData.java
@@ -24,12 +24,12 @@
 	/**
 	 * 日月年
 	 */
-	@Field(type = FieldType.Integer)
+	@Field(type = FieldType.Text)
 	private String date;
 	/**
 	 * 时分秒
 	 */
-	@Field(type = FieldType.Integer)
+	@Field(type = FieldType.Text)
 	private String time;
 	/**
 	 * 经度
@@ -81,24 +81,28 @@
 	 * 解析报文
 	 */
 	public GnssData decode(ByteBuf byteBuf) {
-		this.encrypt = byteBuf.readByte();
-		int d = byteBuf.readByte();
-		int m = byteBuf.readByte();
-		int y = byteBuf.readShort();
-		this.date = y + "-" + String.format("%02d", m) + "-" + String.format("%02d", d);
-		int h = byteBuf.readByte();
-		int mi = byteBuf.readByte();
-		int s = byteBuf.readByte();
-		this.time = String.format("%02d", h) + ":" + String.format("%02d", mi) + ":" + String.format("%02d", s);
-		this.lon = byteBuf.readInt();
-		this.lat = byteBuf.readInt();
-		this.vec1 = byteBuf.readShort();
-		this.vec2 = byteBuf.readShort();
-		this.vec3 = byteBuf.readInt();
-		this.direction = byteBuf.readShort();
-		this.altitude = byteBuf.readShort();
-		this.state = byteBuf.readInt();
-		this.alarm = byteBuf.readInt();
+		try {
+			this.encrypt = byteBuf.readByte();
+			int d = byteBuf.readByte();
+			int m = byteBuf.readByte();
+			int y = byteBuf.readShort();
+			this.date = y + "-" + String.format("%02d", m) + "-" + String.format("%02d", d);
+			int h = byteBuf.readByte();
+			int mi = byteBuf.readByte();
+			int s = byteBuf.readByte();
+			this.time = String.format("%02d", h) + ":" + String.format("%02d", mi) + ":" + String.format("%02d", s);
+			this.lon = byteBuf.readInt();
+			this.lat = byteBuf.readInt();
+			this.vec1 = byteBuf.readShort();
+			this.vec2 = byteBuf.readShort();
+			this.vec3 = byteBuf.readInt();
+			this.direction = byteBuf.readShort();
+			this.altitude = byteBuf.readShort();
+			this.state = byteBuf.readInt();
+			this.alarm = byteBuf.readInt();
+		}catch (Exception e){
+			e.printStackTrace();
+		}
 		return this;
 	}
 }

--
Gitblit v1.7.1