Compare commits

...

2 Commits

Author SHA1 Message Date
afc1d8d996 fix(aiot): 摄像头查询接口加入认证白名单
问题:service调用 /api/ai/camera/get 接口时返回401未授权
根因:新添加的摄像头查询接口需要登录认证

修复:将 /api/ai/camera/get 加入认证白名单
- 允许service服务无需token即可查询摄像头信息
- 用于告警汇总页面获取摄像头中文名称

影响文件:
- src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java:105
2026-02-24 13:29:25 +08:00
76399d13ce feat(aiot): 添加摄像头查询接口 - 支持通过camera_code查询
新增功能:
- 新增 AiCameraController 提供 /api/ai/camera/get 接口
- 支持通过 cameraCode 参数查询 StreamProxy 摄像头信息
- 用于告警服务从WVP获取摄像头名称等详细信息

接口说明:
- 路径:GET /api/ai/camera/get
- 参数:cameraCode(摄像头编码,如:cam_xxxxxxxxxxxx)
- 返回:StreamProxy对象(包含name、gb_name、app等字段)

使用场景:
- 告警汇总/device-summary API需要获取摄像头中文名称
- 前端vite代理:/admin-api/aiot/device/camera/get → WVP /api/ai/camera/get

技术细节:
- 使用StreamProxyMapper.selectByCameraCode查询
- 返回WVPResult封装的响应
2026-02-24 09:34:06 +08:00
2 changed files with 42 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
package com.genersoft.iot.vmp.aiot.controller;
import com.genersoft.iot.vmp.streamProxy.bean.StreamProxy;
import com.genersoft.iot.vmp.streamProxy.dao.StreamProxyMapper;
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* AI摄像头管理接口
*/
@Slf4j
@RestController
@RequestMapping("/api/ai/camera")
@Tag(name = "AI-摄像头管理")
public class AiCameraController {
@Autowired
private StreamProxyMapper streamProxyMapper;
@Operation(summary = "根据camera_code查询摄像头信息")
@GetMapping("/get")
public WVPResult<StreamProxy> getByCameraCode(
@Parameter(description = "摄像头编码") @RequestParam String cameraCode
) {
log.info("[AI-摄像头] 查询摄像头信息: cameraCode={}", cameraCode);
StreamProxy proxy = streamProxyMapper.selectByCameraCode(cameraCode);
if (proxy == null) {
log.warn("[AI-摄像头] 摄像头不存在: cameraCode={}", cameraCode);
return WVPResult.fail(404, "摄像头不存在");
}
return WVPResult.success(proxy);
}
}

View File

@@ -102,6 +102,7 @@ public class WebSecurityConfig {
defaultExcludes.add("/api/jt1078/playback/download");
defaultExcludes.add("/api/jt1078/snap");
defaultExcludes.add("/api/ai/roi/snap");
defaultExcludes.add("/api/ai/camera/get");
if (userSetting.getInterfaceAuthentication() && !userSetting.getInterfaceAuthenticationExcludes().isEmpty()) {
defaultExcludes.addAll(userSetting.getInterfaceAuthenticationExcludes());