From 0cd86a79c229167f9e2f9d3284d577732061c317 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期一, 28 二月 2022 10:39:51 +0800
Subject: [PATCH] 修复设备删除
---
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java | 1 -
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java | 9 ++++++---
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java | 2 ++
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java | 14 ++++++++------
4 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java
index 05ecd3f..d0b1cb2 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java
@@ -72,7 +72,6 @@
ResponseBody responseBody = response.body();
if (responseBody != null) {
String responseStr = responseBody.string();
- System.out.println(responseStr);
responseJSON = JSON.parseObject(responseStr);
}
}else {
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
index 507d4e6..159cd05 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
@@ -4,6 +4,7 @@
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.genersoft.iot.vmp.common.VideoManagerConstants;
+import com.genersoft.iot.vmp.conf.MediaConfig;
import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.conf.UserSetup;
import com.genersoft.iot.vmp.gb28181.bean.Device;
@@ -278,6 +279,7 @@
@Override
public MediaServerItem getDefaultMediaServer() {
+
return mediaServerMapper.queryDefault();
}
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
index fcb5207..6e3deba 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
@@ -4,6 +4,7 @@
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.genersoft.iot.vmp.common.StreamInfo;
+import com.genersoft.iot.vmp.conf.MediaConfig;
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
import com.genersoft.iot.vmp.media.zlm.dto.MediaItem;
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
@@ -26,6 +27,10 @@
@Autowired
private IMediaServerService mediaServerService;
+
+ @Autowired
+ private MediaConfig mediaConfig;
+
@Autowired
private ZLMRESTfulUtils zlmresTfulUtils;
@@ -39,15 +44,12 @@
@Override
public StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId, String addr) {
StreamInfo streamInfo = null;
-
- MediaServerItem mediaInfo;
if (mediaServerId == null) {
- mediaInfo = mediaServerService.getDefaultMediaServer();
- }else {
- mediaInfo = mediaServerService.getOne(mediaServerId);
+ mediaServerId = mediaConfig.getId();
}
+ MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);;
if (mediaInfo == null) {
- return streamInfo;
+ return null;
}
JSONObject mediaList = zlmresTfulUtils.getMediaList(mediaInfo, app, stream);
if (mediaList != null) {
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
index 6d3be95..c3c11a8 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
@@ -41,7 +41,11 @@
int delChannelForGB(String platformId, List<ChannelReduce> channelReducesToDel);
@Delete("<script> "+
- "DELETE FROM platform_gb_channel WHERE deviceId='${deviceId}' " +
+ "DELETE FROM platform_gb_channel WHERE deviceChannelId in " +
+ "( select temp.deviceChannelId from " +
+ "(select pgc.deviceChannelId from platform_gb_channel pgc " +
+ "left join device_channel dc on dc.id = pgc.deviceChannelId where dc.deviceId =#{deviceId} " +
+ ") temp)" +
"</script>")
int delChannelForDeviceId(String deviceId);
@@ -50,8 +54,7 @@
"</script>")
int cleanChannelForGB(String platformId);
- @Select("SELECT * FROM device_channel WHERE deviceId = (SELECT deviceId FROM platform_gb_channel WHERE " +
- "platformId='${platformId}' AND channelId='${channelId}' ) AND channelId='${channelId}'")
+ @Select("SELECT dc.* FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE dc.channelId='${channelId}' and pgc.platformId='${platformId}'")
DeviceChannel queryChannelInParentPlatform(String platformId, String channelId);
@Select("select dc.channelId as id, dc.name as name, pgc.platformId as platformId, pgc.catalogId as parentId, 0 as childrenCount, 1 as type " +
--
Gitblit v1.8.0