fix(ops): 修复设备上线时未更新区域索引缓存的问题

问题:设备上线时 updateBadgeOnlineStatus() 只更新了 currentAreaId 字段,
未调用 addToAreaIndex() 更新 ops:area:badges:{areaId} 缓存,
导致设备上线后区域设备查询返回空。

修复:当 areaId 不为空时,同时调用 addToAreaIndex() 更新区域设备索引缓存。

Co-Authored-By: Claude (MiniMax-M2.1) <noreply@anthropic.com>
This commit is contained in:
lzh
2026-01-29 18:38:10 +08:00
parent 569ca2c0da
commit f44f422ba8

View File

@@ -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");