‘liusuyi’
2023-08-12 e82cfae81d016a5171224f1358eba663d2f60c68
ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java
@@ -7,6 +7,7 @@
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.device.camera.domain.ArdCameras;
import com.ruoyi.media.domain.StreamInfo;
import com.ruoyi.media.service.IMediaService;
@@ -37,7 +38,15 @@
    @PreAuthorize("@ss.hasPermi('media:stream:add')")
    @ApiOperationSupport(includeParameters = {"streamInfo.name", "streamInfo.rtspSource", "streamInfo.mode"})
    public AjaxResult addPath(@RequestBody StreamInfo streamInfo) {
        String rtsp = mediaService.addPath(streamInfo.getName(), streamInfo.getRtspSource(), streamInfo.getMode());
        if(StringUtils.isEmpty(streamInfo.getName()))
        {
            return AjaxResult.error("通道名称不能为空");
        }
        if(StringUtils.isEmpty(streamInfo.getRtspSource()))
        {
            return AjaxResult.error("rtsp地址不能为空");
        }
        String rtsp = mediaService.addPath(streamInfo.getName(), streamInfo.getRtspSource(), streamInfo.getMode(),streamInfo.getIsCode());
        return AjaxResult.success(rtsp);
    }
    /**
@@ -56,7 +65,7 @@
    @PutMapping
    public AjaxResult edit(@RequestBody StreamInfo streamInfo) {
        mediaService.removePath(new String[]{streamInfo.getName()});
        String rtsp = mediaService.addPath(streamInfo.getName(), streamInfo.getRtspSource(), streamInfo.getMode());
        String rtsp = mediaService.addPath(streamInfo.getName(), streamInfo.getRtspSource(), streamInfo.getMode(),streamInfo.getIsCode());
        return AjaxResult.success(rtsp);
    }