
101 changed files with 4681 additions and 14905 deletions
@ -0,0 +1,540 @@ |
|||||
|
-- 此脚本采用dbeaver导出 |
||||
|
-- MySQL dump 10.13 Distrib 8.0.27, for Linux (x86_64) |
||||
|
-- |
||||
|
-- Host: localhost Database: wvp |
||||
|
-- ------------------------------------------------------ |
||||
|
-- Server version 8.0.27-0ubuntu0.20.04.1 |
||||
|
|
||||
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; |
||||
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; |
||||
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; |
||||
|
/*!50503 SET NAMES utf8mb4 */; |
||||
|
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; |
||||
|
/*!40103 SET TIME_ZONE='+00:00' */; |
||||
|
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; |
||||
|
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; |
||||
|
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; |
||||
|
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; |
||||
|
|
||||
|
-- |
||||
|
-- Table structure for table `device` |
||||
|
-- |
||||
|
|
||||
|
DROP TABLE IF EXISTS `device`; |
||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */; |
||||
|
/*!50503 SET character_set_client = utf8mb4 */; |
||||
|
CREATE TABLE `device` ( |
||||
|
`deviceId` varchar(50) NOT NULL, |
||||
|
`name` varchar(255) DEFAULT NULL, |
||||
|
`manufacturer` varchar(255) DEFAULT NULL, |
||||
|
`model` varchar(255) DEFAULT NULL, |
||||
|
`firmware` varchar(255) DEFAULT NULL, |
||||
|
`transport` varchar(50) DEFAULT NULL, |
||||
|
`streamMode` varchar(50) DEFAULT NULL, |
||||
|
`online` varchar(50) DEFAULT NULL, |
||||
|
`registerTime` varchar(50) DEFAULT NULL, |
||||
|
`keepaliveTime` varchar(50) DEFAULT NULL, |
||||
|
`ip` varchar(50) NOT NULL, |
||||
|
`createTime` varchar(50) NOT NULL, |
||||
|
`updateTime` varchar(50) NOT NULL, |
||||
|
`port` int NOT NULL, |
||||
|
`expires` int NOT NULL, |
||||
|
`subscribeCycleForCatalog` int NOT NULL, |
||||
|
`hostAddress` varchar(50) NOT NULL, |
||||
|
`charset` varchar(50) NOT NULL, |
||||
|
PRIMARY KEY (`deviceId`) |
||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; |
||||
|
/*!40101 SET character_set_client = @saved_cs_client */; |
||||
|
|
||||
|
-- |
||||
|
-- Dumping data for table `device` |
||||
|
-- |
||||
|
|
||||
|
LOCK TABLES `device` WRITE; |
||||
|
/*!40000 ALTER TABLE `device` DISABLE KEYS */; |
||||
|
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'); |
||||
|
/*!40000 ALTER TABLE `device` ENABLE KEYS */; |
||||
|
UNLOCK TABLES; |
||||
|
|
||||
|
-- |
||||
|
-- Table structure for table `device_alarm` |
||||
|
-- |
||||
|
|
||||
|
DROP TABLE IF EXISTS `device_alarm`; |
||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */; |
||||
|
/*!50503 SET character_set_client = utf8mb4 */; |
||||
|
CREATE TABLE `device_alarm` ( |
||||
|
`id` int NOT NULL AUTO_INCREMENT, |
||||
|
`deviceId` varchar(50) NOT NULL, |
||||
|
`channelId` varchar(50) NOT NULL, |
||||
|
`alarmPriority` varchar(50) NOT NULL, |
||||
|
`alarmMethod` varchar(50) DEFAULT NULL, |
||||
|
`alarmTime` varchar(50) NOT NULL, |
||||
|
`alarmDescription` varchar(255) DEFAULT NULL, |
||||
|
`longitude` double DEFAULT NULL, |
||||
|
`latitude` double DEFAULT NULL, |
||||
|
`alarmType` varchar(50) DEFAULT NULL, |
||||
|
PRIMARY KEY (`id`) |
||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; |
||||
|
/*!40101 SET character_set_client = @saved_cs_client */; |
||||
|
|
||||
|
-- |
||||
|
-- Dumping data for table `device_alarm` |
||||
|
-- |
||||
|
|
||||
|
LOCK TABLES `device_alarm` WRITE; |
||||
|
/*!40000 ALTER TABLE `device_alarm` DISABLE KEYS */; |
||||
|
/*!40000 ALTER TABLE `device_alarm` ENABLE KEYS */; |
||||
|
UNLOCK TABLES; |
||||
|
|
||||
|
-- |
||||
|
-- Table structure for table `device_channel` |
||||
|
-- |
||||
|
|
||||
|
DROP TABLE IF EXISTS `device_channel`; |
||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */; |
||||
|
/*!50503 SET character_set_client = utf8mb4 */; |
||||
|
CREATE TABLE `device_channel` ( |
||||
|
`channelId` varchar(50) NOT NULL, |
||||
|
`name` varchar(255) DEFAULT NULL, |
||||
|
`manufacture` varchar(50) DEFAULT NULL, |
||||
|
`model` varchar(50) DEFAULT NULL, |
||||
|
`owner` varchar(50) DEFAULT NULL, |
||||
|
`civilCode` varchar(50) DEFAULT NULL, |
||||
|
`block` varchar(50) DEFAULT NULL, |
||||
|
`address` varchar(50) DEFAULT NULL, |
||||
|
`parentId` varchar(50) DEFAULT NULL, |
||||
|
`safetyWay` int DEFAULT NULL, |
||||
|
`registerWay` int DEFAULT NULL, |
||||
|
`certNum` varchar(50) DEFAULT NULL, |
||||
|
`certifiable` int DEFAULT NULL, |
||||
|
`errCode` int DEFAULT NULL, |
||||
|
`endTime` varchar(50) DEFAULT NULL, |
||||
|
`secrecy` varchar(50) DEFAULT NULL, |
||||
|
`ipAddress` varchar(50) DEFAULT NULL, |
||||
|
`port` int DEFAULT NULL, |
||||
|
`password` varchar(255) DEFAULT NULL, |
||||
|
`PTZType` int DEFAULT NULL, |
||||
|
`status` int DEFAULT NULL, |
||||
|
`longitude` double DEFAULT NULL, |
||||
|
`latitude` double DEFAULT NULL, |
||||
|
`streamId` varchar(50) DEFAULT NULL, |
||||
|
`deviceId` varchar(50) NOT NULL, |
||||
|
`parental` varchar(50) DEFAULT NULL, |
||||
|
`hasAudio` bit(1) DEFAULT NULL, |
||||
|
`createTime` varchar(50) NOT NULL, |
||||
|
`updateTime` varchar(50) NOT NULL, |
||||
|
PRIMARY KEY (`channelId`,`deviceId`) |
||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; |
||||
|
/*!40101 SET character_set_client = @saved_cs_client */; |
||||
|
|
||||
|
-- |
||||
|
-- Dumping data for table `device_channel` |
||||
|
-- |
||||
|
|
||||
|
LOCK TABLES `device_channel` WRITE; |
||||
|
/*!40000 ALTER TABLE `device_channel` DISABLE KEYS */; |
||||
|
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'); |
||||
|
/*!40000 ALTER TABLE `device_channel` ENABLE KEYS */; |
||||
|
UNLOCK TABLES; |
||||
|
|
||||
|
-- |
||||
|
-- Table structure for table `device_mobile_position` |
||||
|
-- |
||||
|
|
||||
|
DROP TABLE IF EXISTS `device_mobile_position`; |
||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */; |
||||
|
/*!50503 SET character_set_client = utf8mb4 */; |
||||
|
CREATE TABLE `device_mobile_position` ( |
||||
|
`deviceId` varchar(50) NOT NULL, |
||||
|
`channelId` varchar(50) NOT NULL, |
||||
|
`deviceName` varchar(255) DEFAULT NULL, |
||||
|
`time` varchar(50) NOT NULL, |
||||
|
`longitude` double NOT NULL, |
||||
|
`latitude` double NOT NULL, |
||||
|
`altitude` double DEFAULT NULL, |
||||
|
`speed` double DEFAULT NULL, |
||||
|
`direction` double DEFAULT NULL, |
||||
|
`reportSource` varchar(50) DEFAULT NULL, |
||||
|
`geodeticSystem` varchar(50) DEFAULT NULL, |
||||
|
`cnLng` varchar(50) DEFAULT NULL, |
||||
|
`cnLat` varchar(50) DEFAULT NULL, |
||||
|
PRIMARY KEY (`deviceId`,`time`) |
||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; |
||||
|
/*!40101 SET character_set_client = @saved_cs_client */; |
||||
|
|
||||
|
-- |
||||
|
-- Dumping data for table `device_mobile_position` |
||||
|
-- |
||||
|
|
||||
|
LOCK TABLES `device_mobile_position` WRITE; |
||||
|
/*!40000 ALTER TABLE `device_mobile_position` DISABLE KEYS */; |
||||
|
/*!40000 ALTER TABLE `device_mobile_position` ENABLE KEYS */; |
||||
|
UNLOCK TABLES; |
||||
|
|
||||
|
-- |
||||
|
-- Table structure for table `gb_stream` |
||||
|
-- |
||||
|
|
||||
|
DROP TABLE IF EXISTS `gb_stream`; |
||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */; |
||||
|
/*!50503 SET character_set_client = utf8mb4 */; |
||||
|
CREATE TABLE `gb_stream` ( |
||||
|
`app` varchar(255) NOT NULL, |
||||
|
`stream` varchar(255) NOT NULL, |
||||
|
`gbId` varchar(50) NOT NULL, |
||||
|
`name` varchar(255) DEFAULT NULL, |
||||
|
`longitude` double DEFAULT NULL, |
||||
|
`latitude` double DEFAULT NULL, |
||||
|
`streamType` varchar(50) DEFAULT NULL, |
||||
|
`mediaServerId` varchar(50) DEFAULT NULL, |
||||
|
`status` int DEFAULT NULL, |
||||
|
PRIMARY KEY (`app`,`stream`,`gbId`) |
||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; |
||||
|
/*!40101 SET character_set_client = @saved_cs_client */; |
||||
|
|
||||
|
-- |
||||
|
-- Dumping data for table `gb_stream` |
||||
|
-- |
||||
|
|
||||
|
LOCK TABLES `gb_stream` WRITE; |
||||
|
/*!40000 ALTER TABLE `gb_stream` DISABLE KEYS */; |
||||
|
INSERT INTO `gb_stream` VALUES ('1000','10000001_52869999','77777777777777777777','shoulei1111',0,0,'push','XR1LEpKlfQtSg9Z1',1); |
||||
|
/*!40000 ALTER TABLE `gb_stream` ENABLE KEYS */; |
||||
|
UNLOCK TABLES; |
||||
|
|
||||
|
-- |
||||
|
-- Table structure for table `log` |
||||
|
-- |
||||
|
|
||||
|
DROP TABLE IF EXISTS `log`; |
||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */; |
||||
|
/*!50503 SET character_set_client = utf8mb4 */; |
||||
|
CREATE TABLE `log` ( |
||||
|
`id` int NOT NULL AUTO_INCREMENT, |
||||
|
`name` varchar(50) NOT NULL, |
||||
|
`type` varchar(50) NOT NULL, |
||||
|
`uri` varchar(200) NOT NULL, |
||||
|
`address` varchar(50) NOT NULL, |
||||
|
`result` varchar(50) NOT NULL, |
||||
|
`timing` bigint NOT NULL, |
||||
|
`username` varchar(50) NOT NULL, |
||||
|
`createTime` varchar(50) NOT NULL, |
||||
|
PRIMARY KEY (`id`) |
||||
|
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; |
||||
|
/*!40101 SET character_set_client = @saved_cs_client */; |
||||
|
|
||||
|
-- |
||||
|
-- Dumping data for table `log` |
||||
|
-- |
||||
|
|
||||
|
LOCK TABLES `log` WRITE; |
||||
|
/*!40000 ALTER TABLE `log` DISABLE KEYS */; |
||||
|
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'); |
||||
|
/*!40000 ALTER TABLE `log` ENABLE KEYS */; |
||||
|
UNLOCK TABLES; |
||||
|
|
||||
|
-- |
||||
|
-- Table structure for table `media_server` |
||||
|
-- |
||||
|
|
||||
|
DROP TABLE IF EXISTS `media_server`; |
||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */; |
||||
|
/*!50503 SET character_set_client = utf8mb4 */; |
||||
|
CREATE TABLE `media_server` ( |
||||
|
`id` varchar(255) NOT NULL, |
||||
|
`ip` varchar(50) NOT NULL, |
||||
|
`hookIp` varchar(50) NOT NULL, |
||||
|
`sdpIp` varchar(50) NOT NULL, |
||||
|
`streamIp` varchar(50) NOT NULL, |
||||
|
`httpPort` int NOT NULL, |
||||
|
`httpSSlPort` int NOT NULL, |
||||
|
`rtmpPort` int NOT NULL, |
||||
|
`rtmpSSlPort` int NOT NULL, |
||||
|
`rtpProxyPort` int NOT NULL, |
||||
|
`rtspPort` int NOT NULL, |
||||
|
`rtspSSLPort` int NOT NULL, |
||||
|
`autoConfig` int NOT NULL, |
||||
|
`secret` varchar(50) NOT NULL, |
||||
|
`streamNoneReaderDelayMS` int NOT NULL, |
||||
|
`rtpEnable` int NOT NULL, |
||||
|
`rtpPortRange` varchar(50) NOT NULL, |
||||
|
`sendRtpPortRange` varchar(50) NOT NULL, |
||||
|
`recordAssistPort` int NOT NULL, |
||||
|
`defaultServer` int NOT NULL, |
||||
|
`createTime` varchar(50) NOT NULL, |
||||
|
`updateTime` varchar(50) NOT NULL, |
||||
|
`hookAliveInterval` int NOT NULL, |
||||
|
PRIMARY KEY (`id`), |
||||
|
UNIQUE KEY `media_server_i` (`ip`,`httpPort`) |
||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; |
||||
|
/*!40101 SET character_set_client = @saved_cs_client */; |
||||
|
|
||||
|
-- |
||||
|
-- Dumping data for table `media_server` |
||||
|
-- |
||||
|
|
||||
|
LOCK TABLES `media_server` WRITE; |
||||
|
/*!40000 ALTER TABLE `media_server` DISABLE KEYS */; |
||||
|
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); |
||||
|
/*!40000 ALTER TABLE `media_server` ENABLE KEYS */; |
||||
|
UNLOCK TABLES; |
||||
|
|
||||
|
-- |
||||
|
-- Table structure for table `parent_platform` |
||||
|
-- |
||||
|
|
||||
|
DROP TABLE IF EXISTS `parent_platform`; |
||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */; |
||||
|
/*!50503 SET character_set_client = utf8mb4 */; |
||||
|
CREATE TABLE `parent_platform` ( |
||||
|
`id` int NOT NULL AUTO_INCREMENT, |
||||
|
`enable` int DEFAULT NULL, |
||||
|
`name` varchar(255) DEFAULT NULL, |
||||
|
`serverGBId` varchar(50) NOT NULL, |
||||
|
`serverGBDomain` varchar(50) DEFAULT NULL, |
||||
|
`serverIP` varchar(50) DEFAULT NULL, |
||||
|
`serverPort` int DEFAULT NULL, |
||||
|
`deviceGBId` varchar(50) NOT NULL, |
||||
|
`deviceIp` varchar(50) DEFAULT NULL, |
||||
|
`devicePort` varchar(50) DEFAULT NULL, |
||||
|
`username` varchar(255) DEFAULT NULL, |
||||
|
`password` varchar(50) DEFAULT NULL, |
||||
|
`expires` varchar(50) DEFAULT NULL, |
||||
|
`keepTimeout` varchar(50) DEFAULT NULL, |
||||
|
`transport` varchar(50) DEFAULT NULL, |
||||
|
`characterSet` varchar(50) DEFAULT NULL, |
||||
|
`catalogId` varchar(50) NOT NULL, |
||||
|
`ptz` int DEFAULT NULL, |
||||
|
`rtcp` int DEFAULT NULL, |
||||
|
`status` bit(1) DEFAULT NULL, |
||||
|
`shareAllLiveStream` int DEFAULT NULL, |
||||
|
PRIMARY KEY (`id`,`serverGBId`) |
||||
|
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; |
||||
|
/*!40101 SET character_set_client = @saved_cs_client */; |
||||
|
|
||||
|
-- |
||||
|
-- Dumping data for table `parent_platform` |
||||
|
-- |
||||
|
|
||||
|
LOCK TABLES `parent_platform` WRITE; |
||||
|
/*!40000 ALTER TABLE `parent_platform` DISABLE KEYS */; |
||||
|
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); |
||||
|
/*!40000 ALTER TABLE `parent_platform` ENABLE KEYS */; |
||||
|
UNLOCK TABLES; |
||||
|
|
||||
|
-- |
||||
|
-- Table structure for table `platform_catalog` |
||||
|
-- |
||||
|
|
||||
|
DROP TABLE IF EXISTS `platform_catalog`; |
||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */; |
||||
|
/*!50503 SET character_set_client = utf8mb4 */; |
||||
|
CREATE TABLE `platform_catalog` ( |
||||
|
`id` varchar(50) NOT NULL, |
||||
|
`platformId` varchar(50) NOT NULL, |
||||
|
`name` varchar(255) NOT NULL, |
||||
|
`parentId` varchar(50) DEFAULT NULL, |
||||
|
PRIMARY KEY (`id`) |
||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; |
||||
|
/*!40101 SET character_set_client = @saved_cs_client */; |
||||
|
|
||||
|
-- |
||||
|
-- Dumping data for table `platform_catalog` |
||||
|
-- |
||||
|
|
||||
|
LOCK TABLES `platform_catalog` WRITE; |
||||
|
/*!40000 ALTER TABLE `platform_catalog` DISABLE KEYS */; |
||||
|
INSERT INTO `platform_catalog` VALUES ('1111111111','1111111111111','11122','1111111111111'); |
||||
|
/*!40000 ALTER TABLE `platform_catalog` ENABLE KEYS */; |
||||
|
UNLOCK TABLES; |
||||
|
|
||||
|
-- |
||||
|
-- Table structure for table `platform_gb_channel` |
||||
|
-- |
||||
|
|
||||
|
DROP TABLE IF EXISTS `platform_gb_channel`; |
||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */; |
||||
|
/*!50503 SET character_set_client = utf8mb4 */; |
||||
|
CREATE TABLE `platform_gb_channel` ( |
||||
|
`channelId` varchar(50) NOT NULL, |
||||
|
`deviceId` varchar(50) NOT NULL, |
||||
|
`platformId` varchar(50) NOT NULL, |
||||
|
`deviceAndChannelId` varchar(50) NOT NULL, |
||||
|
`catalogId` varchar(50) NOT NULL, |
||||
|
PRIMARY KEY (`deviceAndChannelId`,`platformId`) |
||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; |
||||
|
/*!40101 SET character_set_client = @saved_cs_client */; |
||||
|
|
||||
|
-- |
||||
|
-- Dumping data for table `platform_gb_channel` |
||||
|
-- |
||||
|
|
||||
|
LOCK TABLES `platform_gb_channel` WRITE; |
||||
|
/*!40000 ALTER TABLE `platform_gb_channel` DISABLE KEYS */; |
||||
|
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'); |
||||
|
/*!40000 ALTER TABLE `platform_gb_channel` ENABLE KEYS */; |
||||
|
UNLOCK TABLES; |
||||
|
|
||||
|
-- |
||||
|
-- Table structure for table `platform_gb_stream` |
||||
|
-- |
||||
|
|
||||
|
DROP TABLE IF EXISTS `platform_gb_stream`; |
||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */; |
||||
|
/*!50503 SET character_set_client = utf8mb4 */; |
||||
|
CREATE TABLE `platform_gb_stream` ( |
||||
|
`platformId` varchar(50) NOT NULL, |
||||
|
`app` varchar(255) NOT NULL, |
||||
|
`stream` varchar(255) NOT NULL, |
||||
|
`catalogId` varchar(50) NOT NULL, |
||||
|
PRIMARY KEY (`platformId`,`app`,`stream`) |
||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; |
||||
|
/*!40101 SET character_set_client = @saved_cs_client */; |
||||
|
|
||||
|
-- |
||||
|
-- Dumping data for table `platform_gb_stream` |
||||
|
-- |
||||
|
|
||||
|
LOCK TABLES `platform_gb_stream` WRITE; |
||||
|
/*!40000 ALTER TABLE `platform_gb_stream` DISABLE KEYS */; |
||||
|
INSERT INTO `platform_gb_stream` VALUES ('1111111111111','1000','10000001_52869999','1111111111'); |
||||
|
/*!40000 ALTER TABLE `platform_gb_stream` ENABLE KEYS */; |
||||
|
UNLOCK TABLES; |
||||
|
|
||||
|
-- |
||||
|
-- Table structure for table `role` |
||||
|
-- |
||||
|
|
||||
|
DROP TABLE IF EXISTS `role`; |
||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */; |
||||
|
/*!50503 SET character_set_client = utf8mb4 */; |
||||
|
CREATE TABLE `role` ( |
||||
|
`id` int NOT NULL AUTO_INCREMENT, |
||||
|
`name` text NOT NULL, |
||||
|
`authority` text NOT NULL, |
||||
|
`createTime` varchar(50) NOT NULL, |
||||
|
`updateTime` varchar(50) NOT NULL, |
||||
|
PRIMARY KEY (`id`) |
||||
|
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; |
||||
|
/*!40101 SET character_set_client = @saved_cs_client */; |
||||
|
|
||||
|
-- |
||||
|
-- Dumping data for table `role` |
||||
|
-- |
||||
|
|
||||
|
LOCK TABLES `role` WRITE; |
||||
|
/*!40000 ALTER TABLE `role` DISABLE KEYS */; |
||||
|
INSERT INTO `role` VALUES (1,'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57'); |
||||
|
/*!40000 ALTER TABLE `role` ENABLE KEYS */; |
||||
|
UNLOCK TABLES; |
||||
|
|
||||
|
-- |
||||
|
-- Table structure for table `stream_proxy` |
||||
|
-- |
||||
|
|
||||
|
DROP TABLE IF EXISTS `stream_proxy`; |
||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */; |
||||
|
/*!50503 SET character_set_client = utf8mb4 */; |
||||
|
CREATE TABLE `stream_proxy` ( |
||||
|
`type` varchar(50) NOT NULL, |
||||
|
`app` varchar(255) NOT NULL, |
||||
|
`stream` varchar(255) NOT NULL, |
||||
|
`url` varchar(255) DEFAULT NULL, |
||||
|
`src_url` varchar(255) DEFAULT NULL, |
||||
|
`dst_url` varchar(255) DEFAULT NULL, |
||||
|
`timeout_ms` int DEFAULT NULL, |
||||
|
`ffmpeg_cmd_key` varchar(255) DEFAULT NULL, |
||||
|
`rtp_type` varchar(50) DEFAULT NULL, |
||||
|
`mediaServerId` varchar(50) DEFAULT NULL, |
||||
|
`enable_hls` bit(1) DEFAULT NULL, |
||||
|
`enable_mp4` bit(1) DEFAULT NULL, |
||||
|
`enable` bit(1) NOT NULL, |
||||
|
`enable_remove_none_reader` bit(1) NOT NULL, |
||||
|
`createTime` varchar(50) NOT NULL, |
||||
|
PRIMARY KEY (`app`,`stream`) |
||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; |
||||
|
/*!40101 SET character_set_client = @saved_cs_client */; |
||||
|
|
||||
|
-- |
||||
|
-- Dumping data for table `stream_proxy` |
||||
|
-- |
||||
|
|
||||
|
LOCK TABLES `stream_proxy` WRITE; |
||||
|
/*!40000 ALTER TABLE `stream_proxy` DISABLE KEYS */; |
||||
|
/*!40000 ALTER TABLE `stream_proxy` ENABLE KEYS */; |
||||
|
UNLOCK TABLES; |
||||
|
|
||||
|
-- |
||||
|
-- Table structure for table `stream_push` |
||||
|
-- |
||||
|
|
||||
|
DROP TABLE IF EXISTS `stream_push`; |
||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */; |
||||
|
/*!50503 SET character_set_client = utf8mb4 */; |
||||
|
CREATE TABLE `stream_push` ( |
||||
|
`app` varchar(255) NOT NULL, |
||||
|
`stream` varchar(255) NOT NULL, |
||||
|
`totalReaderCount` varchar(50) DEFAULT NULL, |
||||
|
`originType` int DEFAULT NULL, |
||||
|
`originTypeStr` varchar(50) DEFAULT NULL, |
||||
|
`createStamp` int DEFAULT NULL, |
||||
|
`aliveSecond` int DEFAULT NULL, |
||||
|
`mediaServerId` varchar(50) DEFAULT NULL, |
||||
|
PRIMARY KEY (`app`,`stream`) |
||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; |
||||
|
/*!40101 SET character_set_client = @saved_cs_client */; |
||||
|
|
||||
|
-- |
||||
|
-- Dumping data for table `stream_push` |
||||
|
-- |
||||
|
|
||||
|
LOCK TABLES `stream_push` WRITE; |
||||
|
/*!40000 ALTER TABLE `stream_push` DISABLE KEYS */; |
||||
|
INSERT INTO `stream_push` VALUES ('1000','10000001_52869999','0',2,'rtsp_push',1641366850,0,'XR1LEpKlfQtSg9Z1'); |
||||
|
/*!40000 ALTER TABLE `stream_push` ENABLE KEYS */; |
||||
|
UNLOCK TABLES; |
||||
|
|
||||
|
-- |
||||
|
-- Table structure for table `user` |
||||
|
-- |
||||
|
|
||||
|
DROP TABLE IF EXISTS `user`; |
||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */; |
||||
|
/*!50503 SET character_set_client = utf8mb4 */; |
||||
|
CREATE TABLE `user` ( |
||||
|
`id` int NOT NULL AUTO_INCREMENT, |
||||
|
`username` varchar(255) NOT NULL, |
||||
|
`password` varchar(255) NOT NULL, |
||||
|
`roleId` int NOT NULL, |
||||
|
`createTime` varchar(50) NOT NULL, |
||||
|
`updateTime` varchar(50) NOT NULL, |
||||
|
PRIMARY KEY (`id`), |
||||
|
UNIQUE KEY `user_username_uindex` (`username`) |
||||
|
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; |
||||
|
/*!40101 SET character_set_client = @saved_cs_client */; |
||||
|
|
||||
|
-- |
||||
|
-- Dumping data for table `user` |
||||
|
-- |
||||
|
|
||||
|
LOCK TABLES `user` WRITE; |
||||
|
/*!40000 ALTER TABLE `user` DISABLE KEYS */; |
||||
|
INSERT INTO `user` VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021-04-13 14:14:57','2021-04-13 14:14:57'); |
||||
|
/*!40000 ALTER TABLE `user` ENABLE KEYS */; |
||||
|
UNLOCK TABLES; |
||||
|
|
||||
|
-- |
||||
|
-- Dumping routines for database 'wvp' |
||||
|
-- |
||||
|
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; |
||||
|
|
||||
|
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; |
||||
|
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; |
||||
|
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; |
||||
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; |
||||
|
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; |
||||
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; |
||||
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; |
||||
|
|
||||
|
-- Dump completed on 2022-01-05 15:15:35 |
@ -0,0 +1,41 @@ |
|||||
|
package com.genersoft.iot.vmp.conf; |
||||
|
|
||||
|
import org.springframework.data.redis.connection.RedisConnection; |
||||
|
import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; |
||||
|
import org.springframework.data.redis.listener.RedisMessageListenerContainer; |
||||
|
import org.springframework.util.StringUtils; |
||||
|
|
||||
|
import java.util.Properties; |
||||
|
|
||||
|
public class RedisKeyExpirationEventMessageListener extends KeyExpirationEventMessageListener { |
||||
|
|
||||
|
private UserSetup userSetup; |
||||
|
private RedisMessageListenerContainer listenerContainer; |
||||
|
private String keyspaceNotificationsConfigParameter = "EA"; |
||||
|
|
||||
|
public RedisKeyExpirationEventMessageListener(RedisMessageListenerContainer listenerContainer, UserSetup userSetup) { |
||||
|
super(listenerContainer); |
||||
|
this.listenerContainer = listenerContainer; |
||||
|
this.userSetup = userSetup; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void init() { |
||||
|
if (!userSetup.getRedisConfig()) { |
||||
|
// 配置springboot默认Config为空,即不让应用去修改redis的默认配置,因为Redis服务出于安全会禁用CONFIG命令给远程用户使用
|
||||
|
setKeyspaceNotificationsConfigParameter(""); |
||||
|
}else { |
||||
|
|
||||
|
RedisConnection connection = this.listenerContainer.getConnectionFactory().getConnection(); |
||||
|
Properties config = connection.getConfig("notify-keyspace-events"); |
||||
|
try { |
||||
|
if (!config.getProperty("notify-keyspace-events").equals(keyspaceNotificationsConfigParameter)) { |
||||
|
connection.setConfig("notify-keyspace-events", keyspaceNotificationsConfigParameter); |
||||
|
} |
||||
|
} finally { |
||||
|
connection.close(); |
||||
|
} |
||||
|
} |
||||
|
super.init(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
package com.genersoft.iot.vmp.gb28181.bean; |
||||
|
|
||||
|
public class CmdType { |
||||
|
|
||||
|
public static final String CATALOG = "Catalog"; |
||||
|
public static final String ALARM = "Alarm"; |
||||
|
public static final String MOBILE_POSITION = "MobilePosition"; |
||||
|
} |
@ -0,0 +1,21 @@ |
|||||
|
package com.genersoft.iot.vmp.gb28181.bean; |
||||
|
|
||||
|
import javax.sip.Dialog; |
||||
|
import java.util.EventObject; |
||||
|
|
||||
|
public class DeviceNotFoundEvent extends EventObject { |
||||
|
/** |
||||
|
* Constructs a prototypical Event. |
||||
|
* |
||||
|
* @param dialog |
||||
|
* @throws IllegalArgumentException if source is null. |
||||
|
*/ |
||||
|
public DeviceNotFoundEvent(Dialog dialog) { |
||||
|
super(dialog); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public Dialog getDialog() { |
||||
|
return (Dialog)super.getSource(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,71 @@ |
|||||
|
package com.genersoft.iot.vmp.gb28181.bean; |
||||
|
|
||||
|
public class PlatformCatalog { |
||||
|
private String id; |
||||
|
private String name; |
||||
|
private String platformId; |
||||
|
private String parentId; |
||||
|
private int childrenCount; // 子节点数
|
||||
|
private int type; // 0 目录, 1 国标通道, 2 直播流
|
||||
|
|
||||
|
public String getId() { |
||||
|
return id; |
||||
|
} |
||||
|
|
||||
|
public void setId(String id) { |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
public String getName() { |
||||
|
return name; |
||||
|
} |
||||
|
|
||||
|
public void setName(String name) { |
||||
|
this.name = name; |
||||
|
} |
||||
|
|
||||
|
public String getPlatformId() { |
||||
|
return platformId; |
||||
|
} |
||||
|
|
||||
|
public void setPlatformId(String platformId) { |
||||
|
this.platformId = platformId; |
||||
|
} |
||||
|
|
||||
|
public String getParentId() { |
||||
|
return parentId; |
||||
|
} |
||||
|
|
||||
|
public void setParentId(String parentId) { |
||||
|
this.parentId = parentId; |
||||
|
} |
||||
|
|
||||
|
public int getChildrenCount() { |
||||
|
return childrenCount; |
||||
|
} |
||||
|
|
||||
|
public void setChildrenCount(int childrenCount) { |
||||
|
this.childrenCount = childrenCount; |
||||
|
} |
||||
|
|
||||
|
public int getType() { |
||||
|
return type; |
||||
|
} |
||||
|
|
||||
|
public void setType(int type) { |
||||
|
this.type = type; |
||||
|
} |
||||
|
|
||||
|
public void setTypeForCatalog() { |
||||
|
this.type = 0; |
||||
|
} |
||||
|
|
||||
|
public void setTypeForGb() { |
||||
|
this.type = 1; |
||||
|
} |
||||
|
|
||||
|
public void setTypeForStream() { |
||||
|
this.type = 2; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,78 @@ |
|||||
|
package com.genersoft.iot.vmp.gb28181.bean; |
||||
|
|
||||
|
import javax.sip.RequestEvent; |
||||
|
import javax.sip.header.*; |
||||
|
import javax.sip.message.Request; |
||||
|
|
||||
|
public class SubscribeInfo { |
||||
|
|
||||
|
public SubscribeInfo() { |
||||
|
} |
||||
|
|
||||
|
public SubscribeInfo(RequestEvent evt, String id) { |
||||
|
this.id = id; |
||||
|
Request request = evt.getRequest(); |
||||
|
CallIdHeader callIdHeader = (CallIdHeader)request.getHeader(CallIdHeader.NAME); |
||||
|
this.callId = callIdHeader.getCallId(); |
||||
|
FromHeader fromHeader = (FromHeader)request.getHeader(FromHeader.NAME); |
||||
|
this.fromTag = fromHeader.getTag(); |
||||
|
ExpiresHeader expiresHeader = (ExpiresHeader)request.getHeader(ExpiresHeader.NAME); |
||||
|
this.expires = expiresHeader.getExpires(); |
||||
|
this.event = ((EventHeader)request.getHeader(EventHeader.NAME)).getName(); |
||||
|
} |
||||
|
|
||||
|
private String id; |
||||
|
private int expires; |
||||
|
private String callId; |
||||
|
private String event; |
||||
|
private String fromTag; |
||||
|
private String toTag; |
||||
|
|
||||
|
public String getId() { |
||||
|
return id; |
||||
|
} |
||||
|
|
||||
|
public int getExpires() { |
||||
|
return expires; |
||||
|
} |
||||
|
|
||||
|
public String getCallId() { |
||||
|
return callId; |
||||
|
} |
||||
|
|
||||
|
public String getFromTag() { |
||||
|
return fromTag; |
||||
|
} |
||||
|
|
||||
|
public void setToTag(String toTag) { |
||||
|
this.toTag = toTag; |
||||
|
} |
||||
|
|
||||
|
public String getToTag() { |
||||
|
return toTag; |
||||
|
} |
||||
|
|
||||
|
public void setId(String id) { |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
public void setExpires(int expires) { |
||||
|
this.expires = expires; |
||||
|
} |
||||
|
|
||||
|
public void setCallId(String callId) { |
||||
|
this.callId = callId; |
||||
|
} |
||||
|
|
||||
|
public void setFromTag(String fromTag) { |
||||
|
this.fromTag = fromTag; |
||||
|
} |
||||
|
|
||||
|
public String getEvent() { |
||||
|
return event; |
||||
|
} |
||||
|
|
||||
|
public void setEvent(String event) { |
||||
|
this.event = event; |
||||
|
} |
||||
|
} |
@ -0,0 +1,52 @@ |
|||||
|
package com.genersoft.iot.vmp.gb28181.event.subscribe; |
||||
|
|
||||
|
import com.genersoft.iot.vmp.common.VideoManagerConstants; |
||||
|
import com.genersoft.iot.vmp.conf.DynamicTask; |
||||
|
import com.genersoft.iot.vmp.conf.RedisKeyExpirationEventMessageListener; |
||||
|
import com.genersoft.iot.vmp.conf.UserSetup; |
||||
|
import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
||||
|
import org.checkerframework.checker.units.qual.A; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.data.redis.connection.Message; |
||||
|
import org.springframework.data.redis.listener.RedisMessageListenerContainer; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* 平台订阅到期事件 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class SubscribeListenerForPlatform extends RedisKeyExpirationEventMessageListener { |
||||
|
|
||||
|
private Logger logger = LoggerFactory.getLogger(SubscribeListenerForPlatform.class); |
||||
|
|
||||
|
@Autowired |
||||
|
private UserSetup userSetup; |
||||
|
|
||||
|
@Autowired |
||||
|
private DynamicTask dynamicTask; |
||||
|
|
||||
|
public SubscribeListenerForPlatform(RedisMessageListenerContainer listenerContainer, UserSetup userSetup) { |
||||
|
super(listenerContainer, userSetup); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 监听失效的key |
||||
|
* @param message |
||||
|
* @param pattern |
||||
|
*/ |
||||
|
@Override |
||||
|
public void onMessage(Message message, byte[] pattern) { |
||||
|
// 获取失效的key
|
||||
|
String expiredKey = message.toString(); |
||||
|
logger.debug(expiredKey); |
||||
|
// 订阅到期
|
||||
|
String PLATFORM_KEEPLIVEKEY_PREFIX = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_"; |
||||
|
if (expiredKey.startsWith(PLATFORM_KEEPLIVEKEY_PREFIX)) { |
||||
|
// 取消定时任务
|
||||
|
dynamicTask.stopCron(expiredKey); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,58 @@ |
|||||
|
package com.genersoft.iot.vmp.gb28181.event.subscribe.catalog; |
||||
|
|
||||
|
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
||||
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
||||
|
import org.springframework.context.ApplicationEvent; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public class CatalogEvent extends ApplicationEvent { |
||||
|
public CatalogEvent(Object source) { |
||||
|
super(source); |
||||
|
} |
||||
|
|
||||
|
public static final String ON = "ON"; // 上线
|
||||
|
public static final String OFF = "OFF"; // 离线
|
||||
|
public static final String VLOST = "VLOST"; // 视频丢失
|
||||
|
public static final String DEFECT = "DEFECT"; // 故障
|
||||
|
public static final String ADD = "ADD"; // 增加
|
||||
|
public static final String DEL = "DEL"; // 删除
|
||||
|
public static final String UPDATE = "UPDATE"; // 更新
|
||||
|
|
||||
|
private List<DeviceChannel> deviceChannels; |
||||
|
private List<GbStream> gbStreams; |
||||
|
private String type; |
||||
|
private String platformId; |
||||
|
|
||||
|
public List<DeviceChannel> getDeviceChannels() { |
||||
|
return deviceChannels; |
||||
|
} |
||||
|
|
||||
|
public void setDeviceChannels(List<DeviceChannel> deviceChannels) { |
||||
|
this.deviceChannels = deviceChannels; |
||||
|
} |
||||
|
|
||||
|
public String getType() { |
||||
|
return type; |
||||
|
} |
||||
|
|
||||
|
public void setType(String type) { |
||||
|
this.type = type; |
||||
|
} |
||||
|
|
||||
|
public String getPlatformId() { |
||||
|
return platformId; |
||||
|
} |
||||
|
|
||||
|
public void setPlatformId(String platformId) { |
||||
|
this.platformId = platformId; |
||||
|
} |
||||
|
|
||||
|
public List<GbStream> getGbStreams() { |
||||
|
return gbStreams; |
||||
|
} |
||||
|
|
||||
|
public void setGbStreams(List<GbStream> gbStreams) { |
||||
|
this.gbStreams = gbStreams; |
||||
|
} |
||||
|
} |
@ -0,0 +1,172 @@ |
|||||
|
package com.genersoft.iot.vmp.gb28181.event.subscribe.catalog; |
||||
|
|
||||
|
import com.genersoft.iot.vmp.common.VideoManagerConstants; |
||||
|
import com.genersoft.iot.vmp.conf.SipConfig; |
||||
|
import com.genersoft.iot.vmp.conf.UserSetup; |
||||
|
import com.genersoft.iot.vmp.gb28181.bean.*; |
||||
|
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
||||
|
import com.genersoft.iot.vmp.gb28181.event.platformNotRegister.PlatformNotRegisterEvent; |
||||
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; |
||||
|
import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; |
||||
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
||||
|
import com.genersoft.iot.vmp.service.IGbStreamService; |
||||
|
import com.genersoft.iot.vmp.service.IMediaServerService; |
||||
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
||||
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.context.ApplicationListener; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
import org.springframework.util.StringUtils; |
||||
|
|
||||
|
import java.util.*; |
||||
|
|
||||
|
/** |
||||
|
* catalog事件 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class CatalogEventLister implements ApplicationListener<CatalogEvent> { |
||||
|
|
||||
|
private final static Logger logger = LoggerFactory.getLogger(CatalogEventLister.class); |
||||
|
|
||||
|
@Autowired |
||||
|
private IVideoManagerStorager storager; |
||||
|
@Autowired |
||||
|
private IRedisCatchStorage redisCatchStorage; |
||||
|
@Autowired |
||||
|
private IMediaServerService mediaServerService; |
||||
|
|
||||
|
@Autowired |
||||
|
private SIPCommanderFroPlatform sipCommanderFroPlatform; |
||||
|
|
||||
|
@Autowired |
||||
|
private ZLMRTPServerFactory zlmrtpServerFactory; |
||||
|
|
||||
|
@Autowired |
||||
|
private SipConfig config; |
||||
|
|
||||
|
@Autowired |
||||
|
private UserSetup userSetup; |
||||
|
|
||||
|
@Autowired |
||||
|
private IGbStreamService gbStreamService; |
||||
|
|
||||
|
@Override |
||||
|
public void onApplicationEvent(CatalogEvent event) { |
||||
|
SubscribeInfo subscribe = null; |
||||
|
ParentPlatform parentPlatform = null; |
||||
|
|
||||
|
Map<String, List<ParentPlatform>> parentPlatformMap = new HashMap<>(); |
||||
|
if (event.getPlatformId() != null) { |
||||
|
parentPlatform = storager.queryParentPlatByServerGBId(event.getPlatformId()); |
||||
|
if (!parentPlatform.isStatus())return; |
||||
|
String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + event.getPlatformId(); |
||||
|
subscribe = redisCatchStorage.getSubscribe(key); |
||||
|
if (subscribe == null) return; |
||||
|
}else { |
||||
|
// 获取所用订阅
|
||||
|
List<String> platforms = redisCatchStorage.getAllSubscribePlatform(); |
||||
|
if (event.getDeviceChannels() != null) { |
||||
|
if (platforms.size() > 0) { |
||||
|
for (DeviceChannel deviceChannel : event.getDeviceChannels()) { |
||||
|
List<ParentPlatform> parentPlatformsForGB = storager.queryPlatFormListForGBWithGBId(deviceChannel.getChannelId(), platforms); |
||||
|
parentPlatformMap.put(deviceChannel.getChannelId(), parentPlatformsForGB); |
||||
|
} |
||||
|
} |
||||
|
}else if (event.getGbStreams() != null) { |
||||
|
if (platforms.size() > 0) { |
||||
|
for (GbStream gbStream : event.getGbStreams()) { |
||||
|
if (gbStream == null || StringUtils.isEmpty(gbStream.getGbId())) continue; |
||||
|
List<ParentPlatform> parentPlatformsForGB = storager.queryPlatFormListForStreamWithGBId(gbStream.getApp(),gbStream.getStream(), platforms); |
||||
|
parentPlatformMap.put(gbStream.getGbId(), parentPlatformsForGB); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
switch (event.getType()) { |
||||
|
case CatalogEvent.ON: |
||||
|
case CatalogEvent.OFF: |
||||
|
case CatalogEvent.DEL: |
||||
|
|
||||
|
if (parentPlatform != null || subscribe != null) { |
||||
|
List<DeviceChannel> deviceChannelList = new ArrayList<>(); |
||||
|
if (event.getDeviceChannels() != null) { |
||||
|
deviceChannelList.addAll(event.getDeviceChannels()); |
||||
|
} |
||||
|
if (event.getGbStreams() != null && event.getGbStreams().size() > 0){ |
||||
|
for (GbStream gbStream : event.getGbStreams()) { |
||||
|
DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform.getDeviceGBId()); |
||||
|
deviceChannelList.add(deviceChannelByStream); |
||||
|
} |
||||
|
} |
||||
|
if (deviceChannelList.size() > 0) { |
||||
|
logger.info("[Catalog事件: {}]平台:{},影响通道{}个", event.getType(), event.getPlatformId(), deviceChannelList.size()); |
||||
|
sipCommanderFroPlatform.sendNotifyForCatalogOther(event.getType(), parentPlatform, deviceChannelList, subscribe); |
||||
|
} |
||||
|
}else if (parentPlatformMap.keySet().size() > 0) { |
||||
|
for (String gbId : parentPlatformMap.keySet()) { |
||||
|
List<ParentPlatform> parentPlatforms = parentPlatformMap.get(gbId); |
||||
|
if (parentPlatforms != null && parentPlatforms.size() > 0) { |
||||
|
for (ParentPlatform platform : parentPlatforms) { |
||||
|
String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + platform.getServerGBId(); |
||||
|
SubscribeInfo subscribeInfo = redisCatchStorage.getSubscribe(key); |
||||
|
if (subscribeInfo == null) continue; |
||||
|
logger.info("[Catalog事件: {}]平台:{},影响通道{}", event.getType(), platform.getServerGBId(), gbId); |
||||
|
List<DeviceChannel> deviceChannelList = new ArrayList<>(); |
||||
|
DeviceChannel deviceChannel = new DeviceChannel(); |
||||
|
deviceChannel.setChannelId(gbId); |
||||
|
deviceChannelList.add(deviceChannel); |
||||
|
sipCommanderFroPlatform.sendNotifyForCatalogOther(event.getType(), platform, deviceChannelList, subscribeInfo); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
break; |
||||
|
case CatalogEvent.VLOST: |
||||
|
break; |
||||
|
case CatalogEvent.DEFECT: |
||||
|
break; |
||||
|
case CatalogEvent.ADD: |
||||
|
case CatalogEvent.UPDATE: |
||||
|
if (parentPlatform != null || subscribe != null) { |
||||
|
List<DeviceChannel> deviceChannelList = new ArrayList<>(); |
||||
|
if (event.getDeviceChannels() != null) { |
||||
|
deviceChannelList.addAll(event.getDeviceChannels()); |
||||
|
} |
||||
|
if (event.getGbStreams() != null && event.getGbStreams().size() > 0){ |
||||
|
for (GbStream gbStream : event.getGbStreams()) { |
||||
|
DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform.getDeviceGBId()); |
||||
|
deviceChannelList.add(deviceChannelByStream); |
||||
|
} |
||||
|
} |
||||
|
if (deviceChannelList.size() > 0) { |
||||
|
logger.info("[Catalog事件: {}]平台:{},影响通道{}个", event.getType(), event.getPlatformId(), deviceChannelList.size()); |
||||
|
sipCommanderFroPlatform.sendNotifyForCatalogAddOrUpdate(event.getType(), parentPlatform, deviceChannelList, subscribe); |
||||
|
} |
||||
|
}else if (parentPlatformMap.keySet().size() > 0) { |
||||
|
for (String gbId : parentPlatformMap.keySet()) { |
||||
|
List<ParentPlatform> parentPlatforms = parentPlatformMap.get(gbId); |
||||
|
if (parentPlatforms != null && parentPlatforms.size() > 0) { |
||||
|
for (ParentPlatform platform : parentPlatforms) { |
||||
|
String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + platform.getServerGBId(); |
||||
|
SubscribeInfo subscribeInfo = redisCatchStorage.getSubscribe(key); |
||||
|
if (subscribeInfo == null) continue; |
||||
|
logger.info("[Catalog事件: {}]平台:{},影响通道{}", event.getType(), platform.getServerGBId(), gbId); |
||||
|
List<DeviceChannel> deviceChannelList = new ArrayList<>(); |
||||
|
DeviceChannel deviceChannel = storager.queryChannelInParentPlatform(platform.getServerGBId(), gbId); |
||||
|
deviceChannelList.add(deviceChannel); |
||||
|
GbStream gbStream = storager.queryStreamInParentPlatform(platform.getServerGBId(), gbId); |
||||
|
DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), platform.getDeviceGBId()); |
||||
|
deviceChannelList.add(deviceChannelByStream); |
||||
|
sipCommanderFroPlatform.sendNotifyForCatalogOther(event.getType(), platform, deviceChannelList, subscribeInfo); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
break; |
||||
|
default: |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,70 @@ |
|||||
|
package com.genersoft.iot.vmp.gb28181.task; |
||||
|
|
||||
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
||||
|
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
||||
|
import com.genersoft.iot.vmp.gb28181.bean.SubscribeInfo; |
||||
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
||||
|
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
||||
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
||||
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
||||
|
|
||||
|
import java.text.SimpleDateFormat; |
||||
|
import java.util.List; |
||||
|
|
||||
|
public class GPSSubscribeTask implements Runnable{ |
||||
|
|
||||
|
private IRedisCatchStorage redisCatchStorage; |
||||
|
private IVideoManagerStorager storager; |
||||
|
private ISIPCommanderForPlatform sipCommanderForPlatform; |
||||
|
private String platformId; |
||||
|
private String sn; |
||||
|
private String key; |
||||
|
|
||||
|
private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
||||
|
|
||||
|
public GPSSubscribeTask(IRedisCatchStorage redisCatchStorage, ISIPCommanderForPlatform sipCommanderForPlatform, IVideoManagerStorager storager, String platformId, String sn, String key) { |
||||
|
this.redisCatchStorage = redisCatchStorage; |
||||
|
this.storager = storager; |
||||
|
this.platformId = platformId; |
||||
|
this.sn = sn; |
||||
|
this.key = key; |
||||
|
this.sipCommanderForPlatform = sipCommanderForPlatform; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void run() { |
||||
|
|
||||
|
SubscribeInfo subscribe = redisCatchStorage.getSubscribe(key); |
||||
|
if (subscribe != null) { |
||||
|
System.out.println("发送GPS消息"); |
||||
|
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId); |
||||
|
if (parentPlatform == null || parentPlatform.isStatus()) { |
||||
|
// TODO 暂时只处理视频流的回复,后续增加对国标设备的支持
|
||||
|
List<GbStream> gbStreams = storager.queryGbStreamListInPlatform(platformId); |
||||
|
if (gbStreams.size() > 0) { |
||||
|
for (GbStream gbStream : gbStreams) { |
||||
|
String gbId = gbStream.getGbId(); |
||||
|
GPSMsgInfo gpsMsgInfo = redisCatchStorage.getGpsMsgInfo(gbId); |
||||
|
if (gbStream.isStatus()) { |
||||
|
if (gpsMsgInfo != null) { |
||||
|
// 发送GPS消息
|
||||
|
sipCommanderForPlatform.sendNotifyMobilePosition(parentPlatform, gpsMsgInfo, subscribe); |
||||
|
}else { |
||||
|
// 没有在redis找到新的消息就使用数据库的消息
|
||||
|
gpsMsgInfo = new GPSMsgInfo(); |
||||
|
gpsMsgInfo.setId(gbId); |
||||
|
gpsMsgInfo.setLat(gbStream.getLongitude()); |
||||
|
gpsMsgInfo.setLng(gbStream.getLongitude()); |
||||
|
// 发送GPS消息
|
||||
|
sipCommanderForPlatform.sendNotifyMobilePosition(parentPlatform, gpsMsgInfo, subscribe); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,39 @@ |
|||||
|
package com.genersoft.iot.vmp.service; |
||||
|
|
||||
|
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
||||
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
||||
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.scheduling.annotation.Scheduled; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 定时查找redis中的GPS推送消息,并保存到对应的流中 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class StreamGPSSubscribeTask { |
||||
|
|
||||
|
@Autowired |
||||
|
private IRedisCatchStorage redisCatchStorage; |
||||
|
|
||||
|
@Autowired |
||||
|
private IVideoManagerStorager storager; |
||||
|
|
||||
|
|
||||
|
|
||||
|
@Scheduled(fixedRate = 30 * 1000) //每30秒执行一次
|
||||
|
public void execute(){ |
||||
|
List<GPSMsgInfo> gpsMsgInfo = redisCatchStorage.getAllGpsMsgInfo(); |
||||
|
if (gpsMsgInfo.size() > 0) { |
||||
|
storager.updateStreamGPS(gpsMsgInfo); |
||||
|
for (GPSMsgInfo msgInfo : gpsMsgInfo) { |
||||
|
msgInfo.setStored(true); |
||||
|
redisCatchStorage.updateGpsMsgInfo(msgInfo); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,106 @@ |
|||||
|
package com.genersoft.iot.vmp.service.bean; |
||||
|
|
||||
|
public class GPSMsgInfo { |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 经度 (必选) |
||||
|
*/ |
||||
|
private double lng; |
||||
|
|
||||
|
/** |
||||
|
* 纬度 (必选) |
||||
|
*/ |
||||
|
private double lat; |
||||
|
|
||||
|
/** |
||||
|
* 速度,单位:km/h (可选) |
||||
|
*/ |
||||
|
private double speed; |
||||
|
|
||||
|
/** |
||||
|
* 产生通知时间, 时间格式: 2020-01-14T14:32:12 |
||||
|
*/ |
||||
|
private String time; |
||||
|
|
||||
|
/** |
||||
|
* 方向,取值为当前摄像头方向与正北方的顺时针夹角,取值范围0°~360°,单位:(°)(可选) |
||||
|
*/ |
||||
|
private String direction; |
||||
|
|
||||
|
/** |
||||
|
* 海拔高度,单位:m(可选) |
||||
|
*/ |
||||
|
private String altitude; |
||||
|
|
||||
|
private boolean stored; |
||||
|
|
||||
|
|
||||
|
public String getId() { |
||||
|
return id; |
||||
|
} |
||||
|
|
||||
|
public void setId(String id) { |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
public double getLng() { |
||||
|
return lng; |
||||
|
} |
||||
|
|
||||
|
public void setLng(double lng) { |
||||
|
this.lng = lng; |
||||
|
} |
||||
|
|
||||
|
public double getLat() { |
||||
|
return lat; |
||||
|
} |
||||
|
|
||||
|
public void setLat(double lat) { |
||||
|
this.lat = lat; |
||||
|
} |
||||
|
|
||||
|
public double getSpeed() { |
||||
|
return speed; |
||||
|
} |
||||
|
|
||||
|
public void setSpeed(double speed) { |
||||
|
this.speed = speed; |
||||
|
} |
||||
|
|
||||
|
public String getTime() { |
||||
|
return time; |
||||
|
} |
||||
|
|
||||
|
public void setTime(String time) { |
||||
|
this.time = time; |
||||
|
} |
||||
|
|
||||
|
public String getDirection() { |
||||
|
return direction; |
||||
|
} |
||||
|
|
||||
|
public void setDirection(String direction) { |
||||
|
this.direction = direction; |
||||
|
} |
||||
|
|
||||
|
public String getAltitude() { |
||||
|
return altitude; |
||||
|
} |
||||
|
|
||||
|
public void setAltitude(String altitude) { |
||||
|
this.altitude = altitude; |
||||
|
} |
||||
|
|
||||
|
public boolean isStored() { |
||||
|
return stored; |
||||
|
} |
||||
|
|
||||
|
public void setStored(boolean stored) { |
||||
|
this.stored = stored; |
||||
|
} |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
package com.genersoft.iot.vmp.service.impl; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSON; |
||||
|
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
||||
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.data.redis.connection.Message; |
||||
|
import org.springframework.data.redis.connection.MessageListener; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
@Component |
||||
|
public class RedisGPSMsgListener implements MessageListener { |
||||
|
|
||||
|
@Autowired |
||||
|
private IRedisCatchStorage redisCatchStorage; |
||||
|
|
||||
|
@Override |
||||
|
public void onMessage(Message message, byte[] bytes) { |
||||
|
GPSMsgInfo gpsMsgInfo = JSON.parseObject(message.getBody(), GPSMsgInfo.class); |
||||
|
redisCatchStorage.updateGpsMsgInfo(gpsMsgInfo); |
||||
|
} |
||||
|
} |
@ -0,0 +1,85 @@ |
|||||
|
package com.genersoft.iot.vmp.service.impl; |
||||
|
|
||||
|
import com.alibaba.excel.context.AnalysisContext; |
||||
|
import com.alibaba.excel.event.AnalysisEventListener; |
||||
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
||||
|
import com.genersoft.iot.vmp.service.IStreamPushService; |
||||
|
import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto; |
||||
|
import org.springframework.util.StringUtils; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.HashSet; |
||||
|
import java.util.List; |
||||
|
import java.util.Set; |
||||
|
|
||||
|
public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPushExcelDto> { |
||||
|
|
||||
|
private ErrorDataHandler errorDataHandler; |
||||
|
private IStreamPushService pushService; |
||||
|
private String defaultMediaServerId; |
||||
|
private List<StreamPushItem> streamPushItems = new ArrayList<>(); |
||||
|
private Set<String> streamPushStreamSet = new HashSet<>(); |
||||
|
private Set<String> streamPushGBSet = new HashSet<>(); |
||||
|
private List<String> errorStreamList = new ArrayList<>(); |
||||
|
private List<String> errorGBList = new ArrayList<>(); |
||||
|
|
||||
|
public StreamPushUploadFileHandler(IStreamPushService pushService, String defaultMediaServerId, ErrorDataHandler errorDataHandler) { |
||||
|
this.pushService = pushService; |
||||
|
this.defaultMediaServerId = defaultMediaServerId; |
||||
|
this.errorDataHandler = errorDataHandler; |
||||
|
} |
||||
|
|
||||
|
public interface ErrorDataHandler{ |
||||
|
void handle(List<String> streams, List<String> gbId); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void invoke(StreamPushExcelDto streamPushExcelDto, AnalysisContext analysisContext) { |
||||
|
if (StringUtils.isEmpty(streamPushExcelDto.getApp()) |
||||
|
|| StringUtils.isEmpty(streamPushExcelDto.getStream()) |
||||
|
|| StringUtils.isEmpty(streamPushExcelDto.getGbId())) { |
||||
|
return; |
||||
|
} |
||||
|
if (streamPushGBSet.contains(streamPushExcelDto.getGbId())) { |
||||
|
errorGBList.add(streamPushExcelDto.getGbId()); |
||||
|
} |
||||
|
if (streamPushStreamSet.contains(streamPushExcelDto.getApp() + streamPushExcelDto.getStream())) { |
||||
|
errorStreamList.add(streamPushExcelDto.getApp() + "/" + streamPushExcelDto.getStream()); |
||||
|
} |
||||
|
if (streamPushGBSet.contains(streamPushExcelDto.getGbId()) || streamPushStreamSet.contains(streamPushExcelDto.getApp() + streamPushExcelDto.getStream())) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
StreamPushItem streamPushItem = new StreamPushItem(); |
||||
|
streamPushItem.setApp(streamPushExcelDto.getApp()); |
||||
|
streamPushItem.setStream(streamPushExcelDto.getStream()); |
||||
|
streamPushItem.setGbId(streamPushExcelDto.getGbId()); |
||||
|
streamPushItem.setStatus(false); |
||||
|
streamPushItem.setStreamType("push"); |
||||
|
streamPushItem.setCreateStamp(System.currentTimeMillis()/1000); |
||||
|
streamPushItem.setMediaServerId(defaultMediaServerId); |
||||
|
streamPushItem.setName(streamPushExcelDto.getName()); |
||||
|
streamPushItem.setOriginType(2); |
||||
|
streamPushItem.setOriginTypeStr("rtsp_push"); |
||||
|
streamPushItem.setTotalReaderCount("0"); |
||||
|
streamPushItems.add(streamPushItem); |
||||
|
streamPushGBSet.add(streamPushExcelDto.getGbId()); |
||||
|
streamPushStreamSet.add(streamPushExcelDto.getApp()+streamPushExcelDto.getStream()); |
||||
|
if (streamPushItems.size() > 300) { |
||||
|
pushService.batchAdd(streamPushItems); |
||||
|
// 存储完成清理 list
|
||||
|
streamPushItems.clear(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
||||
|
// 这里也要保存数据,确保最后遗留的数据也存储到数据库
|
||||
|
if (streamPushItems.size() > 0) { |
||||
|
pushService.batchAdd(streamPushItems); |
||||
|
} |
||||
|
streamPushGBSet.clear(); |
||||
|
streamPushStreamSet.clear(); |
||||
|
errorDataHandler.handle(errorStreamList, errorGBList); |
||||
|
} |
||||
|
} |
@ -0,0 +1,44 @@ |
|||||
|
package com.genersoft.iot.vmp.storager.dao; |
||||
|
|
||||
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
||||
|
import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog; |
||||
|
import com.genersoft.iot.vmp.gb28181.bean.PlatformGbStream; |
||||
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
||||
|
import org.apache.ibatis.annotations.*; |
||||
|
import org.springframework.stereotype.Repository; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
@Mapper |
||||
|
@Repository |
||||
|
public interface PlatformCatalogMapper { |
||||
|
|
||||
|
@Insert("INSERT INTO platform_catalog (id, name, platformId, parentId) VALUES" + |
||||
|
"(#{id}, #{name}, #{platformId}, #{parentId})") |
||||
|
int add(PlatformCatalog platformCatalog); |
||||
|
|
||||
|
@Delete("DELETE FROM platform_catalog WHERE id=#{id}") |
||||
|
int del(String id); |
||||
|
|
||||
|
@Delete("DELETE FROM platform_catalog WHERE platformId=#{platformId}") |
||||
|
int delByPlatformId(String platformId); |
||||
|
|
||||
|
@Select("SELECT pc.*, count(pc2.id) as childrenCount FROM platform_catalog pc " + |
||||
|
"left join platform_catalog pc2 on pc.id = pc2.parentId " + |
||||
|
"WHERE pc.parentId=#{parentId} AND pc.platformId=#{platformId} group by pc.id") |
||||
|
List<PlatformCatalog> selectByParentId(String platformId, String parentId); |
||||
|
|
||||
|
@Select("SELECT *, (SELECT COUNT(1) from platform_catalog where parentId = pc.id) as childrenCount FROM platform_catalog pc WHERE pc.id=#{id}") |
||||
|
PlatformCatalog select(String id); |
||||
|
|
||||
|
@Update(value = {" <script>" + |
||||
|
"UPDATE platform_catalog " + |
||||
|
"SET name=#{name}" + |
||||
|
"WHERE id=#{id}"+ |
||||
|
"</script>"}) |
||||
|
int update(PlatformCatalog platformCatalog); |
||||
|
|
||||
|
@Select("SELECT *, (SELECT COUNT(1) from platform_catalog where parentId = pc.id) as childrenCount FROM platform_catalog pc WHERE pc.platformId=#{platformId}") |
||||
|
List<PlatformCatalog> selectByPlatForm(String platformId); |
||||
|
} |
@ -0,0 +1,50 @@ |
|||||
|
package com.genersoft.iot.vmp.vmanager.bean; |
||||
|
|
||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||
|
|
||||
|
public class StreamPushExcelDto { |
||||
|
|
||||
|
@ExcelProperty("名称") |
||||
|
private String name; |
||||
|
|
||||
|
@ExcelProperty("应用名") |
||||
|
private String app; |
||||
|
|
||||
|
@ExcelProperty("流ID") |
||||
|
private String stream; |
||||
|
|
||||
|
@ExcelProperty("国标ID") |
||||
|
private String gbId; |
||||
|
|
||||
|
public String getName() { |
||||
|
return name; |
||||
|
} |
||||
|
|
||||
|
public void setName(String name) { |
||||
|
this.name = name; |
||||
|
} |
||||
|
|
||||
|
public String getApp() { |
||||
|
return app; |
||||
|
} |
||||
|
|
||||
|
public void setApp(String app) { |
||||
|
this.app = app; |
||||
|
} |
||||
|
|
||||
|
public String getStream() { |
||||
|
return stream; |
||||
|
} |
||||
|
|
||||
|
public void setStream(String stream) { |
||||
|
this.stream = stream; |
||||
|
} |
||||
|
|
||||
|
public String getGbId() { |
||||
|
return gbId; |
||||
|
} |
||||
|
|
||||
|
public void setGbId(String gbId) { |
||||
|
this.gbId = gbId; |
||||
|
} |
||||
|
} |
@ -1,44 +0,0 @@ |
|||||
package com.genersoft.iot.vmp.vmanager.gb28181.platformGbStream; |
|
||||
|
|
||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
|
||||
import com.genersoft.iot.vmp.service.IGbStreamService; |
|
||||
import com.github.pagehelper.PageInfo; |
|
||||
import io.swagger.annotations.Api; |
|
||||
import io.swagger.annotations.ApiImplicitParam; |
|
||||
import io.swagger.annotations.ApiImplicitParams; |
|
||||
import io.swagger.annotations.ApiOperation; |
|
||||
import org.slf4j.Logger; |
|
||||
import org.slf4j.LoggerFactory; |
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||
import org.springframework.web.bind.annotation.*; |
|
||||
|
|
||||
@Api(tags = "级联平台关联视频流") |
|
||||
@CrossOrigin |
|
||||
@RestController |
|
||||
@RequestMapping("/api/platform_gb_stream") |
|
||||
public class PlatformGbStreamController { |
|
||||
|
|
||||
private final static Logger logger = LoggerFactory.getLogger(PlatformGbStreamController.class); |
|
||||
|
|
||||
@Autowired |
|
||||
private IGbStreamService gbStreamService; |
|
||||
|
|
||||
@Autowired |
|
||||
private IVideoManagerStorager storager; |
|
||||
|
|
||||
@ApiOperation("分页查询级联平台关联的视频流") |
|
||||
@ApiImplicitParams({ |
|
||||
@ApiImplicitParam(name = "page", value = "当前页", dataTypeClass = Integer.class), |
|
||||
@ApiImplicitParam(name = "count", value = "每页条数", dataTypeClass = Integer.class), |
|
||||
}) |
|
||||
@GetMapping(value = "/list") |
|
||||
@ResponseBody |
|
||||
public PageInfo<GbStream> list(@RequestParam(required = false)Integer page, |
|
||||
@RequestParam(required = false)Integer count){ |
|
||||
|
|
||||
return gbStreamService.getAll(page, count); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
} |
|
Binary file not shown.
File diff suppressed because it is too large
@ -0,0 +1,101 @@ |
|||||
|
<template> |
||||
|
<div id="catalogEdit" v-loading="isLoging"> |
||||
|
<el-dialog |
||||
|
title="节点编辑" |
||||
|
width="40%" |
||||
|
top="2rem" |
||||
|
:append-to-body="true" |
||||
|
:close-on-click-modal="false" |
||||
|
:visible.sync="showDialog" |
||||
|
:destroy-on-close="true" |
||||
|
@close="close()" |
||||
|
> |
||||
|
<div id="shared" style="margin-top: 1rem;margin-right: 100px;"> |
||||
|
<el-form ref="form" :rules="rules" :model="form" label-width="140px" > |
||||
|
<el-form-item label="节点编号" prop="id" > |
||||
|
<el-input v-model="form.id" :disabled="isEdit"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="节点名称" prop="name"> |
||||
|
<el-input v-model="form.name" clearable></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item> |
||||
|
<div style="float: right;"> |
||||
|
<el-button type="primary" @click="onSubmit" >确认</el-button> |
||||
|
<el-button @click="close">取消</el-button> |
||||
|
</div> |
||||
|
|
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
</div> |
||||
|
</el-dialog> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
|
||||
|
export default { |
||||
|
name: "catalogEdit", |
||||
|
computed: {}, |
||||
|
props: ['platformId'], |
||||
|
created() {}, |
||||
|
data() { |
||||
|
return { |
||||
|
submitCallback: null, |
||||
|
showDialog: false, |
||||
|
isLoging: false, |
||||
|
isEdit: false, |
||||
|
form: { |
||||
|
id: null, |
||||
|
name: null, |
||||
|
platformId: null, |
||||
|
parentId: null, |
||||
|
}, |
||||
|
rules: { |
||||
|
name: [{ required: true, message: "请输入名称", trigger: "blur" }], |
||||
|
id: [{ required: true, message: "请输入id", trigger: "blur" }] |
||||
|
}, |
||||
|
}; |
||||
|
}, |
||||
|
methods: { |
||||
|
openDialog: function (isEdit, id, name, parentId, callback) { |
||||
|
console.log("parentId: " + parentId) |
||||
|
this.isEdit = isEdit; |
||||
|
this.form.id = id; |
||||
|
this.form.name = name; |
||||
|
this.form.platformId = this.platformId; |
||||
|
this.form.parentId = parentId; |
||||
|
this.showDialog = true; |
||||
|
this.submitCallback = callback; |
||||
|
}, |
||||
|
onSubmit: function () { |
||||
|
console.log("onSubmit"); |
||||
|
console.log(this.form); |
||||
|
this.$axios({ |
||||
|
method:"post", |
||||
|
url:`/api/platform/catalog/${!this.isEdit? "add":"edit"}`, |
||||
|
data: this.form |
||||
|
}) |
||||
|
.then((res)=> { |
||||
|
if (res.data.code === 0) { |
||||
|
console.log("添加/修改成功") |
||||
|
if (this.submitCallback)this.submitCallback() |
||||
|
}else { |
||||
|
this.$message({ |
||||
|
showClose: true, |
||||
|
message: res.data.msg, |
||||
|
type: "error", |
||||
|
}); |
||||
|
} |
||||
|
this.close(); |
||||
|
}) |
||||
|
.catch((error)=> { |
||||
|
console.log(error); |
||||
|
}); |
||||
|
}, |
||||
|
close: function () { |
||||
|
this.showDialog = false; |
||||
|
this.$refs.form.resetFields(); |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
@ -0,0 +1,309 @@ |
|||||
|
<template> |
||||
|
<div id="chooseChannelForCatalog" > |
||||
|
<div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;font-size: 14px;"> |
||||
|
<el-tree class="el-scrollbar" |
||||
|
ref="tree" |
||||
|
id="catalogTree" |
||||
|
empty-text="未知节点" |
||||
|
node-key="id" |
||||
|
default-expand-all |
||||
|
:highlight-current="true" |
||||
|
:expand-on-click-node="false" |
||||
|
:props="props" |
||||
|
:load="loadNode" |
||||
|
@node-contextmenu="contextmenuEventHandler" |
||||
|
lazy> |
||||
|
<span class="custom-tree-node" slot-scope="{ node, data }" style="width: 100%"> |
||||
|
<el-radio v-if="node.data.type === 0" style="margin-right: 0" v-model="chooseId" :label="node.data.id">{{''}}</el-radio> |
||||
|
<span v-if="node.data.type === 0 && node.level === 1" class="el-icon-s-home"></span> |
||||
|
<span v-if="node.data.type === 0 && node.level > 1" class="el-icon-folder-opened"></span> |
||||
|
<span v-if="node.data.type === 1" class="iconfont icon-shexiangtou"></span> |
||||
|
<span v-if="node.data.type === 2" class="iconfont icon-zhibo"></span> |
||||
|
<span style="padding-left: 1px">{{ node.label }}</span> |
||||
|
<span> |
||||
|
<i style="margin-left: 5rem; color: #9d9d9d; padding-right: 20px" v-if="node.data.id === defaultCatalogId">默认</i> |
||||
|
</span> |
||||
|
</span> |
||||
|
</el-tree> |
||||
|
</div> |
||||
|
<catalogEdit ref="catalogEdit" :platformId="platformId"></catalogEdit> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
|
||||
|
<script> |
||||
|
|
||||
|
import catalogEdit from './catalogEdit.vue' |
||||
|
export default { |
||||
|
name: 'chooseChannelForCatalog', |
||||
|
props: ['platformId', 'platformName', 'defaultCatalogId', 'catalogIdChange'], |
||||
|
created() { |
||||
|
this.initData(); |
||||
|
setTimeout(()=>{ |
||||
|
if (this.catalogIdChange)this.catalogIdChange(this.defaultCatalogId); |
||||
|
}, 100) |
||||
|
|
||||
|
}, |
||||
|
components: { |
||||
|
catalogEdit, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
props: { |
||||
|
label: 'name', |
||||
|
children: 'children', |
||||
|
isLeaf: 'leaf' |
||||
|
}, |
||||
|
chooseNode: null, |
||||
|
chooseId: this.defaultCatalogId, |
||||
|
catalogTree: null, |
||||
|
contextmenuShow: false |
||||
|
|
||||
|
}; |
||||
|
}, |
||||
|
watch:{ |
||||
|
platformId(newData, oldData){ |
||||
|
console.log(newData) |
||||
|
this.initData() |
||||
|
}, |
||||
|
chooseId(newData, oldData){ |
||||
|
console.log("发送: " + newData) |
||||
|
if (this.catalogIdChange)this.catalogIdChange(newData); |
||||
|
}, |
||||
|
}, |
||||
|
methods: { |
||||
|
initData: function () { |
||||
|
this.getCatalog(); |
||||
|
}, |
||||
|
|
||||
|
getCatalog: function(parentId, callback) { |
||||
|
let that = this; |
||||
|
this.$axios({ |
||||
|
method:"get", |
||||
|
url:`/api/platform/catalog`, |
||||
|
params: { |
||||
|
platformId: that.platformId, |
||||
|
parentId: parentId |
||||
|
} |
||||
|
}) |
||||
|
.then((res)=> { |
||||
|
if (res.data.code === 0) { |
||||
|
if (typeof(callback) === 'function') { |
||||
|
callback(res.data.data) |
||||
|
} |
||||
|
// |
||||
|
|
||||
|
// if (typeof (this.$refs.tree.setCurrentKey) == "undefined") { |
||||
|
// this.$refs.tree.setCurrentKey(this.defaultCatalogId) |
||||
|
// let data = this.$refs.tree.getCurrentNode() |
||||
|
// if (data != null && data.id === this.defaultCatalogId) { |
||||
|
// this.currentCatalogChange(data, this.$refs.tree.getNode(data.id)) |
||||
|
// } |
||||
|
// } |
||||
|
|
||||
|
} |
||||
|
}) |
||||
|
.catch(function (error) { |
||||
|
console.log(error); |
||||
|
}); |
||||
|
|
||||
|
}, |
||||
|
addCatalog: function (parentId, node){ |
||||
|
let that = this; |
||||
|
// 打开添加弹窗 |
||||
|
that.$refs.catalogEdit.openDialog(false, null, null, parentId, ()=>{ |
||||
|
node.loaded = false |
||||
|
node.expand(); |
||||
|
}); |
||||
|
|
||||
|
}, |
||||
|
refreshCatalog: function (node){ |
||||
|
node.loaded = false |
||||
|
node.expand(); |
||||
|
}, |
||||
|
refreshCatalogById: function (id) { |
||||
|
if (id) { |
||||
|
let node = this.$refs.tree.getNode(id); |
||||
|
this.refreshCatalog(node); |
||||
|
} |
||||
|
// if (nodeIds !== null) { |
||||
|
// let refreshNode = {} |
||||
|
// for (let i = 0; i < nodeIds.length; i++) { |
||||
|
// let node = this.$refs.tree.getNode(nodeIds[i]); |
||||
|
// refreshNode[node.parent.data.id] = node.parent |
||||
|
// } |
||||
|
// if (Object.values(refreshNode).length > 0) { |
||||
|
// for (let j = 0; j < Object.values(refreshNode).length; j++) { |
||||
|
// this.refreshCatalog(Object.values(refreshNode)[j]); |
||||
|
// } |
||||
|
// } |
||||
|
// } |
||||
|
}, |
||||
|
editCatalog: function (data, node){ |
||||
|
let that = this; |
||||
|
// 打开添加弹窗 |
||||
|
that.$refs.catalogEdit.openDialog(true, data.id, data.name, data.parentId, (data)=>{ |
||||
|
node.parent.loaded = false |
||||
|
node.parent.expand(); |
||||
|
}); |
||||
|
|
||||
|
}, |
||||
|
removeCatalog: function (id, node){ |
||||
|
this.$axios({ |
||||
|
method:"delete", |
||||
|
url:`/api/platform/catalog/del`, |
||||
|
params: { |
||||
|
id: id, |
||||
|
} |
||||
|
}) |
||||
|
.then((res) => { |
||||
|
if (res.data.code === 0) { |
||||
|
console.log("移除成功") |
||||
|
node.parent.loaded = false |
||||
|
node.parent.expand(); |
||||
|
} |
||||
|
}) |
||||
|
.catch(function (error) { |
||||
|
console.log(error); |
||||
|
}); |
||||
|
}, |
||||
|
setDefaultCatalog: function (id){ |
||||
|
this.$axios({ |
||||
|
method:"post", |
||||
|
url:`/api/platform/catalog/default/update`, |
||||
|
params: { |
||||
|
platformId: this.platformId, |
||||
|
catalogId: id, |
||||
|
} |
||||
|
}) |
||||
|
.then((res)=> { |
||||
|
if (res.data.code === 0) { |
||||
|
this.defaultCatalogId = id; |
||||
|
} |
||||
|
}) |
||||
|
.catch(function (error) { |
||||
|
console.log(error); |
||||
|
}); |
||||
|
}, |
||||
|
loadNode: function(node, resolve){ |
||||
|
if (node.level === 0) { |
||||
|
resolve([{ |
||||
|
name: this.platformName, |
||||
|
id: this.platformId, |
||||
|
type: 0 |
||||
|
}]); |
||||
|
} |
||||
|
if (node.level >= 1){ |
||||
|
this.getCatalog(node.data.id, resolve) |
||||
|
} |
||||
|
}, |
||||
|
contextmenuEventHandler: function (event,data,node,element){ |
||||
|
if (node.data.type !== 0) { |
||||
|
data.parentId = node.parent.data.id; |
||||
|
this.$contextmenu({ |
||||
|
items: [ |
||||
|
{ |
||||
|
label: "移除通道", |
||||
|
icon: "el-icon-delete", |
||||
|
disabled: false, |
||||
|
onClick: () => { |
||||
|
this.$axios({ |
||||
|
method:"delete", |
||||
|
url:"/api/platform/catalog/relation/del", |
||||
|
data: data |
||||
|
}).then((res)=>{ |
||||
|
console.log("移除成功") |
||||
|
node.parent.loaded = false |
||||
|
node.parent.expand(); |
||||
|
}).catch(function (error) { |
||||
|
console.log(error); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
], |
||||
|
event, // 鼠标事件信息 |
||||
|
customClass: "custom-class", // 自定义菜单 class |
||||
|
zIndex: 3000, // 菜单样式 z-index |
||||
|
}); |
||||
|
}else { |
||||
|
this.$contextmenu({ |
||||
|
items: [ |
||||
|
{ |
||||
|
label: "刷新节点", |
||||
|
icon: "el-icon-refresh", |
||||
|
disabled: false, |
||||
|
onClick: () => { |
||||
|
this.refreshCatalog(node); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: "新建节点", |
||||
|
icon: "el-icon-plus", |
||||
|
disabled: false, |
||||
|
onClick: () => { |
||||
|
this.addCatalog(data.id, node); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: "修改节点", |
||||
|
icon: "el-icon-edit", |
||||
|
disabled: node.level === 1, |
||||
|
onClick: () => { |
||||
|
this.editCatalog(data, node); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: "删除节点", |
||||
|
icon: "el-icon-delete", |
||||
|
disabled: node.level === 1, |
||||
|
divided: true, |
||||
|
onClick: () => { |
||||
|
this.removeCatalog(data.id, node) |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: "设为默认", |
||||
|
icon: "el-icon-folder-checked", |
||||
|
disabled: node.data.id === this.defaultCatalogId, |
||||
|
onClick: () => { |
||||
|
this.setDefaultCatalog(data.id) |
||||
|
}, |
||||
|
}, |
||||
|
// { |
||||
|
// label: "导出", |
||||
|
// icon: "el-icon-download", |
||||
|
// disabled: false, |
||||
|
// children: [ |
||||
|
// { |
||||
|
// label: "导出到文件", |
||||
|
// onClick: () => { |
||||
|
// |
||||
|
// }, |
||||
|
// }, |
||||
|
// { |
||||
|
// label: "导出到其他平台", |
||||
|
// onClick: () => { |
||||
|
// |
||||
|
// }, |
||||
|
// } |
||||
|
// ] |
||||
|
// }, |
||||
|
|
||||
|
], |
||||
|
event, // 鼠标事件信息 |
||||
|
customClass: "custom-class", // 自定义菜单 class |
||||
|
zIndex: 3000, // 菜单样式 z-index |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
return false; |
||||
|
}, |
||||
|
} |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
#catalogTree{ |
||||
|
display: inline-block; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,125 @@ |
|||||
|
<template> |
||||
|
<div id="importChannel" v-loading="isLoging"> |
||||
|
<el-dialog |
||||
|
title="导入通道数据" |
||||
|
width="30rem" |
||||
|
top="2rem" |
||||
|
:append-to-body="true" |
||||
|
:close-on-click-modal="false" |
||||
|
:visible.sync="showDialog" |
||||
|
:destroy-on-close="true" |
||||
|
@close="close()" |
||||
|
> |
||||
|
<div> |
||||
|
<el-upload |
||||
|
class="upload-box" |
||||
|
drag |
||||
|
:action="uploadUrl" |
||||
|
name="file" |
||||
|
:on-success="successHook" |
||||
|
:on-error="errorHook" |
||||
|
> |
||||
|
<i class="el-icon-upload"></i> |
||||
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> |
||||
|
<div class="el-upload__tip" slot="tip">只能上传 csv / xls / xlsx 文件</div> |
||||
|
</el-upload> |
||||
|
</div> |
||||
|
</el-dialog> |
||||
|
<ShowErrorData ref="showErrorData" :gbIds="errorGBIds" :streams="errorStreams" ></ShowErrorData> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
|
||||
|
import ShowErrorData from './importChannelShowErrorData.vue' |
||||
|
|
||||
|
export default { |
||||
|
name: "importChannel", |
||||
|
components: { |
||||
|
ShowErrorData, |
||||
|
}, |
||||
|
created() {}, |
||||
|
data() { |
||||
|
return { |
||||
|
submitCallback: null, |
||||
|
showDialog: false, |
||||
|
isLoging: false, |
||||
|
isEdit: false, |
||||
|
errorStreams: null, |
||||
|
errorGBIds: null, |
||||
|
uploadUrl: process.env.NODE_ENV === 'development'?`debug/api/push/upload`:`api/push/upload`, |
||||
|
}; |
||||
|
}, |
||||
|
methods: { |
||||
|
openDialog: function (callback) { |
||||
|
this.showDialog = true; |
||||
|
this.submitCallback = callback; |
||||
|
}, |
||||
|
onSubmit: function () { |
||||
|
console.log("onSubmit"); |
||||
|
console.log(this.form); |
||||
|
this.$axios({ |
||||
|
method:"post", |
||||
|
url:`/api/platform/catalog/${!this.isEdit? "add":"edit"}`, |
||||
|
data: this.form |
||||
|
}) |
||||
|
.then((res)=> { |
||||
|
if (res.data.code === 0) { |
||||
|
console.log("添加/修改成功") |
||||
|
if (this.submitCallback)this.submitCallback() |
||||
|
}else { |
||||
|
this.$message({ |
||||
|
showClose: true, |
||||
|
message: res.data.msg, |
||||
|
type: "error", |
||||
|
}); |
||||
|
} |
||||
|
this.close(); |
||||
|
}) |
||||
|
.catch((error)=> { |
||||
|
console.log(error); |
||||
|
}); |
||||
|
}, |
||||
|
close: function () { |
||||
|
this.showDialog = false; |
||||
|
}, |
||||
|
successHook: function(response, file, fileList){ |
||||
|
if (response.code === 0) { |
||||
|
this.$message({ |
||||
|
showClose: true, |
||||
|
message: response.msg, |
||||
|
type: "success", |
||||
|
}); |
||||
|
}else if (response.code === 1) { |
||||
|
this.errorGBIds = response.data.gbId |
||||
|
this.errorStreams = response.data.stream |
||||
|
console.log(this.$refs) |
||||
|
console.log(this.$refs.showErrorData) |
||||
|
this.$refs.showErrorData.openDialog() |
||||
|
}else { |
||||
|
this.$message({ |
||||
|
showClose: true, |
||||
|
message: response.msg, |
||||
|
type: "error", |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
errorHook: function (err, file, fileList) { |
||||
|
this.$message({ |
||||
|
showClose: true, |
||||
|
message: err, |
||||
|
type: "error", |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
<style> |
||||
|
.upload-box{ |
||||
|
text-align: center; |
||||
|
} |
||||
|
.errDataBox{ |
||||
|
max-height: 15rem; |
||||
|
overflow: auto; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,64 @@ |
|||||
|
<template> |
||||
|
<div id="importChannelShowErrorData" v-loading="isLoging"> |
||||
|
<el-dialog |
||||
|
title="导入通道数据成功,但数据存在重复" |
||||
|
width="30rem" |
||||
|
top="2rem" |
||||
|
:append-to-body="true" |
||||
|
:close-on-click-modal="false" |
||||
|
:visible.sync="showDialog" |
||||
|
:destroy-on-close="true" |
||||
|
@close="close()" |
||||
|
> |
||||
|
<div > |
||||
|
重复国标ID: |
||||
|
<el-button style="float: right;" type="primary" size="mini" icon="el-icon-document-copy" title="点击拷贝" v-clipboard="gbIds.join(',')" @success="$message({type:'success', message:'成功拷贝到粘贴板'})">复制</el-button> |
||||
|
<ul class="errDataBox"> |
||||
|
<li v-for="id in gbIds" > |
||||
|
{{ id }} |
||||
|
</li> |
||||
|
</ul> |
||||
|
</div> |
||||
|
|
||||
|
<div > |
||||
|
重复App/stream: |
||||
|
<el-button style="float: right;" type="primary" size="mini" icon="el-icon-document-copy" title="点击拷贝" v-clipboard="streams.join(',')" @success="$message({type:'success', message:'成功拷贝到粘贴板'})">复制</el-button> |
||||
|
<ul class="errDataBox"> |
||||
|
<li v-for="id in streams" > |
||||
|
{{ id }} |
||||
|
</li> |
||||
|
</ul> |
||||
|
</div> |
||||
|
</el-dialog> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
|
||||
|
export default { |
||||
|
name: "importChannelShowErrorData", |
||||
|
computed: {}, |
||||
|
created() {}, |
||||
|
props: ['gbIds', 'streams'], |
||||
|
data() { |
||||
|
return { |
||||
|
isLoging: false, |
||||
|
showDialog: false, |
||||
|
}; |
||||
|
}, |
||||
|
methods: { |
||||
|
openDialog: function () { |
||||
|
this.showDialog = true; |
||||
|
}, |
||||
|
close: function () { |
||||
|
this.showDialog = false; |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
<style> |
||||
|
.errDataBox{ |
||||
|
max-height: 15rem; |
||||
|
overflow: auto; |
||||
|
} |
||||
|
</style> |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue