From 480439a44a66ede602aa57e5446ecdf2a3732923 Mon Sep 17 00:00:00 2001
From: zhangnaisong <2434969829@qq.com>
Date: 星期一, 29 一月 2024 20:37:06 +0800
Subject: [PATCH] 车辆追踪session获取修改提交
---
ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
index 8df1d76..aebc0a0 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
@@ -963,7 +963,14 @@
if (position.size() != 0) {
Map<String, Map<String, Object>> data = new HashMap();
data.put("31000", position);
- WebSocketUtils.sendMessage(ONLINE_USER_SESSIONS.get(usersId), JSON.toJSONString(data));
+ //WebSocketUtils.sendMessage(ONLINE_USER_SESSIONS.get(usersId), JSON.toJSONString(data));
+ String sessionId = "";
+ for(String key : ONLINE_USER_SESSIONS.keySet()){
+ if(key.startsWith(usersId + "_")){
+ sessionId = key;
+ }
+ }
+ WebSocketUtils.sendMessage(ONLINE_USER_SESSIONS.get(sessionId), JSON.toJSONString(data));
}
}
}
@@ -985,7 +992,14 @@
if (position.size() != 0) {
Map<String, Map<String, Object>> data = new HashMap();
data.put("31000", position);
- WebSocketUtils.sendMessage(ONLINE_USER_SESSIONS.get(usersId), JSON.toJSONString(data));
+ //WebSocketUtils.sendMessage(ONLINE_USER_SESSIONS.get(usersId), JSON.toJSONString(data));
+ String sessionId = "";
+ for(String key : ONLINE_USER_SESSIONS.keySet()){
+ if(key.startsWith(usersId + "_")){
+ sessionId = key;
+ }
+ }
+ WebSocketUtils.sendMessage(ONLINE_USER_SESSIONS.get(sessionId), JSON.toJSONString(data));
}
}
}
--
Gitblit v1.9.3