From d3c400de64118d66741f0e953f2d814294296a98 Mon Sep 17 00:00:00 2001 From: 16337 <1633794139@qq.com> Date: Mon, 2 Mar 2026 09:38:51 +0800 Subject: [PATCH] =?UTF-8?q?feat(aiot):=20=E6=88=AA=E5=9B=BE=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E6=90=BA=E5=B8=A6=20rtsp=5Furl=EF=BC=8C=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E6=97=A0=20ROI=20=E6=91=84=E5=83=8F=E5=A4=B4=E6=8C=89?= =?UTF-8?q?=E9=9C=80=E6=88=AA=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 截图 XADD 到 Redis Stream 时,通过 StreamProxyMapper 查询摄像头的 rtsp_url 并附带到请求中,供 Edge 对无 ROI(无常驻流)的摄像头 临时连接 RTSP 抓帧,解决"先截图才能画 ROI"的鸡生蛋问题。 Co-Authored-By: Claude Opus 4.6 --- .../aiot/service/impl/AiScreenshotServiceImpl.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/com/genersoft/iot/vmp/aiot/service/impl/AiScreenshotServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/aiot/service/impl/AiScreenshotServiceImpl.java index 62f7821f6..13036713f 100644 --- a/src/main/java/com/genersoft/iot/vmp/aiot/service/impl/AiScreenshotServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/aiot/service/impl/AiScreenshotServiceImpl.java @@ -3,6 +3,8 @@ package com.genersoft.iot.vmp.aiot.service.impl; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.genersoft.iot.vmp.aiot.service.IAiScreenshotService; +import com.genersoft.iot.vmp.streamProxy.bean.StreamProxy; +import com.genersoft.iot.vmp.streamProxy.dao.StreamProxyMapper; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -42,6 +44,9 @@ public class AiScreenshotServiceImpl implements IAiScreenshotService { @Autowired private StringRedisTemplate stringRedisTemplate; + @Autowired + private StreamProxyMapper streamProxyMapper; + @Value("${ai.screenshot.callback-url:}") private String callbackUrl; @@ -83,6 +88,15 @@ public class AiScreenshotServiceImpl implements IAiScreenshotService { fields.put("callback_url", callbackUrl); } + // 查询 rtsp_url 放入请求,供 Edge 对无 ROI 摄像头临时连接截图 + StreamProxy proxy = streamProxyMapper.selectByCameraCode(cameraCode); + if (proxy != null) { + String rtspUrl = proxy.getSrcUrl(); + if (rtspUrl != null && !rtspUrl.isEmpty()) { + fields.put("rtsp_url", rtspUrl); + } + } + try { MapRecord record = MapRecord.create(SNAP_REQUEST_STREAM, fields); RecordId recordId = stringRedisTemplate.opsForStream().add(record);