From c2e551ea306979e01d5835746abfe8d25285c772 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期六, 21 十月 2023 16:59:42 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java | 3 +
ard-work/src/main/java/com/ruoyi/media/controller/VtduController.java | 66 +++++++++++++++------------------
2 files changed, 33 insertions(+), 36 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/media/controller/VtduController.java b/ard-work/src/main/java/com/ruoyi/media/controller/VtduController.java
index afbbf20..34c87bd 100644
--- a/ard-work/src/main/java/com/ruoyi/media/controller/VtduController.java
+++ b/ard-work/src/main/java/com/ruoyi/media/controller/VtduController.java
@@ -30,25 +30,26 @@
/**
* 娴佸獟浣撶鐞咰ontroller
- *
+ *
* @author ard
* @date 2023-08-29
*/
@RestController
@RequestMapping("/vtdu/media")
-public class VtduController extends BaseController
-{
+public class VtduController extends BaseController {
@Autowired
private IVtduService vtduService;
@Resource
+ private IMediaService mediaService;
+ @Resource
private ICameraSdkService cameraSdkService;
+
/**
* 鏌ヨ娴佸獟浣撶鐞嗗垪琛�
*/
@PreAuthorize("@ss.hasPermi('vtdu:media:list')")
@GetMapping("/list")
- public TableDataInfo list(Vtdu vtdu)
- {
+ public TableDataInfo list(Vtdu vtdu) {
startPage();
List<Vtdu> list = vtduService.selectVtduList(vtdu);
return getDataTable(list);
@@ -60,8 +61,7 @@
@PreAuthorize("@ss.hasPermi('vtdu:media:export')")
@Log(title = "娴佸獟浣撶鐞�", businessType = BusinessType.EXPORT)
@PostMapping("/export")
- public void export(HttpServletResponse response, Vtdu vtdu)
- {
+ public void export(HttpServletResponse response, Vtdu vtdu) {
List<Vtdu> list = vtduService.selectVtduList(vtdu);
ExcelUtil<Vtdu> util = new ExcelUtil<Vtdu>(Vtdu.class);
util.exportExcel(response, list, "娴佸獟浣撶鐞嗘暟鎹�");
@@ -72,30 +72,27 @@
*/
@PreAuthorize("@ss.hasPermi('vtdu:media:query')")
@GetMapping(value = "/{name}")
- public AjaxResult getInfo(@PathVariable("name") String name)
- {
- //region 鑷姩杞爜
- String[] nameArray = name.split("_");
- String cameraId=nameArray[0];
- Integer chanNo=Integer.valueOf(nameArray[1]);
- CameraCmd cmd=new CameraCmd();
- cmd.setCameraId(cameraId);
- cmd.setChanNo(chanNo);
- Map<String, Object> videoCompressionCfg = cameraSdkService.getVideoCompressionCfg(cmd);
- String videoEncType = (String)videoCompressionCfg.get("videoEncType");
+ public AjaxResult getInfo(@PathVariable("name") String name) {
Vtdu vtdu = vtduService.selectVtduByName(name);
- if(!videoEncType.equals("鏍囧噯h264"))
- {
- vtdu.setIsCode("1");
+ if (vtdu != null) {
+ String cameraId = name.split("_")[0];
+ Integer chanNo = Integer.valueOf(name.split("_")[1]);
+ CameraCmd cmd = new CameraCmd(cameraId, chanNo);
+ Map<String, Object> videoCompressionCfg = cameraSdkService.getVideoCompressionCfg(cmd);
+ String videoEncType = (String) videoCompressionCfg.get("videoEncType");
+ if (!videoEncType.equals("鏍囧噯h264")) {
+ vtdu.setIsCode("1");
+ } else {
+ vtdu.setIsCode("0");
+ }
+ //娴佸獟浣撲笉瀛樺湪鏂板锛屽瓨鍦ㄦ洿鏂�
+ if (!mediaService.checkNameExist(name)) {
+ mediaService.addPath(name, vtdu.getRtspSource(), vtdu.getMode(), vtdu.getIsCode());
+ } else {
+ vtduService.updateVtdu(vtdu);
+ }
}
- else
- {
- vtdu.setIsCode("0");
- }
- vtduService.deleteVtduByName(name);
- vtduService.insertVtdu(vtdu);
- //endregion
- return success(vtduService.selectVtduByName(name));
+ return success(vtdu);
}
/**
@@ -104,8 +101,7 @@
@PreAuthorize("@ss.hasPermi('vtdu:media:add')")
@Log(title = "娴佸獟浣撶鐞�", businessType = BusinessType.INSERT)
@PostMapping
- public AjaxResult add(@RequestBody Vtdu vtdu)
- {
+ public AjaxResult add(@RequestBody Vtdu vtdu) {
if (StringUtils.isEmpty(vtdu.getName())) {
return AjaxResult.error("閫氶亾鍚嶇О涓嶈兘涓虹┖");
}
@@ -121,8 +117,7 @@
@PreAuthorize("@ss.hasPermi('vtdu:media:edit')")
@Log(title = "娴佸獟浣撶鐞�", businessType = BusinessType.UPDATE)
@PutMapping
- public AjaxResult edit(@RequestBody Vtdu vtdu)
- {
+ public AjaxResult edit(@RequestBody Vtdu vtdu) {
return toAjax(vtduService.updateVtdu(vtdu));
}
@@ -131,9 +126,8 @@
*/
@PreAuthorize("@ss.hasPermi('vtdu:media:remove')")
@Log(title = "娴佸獟浣撶鐞�", businessType = BusinessType.DELETE)
- @DeleteMapping("/{names}")
- public AjaxResult remove(@PathVariable String[] names)
- {
+ @DeleteMapping("/{names}")
+ public AjaxResult remove(@PathVariable String[] names) {
return toAjax(vtduService.deleteVtduByNames(names));
}
}
diff --git a/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java b/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java
index dcb2670..c0326e2 100644
--- a/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java
@@ -104,6 +104,9 @@
} else {
conf.setSource(sourceUrl);
conf.setSourceOnDemand(true);
+ conf.setRunOnDemand("");
+ conf.setRunOnDemandRestart(false);
+ conf.setRunOnDemandCloseAfter("5s");
}
conf.setMaxReaders(100);
conf.setSourceProtocol("tcp");
--
Gitblit v1.9.3