Commit 6e0f7fae6eda7ffa18c4289d19a705f272174911
1 parent
7e428f82
为级联平台增加虚拟目录功能
Showing
50 changed files
with
1802 additions
and
104 deletions
README.md
| @@ -95,15 +95,13 @@ https://gitee.com/pan648540858/wvp-GB28181-pro.git | @@ -95,15 +95,13 @@ https://gitee.com/pan648540858/wvp-GB28181-pro.git | ||
| 95 | - [X] 平台状态查询 | 95 | - [X] 平台状态查询 |
| 96 | - [X] 平台信息查询 | 96 | - [X] 平台信息查询 |
| 97 | - [X] 平台远程启动 | 97 | - [X] 平台远程启动 |
| 98 | + - [X] 每个级联平台可自定义的虚拟目录 | ||
| 98 | - [X] 添加RTSP视频 | 99 | - [X] 添加RTSP视频 |
| 99 | - [X] 添加接口鉴权 | 100 | - [X] 添加接口鉴权 |
| 100 | -- [ ] 添加ONVIF探测局域网内的设备 | ||
| 101 | - [X] 添加RTMP视频 | 101 | - [X] 添加RTMP视频 |
| 102 | - [X] 云端录像(需要部署单独服务配合使用) | 102 | - [X] 云端录像(需要部署单独服务配合使用) |
| 103 | - [X] 多流媒体节点,自动选择负载最低的节点使用。 | 103 | - [X] 多流媒体节点,自动选择负载最低的节点使用。 |
| 104 | - [X] 支持使用mysql作为数据库,默认sqlite3,开箱即用。 | 104 | - [X] 支持使用mysql作为数据库,默认sqlite3,开箱即用。 |
| 105 | -- [ ] 添加系统配置 | ||
| 106 | -- [ ] 添加用户管理 | ||
| 107 | - [X] WEB端支持播放H264与H265,音频支持G.711A/G.711U/AAC,覆盖国标常用编码格式。 | 105 | - [X] WEB端支持播放H264与H265,音频支持G.711A/G.711U/AAC,覆盖国标常用编码格式。 |
| 108 | 106 | ||
| 109 | # docker快速体验 | 107 | # docker快速体验 |
sql/dump-wvp-202201051515.sql
0 → 100644
| 1 | +-- MySQL dump 10.13 Distrib 8.0.27, for Linux (x86_64) | ||
| 2 | +-- | ||
| 3 | +-- Host: localhost Database: wvp | ||
| 4 | +-- ------------------------------------------------------ | ||
| 5 | +-- Server version 8.0.27-0ubuntu0.20.04.1 | ||
| 6 | + | ||
| 7 | +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; | ||
| 8 | +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; | ||
| 9 | +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; | ||
| 10 | +/*!50503 SET NAMES utf8mb4 */; | ||
| 11 | +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; | ||
| 12 | +/*!40103 SET TIME_ZONE='+00:00' */; | ||
| 13 | +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; | ||
| 14 | +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; | ||
| 15 | +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; | ||
| 16 | +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; | ||
| 17 | + | ||
| 18 | +-- | ||
| 19 | +-- Table structure for table `device` | ||
| 20 | +-- | ||
| 21 | + | ||
| 22 | +DROP TABLE IF EXISTS `device`; | ||
| 23 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | ||
| 24 | +/*!50503 SET character_set_client = utf8mb4 */; | ||
| 25 | +CREATE TABLE `device` ( | ||
| 26 | + `deviceId` varchar(50) NOT NULL, | ||
| 27 | + `name` varchar(255) DEFAULT NULL, | ||
| 28 | + `manufacturer` varchar(255) DEFAULT NULL, | ||
| 29 | + `model` varchar(255) DEFAULT NULL, | ||
| 30 | + `firmware` varchar(255) DEFAULT NULL, | ||
| 31 | + `transport` varchar(50) DEFAULT NULL, | ||
| 32 | + `streamMode` varchar(50) DEFAULT NULL, | ||
| 33 | + `online` varchar(50) DEFAULT NULL, | ||
| 34 | + `registerTime` varchar(50) DEFAULT NULL, | ||
| 35 | + `keepaliveTime` varchar(50) DEFAULT NULL, | ||
| 36 | + `ip` varchar(50) NOT NULL, | ||
| 37 | + `createTime` varchar(50) NOT NULL, | ||
| 38 | + `updateTime` varchar(50) NOT NULL, | ||
| 39 | + `port` int NOT NULL, | ||
| 40 | + `expires` int NOT NULL, | ||
| 41 | + `subscribeCycleForCatalog` int NOT NULL, | ||
| 42 | + `hostAddress` varchar(50) NOT NULL, | ||
| 43 | + `charset` varchar(50) NOT NULL, | ||
| 44 | + PRIMARY KEY (`deviceId`) | ||
| 45 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
| 46 | +/*!40101 SET character_set_client = @saved_cs_client */; | ||
| 47 | + | ||
| 48 | +-- | ||
| 49 | +-- Dumping data for table `device` | ||
| 50 | +-- | ||
| 51 | + | ||
| 52 | +LOCK TABLES `device` WRITE; | ||
| 53 | +/*!40000 ALTER TABLE `device` DISABLE KEYS */; | ||
| 54 | +INSERT INTO `device` VALUES ('34020000001320000005','IPC-HFW4433M-I2','Dahua','IPC-HFW4433M-I2','2.622.0000000.31.R,2017-12-14','UDP','UDP','1','2022-01-05 15:08:26','2022-01-05 15:15:26','192.168.1.100','2022-01-05 15:08:26','2022-01-05 15:15:26',5060,3600,0,'192.168.1.100:5060','gb2312'),('34020000002000000005','DH-NVR5864-I','Dahua','DH-NVR5864-I','4.001.0000000.3,2020-10-22','UDP','UDP','1','2022-01-05 14:07:36','2022-01-05 15:15:25','192.168.1.19','2022-01-05 15:08:25','2022-01-05 15:15:25',5060,3600,0,'192.168.1.19:5060','gb2312'),('44010000001110008008',NULL,'Mercury','MIPC368(P)W-4','1.0.1 Build 210304 Rel.60784n','UDP','UDP','1','2022-01-05 15:08:35','2022-01-05 15:14:35','192.168.1.17','2022-01-05 15:08:35','2022-01-05 15:14:35',5060,36000,0,'192.168.1.17:5060','gb2312'); | ||
| 55 | +/*!40000 ALTER TABLE `device` ENABLE KEYS */; | ||
| 56 | +UNLOCK TABLES; | ||
| 57 | + | ||
| 58 | +-- | ||
| 59 | +-- Table structure for table `device_alarm` | ||
| 60 | +-- | ||
| 61 | + | ||
| 62 | +DROP TABLE IF EXISTS `device_alarm`; | ||
| 63 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | ||
| 64 | +/*!50503 SET character_set_client = utf8mb4 */; | ||
| 65 | +CREATE TABLE `device_alarm` ( | ||
| 66 | + `id` int NOT NULL AUTO_INCREMENT, | ||
| 67 | + `deviceId` varchar(50) NOT NULL, | ||
| 68 | + `channelId` varchar(50) NOT NULL, | ||
| 69 | + `alarmPriority` varchar(50) NOT NULL, | ||
| 70 | + `alarmMethod` varchar(50) DEFAULT NULL, | ||
| 71 | + `alarmTime` varchar(50) NOT NULL, | ||
| 72 | + `alarmDescription` varchar(255) DEFAULT NULL, | ||
| 73 | + `longitude` double DEFAULT NULL, | ||
| 74 | + `latitude` double DEFAULT NULL, | ||
| 75 | + `alarmType` varchar(50) DEFAULT NULL, | ||
| 76 | + PRIMARY KEY (`id`) | ||
| 77 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
| 78 | +/*!40101 SET character_set_client = @saved_cs_client */; | ||
| 79 | + | ||
| 80 | +-- | ||
| 81 | +-- Dumping data for table `device_alarm` | ||
| 82 | +-- | ||
| 83 | + | ||
| 84 | +LOCK TABLES `device_alarm` WRITE; | ||
| 85 | +/*!40000 ALTER TABLE `device_alarm` DISABLE KEYS */; | ||
| 86 | +/*!40000 ALTER TABLE `device_alarm` ENABLE KEYS */; | ||
| 87 | +UNLOCK TABLES; | ||
| 88 | + | ||
| 89 | +-- | ||
| 90 | +-- Table structure for table `device_channel` | ||
| 91 | +-- | ||
| 92 | + | ||
| 93 | +DROP TABLE IF EXISTS `device_channel`; | ||
| 94 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | ||
| 95 | +/*!50503 SET character_set_client = utf8mb4 */; | ||
| 96 | +CREATE TABLE `device_channel` ( | ||
| 97 | + `channelId` varchar(50) NOT NULL, | ||
| 98 | + `name` varchar(255) DEFAULT NULL, | ||
| 99 | + `manufacture` varchar(50) DEFAULT NULL, | ||
| 100 | + `model` varchar(50) DEFAULT NULL, | ||
| 101 | + `owner` varchar(50) DEFAULT NULL, | ||
| 102 | + `civilCode` varchar(50) DEFAULT NULL, | ||
| 103 | + `block` varchar(50) DEFAULT NULL, | ||
| 104 | + `address` varchar(50) DEFAULT NULL, | ||
| 105 | + `parentId` varchar(50) DEFAULT NULL, | ||
| 106 | + `safetyWay` int DEFAULT NULL, | ||
| 107 | + `registerWay` int DEFAULT NULL, | ||
| 108 | + `certNum` varchar(50) DEFAULT NULL, | ||
| 109 | + `certifiable` int DEFAULT NULL, | ||
| 110 | + `errCode` int DEFAULT NULL, | ||
| 111 | + `endTime` varchar(50) DEFAULT NULL, | ||
| 112 | + `secrecy` varchar(50) DEFAULT NULL, | ||
| 113 | + `ipAddress` varchar(50) DEFAULT NULL, | ||
| 114 | + `port` int DEFAULT NULL, | ||
| 115 | + `password` varchar(255) DEFAULT NULL, | ||
| 116 | + `PTZType` int DEFAULT NULL, | ||
| 117 | + `status` int DEFAULT NULL, | ||
| 118 | + `longitude` double DEFAULT NULL, | ||
| 119 | + `latitude` double DEFAULT NULL, | ||
| 120 | + `streamId` varchar(50) DEFAULT NULL, | ||
| 121 | + `deviceId` varchar(50) NOT NULL, | ||
| 122 | + `parental` varchar(50) DEFAULT NULL, | ||
| 123 | + `hasAudio` bit(1) DEFAULT NULL, | ||
| 124 | + `createTime` varchar(50) NOT NULL, | ||
| 125 | + `updateTime` varchar(50) NOT NULL, | ||
| 126 | + PRIMARY KEY (`channelId`,`deviceId`) | ||
| 127 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
| 128 | +/*!40101 SET character_set_client = @saved_cs_client */; | ||
| 129 | + | ||
| 130 | +-- | ||
| 131 | +-- Dumping data for table `device_channel` | ||
| 132 | +-- | ||
| 133 | + | ||
| 134 | +LOCK TABLES `device_channel` WRITE; | ||
| 135 | +/*!40000 ALTER TABLE `device_channel` DISABLE KEYS */; | ||
| 136 | +INSERT INTO `device_channel` VALUES ('34020000001310000001','IPC','Dahua','IPC-HFW4433M-I2','0','340200','','axy','34020000001320000005',0,1,'',0,0,NULL,'0','',0,'',0,1,0,0,'','34020000001320000005','0',NULL,'2022-01-05 15:11:21','2022-01-05 15:11:21'),('34020000001310000001','通道1','Dahua','DH-NVR5864-I','0','340200','','axy','34020000002000000005',0,1,'',0,0,NULL,'0','192.168.1.17',37777,'',0,1,0,0,'','34020000002000000005','0',NULL,'2022-01-05 15:11:25','2022-01-05 15:11:25'),('34020000001310000065','GB_Chn_065','Dahua','DH-NVR5864-I','0','340200','','axy','34020000002000000005',0,1,'',0,0,NULL,'0','',0,'',0,1,0,0,'','34020000002000000005','0',NULL,'2022-01-05 15:11:25','2022-01-05 15:11:25'),('34020000001320000001','IPCamera 01','Mercury','MIPC368(P)W-4','Owner','CivilCode','','Address','',0,1,'',0,0,NULL,'0','',0,'',0,1,0,0,'','44010000001110008008','0',NULL,'2022-01-05 15:11:26','2022-01-05 15:11:26'); | ||
| 137 | +/*!40000 ALTER TABLE `device_channel` ENABLE KEYS */; | ||
| 138 | +UNLOCK TABLES; | ||
| 139 | + | ||
| 140 | +-- | ||
| 141 | +-- Table structure for table `device_mobile_position` | ||
| 142 | +-- | ||
| 143 | + | ||
| 144 | +DROP TABLE IF EXISTS `device_mobile_position`; | ||
| 145 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | ||
| 146 | +/*!50503 SET character_set_client = utf8mb4 */; | ||
| 147 | +CREATE TABLE `device_mobile_position` ( | ||
| 148 | + `deviceId` varchar(50) NOT NULL, | ||
| 149 | + `channelId` varchar(50) NOT NULL, | ||
| 150 | + `deviceName` varchar(255) DEFAULT NULL, | ||
| 151 | + `time` varchar(50) NOT NULL, | ||
| 152 | + `longitude` double NOT NULL, | ||
| 153 | + `latitude` double NOT NULL, | ||
| 154 | + `altitude` double DEFAULT NULL, | ||
| 155 | + `speed` double DEFAULT NULL, | ||
| 156 | + `direction` double DEFAULT NULL, | ||
| 157 | + `reportSource` varchar(50) DEFAULT NULL, | ||
| 158 | + `geodeticSystem` varchar(50) DEFAULT NULL, | ||
| 159 | + `cnLng` varchar(50) DEFAULT NULL, | ||
| 160 | + `cnLat` varchar(50) DEFAULT NULL, | ||
| 161 | + PRIMARY KEY (`deviceId`,`time`) | ||
| 162 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
| 163 | +/*!40101 SET character_set_client = @saved_cs_client */; | ||
| 164 | + | ||
| 165 | +-- | ||
| 166 | +-- Dumping data for table `device_mobile_position` | ||
| 167 | +-- | ||
| 168 | + | ||
| 169 | +LOCK TABLES `device_mobile_position` WRITE; | ||
| 170 | +/*!40000 ALTER TABLE `device_mobile_position` DISABLE KEYS */; | ||
| 171 | +/*!40000 ALTER TABLE `device_mobile_position` ENABLE KEYS */; | ||
| 172 | +UNLOCK TABLES; | ||
| 173 | + | ||
| 174 | +-- | ||
| 175 | +-- Table structure for table `gb_stream` | ||
| 176 | +-- | ||
| 177 | + | ||
| 178 | +DROP TABLE IF EXISTS `gb_stream`; | ||
| 179 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | ||
| 180 | +/*!50503 SET character_set_client = utf8mb4 */; | ||
| 181 | +CREATE TABLE `gb_stream` ( | ||
| 182 | + `app` varchar(255) NOT NULL, | ||
| 183 | + `stream` varchar(255) NOT NULL, | ||
| 184 | + `gbId` varchar(50) NOT NULL, | ||
| 185 | + `name` varchar(255) DEFAULT NULL, | ||
| 186 | + `longitude` double DEFAULT NULL, | ||
| 187 | + `latitude` double DEFAULT NULL, | ||
| 188 | + `streamType` varchar(50) DEFAULT NULL, | ||
| 189 | + `mediaServerId` varchar(50) DEFAULT NULL, | ||
| 190 | + `status` int DEFAULT NULL, | ||
| 191 | + PRIMARY KEY (`app`,`stream`,`gbId`) | ||
| 192 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
| 193 | +/*!40101 SET character_set_client = @saved_cs_client */; | ||
| 194 | + | ||
| 195 | +-- | ||
| 196 | +-- Dumping data for table `gb_stream` | ||
| 197 | +-- | ||
| 198 | + | ||
| 199 | +LOCK TABLES `gb_stream` WRITE; | ||
| 200 | +/*!40000 ALTER TABLE `gb_stream` DISABLE KEYS */; | ||
| 201 | +INSERT INTO `gb_stream` VALUES ('1000','10000001_52869999','77777777777777777777','shoulei1111',0,0,'push','XR1LEpKlfQtSg9Z1',1); | ||
| 202 | +/*!40000 ALTER TABLE `gb_stream` ENABLE KEYS */; | ||
| 203 | +UNLOCK TABLES; | ||
| 204 | + | ||
| 205 | +-- | ||
| 206 | +-- Table structure for table `log` | ||
| 207 | +-- | ||
| 208 | + | ||
| 209 | +DROP TABLE IF EXISTS `log`; | ||
| 210 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | ||
| 211 | +/*!50503 SET character_set_client = utf8mb4 */; | ||
| 212 | +CREATE TABLE `log` ( | ||
| 213 | + `id` int NOT NULL AUTO_INCREMENT, | ||
| 214 | + `name` varchar(50) NOT NULL, | ||
| 215 | + `type` varchar(50) NOT NULL, | ||
| 216 | + `uri` varchar(200) NOT NULL, | ||
| 217 | + `address` varchar(50) NOT NULL, | ||
| 218 | + `result` varchar(50) NOT NULL, | ||
| 219 | + `timing` bigint NOT NULL, | ||
| 220 | + `username` varchar(50) NOT NULL, | ||
| 221 | + `createTime` varchar(50) NOT NULL, | ||
| 222 | + PRIMARY KEY (`id`) | ||
| 223 | +) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
| 224 | +/*!40101 SET character_set_client = @saved_cs_client */; | ||
| 225 | + | ||
| 226 | +-- | ||
| 227 | +-- Dumping data for table `log` | ||
| 228 | +-- | ||
| 229 | + | ||
| 230 | +LOCK TABLES `log` WRITE; | ||
| 231 | +/*!40000 ALTER TABLE `log` DISABLE KEYS */; | ||
| 232 | +INSERT INTO `log` VALUES (1,'登录','GET','/api/user/login','127.0.0.1','200 OK',245,'admin','2022-01-05 15:09:06'),(2,'添加上级平台','POST','/api/platform/save','127.0.0.1','200 OK',88,'admin','2022-01-05 15:09:24'),(3,'[设备查询] 同步设备通道','POST','/api/device/query/devices/34020000001320000005/sync','127.0.0.1','200 OK',17,'admin','2022-01-05 15:11:21'),(4,'[设备查询] 同步设备通道','POST','/api/device/query/devices/34020000002000000005/sync','127.0.0.1','200 OK',4,'admin','2022-01-05 15:11:25'),(5,'[设备查询] 同步设备通道','POST','/api/device/query/devices/44010000001110008008/sync','127.0.0.1','200 OK',4,'admin','2022-01-05 15:11:26'),(6,'向上级平台添加国标通道','POST','/api/platform/update_channel_for_gb','127.0.0.1','200 OK',52,'admin','2022-01-05 15:11:32'),(7,'从上级平台移除国标通道','DELETE','/api/platform/del_channel_for_gb','127.0.0.1','200 OK',35,'admin','2022-01-05 15:11:34'),(8,'向上级平台添加国标通道','POST','/api/platform/update_channel_for_gb','127.0.0.1','200 OK',39,'admin','2022-01-05 15:11:35'),(9,'从上级平台移除国标通道','DELETE','/api/platform/del_channel_for_gb','127.0.0.1','200 OK',46,'admin','2022-01-05 15:14:00'),(10,'向上级平台添加国标通道','POST','/api/platform/update_channel_for_gb','127.0.0.1','200 OK',59,'admin','2022-01-05 15:14:01'),(11,'添加通道与国标的关联','POST','/api/gbStream/add','127.0.0.1','200 OK',12,'admin','2022-01-05 15:14:16'),(12,'添加通道与国标的关联','POST','/api/gbStream/add','127.0.0.1','200 OK',8,'admin','2022-01-05 15:14:17'),(13,'添加通道与国标的关联','POST','/api/gbStream/add','127.0.0.1','200 OK',6,'admin','2022-01-05 15:14:19'),(14,'添加通道与国标的关联','POST','/api/gbStream/add','127.0.0.1','200 OK',8,'admin','2022-01-05 15:14:19'),(15,'移除通道与国标的关联','DELETE','/api/gbStream/del','127.0.0.1','200 OK',11,'admin','2022-01-05 15:14:21'),(16,'添加通道与国标的关联','POST','/api/gbStream/add','127.0.0.1','200 OK',42,'admin','2022-01-05 15:14:24'),(17,'移除通道与国标的关联','DELETE','/api/gbStream/del','127.0.0.1','200 OK',43,'admin','2022-01-05 15:14:25'),(18,'添加通道与国标的关联','POST','/api/gbStream/add','127.0.0.1','200 OK',9,'admin','2022-01-05 15:14:27'),(19,'添加通道与国标的关联','POST','/api/gbStream/add','127.0.0.1','200 OK',9,'admin','2022-01-05 15:14:37'),(20,'添加通道与国标的关联','POST','/api/gbStream/add','127.0.0.1','200 OK',10,'admin','2022-01-05 15:14:38'); | ||
| 233 | +/*!40000 ALTER TABLE `log` ENABLE KEYS */; | ||
| 234 | +UNLOCK TABLES; | ||
| 235 | + | ||
| 236 | +-- | ||
| 237 | +-- Table structure for table `media_server` | ||
| 238 | +-- | ||
| 239 | + | ||
| 240 | +DROP TABLE IF EXISTS `media_server`; | ||
| 241 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | ||
| 242 | +/*!50503 SET character_set_client = utf8mb4 */; | ||
| 243 | +CREATE TABLE `media_server` ( | ||
| 244 | + `id` varchar(255) NOT NULL, | ||
| 245 | + `ip` varchar(50) NOT NULL, | ||
| 246 | + `hookIp` varchar(50) NOT NULL, | ||
| 247 | + `sdpIp` varchar(50) NOT NULL, | ||
| 248 | + `streamIp` varchar(50) NOT NULL, | ||
| 249 | + `httpPort` int NOT NULL, | ||
| 250 | + `httpSSlPort` int NOT NULL, | ||
| 251 | + `rtmpPort` int NOT NULL, | ||
| 252 | + `rtmpSSlPort` int NOT NULL, | ||
| 253 | + `rtpProxyPort` int NOT NULL, | ||
| 254 | + `rtspPort` int NOT NULL, | ||
| 255 | + `rtspSSLPort` int NOT NULL, | ||
| 256 | + `autoConfig` int NOT NULL, | ||
| 257 | + `secret` varchar(50) NOT NULL, | ||
| 258 | + `streamNoneReaderDelayMS` int NOT NULL, | ||
| 259 | + `rtpEnable` int NOT NULL, | ||
| 260 | + `rtpPortRange` varchar(50) NOT NULL, | ||
| 261 | + `sendRtpPortRange` varchar(50) NOT NULL, | ||
| 262 | + `recordAssistPort` int NOT NULL, | ||
| 263 | + `defaultServer` int NOT NULL, | ||
| 264 | + `createTime` varchar(50) NOT NULL, | ||
| 265 | + `updateTime` varchar(50) NOT NULL, | ||
| 266 | + `hookAliveInterval` int NOT NULL, | ||
| 267 | + PRIMARY KEY (`id`), | ||
| 268 | + UNIQUE KEY `media_server_i` (`ip`,`httpPort`) | ||
| 269 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
| 270 | +/*!40101 SET character_set_client = @saved_cs_client */; | ||
| 271 | + | ||
| 272 | +-- | ||
| 273 | +-- Dumping data for table `media_server` | ||
| 274 | +-- | ||
| 275 | + | ||
| 276 | +LOCK TABLES `media_server` WRITE; | ||
| 277 | +/*!40000 ALTER TABLE `media_server` DISABLE KEYS */; | ||
| 278 | +INSERT INTO `media_server` VALUES ('XR1LEpKlfQtSg9Z1','192.168.1.3','127.0.0.1','192.168.1.3','192.168.1.3',6080,0,10935,0,10000,10554,0,1,'035c73f7-bb6b-4889-a715-d9eb2d1925cc',100000,1,'30000,30500','30000,30500',18081,1,'2022-01-05 15:08:27','2022-01-05 15:08:27',10); | ||
| 279 | +/*!40000 ALTER TABLE `media_server` ENABLE KEYS */; | ||
| 280 | +UNLOCK TABLES; | ||
| 281 | + | ||
| 282 | +-- | ||
| 283 | +-- Table structure for table `parent_platform` | ||
| 284 | +-- | ||
| 285 | + | ||
| 286 | +DROP TABLE IF EXISTS `parent_platform`; | ||
| 287 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | ||
| 288 | +/*!50503 SET character_set_client = utf8mb4 */; | ||
| 289 | +CREATE TABLE `parent_platform` ( | ||
| 290 | + `id` int NOT NULL AUTO_INCREMENT, | ||
| 291 | + `enable` int DEFAULT NULL, | ||
| 292 | + `name` varchar(255) DEFAULT NULL, | ||
| 293 | + `serverGBId` varchar(50) NOT NULL, | ||
| 294 | + `serverGBDomain` varchar(50) DEFAULT NULL, | ||
| 295 | + `serverIP` varchar(50) DEFAULT NULL, | ||
| 296 | + `serverPort` int DEFAULT NULL, | ||
| 297 | + `deviceGBId` varchar(50) NOT NULL, | ||
| 298 | + `deviceIp` varchar(50) DEFAULT NULL, | ||
| 299 | + `devicePort` varchar(50) DEFAULT NULL, | ||
| 300 | + `username` varchar(255) DEFAULT NULL, | ||
| 301 | + `password` varchar(50) DEFAULT NULL, | ||
| 302 | + `expires` varchar(50) DEFAULT NULL, | ||
| 303 | + `keepTimeout` varchar(50) DEFAULT NULL, | ||
| 304 | + `transport` varchar(50) DEFAULT NULL, | ||
| 305 | + `characterSet` varchar(50) DEFAULT NULL, | ||
| 306 | + `catalogId` varchar(50) NOT NULL, | ||
| 307 | + `ptz` int DEFAULT NULL, | ||
| 308 | + `rtcp` int DEFAULT NULL, | ||
| 309 | + `status` bit(1) DEFAULT NULL, | ||
| 310 | + `shareAllLiveStream` int DEFAULT NULL, | ||
| 311 | + PRIMARY KEY (`id`,`serverGBId`) | ||
| 312 | +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
| 313 | +/*!40101 SET character_set_client = @saved_cs_client */; | ||
| 314 | + | ||
| 315 | +-- | ||
| 316 | +-- Dumping data for table `parent_platform` | ||
| 317 | +-- | ||
| 318 | + | ||
| 319 | +LOCK TABLES `parent_platform` WRITE; | ||
| 320 | +/*!40000 ALTER TABLE `parent_platform` DISABLE KEYS */; | ||
| 321 | +INSERT INTO `parent_platform` VALUES (1,1,'1112','1111111111111','1111111111','11.11.11.11',111111,'34020000002110000015','192.168.1.3','5060','34020000002110000015','12345678','300','60','UDP','GB2312','1111111111111',1,0,_binary '\0',1); | ||
| 322 | +/*!40000 ALTER TABLE `parent_platform` ENABLE KEYS */; | ||
| 323 | +UNLOCK TABLES; | ||
| 324 | + | ||
| 325 | +-- | ||
| 326 | +-- Table structure for table `platform_catalog` | ||
| 327 | +-- | ||
| 328 | + | ||
| 329 | +DROP TABLE IF EXISTS `platform_catalog`; | ||
| 330 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | ||
| 331 | +/*!50503 SET character_set_client = utf8mb4 */; | ||
| 332 | +CREATE TABLE `platform_catalog` ( | ||
| 333 | + `id` varchar(50) NOT NULL, | ||
| 334 | + `platformId` varchar(50) NOT NULL, | ||
| 335 | + `name` varchar(255) NOT NULL, | ||
| 336 | + `parentId` varchar(50) DEFAULT NULL, | ||
| 337 | + PRIMARY KEY (`id`) | ||
| 338 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
| 339 | +/*!40101 SET character_set_client = @saved_cs_client */; | ||
| 340 | + | ||
| 341 | +-- | ||
| 342 | +-- Dumping data for table `platform_catalog` | ||
| 343 | +-- | ||
| 344 | + | ||
| 345 | +LOCK TABLES `platform_catalog` WRITE; | ||
| 346 | +/*!40000 ALTER TABLE `platform_catalog` DISABLE KEYS */; | ||
| 347 | +INSERT INTO `platform_catalog` VALUES ('1111111111','1111111111111','11122','1111111111111'); | ||
| 348 | +/*!40000 ALTER TABLE `platform_catalog` ENABLE KEYS */; | ||
| 349 | +UNLOCK TABLES; | ||
| 350 | + | ||
| 351 | +-- | ||
| 352 | +-- Table structure for table `platform_gb_channel` | ||
| 353 | +-- | ||
| 354 | + | ||
| 355 | +DROP TABLE IF EXISTS `platform_gb_channel`; | ||
| 356 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | ||
| 357 | +/*!50503 SET character_set_client = utf8mb4 */; | ||
| 358 | +CREATE TABLE `platform_gb_channel` ( | ||
| 359 | + `channelId` varchar(50) NOT NULL, | ||
| 360 | + `deviceId` varchar(50) NOT NULL, | ||
| 361 | + `platformId` varchar(50) NOT NULL, | ||
| 362 | + `deviceAndChannelId` varchar(50) NOT NULL, | ||
| 363 | + `catalogId` varchar(50) NOT NULL, | ||
| 364 | + PRIMARY KEY (`deviceAndChannelId`,`platformId`) | ||
| 365 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
| 366 | +/*!40101 SET character_set_client = @saved_cs_client */; | ||
| 367 | + | ||
| 368 | +-- | ||
| 369 | +-- Dumping data for table `platform_gb_channel` | ||
| 370 | +-- | ||
| 371 | + | ||
| 372 | +LOCK TABLES `platform_gb_channel` WRITE; | ||
| 373 | +/*!40000 ALTER TABLE `platform_gb_channel` DISABLE KEYS */; | ||
| 374 | +INSERT INTO `platform_gb_channel` VALUES ('34020000001310000001','34020000001320000005','1111111111111','34020000001320000005_34020000001310000001','1111111111'),('34020000001310000001','34020000002000000005','1111111111111','34020000002000000005_34020000001310000001','1111111111'),('34020000001310000065','34020000002000000005','1111111111111','34020000002000000005_34020000001310000065','1111111111'),('34020000001320000001','44010000001110008008','1111111111111','44010000001110008008_34020000001320000001','1111111111'); | ||
| 375 | +/*!40000 ALTER TABLE `platform_gb_channel` ENABLE KEYS */; | ||
| 376 | +UNLOCK TABLES; | ||
| 377 | + | ||
| 378 | +-- | ||
| 379 | +-- Table structure for table `platform_gb_stream` | ||
| 380 | +-- | ||
| 381 | + | ||
| 382 | +DROP TABLE IF EXISTS `platform_gb_stream`; | ||
| 383 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | ||
| 384 | +/*!50503 SET character_set_client = utf8mb4 */; | ||
| 385 | +CREATE TABLE `platform_gb_stream` ( | ||
| 386 | + `platformId` varchar(50) NOT NULL, | ||
| 387 | + `app` varchar(255) NOT NULL, | ||
| 388 | + `stream` varchar(255) NOT NULL, | ||
| 389 | + `catalogId` varchar(50) NOT NULL, | ||
| 390 | + PRIMARY KEY (`platformId`,`app`,`stream`) | ||
| 391 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
| 392 | +/*!40101 SET character_set_client = @saved_cs_client */; | ||
| 393 | + | ||
| 394 | +-- | ||
| 395 | +-- Dumping data for table `platform_gb_stream` | ||
| 396 | +-- | ||
| 397 | + | ||
| 398 | +LOCK TABLES `platform_gb_stream` WRITE; | ||
| 399 | +/*!40000 ALTER TABLE `platform_gb_stream` DISABLE KEYS */; | ||
| 400 | +INSERT INTO `platform_gb_stream` VALUES ('1111111111111','1000','10000001_52869999','1111111111'); | ||
| 401 | +/*!40000 ALTER TABLE `platform_gb_stream` ENABLE KEYS */; | ||
| 402 | +UNLOCK TABLES; | ||
| 403 | + | ||
| 404 | +-- | ||
| 405 | +-- Table structure for table `role` | ||
| 406 | +-- | ||
| 407 | + | ||
| 408 | +DROP TABLE IF EXISTS `role`; | ||
| 409 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | ||
| 410 | +/*!50503 SET character_set_client = utf8mb4 */; | ||
| 411 | +CREATE TABLE `role` ( | ||
| 412 | + `id` int NOT NULL AUTO_INCREMENT, | ||
| 413 | + `name` text NOT NULL, | ||
| 414 | + `authority` text NOT NULL, | ||
| 415 | + `createTime` varchar(50) NOT NULL, | ||
| 416 | + `updateTime` varchar(50) NOT NULL, | ||
| 417 | + PRIMARY KEY (`id`) | ||
| 418 | +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
| 419 | +/*!40101 SET character_set_client = @saved_cs_client */; | ||
| 420 | + | ||
| 421 | +-- | ||
| 422 | +-- Dumping data for table `role` | ||
| 423 | +-- | ||
| 424 | + | ||
| 425 | +LOCK TABLES `role` WRITE; | ||
| 426 | +/*!40000 ALTER TABLE `role` DISABLE KEYS */; | ||
| 427 | +INSERT INTO `role` VALUES (1,'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57'); | ||
| 428 | +/*!40000 ALTER TABLE `role` ENABLE KEYS */; | ||
| 429 | +UNLOCK TABLES; | ||
| 430 | + | ||
| 431 | +-- | ||
| 432 | +-- Table structure for table `stream_proxy` | ||
| 433 | +-- | ||
| 434 | + | ||
| 435 | +DROP TABLE IF EXISTS `stream_proxy`; | ||
| 436 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | ||
| 437 | +/*!50503 SET character_set_client = utf8mb4 */; | ||
| 438 | +CREATE TABLE `stream_proxy` ( | ||
| 439 | + `type` varchar(50) NOT NULL, | ||
| 440 | + `app` varchar(255) NOT NULL, | ||
| 441 | + `stream` varchar(255) NOT NULL, | ||
| 442 | + `url` varchar(255) DEFAULT NULL, | ||
| 443 | + `src_url` varchar(255) DEFAULT NULL, | ||
| 444 | + `dst_url` varchar(255) DEFAULT NULL, | ||
| 445 | + `timeout_ms` int DEFAULT NULL, | ||
| 446 | + `ffmpeg_cmd_key` varchar(255) DEFAULT NULL, | ||
| 447 | + `rtp_type` varchar(50) DEFAULT NULL, | ||
| 448 | + `mediaServerId` varchar(50) DEFAULT NULL, | ||
| 449 | + `enable_hls` bit(1) DEFAULT NULL, | ||
| 450 | + `enable_mp4` bit(1) DEFAULT NULL, | ||
| 451 | + `enable` bit(1) NOT NULL, | ||
| 452 | + `enable_remove_none_reader` bit(1) NOT NULL, | ||
| 453 | + `createTime` varchar(50) NOT NULL, | ||
| 454 | + PRIMARY KEY (`app`,`stream`) | ||
| 455 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
| 456 | +/*!40101 SET character_set_client = @saved_cs_client */; | ||
| 457 | + | ||
| 458 | +-- | ||
| 459 | +-- Dumping data for table `stream_proxy` | ||
| 460 | +-- | ||
| 461 | + | ||
| 462 | +LOCK TABLES `stream_proxy` WRITE; | ||
| 463 | +/*!40000 ALTER TABLE `stream_proxy` DISABLE KEYS */; | ||
| 464 | +/*!40000 ALTER TABLE `stream_proxy` ENABLE KEYS */; | ||
| 465 | +UNLOCK TABLES; | ||
| 466 | + | ||
| 467 | +-- | ||
| 468 | +-- Table structure for table `stream_push` | ||
| 469 | +-- | ||
| 470 | + | ||
| 471 | +DROP TABLE IF EXISTS `stream_push`; | ||
| 472 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | ||
| 473 | +/*!50503 SET character_set_client = utf8mb4 */; | ||
| 474 | +CREATE TABLE `stream_push` ( | ||
| 475 | + `app` varchar(255) NOT NULL, | ||
| 476 | + `stream` varchar(255) NOT NULL, | ||
| 477 | + `totalReaderCount` varchar(50) DEFAULT NULL, | ||
| 478 | + `originType` int DEFAULT NULL, | ||
| 479 | + `originTypeStr` varchar(50) DEFAULT NULL, | ||
| 480 | + `createStamp` int DEFAULT NULL, | ||
| 481 | + `aliveSecond` int DEFAULT NULL, | ||
| 482 | + `mediaServerId` varchar(50) DEFAULT NULL, | ||
| 483 | + PRIMARY KEY (`app`,`stream`) | ||
| 484 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
| 485 | +/*!40101 SET character_set_client = @saved_cs_client */; | ||
| 486 | + | ||
| 487 | +-- | ||
| 488 | +-- Dumping data for table `stream_push` | ||
| 489 | +-- | ||
| 490 | + | ||
| 491 | +LOCK TABLES `stream_push` WRITE; | ||
| 492 | +/*!40000 ALTER TABLE `stream_push` DISABLE KEYS */; | ||
| 493 | +INSERT INTO `stream_push` VALUES ('1000','10000001_52869999','0',2,'rtsp_push',1641366850,0,'XR1LEpKlfQtSg9Z1'); | ||
| 494 | +/*!40000 ALTER TABLE `stream_push` ENABLE KEYS */; | ||
| 495 | +UNLOCK TABLES; | ||
| 496 | + | ||
| 497 | +-- | ||
| 498 | +-- Table structure for table `user` | ||
| 499 | +-- | ||
| 500 | + | ||
| 501 | +DROP TABLE IF EXISTS `user`; | ||
| 502 | +/*!40101 SET @saved_cs_client = @@character_set_client */; | ||
| 503 | +/*!50503 SET character_set_client = utf8mb4 */; | ||
| 504 | +CREATE TABLE `user` ( | ||
| 505 | + `id` int NOT NULL AUTO_INCREMENT, | ||
| 506 | + `username` varchar(255) NOT NULL, | ||
| 507 | + `password` varchar(255) NOT NULL, | ||
| 508 | + `roleId` int NOT NULL, | ||
| 509 | + `createTime` varchar(50) NOT NULL, | ||
| 510 | + `updateTime` varchar(50) NOT NULL, | ||
| 511 | + PRIMARY KEY (`id`), | ||
| 512 | + UNIQUE KEY `user_username_uindex` (`username`) | ||
| 513 | +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; | ||
| 514 | +/*!40101 SET character_set_client = @saved_cs_client */; | ||
| 515 | + | ||
| 516 | +-- | ||
| 517 | +-- Dumping data for table `user` | ||
| 518 | +-- | ||
| 519 | + | ||
| 520 | +LOCK TABLES `user` WRITE; | ||
| 521 | +/*!40000 ALTER TABLE `user` DISABLE KEYS */; | ||
| 522 | +INSERT INTO `user` VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021-04-13 14:14:57','2021-04-13 14:14:57'); | ||
| 523 | +/*!40000 ALTER TABLE `user` ENABLE KEYS */; | ||
| 524 | +UNLOCK TABLES; | ||
| 525 | + | ||
| 526 | +-- | ||
| 527 | +-- Dumping routines for database 'wvp' | ||
| 528 | +-- | ||
| 529 | +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; | ||
| 530 | + | ||
| 531 | +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; | ||
| 532 | +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; | ||
| 533 | +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; | ||
| 534 | +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; | ||
| 535 | +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; | ||
| 536 | +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; | ||
| 537 | +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; | ||
| 538 | + | ||
| 539 | +-- Dump completed on 2022-01-05 15:15:35 |
sql/mysql.sql
| @@ -171,6 +171,7 @@ create table parent_platform | @@ -171,6 +171,7 @@ create table parent_platform | ||
| 171 | keepTimeout varchar(50) null, | 171 | keepTimeout varchar(50) null, |
| 172 | transport varchar(50) null, | 172 | transport varchar(50) null, |
| 173 | characterSet varchar(50) null, | 173 | characterSet varchar(50) null, |
| 174 | + catalogId varchar(50) not null, | ||
| 174 | ptz int null, | 175 | ptz int null, |
| 175 | rtcp int null, | 176 | rtcp int null, |
| 176 | status bit null, | 177 | status bit null, |
| @@ -178,12 +179,22 @@ create table parent_platform | @@ -178,12 +179,22 @@ create table parent_platform | ||
| 178 | primary key (id, serverGBId) | 179 | primary key (id, serverGBId) |
| 179 | ); | 180 | ); |
| 180 | 181 | ||
| 182 | + | ||
| 183 | +create table platform_catalog | ||
| 184 | +( | ||
| 185 | + id varchar(50) primary key, | ||
| 186 | + platformId varchar(50) not null, | ||
| 187 | + name varchar(255) not null, | ||
| 188 | + parentId varchar(50) | ||
| 189 | +); | ||
| 190 | + | ||
| 181 | create table platform_gb_channel | 191 | create table platform_gb_channel |
| 182 | ( | 192 | ( |
| 183 | channelId varchar(50) not null, | 193 | channelId varchar(50) not null, |
| 184 | deviceId varchar(50) not null, | 194 | deviceId varchar(50) not null, |
| 185 | platformId varchar(50) not null, | 195 | platformId varchar(50) not null, |
| 186 | deviceAndChannelId varchar(50) not null, | 196 | deviceAndChannelId varchar(50) not null, |
| 197 | + catalogId varchar(50) not null, | ||
| 187 | primary key (deviceAndChannelId, platformId) | 198 | primary key (deviceAndChannelId, platformId) |
| 188 | ); | 199 | ); |
| 189 | 200 | ||
| @@ -192,6 +203,7 @@ create table platform_gb_stream | @@ -192,6 +203,7 @@ create table platform_gb_stream | ||
| 192 | platformId varchar(50) not null, | 203 | platformId varchar(50) not null, |
| 193 | app varchar(255) not null, | 204 | app varchar(255) not null, |
| 194 | stream varchar(255) not null, | 205 | stream varchar(255) not null, |
| 206 | + catalogId varchar(50) not null, | ||
| 195 | primary key (platformId, app, stream) | 207 | primary key (platformId, app, stream) |
| 196 | ); | 208 | ); |
| 197 | 209 |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceNotFoundEvent.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.gb28181.bean; | ||
| 2 | + | ||
| 3 | +import javax.sip.Dialog; | ||
| 4 | +import java.util.EventObject; | ||
| 5 | + | ||
| 6 | +public class DeviceNotFoundEvent extends EventObject { | ||
| 7 | + /** | ||
| 8 | + * Constructs a prototypical Event. | ||
| 9 | + * | ||
| 10 | + * @param dialog | ||
| 11 | + * @throws IllegalArgumentException if source is null. | ||
| 12 | + */ | ||
| 13 | + public DeviceNotFoundEvent(Dialog dialog) { | ||
| 14 | + super(dialog); | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + | ||
| 18 | + public Dialog getDialog() { | ||
| 19 | + return (Dialog)super.getSource(); | ||
| 20 | + } | ||
| 21 | +} |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java
| @@ -109,6 +109,11 @@ public class ParentPlatform { | @@ -109,6 +109,11 @@ public class ParentPlatform { | ||
| 109 | */ | 109 | */ |
| 110 | private boolean shareAllLiveStream; | 110 | private boolean shareAllLiveStream; |
| 111 | 111 | ||
| 112 | + /** | ||
| 113 | + * 默认目录Id,自动添加的通道多放在这个目录下 | ||
| 114 | + */ | ||
| 115 | + private String catalogId; | ||
| 116 | + | ||
| 112 | public Integer getId() { | 117 | public Integer getId() { |
| 113 | return id; | 118 | return id; |
| 114 | } | 119 | } |
| @@ -277,4 +282,12 @@ public class ParentPlatform { | @@ -277,4 +282,12 @@ public class ParentPlatform { | ||
| 277 | public void setShareAllLiveStream(boolean shareAllLiveStream) { | 282 | public void setShareAllLiveStream(boolean shareAllLiveStream) { |
| 278 | this.shareAllLiveStream = shareAllLiveStream; | 283 | this.shareAllLiveStream = shareAllLiveStream; |
| 279 | } | 284 | } |
| 285 | + | ||
| 286 | + public String getCatalogId() { | ||
| 287 | + return catalogId; | ||
| 288 | + } | ||
| 289 | + | ||
| 290 | + public void setCatalogId(String catalogId) { | ||
| 291 | + this.catalogId = catalogId; | ||
| 292 | + } | ||
| 280 | } | 293 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformCatalog.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.gb28181.bean; | ||
| 2 | + | ||
| 3 | +public class PlatformCatalog { | ||
| 4 | + private String id; | ||
| 5 | + private String name; | ||
| 6 | + private String platformId; | ||
| 7 | + private String parentId; | ||
| 8 | + private int childrenCount; // 子节点数 | ||
| 9 | + private int type; // 0 目录, 1 国标通道, 2 直播流 | ||
| 10 | + | ||
| 11 | + public String getId() { | ||
| 12 | + return id; | ||
| 13 | + } | ||
| 14 | + | ||
| 15 | + public void setId(String id) { | ||
| 16 | + this.id = id; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + public String getName() { | ||
| 20 | + return name; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + public void setName(String name) { | ||
| 24 | + this.name = name; | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + public String getPlatformId() { | ||
| 28 | + return platformId; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + public void setPlatformId(String platformId) { | ||
| 32 | + this.platformId = platformId; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public String getParentId() { | ||
| 36 | + return parentId; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + public void setParentId(String parentId) { | ||
| 40 | + this.parentId = parentId; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + public int getChildrenCount() { | ||
| 44 | + return childrenCount; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + public void setChildrenCount(int childrenCount) { | ||
| 48 | + this.childrenCount = childrenCount; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public int getType() { | ||
| 52 | + return type; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + public void setType(int type) { | ||
| 56 | + this.type = type; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + public void setTypeForCatalog() { | ||
| 60 | + this.type = 0; | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + public void setTypeForGb() { | ||
| 64 | + this.type = 1; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + public void setTypeForStream() { | ||
| 68 | + this.type = 2; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | +} |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformGbStream.java
| @@ -4,6 +4,7 @@ public class PlatformGbStream { | @@ -4,6 +4,7 @@ public class PlatformGbStream { | ||
| 4 | private String app; | 4 | private String app; |
| 5 | private String stream; | 5 | private String stream; |
| 6 | private String platformId; | 6 | private String platformId; |
| 7 | + private String catalogId; | ||
| 7 | 8 | ||
| 8 | public String getApp() { | 9 | public String getApp() { |
| 9 | return app; | 10 | return app; |
| @@ -29,4 +30,11 @@ public class PlatformGbStream { | @@ -29,4 +30,11 @@ public class PlatformGbStream { | ||
| 29 | this.platformId = platformId; | 30 | this.platformId = platformId; |
| 30 | } | 31 | } |
| 31 | 32 | ||
| 33 | + public String getCatalogId() { | ||
| 34 | + return catalogId; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + public void setCatalogId(String catalogId) { | ||
| 38 | + this.catalogId = catalogId; | ||
| 39 | + } | ||
| 32 | } | 40 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/event/SipSubscribe.java
| 1 | package com.genersoft.iot.vmp.gb28181.event; | 1 | package com.genersoft.iot.vmp.gb28181.event; |
| 2 | 2 | ||
| 3 | +import com.genersoft.iot.vmp.gb28181.bean.DeviceNotFoundEvent; | ||
| 3 | import org.slf4j.Logger; | 4 | import org.slf4j.Logger; |
| 4 | import org.slf4j.LoggerFactory; | 5 | import org.slf4j.LoggerFactory; |
| 5 | import org.springframework.scheduling.annotation.Scheduled; | 6 | import org.springframework.scheduling.annotation.Scheduled; |
| @@ -91,6 +92,13 @@ public class SipSubscribe { | @@ -91,6 +92,13 @@ public class SipSubscribe { | ||
| 91 | this.statusCode = -1024; | 92 | this.statusCode = -1024; |
| 92 | this.callId = dialogTerminatedEvent.getDialog().getCallId().getCallId(); | 93 | this.callId = dialogTerminatedEvent.getDialog().getCallId().getCallId(); |
| 93 | this.dialog = dialogTerminatedEvent.getDialog(); | 94 | this.dialog = dialogTerminatedEvent.getDialog(); |
| 95 | + }else if (event instanceof DeviceNotFoundEvent) { | ||
| 96 | + DeviceNotFoundEvent deviceNotFoundEvent = (DeviceNotFoundEvent)event; | ||
| 97 | + this.type = "deviceNotFoundEvent"; | ||
| 98 | + this.msg = "设备未找到"; | ||
| 99 | + this.statusCode = -1024; | ||
| 100 | + this.callId = deviceNotFoundEvent.getDialog().getCallId().getCallId(); | ||
| 101 | + this.dialog = deviceNotFoundEvent.getDialog(); | ||
| 94 | } | 102 | } |
| 95 | } | 103 | } |
| 96 | } | 104 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPProcessorObserver.java
| @@ -94,7 +94,6 @@ public class SIPProcessorObserver implements ISIPProcessorObserver { | @@ -94,7 +94,6 @@ public class SIPProcessorObserver implements ISIPProcessorObserver { | ||
| 94 | logger.debug(responseEvent.getResponse().toString()); | 94 | logger.debug(responseEvent.getResponse().toString()); |
| 95 | int status = response.getStatusCode(); | 95 | int status = response.getStatusCode(); |
| 96 | if (((status >= 200) && (status < 300)) || status == 401) { // Success! | 96 | if (((status >= 200) && (status < 300)) || status == 401) { // Success! |
| 97 | -// ISIPResponseProcessor processor = processorFactory.createResponseProcessor(evt); | ||
| 98 | CSeqHeader cseqHeader = (CSeqHeader) responseEvent.getResponse().getHeader(CSeqHeader.NAME); | 97 | CSeqHeader cseqHeader = (CSeqHeader) responseEvent.getResponse().getHeader(CSeqHeader.NAME); |
| 99 | String method = cseqHeader.getMethod(); | 98 | String method = cseqHeader.getMethod(); |
| 100 | ISIPResponseProcessor sipRequestProcessor = responseProcessorMap.get(method); | 99 | ISIPResponseProcessor sipRequestProcessor = responseProcessorMap.get(method); |
| @@ -108,6 +107,7 @@ public class SIPProcessorObserver implements ISIPProcessorObserver { | @@ -108,6 +107,7 @@ public class SIPProcessorObserver implements ISIPProcessorObserver { | ||
| 108 | if (subscribe != null) { | 107 | if (subscribe != null) { |
| 109 | SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(responseEvent); | 108 | SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(responseEvent); |
| 110 | subscribe.response(eventResult); | 109 | subscribe.response(eventResult); |
| 110 | + sipSubscribe.removeOkSubscribe(callIdHeader.getCallId()); | ||
| 111 | } | 111 | } |
| 112 | } | 112 | } |
| 113 | } | 113 | } |
| @@ -122,6 +122,7 @@ public class SIPProcessorObserver implements ISIPProcessorObserver { | @@ -122,6 +122,7 @@ public class SIPProcessorObserver implements ISIPProcessorObserver { | ||
| 122 | if (subscribe != null) { | 122 | if (subscribe != null) { |
| 123 | SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(responseEvent); | 123 | SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(responseEvent); |
| 124 | subscribe.response(eventResult); | 124 | subscribe.response(eventResult); |
| 125 | + sipSubscribe.removeErrorSubscribe(callIdHeader.getCallId()); | ||
| 125 | } | 126 | } |
| 126 | } | 127 | } |
| 127 | } | 128 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
| @@ -107,6 +107,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -107,6 +107,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 107 | // 查询平台下是否有该通道 | 107 | // 查询平台下是否有该通道 |
| 108 | DeviceChannel channel = storager.queryChannelInParentPlatform(requesterId, channelId); | 108 | DeviceChannel channel = storager.queryChannelInParentPlatform(requesterId, channelId); |
| 109 | List<GbStream> gbStreams = storager.queryStreamInParentPlatform(requesterId, channelId); | 109 | List<GbStream> gbStreams = storager.queryStreamInParentPlatform(requesterId, channelId); |
| 110 | + PlatformCatalog catalog = storager.getCatalog(channelId); | ||
| 110 | GbStream gbStream = gbStreams.size() > 0? gbStreams.get(0):null; | 111 | GbStream gbStream = gbStreams.size() > 0? gbStreams.get(0):null; |
| 111 | MediaServerItem mediaServerItem = null; | 112 | MediaServerItem mediaServerItem = null; |
| 112 | // 不是通道可能是直播流 | 113 | // 不是通道可能是直播流 |
| @@ -132,7 +133,10 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -132,7 +133,10 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 132 | return; | 133 | return; |
| 133 | } | 134 | } |
| 134 | responseAck(evt, Response.CALL_IS_BEING_FORWARDED); // 通道存在,发181,呼叫转接中 | 135 | responseAck(evt, Response.CALL_IS_BEING_FORWARDED); // 通道存在,发181,呼叫转接中 |
| 135 | - }else { | 136 | + }else if (catalog != null) { |
| 137 | + responseAck(evt, Response.BAD_REQUEST, "catalog channel can not play"); // 目录不支持点播 | ||
| 138 | + return; | ||
| 139 | + } else { | ||
| 136 | logger.info("通道不存在,返回404"); | 140 | logger.info("通道不存在,返回404"); |
| 137 | responseAck(evt, Response.NOT_FOUND); // 通道不存在,发404,资源不存在 | 141 | responseAck(evt, Response.NOT_FOUND); // 通道不存在,发404,资源不存在 |
| 138 | return; | 142 | return; |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/MessageRequestProcessor.java
| 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message; | 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message; |
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 3 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 4 | +import com.genersoft.iot.vmp.gb28181.bean.DeviceNotFoundEvent; | ||
| 4 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | 5 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 6 | +import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; | ||
| 5 | import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; | 7 | import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; |
| 6 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor; | 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor; |
| 7 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; | 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| @@ -19,6 +21,7 @@ import org.springframework.stereotype.Component; | @@ -19,6 +21,7 @@ import org.springframework.stereotype.Component; | ||
| 19 | import javax.sip.InvalidArgumentException; | 21 | import javax.sip.InvalidArgumentException; |
| 20 | import javax.sip.RequestEvent; | 22 | import javax.sip.RequestEvent; |
| 21 | import javax.sip.SipException; | 23 | import javax.sip.SipException; |
| 24 | +import javax.sip.header.CallIdHeader; | ||
| 22 | import javax.sip.message.Response; | 25 | import javax.sip.message.Response; |
| 23 | import java.text.ParseException; | 26 | import java.text.ParseException; |
| 24 | import java.util.Map; | 27 | import java.util.Map; |
| @@ -40,6 +43,9 @@ public class MessageRequestProcessor extends SIPRequestProcessorParent implement | @@ -40,6 +43,9 @@ public class MessageRequestProcessor extends SIPRequestProcessorParent implement | ||
| 40 | private IVideoManagerStorager storage; | 43 | private IVideoManagerStorager storage; |
| 41 | 44 | ||
| 42 | @Autowired | 45 | @Autowired |
| 46 | + private SipSubscribe sipSubscribe; | ||
| 47 | + | ||
| 48 | + @Autowired | ||
| 43 | private IRedisCatchStorage redisCatchStorage; | 49 | private IRedisCatchStorage redisCatchStorage; |
| 44 | 50 | ||
| 45 | @Override | 51 | @Override |
| @@ -56,6 +62,7 @@ public class MessageRequestProcessor extends SIPRequestProcessorParent implement | @@ -56,6 +62,7 @@ public class MessageRequestProcessor extends SIPRequestProcessorParent implement | ||
| 56 | public void process(RequestEvent evt) { | 62 | public void process(RequestEvent evt) { |
| 57 | logger.debug("接收到消息:" + evt.getRequest()); | 63 | logger.debug("接收到消息:" + evt.getRequest()); |
| 58 | String deviceId = SipUtils.getUserIdFromFromHeader(evt.getRequest()); | 64 | String deviceId = SipUtils.getUserIdFromFromHeader(evt.getRequest()); |
| 65 | + CallIdHeader callIdHeader = (CallIdHeader)evt.getRequest().getHeader(CallIdHeader.NAME); | ||
| 59 | // 查询设备是否存在 | 66 | // 查询设备是否存在 |
| 60 | Device device = redisCatchStorage.getDevice(deviceId); | 67 | Device device = redisCatchStorage.getDevice(deviceId); |
| 61 | // 查询上级平台是否存在 | 68 | // 查询上级平台是否存在 |
| @@ -63,7 +70,12 @@ public class MessageRequestProcessor extends SIPRequestProcessorParent implement | @@ -63,7 +70,12 @@ public class MessageRequestProcessor extends SIPRequestProcessorParent implement | ||
| 63 | try { | 70 | try { |
| 64 | if (device == null && parentPlatform == null) { | 71 | if (device == null && parentPlatform == null) { |
| 65 | // 不存在则回复404 | 72 | // 不存在则回复404 |
| 66 | - responseAck(evt, Response.NOT_FOUND, "device id not found"); | 73 | + responseAck(evt, Response.NOT_FOUND, "device "+ deviceId +" not found"); |
| 74 | + logger.warn("[设备未找到 ]: {}", deviceId); | ||
| 75 | + if (sipSubscribe.getErrorSubscribe(callIdHeader.getCallId()) != null){ | ||
| 76 | + SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(new DeviceNotFoundEvent(evt.getDialog())); | ||
| 77 | + sipSubscribe.getErrorSubscribe(callIdHeader.getCallId()).response(eventResult); | ||
| 78 | + }; | ||
| 67 | }else { | 79 | }else { |
| 68 | Element rootElement = getRootElement(evt); | 80 | Element rootElement = getRootElement(evt); |
| 69 | String name = rootElement.getName(); | 81 | String name = rootElement.getName(); |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/CatalogNotifyMessageHandler.java
| 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd; | 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd; |
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.conf.SipConfig; | 3 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 4 | -import com.genersoft.iot.vmp.gb28181.bean.Device; | ||
| 5 | -import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | ||
| 6 | -import com.genersoft.iot.vmp.gb28181.bean.GbStream; | ||
| 7 | -import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | 4 | +import com.genersoft.iot.vmp.gb28181.bean.*; |
| 8 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | 5 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 9 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | 6 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 10 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; | 7 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; |
| @@ -71,11 +68,41 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple | @@ -71,11 +68,41 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple | ||
| 71 | // 查询关联的直播通道 | 68 | // 查询关联的直播通道 |
| 72 | List<GbStream> gbStreams = storager.queryGbStreamListInPlatform(parentPlatform.getServerGBId()); | 69 | List<GbStream> gbStreams = storager.queryGbStreamListInPlatform(parentPlatform.getServerGBId()); |
| 73 | int size = channelReduces.size() + gbStreams.size(); | 70 | int size = channelReduces.size() + gbStreams.size(); |
| 71 | + // 回复目录信息 | ||
| 72 | + List<PlatformCatalog> catalogs = storager.queryCatalogInPlatform(parentPlatform.getServerGBId()); | ||
| 73 | + if (catalogs.size() > 0) { | ||
| 74 | + for (PlatformCatalog catalog : catalogs) { | ||
| 75 | + DeviceChannel deviceChannel = new DeviceChannel(); | ||
| 76 | + deviceChannel.setChannelId(catalog.getId()); | ||
| 77 | + deviceChannel.setName(catalog.getName()); | ||
| 78 | + deviceChannel.setLongitude(0.0); | ||
| 79 | + deviceChannel.setLatitude(0.0); | ||
| 80 | + deviceChannel.setDeviceId(parentPlatform.getDeviceGBId()); | ||
| 81 | + deviceChannel.setManufacture("wvp-pro"); | ||
| 82 | + deviceChannel.setStatus(1); | ||
| 83 | + deviceChannel.setParental(1); | ||
| 84 | + deviceChannel.setParentId(catalog.getParentId()); | ||
| 85 | + deviceChannel.setRegisterWay(1); | ||
| 86 | + deviceChannel.setCivilCode(config.getDomain()); | ||
| 87 | + deviceChannel.setModel("live"); | ||
| 88 | + deviceChannel.setOwner("wvp-pro"); | ||
| 89 | + deviceChannel.setSecrecy("0"); | ||
| 90 | + cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size); | ||
| 91 | + // 防止发送过快 | ||
| 92 | + Thread.sleep(10); | ||
| 93 | + } | ||
| 94 | + } | ||
| 74 | // 回复级联的通道 | 95 | // 回复级联的通道 |
| 75 | if (channelReduces.size() > 0) { | 96 | if (channelReduces.size() > 0) { |
| 76 | for (ChannelReduce channelReduce : channelReduces) { | 97 | for (ChannelReduce channelReduce : channelReduces) { |
| 77 | DeviceChannel deviceChannel = storager.queryChannel(channelReduce.getDeviceId(), channelReduce.getChannelId()); | 98 | DeviceChannel deviceChannel = storager.queryChannel(channelReduce.getDeviceId(), channelReduce.getChannelId()); |
| 99 | + // TODO 目前暂时认为这里只用通道没有目录 | ||
| 100 | + deviceChannel.setParental(0); | ||
| 101 | + deviceChannel.setParentId(channelReduce.getCatalogId()); | ||
| 102 | + | ||
| 78 | cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size); | 103 | cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size); |
| 104 | + // 防止发送过快 | ||
| 105 | + Thread.sleep(10); | ||
| 79 | } | 106 | } |
| 80 | } | 107 | } |
| 81 | // 回复直播的通道 | 108 | // 回复直播的通道 |
| @@ -89,16 +116,16 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple | @@ -89,16 +116,16 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple | ||
| 89 | deviceChannel.setDeviceId(parentPlatform.getDeviceGBId()); | 116 | deviceChannel.setDeviceId(parentPlatform.getDeviceGBId()); |
| 90 | deviceChannel.setManufacture("wvp-pro"); | 117 | deviceChannel.setManufacture("wvp-pro"); |
| 91 | deviceChannel.setStatus(gbStream.isStatus()?1:0); | 118 | deviceChannel.setStatus(gbStream.isStatus()?1:0); |
| 92 | - // deviceChannel.setParentId(parentPlatform.getDeviceGBId()); | 119 | + deviceChannel.setParentId(gbStream.getCatalogId()); |
| 93 | deviceChannel.setRegisterWay(1); | 120 | deviceChannel.setRegisterWay(1); |
| 94 | deviceChannel.setCivilCode(config.getDomain()); | 121 | deviceChannel.setCivilCode(config.getDomain()); |
| 95 | deviceChannel.setModel("live"); | 122 | deviceChannel.setModel("live"); |
| 96 | deviceChannel.setOwner("wvp-pro"); | 123 | deviceChannel.setOwner("wvp-pro"); |
| 97 | deviceChannel.setParental(0); | 124 | deviceChannel.setParental(0); |
| 98 | deviceChannel.setSecrecy("0"); | 125 | deviceChannel.setSecrecy("0"); |
| 99 | - deviceChannel.setSecrecy("0"); | ||
| 100 | - | ||
| 101 | cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size); | 126 | cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size); |
| 127 | + // 防止发送过快 | ||
| 128 | + Thread.sleep(10); | ||
| 102 | } | 129 | } |
| 103 | } | 130 | } |
| 104 | if (size == 0) { | 131 | if (size == 0) { |
| @@ -111,6 +138,8 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple | @@ -111,6 +138,8 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple | ||
| 111 | e.printStackTrace(); | 138 | e.printStackTrace(); |
| 112 | } catch (ParseException e) { | 139 | } catch (ParseException e) { |
| 113 | e.printStackTrace(); | 140 | e.printStackTrace(); |
| 141 | + } catch (InterruptedException e) { | ||
| 142 | + e.printStackTrace(); | ||
| 114 | } | 143 | } |
| 115 | 144 | ||
| 116 | } | 145 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java
| 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.cmd; | 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.cmd; |
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.conf.SipConfig; | 3 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 4 | -import com.genersoft.iot.vmp.gb28181.bean.Device; | ||
| 5 | -import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | ||
| 6 | -import com.genersoft.iot.vmp.gb28181.bean.GbStream; | ||
| 7 | -import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | 4 | +import com.genersoft.iot.vmp.gb28181.bean.*; |
| 8 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | 5 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 9 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | 6 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 10 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; | 7 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; |
| @@ -73,12 +70,41 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem | @@ -73,12 +70,41 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem | ||
| 73 | List<ChannelReduce> channelReduces = storager.queryChannelListInParentPlatform(parentPlatform.getServerGBId()); | 70 | List<ChannelReduce> channelReduces = storager.queryChannelListInParentPlatform(parentPlatform.getServerGBId()); |
| 74 | // 查询关联的直播通道 | 71 | // 查询关联的直播通道 |
| 75 | List<GbStream> gbStreams = storager.queryGbStreamListInPlatform(parentPlatform.getServerGBId()); | 72 | List<GbStream> gbStreams = storager.queryGbStreamListInPlatform(parentPlatform.getServerGBId()); |
| 76 | - int size = channelReduces.size() + gbStreams.size(); | 73 | + // 回复目录信息 |
| 74 | + List<PlatformCatalog> catalogs = storager.queryCatalogInPlatform(parentPlatform.getServerGBId()); | ||
| 75 | + int size = catalogs.size() + channelReduces.size() + gbStreams.size(); | ||
| 76 | + if (catalogs.size() > 0) { | ||
| 77 | + for (PlatformCatalog catalog : catalogs) { | ||
| 78 | + DeviceChannel deviceChannel = new DeviceChannel(); | ||
| 79 | + deviceChannel.setChannelId(catalog.getId()); | ||
| 80 | + deviceChannel.setName(catalog.getName()); | ||
| 81 | + deviceChannel.setLongitude(0.0); | ||
| 82 | + deviceChannel.setLatitude(0.0); | ||
| 83 | + deviceChannel.setDeviceId(parentPlatform.getDeviceGBId()); | ||
| 84 | + deviceChannel.setManufacture("wvp-pro"); | ||
| 85 | + deviceChannel.setStatus(1); | ||
| 86 | + deviceChannel.setParental(1); | ||
| 87 | + deviceChannel.setParentId(catalog.getParentId()); | ||
| 88 | + deviceChannel.setRegisterWay(1); | ||
| 89 | + deviceChannel.setCivilCode(config.getDomain()); | ||
| 90 | + deviceChannel.setModel("live"); | ||
| 91 | + deviceChannel.setOwner("wvp-pro"); | ||
| 92 | + deviceChannel.setSecrecy("0"); | ||
| 93 | + cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size); | ||
| 94 | + // 防止发送过快 | ||
| 95 | + Thread.sleep(10); | ||
| 96 | + } | ||
| 97 | + } | ||
| 77 | // 回复级联的通道 | 98 | // 回复级联的通道 |
| 78 | if (channelReduces.size() > 0) { | 99 | if (channelReduces.size() > 0) { |
| 79 | for (ChannelReduce channelReduce : channelReduces) { | 100 | for (ChannelReduce channelReduce : channelReduces) { |
| 80 | DeviceChannel deviceChannel = storager.queryChannel(channelReduce.getDeviceId(), channelReduce.getChannelId()); | 101 | DeviceChannel deviceChannel = storager.queryChannel(channelReduce.getDeviceId(), channelReduce.getChannelId()); |
| 102 | + // TODO 目前暂时认为这里只用通道没有目录 | ||
| 103 | + deviceChannel.setParental(0); | ||
| 104 | + deviceChannel.setParentId(channelReduce.getCatalogId()); | ||
| 81 | cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size); | 105 | cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size); |
| 106 | + // 防止发送过快 | ||
| 107 | + Thread.sleep(10); | ||
| 82 | } | 108 | } |
| 83 | } | 109 | } |
| 84 | // 回复直播的通道 | 110 | // 回复直播的通道 |
| @@ -92,14 +118,13 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem | @@ -92,14 +118,13 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem | ||
| 92 | deviceChannel.setDeviceId(parentPlatform.getDeviceGBId()); | 118 | deviceChannel.setDeviceId(parentPlatform.getDeviceGBId()); |
| 93 | deviceChannel.setManufacture("wvp-pro"); | 119 | deviceChannel.setManufacture("wvp-pro"); |
| 94 | deviceChannel.setStatus(gbStream.isStatus()?1:0); | 120 | deviceChannel.setStatus(gbStream.isStatus()?1:0); |
| 95 | - // deviceChannel.setParentId(parentPlatform.getDeviceGBId()); | 121 | + deviceChannel.setParentId(gbStream.getCatalogId()); |
| 96 | deviceChannel.setRegisterWay(1); | 122 | deviceChannel.setRegisterWay(1); |
| 97 | deviceChannel.setCivilCode(config.getDomain()); | 123 | deviceChannel.setCivilCode(config.getDomain()); |
| 98 | deviceChannel.setModel("live"); | 124 | deviceChannel.setModel("live"); |
| 99 | deviceChannel.setOwner("wvp-pro"); | 125 | deviceChannel.setOwner("wvp-pro"); |
| 100 | deviceChannel.setParental(0); | 126 | deviceChannel.setParental(0); |
| 101 | deviceChannel.setSecrecy("0"); | 127 | deviceChannel.setSecrecy("0"); |
| 102 | - deviceChannel.setSecrecy("0"); | ||
| 103 | 128 | ||
| 104 | cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size); | 129 | cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size); |
| 105 | } | 130 | } |
| @@ -114,6 +139,8 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem | @@ -114,6 +139,8 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem | ||
| 114 | e.printStackTrace(); | 139 | e.printStackTrace(); |
| 115 | } catch (ParseException e) { | 140 | } catch (ParseException e) { |
| 116 | e.printStackTrace(); | 141 | e.printStackTrace(); |
| 142 | + } catch (InterruptedException e) { | ||
| 143 | + e.printStackTrace(); | ||
| 117 | } | 144 | } |
| 118 | 145 | ||
| 119 | } | 146 | } |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
| @@ -4,7 +4,6 @@ import java.util.List; | @@ -4,7 +4,6 @@ import java.util.List; | ||
| 4 | import java.util.UUID; | 4 | import java.util.UUID; |
| 5 | 5 | ||
| 6 | import com.alibaba.fastjson.JSON; | 6 | import com.alibaba.fastjson.JSON; |
| 7 | -import com.alibaba.fastjson.JSONArray; | ||
| 8 | import com.genersoft.iot.vmp.common.StreamInfo; | 7 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 9 | import com.genersoft.iot.vmp.conf.MediaConfig; | 8 | import com.genersoft.iot.vmp.conf.MediaConfig; |
| 10 | import com.genersoft.iot.vmp.conf.UserSetup; | 9 | import com.genersoft.iot.vmp.conf.UserSetup; |
| @@ -302,7 +301,7 @@ public class ZLMHttpHookListener { | @@ -302,7 +301,7 @@ public class ZLMHttpHookListener { | ||
| 302 | @ResponseBody | 301 | @ResponseBody |
| 303 | @PostMapping(value = "/on_stream_changed", produces = "application/json;charset=UTF-8") | 302 | @PostMapping(value = "/on_stream_changed", produces = "application/json;charset=UTF-8") |
| 304 | public ResponseEntity<String> onStreamChanged(@RequestBody MediaItem item){ | 303 | public ResponseEntity<String> onStreamChanged(@RequestBody MediaItem item){ |
| 305 | - | 304 | + |
| 306 | if (logger.isDebugEnabled()) { | 305 | if (logger.isDebugEnabled()) { |
| 307 | logger.debug("[ ZLM HOOK ]on_stream_changed API调用,参数:" + JSONObject.toJSONString(item)); | 306 | logger.debug("[ ZLM HOOK ]on_stream_changed API调用,参数:" + JSONObject.toJSONString(item)); |
| 308 | } | 307 | } |
| @@ -322,10 +321,8 @@ public class ZLMHttpHookListener { | @@ -322,10 +321,8 @@ public class ZLMHttpHookListener { | ||
| 322 | String schema = item.getSchema(); | 321 | String schema = item.getSchema(); |
| 323 | List<MediaItem.MediaTrack> tracks = item.getTracks(); | 322 | List<MediaItem.MediaTrack> tracks = item.getTracks(); |
| 324 | boolean regist = item.isRegist(); | 323 | boolean regist = item.isRegist(); |
| 325 | - if (tracks != null) { | ||
| 326 | - logger.info("[stream: " + streamId + "] on_stream_changed->>" + schema); | ||
| 327 | - } | ||
| 328 | if ("rtmp".equals(schema)){ | 324 | if ("rtmp".equals(schema)){ |
| 325 | + logger.info("on_stream_changed:注册->{}, app->{}, stream->{}", regist, app, streamId); | ||
| 329 | if (regist) { | 326 | if (regist) { |
| 330 | mediaServerService.addCount(mediaServerId); | 327 | mediaServerService.addCount(mediaServerId); |
| 331 | }else { | 328 | }else { |
src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java
| @@ -30,7 +30,7 @@ public interface IGbStreamService { | @@ -30,7 +30,7 @@ public interface IGbStreamService { | ||
| 30 | * 保存国标关联 | 30 | * 保存国标关联 |
| 31 | * @param gbStreams | 31 | * @param gbStreams |
| 32 | */ | 32 | */ |
| 33 | - boolean addPlatformInfo(List<GbStream> gbStreams, String platformId); | 33 | + boolean addPlatformInfo(List<GbStream> gbStreams, String platformId, String catalogId); |
| 34 | 34 | ||
| 35 | /** | 35 | /** |
| 36 | * 移除国标关联 | 36 | * 移除国标关联 |
src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java
| @@ -47,13 +47,15 @@ public class GbStreamServiceImpl implements IGbStreamService { | @@ -47,13 +47,15 @@ public class GbStreamServiceImpl implements IGbStreamService { | ||
| 47 | 47 | ||
| 48 | 48 | ||
| 49 | @Override | 49 | @Override |
| 50 | - public boolean addPlatformInfo(List<GbStream> gbStreams, String platformId) { | 50 | + public boolean addPlatformInfo(List<GbStream> gbStreams, String platformId, String catalogId) { |
| 51 | // 放在事务内执行 | 51 | // 放在事务内执行 |
| 52 | boolean result = false; | 52 | boolean result = false; |
| 53 | TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); | 53 | TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); |
| 54 | try { | 54 | try { |
| 55 | for (GbStream gbStream : gbStreams) { | 55 | for (GbStream gbStream : gbStreams) { |
| 56 | + gbStream.setCatalogId(catalogId); | ||
| 56 | gbStream.setPlatformId(platformId); | 57 | gbStream.setPlatformId(platformId); |
| 58 | + // TODO 修改为批量提交 | ||
| 57 | platformGbStreamMapper.add(gbStream); | 59 | platformGbStreamMapper.add(gbStream); |
| 58 | } | 60 | } |
| 59 | dataSourceTransactionManager.commit(transactionStatus); //手动提交 | 61 | dataSourceTransactionManager.commit(transactionStatus); //手动提交 |
src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
| @@ -130,7 +130,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService { | @@ -130,7 +130,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService { | ||
| 130 | if ( !StringUtils.isEmpty(param.getPlatformGbId()) && streamLive) { | 130 | if ( !StringUtils.isEmpty(param.getPlatformGbId()) && streamLive) { |
| 131 | List<GbStream> gbStreams = new ArrayList<>(); | 131 | List<GbStream> gbStreams = new ArrayList<>(); |
| 132 | gbStreams.add(param); | 132 | gbStreams.add(param); |
| 133 | - if (gbStreamService.addPlatformInfo(gbStreams, param.getPlatformGbId())){ | 133 | + if (gbStreamService.addPlatformInfo(gbStreams, param.getPlatformGbId(), param.getCatalogId())){ |
| 134 | result.append(", 关联国标平台[ " + param.getPlatformGbId() + " ]成功"); | 134 | result.append(", 关联国标平台[ " + param.getPlatformGbId() + " ]成功"); |
| 135 | }else { | 135 | }else { |
| 136 | result.append(", 关联国标平台[ " + param.getPlatformGbId() + " ]失败"); | 136 | result.append(", 关联国标平台[ " + param.getPlatformGbId() + " ]失败"); |
| @@ -141,6 +141,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService { | @@ -141,6 +141,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService { | ||
| 141 | if (parentPlatforms.size() > 0) { | 141 | if (parentPlatforms.size() > 0) { |
| 142 | for (ParentPlatform parentPlatform : parentPlatforms) { | 142 | for (ParentPlatform parentPlatform : parentPlatforms) { |
| 143 | param.setPlatformId(parentPlatform.getServerGBId()); | 143 | param.setPlatformId(parentPlatform.getServerGBId()); |
| 144 | + param.setCatalogId(parentPlatform.getCatalogId()); | ||
| 144 | String stream = param.getStream(); | 145 | String stream = param.getStream(); |
| 145 | StreamProxyItem streamProxyItems = platformGbStreamMapper.selectOne(param.getApp(), stream, parentPlatform.getServerGBId()); | 146 | StreamProxyItem streamProxyItems = platformGbStreamMapper.selectOne(param.getApp(), stream, parentPlatform.getServerGBId()); |
| 146 | if (streamProxyItems == null) { | 147 | if (streamProxyItems == null) { |
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java
| @@ -119,6 +119,7 @@ public class StreamPushServiceImpl implements IStreamPushService { | @@ -119,6 +119,7 @@ public class StreamPushServiceImpl implements IStreamPushService { | ||
| 119 | List<ParentPlatform> parentPlatforms = parentPlatformMapper.selectAllAhareAllLiveStream(); | 119 | List<ParentPlatform> parentPlatforms = parentPlatformMapper.selectAllAhareAllLiveStream(); |
| 120 | if (parentPlatforms.size() > 0) { | 120 | if (parentPlatforms.size() > 0) { |
| 121 | for (ParentPlatform parentPlatform : parentPlatforms) { | 121 | for (ParentPlatform parentPlatform : parentPlatforms) { |
| 122 | + stream.setCatalogId(parentPlatform.getCatalogId()); | ||
| 122 | stream.setPlatformId(parentPlatform.getServerGBId()); | 123 | stream.setPlatformId(parentPlatform.getServerGBId()); |
| 123 | String streamId = stream.getStream(); | 124 | String streamId = stream.getStream(); |
| 124 | StreamProxyItem streamProxyItems = platformGbStreamMapper.selectOne(stream.getApp(), streamId, parentPlatform.getServerGBId()); | 125 | StreamProxyItem streamProxyItems = platformGbStreamMapper.selectOne(stream.getApp(), streamId, parentPlatform.getServerGBId()); |
src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java
| @@ -185,6 +185,8 @@ public interface IRedisCatchStorage { | @@ -185,6 +185,8 @@ public interface IRedisCatchStorage { | ||
| 185 | */ | 185 | */ |
| 186 | void updateDevice(Device device); | 186 | void updateDevice(Device device); |
| 187 | 187 | ||
| 188 | + void removeDevice(String deviceId); | ||
| 189 | + | ||
| 188 | /** | 190 | /** |
| 189 | * 获取Device | 191 | * 获取Device |
| 190 | */ | 192 | */ |
src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java
| @@ -243,7 +243,7 @@ public interface IVideoManagerStorager { | @@ -243,7 +243,7 @@ public interface IVideoManagerStorager { | ||
| 243 | * @param channelReduces | 243 | * @param channelReduces |
| 244 | * @return | 244 | * @return |
| 245 | */ | 245 | */ |
| 246 | - int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces); | 246 | + int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces, String catalogId); |
| 247 | 247 | ||
| 248 | /** | 248 | /** |
| 249 | * 移除上级平台的通道信息 | 249 | * 移除上级平台的通道信息 |
| @@ -256,6 +256,9 @@ public interface IVideoManagerStorager { | @@ -256,6 +256,9 @@ public interface IVideoManagerStorager { | ||
| 256 | 256 | ||
| 257 | DeviceChannel queryChannelInParentPlatform(String platformId, String channelId); | 257 | DeviceChannel queryChannelInParentPlatform(String platformId, String channelId); |
| 258 | 258 | ||
| 259 | + List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId); | ||
| 260 | + List<PlatformCatalog> queryStreamInParentPlatformAndCatalog(String platformId, String catalogId); | ||
| 261 | + | ||
| 259 | Device queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId); | 262 | Device queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId); |
| 260 | 263 | ||
| 261 | 264 | ||
| @@ -431,4 +434,26 @@ public interface IVideoManagerStorager { | @@ -431,4 +434,26 @@ public interface IVideoManagerStorager { | ||
| 431 | * @param deviceChannelList | 434 | * @param deviceChannelList |
| 432 | */ | 435 | */ |
| 433 | boolean resetChannels(String deviceId, List<DeviceChannel> deviceChannelList); | 436 | boolean resetChannels(String deviceId, List<DeviceChannel> deviceChannelList); |
| 437 | + | ||
| 438 | + /** | ||
| 439 | + * 获取目录信息 | ||
| 440 | + * @param platformId | ||
| 441 | + * @param parentId | ||
| 442 | + * @return | ||
| 443 | + */ | ||
| 444 | + List<PlatformCatalog> getChildrenCatalogByPlatform(String platformId, String parentId); | ||
| 445 | + | ||
| 446 | + int addCatalog(PlatformCatalog platformCatalog); | ||
| 447 | + | ||
| 448 | + PlatformCatalog getCatalog(String id); | ||
| 449 | + | ||
| 450 | + int delCatalog(String id); | ||
| 451 | + | ||
| 452 | + int updateCatalog(PlatformCatalog platformCatalog); | ||
| 453 | + | ||
| 454 | + int setDefaultCatalog(String platformId, String catalogId); | ||
| 455 | + | ||
| 456 | + List<PlatformCatalog> queryCatalogInPlatform(String serverGBId); | ||
| 457 | + | ||
| 458 | + int delRelation(PlatformCatalog platformCatalog); | ||
| 434 | } | 459 | } |
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
| @@ -91,7 +91,8 @@ public interface DeviceChannelMapper { | @@ -91,7 +91,8 @@ public interface DeviceChannelMapper { | ||
| 91 | "SELECT * FROM ( "+ | 91 | "SELECT * FROM ( "+ |
| 92 | " SELECT dc.channelId, dc.deviceId, dc.name, de.manufacturer, de.hostAddress, " + | 92 | " SELECT dc.channelId, dc.deviceId, dc.name, de.manufacturer, de.hostAddress, " + |
| 93 | "(SELECT count(0) FROM device_channel WHERE parentId=dc.channelId) as subCount, " + | 93 | "(SELECT count(0) FROM device_channel WHERE parentId=dc.channelId) as subCount, " + |
| 94 | - "(SELECT pc.platformId FROM platform_gb_channel pc WHERE pc.deviceId=dc.deviceId AND pc.channelId = dc.channelId ) as platformId " + | 94 | + "(SELECT pc.platformId FROM platform_gb_channel pc WHERE pc.deviceId=dc.deviceId AND pc.channelId = dc.channelId ) as platformId, " + |
| 95 | + "(SELECT pc.catalogId FROM platform_gb_channel pc WHERE pc.deviceId=dc.deviceId AND pc.channelId = dc.channelId ) as catalogId " + | ||
| 95 | "FROM device_channel dc " + | 96 | "FROM device_channel dc " + |
| 96 | "LEFT JOIN device de ON dc.deviceId = de.deviceId " + | 97 | "LEFT JOIN device de ON dc.deviceId = de.deviceId " + |
| 97 | " WHERE 1=1 " + | 98 | " WHERE 1=1 " + |
src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java
| @@ -35,7 +35,7 @@ public interface GbStreamMapper { | @@ -35,7 +35,7 @@ public interface GbStreamMapper { | ||
| 35 | @Delete("DELETE FROM gb_stream WHERE app=#{app} AND stream=#{stream}") | 35 | @Delete("DELETE FROM gb_stream WHERE app=#{app} AND stream=#{stream}") |
| 36 | int del(String app, String stream); | 36 | int del(String app, String stream); |
| 37 | 37 | ||
| 38 | - @Select("SELECT gs.*, pgs.platformId FROM gb_stream gs LEFT JOIN platform_gb_stream pgs ON gs.app = pgs.app AND gs.stream = pgs.stream") | 38 | + @Select("SELECT gs.*, pgs.platformId AS platformId, pgs.catalogId AS catalogId FROM gb_stream gs LEFT JOIN platform_gb_stream pgs ON gs.app = pgs.app AND gs.stream = pgs.stream") |
| 39 | List<GbStream> selectAll(); | 39 | List<GbStream> selectAll(); |
| 40 | 40 | ||
| 41 | @Select("SELECT * FROM gb_stream WHERE app=#{app} AND stream=#{stream}") | 41 | @Select("SELECT * FROM gb_stream WHERE app=#{app} AND stream=#{stream}") |
| @@ -44,12 +44,12 @@ public interface GbStreamMapper { | @@ -44,12 +44,12 @@ public interface GbStreamMapper { | ||
| 44 | @Select("SELECT * FROM gb_stream WHERE gbId=#{gbId}") | 44 | @Select("SELECT * FROM gb_stream WHERE gbId=#{gbId}") |
| 45 | List<GbStream> selectByGBId(String gbId); | 45 | List<GbStream> selectByGBId(String gbId); |
| 46 | 46 | ||
| 47 | - @Select("SELECT gs.*, pgs.platformId FROM gb_stream gs " + | 47 | + @Select("SELECT gs.*, pgs.platformId as platformId, pgs.catalogId as catalogId FROM gb_stream gs " + |
| 48 | "LEFT JOIN platform_gb_stream pgs ON gs.app = pgs.app AND gs.stream = pgs.stream " + | 48 | "LEFT JOIN platform_gb_stream pgs ON gs.app = pgs.app AND gs.stream = pgs.stream " + |
| 49 | "WHERE gs.gbId = '${gbId}' AND pgs.platformId = '${platformId}'") | 49 | "WHERE gs.gbId = '${gbId}' AND pgs.platformId = '${platformId}'") |
| 50 | List<GbStream> queryStreamInPlatform(String platformId, String gbId); | 50 | List<GbStream> queryStreamInPlatform(String platformId, String gbId); |
| 51 | 51 | ||
| 52 | - @Select("SELECT gs.*, pgs.platformId FROM gb_stream gs " + | 52 | + @Select("SELECT gs.*, pgs.platformId as platformId, pgs.catalogId as catalogId FROM gb_stream gs " + |
| 53 | "LEFT JOIN platform_gb_stream pgs ON gs.app = pgs.app AND gs.stream = pgs.stream " + | 53 | "LEFT JOIN platform_gb_stream pgs ON gs.app = pgs.app AND gs.stream = pgs.stream " + |
| 54 | "WHERE pgs.platformId = '${platformId}'") | 54 | "WHERE pgs.platformId = '${platformId}'") |
| 55 | List<GbStream> queryGbStreamListInPlatform(String platformId); | 55 | List<GbStream> queryGbStreamListInPlatform(String platformId); |
| @@ -59,17 +59,11 @@ public interface GbStreamMapper { | @@ -59,17 +59,11 @@ public interface GbStreamMapper { | ||
| 59 | "WHERE app=#{app} AND stream=#{stream}") | 59 | "WHERE app=#{app} AND stream=#{stream}") |
| 60 | int setStatus(String app, String stream, boolean status); | 60 | int setStatus(String app, String stream, boolean status); |
| 61 | 61 | ||
| 62 | - @Select("SELECT gs.*, pgs.platformId FROM gb_stream gs LEFT JOIN platform_gb_stream pgs ON gs.app = pgs.app AND gs.stream = pgs.stream WHERE mediaServerId=#{mediaServerId} ") | ||
| 63 | - List<GbStream> selectAllByMediaServerId(String mediaServerId); | ||
| 64 | - | ||
| 65 | @Update("UPDATE gb_stream " + | 62 | @Update("UPDATE gb_stream " + |
| 66 | "SET status=${status} " + | 63 | "SET status=${status} " + |
| 67 | "WHERE mediaServerId=#{mediaServerId} ") | 64 | "WHERE mediaServerId=#{mediaServerId} ") |
| 68 | void updateStatusByMediaServerId(String mediaServerId, boolean status); | 65 | void updateStatusByMediaServerId(String mediaServerId, boolean status); |
| 69 | 66 | ||
| 70 | - @Select("SELECT * FROM gb_stream WHERE mediaServerId=#{mediaServerId}") | ||
| 71 | - void delByMediaServerId(String mediaServerId); | ||
| 72 | - | ||
| 73 | @Delete("DELETE FROM gb_stream WHERE streamType=#{type} AND gbId=NULL AND mediaServerId=#{mediaServerId}") | 67 | @Delete("DELETE FROM gb_stream WHERE streamType=#{type} AND gbId=NULL AND mediaServerId=#{mediaServerId}") |
| 74 | void deleteWithoutGBId(String type, String mediaServerId); | 68 | void deleteWithoutGBId(String type, String mediaServerId); |
| 75 | 69 |
src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java
| @@ -15,10 +15,10 @@ public interface ParentPlatformMapper { | @@ -15,10 +15,10 @@ public interface ParentPlatformMapper { | ||
| 15 | 15 | ||
| 16 | @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " + | 16 | @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " + |
| 17 | " devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, " + | 17 | " devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, " + |
| 18 | - " status, shareAllLiveStream) " + | 18 | + " status, shareAllLiveStream, catalogId) " + |
| 19 | " VALUES (${enable}, '${name}', '${serverGBId}', '${serverGBDomain}', '${serverIP}', ${serverPort}, '${deviceGBId}', '${deviceIp}', " + | 19 | " VALUES (${enable}, '${name}', '${serverGBId}', '${serverGBDomain}', '${serverIP}', ${serverPort}, '${deviceGBId}', '${deviceIp}', " + |
| 20 | " '${devicePort}', '${username}', '${password}', '${expires}', '${keepTimeout}', '${transport}', '${characterSet}', ${ptz}, ${rtcp}, " + | 20 | " '${devicePort}', '${username}', '${password}', '${expires}', '${keepTimeout}', '${transport}', '${characterSet}', ${ptz}, ${rtcp}, " + |
| 21 | - " ${status}, ${shareAllLiveStream})") | 21 | + " ${status}, ${shareAllLiveStream}, #{catalogId})") |
| 22 | int addParentPlatform(ParentPlatform parentPlatform); | 22 | int addParentPlatform(ParentPlatform parentPlatform); |
| 23 | 23 | ||
| 24 | @Update("UPDATE parent_platform " + | 24 | @Update("UPDATE parent_platform " + |
| @@ -40,7 +40,8 @@ public interface ParentPlatformMapper { | @@ -40,7 +40,8 @@ public interface ParentPlatformMapper { | ||
| 40 | "ptz=#{ptz}, " + | 40 | "ptz=#{ptz}, " + |
| 41 | "rtcp=#{rtcp}, " + | 41 | "rtcp=#{rtcp}, " + |
| 42 | "status=#{status}, " + | 42 | "status=#{status}, " + |
| 43 | - "shareAllLiveStream=#{shareAllLiveStream} " + | 43 | + "shareAllLiveStream=#{shareAllLiveStream}, " + |
| 44 | + "catalogId=#{catalogId} " + | ||
| 44 | "WHERE id=#{id}") | 45 | "WHERE id=#{id}") |
| 45 | int updateParentPlatform(ParentPlatform parentPlatform); | 46 | int updateParentPlatform(ParentPlatform parentPlatform); |
| 46 | 47 | ||
| @@ -74,4 +75,11 @@ public interface ParentPlatformMapper { | @@ -74,4 +75,11 @@ public interface ParentPlatformMapper { | ||
| 74 | 75 | ||
| 75 | @Select("SELECT * FROM parent_platform WHERE shareAllLiveStream=true") | 76 | @Select("SELECT * FROM parent_platform WHERE shareAllLiveStream=true") |
| 76 | List<ParentPlatform> selectAllAhareAllLiveStream(); | 77 | List<ParentPlatform> selectAllAhareAllLiveStream(); |
| 78 | + | ||
| 79 | + @Update(value = {" <script>" + | ||
| 80 | + "UPDATE parent_platform " + | ||
| 81 | + "SET catalogId=#{catalogId}" + | ||
| 82 | + "WHERE serverGBId=#{platformId}"+ | ||
| 83 | + "</script>"}) | ||
| 84 | + int setDefaultCatalog(String platformId, String catalogId); | ||
| 77 | } | 85 | } |
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformCatalogMapper.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.storager.dao; | ||
| 2 | + | ||
| 3 | +import com.genersoft.iot.vmp.gb28181.bean.GbStream; | ||
| 4 | +import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog; | ||
| 5 | +import com.genersoft.iot.vmp.gb28181.bean.PlatformGbStream; | ||
| 6 | +import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; | ||
| 7 | +import org.apache.ibatis.annotations.*; | ||
| 8 | +import org.springframework.stereotype.Repository; | ||
| 9 | + | ||
| 10 | +import java.util.List; | ||
| 11 | + | ||
| 12 | + | ||
| 13 | +@Mapper | ||
| 14 | +@Repository | ||
| 15 | +public interface PlatformCatalogMapper { | ||
| 16 | + | ||
| 17 | + @Insert("INSERT INTO platform_catalog (id, name, platformId, parentId) VALUES" + | ||
| 18 | + "(#{id}, #{name}, #{platformId}, #{parentId})") | ||
| 19 | + int add(PlatformCatalog platformCatalog); | ||
| 20 | + | ||
| 21 | + @Delete("DELETE FROM platform_catalog WHERE id=#{id}") | ||
| 22 | + int del(String id); | ||
| 23 | + | ||
| 24 | + @Delete("DELETE FROM platform_catalog WHERE platformId=#{platformId}") | ||
| 25 | + int delByPlatformId(String platformId); | ||
| 26 | + | ||
| 27 | + @Select("SELECT *, (SELECT COUNT(1) from platform_catalog where parentId = pc.id AND platformId=#{platformId}) as childrenCount FROM platform_catalog pc WHERE parentId=#{parentId} AND platformId=#{platformId}") | ||
| 28 | + List<PlatformCatalog> selectByParentId(String platformId, String parentId); | ||
| 29 | + | ||
| 30 | + @Select("SELECT *, (SELECT COUNT(1) from platform_catalog where parentId = pc.id) as childrenCount FROM platform_catalog pc WHERE pc.id=#{id}") | ||
| 31 | + PlatformCatalog select(String id); | ||
| 32 | + | ||
| 33 | + @Update(value = {" <script>" + | ||
| 34 | + "UPDATE platform_catalog " + | ||
| 35 | + "SET name=#{name}" + | ||
| 36 | + "WHERE id=#{id}"+ | ||
| 37 | + "</script>"}) | ||
| 38 | + int update(PlatformCatalog platformCatalog); | ||
| 39 | + | ||
| 40 | + @Select("SELECT *, (SELECT COUNT(1) from platform_catalog where parentId = pc.id) as childrenCount FROM platform_catalog pc WHERE pc.platformId=#{platformId}") | ||
| 41 | + List<PlatformCatalog> selectByPlatForm(String platformId); | ||
| 42 | +} |
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
| @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.storager.dao; | @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.storager.dao; | ||
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 3 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 4 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | 4 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 5 | +import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog; | ||
| 5 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | 6 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; |
| 6 | import org.apache.ibatis.annotations.Delete; | 7 | import org.apache.ibatis.annotations.Delete; |
| 7 | import org.apache.ibatis.annotations.Insert; | 8 | import org.apache.ibatis.annotations.Insert; |
| @@ -25,9 +26,9 @@ public interface PlatformChannelMapper { | @@ -25,9 +26,9 @@ public interface PlatformChannelMapper { | ||
| 25 | List<String> findChannelRelatedPlatform(String platformId, List<String> deviceAndChannelIds); | 26 | List<String> findChannelRelatedPlatform(String platformId, List<String> deviceAndChannelIds); |
| 26 | 27 | ||
| 27 | @Insert("<script> "+ | 28 | @Insert("<script> "+ |
| 28 | - "INSERT INTO platform_gb_channel (channelId, deviceId, platformId, deviceAndChannelId) VALUES" + | 29 | + "INSERT INTO platform_gb_channel (channelId, deviceId, platformId, deviceAndChannelId, catalogId) VALUES" + |
| 29 | "<foreach collection='channelReducesToAdd' item='item' separator=','>" + | 30 | "<foreach collection='channelReducesToAdd' item='item' separator=','>" + |
| 30 | - " ('${item.channelId}','${item.deviceId}', '${platformId}', '${item.deviceId}_${item.channelId}' )" + | 31 | + " ('${item.channelId}','${item.deviceId}', '${platformId}', '${item.deviceId}_${item.channelId}' , '${item.catalogId}' )" + |
| 31 | "</foreach>" + | 32 | "</foreach>" + |
| 32 | "</script>") | 33 | "</script>") |
| 33 | int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd); | 34 | int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd); |
| @@ -54,6 +55,22 @@ public interface PlatformChannelMapper { | @@ -54,6 +55,22 @@ public interface PlatformChannelMapper { | ||
| 54 | "platformId='${platformId}' AND channelId='${channelId}' ) AND channelId='${channelId}'") | 55 | "platformId='${platformId}' AND channelId='${channelId}' ) AND channelId='${channelId}'") |
| 55 | DeviceChannel queryChannelInParentPlatform(String platformId, String channelId); | 56 | DeviceChannel queryChannelInParentPlatform(String platformId, String channelId); |
| 56 | 57 | ||
| 58 | + | ||
| 59 | + @Select("select dc.channelId as id, dc.name as name, pgc.platformId as platformId, pgc.catalogId as parentId, 0 as childrenCount, 1 as type " + | ||
| 60 | + "from device_channel dc left join platform_gb_channel pgc on dc.deviceId = pgc.deviceId and dc.channelId = pgc.channelId " + | ||
| 61 | + "where pgc.platformId=#{platformId} and pgc.catalogId=#{catalogId}") | ||
| 62 | + List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId); | ||
| 63 | + | ||
| 57 | @Select("SELECT * FROM device WHERE deviceId = (SELECT deviceId FROM platform_gb_channel WHERE platformId='${platformId}' AND channelId='${channelId}')") | 64 | @Select("SELECT * FROM device WHERE deviceId = (SELECT deviceId FROM platform_gb_channel WHERE platformId='${platformId}' AND channelId='${channelId}')") |
| 58 | Device queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId); | 65 | Device queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId); |
| 66 | + | ||
| 67 | + @Delete("<script> "+ | ||
| 68 | + "DELETE FROM platform_gb_channel WHERE catalogId=#{id}" + | ||
| 69 | + "</script>") | ||
| 70 | + int delByCatalogId(String id); | ||
| 71 | + | ||
| 72 | + @Delete("<script> "+ | ||
| 73 | + "DELETE FROM platform_gb_channel WHERE catalogId=#{parentId} AND platformId=#{platformId} AND channelId=#{id}" + | ||
| 74 | + "</script>") | ||
| 75 | + int delByCatalogIdAndChannelIdAndPlatformId(PlatformCatalog platformCatalog); | ||
| 59 | } | 76 | } |
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java
| 1 | package com.genersoft.iot.vmp.storager.dao; | 1 | package com.genersoft.iot.vmp.storager.dao; |
| 2 | 2 | ||
| 3 | +import com.genersoft.iot.vmp.gb28181.bean.GbStream; | ||
| 4 | +import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog; | ||
| 3 | import com.genersoft.iot.vmp.gb28181.bean.PlatformGbStream; | 5 | import com.genersoft.iot.vmp.gb28181.bean.PlatformGbStream; |
| 4 | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; | 6 | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
| 5 | import org.apache.ibatis.annotations.*; | 7 | import org.apache.ibatis.annotations.*; |
| @@ -12,8 +14,8 @@ import java.util.List; | @@ -12,8 +14,8 @@ import java.util.List; | ||
| 12 | @Repository | 14 | @Repository |
| 13 | public interface PlatformGbStreamMapper { | 15 | public interface PlatformGbStreamMapper { |
| 14 | 16 | ||
| 15 | - @Insert("INSERT INTO platform_gb_stream (app, stream, platformId) VALUES" + | ||
| 16 | - "('${app}', '${stream}', '${platformId}')") | 17 | + @Insert("INSERT INTO platform_gb_stream (app, stream, platformId, catalogId) VALUES" + |
| 18 | + "('${app}', '${stream}', '${platformId}', '${catalogId}')") | ||
| 17 | int add(PlatformGbStream platformGbStream); | 19 | int add(PlatformGbStream platformGbStream); |
| 18 | 20 | ||
| 19 | @Delete("DELETE FROM platform_gb_stream WHERE app=#{app} AND stream=#{stream}") | 21 | @Delete("DELETE FROM platform_gb_stream WHERE app=#{app} AND stream=#{stream}") |
| @@ -27,4 +29,22 @@ public interface PlatformGbStreamMapper { | @@ -27,4 +29,22 @@ public interface PlatformGbStreamMapper { | ||
| 27 | 29 | ||
| 28 | @Select("SELECT * FROM platform_gb_stream WHERE app=#{app} AND stream=#{stream} AND platformId=#{serverGBId}") | 30 | @Select("SELECT * FROM platform_gb_stream WHERE app=#{app} AND stream=#{stream} AND platformId=#{serverGBId}") |
| 29 | StreamProxyItem selectOne(String app, String stream, String serverGBId); | 31 | StreamProxyItem selectOne(String app, String stream, String serverGBId); |
| 32 | + | ||
| 33 | + @Select("select gs.* \n" + | ||
| 34 | + "from gb_stream gs\n" + | ||
| 35 | + " left join platform_gb_stream pgs\n" + | ||
| 36 | + " on gs.app = pgs.app and gs.stream = pgs.stream\n" + | ||
| 37 | + "where pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}") | ||
| 38 | + List<GbStream> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId); | ||
| 39 | + | ||
| 40 | + @Select("select gs.gbId as id, gs.name as name, pgs.platformId as platformId, pgs.catalogId as catalogId , 0 as childrenCount, 2 as type\n" + | ||
| 41 | + "from gb_stream gs\n" + | ||
| 42 | + " left join platform_gb_stream pgs\n" + | ||
| 43 | + " on gs.app = pgs.app and gs.stream = pgs.stream\n" + | ||
| 44 | + "where pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}") | ||
| 45 | + List<PlatformCatalog> queryChannelInParentPlatformAndCatalogForCatlog(String platformId, String catalogId); | ||
| 46 | + | ||
| 47 | + @Delete("DELETE FROM platform_gb_stream WHERE catalogId=#{id}") | ||
| 48 | + int delByCatalogId(String id); | ||
| 49 | + | ||
| 30 | } | 50 | } |
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
| @@ -407,6 +407,12 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -407,6 +407,12 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 407 | } | 407 | } |
| 408 | 408 | ||
| 409 | @Override | 409 | @Override |
| 410 | + public void removeDevice(String deviceId) { | ||
| 411 | + String key = VideoManagerConstants.DEVICE_PREFIX + userSetup.getServerId() + "_" + deviceId; | ||
| 412 | + redis.del(key); | ||
| 413 | + } | ||
| 414 | + | ||
| 415 | + @Override | ||
| 410 | public Device getDevice(String deviceId) { | 416 | public Device getDevice(String deviceId) { |
| 411 | String key = VideoManagerConstants.DEVICE_PREFIX + userSetup.getServerId() + "_" + deviceId; | 417 | String key = VideoManagerConstants.DEVICE_PREFIX + userSetup.getServerId() + "_" + deviceId; |
| 412 | return (Device)redis.get(key); | 418 | return (Device)redis.get(key); |
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
| @@ -71,6 +71,9 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | @@ -71,6 +71,9 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | ||
| 71 | 71 | ||
| 72 | @Autowired | 72 | @Autowired |
| 73 | private GbStreamMapper gbStreamMapper; | 73 | private GbStreamMapper gbStreamMapper; |
| 74 | + | ||
| 75 | + @Autowired | ||
| 76 | + private PlatformCatalogMapper catalogMapper; | ||
| 74 | ; | 77 | ; |
| 75 | 78 | ||
| 76 | @Autowired | 79 | @Autowired |
| @@ -449,6 +452,9 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | @@ -449,6 +452,9 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | ||
| 449 | 452 | ||
| 450 | @Override | 453 | @Override |
| 451 | public boolean addParentPlatform(ParentPlatform parentPlatform) { | 454 | public boolean addParentPlatform(ParentPlatform parentPlatform) { |
| 455 | + if (parentPlatform.getCatalogId() == null) { | ||
| 456 | + parentPlatform.setCatalogId(parentPlatform.getServerGBId()); | ||
| 457 | + } | ||
| 452 | int result = platformMapper.addParentPlatform(parentPlatform); | 458 | int result = platformMapper.addParentPlatform(parentPlatform); |
| 453 | return result > 0; | 459 | return result > 0; |
| 454 | } | 460 | } |
| @@ -458,6 +464,9 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | @@ -458,6 +464,9 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | ||
| 458 | int result = 0; | 464 | int result = 0; |
| 459 | ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId()); // .getDeviceGBId()); | 465 | ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId()); // .getDeviceGBId()); |
| 460 | if (parentPlatform.getId() == null ) { | 466 | if (parentPlatform.getId() == null ) { |
| 467 | + if (parentPlatform.getCatalogId() == null) { | ||
| 468 | + parentPlatform.setCatalogId(parentPlatform.getServerGBId()); | ||
| 469 | + } | ||
| 461 | result = platformMapper.addParentPlatform(parentPlatform); | 470 | result = platformMapper.addParentPlatform(parentPlatform); |
| 462 | if (parentPlatformCatch == null) { | 471 | if (parentPlatformCatch == null) { |
| 463 | parentPlatformCatch = new ParentPlatformCatch(); | 472 | parentPlatformCatch = new ParentPlatformCatch(); |
| @@ -480,8 +489,11 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | @@ -480,8 +489,11 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | ||
| 480 | // 共享所有视频流,需要将现有视频流添加到此平台 | 489 | // 共享所有视频流,需要将现有视频流添加到此平台 |
| 481 | List<GbStream> gbStreams = gbStreamMapper.selectAll(); | 490 | List<GbStream> gbStreams = gbStreamMapper.selectAll(); |
| 482 | if (gbStreams.size() > 0) { | 491 | if (gbStreams.size() > 0) { |
| 492 | + for (GbStream gbStream : gbStreams) { | ||
| 493 | + gbStream.setCatalogId(parentPlatform.getCatalogId()); | ||
| 494 | + } | ||
| 483 | if (parentPlatform.isShareAllLiveStream()) { | 495 | if (parentPlatform.isShareAllLiveStream()) { |
| 484 | - gbStreamService.addPlatformInfo(gbStreams, parentPlatform.getServerGBId()); | 496 | + gbStreamService.addPlatformInfo(gbStreams, parentPlatform.getServerGBId(), parentPlatform.getCatalogId()); |
| 485 | }else { | 497 | }else { |
| 486 | gbStreamService.delPlatformInfo(gbStreams); | 498 | gbStreamService.delPlatformInfo(gbStreams); |
| 487 | } | 499 | } |
| @@ -536,10 +548,11 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | @@ -536,10 +548,11 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | ||
| 536 | } | 548 | } |
| 537 | 549 | ||
| 538 | @Override | 550 | @Override |
| 539 | - public int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces) { | 551 | + public int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces, String catalogId) { |
| 540 | 552 | ||
| 541 | Map<String, ChannelReduce> deviceAndChannels = new HashMap<>(); | 553 | Map<String, ChannelReduce> deviceAndChannels = new HashMap<>(); |
| 542 | for (ChannelReduce channelReduce : channelReduces) { | 554 | for (ChannelReduce channelReduce : channelReduces) { |
| 555 | + channelReduce.setCatalogId(catalogId); | ||
| 543 | deviceAndChannels.put(channelReduce.getDeviceId() + "_" + channelReduce.getChannelId(), channelReduce); | 556 | deviceAndChannels.put(channelReduce.getDeviceId() + "_" + channelReduce.getChannelId(), channelReduce); |
| 544 | } | 557 | } |
| 545 | List<String> deviceAndChannelList = new ArrayList<>(deviceAndChannels.keySet()); | 558 | List<String> deviceAndChannelList = new ArrayList<>(deviceAndChannels.keySet()); |
| @@ -577,6 +590,18 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | @@ -577,6 +590,18 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | ||
| 577 | } | 590 | } |
| 578 | 591 | ||
| 579 | @Override | 592 | @Override |
| 593 | + public List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId) { | ||
| 594 | + List<PlatformCatalog> catalogs = platformChannelMapper.queryChannelInParentPlatformAndCatalog(platformId, catalogId); | ||
| 595 | + return catalogs; | ||
| 596 | + } | ||
| 597 | + | ||
| 598 | + @Override | ||
| 599 | + public List<PlatformCatalog> queryStreamInParentPlatformAndCatalog(String platformId, String catalogId) { | ||
| 600 | + List<PlatformCatalog> catalogs = platformGbStreamMapper.queryChannelInParentPlatformAndCatalogForCatlog(platformId, catalogId); | ||
| 601 | + return catalogs; | ||
| 602 | + } | ||
| 603 | + | ||
| 604 | + @Override | ||
| 580 | public Device queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId) { | 605 | public Device queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId) { |
| 581 | Device device = platformChannelMapper.queryVideoDeviceByPlatformIdAndChannelId(platformId, channelId); | 606 | Device device = platformChannelMapper.queryVideoDeviceByPlatformIdAndChannelId(platformId, channelId); |
| 582 | return device; | 607 | return device; |
| @@ -739,6 +764,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | @@ -739,6 +764,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | ||
| 739 | List<ParentPlatform> parentPlatforms = parentPlatformMapper.selectAllAhareAllLiveStream(); | 764 | List<ParentPlatform> parentPlatforms = parentPlatformMapper.selectAllAhareAllLiveStream(); |
| 740 | if (parentPlatforms.size() > 0) { | 765 | if (parentPlatforms.size() > 0) { |
| 741 | for (ParentPlatform parentPlatform : parentPlatforms) { | 766 | for (ParentPlatform parentPlatform : parentPlatforms) { |
| 767 | + streamPushItem.setCatalogId(parentPlatform.getCatalogId()); | ||
| 742 | streamPushItem.setPlatformId(parentPlatform.getServerGBId()); | 768 | streamPushItem.setPlatformId(parentPlatform.getServerGBId()); |
| 743 | String stream = streamPushItem.getStream(); | 769 | String stream = streamPushItem.getStream(); |
| 744 | StreamProxyItem streamProxyItems = platformGbStreamMapper.selectOne(streamPushItem.getApp(), stream, parentPlatform.getServerGBId()); | 770 | StreamProxyItem streamProxyItems = platformGbStreamMapper.selectOne(streamPushItem.getApp(), stream, parentPlatform.getServerGBId()); |
| @@ -804,4 +830,69 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | @@ -804,4 +830,69 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | ||
| 804 | return streamProxyMapper.selectOne(app, streamId); | 830 | return streamProxyMapper.selectOne(app, streamId); |
| 805 | } | 831 | } |
| 806 | 832 | ||
| 833 | + @Override | ||
| 834 | + public List<PlatformCatalog> getChildrenCatalogByPlatform(String platformId, String parentId) { | ||
| 835 | + return catalogMapper.selectByParentId(platformId, parentId); | ||
| 836 | + } | ||
| 837 | + | ||
| 838 | + @Override | ||
| 839 | + public int addCatalog(PlatformCatalog platformCatalog) { | ||
| 840 | + return catalogMapper.add(platformCatalog); | ||
| 841 | + } | ||
| 842 | + | ||
| 843 | + @Override | ||
| 844 | + public PlatformCatalog getCatalog(String id) { | ||
| 845 | + return catalogMapper.select(id); | ||
| 846 | + } | ||
| 847 | + | ||
| 848 | + @Override | ||
| 849 | + public int delCatalog(String id) { | ||
| 850 | + PlatformCatalog platformCatalog = catalogMapper.select(id); | ||
| 851 | + if (platformCatalog.getChildrenCount() > 0) { | ||
| 852 | + List<PlatformCatalog> platformCatalogList = catalogMapper.selectByParentId(platformCatalog.getPlatformId(), platformCatalog.getId()); | ||
| 853 | + for (PlatformCatalog catalog : platformCatalogList) { | ||
| 854 | + if (catalog.getChildrenCount() == 0) { | ||
| 855 | + catalogMapper.del(catalog.getId()); | ||
| 856 | + platformGbStreamMapper.delByCatalogId(catalog.getId()); | ||
| 857 | + platformChannelMapper.delByCatalogId(catalog.getId()); | ||
| 858 | + }else { | ||
| 859 | + delCatalog(catalog.getId()); | ||
| 860 | + } | ||
| 861 | + } | ||
| 862 | + } | ||
| 863 | + int delresult = catalogMapper.del(id); | ||
| 864 | + int delStreamresult = platformGbStreamMapper.delByCatalogId(id); | ||
| 865 | + int delChanneresult = platformChannelMapper.delByCatalogId(id); | ||
| 866 | + return delresult + delChanneresult + delStreamresult; | ||
| 867 | + } | ||
| 868 | + | ||
| 869 | + @Override | ||
| 870 | + public int updateCatalog(PlatformCatalog platformCatalog) { | ||
| 871 | + return catalogMapper.update(platformCatalog); | ||
| 872 | + } | ||
| 873 | + | ||
| 874 | + @Override | ||
| 875 | + public int setDefaultCatalog(String platformId, String catalogId) { | ||
| 876 | + return platformMapper.setDefaultCatalog(platformId, catalogId); | ||
| 877 | + } | ||
| 878 | + | ||
| 879 | + @Override | ||
| 880 | + public List<PlatformCatalog> queryCatalogInPlatform(String platformId) { | ||
| 881 | + return catalogMapper.selectByPlatForm(platformId); | ||
| 882 | + } | ||
| 883 | + | ||
| 884 | + @Override | ||
| 885 | + public int delRelation(PlatformCatalog platformCatalog) { | ||
| 886 | + if (platformCatalog.getType() == 1) { | ||
| 887 | + return platformChannelMapper.delByCatalogIdAndChannelIdAndPlatformId(platformCatalog); | ||
| 888 | + }else if (platformCatalog.getType() == 2) { | ||
| 889 | + List<GbStream> gbStreams = platformGbStreamMapper.queryChannelInParentPlatformAndCatalog(platformCatalog.getPlatformId(), platformCatalog.getParentId()); | ||
| 890 | + for (GbStream gbStream : gbStreams) { | ||
| 891 | + if (gbStream.getGbId().equals(platformCatalog.getId())) { | ||
| 892 | + return platformGbStreamMapper.delByAppAndStream(gbStream.getApp(), gbStream.getStream()); | ||
| 893 | + } | ||
| 894 | + } | ||
| 895 | + } | ||
| 896 | + return 0; | ||
| 897 | + } | ||
| 807 | } | 898 | } |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
| @@ -152,12 +152,16 @@ public class DeviceQuery { | @@ -152,12 +152,16 @@ public class DeviceQuery { | ||
| 152 | String uuid = UUID.randomUUID().toString(); | 152 | String uuid = UUID.randomUUID().toString(); |
| 153 | DeferredResult<ResponseEntity<Device>> result = new DeferredResult<ResponseEntity<Device>>(15*1000L); | 153 | DeferredResult<ResponseEntity<Device>> result = new DeferredResult<ResponseEntity<Device>>(15*1000L); |
| 154 | result.onTimeout(()->{ | 154 | result.onTimeout(()->{ |
| 155 | - logger.warn(String.format("设备通道信息同步超时")); | 155 | + logger.warn("设备[{}]通道信息同步超时", deviceId); |
| 156 | // 释放rtpserver | 156 | // 释放rtpserver |
| 157 | RequestMessage msg = new RequestMessage(); | 157 | RequestMessage msg = new RequestMessage(); |
| 158 | msg.setKey(key); | 158 | msg.setKey(key); |
| 159 | msg.setId(uuid); | 159 | msg.setId(uuid); |
| 160 | - msg.setData("Timeout"); | 160 | + WVPResult<Object> wvpResult = new WVPResult<>(); |
| 161 | + wvpResult.setCode(-1); | ||
| 162 | + wvpResult.setData(device); | ||
| 163 | + wvpResult.setMsg("更新超时"); | ||
| 164 | + msg.setData(wvpResult); | ||
| 161 | resultHolder.invokeAllResult(msg); | 165 | resultHolder.invokeAllResult(msg); |
| 162 | }); | 166 | }); |
| 163 | // 等待其他相同请求返回时一起返回 | 167 | // 等待其他相同请求返回时一起返回 |
| @@ -168,7 +172,11 @@ public class DeviceQuery { | @@ -168,7 +172,11 @@ public class DeviceQuery { | ||
| 168 | RequestMessage msg = new RequestMessage(); | 172 | RequestMessage msg = new RequestMessage(); |
| 169 | msg.setKey(key); | 173 | msg.setKey(key); |
| 170 | msg.setId(uuid); | 174 | msg.setId(uuid); |
| 171 | - msg.setData(String.format("同步通道失败,错误码: %s, %s", event.statusCode, event.msg)); | 175 | + WVPResult<Object> wvpResult = new WVPResult<>(); |
| 176 | + wvpResult.setCode(-1); | ||
| 177 | + wvpResult.setData(device); | ||
| 178 | + wvpResult.setMsg(String.format("同步通道失败,错误码: %s, %s", event.statusCode, event.msg)); | ||
| 179 | + msg.setData(wvpResult); | ||
| 172 | resultHolder.invokeAllResult(msg); | 180 | resultHolder.invokeAllResult(msg); |
| 173 | }); | 181 | }); |
| 174 | 182 | ||
| @@ -199,6 +207,7 @@ public class DeviceQuery { | @@ -199,6 +207,7 @@ public class DeviceQuery { | ||
| 199 | boolean isSuccess = storager.delete(deviceId); | 207 | boolean isSuccess = storager.delete(deviceId); |
| 200 | if (isSuccess) { | 208 | if (isSuccess) { |
| 201 | redisCatchStorage.clearCatchByDeviceId(deviceId); | 209 | redisCatchStorage.clearCatchByDeviceId(deviceId); |
| 210 | + redisCatchStorage.removeDevice(deviceId); | ||
| 202 | JSONObject json = new JSONObject(); | 211 | JSONObject json = new JSONObject(); |
| 203 | json.put("deviceId", deviceId); | 212 | json.put("deviceId", deviceId); |
| 204 | return new ResponseEntity<>(json.toString(),HttpStatus.OK); | 213 | return new ResponseEntity<>(json.toString(),HttpStatus.OK); |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java
| @@ -82,7 +82,7 @@ public class GbStreamController { | @@ -82,7 +82,7 @@ public class GbStreamController { | ||
| 82 | @PostMapping(value = "/add") | 82 | @PostMapping(value = "/add") |
| 83 | @ResponseBody | 83 | @ResponseBody |
| 84 | public Object add(@RequestBody GbStreamParam gbStreamParam){ | 84 | public Object add(@RequestBody GbStreamParam gbStreamParam){ |
| 85 | - if (gbStreamService.addPlatformInfo(gbStreamParam.getGbStreams(), gbStreamParam.getPlatformId())) { | 85 | + if (gbStreamService.addPlatformInfo(gbStreamParam.getGbStreams(), gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId())) { |
| 86 | return "success"; | 86 | return "success"; |
| 87 | }else { | 87 | }else { |
| 88 | return "fail"; | 88 | return "fail"; |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/bean/GbStreamParam.java
| @@ -8,12 +8,22 @@ public class GbStreamParam { | @@ -8,12 +8,22 @@ public class GbStreamParam { | ||
| 8 | 8 | ||
| 9 | private String platformId; | 9 | private String platformId; |
| 10 | 10 | ||
| 11 | + private String catalogId; | ||
| 12 | + | ||
| 11 | private List<GbStream> gbStreams; | 13 | private List<GbStream> gbStreams; |
| 12 | 14 | ||
| 13 | public String getPlatformId() { | 15 | public String getPlatformId() { |
| 14 | return platformId; | 16 | return platformId; |
| 15 | } | 17 | } |
| 16 | 18 | ||
| 19 | + public String getCatalogId() { | ||
| 20 | + return catalogId; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + public void setCatalogId(String catalogId) { | ||
| 24 | + this.catalogId = catalogId; | ||
| 25 | + } | ||
| 26 | + | ||
| 17 | public void setPlatformId(String platformId) { | 27 | public void setPlatformId(String platformId) { |
| 18 | this.platformId = platformId; | 28 | this.platformId = platformId; |
| 19 | } | 29 | } |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
| 1 | package com.genersoft.iot.vmp.vmanager.gb28181.platform; | 1 | package com.genersoft.iot.vmp.vmanager.gb28181.platform; |
| 2 | 2 | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
| 5 | +import com.genersoft.iot.vmp.gb28181.bean.CatalogData; | ||
| 6 | +import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | ||
| 4 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | 7 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 8 | +import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog; | ||
| 5 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; | 9 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| 6 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 10 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 7 | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 11 | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
| 12 | +import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | ||
| 8 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | 13 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; |
| 9 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.UpdateChannelParam; | 14 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.UpdateChannelParam; |
| 10 | import com.github.pagehelper.PageInfo; | 15 | import com.github.pagehelper.PageInfo; |
| @@ -21,6 +26,8 @@ import org.springframework.util.StringUtils; | @@ -21,6 +26,8 @@ import org.springframework.util.StringUtils; | ||
| 21 | import org.springframework.web.bind.annotation.*; | 26 | import org.springframework.web.bind.annotation.*; |
| 22 | import com.genersoft.iot.vmp.conf.SipConfig; | 27 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 23 | 28 | ||
| 29 | +import java.util.List; | ||
| 30 | + | ||
| 24 | /** | 31 | /** |
| 25 | * 级联平台管理 | 32 | * 级联平台管理 |
| 26 | */ | 33 | */ |
| @@ -253,7 +260,7 @@ public class PlatformController { | @@ -253,7 +260,7 @@ public class PlatformController { | ||
| 253 | if (logger.isDebugEnabled()) { | 260 | if (logger.isDebugEnabled()) { |
| 254 | logger.debug("给上级平台添加国标通道API调用"); | 261 | logger.debug("给上级平台添加国标通道API调用"); |
| 255 | } | 262 | } |
| 256 | - int result = storager.updateChannelForGB(param.getPlatformId(), param.getChannelReduces()); | 263 | + int result = storager.updateChannelForGB(param.getPlatformId(), param.getChannelReduces(), param.getCatalogId()); |
| 257 | 264 | ||
| 258 | return new ResponseEntity<>(String.valueOf(result > 0), HttpStatus.OK); | 265 | return new ResponseEntity<>(String.valueOf(result > 0), HttpStatus.OK); |
| 259 | } | 266 | } |
| @@ -279,5 +286,197 @@ public class PlatformController { | @@ -279,5 +286,197 @@ public class PlatformController { | ||
| 279 | return new ResponseEntity<>(String.valueOf(result > 0), HttpStatus.OK); | 286 | return new ResponseEntity<>(String.valueOf(result > 0), HttpStatus.OK); |
| 280 | } | 287 | } |
| 281 | 288 | ||
| 289 | + /** | ||
| 290 | + * 获取目录 | ||
| 291 | + * @param platformId 平台ID | ||
| 292 | + * @param parentId 目录父ID | ||
| 293 | + * @return | ||
| 294 | + */ | ||
| 295 | + @ApiOperation("获取目录") | ||
| 296 | + @ApiImplicitParams({ | ||
| 297 | + @ApiImplicitParam(name = "platformId", value = "平台ID", dataTypeClass = String.class, required = true), | ||
| 298 | + @ApiImplicitParam(name = "parentId", value = "目录父ID", dataTypeClass = String.class, required = true), | ||
| 299 | + }) | ||
| 300 | + @GetMapping("/catalog") | ||
| 301 | + @ResponseBody | ||
| 302 | + public ResponseEntity<WVPResult<List<PlatformCatalog>>> getCatalogByPlatform(String platformId, String parentId){ | ||
| 303 | + | ||
| 304 | + if (logger.isDebugEnabled()) { | ||
| 305 | + logger.debug("查询目录,platformId: {}, parentId: {}", platformId, parentId); | ||
| 306 | + } | ||
| 307 | + List<PlatformCatalog> platformCatalogList = storager.getChildrenCatalogByPlatform(platformId, parentId); | ||
| 308 | + // 查询下属的国标通道 | ||
| 309 | + List<PlatformCatalog> catalogsForChannel = storager.queryChannelInParentPlatformAndCatalog(platformId, parentId); | ||
| 310 | + List<PlatformCatalog> catalogsForStream = storager.queryStreamInParentPlatformAndCatalog(platformId, parentId); | ||
| 311 | + platformCatalogList.addAll(catalogsForChannel); | ||
| 312 | + platformCatalogList.addAll(catalogsForStream); | ||
| 313 | + WVPResult<List<PlatformCatalog>> result = new WVPResult<>(); | ||
| 314 | + result.setCode(0); | ||
| 315 | + result.setMsg("success"); | ||
| 316 | + result.setData(platformCatalogList); | ||
| 317 | + return new ResponseEntity<>(result, HttpStatus.OK); | ||
| 318 | + } | ||
| 319 | + | ||
| 320 | + /** | ||
| 321 | + * 添加目录 | ||
| 322 | + * @param platformCatalog 目录 | ||
| 323 | + * @return | ||
| 324 | + */ | ||
| 325 | + @ApiOperation("添加目录") | ||
| 326 | + @ApiImplicitParams({ | ||
| 327 | + @ApiImplicitParam(name = "platformCatalog", value = "目录信息", dataTypeClass = PlatformCatalog.class, required = true), | ||
| 328 | + }) | ||
| 329 | + @PostMapping("/catalog/add") | ||
| 330 | + @ResponseBody | ||
| 331 | + public ResponseEntity<WVPResult<List<PlatformCatalog>>> addCatalog(@RequestBody PlatformCatalog platformCatalog){ | ||
| 332 | + | ||
| 333 | + if (logger.isDebugEnabled()) { | ||
| 334 | + logger.debug("添加目录,{}", JSON.toJSONString(platformCatalog)); | ||
| 335 | + } | ||
| 336 | + PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getId()); | ||
| 337 | + WVPResult<List<PlatformCatalog>> result = new WVPResult<>(); | ||
| 338 | + | ||
| 339 | + | ||
| 340 | + if (platformCatalogInStore != null) { | ||
| 341 | + result.setCode(-1); | ||
| 342 | + result.setMsg( platformCatalog.getId() + " already exists"); | ||
| 343 | + return new ResponseEntity<>(result, HttpStatus.OK); | ||
| 344 | + } | ||
| 345 | + int addResult = storager.addCatalog(platformCatalog); | ||
| 346 | + if (addResult > 0) { | ||
| 347 | + result.setCode(0); | ||
| 348 | + result.setMsg("success"); | ||
| 349 | + return new ResponseEntity<>(result, HttpStatus.OK); | ||
| 350 | + }else { | ||
| 351 | + result.setCode(-500); | ||
| 352 | + result.setMsg("save error"); | ||
| 353 | + return new ResponseEntity<>(result, HttpStatus.OK); | ||
| 354 | + } | ||
| 355 | + } | ||
| 356 | + | ||
| 357 | + /** | ||
| 358 | + * 编辑目录 | ||
| 359 | + * @param platformCatalog 目录 | ||
| 360 | + * @return | ||
| 361 | + */ | ||
| 362 | + @ApiOperation("编辑目录") | ||
| 363 | + @ApiImplicitParams({ | ||
| 364 | + @ApiImplicitParam(name = "platformCatalog", value = "目录信息", dataTypeClass = PlatformCatalog.class, required = true), | ||
| 365 | + }) | ||
| 366 | + @PostMapping("/catalog/edit") | ||
| 367 | + @ResponseBody | ||
| 368 | + public ResponseEntity<WVPResult<List<PlatformCatalog>>> editCatalog(@RequestBody PlatformCatalog platformCatalog){ | ||
| 369 | + | ||
| 370 | + if (logger.isDebugEnabled()) { | ||
| 371 | + logger.debug("编辑目录,{}", JSON.toJSONString(platformCatalog)); | ||
| 372 | + } | ||
| 373 | + PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getId()); | ||
| 374 | + WVPResult<List<PlatformCatalog>> result = new WVPResult<>(); | ||
| 375 | + result.setCode(0); | ||
| 376 | + | ||
| 377 | + if (platformCatalogInStore == null) { | ||
| 378 | + result.setMsg( platformCatalog.getId() + " not exists"); | ||
| 379 | + return new ResponseEntity<>(result, HttpStatus.OK); | ||
| 380 | + } | ||
| 381 | + int addResult = storager.updateCatalog(platformCatalog); | ||
| 382 | + if (addResult > 0) { | ||
| 383 | + result.setMsg("success"); | ||
| 384 | + return new ResponseEntity<>(result, HttpStatus.OK); | ||
| 385 | + }else { | ||
| 386 | + result.setMsg("save error"); | ||
| 387 | + return new ResponseEntity<>(result, HttpStatus.OK); | ||
| 388 | + } | ||
| 389 | + } | ||
| 390 | + | ||
| 391 | + /** | ||
| 392 | + * 删除目录 | ||
| 393 | + * @param id 目录Id | ||
| 394 | + * @return | ||
| 395 | + */ | ||
| 396 | + @ApiOperation("删除目录") | ||
| 397 | + @ApiImplicitParams({ | ||
| 398 | + @ApiImplicitParam(name = "id", value = "目录Id", dataTypeClass = String.class, required = true), | ||
| 399 | + }) | ||
| 400 | + @DeleteMapping("/catalog/del") | ||
| 401 | + @ResponseBody | ||
| 402 | + public ResponseEntity<WVPResult<List<PlatformCatalog>>> delCatalog(String id){ | ||
| 403 | + | ||
| 404 | + if (logger.isDebugEnabled()) { | ||
| 405 | + logger.debug("删除目录,{}", id); | ||
| 406 | + } | ||
| 407 | + int delResult = storager.delCatalog(id); | ||
| 408 | + WVPResult<List<PlatformCatalog>> result = new WVPResult<>(); | ||
| 409 | + result.setCode(0); | ||
| 410 | + | ||
| 411 | + if (delResult > 0) { | ||
| 412 | + result.setMsg("success"); | ||
| 413 | + return new ResponseEntity<>(result, HttpStatus.OK); | ||
| 414 | + }else { | ||
| 415 | + result.setMsg("save error"); | ||
| 416 | + return new ResponseEntity<>(result, HttpStatus.OK); | ||
| 417 | + } | ||
| 418 | + } | ||
| 419 | + | ||
| 420 | + /** | ||
| 421 | + * 删除关联 | ||
| 422 | + * @param platformCatalog 关联的信息 | ||
| 423 | + * @return | ||
| 424 | + */ | ||
| 425 | + @ApiOperation("删除关联") | ||
| 426 | + @ApiImplicitParams({ | ||
| 427 | + @ApiImplicitParam(name = "platformCatalog", value = "关联的信息", dataTypeClass = PlatformCatalog.class, required = true), | ||
| 428 | + }) | ||
| 429 | + @DeleteMapping("/catalog/relation/del") | ||
| 430 | + @ResponseBody | ||
| 431 | + public ResponseEntity<WVPResult<List<PlatformCatalog>>> delRelation(@RequestBody PlatformCatalog platformCatalog){ | ||
| 432 | + | ||
| 433 | + if (logger.isDebugEnabled()) { | ||
| 434 | + logger.debug("删除关联,{}", JSON.toJSONString(platformCatalog)); | ||
| 435 | + } | ||
| 436 | + int delResult = storager.delRelation(platformCatalog); | ||
| 437 | + WVPResult<List<PlatformCatalog>> result = new WVPResult<>(); | ||
| 438 | + result.setCode(0); | ||
| 439 | + | ||
| 440 | + if (delResult > 0) { | ||
| 441 | + result.setMsg("success"); | ||
| 442 | + return new ResponseEntity<>(result, HttpStatus.OK); | ||
| 443 | + }else { | ||
| 444 | + result.setMsg("save error"); | ||
| 445 | + return new ResponseEntity<>(result, HttpStatus.OK); | ||
| 446 | + } | ||
| 447 | + } | ||
| 448 | + | ||
| 449 | + | ||
| 450 | + /** | ||
| 451 | + * 修改默认目录 | ||
| 452 | + * @param platformId 平台Id | ||
| 453 | + * @param catalogId 目录Id | ||
| 454 | + * @return | ||
| 455 | + */ | ||
| 456 | + @ApiOperation("修改默认目录") | ||
| 457 | + @ApiImplicitParams({ | ||
| 458 | + @ApiImplicitParam(name = "platformId", value = "平台Id", dataTypeClass = String.class, required = true), | ||
| 459 | + @ApiImplicitParam(name = "catalogId", value = "目录Id", dataTypeClass = String.class, required = true), | ||
| 460 | + }) | ||
| 461 | + @PostMapping("/catalog/default/update") | ||
| 462 | + @ResponseBody | ||
| 463 | + public ResponseEntity<WVPResult<String>> setDefaultCatalog(String platformId, String catalogId){ | ||
| 464 | + | ||
| 465 | + if (logger.isDebugEnabled()) { | ||
| 466 | + logger.debug("修改默认目录,{},{}", platformId, catalogId); | ||
| 467 | + } | ||
| 468 | + int updateResult = storager.setDefaultCatalog(platformId, catalogId); | ||
| 469 | + WVPResult<String> result = new WVPResult<>(); | ||
| 470 | + result.setCode(0); | ||
| 471 | + | ||
| 472 | + if (updateResult > 0) { | ||
| 473 | + result.setMsg("success"); | ||
| 474 | + return new ResponseEntity<>(result, HttpStatus.OK); | ||
| 475 | + }else { | ||
| 476 | + result.setMsg("save error"); | ||
| 477 | + return new ResponseEntity<>(result, HttpStatus.OK); | ||
| 478 | + } | ||
| 479 | + } | ||
| 480 | + | ||
| 282 | 481 | ||
| 283 | } | 482 | } |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/bean/ChannelReduce.java
| @@ -40,6 +40,11 @@ public class ChannelReduce { | @@ -40,6 +40,11 @@ public class ChannelReduce { | ||
| 40 | */ | 40 | */ |
| 41 | private String platformId; | 41 | private String platformId; |
| 42 | 42 | ||
| 43 | + /** | ||
| 44 | + * 目录Id | ||
| 45 | + */ | ||
| 46 | + private String catalogId; | ||
| 47 | + | ||
| 43 | 48 | ||
| 44 | public String getChannelId() { | 49 | public String getChannelId() { |
| 45 | return channelId; | 50 | return channelId; |
| @@ -96,4 +101,12 @@ public class ChannelReduce { | @@ -96,4 +101,12 @@ public class ChannelReduce { | ||
| 96 | public void setPlatformId(String platformId) { | 101 | public void setPlatformId(String platformId) { |
| 97 | this.platformId = platformId; | 102 | this.platformId = platformId; |
| 98 | } | 103 | } |
| 104 | + | ||
| 105 | + public String getCatalogId() { | ||
| 106 | + return catalogId; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + public void setCatalogId(String catalogId) { | ||
| 110 | + this.catalogId = catalogId; | ||
| 111 | + } | ||
| 99 | } | 112 | } |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/bean/UpdateChannelParam.java
| @@ -4,6 +4,7 @@ import java.util.List; | @@ -4,6 +4,7 @@ import java.util.List; | ||
| 4 | 4 | ||
| 5 | public class UpdateChannelParam { | 5 | public class UpdateChannelParam { |
| 6 | private String platformId; | 6 | private String platformId; |
| 7 | + private String catalogId; | ||
| 7 | private List<ChannelReduce> channelReduces; | 8 | private List<ChannelReduce> channelReduces; |
| 8 | 9 | ||
| 9 | public String getPlatformId() { | 10 | public String getPlatformId() { |
| @@ -21,4 +22,12 @@ public class UpdateChannelParam { | @@ -21,4 +22,12 @@ public class UpdateChannelParam { | ||
| 21 | public void setChannelReduces(List<ChannelReduce> channelReduces) { | 22 | public void setChannelReduces(List<ChannelReduce> channelReduces) { |
| 22 | this.channelReduces = channelReduces; | 23 | this.channelReduces = channelReduces; |
| 23 | } | 24 | } |
| 25 | + | ||
| 26 | + public String getCatalogId() { | ||
| 27 | + return catalogId; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + public void setCatalogId(String catalogId) { | ||
| 31 | + this.catalogId = catalogId; | ||
| 32 | + } | ||
| 24 | } | 33 | } |
src/main/resources/all-application.yml
| @@ -27,7 +27,7 @@ spring: | @@ -27,7 +27,7 @@ spring: | ||
| 27 | datasource: | 27 | datasource: |
| 28 | # 使用mysql 打开23-28行注释, 删除29-36行 | 28 | # 使用mysql 打开23-28行注释, 删除29-36行 |
| 29 | # name: wvp | 29 | # name: wvp |
| 30 | - # url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true | 30 | + # url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&allowMultiQueries=true |
| 31 | # username: | 31 | # username: |
| 32 | # password: | 32 | # password: |
| 33 | # type: com.alibaba.druid.pool.DruidDataSource | 33 | # type: com.alibaba.druid.pool.DruidDataSource |
src/main/resources/application-dev.yml
| @@ -15,7 +15,7 @@ spring: | @@ -15,7 +15,7 @@ spring: | ||
| 15 | datasource: | 15 | datasource: |
| 16 | # 使用mysql 打开23-28行注释, 删除29-36行 | 16 | # 使用mysql 打开23-28行注释, 删除29-36行 |
| 17 | # name: wvp | 17 | # name: wvp |
| 18 | - # url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true | 18 | + # url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&allowMultiQueries=true |
| 19 | # username: | 19 | # username: |
| 20 | # password: | 20 | # password: |
| 21 | # type: com.alibaba.druid.pool.DruidDataSource | 21 | # type: com.alibaba.druid.pool.DruidDataSource |
src/main/resources/application-docker.yml
| @@ -15,7 +15,7 @@ spring: | @@ -15,7 +15,7 @@ spring: | ||
| 15 | datasource: | 15 | datasource: |
| 16 | # 使用mysql 打开23-28行注释, 删除29-36行 | 16 | # 使用mysql 打开23-28行注释, 删除29-36行 |
| 17 | # name: wvp | 17 | # name: wvp |
| 18 | - # url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true | 18 | + # url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&allowMultiQueries=true |
| 19 | # username: | 19 | # username: |
| 20 | # password: | 20 | # password: |
| 21 | # type: com.alibaba.druid.pool.DruidDataSource | 21 | # type: com.alibaba.druid.pool.DruidDataSource |
src/main/resources/wvp.sqlite
No preview for this file type
web_src/package-lock.json
| @@ -19,6 +19,7 @@ | @@ -19,6 +19,7 @@ | ||
| 19 | "vue-baidu-map": "^0.21.22", | 19 | "vue-baidu-map": "^0.21.22", |
| 20 | "vue-clipboard2": "^0.3.1", | 20 | "vue-clipboard2": "^0.3.1", |
| 21 | "vue-clipboards": "^1.3.0", | 21 | "vue-clipboards": "^1.3.0", |
| 22 | + "vue-contextmenujs": "^1.3.13", | ||
| 22 | "vue-cookies": "^1.7.4", | 23 | "vue-cookies": "^1.7.4", |
| 23 | "vue-router": "^3.1.6" | 24 | "vue-router": "^3.1.6" |
| 24 | }, | 25 | }, |
| @@ -12920,6 +12921,11 @@ | @@ -12920,6 +12921,11 @@ | ||
| 12920 | "tiny-emitter": "^2.0.0" | 12921 | "tiny-emitter": "^2.0.0" |
| 12921 | } | 12922 | } |
| 12922 | }, | 12923 | }, |
| 12924 | + "node_modules/vue-contextmenujs": { | ||
| 12925 | + "version": "1.3.13", | ||
| 12926 | + "resolved": "https://registry.npmmirror.com/vue-contextmenujs/download/vue-contextmenujs-1.3.13.tgz", | ||
| 12927 | + "integrity": "sha1-O9rgI8e9QgleeNpCWAACUNUKuO8=" | ||
| 12928 | + }, | ||
| 12923 | "node_modules/vue-cookies": { | 12929 | "node_modules/vue-cookies": { |
| 12924 | "version": "1.7.4", | 12930 | "version": "1.7.4", |
| 12925 | "resolved": "https://registry.npm.taobao.org/vue-cookies/download/vue-cookies-1.7.4.tgz?cache=0&sync_timestamp=1598941352058&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue-cookies%2Fdownload%2Fvue-cookies-1.7.4.tgz", | 12931 | "resolved": "https://registry.npm.taobao.org/vue-cookies/download/vue-cookies-1.7.4.tgz?cache=0&sync_timestamp=1598941352058&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue-cookies%2Fdownload%2Fvue-cookies-1.7.4.tgz", |
| @@ -25077,6 +25083,11 @@ | @@ -25077,6 +25083,11 @@ | ||
| 25077 | } | 25083 | } |
| 25078 | } | 25084 | } |
| 25079 | }, | 25085 | }, |
| 25086 | + "vue-contextmenujs": { | ||
| 25087 | + "version": "1.3.13", | ||
| 25088 | + "resolved": "https://registry.npmmirror.com/vue-contextmenujs/download/vue-contextmenujs-1.3.13.tgz", | ||
| 25089 | + "integrity": "sha1-O9rgI8e9QgleeNpCWAACUNUKuO8=" | ||
| 25090 | + }, | ||
| 25080 | "vue-cookies": { | 25091 | "vue-cookies": { |
| 25081 | "version": "1.7.4", | 25092 | "version": "1.7.4", |
| 25082 | "resolved": "https://registry.npm.taobao.org/vue-cookies/download/vue-cookies-1.7.4.tgz?cache=0&sync_timestamp=1598941352058&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue-cookies%2Fdownload%2Fvue-cookies-1.7.4.tgz", | 25093 | "resolved": "https://registry.npm.taobao.org/vue-cookies/download/vue-cookies-1.7.4.tgz?cache=0&sync_timestamp=1598941352058&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue-cookies%2Fdownload%2Fvue-cookies-1.7.4.tgz", |
web_src/package.json
| @@ -21,6 +21,7 @@ | @@ -21,6 +21,7 @@ | ||
| 21 | "vue-baidu-map": "^0.21.22", | 21 | "vue-baidu-map": "^0.21.22", |
| 22 | "vue-clipboard2": "^0.3.1", | 22 | "vue-clipboard2": "^0.3.1", |
| 23 | "vue-clipboards": "^1.3.0", | 23 | "vue-clipboards": "^1.3.0", |
| 24 | + "vue-contextmenujs": "^1.3.13", | ||
| 24 | "vue-cookies": "^1.7.4", | 25 | "vue-cookies": "^1.7.4", |
| 25 | "vue-router": "^3.1.6" | 26 | "vue-router": "^3.1.6" |
| 26 | }, | 27 | }, |
web_src/src/components/ParentPlatformList.vue
| @@ -138,7 +138,7 @@ export default { | @@ -138,7 +138,7 @@ export default { | ||
| 138 | }); | 138 | }); |
| 139 | }, | 139 | }, |
| 140 | chooseChannel: function(platform) { | 140 | chooseChannel: function(platform) { |
| 141 | - this.$refs.chooseChannelDialog.openDialog(platform.serverGBId, this.initData) | 141 | + this.$refs.chooseChannelDialog.openDialog(platform.serverGBId, platform.name, platform.catalogId, this.initData) |
| 142 | }, | 142 | }, |
| 143 | initData: function() { | 143 | initData: function() { |
| 144 | this.getPlatformList(); | 144 | this.getPlatformList(); |
web_src/src/components/dialog/catalogEdit.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div id="catalogEdit" v-loading="isLoging"> | ||
| 3 | + <el-dialog | ||
| 4 | + title="节点编辑" | ||
| 5 | + width="40%" | ||
| 6 | + top="2rem" | ||
| 7 | + :append-to-body="true" | ||
| 8 | + :close-on-click-modal="false" | ||
| 9 | + :visible.sync="showDialog" | ||
| 10 | + :destroy-on-close="true" | ||
| 11 | + @close="close()" | ||
| 12 | + > | ||
| 13 | + <div id="shared" style="margin-top: 1rem;margin-right: 100px;"> | ||
| 14 | + <el-form ref="form" :rules="rules" :model="form" label-width="140px" > | ||
| 15 | + <el-form-item label="节点编号" prop="id" > | ||
| 16 | + <el-input v-model="form.id" :disabled="isEdit"></el-input> | ||
| 17 | + </el-form-item> | ||
| 18 | + <el-form-item label="节点名称" prop="name"> | ||
| 19 | + <el-input v-model="form.name" clearable></el-input> | ||
| 20 | + </el-form-item> | ||
| 21 | + <el-form-item> | ||
| 22 | + <div style="float: right;"> | ||
| 23 | + <el-button type="primary" @click="onSubmit" >确认</el-button> | ||
| 24 | + <el-button @click="close">取消</el-button> | ||
| 25 | + </div> | ||
| 26 | + | ||
| 27 | + </el-form-item> | ||
| 28 | + </el-form> | ||
| 29 | + </div> | ||
| 30 | + </el-dialog> | ||
| 31 | + </div> | ||
| 32 | +</template> | ||
| 33 | + | ||
| 34 | +<script> | ||
| 35 | + | ||
| 36 | +export default { | ||
| 37 | + name: "catalogEdit", | ||
| 38 | + computed: {}, | ||
| 39 | + props: ['platformId'], | ||
| 40 | + created() {}, | ||
| 41 | + data() { | ||
| 42 | + return { | ||
| 43 | + submitCallback: null, | ||
| 44 | + showDialog: false, | ||
| 45 | + isLoging: false, | ||
| 46 | + isEdit: false, | ||
| 47 | + form: { | ||
| 48 | + id: null, | ||
| 49 | + name: null, | ||
| 50 | + platformId: null, | ||
| 51 | + parentId: null, | ||
| 52 | + }, | ||
| 53 | + rules: { | ||
| 54 | + name: [{ required: true, message: "请输入名称", trigger: "blur" }], | ||
| 55 | + id: [{ required: true, message: "请输入id", trigger: "blur" }] | ||
| 56 | + }, | ||
| 57 | + }; | ||
| 58 | + }, | ||
| 59 | + methods: { | ||
| 60 | + openDialog: function (isEdit, id, name, parentId, callback) { | ||
| 61 | + console.log("parentId: " + parentId) | ||
| 62 | + this.isEdit = isEdit; | ||
| 63 | + this.form.id = id; | ||
| 64 | + this.form.name = name; | ||
| 65 | + this.form.platformId = this.platformId; | ||
| 66 | + this.form.parentId = parentId; | ||
| 67 | + this.showDialog = true; | ||
| 68 | + this.submitCallback = callback; | ||
| 69 | + }, | ||
| 70 | + onSubmit: function () { | ||
| 71 | + console.log("onSubmit"); | ||
| 72 | + console.log(this.form); | ||
| 73 | + this.$axios({ | ||
| 74 | + method:"post", | ||
| 75 | + url:`/api/platform/catalog/${!this.isEdit? "add":"edit"}`, | ||
| 76 | + data: this.form | ||
| 77 | + }) | ||
| 78 | + .then((res)=> { | ||
| 79 | + if (res.data.code === 0) { | ||
| 80 | + console.log("添加/修改成功") | ||
| 81 | + if (this.submitCallback)this.submitCallback() | ||
| 82 | + }else { | ||
| 83 | + this.$message({ | ||
| 84 | + showClose: true, | ||
| 85 | + message: res.data.msg, | ||
| 86 | + type: "error", | ||
| 87 | + }); | ||
| 88 | + } | ||
| 89 | + this.close(); | ||
| 90 | + }) | ||
| 91 | + .catch((error)=> { | ||
| 92 | + console.log(error); | ||
| 93 | + }); | ||
| 94 | + }, | ||
| 95 | + close: function () { | ||
| 96 | + this.showDialog = false; | ||
| 97 | + this.$refs.form.resetFields(); | ||
| 98 | + }, | ||
| 99 | + }, | ||
| 100 | +}; | ||
| 101 | +</script> |
web_src/src/components/dialog/chooseChannel.vue
| 1 | <template> | 1 | <template> |
| 2 | <div id="chooseChannel" v-loading="isLoging"> | 2 | <div id="chooseChannel" v-loading="isLoging"> |
| 3 | 3 | ||
| 4 | - <el-dialog title="选择通道" v-if="showDialog" top="2rem" width="70%" :close-on-click-modal="false" :visible.sync="showDialog" :destroy-on-close="true" @close="close()"> | ||
| 5 | - <el-tabs v-model="tabActiveName" > | ||
| 6 | - <el-tab-pane label="国标通道" name="gbChannel"> | ||
| 7 | - <el-container> | ||
| 8 | - <el-main style="background-color: #FFF;"> | ||
| 9 | - <chooseChannelForGb :platformId=platformId ></chooseChannelForGb> | ||
| 10 | - </el-main> | ||
| 11 | - </el-container> | ||
| 12 | - | 4 | + <el-dialog title="选择通道" v-if="showDialog" top="2rem" width="90%" :close-on-click-modal="false" :visible.sync="showDialog" :destroy-on-close="true" @close="close()"> |
| 5 | + <el-row> | ||
| 6 | + <el-col :span="10"> | ||
| 7 | + <el-tabs v-model="catalogTabActiveName" > | ||
| 8 | + <el-tab-pane label="目录结构" name="catalog"> | ||
| 9 | + <el-container> | ||
| 10 | + <el-main style="background-color: #FFF;"> | ||
| 11 | + <chooseChannelForCatalog ref="chooseChannelForCatalog" :platformId=platformId :platformName=platformName :defaultCatalogId=defaultCatalogId :catalogIdChange="catalogIdChange"></chooseChannelForCatalog> | ||
| 12 | + </el-main> | ||
| 13 | + </el-container> | ||
| 14 | + </el-tab-pane> | ||
| 15 | + </el-tabs> | ||
| 13 | 16 | ||
| 17 | + </el-col> | ||
| 18 | + <el-col :span="14"> | ||
| 19 | + <el-tabs v-model="tabActiveName" @tab-click="tabClick"> | ||
| 20 | + <el-tab-pane label="国标通道" name="gbChannel"> | ||
| 21 | + <el-container> | ||
| 22 | + <el-main style="background-color: #FFF;"> | ||
| 23 | + <chooseChannelForGb ref="chooseChannelForGb" :platformId=platformId :updateChoosedCallback="updateChooseChannelCallback"></chooseChannelForGb> | ||
| 24 | + </el-main> | ||
| 25 | + </el-container> | ||
| 14 | </el-tab-pane> | 26 | </el-tab-pane> |
| 15 | <el-tab-pane label="直播流通道" name="streamchannel"> | 27 | <el-tab-pane label="直播流通道" name="streamchannel"> |
| 16 | - <el-container> | ||
| 17 | - <el-main style="background-color: #FFF;"> | ||
| 18 | - <chooseChannelFoStream :platformId=platformId ></chooseChannelFoStream> | ||
| 19 | - </el-main> | ||
| 20 | - </el-container> | 28 | + <el-container> |
| 29 | + <el-main style="background-color: #FFF;"> | ||
| 30 | + <chooseChannelFoStream ref="chooseChannelFoStream" :platformId=platformId :updateChoosedCallback="updateChooseChannelCallback"></chooseChannelFoStream> | ||
| 31 | + </el-main> | ||
| 32 | + </el-container> | ||
| 21 | </el-tab-pane> | 33 | </el-tab-pane> |
| 22 | - </el-tabs> | 34 | + </el-tabs> |
| 35 | + </el-col> | ||
| 36 | + </el-row> | ||
| 37 | + | ||
| 23 | </el-dialog> | 38 | </el-dialog> |
| 24 | </div> | 39 | </div> |
| 25 | </template> | 40 | </template> |
| @@ -27,12 +42,14 @@ | @@ -27,12 +42,14 @@ | ||
| 27 | <script> | 42 | <script> |
| 28 | import chooseChannelForGb from '../dialog/chooseChannelForGb.vue' | 43 | import chooseChannelForGb from '../dialog/chooseChannelForGb.vue' |
| 29 | import chooseChannelFoStream from '../dialog/chooseChannelForStream.vue' | 44 | import chooseChannelFoStream from '../dialog/chooseChannelForStream.vue' |
| 45 | +import chooseChannelForCatalog from '../dialog/chooseChannelForCatalog.vue' | ||
| 30 | export default { | 46 | export default { |
| 31 | name: 'chooseChannel', | 47 | name: 'chooseChannel', |
| 32 | props: {}, | 48 | props: {}, |
| 33 | components: { | 49 | components: { |
| 34 | chooseChannelForGb, | 50 | chooseChannelForGb, |
| 35 | chooseChannelFoStream, | 51 | chooseChannelFoStream, |
| 52 | + chooseChannelForCatalog, | ||
| 36 | }, | 53 | }, |
| 37 | computed: { | 54 | computed: { |
| 38 | // getPlayerShared: function () { | 55 | // getPlayerShared: function () { |
| @@ -47,20 +64,35 @@ export default { | @@ -47,20 +64,35 @@ export default { | ||
| 47 | return { | 64 | return { |
| 48 | isLoging: false, | 65 | isLoging: false, |
| 49 | tabActiveName: "gbChannel", | 66 | tabActiveName: "gbChannel", |
| 67 | + catalogTabActiveName: "catalog", | ||
| 50 | platformId: "", | 68 | platformId: "", |
| 51 | - isLoging: false, | 69 | + catalogId: "", |
| 70 | + platformName: "", | ||
| 71 | + defaultCatalogId: "", | ||
| 52 | showDialog: false, | 72 | showDialog: false, |
| 53 | chooseData: {} | 73 | chooseData: {} |
| 54 | 74 | ||
| 55 | }; | 75 | }; |
| 56 | }, | 76 | }, |
| 57 | methods: { | 77 | methods: { |
| 58 | - openDialog: function (platformId, closeCallback) { | ||
| 59 | - console.log(platformId) | 78 | + openDialog(platformId, platformName, defaultCatalogId, closeCallback) { |
| 60 | this.platformId = platformId | 79 | this.platformId = platformId |
| 80 | + this.platformName = platformName | ||
| 81 | + this.defaultCatalogId = defaultCatalogId | ||
| 61 | this.showDialog = true | 82 | this.showDialog = true |
| 62 | this.closeCallback = closeCallback | 83 | this.closeCallback = closeCallback |
| 63 | }, | 84 | }, |
| 85 | + tabClick (tab, event){ | ||
| 86 | + console.log(tab.label) | ||
| 87 | + if (tab.label === "gbChannel") { | ||
| 88 | + this.$refs.chooseChannelForGb.catalogIdChange(this.catalogId); | ||
| 89 | + this.$refs.chooseChannelForGb.initData(); | ||
| 90 | + }else { | ||
| 91 | + this.$refs.chooseChannelFoStream.catalogIdChange(this.catalogId); | ||
| 92 | + this.$refs.chooseChannelFoStream.initData(); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + }, | ||
| 64 | close: function() { | 96 | close: function() { |
| 65 | this.closeCallback() | 97 | this.closeCallback() |
| 66 | }, | 98 | }, |
| @@ -88,6 +120,21 @@ export default { | @@ -88,6 +120,21 @@ export default { | ||
| 88 | }).catch(function (error) { | 120 | }).catch(function (error) { |
| 89 | console.log(error); | 121 | console.log(error); |
| 90 | }); | 122 | }); |
| 123 | + }, | ||
| 124 | + catalogIdChange: function (id) { | ||
| 125 | + console.log("中间模块收到: " + id) | ||
| 126 | + this.catalogId = id; | ||
| 127 | + if (this.tabActiveName === "gbChannel") { | ||
| 128 | + this.$refs.chooseChannelForGb.catalogIdChange(id); | ||
| 129 | + }else { | ||
| 130 | + this.$refs.chooseChannelFoStream.catalogIdChange(id); | ||
| 131 | + } | ||
| 132 | + }, | ||
| 133 | + updateChooseChannelCallback (id, nodeIds){ | ||
| 134 | + console.log("中间模块收到选择通道变化: " + id) | ||
| 135 | + console.log("中间模块收到选择通道变化: " + nodeIds) | ||
| 136 | + console.log("中间模块收到选择通道变化: " + typeof (nodeIds)) | ||
| 137 | + this.$refs.chooseChannelForCatalog.refreshCatalogById(id, nodeIds) | ||
| 91 | } | 138 | } |
| 92 | } | 139 | } |
| 93 | }; | 140 | }; |
web_src/src/components/dialog/chooseChannelForCatalog.vue
0 → 100644
| 1 | +<template> | ||
| 2 | +<div id="chooseChannelForCatalog" > | ||
| 3 | + <div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;font-size: 14px;"> | ||
| 4 | + <el-tree class="el-scrollbar" | ||
| 5 | + ref="tree" | ||
| 6 | + id="catalogTree" | ||
| 7 | + empty-text="未知节点" | ||
| 8 | + node-key="id" | ||
| 9 | + default-expand-all | ||
| 10 | + :highlight-current="true" | ||
| 11 | + :expand-on-click-node="false" | ||
| 12 | + :props="props" | ||
| 13 | + :load="loadNode" | ||
| 14 | + @node-contextmenu="contextmenuEventHandler" | ||
| 15 | + lazy> | ||
| 16 | + <span class="custom-tree-node" slot-scope="{ node, data }" style="width: 100%"> | ||
| 17 | + <el-radio v-if="node.data.type === 0" style="margin-right: 0" v-model="chooseId" :label="node.data.id">{{''}}</el-radio> | ||
| 18 | + <span v-if="node.data.type === 0 && node.level === 1" class="el-icon-s-home"></span> | ||
| 19 | + <span v-if="node.data.type === 0 && node.level > 1" class="el-icon-folder-opened"></span> | ||
| 20 | + <span v-if="node.data.type === 1" class="iconfont icon-shexiangtou"></span> | ||
| 21 | + <span v-if="node.data.type === 2" class="iconfont icon-zhibo"></span> | ||
| 22 | + <span style="padding-left: 1px">{{ node.label }}</span> | ||
| 23 | + <span> | ||
| 24 | + <i style="margin-left: 5rem; color: #9d9d9d; padding-right: 20px" v-if="node.data.id === defaultCatalogId">默认</i> | ||
| 25 | + </span> | ||
| 26 | + </span> | ||
| 27 | + </el-tree> | ||
| 28 | + </div> | ||
| 29 | + <catalogEdit ref="catalogEdit" :platformId="platformId"></catalogEdit> | ||
| 30 | +</div> | ||
| 31 | +</template> | ||
| 32 | + | ||
| 33 | + | ||
| 34 | +<script> | ||
| 35 | + | ||
| 36 | +import catalogEdit from './catalogEdit.vue' | ||
| 37 | +export default { | ||
| 38 | + name: 'chooseChannelForCatalog', | ||
| 39 | + props: ['platformId', 'platformName', 'defaultCatalogId', 'catalogIdChange'], | ||
| 40 | + created() { | ||
| 41 | + this.initData(); | ||
| 42 | + setTimeout(()=>{ | ||
| 43 | + if (this.catalogIdChange)this.catalogIdChange(this.defaultCatalogId); | ||
| 44 | + }, 100) | ||
| 45 | + | ||
| 46 | + }, | ||
| 47 | + components: { | ||
| 48 | + catalogEdit, | ||
| 49 | + }, | ||
| 50 | + data() { | ||
| 51 | + return { | ||
| 52 | + props: { | ||
| 53 | + label: 'name', | ||
| 54 | + children: 'children', | ||
| 55 | + isLeaf: 'leaf' | ||
| 56 | + }, | ||
| 57 | + chooseNode: null, | ||
| 58 | + chooseId: this.defaultCatalogId, | ||
| 59 | + catalogTree: null, | ||
| 60 | + contextmenuShow: false | ||
| 61 | + | ||
| 62 | + }; | ||
| 63 | + }, | ||
| 64 | + watch:{ | ||
| 65 | + platformId(newData, oldData){ | ||
| 66 | + console.log(newData) | ||
| 67 | + this.initData() | ||
| 68 | + }, | ||
| 69 | + chooseId(newData, oldData){ | ||
| 70 | + console.log("发送: " + newData) | ||
| 71 | + if (this.catalogIdChange)this.catalogIdChange(newData); | ||
| 72 | + }, | ||
| 73 | + }, | ||
| 74 | + methods: { | ||
| 75 | + initData: function () { | ||
| 76 | + this.getCatalog(); | ||
| 77 | + }, | ||
| 78 | + | ||
| 79 | + getCatalog: function(parentId, callback) { | ||
| 80 | + let that = this; | ||
| 81 | + this.$axios({ | ||
| 82 | + method:"get", | ||
| 83 | + url:`/api/platform/catalog`, | ||
| 84 | + params: { | ||
| 85 | + platformId: that.platformId, | ||
| 86 | + parentId: parentId | ||
| 87 | + } | ||
| 88 | + }) | ||
| 89 | + .then((res)=> { | ||
| 90 | + if (res.data.code === 0) { | ||
| 91 | + if (typeof(callback) === 'function') { | ||
| 92 | + callback(res.data.data) | ||
| 93 | + } | ||
| 94 | + // | ||
| 95 | + | ||
| 96 | + // if (typeof (this.$refs.tree.setCurrentKey) == "undefined") { | ||
| 97 | + // this.$refs.tree.setCurrentKey(this.defaultCatalogId) | ||
| 98 | + // let data = this.$refs.tree.getCurrentNode() | ||
| 99 | + // if (data != null && data.id === this.defaultCatalogId) { | ||
| 100 | + // this.currentCatalogChange(data, this.$refs.tree.getNode(data.id)) | ||
| 101 | + // } | ||
| 102 | + // } | ||
| 103 | + | ||
| 104 | + } | ||
| 105 | + }) | ||
| 106 | + .catch(function (error) { | ||
| 107 | + console.log(error); | ||
| 108 | + }); | ||
| 109 | + | ||
| 110 | + }, | ||
| 111 | + addCatalog: function (parentId, node){ | ||
| 112 | + let that = this; | ||
| 113 | + // 打开添加弹窗 | ||
| 114 | + that.$refs.catalogEdit.openDialog(false, null, null, parentId, ()=>{ | ||
| 115 | + node.loaded = false | ||
| 116 | + node.expand(); | ||
| 117 | + }); | ||
| 118 | + | ||
| 119 | + }, | ||
| 120 | + refreshCatalog: function (node){ | ||
| 121 | + node.loaded = false | ||
| 122 | + node.expand(); | ||
| 123 | + }, | ||
| 124 | + refreshCatalogById: function (id, nodeIds) { | ||
| 125 | + if (id) { | ||
| 126 | + console.log("refreshCatalogById: " + id) | ||
| 127 | + let node = this.$refs.tree.getNode(id); | ||
| 128 | + console.log(node) | ||
| 129 | + this.refreshCatalog(node); | ||
| 130 | + } | ||
| 131 | + if (nodeIds !== null) { | ||
| 132 | + let refreshNode = {} | ||
| 133 | + for (let i = 0; i < nodeIds.length; i++) { | ||
| 134 | + let node = this.$refs.tree.getNode(nodeIds[i]); | ||
| 135 | + refreshNode[node.parent.data.id] = node.parent | ||
| 136 | + } | ||
| 137 | + if (Object.values(refreshNode).length > 0) { | ||
| 138 | + for (let j = 0; j < Object.values(refreshNode).length; j++) { | ||
| 139 | + this.refreshCatalog(Object.values(refreshNode)[j]); | ||
| 140 | + } | ||
| 141 | + } | ||
| 142 | + } | ||
| 143 | + }, | ||
| 144 | + editCatalog: function (data, node){ | ||
| 145 | + let that = this; | ||
| 146 | + // 打开添加弹窗 | ||
| 147 | + that.$refs.catalogEdit.openDialog(true, data.id, data.name, data.parentId, (data)=>{ | ||
| 148 | + node.parent.loaded = false | ||
| 149 | + node.parent.expand(); | ||
| 150 | + }); | ||
| 151 | + | ||
| 152 | + }, | ||
| 153 | + removeCatalog: function (id, node){ | ||
| 154 | + this.$axios({ | ||
| 155 | + method:"delete", | ||
| 156 | + url:`/api/platform/catalog/del`, | ||
| 157 | + params: { | ||
| 158 | + id: id, | ||
| 159 | + } | ||
| 160 | + }) | ||
| 161 | + .then((res) => { | ||
| 162 | + if (res.data.code === 0) { | ||
| 163 | + console.log("移除成功") | ||
| 164 | + node.parent.loaded = false | ||
| 165 | + node.parent.expand(); | ||
| 166 | + } | ||
| 167 | + }) | ||
| 168 | + .catch(function (error) { | ||
| 169 | + console.log(error); | ||
| 170 | + }); | ||
| 171 | + }, | ||
| 172 | + setDefaultCatalog: function (id){ | ||
| 173 | + this.$axios({ | ||
| 174 | + method:"post", | ||
| 175 | + url:`/api/platform/catalog/default/update`, | ||
| 176 | + params: { | ||
| 177 | + platformId: this.platformId, | ||
| 178 | + catalogId: id, | ||
| 179 | + } | ||
| 180 | + }) | ||
| 181 | + .then((res)=> { | ||
| 182 | + if (res.data.code === 0) { | ||
| 183 | + this.defaultCatalogId = id; | ||
| 184 | + } | ||
| 185 | + }) | ||
| 186 | + .catch(function (error) { | ||
| 187 | + console.log(error); | ||
| 188 | + }); | ||
| 189 | + }, | ||
| 190 | + loadNode: function(node, resolve){ | ||
| 191 | + if (node.level === 0) { | ||
| 192 | + resolve([{ | ||
| 193 | + name: this.platformName, | ||
| 194 | + id: this.platformId, | ||
| 195 | + type: 0 | ||
| 196 | + }]); | ||
| 197 | + } | ||
| 198 | + if (node.level >= 1){ | ||
| 199 | + this.getCatalog(node.data.id, resolve) | ||
| 200 | + } | ||
| 201 | + }, | ||
| 202 | + contextmenuEventHandler: function (event,data,node,element){ | ||
| 203 | + if (node.data.type !== 0) { | ||
| 204 | + data.parentId = node.parent.data.id; | ||
| 205 | + this.$contextmenu({ | ||
| 206 | + items: [ | ||
| 207 | + { | ||
| 208 | + label: "移除通道", | ||
| 209 | + icon: "el-icon-delete", | ||
| 210 | + disabled: false, | ||
| 211 | + onClick: () => { | ||
| 212 | + this.$axios({ | ||
| 213 | + method:"delete", | ||
| 214 | + url:"/api/platform/catalog/relation/del", | ||
| 215 | + data: data | ||
| 216 | + }).then((res)=>{ | ||
| 217 | + console.log("移除成功") | ||
| 218 | + node.parent.loaded = false | ||
| 219 | + node.parent.expand(); | ||
| 220 | + }).catch(function (error) { | ||
| 221 | + console.log(error); | ||
| 222 | + }); | ||
| 223 | + } | ||
| 224 | + } | ||
| 225 | + ], | ||
| 226 | + event, // 鼠标事件信息 | ||
| 227 | + customClass: "custom-class", // 自定义菜单 class | ||
| 228 | + zIndex: 3000, // 菜单样式 z-index | ||
| 229 | + }); | ||
| 230 | + }else { | ||
| 231 | + this.$contextmenu({ | ||
| 232 | + items: [ | ||
| 233 | + { | ||
| 234 | + label: "刷新节点", | ||
| 235 | + icon: "el-icon-refresh", | ||
| 236 | + disabled: false, | ||
| 237 | + onClick: () => { | ||
| 238 | + this.refreshCatalog(node); | ||
| 239 | + } | ||
| 240 | + }, | ||
| 241 | + { | ||
| 242 | + label: "新建节点", | ||
| 243 | + icon: "el-icon-plus", | ||
| 244 | + disabled: false, | ||
| 245 | + onClick: () => { | ||
| 246 | + this.addCatalog(data.id, node); | ||
| 247 | + } | ||
| 248 | + }, | ||
| 249 | + { | ||
| 250 | + label: "修改节点", | ||
| 251 | + icon: "el-icon-edit", | ||
| 252 | + disabled: node.level === 1, | ||
| 253 | + onClick: () => { | ||
| 254 | + this.editCatalog(data, node); | ||
| 255 | + } | ||
| 256 | + }, | ||
| 257 | + { | ||
| 258 | + label: "删除节点", | ||
| 259 | + icon: "el-icon-delete", | ||
| 260 | + disabled: node.level === 1, | ||
| 261 | + divided: true, | ||
| 262 | + onClick: () => { | ||
| 263 | + this.removeCatalog(data.id, node) | ||
| 264 | + } | ||
| 265 | + }, | ||
| 266 | + { | ||
| 267 | + label: "设为默认", | ||
| 268 | + icon: "el-icon-folder-checked", | ||
| 269 | + disabled: node.data.id === this.defaultCatalogId, | ||
| 270 | + onClick: () => { | ||
| 271 | + this.setDefaultCatalog(data.id) | ||
| 272 | + }, | ||
| 273 | + }, | ||
| 274 | + // { | ||
| 275 | + // label: "导出", | ||
| 276 | + // icon: "el-icon-download", | ||
| 277 | + // disabled: false, | ||
| 278 | + // children: [ | ||
| 279 | + // { | ||
| 280 | + // label: "导出到文件", | ||
| 281 | + // onClick: () => { | ||
| 282 | + // | ||
| 283 | + // }, | ||
| 284 | + // }, | ||
| 285 | + // { | ||
| 286 | + // label: "导出到其他平台", | ||
| 287 | + // onClick: () => { | ||
| 288 | + // | ||
| 289 | + // }, | ||
| 290 | + // } | ||
| 291 | + // ] | ||
| 292 | + // }, | ||
| 293 | + | ||
| 294 | + ], | ||
| 295 | + event, // 鼠标事件信息 | ||
| 296 | + customClass: "custom-class", // 自定义菜单 class | ||
| 297 | + zIndex: 3000, // 菜单样式 z-index | ||
| 298 | + }); | ||
| 299 | + } | ||
| 300 | + | ||
| 301 | + return false; | ||
| 302 | + }, | ||
| 303 | + } | ||
| 304 | +}; | ||
| 305 | +</script> | ||
| 306 | + | ||
| 307 | +<style> | ||
| 308 | +#catalogTree{ | ||
| 309 | + display: inline-block; | ||
| 310 | +} | ||
| 311 | +</style> |
web_src/src/components/dialog/chooseChannelForGb.vue
| @@ -21,9 +21,9 @@ | @@ -21,9 +21,9 @@ | ||
| 21 | <el-option label="离线" value="false"></el-option> | 21 | <el-option label="离线" value="false"></el-option> |
| 22 | </el-select> | 22 | </el-select> |
| 23 | 23 | ||
| 24 | - <el-checkbox @change="shareAllCheckedChanage">全部共享</el-checkbox> | 24 | + <el-checkbox @change="shareAllCheckedChange">全部共享</el-checkbox> |
| 25 | </div> | 25 | </div> |
| 26 | - <el-table ref="gbChannelsTable" :data="gbChannels" border style="width: 100%" @selection-change="checkedChanage" > | 26 | + <el-table ref="gbChannelsTable" :data="gbChannels" border style="width: 100%" @selection-change="checkedChange" > |
| 27 | <el-table-column type="selection" width="55" align="center" fixed > </el-table-column> | 27 | <el-table-column type="selection" width="55" align="center" fixed > </el-table-column> |
| 28 | <el-table-column prop="channelId" label="通道编号" width="210"> | 28 | <el-table-column prop="channelId" label="通道编号" width="210"> |
| 29 | </el-table-column> | 29 | </el-table-column> |
| @@ -49,7 +49,6 @@ | @@ -49,7 +49,6 @@ | ||
| 49 | <script> | 49 | <script> |
| 50 | export default { | 50 | export default { |
| 51 | name: 'chooseChannelForGb', | 51 | name: 'chooseChannelForGb', |
| 52 | - props: {}, | ||
| 53 | computed: { | 52 | computed: { |
| 54 | // getPlayerShared: function () { | 53 | // getPlayerShared: function () { |
| 55 | // return { | 54 | // return { |
| @@ -59,7 +58,7 @@ export default { | @@ -59,7 +58,7 @@ export default { | ||
| 59 | // }; | 58 | // }; |
| 60 | // } | 59 | // } |
| 61 | }, | 60 | }, |
| 62 | - props: ['platformId'], | 61 | + props: ['platformId', 'updateChoosedCallback'], |
| 63 | created() { | 62 | created() { |
| 64 | this.initData(); | 63 | this.initData(); |
| 65 | }, | 64 | }, |
| @@ -71,6 +70,7 @@ export default { | @@ -71,6 +70,7 @@ export default { | ||
| 71 | channelType: "", | 70 | channelType: "", |
| 72 | online: "", | 71 | online: "", |
| 73 | choosed: "", | 72 | choosed: "", |
| 73 | + catalogId: null, | ||
| 74 | currentPage: 1, | 74 | currentPage: 1, |
| 75 | count: 10, | 75 | count: 10, |
| 76 | total: 0, | 76 | total: 0, |
| @@ -97,28 +97,28 @@ export default { | @@ -97,28 +97,28 @@ export default { | ||
| 97 | this.count = val; | 97 | this.count = val; |
| 98 | console.log(val) | 98 | console.log(val) |
| 99 | this.initData(); | 99 | this.initData(); |
| 100 | - | ||
| 101 | }, | 100 | }, |
| 102 | - rowcheckedChanage: function (val, row) { | 101 | + rowcheckedChange: function (val, row) { |
| 103 | console.log(val) | 102 | console.log(val) |
| 104 | console.log(row) | 103 | console.log(row) |
| 105 | }, | 104 | }, |
| 106 | - checkedChanage: function (val) { | ||
| 107 | - var that = this; | 105 | + // selectDisable: function (){ |
| 106 | + // if (this.catalogId == null) { | ||
| 107 | + // return false; | ||
| 108 | + // } | ||
| 109 | + // }, | ||
| 110 | + checkedChange: function (val) { | ||
| 111 | + let that = this; | ||
| 108 | if (!that.eventEnanle) { | 112 | if (!that.eventEnanle) { |
| 109 | return; | 113 | return; |
| 110 | } | 114 | } |
| 111 | - var tabelData = JSON.parse(JSON.stringify(this.$refs.gbChannelsTable.data)); | ||
| 112 | - console.log("checkedChanage") | ||
| 113 | - console.log(val) | ||
| 114 | - | ||
| 115 | - var newData = {}; | ||
| 116 | - var addData = []; | ||
| 117 | - var delData = []; | 115 | + let newData = {}; |
| 116 | + let addData = []; | ||
| 117 | + let delData = []; | ||
| 118 | if (val.length > 0) { | 118 | if (val.length > 0) { |
| 119 | for (let i = 0; i < val.length; i++) { | 119 | for (let i = 0; i < val.length; i++) { |
| 120 | const element = val[i]; | 120 | const element = val[i]; |
| 121 | - var key = element.deviceId + "_" + element.channelId; | 121 | + let key = element.deviceId + "_" + element.channelId; |
| 122 | newData[key] = element; | 122 | newData[key] = element; |
| 123 | if (!!!that.gbChoosechannel[key]){ | 123 | if (!!!that.gbChoosechannel[key]){ |
| 124 | addData.push(element) | 124 | addData.push(element) |
| @@ -127,7 +127,7 @@ export default { | @@ -127,7 +127,7 @@ export default { | ||
| 127 | } | 127 | } |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | - var oldKeys = Object.keys(that.gbChoosechannel); | 130 | + let oldKeys = Object.keys(that.gbChoosechannel); |
| 131 | if (oldKeys.length > 0) { | 131 | if (oldKeys.length > 0) { |
| 132 | for (let i = 0; i < oldKeys.length; i++) { | 132 | for (let i = 0; i < oldKeys.length; i++) { |
| 133 | const key = oldKeys[i]; | 133 | const key = oldKeys[i]; |
| @@ -136,7 +136,7 @@ export default { | @@ -136,7 +136,7 @@ export default { | ||
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | }else{ | 138 | }else{ |
| 139 | - var oldKeys = Object.keys(that.gbChoosechannel); | 139 | + let oldKeys = Object.keys(that.gbChoosechannel); |
| 140 | if (oldKeys.length > 0) { | 140 | if (oldKeys.length > 0) { |
| 141 | for (let i = 0; i < oldKeys.length; i++) { | 141 | for (let i = 0; i < oldKeys.length; i++) { |
| 142 | const key = oldKeys[i]; | 142 | const key = oldKeys[i]; |
| @@ -152,15 +152,17 @@ export default { | @@ -152,15 +152,17 @@ export default { | ||
| 152 | url:"/api/platform/update_channel_for_gb", | 152 | url:"/api/platform/update_channel_for_gb", |
| 153 | data:{ | 153 | data:{ |
| 154 | platformId: that.platformId, | 154 | platformId: that.platformId, |
| 155 | - channelReduces: addData | 155 | + channelReduces: addData, |
| 156 | + catalogId: that.catalogId | ||
| 156 | } | 157 | } |
| 157 | }).then((res)=>{ | 158 | }).then((res)=>{ |
| 158 | console.log("保存成功") | 159 | console.log("保存成功") |
| 160 | + if(that.updateChoosedCallback)that.updateChoosedCallback(that.catalogId) | ||
| 159 | }).catch(function (error) { | 161 | }).catch(function (error) { |
| 160 | console.log(error); | 162 | console.log(error); |
| 161 | }); | 163 | }); |
| 162 | } | 164 | } |
| 163 | - if (Object.keys(delData).length >0) { | 165 | + if (delData.length >0) { |
| 164 | that.$axios({ | 166 | that.$axios({ |
| 165 | method:"delete", | 167 | method:"delete", |
| 166 | url:"/api/platform/del_channel_for_gb", | 168 | url:"/api/platform/del_channel_for_gb", |
| @@ -170,13 +172,18 @@ export default { | @@ -170,13 +172,18 @@ export default { | ||
| 170 | } | 172 | } |
| 171 | }).then((res)=>{ | 173 | }).then((res)=>{ |
| 172 | console.log("移除成功") | 174 | console.log("移除成功") |
| 175 | + let nodeIds = new Array(); | ||
| 176 | + for (let i = 0; i < delData.length; i++) { | ||
| 177 | + nodeIds.push(delData[i].channelId) | ||
| 178 | + } | ||
| 179 | + if(that.updateChoosedCallback)that.updateChoosedCallback(null, nodeIds) | ||
| 173 | }).catch(function (error) { | 180 | }).catch(function (error) { |
| 174 | console.log(error); | 181 | console.log(error); |
| 175 | }); | 182 | }); |
| 176 | } | 183 | } |
| 177 | 184 | ||
| 178 | }, | 185 | }, |
| 179 | - shareAllCheckedChanage: function (val) { | 186 | + shareAllCheckedChange: function (val) { |
| 180 | this.chooseChanage(null, val) | 187 | this.chooseChanage(null, val) |
| 181 | }, | 188 | }, |
| 182 | getChannelList: function () { | 189 | getChannelList: function () { |
| @@ -215,7 +222,7 @@ export default { | @@ -215,7 +222,7 @@ export default { | ||
| 215 | } | 222 | } |
| 216 | } | 223 | } |
| 217 | that.eventEnanle = true; | 224 | that.eventEnanle = true; |
| 218 | - // that.checkedChanage(chooseGBS) | 225 | + // that.checkedChange(chooseGBS) |
| 219 | }) | 226 | }) |
| 220 | console.log(that.gbChoosechannel) | 227 | console.log(that.gbChoosechannel) |
| 221 | }) | 228 | }) |
| @@ -230,6 +237,10 @@ export default { | @@ -230,6 +237,10 @@ export default { | ||
| 230 | handleGBSelectionChange: function() { | 237 | handleGBSelectionChange: function() { |
| 231 | this.initData(); | 238 | this.initData(); |
| 232 | }, | 239 | }, |
| 240 | + catalogIdChange: function(id) { | ||
| 241 | + this.catalogId = id; | ||
| 242 | + console.log("通道选择模块收到: " + id) | ||
| 243 | + }, | ||
| 233 | } | 244 | } |
| 234 | }; | 245 | }; |
| 235 | </script> | 246 | </script> |
web_src/src/components/dialog/chooseChannelForStream.vue
| @@ -27,7 +27,6 @@ | @@ -27,7 +27,6 @@ | ||
| 27 | <script> | 27 | <script> |
| 28 | export default { | 28 | export default { |
| 29 | name: 'chooseChannelFoStream', | 29 | name: 'chooseChannelFoStream', |
| 30 | - props: {}, | ||
| 31 | computed: { | 30 | computed: { |
| 32 | // getPlayerShared: function () { | 31 | // getPlayerShared: function () { |
| 33 | // return { | 32 | // return { |
| @@ -37,7 +36,7 @@ export default { | @@ -37,7 +36,7 @@ export default { | ||
| 37 | // }; | 36 | // }; |
| 38 | // } | 37 | // } |
| 39 | }, | 38 | }, |
| 40 | - props: ['platformId'], | 39 | + props: ['platformId', 'updateChoosedCallback'], |
| 41 | created() { | 40 | created() { |
| 42 | this.initData(); | 41 | this.initData(); |
| 43 | }, | 42 | }, |
| @@ -49,6 +48,7 @@ export default { | @@ -49,6 +48,7 @@ export default { | ||
| 49 | channelType: "", | 48 | channelType: "", |
| 50 | online: "", | 49 | online: "", |
| 51 | choosed: "", | 50 | choosed: "", |
| 51 | + catalogId: null, | ||
| 52 | currentPage: 1, | 52 | currentPage: 1, |
| 53 | count: 10, | 53 | count: 10, |
| 54 | total: 0, | 54 | total: 0, |
| @@ -131,10 +131,12 @@ export default { | @@ -131,10 +131,12 @@ export default { | ||
| 131 | url:"/api/gbStream/add", | 131 | url:"/api/gbStream/add", |
| 132 | data:{ | 132 | data:{ |
| 133 | platformId: that.platformId, | 133 | platformId: that.platformId, |
| 134 | + catalogId: that.catalogId, | ||
| 134 | gbStreams: addData, | 135 | gbStreams: addData, |
| 135 | } | 136 | } |
| 136 | }).then((res)=>{ | 137 | }).then((res)=>{ |
| 137 | console.log("保存成功") | 138 | console.log("保存成功") |
| 139 | + if(this.updateChoosedCallback)this.updateChoosedCallback(this.catalogId) | ||
| 138 | }).catch(function (error) { | 140 | }).catch(function (error) { |
| 139 | console.log(error); | 141 | console.log(error); |
| 140 | }); | 142 | }); |
| @@ -149,6 +151,7 @@ export default { | @@ -149,6 +151,7 @@ export default { | ||
| 149 | } | 151 | } |
| 150 | }).then((res)=>{ | 152 | }).then((res)=>{ |
| 151 | console.log("移除成功") | 153 | console.log("移除成功") |
| 154 | + if(this.updateChoosedCallback)this.updateChoosedCallback(this.catalogId) | ||
| 152 | }).catch(function (error) { | 155 | }).catch(function (error) { |
| 153 | console.log(error); | 156 | console.log(error); |
| 154 | }); | 157 | }); |
| @@ -207,6 +210,10 @@ export default { | @@ -207,6 +210,10 @@ export default { | ||
| 207 | handleGBSelectionChange: function() { | 210 | handleGBSelectionChange: function() { |
| 208 | this.initData(); | 211 | this.initData(); |
| 209 | }, | 212 | }, |
| 213 | + catalogIdChange: function(id) { | ||
| 214 | + this.catalogId = id; | ||
| 215 | + console.log("直播通道选择模块收到: " + id) | ||
| 216 | + }, | ||
| 210 | } | 217 | } |
| 211 | }; | 218 | }; |
| 212 | </script> | 219 | </script> |
web_src/src/components/dialog/platformEdit.vue
| @@ -196,6 +196,7 @@ export default { | @@ -196,6 +196,7 @@ export default { | ||
| 196 | this.platform.transport = platform.transport; | 196 | this.platform.transport = platform.transport; |
| 197 | this.platform.characterSet = platform.characterSet; | 197 | this.platform.characterSet = platform.characterSet; |
| 198 | this.platform.shareAllLiveStream = platform.shareAllLiveStream; | 198 | this.platform.shareAllLiveStream = platform.shareAllLiveStream; |
| 199 | + this.platform.catalogId = platform.catalogId; | ||
| 199 | this.onSubmit_text = "保存"; | 200 | this.onSubmit_text = "保存"; |
| 200 | } | 201 | } |
| 201 | this.showDialog = true; | 202 | this.showDialog = true; |
web_src/src/main.js
| @@ -12,6 +12,7 @@ import VueClipboard from 'vue-clipboard2'; | @@ -12,6 +12,7 @@ import VueClipboard from 'vue-clipboard2'; | ||
| 12 | import { Notification } from 'element-ui'; | 12 | import { Notification } from 'element-ui'; |
| 13 | import Fingerprint2 from 'fingerprintjs2'; | 13 | import Fingerprint2 from 'fingerprintjs2'; |
| 14 | import VueClipboards from 'vue-clipboards'; | 14 | import VueClipboards from 'vue-clipboards'; |
| 15 | +import Contextmenu from "vue-contextmenujs" | ||
| 15 | 16 | ||
| 16 | 17 | ||
| 17 | // 生成唯一ID | 18 | // 生成唯一ID |
| @@ -37,6 +38,7 @@ Vue.use(VueCookies); | @@ -37,6 +38,7 @@ Vue.use(VueCookies); | ||
| 37 | Vue.use(VueClipboards); | 38 | Vue.use(VueClipboards); |
| 38 | Vue.prototype.$axios = axios; | 39 | Vue.prototype.$axios = axios; |
| 39 | Vue.prototype.$notify = Notification; | 40 | Vue.prototype.$notify = Notification; |
| 41 | +Vue.use(Contextmenu); | ||
| 40 | 42 | ||
| 41 | axios.defaults.baseURL = (process.env.NODE_ENV === 'development') ? process.env.BASE_API : ""; | 43 | axios.defaults.baseURL = (process.env.NODE_ENV === 'development') ? process.env.BASE_API : ""; |
| 42 | 44 |
web_src/static/css/iconfont.css
| 1 | @font-face { | 1 | @font-face { |
| 2 | font-family: "iconfont"; /* Project id 1291092 */ | 2 | font-family: "iconfont"; /* Project id 1291092 */ |
| 3 | - src: url('iconfont.woff2?t=1637741914969') format('woff2'), | ||
| 4 | - url('iconfont.woff?t=1637741914969') format('woff'), | ||
| 5 | - url('iconfont.ttf?t=1637741914969') format('truetype'); | 3 | + src: url('iconfont.woff2?t=1640922722742') format('woff2'), |
| 4 | + url('iconfont.woff?t=1640922722742') format('woff'), | ||
| 5 | + url('iconfont.ttf?t=1640922722742') format('truetype'); | ||
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | .iconfont { | 8 | .iconfont { |
| @@ -13,6 +13,22 @@ | @@ -13,6 +13,22 @@ | ||
| 13 | -moz-osx-font-smoothing: grayscale; | 13 | -moz-osx-font-smoothing: grayscale; |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | +.icon-wxbzhuye:before { | ||
| 17 | + content: "\e7d1"; | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +.icon-mulu:before { | ||
| 21 | + content: "\e7d2"; | ||
| 22 | +} | ||
| 23 | + | ||
| 24 | +.icon-zhibo:before { | ||
| 25 | + content: "\e8c1"; | ||
| 26 | +} | ||
| 27 | + | ||
| 28 | +.icon-shexiangtou:before { | ||
| 29 | + content: "\e7d3"; | ||
| 30 | +} | ||
| 31 | + | ||
| 16 | .icon-suoxiao:before { | 32 | .icon-suoxiao:before { |
| 17 | content: "\e79a"; | 33 | content: "\e79a"; |
| 18 | } | 34 | } |
| @@ -49,7 +65,7 @@ | @@ -49,7 +65,7 @@ | ||
| 49 | content: "\e7a2"; | 65 | content: "\e7a2"; |
| 50 | } | 66 | } |
| 51 | 67 | ||
| 52 | -.icon-kuaijin:before { | 68 | +.icon-houtui:before { |
| 53 | content: "\e7a3"; | 69 | content: "\e7a3"; |
| 54 | } | 70 | } |
| 55 | 71 | ||
| @@ -57,7 +73,7 @@ | @@ -57,7 +73,7 @@ | ||
| 57 | content: "\e7a4"; | 73 | content: "\e7a4"; |
| 58 | } | 74 | } |
| 59 | 75 | ||
| 60 | -.icon-kuaitui:before { | 76 | +.icon-kuaijin:before { |
| 61 | content: "\e7a5"; | 77 | content: "\e7a5"; |
| 62 | } | 78 | } |
| 63 | 79 |
web_src/static/css/iconfont.woff2
No preview for this file type