修复:proxyImage无持久化记录时自动触发截图,避免首次加载404
DB无cos_key记录时,自动调用requestScreenshot触发Edge截图, 等待结果持久化后再代理返回图片,解决ROI页面首次加载显示损坏图片。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -320,8 +320,17 @@ public class AiScreenshotServiceImpl implements IAiScreenshotService {
|
|||||||
// 1. 查 DB 持久化的 cos_key(永不过期)- 优先直接操作 COS
|
// 1. 查 DB 持久化的 cos_key(永不过期)- 优先直接操作 COS
|
||||||
String cosKey = snapshotMapper.getCosKey(cameraCode);
|
String cosKey = snapshotMapper.getCosKey(cameraCode);
|
||||||
if (cosKey == null) {
|
if (cosKey == null) {
|
||||||
log.warn("[AI截图] 代理图片: 无持久化记录 cameraCode={}", cameraCode);
|
// DB 无记录,自动触发一次截图并等待持久化
|
||||||
return null;
|
log.info("[AI截图] 代理图片: 无持久化记录,自动触发截图 cameraCode={}", cameraCode);
|
||||||
|
Map<String, Object> snapResult = requestScreenshot(cameraCode, true);
|
||||||
|
if ("ok".equals(snapResult.get("status"))) {
|
||||||
|
// 截图成功,重新查 DB
|
||||||
|
cosKey = snapshotMapper.getCosKey(cameraCode);
|
||||||
|
}
|
||||||
|
if (cosKey == null) {
|
||||||
|
log.warn("[AI截图] 代理图片: 自动截图后仍无持久化记录 cameraCode={}", cameraCode);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 通过 CosUtil 直接生成 presigned URL
|
// 2. 通过 CosUtil 直接生成 presigned URL
|
||||||
|
|||||||
Reference in New Issue
Block a user