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封装的响应
This commit is contained in:
2026-02-24 09:34:06 +08:00
parent e72abd3d28
commit 76399d13ce

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);
}
}