zhaowenyu
2025-12-16 f3ba49dc3b2793f8a6968a815a2e38b49159045f
ard-sample/src/main/java/com/ard/sample/manage/service/impl/LiveStreamServiceImpl.java
@@ -1,5 +1,6 @@
package com.ard.sample.manage.service.impl;
import com.ard.sample.common.error.CommonErrorEnum;
import com.ard.sample.common.error.LiveErrorEnum;
import com.ard.sample.common.model.ResponseResult;
import com.ard.sample.component.mqtt.model.CommonTopicResponse;
@@ -258,6 +259,44 @@
    }
    @Override
    public ResponseResult<List<String>> getLiveLens(String sn) {
        List<String> videoTypes = new ArrayList<>();
        // 检查设备是否在线
        if (!deviceService.checkDeviceOnline(sn)) {
            log.info("SN: {}-设备不在线,请检查网络连接!", sn);
            // 抛弃出异常,给调用者处理
            //throw new Exception("设备不在线,请检查网络连接!");
            return ResponseResult.error(CommonErrorEnum.DEVICE_OFFLINE.getErrorCode(),CommonErrorEnum.DEVICE_OFFLINE.getErrorMsg());
        }
        // 读取直播能力拼接参数
        List<CapacityDeviceDTO> devicesList = getLiveCapacity();
        if (devicesList == null || devicesList.isEmpty()) {
            log.info("SN: {}-未获得设备直播能力!", sn);
            // 抛弃出异常,给调用者处理
            //throw new Exception("未获得设备直播能力!");
            return ResponseResult.error(22222200,"未获得设备直播能力!");
        }
        for (CapacityDeviceDTO device : devicesList) {
            if (!device.getSn().equals(sn)) {
                continue;
            }
            List<CapacityCameraDTO> camerasList = device.getCamerasList();
            for (CapacityCameraDTO camera : camerasList) {
                // 机场3中飞行器,没有name,需要其他条件确定主摄像头参数
                for (CapacityVideoDTO video : camera.getVideosList()) {
                    if (video.getSwitchVideoTypes().size() == 1 && camera.getName() == null) {
                        continue;
                    }
                    videoTypes = video.getSwitchVideoTypes();
                }
            }
        }
        return ResponseResult.success(videoTypes);
    }
    @Override
    public ResponseResult liveCameraChange(LiveTypeDTO liveParam) {
        if (liveParam.getCameraPosition() == null) {
            return ResponseResult.error(LiveErrorEnum.ERROR_PARAMETERS);