From c185de12314b8733f23ed7856e6d1e87ee95c1ca Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 14 二月 2025 15:09:59 +0800
Subject: [PATCH] jtt808初始化
---
server/jtt808_parent/jtt808-server/src/main/java/org/yzh/web/endpoint/JTHandlerInterceptor.java | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/server/jtt808_parent/jtt808-server/src/main/java/org/yzh/web/endpoint/JTHandlerInterceptor.java b/server/jtt808_parent/jtt808-server/src/main/java/org/yzh/web/endpoint/JTHandlerInterceptor.java
index 7669668..6f7fb19 100644
--- a/server/jtt808_parent/jtt808-server/src/main/java/org/yzh/web/endpoint/JTHandlerInterceptor.java
+++ b/server/jtt808_parent/jtt808-server/src/main/java/org/yzh/web/endpoint/JTHandlerInterceptor.java
@@ -1,15 +1,24 @@
package org.yzh.web.endpoint;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
import io.github.yezhihao.netmc.core.HandlerInterceptor;
import io.github.yezhihao.netmc.session.Session;
+import netscape.javascript.JSObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.yzh.commons.util.Byte2NumberUtils;
import org.yzh.protocol.basics.JTMessage;
import org.yzh.protocol.commons.JT808;
+import org.yzh.protocol.commons.transform.AttributeKey;
+import org.yzh.protocol.commons.transform.attribute.Battery;
import org.yzh.protocol.t808.T0001;
import org.yzh.protocol.t808.T0200;
import org.yzh.web.model.entity.DeviceDO;
import org.yzh.web.model.enums.SessionKey;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
public class JTHandlerInterceptor implements HandlerInterceptor<JTMessage> {
@@ -73,8 +82,16 @@
boolean transform = request.transform();
if (messageId == JT808.浣嶇疆淇℃伅姹囨姤) {
DeviceDO device = SessionKey.getDevice(session);
- if (device != null)
+ if (device != null){
device.setLocation((T0200) request);
+ if(device.getLocation()!=null && device.getLocation().getAttributes()!=null ){
+ Battery battery= (Battery) device.getLocation().getAttributes().get(AttributeKey.Battery);
+ if(battery !=null){
+ device.setBatteryVoltage(battery.getVoltage());
+ }
+ }
+ }
+
return transform;
}
if (!session.isRegistered()) {
--
Gitblit v1.9.3