From 44f2a0a32c096bdb05d4cc0ac162cdc1eb14c3ed Mon Sep 17 00:00:00 2001
From: Administrator <1144154118@qq.com>
Date: 星期四, 10 八月 2023 13:14:29 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java | 66 ++++++++++++++++++--------------
1 files changed, 37 insertions(+), 29 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java b/ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java
index 4d1121a..52adb77 100644
--- a/ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java
+++ b/ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java
@@ -1,9 +1,13 @@
package com.ruoyi.media.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.ruoyi.common.annotation.Anonymous;
+import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.device.camera.domain.ArdCameras;
import com.ruoyi.media.domain.StreamInfo;
import com.ruoyi.media.service.IMediaService;
import io.swagger.annotations.Api;
@@ -23,30 +27,52 @@
@RestController
@Api(tags = "娴佸獟浣撴帴鍙�")
@RequestMapping("/media/stream")
+@Anonymous
public class MediaController extends BaseController {
@Resource
private IMediaService mediaService;
- @PostMapping("/add")
+ @PostMapping()
@ApiOperation("澧炲姞杞爜")
- @ApiOperationSupport(includeParameters = {"streamInfo.name","streamInfo.rtspSource"})
+ @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());
+ String rtsp = mediaService.addPath(streamInfo.getName(), streamInfo.getRtspSource(), streamInfo.getMode());
+ return AjaxResult.success(rtsp);
+ }
+ /**
+ * 鑾峰彇杞爜璇︾粏淇℃伅
+ */
+ @ApiOperation("鑾峰彇杞爜璇︾粏淇℃伅")
+ @GetMapping(value = "/{name}")
+ public AjaxResult getInfo(@PathVariable("name") String name) {
+ return success(mediaService.getPathInfo(name));
+ }
+ /**
+ * 淇敼杞爜
+ */
+ @ApiOperation("淇敼杞爜")
+ @PreAuthorize("@ss.hasPermi('media:stream:edit')")
+ @PutMapping
+ public AjaxResult edit(@RequestBody StreamInfo streamInfo) {
+ mediaService.removePath(new String[]{streamInfo.getName()});
+ String rtsp = mediaService.addPath(streamInfo.getName(), streamInfo.getRtspSource(), streamInfo.getMode());
return AjaxResult.success(rtsp);
}
- @PostMapping("/remove")
+ @DeleteMapping("/path/{names}")
+ @PreAuthorize("@ss.hasPermi('media:stream:remove')")
@ApiOperation("绉婚櫎杞爜")
- @ApiOperationSupport(includeParameters = {"streamInfo.name"})
- public AjaxResult removePath(@RequestBody StreamInfo streamInfo) {
- mediaService.removePath(streamInfo.getName());
+ public AjaxResult removePath( @PathVariable String[] names) {
+ mediaService.removePath(names);
return AjaxResult.success();
}
- @GetMapping("/getPaths")
+ @GetMapping("/path/list")
@ApiOperation("鑾峰彇褰撳墠杞爜鍒楄〃")
- public AjaxResult getPaths() {
- return AjaxResult.success(mediaService.paths());
+ public TableDataInfo getPaths() {
+ startPage();
+ return getDataTable(mediaService.paths());
}
@GetMapping("/getRtspSessions")
@@ -86,25 +112,7 @@
startPage();
return getDataTable(mediaService.getPushStreamList());
}
- /**
- * 鏂板娴佸獟浣撴帹娴�
- */
- @PreAuthorize("@ss.hasPermi('media:stream:add')")
- @PostMapping
- @ApiOperationSupport(includeParameters = {"streamInfo.name"})
- public AjaxResult add(@RequestBody StreamInfo streamInfo) throws InterruptedException {
- String rtsp = mediaService.addPath(streamInfo.getName(), streamInfo.getRtspSource());
- return AjaxResult.success(rtsp);
- }
- /**
- * 鍒犻櫎娴佸獟浣撴帹娴�
- */
- @PreAuthorize("@ss.hasPermi('media:stream:remove')")
- @DeleteMapping("/path/{name}")
- public AjaxResult remove(@PathVariable String name) {
- mediaService.removePath(name);
- return AjaxResult.success();
- }
+
/**
* 鍒犻櫎娴佸獟浣撴媺娴�
*/
--
Gitblit v1.9.3