feat(wms): 添加摄像头流媒体功能
- 在 application.yml 中添加 camera 配置项,用于指定媒体服务器地址 - 新增 CameraConfig 类,用于获取媒体服务器主机地址 - 在 WmsCameraManagementController 中添加 getCameraStream 方法,用于获取摄像头 FLV 流地址
This commit is contained in:
@@ -332,3 +332,6 @@ sales:
|
||||
model-name: deepseek-chat
|
||||
max-retries: 3
|
||||
temperature: 1.0
|
||||
|
||||
camera:
|
||||
media-server-host: http://140.143.206.120:8000 # ZLMediaKit 控制台地址
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.klp.common.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "camera")
|
||||
@Data
|
||||
public class CameraConfig {
|
||||
private String mediaServerHost;
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import com.klp.domain.vo.WmsCameraManagementVo;
|
||||
import com.klp.domain.bo.WmsCameraManagementBo;
|
||||
import com.klp.service.IWmsCameraManagementService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.config.CameraConfig;
|
||||
|
||||
/**
|
||||
* 摄像头管理
|
||||
@@ -36,11 +37,11 @@ import com.klp.common.core.page.TableDataInfo;
|
||||
public class WmsCameraManagementController extends BaseController {
|
||||
|
||||
private final IWmsCameraManagementService iWmsCameraManagementService;
|
||||
private final CameraConfig cameraConfig;
|
||||
|
||||
/**
|
||||
* 查询摄像头管理列表
|
||||
*/
|
||||
@SaCheckPermission("wms:cameraManagement:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsCameraManagementVo> list(WmsCameraManagementBo bo, PageQuery pageQuery) {
|
||||
return iWmsCameraManagementService.queryPageList(bo, pageQuery);
|
||||
@@ -49,7 +50,6 @@ public class WmsCameraManagementController extends BaseController {
|
||||
/**
|
||||
* 导出摄像头管理列表
|
||||
*/
|
||||
@SaCheckPermission("wms:cameraManagement:export")
|
||||
@Log(title = "摄像头管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsCameraManagementBo bo, HttpServletResponse response) {
|
||||
@@ -62,17 +62,32 @@ public class WmsCameraManagementController extends BaseController {
|
||||
*
|
||||
* @param cameraId 主键
|
||||
*/
|
||||
@SaCheckPermission("wms:cameraManagement:query")
|
||||
@GetMapping("/{cameraId}")
|
||||
public R<WmsCameraManagementVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long cameraId) {
|
||||
return R.ok(iWmsCameraManagementService.queryById(cameraId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取摄像头FLV流地址(前端可用flv.js播放)
|
||||
*/
|
||||
@GetMapping("/stream/{cameraId}")
|
||||
public R<WmsCameraManagementVo> getCameraStream(@PathVariable Long cameraId) {
|
||||
WmsCameraManagementVo camera = iWmsCameraManagementService.queryById(cameraId);
|
||||
if (camera == null) {
|
||||
return R.fail("摄像头不存在");
|
||||
}
|
||||
// 组装ZLMediaKit的FLV播放地址
|
||||
String app = "live";
|
||||
String stream = camera.getCameraCode();
|
||||
String flvUrl = cameraConfig.getMediaServerHost() + "/" + app + "/" + stream + ".flv";
|
||||
camera.setHttpFmp4(flvUrl); // 复用已有字段存flvUrl,前端用httpFmp4字段接收
|
||||
return R.ok(camera);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增摄像头管理
|
||||
*/
|
||||
@SaCheckPermission("wms:cameraManagement:add")
|
||||
@Log(title = "摄像头管理", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
@@ -83,7 +98,6 @@ public class WmsCameraManagementController extends BaseController {
|
||||
/**
|
||||
* 修改摄像头管理
|
||||
*/
|
||||
@SaCheckPermission("wms:cameraManagement:edit")
|
||||
@Log(title = "摄像头管理", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
@@ -96,7 +110,6 @@ public class WmsCameraManagementController extends BaseController {
|
||||
*
|
||||
* @param cameraIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("wms:cameraManagement:remove")
|
||||
@Log(title = "摄像头管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{cameraIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
|
||||
Reference in New Issue
Block a user