From f44f422ba810bf21ec057b59c0af17df88c489aa Mon Sep 17 00:00:00 2001 From: lzh Date: Thu, 29 Jan 2026 18:38:10 +0800 Subject: [PATCH] =?UTF-8?q?fix(ops):=20=E4=BF=AE=E5=A4=8D=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E4=B8=8A=E7=BA=BF=E6=97=B6=E6=9C=AA=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E7=B4=A2=E5=BC=95=E7=BC=93=E5=AD=98=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题:设备上线时 updateBadgeOnlineStatus() 只更新了 currentAreaId 字段, 未调用 addToAreaIndex() 更新 ops:area:badges:{areaId} 缓存, 导致设备上线后区域设备查询返回空。 修复:当 areaId 不为空时,同时调用 addToAreaIndex() 更新区域设备索引缓存。 Co-Authored-By: Claude (MiniMax-M2.1) --- .../environment/service/badge/BadgeDeviceStatusServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/viewsh-module-ops/viewsh-module-environment-biz/src/main/java/com/viewsh/module/ops/environment/service/badge/BadgeDeviceStatusServiceImpl.java b/viewsh-module-ops/viewsh-module-environment-biz/src/main/java/com/viewsh/module/ops/environment/service/badge/BadgeDeviceStatusServiceImpl.java index 0b66f5c..70b6096 100644 --- a/viewsh-module-ops/viewsh-module-environment-biz/src/main/java/com/viewsh/module/ops/environment/service/badge/BadgeDeviceStatusServiceImpl.java +++ b/viewsh-module-ops/viewsh-module-environment-biz/src/main/java/com/viewsh/module/ops/environment/service/badge/BadgeDeviceStatusServiceImpl.java @@ -263,6 +263,8 @@ public class BadgeDeviceStatusServiceImpl implements BadgeDeviceStatusService, I // 更新实时物理区域信息 (Key2) if (areaId != null) { statusMap.put("currentAreaId", areaId); + // 同时更新区域设备索引缓存 + addToAreaIndex(deviceId, areaId); } else { // 保持现有实时物理区域信息 Object existingAreaId = currentMap.get("currentAreaId");