From 7400ace65d693bb7bcc564b9211d8bab2af3ac01 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: Fri, 25 Feb 2022 20:33:02 +0800
Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E8=8C=83=E6=95=B0=E6=8D=AE=E5=BA=93?=
=?UTF-8?q?=EF=BC=8C=E8=A7=A3=E5=86=B3bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 9 +++
sql/mysql.sql | 68 +++++++++----------
.../iot/vmp/gb28181/bean/DeviceChannel.java | 12 ++++
.../subscribe/catalog/CatalogEventLister.java | 2 +-
.../cmd/CatalogNotifyMessageHandler.java | 1 -
.../vmp/media/zlm/ZLMMediaListManager.java | 6 +-
.../iot/vmp/media/zlm/ZLMRESTfulUtils.java | 19 +++++-
.../vmp/storager/dao/DeviceChannelMapper.java | 35 +++++-----
.../iot/vmp/storager/dao/GbStreamMapper.java | 1 +
.../storager/dao/PlatformChannelMapper.java | 18 ++---
.../impl/VideoManagerStoragerImpl.java | 16 ++---
.../iot/vmp/utils/node/BaseNode.java | 2 +-
.../iot/vmp/utils/node/ForestNode.java | 2 +-
.../iot/vmp/utils/node/ForestNodeManager.java | 6 +-
.../genersoft/iot/vmp/utils/node/INode.java | 2 +-
.../vmp/vmanager/bean/DeviceChannelTree.java | 2 +-
.../gb28181/media/MediaController.java | 5 ++
.../gb28181/platform/bean/ChannelReduce.java | 14 ++++
web_src/src/components/channelList.vue | 4 +-
19 files changed, 142 insertions(+), 82 deletions(-)
diff --git a/pom.xml b/pom.xml
index f1ac4581..770cc253 100644
--- a/pom.xml
+++ b/pom.xml
@@ -183,6 +183,15 @@
4.9.0
+
+
+ com.squareup.okhttp3
+ logging-interceptor
+ 4.9.0
+
+
+
+
com.burgstaller
diff --git a/sql/mysql.sql b/sql/mysql.sql
index f2e358fc..13e1ccdf 100644
--- a/sql/mysql.sql
+++ b/sql/mysql.sql
@@ -44,7 +44,7 @@ CREATE TABLE `device` (
`charset` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `device_deviceId_uindex` (`deviceId`)
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@@ -95,39 +95,41 @@ DROP TABLE IF EXISTS `device_channel`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `device_channel` (
- `channelId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
- `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
- `manufacture` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
- `model` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
- `owner` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
- `civilCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
- `block` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
- `address` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
- `parentId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `id` int NOT NULL AUTO_INCREMENT,
+ `channelId` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
+ `name` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `manufacture` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `model` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `owner` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `civilCode` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `block` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `address` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `parentId` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
`safetyWay` int DEFAULT NULL,
`registerWay` int DEFAULT NULL,
- `certNum` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `certNum` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
`certifiable` int DEFAULT NULL,
`errCode` int DEFAULT NULL,
- `endTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
- `secrecy` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
- `ipAddress` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `endTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `secrecy` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `ipAddress` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
`port` int DEFAULT NULL,
- `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `password` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
`PTZType` int DEFAULT NULL,
`status` int DEFAULT NULL,
`longitude` double DEFAULT NULL,
`latitude` double DEFAULT NULL,
- `streamId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
- `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
- `parental` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `streamId` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
+ `deviceId` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
+ `parental` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
`hasAudio` bit(1) DEFAULT NULL,
- `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
- `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
+ `createTime` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
+ `updateTime` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
`subCount` int DEFAULT '0',
- PRIMARY KEY (`channelId`,`deviceId`) USING BTREE,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `device_channel_id_uindex` (`id`),
UNIQUE KEY `device_channel_pk` (`channelId`,`deviceId`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@@ -196,7 +198,7 @@ CREATE TABLE `gb_stream` (
PRIMARY KEY (`gbStreamId`) USING BTREE,
UNIQUE KEY `app` (`app`,`stream`) USING BTREE,
UNIQUE KEY `gbId` (`gbId`) USING BTREE
-) ENGINE=InnoDB AUTO_INCREMENT=291 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
+) ENGINE=InnoDB AUTO_INCREMENT=375 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@@ -226,7 +228,7 @@ CREATE TABLE `log` (
`username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
PRIMARY KEY (`id`) USING BTREE
-) ENGINE=InnoDB AUTO_INCREMENT=245 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
+) ENGINE=InnoDB AUTO_INCREMENT=313 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@@ -315,7 +317,7 @@ CREATE TABLE `parent_platform` (
PRIMARY KEY (`id`),
UNIQUE KEY `parent_platform_id_uindex` (`id`),
UNIQUE KEY `parent_platform_pk` (`serverGBId`)
-) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
+) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@@ -361,13 +363,11 @@ DROP TABLE IF EXISTS `platform_gb_channel`;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `platform_gb_channel` (
`id` int NOT NULL AUTO_INCREMENT,
- `channelId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
- `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
- `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
- `deviceAndChannelId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
- `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
+ `platformId` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
+ `catalogId` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
+ `deviceChannelId` int NOT NULL,
PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
+) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@@ -393,7 +393,7 @@ CREATE TABLE `platform_gb_stream` (
`id` int NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`),
UNIQUE KEY `platform_gb_stream_pk` (`platformId`,`catalogId`,`gbStreamId`)
-) ENGINE=InnoDB AUTO_INCREMENT=256 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
+) ENGINE=InnoDB AUTO_INCREMENT=406 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@@ -463,7 +463,7 @@ CREATE TABLE `stream_push` (
`mediaServerId` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `stream_push_pk` (`app`,`stream`)
-) ENGINE=InnoDB AUTO_INCREMENT=310 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+) ENGINE=InnoDB AUTO_INCREMENT=394 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@@ -540,4 +540,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2022-02-24 16:52:12
+-- Dump completed on 2022-02-25 20:32:21
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java
index 6d40e360..36337895 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java
@@ -3,6 +3,10 @@ package com.genersoft.iot.vmp.gb28181.bean;
public class DeviceChannel {
+ /**
+ * 数据库自赠ID
+ */
+ private int id;
/**
* 通道id
@@ -165,6 +169,14 @@ public class DeviceChannel {
*/
private boolean hasAudio;
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
public String getDeviceId() {
return deviceId;
}
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java
index 997031b6..3bb28887 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java
@@ -60,7 +60,7 @@ public class CatalogEventLister implements ApplicationListener {
Map> parentPlatformMap = new HashMap<>();
if (event.getPlatformId() != null) {
parentPlatform = storager.queryParentPlatByServerGBId(event.getPlatformId());
- if (!parentPlatform.isStatus())return;
+ if (parentPlatform != null && !parentPlatform.isStatus())return;
String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + event.getPlatformId();
subscribe = redisCatchStorage.getSubscribe(key);
if (subscribe == null) return;
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/CatalogNotifyMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/CatalogNotifyMessageHandler.java
index 7ddcd824..4b99f902 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/CatalogNotifyMessageHandler.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/CatalogNotifyMessageHandler.java
@@ -98,7 +98,6 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple
DeviceChannel deviceChannel = storager.queryChannel(channelReduce.getDeviceId(), channelReduce.getChannelId());
deviceChannel.setParental(0);
deviceChannel.setParentId(channelReduce.getCatalogId());
-
cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size);
// 防止发送过快
Thread.sleep(50);
diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
index a15e01a4..c8844959 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
@@ -122,7 +122,6 @@ public class ZLMMediaListManager {
transform.setName(thirdPartyGB.getName());
}
}
- storager.updateMedia(transform);
if (!StringUtils.isEmpty(transform.getGbId())) {
// 如果这个国标ID已经给了其他推流且流已离线,则移除其他推流
List gbStreams = gbStreamMapper.selectByGBId(transform.getGbId());
@@ -135,13 +134,16 @@ public class ZLMMediaListManager {
}
}
}
- if (gbStreamMapper.selectOne(transform.getApp(), transform.getStream()) != null) {
+ StreamProxyItem streamProxyItem = gbStreamMapper.selectOne(transform.getApp(), transform.getStream());
+ if (streamProxyItem != null) {
+ transform.setGbStreamId(streamProxyItem.getGbStreamId());
gbStreamMapper.update(transform);
}else {
transform.setCreateStamp(System.currentTimeMillis());
gbStreamMapper.add(transform);
}
}
+ storager.updateMedia(transform);
return transform;
}
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 8238a838..05ecd3fb 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
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
import okhttp3.*;
+import okhttp3.logging.HttpLoggingInterceptor;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -25,8 +26,23 @@ public class ZLMRESTfulUtils {
void run(JSONObject response);
}
+ private OkHttpClient getClient(){
+ OkHttpClient.Builder httpClientBuilder = new OkHttpClient.Builder();
+ if (logger.isDebugEnabled()) {
+ HttpLoggingInterceptor logging = new HttpLoggingInterceptor(message -> {
+ logger.debug("http请求参数:" + message);
+ });
+ logging.setLevel(HttpLoggingInterceptor.Level.BASIC);
+ // OkHttp進行添加攔截器loggingInterceptor
+ httpClientBuilder.addInterceptor(logging);
+ }
+ return httpClientBuilder.build();
+ }
+
+
public JSONObject sendPost(MediaServerItem mediaServerItem, String api, Map param, RequestCallback callback) {
- OkHttpClient client = new OkHttpClient();
+ OkHttpClient client = getClient();
+
if (mediaServerItem == null) {
return null;
}
@@ -56,6 +72,7 @@ public class ZLMRESTfulUtils {
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/storager/dao/DeviceChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
index 6d9cd002..d4cace44 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
@@ -87,26 +87,27 @@ public interface DeviceChannelMapper {
void startPlay(String deviceId, String channelId, String streamId);
@Select(value = {" "})
List queryChannelListInAll(String query, Boolean online, Boolean hasSubChannel, String platformId, String catalogId);
@@ -196,8 +197,8 @@ public interface DeviceChannelMapper {
List queryOnlineChannelsByDeviceId(String deviceId);
@Select(" SELECT\n" +
+ " id,\n" +
" channelId,\n" +
- " channelId as id,\n" +
" deviceId,\n" +
" parentId,\n" +
" status,\n" +
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java
index 55b53793..2c63c82b 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java
@@ -19,6 +19,7 @@ public interface GbStreamMapper {
"('${app}', '${stream}', '${gbId}', '${name}', " +
"'${longitude}', '${latitude}', '${streamType}', " +
"'${mediaServerId}', ${status}, ${createStamp})")
+ @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId")
int add(GbStream gbStream);
@Update("UPDATE gb_stream " +
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 37c86a81..6d3be955 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
@@ -21,22 +21,22 @@ public interface PlatformChannelMapper {
* 查询列表里已经关联的
*/
@Select("")
- List findChannelRelatedPlatform(String platformId, List deviceAndChannelIds);
+ List findChannelRelatedPlatform(String platformId, List channelReduces);
@Insert("")
int addChannels(String platformId, List channelReducesToAdd);
@Delete("")
int delChannelForGB(String platformId, List channelReducesToDel);
@@ -79,8 +79,10 @@ public interface PlatformChannelMapper {
"parent_platform pp " +
"left join platform_gb_channel pgc on " +
"pp.serverGBId = pgc.platformId " +
+ "left join device_channel dc on " +
+ "dc.id = pgc.deviceChannelId " +
"WHERE " +
- "pgc.channelId = #{channelId} and pp.status = true " +
+ "dc.channelId = #{channelId} and pp.status = true " +
"AND pp.serverGBId IN" +
" #{item}" +
" ")
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
index 1d04c82d..5ab940cd 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
@@ -607,19 +607,19 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
@Override
public int updateChannelForGB(String platformId, List channelReduces, String catalogId) {
- Map deviceAndChannels = new HashMap<>();
+ Map deviceAndChannels = new HashMap<>();
for (ChannelReduce channelReduce : channelReduces) {
channelReduce.setCatalogId(catalogId);
- deviceAndChannels.put(channelReduce.getDeviceId() + "_" + channelReduce.getChannelId(), channelReduce);
+ deviceAndChannels.put(channelReduce.getId(), channelReduce);
}
- List deviceAndChannelList = new ArrayList<>(deviceAndChannels.keySet());
+ List deviceAndChannelList = new ArrayList<>(deviceAndChannels.keySet());
// 查询当前已经存在的
- List relatedPlatformchannels = platformChannelMapper.findChannelRelatedPlatform(platformId, deviceAndChannelList);
- if (relatedPlatformchannels != null) {
- deviceAndChannelList.removeAll(relatedPlatformchannels);
+ List channelIds = platformChannelMapper.findChannelRelatedPlatform(platformId, channelReduces);
+ if (deviceAndChannelList != null) {
+ deviceAndChannelList.removeAll(channelIds);
}
- for (String relatedPlatformchannel : relatedPlatformchannels) {
- deviceAndChannels.remove(relatedPlatformchannel);
+ for (Integer channelId : channelIds) {
+ deviceAndChannels.remove(channelId);
}
List channelReducesToAdd = new ArrayList<>(deviceAndChannels.values());
// 对剩下的数据进行存储
diff --git a/src/main/java/com/genersoft/iot/vmp/utils/node/BaseNode.java b/src/main/java/com/genersoft/iot/vmp/utils/node/BaseNode.java
index 0de21608..6b955081 100644
--- a/src/main/java/com/genersoft/iot/vmp/utils/node/BaseNode.java
+++ b/src/main/java/com/genersoft/iot/vmp/utils/node/BaseNode.java
@@ -18,7 +18,7 @@ public class BaseNode implements INode {
/**
* 主键ID
*/
- protected String id;
+ protected int id;
/**
* 父节点ID
diff --git a/src/main/java/com/genersoft/iot/vmp/utils/node/ForestNode.java b/src/main/java/com/genersoft/iot/vmp/utils/node/ForestNode.java
index 0ba72072..d0500a1e 100644
--- a/src/main/java/com/genersoft/iot/vmp/utils/node/ForestNode.java
+++ b/src/main/java/com/genersoft/iot/vmp/utils/node/ForestNode.java
@@ -19,7 +19,7 @@ public class ForestNode extends BaseNode {
*/
private Object content;
- public ForestNode(String id, String parentId, Object content) {
+ public ForestNode(int id, String parentId, Object content) {
this.id = id;
this.parentId = parentId;
this.content = content;
diff --git a/src/main/java/com/genersoft/iot/vmp/utils/node/ForestNodeManager.java b/src/main/java/com/genersoft/iot/vmp/utils/node/ForestNodeManager.java
index de98fdc7..895e6de0 100644
--- a/src/main/java/com/genersoft/iot/vmp/utils/node/ForestNodeManager.java
+++ b/src/main/java/com/genersoft/iot/vmp/utils/node/ForestNodeManager.java
@@ -17,12 +17,12 @@ public class ForestNodeManager> {
/**
* 森林的所有节点
*/
- private final ImmutableMap nodeMap;
+ private final ImmutableMap nodeMap;
/**
* 森林的父节点ID
*/
- private final Map parentIdMap = Maps.newHashMap();
+ private final Map parentIdMap = Maps.newHashMap();
public ForestNodeManager(List nodes) {
nodeMap = Maps.uniqueIndex(nodes, INode::getId);
@@ -46,7 +46,7 @@ public class ForestNodeManager> {
*
* @param parentId 父节点ID
*/
- public void addParentId(String parentId) {
+ public void addParentId(int parentId) {
parentIdMap.put(parentId, "");
}
diff --git a/src/main/java/com/genersoft/iot/vmp/utils/node/INode.java b/src/main/java/com/genersoft/iot/vmp/utils/node/INode.java
index 4d6ebfcb..c82d6f76 100644
--- a/src/main/java/com/genersoft/iot/vmp/utils/node/INode.java
+++ b/src/main/java/com/genersoft/iot/vmp/utils/node/INode.java
@@ -14,7 +14,7 @@ public interface INode extends Serializable {
*
* @return String
*/
- String getId();
+ int getId();
/**
* 父主键
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/DeviceChannelTree.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/DeviceChannelTree.java
index 773f2c13..4eaf5987 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/DeviceChannelTree.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/DeviceChannelTree.java
@@ -19,7 +19,7 @@ public class DeviceChannelTree extends DeviceChannel implements INode
-
-
-
+