修复:摄像头创建时 APP+STREAM 重复报错

app/stream 自动生成唯一值(app=camera, stream=cameraCode),
去掉前端传入和重复检查,保留字段供后期 ZLM 对接使用。
This commit is contained in:
2026-03-26 15:38:16 +08:00
parent a8bc6d8888
commit 8f8b4a2e97

View File

@@ -146,15 +146,14 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
@Override
@Transactional
public void add(StreamProxy streamProxy) {
StreamProxy streamProxyInDb = streamProxyMapper.selectOneByAppAndStream(streamProxy.getApp(), streamProxy.getStream());
if (streamProxyInDb != null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "APP+STREAM已经存在");
}
// 自动生成 camera_code日期+序号格式)
String cameraCode = CameraCodeUtil.generate(streamProxyMapper);
streamProxy.setCameraCode(cameraCode);
// app/stream 自动生成唯一值(不再依赖前端传入)
streamProxy.setApp("camera");
streamProxy.setStream(cameraCode);
// camera_name 必填校验
if (streamProxy.getCameraName() == null || streamProxy.getCameraName().trim().isEmpty()) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "摄像头名称不能为空");