fix(aiot): pushAllConfig补充Redis聚合配置写入+修正截图回调地址
pushAllConfig原来只做HTTP推送,不写Redis,导致Edge在
CONFIG_SYNC_MODE=REDIS模式下无法通过Stream接收全量配置。
现在推送后对每个deviceId调用writeDeviceAggregatedConfig,
写入device:{id}:config并发布device_config_stream事件。
同时修正application-dev.yml中截图回调地址。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -163,12 +163,26 @@ public class AiConfigServiceImpl implements IAiConfigService {
|
||||
payload.put("sync_mode", "full");
|
||||
boolean httpSyncOk = pushPayloadToLocalEdge(payload);
|
||||
|
||||
// 写入 Redis 聚合配置 + Stream 事件(供 CONFIG_SYNC_MODE=REDIS 模式的 Edge 使用)
|
||||
Set<String> deviceIds = new LinkedHashSet<>();
|
||||
for (AiRoi roi : rois) {
|
||||
String deviceId = roi.getDeviceId();
|
||||
if (deviceId != null && !deviceId.isEmpty()) {
|
||||
deviceIds.add(deviceId);
|
||||
}
|
||||
}
|
||||
for (String deviceId : deviceIds) {
|
||||
redisConfigService.writeDeviceAggregatedConfig(deviceId, "UPDATE");
|
||||
}
|
||||
log.info("[AiConfig] 全量推送 Redis 聚合配置完成, deviceIds={}", deviceIds);
|
||||
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
result.put("rois", rois.size());
|
||||
result.put("binds", binds.size());
|
||||
result.put("http_sync", httpSyncOk);
|
||||
result.put("message", "已推送全部ROI和算法绑定到Edge");
|
||||
log.info("[AiConfig] 全量推送完成 rois={}, binds={}, httpSync={}", rois.size(), binds.size(), httpSyncOk);
|
||||
result.put("redis_sync_devices", deviceIds.size());
|
||||
result.put("message", "已推送全部ROI和算法绑定到Edge(HTTP+Redis双通道)");
|
||||
log.info("[AiConfig] 全量推送完成 rois={}, binds={}, httpSync={}, redisDevices={}", rois.size(), binds.size(), httpSyncOk, deviceIds.size());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ ai:
|
||||
enabled: true
|
||||
screenshot:
|
||||
# Edge截图回调地址(WVP外部可访问地址,Edge通过此地址回调截图结果)
|
||||
callback-url: http://124.222.218.198:18080
|
||||
callback-url: http://124.221.55.225:18080
|
||||
mqtt:
|
||||
# MQTT推送开关
|
||||
enabled: false
|
||||
|
||||
Reference in New Issue
Block a user