Commit 088419b4d8965e37774a217c5a8135e95fc82c5a
Merge remote-tracking branch 'origin/wvp-28181-2.0' into map
Showing
39 changed files
with
908 additions
and
587 deletions
README.md
| ... | ... | @@ -134,10 +134,10 @@ QQ遘∽ソ。荳闊ャ荳榊屓, 邊セ蜉帶怏髯.谺「霑主、ァ螳カ蝨ィ鄒、驥瑚ョィ隶コ.隗牙セ鈴。ケ逶ョ蟇ケ菴 |
| 134 | 134 | 諢溯ー「菴懆dexter langhuihui](https://github.com/langhuihui) 蠑貅占ソ吩ケ亥・ス逕ィ逧ЦEB謦ュ謾セ蝎ィ縲 |
| 135 | 135 | 諢溯ー「菴懆Kyle](https://gitee.com/kkkkk5G) 蠑貅蝉コ・ス逕ィ逧燕遶ッ鬘オ髱「 |
| 136 | 136 | 諢溯ー「蜷ス榊、ァ菴ャ逧オ槫勧莉・蜿雁ッケ鬘ケ逶ョ逧欠豁」荳主クョ蜉ゥ縲ょ桁諡ャ菴ク埼剞莠惹サ」遐∬エ。迪ョ縲琉鬚伜渚鬥医∬オ謐占オ遲牙推遘肴婿蠑冗噪謾ッ謖シ∽サ・荳区賜蜷堺ク榊蜈亥錘 |
| 137 | -[lawrencehj](https://github.com/lawrencehj) @髯クー-蛻帛・ァ第橿 [swwhaha](https://github.com/swwheihei) | |
| 137 | +[lawrencehj](https://github.com/lawrencehj) [Smallwhitepig](https://github.com/Smallwhitepig) [swwhaha](https://github.com/swwheihei) | |
| 138 | 138 | [hotcoffie](https://github.com/hotcoffie) [xiaomu](https://github.com/nikmu) [TristingChen](https://github.com/TristingChen) |
| 139 | 139 | [chenparty](https://github.com/chenparty) [Hotleave](https://github.com/hotleave) [ydwxb](https://github.com/ydwxb) |
| 140 | -[ydpd](https://github.com/ydpd) [szy833](https://github.com/szy833) [ydwxb](https://github.com/ydwxb) | |
| 140 | +[ydpd](https://github.com/ydpd) [szy833](https://github.com/szy833) [ydwxb](https://github.com/ydwxb) [Albertzhu666](https://github.com/Albertzhu666) | |
| 141 | 141 | |
| 142 | 142 | ps: 蛻壼「槫刈莠ソ吩クェ蜷榊黒瑚け螳夐@貍丈コク莠帛、ァ菴ャ梧ャ「霑主、ァ菴ャ閨皮ウサ謌第キサ蜉縲 |
| 143 | 143 | ... | ... |
bootstrap.sh
0 → 100755
| 1 | +#!/bin/bash | |
| 2 | + | |
| 3 | +###################################################### | |
| 4 | +# Copyright 2019 Pham Ngoc Hoai | |
| 5 | +# | |
| 6 | +# Licensed under the Apache License, Version 2.0 (the "License"); | |
| 7 | +# you may not use this file except in compliance with the License. | |
| 8 | +# You may obtain a copy of the License at | |
| 9 | +# | |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 | |
| 11 | +# | |
| 12 | +# Unless required by applicable law or agreed to in writing, software | |
| 13 | +# distributed under the License is distributed on an "AS IS" BASIS, | |
| 14 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 15 | +# See the License for the specific language governing permissions and | |
| 16 | +# limitations under the License. | |
| 17 | +# | |
| 18 | +# Repo: https://github.com/tyrion9/spring-boot-startup-script | |
| 19 | +# | |
| 20 | +######### PARAM ###################################### | |
| 21 | + | |
| 22 | +JAVA_OPT=-Xmx1024m | |
| 23 | +JARFILE=`ls -1r *.jar 2>/dev/null | head -n 1` | |
| 24 | +PID_FILE=pid.file | |
| 25 | +RUNNING=N | |
| 26 | +PWD=`pwd` | |
| 27 | + | |
| 28 | +######### DO NOT MODIFY ######## | |
| 29 | + | |
| 30 | +if [ -f $PID_FILE ]; then | |
| 31 | + PID=`cat $PID_FILE` | |
| 32 | + if [ ! -z "$PID" ] && kill -0 $PID 2>/dev/null; then | |
| 33 | + RUNNING=Y | |
| 34 | + fi | |
| 35 | +fi | |
| 36 | + | |
| 37 | +start() | |
| 38 | +{ | |
| 39 | + if [ $RUNNING == "Y" ]; then | |
| 40 | + echo "Application already started" | |
| 41 | + else | |
| 42 | + if [ -z "$JARFILE" ] | |
| 43 | + then | |
| 44 | + echo "ERROR: jar file not found" | |
| 45 | + else | |
| 46 | + nohup java $JAVA_OPT -Djava.security.egd=file:/dev/./urandom -jar $PWD/$JARFILE > nohup.out 2>&1 & | |
| 47 | + echo $! > $PID_FILE | |
| 48 | + echo "Application $JARFILE starting..." | |
| 49 | + tail -f nohup.out | |
| 50 | + fi | |
| 51 | + fi | |
| 52 | +} | |
| 53 | + | |
| 54 | +stop() | |
| 55 | +{ | |
| 56 | + if [ $RUNNING == "Y" ]; then | |
| 57 | + kill -9 $PID | |
| 58 | + rm -f $PID_FILE | |
| 59 | + echo "Application stopped" | |
| 60 | + else | |
| 61 | + echo "Application not running" | |
| 62 | + fi | |
| 63 | +} | |
| 64 | + | |
| 65 | +restart() | |
| 66 | +{ | |
| 67 | + stop | |
| 68 | + start | |
| 69 | +} | |
| 70 | + | |
| 71 | +case "$1" in | |
| 72 | + | |
| 73 | + 'start') | |
| 74 | + start | |
| 75 | + ;; | |
| 76 | + | |
| 77 | + 'stop') | |
| 78 | + stop | |
| 79 | + ;; | |
| 80 | + | |
| 81 | + 'restart') | |
| 82 | + restart | |
| 83 | + ;; | |
| 84 | + | |
| 85 | + *) | |
| 86 | + echo "Usage: $0 { start | stop | restart }" | |
| 87 | + exit 1 | |
| 88 | + ;; | |
| 89 | +esac | |
| 90 | +exit 0 | |
| 91 | + | ... | ... |
pom.xml
sql/clean.sql
0 → 100644
| 1 | +delete from device; | |
| 2 | +delete from device_alarm; | |
| 3 | +delete from device_channel; | |
| 4 | +delete from device_mobile_position; | |
| 5 | +delete from gb_stream; | |
| 6 | +delete from log; | |
| 7 | +delete from media_server; | |
| 8 | +delete from parent_platform; | |
| 9 | +delete from platform_catalog; | |
| 10 | +delete from platform_gb_channel; | |
| 11 | +delete from platform_gb_stream; | |
| 12 | +delete from stream_proxy; | |
| 13 | +delete from stream_push; | |
| 0 | 14 | \ No newline at end of file | ... | ... |
sql/mysql.sql
| 1 | --- MySQL dump 10.13 Distrib 8.0.28, for Linux (x86_64) | |
| 1 | +-- MariaDB dump 10.19 Distrib 10.7.3-MariaDB, for Linux (x86_64) | |
| 2 | 2 | -- |
| 3 | --- Host: 127.0.0.1 Database: wvp | |
| 3 | +-- Host: 127.0.0.1 Database: wvp3 | |
| 4 | 4 | -- ------------------------------------------------------ |
| 5 | --- Server version 8.0.28-0ubuntu0.20.04.3 | |
| 5 | +-- Server version 8.0.0-dmr | |
| 6 | 6 | |
| 7 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; |
| 8 | 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; |
| 9 | 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; |
| 10 | -/*!50503 SET NAMES utf8mb4 */; | |
| 10 | +/*!40101 SET NAMES utf8mb4 */; | |
| 11 | 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; |
| 12 | 12 | /*!40103 SET TIME_ZONE='+00:00' */; |
| 13 | 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; |
| ... | ... | @@ -21,33 +21,34 @@ |
| 21 | 21 | |
| 22 | 22 | DROP TABLE IF EXISTS `device`; |
| 23 | 23 | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| 24 | -/*!50503 SET character_set_client = utf8mb4 */; | |
| 24 | +/*!40101 SET character_set_client = utf8 */; | |
| 25 | 25 | CREATE TABLE `device` ( |
| 26 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 27 | - `deviceId` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 28 | - `name` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 29 | - `manufacturer` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 30 | - `model` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 31 | - `firmware` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 32 | - `transport` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 33 | - `streamMode` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 34 | - `online` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 35 | - `registerTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 36 | - `keepaliveTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 37 | - `ip` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 38 | - `createTime` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 39 | - `updateTime` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 40 | - `port` int NOT NULL, | |
| 41 | - `expires` int NOT NULL, | |
| 42 | - `subscribeCycleForCatalog` int NOT NULL, | |
| 43 | - `subscribeCycleForMobilePosition` int NOT NULL, | |
| 44 | - `mobilePositionSubmissionInterval` int DEFAULT 5 NOT NULL, | |
| 45 | - `subscribeCycleForAlarm` int NOT NULL, | |
| 46 | - `hostAddress` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 47 | - `charset` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 26 | + `id` int(11) NOT NULL AUTO_INCREMENT, | |
| 27 | + `deviceId` varchar(50) NOT NULL, | |
| 28 | + `name` varchar(255) DEFAULT NULL, | |
| 29 | + `manufacturer` varchar(255) DEFAULT NULL, | |
| 30 | + `model` varchar(255) DEFAULT NULL, | |
| 31 | + `firmware` varchar(255) DEFAULT NULL, | |
| 32 | + `transport` varchar(50) DEFAULT NULL, | |
| 33 | + `streamMode` varchar(50) DEFAULT NULL, | |
| 34 | + `online` varchar(50) DEFAULT NULL, | |
| 35 | + `registerTime` varchar(50) DEFAULT NULL, | |
| 36 | + `keepaliveTime` varchar(50) DEFAULT NULL, | |
| 37 | + `ip` varchar(50) NOT NULL, | |
| 38 | + `createTime` varchar(50) NOT NULL, | |
| 39 | + `updateTime` varchar(50) NOT NULL, | |
| 40 | + `port` int(11) NOT NULL, | |
| 41 | + `expires` int(11) NOT NULL, | |
| 42 | + `subscribeCycleForCatalog` int(11) NOT NULL, | |
| 43 | + `subscribeCycleForMobilePosition` int(11) NOT NULL, | |
| 44 | + `mobilePositionSubmissionInterval` int(11) NOT NULL DEFAULT '5', | |
| 45 | + `subscribeCycleForAlarm` int(11) NOT NULL, | |
| 46 | + `hostAddress` varchar(50) NOT NULL, | |
| 47 | + `charset` varchar(50) NOT NULL, | |
| 48 | + `ssrcCheck` int(11) DEFAULT '0', | |
| 48 | 49 | PRIMARY KEY (`id`), |
| 49 | 50 | UNIQUE KEY `device_deviceId_uindex` (`deviceId`) |
| 50 | -) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
| 51 | +) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8mb4; | |
| 51 | 52 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 52 | 53 | |
| 53 | 54 | -- |
| ... | ... | @@ -65,20 +66,20 @@ UNLOCK TABLES; |
| 65 | 66 | |
| 66 | 67 | DROP TABLE IF EXISTS `device_alarm`; |
| 67 | 68 | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| 68 | -/*!50503 SET character_set_client = utf8mb4 */; | |
| 69 | +/*!40101 SET character_set_client = utf8 */; | |
| 69 | 70 | CREATE TABLE `device_alarm` ( |
| 70 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 71 | - `deviceId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 72 | - `channelId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 73 | - `alarmPriority` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 74 | - `alarmMethod` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 75 | - `alarmTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 76 | - `alarmDescription` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 71 | + `id` int(11) NOT NULL AUTO_INCREMENT, | |
| 72 | + `deviceId` varchar(50) NOT NULL, | |
| 73 | + `channelId` varchar(50) NOT NULL, | |
| 74 | + `alarmPriority` varchar(50) NOT NULL, | |
| 75 | + `alarmMethod` varchar(50) DEFAULT NULL, | |
| 76 | + `alarmTime` varchar(50) NOT NULL, | |
| 77 | + `alarmDescription` varchar(255) DEFAULT NULL, | |
| 77 | 78 | `longitude` double DEFAULT NULL, |
| 78 | 79 | `latitude` double DEFAULT NULL, |
| 79 | - `alarmType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 80 | + `alarmType` varchar(50) DEFAULT NULL, | |
| 80 | 81 | PRIMARY KEY (`id`) USING BTREE |
| 81 | -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 82 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC; | |
| 82 | 83 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 83 | 84 | |
| 84 | 85 | -- |
| ... | ... | @@ -96,43 +97,43 @@ UNLOCK TABLES; |
| 96 | 97 | |
| 97 | 98 | DROP TABLE IF EXISTS `device_channel`; |
| 98 | 99 | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| 99 | -/*!50503 SET character_set_client = utf8mb4 */; | |
| 100 | +/*!40101 SET character_set_client = utf8 */; | |
| 100 | 101 | CREATE TABLE `device_channel` ( |
| 101 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 102 | - `channelId` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 103 | - `name` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 104 | - `manufacture` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 105 | - `model` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 106 | - `owner` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 107 | - `civilCode` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 108 | - `block` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 109 | - `address` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 110 | - `parentId` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 111 | - `safetyWay` int DEFAULT NULL, | |
| 112 | - `registerWay` int DEFAULT NULL, | |
| 113 | - `certNum` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 114 | - `certifiable` int DEFAULT NULL, | |
| 115 | - `errCode` int DEFAULT NULL, | |
| 116 | - `endTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 117 | - `secrecy` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 118 | - `ipAddress` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 119 | - `port` int DEFAULT NULL, | |
| 120 | - `password` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 121 | - `PTZType` int DEFAULT NULL, | |
| 122 | - `status` int DEFAULT NULL, | |
| 102 | + `id` int(11) NOT NULL AUTO_INCREMENT, | |
| 103 | + `channelId` varchar(50) NOT NULL, | |
| 104 | + `name` varchar(255) DEFAULT NULL, | |
| 105 | + `manufacture` varchar(50) DEFAULT NULL, | |
| 106 | + `model` varchar(50) DEFAULT NULL, | |
| 107 | + `owner` varchar(50) DEFAULT NULL, | |
| 108 | + `civilCode` varchar(50) DEFAULT NULL, | |
| 109 | + `block` varchar(50) DEFAULT NULL, | |
| 110 | + `address` varchar(50) DEFAULT NULL, | |
| 111 | + `parentId` varchar(50) DEFAULT NULL, | |
| 112 | + `safetyWay` int(11) DEFAULT NULL, | |
| 113 | + `registerWay` int(11) DEFAULT NULL, | |
| 114 | + `certNum` varchar(50) DEFAULT NULL, | |
| 115 | + `certifiable` int(11) DEFAULT NULL, | |
| 116 | + `errCode` int(11) DEFAULT NULL, | |
| 117 | + `endTime` varchar(50) DEFAULT NULL, | |
| 118 | + `secrecy` varchar(50) DEFAULT NULL, | |
| 119 | + `ipAddress` varchar(50) DEFAULT NULL, | |
| 120 | + `port` int(11) DEFAULT NULL, | |
| 121 | + `password` varchar(255) DEFAULT NULL, | |
| 122 | + `PTZType` int(11) DEFAULT NULL, | |
| 123 | + `status` int(11) DEFAULT NULL, | |
| 123 | 124 | `longitude` double DEFAULT NULL, |
| 124 | 125 | `latitude` double DEFAULT NULL, |
| 125 | - `streamId` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 126 | - `deviceId` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 127 | - `parental` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 126 | + `streamId` varchar(50) DEFAULT NULL, | |
| 127 | + `deviceId` varchar(50) NOT NULL, | |
| 128 | + `parental` varchar(50) DEFAULT NULL, | |
| 128 | 129 | `hasAudio` bit(1) DEFAULT NULL, |
| 129 | - `createTime` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 130 | - `updateTime` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 131 | - `subCount` int DEFAULT '0', | |
| 130 | + `createTime` varchar(50) NOT NULL, | |
| 131 | + `updateTime` varchar(50) NOT NULL, | |
| 132 | + `subCount` int(11) DEFAULT '0', | |
| 132 | 133 | PRIMARY KEY (`id`), |
| 133 | 134 | UNIQUE KEY `device_channel_id_uindex` (`id`), |
| 134 | 135 | UNIQUE KEY `device_channel_pk` (`channelId`,`deviceId`) |
| 135 | -) ENGINE=InnoDB AUTO_INCREMENT=46 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
| 136 | +) ENGINE=InnoDB AUTO_INCREMENT=81657 DEFAULT CHARSET=utf8mb4; | |
| 136 | 137 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 137 | 138 | |
| 138 | 139 | -- |
| ... | ... | @@ -150,24 +151,24 @@ UNLOCK TABLES; |
| 150 | 151 | |
| 151 | 152 | DROP TABLE IF EXISTS `device_mobile_position`; |
| 152 | 153 | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| 153 | -/*!50503 SET character_set_client = utf8mb4 */; | |
| 154 | +/*!40101 SET character_set_client = utf8 */; | |
| 154 | 155 | CREATE TABLE `device_mobile_position` ( |
| 155 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 156 | - `deviceId` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 157 | - `channelId` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 158 | - `deviceName` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 159 | - `time` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 156 | + `id` int(11) NOT NULL AUTO_INCREMENT, | |
| 157 | + `deviceId` varchar(50) NOT NULL, | |
| 158 | + `channelId` varchar(50) NOT NULL, | |
| 159 | + `deviceName` varchar(255) DEFAULT NULL, | |
| 160 | + `time` varchar(50) NOT NULL, | |
| 160 | 161 | `longitude` double NOT NULL, |
| 161 | 162 | `latitude` double NOT NULL, |
| 162 | 163 | `altitude` double DEFAULT NULL, |
| 163 | 164 | `speed` double DEFAULT NULL, |
| 164 | 165 | `direction` double DEFAULT NULL, |
| 165 | - `reportSource` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 166 | - `geodeticSystem` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 167 | - `cnLng` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 168 | - `cnLat` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 166 | + `reportSource` varchar(50) DEFAULT NULL, | |
| 167 | + `geodeticSystem` varchar(50) DEFAULT NULL, | |
| 168 | + `cnLng` varchar(50) DEFAULT NULL, | |
| 169 | + `cnLat` varchar(50) DEFAULT NULL, | |
| 169 | 170 | PRIMARY KEY (`id`) |
| 170 | -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
| 171 | +) ENGINE=InnoDB AUTO_INCREMENT=6108 DEFAULT CHARSET=utf8mb4; | |
| 171 | 172 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 172 | 173 | |
| 173 | 174 | -- |
| ... | ... | @@ -185,23 +186,23 @@ UNLOCK TABLES; |
| 185 | 186 | |
| 186 | 187 | DROP TABLE IF EXISTS `gb_stream`; |
| 187 | 188 | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| 188 | -/*!50503 SET character_set_client = utf8mb4 */; | |
| 189 | +/*!40101 SET character_set_client = utf8 */; | |
| 189 | 190 | CREATE TABLE `gb_stream` ( |
| 190 | - `gbStreamId` int NOT NULL AUTO_INCREMENT, | |
| 191 | - `app` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 192 | - `stream` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 193 | - `gbId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 194 | - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 191 | + `gbStreamId` int(11) NOT NULL AUTO_INCREMENT, | |
| 192 | + `app` varchar(255) NOT NULL, | |
| 193 | + `stream` varchar(255) NOT NULL, | |
| 194 | + `gbId` varchar(50) NOT NULL, | |
| 195 | + `name` varchar(255) DEFAULT NULL, | |
| 195 | 196 | `longitude` double DEFAULT NULL, |
| 196 | 197 | `latitude` double DEFAULT NULL, |
| 197 | - `streamType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 198 | - `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 199 | - `status` int DEFAULT NULL, | |
| 200 | - `createStamp` bigint DEFAULT NULL, | |
| 198 | + `streamType` varchar(50) DEFAULT NULL, | |
| 199 | + `mediaServerId` varchar(50) DEFAULT NULL, | |
| 200 | + `status` int(11) DEFAULT NULL, | |
| 201 | + `createStamp` bigint(20) DEFAULT NULL, | |
| 201 | 202 | PRIMARY KEY (`gbStreamId`) USING BTREE, |
| 202 | 203 | UNIQUE KEY `app` (`app`,`stream`) USING BTREE, |
| 203 | 204 | UNIQUE KEY `gbId` (`gbId`) USING BTREE |
| 204 | -) ENGINE=InnoDB AUTO_INCREMENT=300766 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 205 | +) ENGINE=InnoDB AUTO_INCREMENT=300769 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC; | |
| 205 | 206 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 206 | 207 | |
| 207 | 208 | -- |
| ... | ... | @@ -219,19 +220,19 @@ UNLOCK TABLES; |
| 219 | 220 | |
| 220 | 221 | DROP TABLE IF EXISTS `log`; |
| 221 | 222 | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| 222 | -/*!50503 SET character_set_client = utf8mb4 */; | |
| 223 | +/*!40101 SET character_set_client = utf8 */; | |
| 223 | 224 | CREATE TABLE `log` ( |
| 224 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 225 | - `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 226 | - `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 227 | - `uri` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 228 | - `address` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 229 | - `result` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 230 | - `timing` bigint NOT NULL, | |
| 231 | - `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 232 | - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 225 | + `id` int(11) NOT NULL AUTO_INCREMENT, | |
| 226 | + `name` varchar(50) NOT NULL, | |
| 227 | + `type` varchar(50) NOT NULL, | |
| 228 | + `uri` varchar(200) NOT NULL, | |
| 229 | + `address` varchar(50) NOT NULL, | |
| 230 | + `result` varchar(50) NOT NULL, | |
| 231 | + `timing` bigint(20) NOT NULL, | |
| 232 | + `username` varchar(50) NOT NULL, | |
| 233 | + `createTime` varchar(50) NOT NULL, | |
| 233 | 234 | PRIMARY KEY (`id`) USING BTREE |
| 234 | -) ENGINE=InnoDB AUTO_INCREMENT=962 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 235 | +) ENGINE=InnoDB AUTO_INCREMENT=1552 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC; | |
| 235 | 236 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 236 | 237 | |
| 237 | 238 | -- |
| ... | ... | @@ -249,34 +250,34 @@ UNLOCK TABLES; |
| 249 | 250 | |
| 250 | 251 | DROP TABLE IF EXISTS `media_server`; |
| 251 | 252 | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| 252 | -/*!50503 SET character_set_client = utf8mb4 */; | |
| 253 | +/*!40101 SET character_set_client = utf8 */; | |
| 253 | 254 | CREATE TABLE `media_server` ( |
| 254 | - `id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 255 | - `ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 256 | - `hookIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 257 | - `sdpIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 258 | - `streamIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 259 | - `httpPort` int NOT NULL, | |
| 260 | - `httpSSlPort` int NOT NULL, | |
| 261 | - `rtmpPort` int NOT NULL, | |
| 262 | - `rtmpSSlPort` int NOT NULL, | |
| 263 | - `rtpProxyPort` int NOT NULL, | |
| 264 | - `rtspPort` int NOT NULL, | |
| 265 | - `rtspSSLPort` int NOT NULL, | |
| 266 | - `autoConfig` int NOT NULL, | |
| 267 | - `secret` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 268 | - `streamNoneReaderDelayMS` int NOT NULL, | |
| 269 | - `rtpEnable` int NOT NULL, | |
| 270 | - `rtpPortRange` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 271 | - `sendRtpPortRange` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 272 | - `recordAssistPort` int NOT NULL, | |
| 273 | - `defaultServer` int NOT NULL, | |
| 274 | - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 275 | - `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 276 | - `hookAliveInterval` int NOT NULL, | |
| 255 | + `id` varchar(255) NOT NULL, | |
| 256 | + `ip` varchar(50) NOT NULL, | |
| 257 | + `hookIp` varchar(50) NOT NULL, | |
| 258 | + `sdpIp` varchar(50) NOT NULL, | |
| 259 | + `streamIp` varchar(50) NOT NULL, | |
| 260 | + `httpPort` int(11) NOT NULL, | |
| 261 | + `httpSSlPort` int(11) NOT NULL, | |
| 262 | + `rtmpPort` int(11) NOT NULL, | |
| 263 | + `rtmpSSlPort` int(11) NOT NULL, | |
| 264 | + `rtpProxyPort` int(11) NOT NULL, | |
| 265 | + `rtspPort` int(11) NOT NULL, | |
| 266 | + `rtspSSLPort` int(11) NOT NULL, | |
| 267 | + `autoConfig` int(11) NOT NULL, | |
| 268 | + `secret` varchar(50) NOT NULL, | |
| 269 | + `streamNoneReaderDelayMS` int(11) NOT NULL, | |
| 270 | + `rtpEnable` int(11) NOT NULL, | |
| 271 | + `rtpPortRange` varchar(50) NOT NULL, | |
| 272 | + `sendRtpPortRange` varchar(50) NOT NULL, | |
| 273 | + `recordAssistPort` int(11) NOT NULL, | |
| 274 | + `defaultServer` int(11) NOT NULL, | |
| 275 | + `createTime` varchar(50) NOT NULL, | |
| 276 | + `updateTime` varchar(50) NOT NULL, | |
| 277 | + `hookAliveInterval` int(11) NOT NULL, | |
| 277 | 278 | PRIMARY KEY (`id`) USING BTREE, |
| 278 | 279 | UNIQUE KEY `media_server_i` (`ip`,`httpPort`) USING BTREE |
| 279 | -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 280 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC; | |
| 280 | 281 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 281 | 282 | |
| 282 | 283 | -- |
| ... | ... | @@ -294,33 +295,36 @@ UNLOCK TABLES; |
| 294 | 295 | |
| 295 | 296 | DROP TABLE IF EXISTS `parent_platform`; |
| 296 | 297 | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| 297 | -/*!50503 SET character_set_client = utf8mb4 */; | |
| 298 | +/*!40101 SET character_set_client = utf8 */; | |
| 298 | 299 | CREATE TABLE `parent_platform` ( |
| 299 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 300 | - `enable` int DEFAULT NULL, | |
| 301 | - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 302 | - `serverGBId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 303 | - `serverGBDomain` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 304 | - `serverIP` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 305 | - `serverPort` int DEFAULT NULL, | |
| 306 | - `deviceGBId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 307 | - `deviceIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 308 | - `devicePort` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 309 | - `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 310 | - `password` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 311 | - `expires` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 312 | - `keepTimeout` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 313 | - `transport` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 314 | - `characterSet` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 315 | - `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 316 | - `ptz` int DEFAULT NULL, | |
| 317 | - `rtcp` int DEFAULT NULL, | |
| 300 | + `id` int(11) NOT NULL AUTO_INCREMENT, | |
| 301 | + `enable` int(11) DEFAULT NULL, | |
| 302 | + `name` varchar(255) DEFAULT NULL, | |
| 303 | + `serverGBId` varchar(50) NOT NULL, | |
| 304 | + `serverGBDomain` varchar(50) DEFAULT NULL, | |
| 305 | + `serverIP` varchar(50) DEFAULT NULL, | |
| 306 | + `serverPort` int(11) DEFAULT NULL, | |
| 307 | + `deviceGBId` varchar(50) NOT NULL, | |
| 308 | + `deviceIp` varchar(50) DEFAULT NULL, | |
| 309 | + `devicePort` varchar(50) DEFAULT NULL, | |
| 310 | + `username` varchar(255) DEFAULT NULL, | |
| 311 | + `password` varchar(50) DEFAULT NULL, | |
| 312 | + `expires` varchar(50) DEFAULT NULL, | |
| 313 | + `keepTimeout` varchar(50) DEFAULT NULL, | |
| 314 | + `transport` varchar(50) DEFAULT NULL, | |
| 315 | + `characterSet` varchar(50) DEFAULT NULL, | |
| 316 | + `catalogId` varchar(50) NOT NULL, | |
| 317 | + `ptz` int(11) DEFAULT NULL, | |
| 318 | + `rtcp` int(11) DEFAULT NULL, | |
| 318 | 319 | `status` bit(1) DEFAULT NULL, |
| 319 | - `shareAllLiveStream` int DEFAULT NULL, | |
| 320 | + `shareAllLiveStream` int(11) DEFAULT NULL, | |
| 321 | + `startOfflinePush` int(11) DEFAULT '0', | |
| 322 | + `administrativeDivision` varchar(50) NOT NULL, | |
| 323 | + `catalogGroup` int(11) DEFAULT '1', | |
| 320 | 324 | PRIMARY KEY (`id`), |
| 321 | 325 | UNIQUE KEY `parent_platform_id_uindex` (`id`), |
| 322 | 326 | UNIQUE KEY `parent_platform_pk` (`serverGBId`) |
| 323 | -) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 327 | +) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC; | |
| 324 | 328 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 325 | 329 | |
| 326 | 330 | -- |
| ... | ... | @@ -338,14 +342,14 @@ UNLOCK TABLES; |
| 338 | 342 | |
| 339 | 343 | DROP TABLE IF EXISTS `platform_catalog`; |
| 340 | 344 | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| 341 | -/*!50503 SET character_set_client = utf8mb4 */; | |
| 345 | +/*!40101 SET character_set_client = utf8 */; | |
| 342 | 346 | CREATE TABLE `platform_catalog` ( |
| 343 | - `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 344 | - `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 345 | - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 346 | - `parentId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 347 | + `id` varchar(50) NOT NULL, | |
| 348 | + `platformId` varchar(50) NOT NULL, | |
| 349 | + `name` varchar(255) NOT NULL, | |
| 350 | + `parentId` varchar(50) DEFAULT NULL, | |
| 347 | 351 | PRIMARY KEY (`id`) USING BTREE |
| 348 | -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 352 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC; | |
| 349 | 353 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 350 | 354 | |
| 351 | 355 | -- |
| ... | ... | @@ -363,14 +367,14 @@ UNLOCK TABLES; |
| 363 | 367 | |
| 364 | 368 | DROP TABLE IF EXISTS `platform_gb_channel`; |
| 365 | 369 | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| 366 | -/*!50503 SET character_set_client = utf8mb4 */; | |
| 370 | +/*!40101 SET character_set_client = utf8 */; | |
| 367 | 371 | CREATE TABLE `platform_gb_channel` ( |
| 368 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 369 | - `platformId` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 370 | - `catalogId` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 371 | - `deviceChannelId` int NOT NULL, | |
| 372 | + `id` int(11) NOT NULL AUTO_INCREMENT, | |
| 373 | + `platformId` varchar(50) NOT NULL, | |
| 374 | + `catalogId` varchar(50) NOT NULL, | |
| 375 | + `deviceChannelId` int(11) NOT NULL, | |
| 372 | 376 | PRIMARY KEY (`id`) |
| 373 | -) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
| 377 | +) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=utf8mb4; | |
| 374 | 378 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 375 | 379 | |
| 376 | 380 | -- |
| ... | ... | @@ -388,15 +392,15 @@ UNLOCK TABLES; |
| 388 | 392 | |
| 389 | 393 | DROP TABLE IF EXISTS `platform_gb_stream`; |
| 390 | 394 | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| 391 | -/*!50503 SET character_set_client = utf8mb4 */; | |
| 395 | +/*!40101 SET character_set_client = utf8 */; | |
| 392 | 396 | CREATE TABLE `platform_gb_stream` ( |
| 393 | - `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 394 | - `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 395 | - `gbStreamId` int NOT NULL, | |
| 396 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 397 | + `platformId` varchar(50) NOT NULL, | |
| 398 | + `catalogId` varchar(50) NOT NULL, | |
| 399 | + `gbStreamId` int(11) NOT NULL, | |
| 400 | + `id` int(11) NOT NULL AUTO_INCREMENT, | |
| 397 | 401 | PRIMARY KEY (`id`), |
| 398 | 402 | UNIQUE KEY `platform_gb_stream_pk` (`platformId`,`catalogId`,`gbStreamId`) |
| 399 | -) ENGINE=InnoDB AUTO_INCREMENT=301207 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 403 | +) ENGINE=InnoDB AUTO_INCREMENT=301210 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC; | |
| 400 | 404 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 401 | 405 | |
| 402 | 406 | -- |
| ... | ... | @@ -414,29 +418,29 @@ UNLOCK TABLES; |
| 414 | 418 | |
| 415 | 419 | DROP TABLE IF EXISTS `stream_proxy`; |
| 416 | 420 | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| 417 | -/*!50503 SET character_set_client = utf8mb4 */; | |
| 421 | +/*!40101 SET character_set_client = utf8 */; | |
| 418 | 422 | CREATE TABLE `stream_proxy` ( |
| 419 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 420 | - `type` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 421 | - `app` varchar(255) COLLATE utf8mb4_general_ci NOT NULL, | |
| 422 | - `stream` varchar(255) COLLATE utf8mb4_general_ci NOT NULL, | |
| 423 | - `url` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 424 | - `src_url` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 425 | - `dst_url` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 426 | - `timeout_ms` int DEFAULT NULL, | |
| 427 | - `ffmpeg_cmd_key` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 428 | - `rtp_type` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 429 | - `mediaServerId` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 423 | + `id` int(11) NOT NULL AUTO_INCREMENT, | |
| 424 | + `type` varchar(50) NOT NULL, | |
| 425 | + `app` varchar(255) NOT NULL, | |
| 426 | + `stream` varchar(255) NOT NULL, | |
| 427 | + `url` varchar(255) DEFAULT NULL, | |
| 428 | + `src_url` varchar(255) DEFAULT NULL, | |
| 429 | + `dst_url` varchar(255) DEFAULT NULL, | |
| 430 | + `timeout_ms` int(11) DEFAULT NULL, | |
| 431 | + `ffmpeg_cmd_key` varchar(255) DEFAULT NULL, | |
| 432 | + `rtp_type` varchar(50) DEFAULT NULL, | |
| 433 | + `mediaServerId` varchar(50) DEFAULT NULL, | |
| 430 | 434 | `enable_hls` bit(1) DEFAULT NULL, |
| 431 | 435 | `enable_mp4` bit(1) DEFAULT NULL, |
| 432 | 436 | `enable` bit(1) NOT NULL, |
| 433 | 437 | `status` bit(1) NOT NULL, |
| 434 | 438 | `enable_remove_none_reader` bit(1) NOT NULL, |
| 435 | - `createTime` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, | |
| 436 | - `name` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 439 | + `createTime` varchar(50) NOT NULL, | |
| 440 | + `name` varchar(255) DEFAULT NULL, | |
| 437 | 441 | PRIMARY KEY (`id`), |
| 438 | 442 | UNIQUE KEY `stream_proxy_pk` (`app`,`stream`) |
| 439 | -) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
| 443 | +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4; | |
| 440 | 444 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 441 | 445 | |
| 442 | 446 | -- |
| ... | ... | @@ -454,20 +458,20 @@ UNLOCK TABLES; |
| 454 | 458 | |
| 455 | 459 | DROP TABLE IF EXISTS `stream_push`; |
| 456 | 460 | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| 457 | -/*!50503 SET character_set_client = utf8mb4 */; | |
| 461 | +/*!40101 SET character_set_client = utf8 */; | |
| 458 | 462 | CREATE TABLE `stream_push` ( |
| 459 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 460 | - `app` varchar(255) COLLATE utf8mb4_general_ci NOT NULL, | |
| 461 | - `stream` varchar(255) COLLATE utf8mb4_general_ci NOT NULL, | |
| 462 | - `totalReaderCount` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 463 | - `originType` int DEFAULT NULL, | |
| 464 | - `originTypeStr` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 465 | - `createStamp` bigint DEFAULT NULL, | |
| 466 | - `aliveSecond` int DEFAULT NULL, | |
| 467 | - `mediaServerId` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, | |
| 463 | + `id` int(11) NOT NULL AUTO_INCREMENT, | |
| 464 | + `app` varchar(255) NOT NULL, | |
| 465 | + `stream` varchar(255) NOT NULL, | |
| 466 | + `totalReaderCount` varchar(50) DEFAULT NULL, | |
| 467 | + `originType` int(11) DEFAULT NULL, | |
| 468 | + `originTypeStr` varchar(50) DEFAULT NULL, | |
| 469 | + `createStamp` bigint(20) DEFAULT NULL, | |
| 470 | + `aliveSecond` int(11) DEFAULT NULL, | |
| 471 | + `mediaServerId` varchar(50) DEFAULT NULL, | |
| 468 | 472 | PRIMARY KEY (`id`), |
| 469 | 473 | UNIQUE KEY `stream_push_pk` (`app`,`stream`) |
| 470 | -) ENGINE=InnoDB AUTO_INCREMENT=300799 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | |
| 474 | +) ENGINE=InnoDB AUTO_INCREMENT=300838 DEFAULT CHARSET=utf8mb4; | |
| 471 | 475 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 472 | 476 | |
| 473 | 477 | -- |
| ... | ... | @@ -485,17 +489,17 @@ UNLOCK TABLES; |
| 485 | 489 | |
| 486 | 490 | DROP TABLE IF EXISTS `user`; |
| 487 | 491 | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| 488 | -/*!50503 SET character_set_client = utf8mb4 */; | |
| 492 | +/*!40101 SET character_set_client = utf8 */; | |
| 489 | 493 | CREATE TABLE `user` ( |
| 490 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 491 | - `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 492 | - `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 493 | - `roleId` int NOT NULL, | |
| 494 | - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 495 | - `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 494 | + `id` int(11) NOT NULL AUTO_INCREMENT, | |
| 495 | + `username` varchar(255) NOT NULL, | |
| 496 | + `password` varchar(255) NOT NULL, | |
| 497 | + `roleId` int(11) NOT NULL, | |
| 498 | + `createTime` varchar(50) NOT NULL, | |
| 499 | + `updateTime` varchar(50) NOT NULL, | |
| 496 | 500 | PRIMARY KEY (`id`) USING BTREE, |
| 497 | 501 | UNIQUE KEY `user_username_uindex` (`username`) USING BTREE |
| 498 | -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 502 | +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC; | |
| 499 | 503 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 500 | 504 | |
| 501 | 505 | -- |
| ... | ... | @@ -504,7 +508,8 @@ CREATE TABLE `user` ( |
| 504 | 508 | |
| 505 | 509 | LOCK TABLES `user` WRITE; |
| 506 | 510 | /*!40000 ALTER TABLE `user` DISABLE KEYS */; |
| 507 | -INSERT INTO `user` VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021 - 04 - 13 14:14:57','2021 - 04 - 13 14:14:57'); | |
| 511 | +INSERT INTO `user` VALUES | |
| 512 | + (1,'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021 - 04 - 13 14:14:57','2021 - 04 - 13 14:14:57'); | |
| 508 | 513 | /*!40000 ALTER TABLE `user` ENABLE KEYS */; |
| 509 | 514 | UNLOCK TABLES; |
| 510 | 515 | |
| ... | ... | @@ -514,15 +519,15 @@ UNLOCK TABLES; |
| 514 | 519 | |
| 515 | 520 | DROP TABLE IF EXISTS `user_role`; |
| 516 | 521 | /*!40101 SET @saved_cs_client = @@character_set_client */; |
| 517 | -/*!50503 SET character_set_client = utf8mb4 */; | |
| 522 | +/*!40101 SET character_set_client = utf8 */; | |
| 518 | 523 | CREATE TABLE `user_role` ( |
| 519 | - `id` int NOT NULL AUTO_INCREMENT, | |
| 520 | - `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 521 | - `authority` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 522 | - `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 523 | - `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, | |
| 524 | + `id` int(11) NOT NULL AUTO_INCREMENT, | |
| 525 | + `name` varchar(50) NOT NULL, | |
| 526 | + `authority` varchar(50) NOT NULL, | |
| 527 | + `createTime` varchar(50) NOT NULL, | |
| 528 | + `updateTime` varchar(50) NOT NULL, | |
| 524 | 529 | PRIMARY KEY (`id`) USING BTREE |
| 525 | -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; | |
| 530 | +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC; | |
| 526 | 531 | /*!40101 SET character_set_client = @saved_cs_client */; |
| 527 | 532 | |
| 528 | 533 | -- |
| ... | ... | @@ -531,7 +536,8 @@ CREATE TABLE `user_role` ( |
| 531 | 536 | |
| 532 | 537 | LOCK TABLES `user_role` WRITE; |
| 533 | 538 | /*!40000 ALTER TABLE `user_role` DISABLE KEYS */; |
| 534 | -INSERT INTO `user_role` VALUES (1,'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57'); | |
| 539 | +INSERT INTO `user_role` VALUES | |
| 540 | + (1,'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57'); | |
| 535 | 541 | /*!40000 ALTER TABLE `user_role` ENABLE KEYS */; |
| 536 | 542 | UNLOCK TABLES; |
| 537 | 543 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; |
| ... | ... | @@ -544,4 +550,4 @@ UNLOCK TABLES; |
| 544 | 550 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; |
| 545 | 551 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; |
| 546 | 552 | |
| 547 | --- Dump completed on 2022-03-07 8:26:30 | |
| 553 | +-- Dump completed on 2022-04-18 10:50:27 | ... | ... |
sql/update.sql
| 1 | -alter table device | |
| 2 | - add subscribeCycleForMobilePosition int null; | |
| 1 | +alter table parent_platform | |
| 2 | + add startOfflinePush int default 0 null; | |
| 3 | 3 | |
| 4 | -alter table device | |
| 5 | - add mobilePositionSubmissionInterval int default 5 null; | |
| 4 | +alter table parent_platform | |
| 5 | + add administrativeDivision varchar(50) not null; | |
| 6 | + | |
| 7 | +alter table parent_platform | |
| 8 | + add catalogGroup int default 1 null; | |
| 6 | 9 | |
| 7 | 10 | alter table device |
| 8 | - add subscribeCycleForAlarm int null; | |
| 9 | 11 | \ No newline at end of file |
| 12 | + add ssrcCheck int default 0 null; | |
| 13 | + | ... | ... |
src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java
| ... | ... | @@ -76,7 +76,6 @@ public class DynamicTask { |
| 76 | 76 | */ |
| 77 | 77 | public void startDelay(String key, Runnable task, int delay) { |
| 78 | 78 | stop(key); |
| 79 | - System.out.println("定时任务开始了"); | |
| 80 | 79 | Date starTime = new Date(System.currentTimeMillis() + delay); |
| 81 | 80 | |
| 82 | 81 | ScheduledFuture future = futureMap.get(key); |
| ... | ... | @@ -100,7 +99,6 @@ public class DynamicTask { |
| 100 | 99 | } |
| 101 | 100 | |
| 102 | 101 | public void stop(String key) { |
| 103 | - System.out.println("定时任务结束了"); | |
| 104 | 102 | if (futureMap.get(key) != null && !futureMap.get(key).isCancelled()) { |
| 105 | 103 | futureMap.get(key).cancel(true); |
| 106 | 104 | Runnable runnable = runnableMap.get(key); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java
| ... | ... | @@ -48,6 +48,7 @@ public class SipLayer{ |
| 48 | 48 | properties.setProperty("javax.sip.STACK_NAME", "GB28181_SIP"); |
| 49 | 49 | properties.setProperty("javax.sip.IP_ADDRESS", sipConfig.getMonitorIp()); |
| 50 | 50 | properties.setProperty("gov.nist.javax.sip.LOG_MESSAGE_CONTENT", "true"); |
| 51 | + properties.setProperty("gov.nist.javax.sip.DELIVER_UNSOLICITED_NOTIFY", "true"); // 接收所有notify请求,即使没有订阅 | |
| 51 | 52 | /** |
| 52 | 53 | * sip_server_log.log 和 sip_debug_log.log public static final int TRACE_NONE = |
| 53 | 54 | * 0; public static final int TRACE_MESSAGES = 16; public static final int | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/CatalogData.java
| ... | ... | @@ -4,6 +4,7 @@ import java.util.Date; |
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | 6 | public class CatalogData { |
| 7 | + private int sn; // 命令序列号 | |
| 7 | 8 | private int total; |
| 8 | 9 | private List<DeviceChannel> channelList; |
| 9 | 10 | private Date lastTime; |
| ... | ... | @@ -15,6 +16,15 @@ public class CatalogData { |
| 15 | 16 | } |
| 16 | 17 | private CatalogDataStatus status; |
| 17 | 18 | |
| 19 | + | |
| 20 | + public int getSn() { | |
| 21 | + return sn; | |
| 22 | + } | |
| 23 | + | |
| 24 | + public void setSn(int sn) { | |
| 25 | + this.sn = sn; | |
| 26 | + } | |
| 27 | + | |
| 18 | 28 | public int getTotal() { |
| 19 | 29 | return total; |
| 20 | 30 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
| ... | ... | @@ -129,6 +129,11 @@ public class Device { |
| 129 | 129 | */ |
| 130 | 130 | private int subscribeCycleForAlarm; |
| 131 | 131 | |
| 132 | + /** | |
| 133 | + * 是否开启ssrc校验,默认关闭,开启可以防止串流 | |
| 134 | + */ | |
| 135 | + private boolean ssrcCheck; | |
| 136 | + | |
| 132 | 137 | |
| 133 | 138 | public String getDeviceId() { |
| 134 | 139 | return deviceId; |
| ... | ... | @@ -321,4 +326,12 @@ public class Device { |
| 321 | 326 | public void setSubscribeCycleForAlarm(int subscribeCycleForAlarm) { |
| 322 | 327 | this.subscribeCycleForAlarm = subscribeCycleForAlarm; |
| 323 | 328 | } |
| 329 | + | |
| 330 | + public boolean isSsrcCheck() { | |
| 331 | + return ssrcCheck; | |
| 332 | + } | |
| 333 | + | |
| 334 | + public void setSsrcCheck(boolean ssrcCheck) { | |
| 335 | + this.ssrcCheck = ssrcCheck; | |
| 336 | + } | |
| 324 | 337 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java
| ... | ... | @@ -169,6 +169,11 @@ public class DeviceChannel { |
| 169 | 169 | */ |
| 170 | 170 | private boolean hasAudio; |
| 171 | 171 | |
| 172 | + /** | |
| 173 | + * 标记通道的类型,0->国标通道 1->直播流通道 2->业务分组/虚拟组织/行政区划 | |
| 174 | + */ | |
| 175 | + private int channelType; | |
| 176 | + | |
| 172 | 177 | public int getId() { |
| 173 | 178 | return id; |
| 174 | 179 | } |
| ... | ... | @@ -441,4 +446,12 @@ public class DeviceChannel { |
| 441 | 446 | public void setUpdateTime(String updateTime) { |
| 442 | 447 | this.updateTime = updateTime; |
| 443 | 448 | } |
| 449 | + | |
| 450 | + public int getChannelType() { | |
| 451 | + return channelType; | |
| 452 | + } | |
| 453 | + | |
| 454 | + public void setChannelType(int channelType) { | |
| 455 | + this.channelType = channelType; | |
| 456 | + } | |
| 444 | 457 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java
| ... | ... | @@ -129,6 +129,21 @@ public class ParentPlatform { |
| 129 | 129 | */ |
| 130 | 130 | private boolean mobilePositionSubscribe; |
| 131 | 131 | |
| 132 | + /** | |
| 133 | + * 点播未推流的设备时是否使用redis通知拉起 | |
| 134 | + */ | |
| 135 | + private boolean startOfflinePush; | |
| 136 | + | |
| 137 | + /** | |
| 138 | + * 目录分组-每次向上级发送通道信息时单个包携带的通道数量,取值1,2,4,8 | |
| 139 | + */ | |
| 140 | + private int catalogGroup; | |
| 141 | + | |
| 142 | + /** | |
| 143 | + * 行政区划 | |
| 144 | + */ | |
| 145 | + private String administrativeDivision; | |
| 146 | + | |
| 132 | 147 | public Integer getId() { |
| 133 | 148 | return id; |
| 134 | 149 | } |
| ... | ... | @@ -329,4 +344,28 @@ public class ParentPlatform { |
| 329 | 344 | public void setMobilePositionSubscribe(boolean mobilePositionSubscribe) { |
| 330 | 345 | this.mobilePositionSubscribe = mobilePositionSubscribe; |
| 331 | 346 | } |
| 347 | + | |
| 348 | + public boolean isStartOfflinePush() { | |
| 349 | + return startOfflinePush; | |
| 350 | + } | |
| 351 | + | |
| 352 | + public void setStartOfflinePush(boolean startOfflinePush) { | |
| 353 | + this.startOfflinePush = startOfflinePush; | |
| 354 | + } | |
| 355 | + | |
| 356 | + public int getCatalogGroup() { | |
| 357 | + return catalogGroup; | |
| 358 | + } | |
| 359 | + | |
| 360 | + public void setCatalogGroup(int catalogGroup) { | |
| 361 | + this.catalogGroup = catalogGroup; | |
| 362 | + } | |
| 363 | + | |
| 364 | + public String getAdministrativeDivision() { | |
| 365 | + return administrativeDivision; | |
| 366 | + } | |
| 367 | + | |
| 368 | + public void setAdministrativeDivision(String administrativeDivision) { | |
| 369 | + this.administrativeDivision = administrativeDivision; | |
| 370 | + } | |
| 332 | 371 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/event/online/OnlineEventListener.java
| ... | ... | @@ -54,6 +54,7 @@ public class OnlineEventListener implements ApplicationListener<OnlineEvent> { |
| 54 | 54 | @Autowired |
| 55 | 55 | private SIPCommander cmder; |
| 56 | 56 | |
| 57 | + | |
| 57 | 58 | private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| 58 | 59 | |
| 59 | 60 | @Override |
| ... | ... | @@ -74,7 +75,7 @@ public class OnlineEventListener implements ApplicationListener<OnlineEvent> { |
| 74 | 75 | if (deviceInStore == null) { //第一次上线 |
| 75 | 76 | logger.info("[{}] 首次注册,查询设备信息以及通道信息", device.getDeviceId()); |
| 76 | 77 | cmder.deviceInfoQuery(device); |
| 77 | - cmder.catalogQuery(device, null); | |
| 78 | + deviceService.sync(device); | |
| 78 | 79 | } |
| 79 | 80 | break; |
| 80 | 81 | // 设备主动发送心跳触发的在线事件 | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataCatch.java
| ... | ... | @@ -26,28 +26,35 @@ public class CatalogDataCatch { |
| 26 | 26 | @Autowired |
| 27 | 27 | private IVideoManagerStorage storager; |
| 28 | 28 | |
| 29 | - public void addReady(String key) { | |
| 30 | - CatalogData catalogData = data.get(key); | |
| 29 | + public void addReady(Device device, int sn ) { | |
| 30 | + CatalogData catalogData = data.get(device.getDeviceId()); | |
| 31 | 31 | if (catalogData == null || catalogData.getStatus().equals(CatalogData.CatalogDataStatus.end)) { |
| 32 | 32 | catalogData = new CatalogData(); |
| 33 | 33 | catalogData.setChannelList(new ArrayList<>()); |
| 34 | + catalogData.setDevice(device); | |
| 35 | + catalogData.setSn(sn); | |
| 34 | 36 | catalogData.setStatus(CatalogData.CatalogDataStatus.ready); |
| 35 | 37 | catalogData.setLastTime(new Date(System.currentTimeMillis())); |
| 36 | - data.put(key, catalogData); | |
| 38 | + data.put(device.getDeviceId(), catalogData); | |
| 37 | 39 | } |
| 38 | 40 | } |
| 39 | 41 | |
| 40 | - public void put(String key, int total, Device device, List<DeviceChannel> deviceChannelList) { | |
| 41 | - CatalogData catalogData = data.get(key); | |
| 42 | + public void put(String deviceId, int sn, int total, Device device, List<DeviceChannel> deviceChannelList) { | |
| 43 | + CatalogData catalogData = data.get(deviceId); | |
| 42 | 44 | if (catalogData == null) { |
| 43 | 45 | catalogData = new CatalogData(); |
| 46 | + catalogData.setSn(sn); | |
| 44 | 47 | catalogData.setTotal(total); |
| 45 | 48 | catalogData.setDevice(device); |
| 46 | 49 | catalogData.setChannelList(new ArrayList<>()); |
| 47 | 50 | catalogData.setStatus(CatalogData.CatalogDataStatus.runIng); |
| 48 | 51 | catalogData.setLastTime(new Date(System.currentTimeMillis())); |
| 49 | - data.put(key, catalogData); | |
| 52 | + data.put(deviceId, catalogData); | |
| 50 | 53 | }else { |
| 54 | + // 同一个设备的通道同步请求只考虑一个,其他的直接忽略 | |
| 55 | + if (catalogData.getSn() != sn) { | |
| 56 | + return; | |
| 57 | + } | |
| 51 | 58 | catalogData.setTotal(total); |
| 52 | 59 | catalogData.setDevice(device); |
| 53 | 60 | catalogData.setStatus(CatalogData.CatalogDataStatus.runIng); |
| ... | ... | @@ -56,20 +63,20 @@ public class CatalogDataCatch { |
| 56 | 63 | } |
| 57 | 64 | } |
| 58 | 65 | |
| 59 | - public List<DeviceChannel> get(String key) { | |
| 60 | - CatalogData catalogData = data.get(key); | |
| 66 | + public List<DeviceChannel> get(String deviceId) { | |
| 67 | + CatalogData catalogData = data.get(deviceId); | |
| 61 | 68 | if (catalogData == null) return null; |
| 62 | 69 | return catalogData.getChannelList(); |
| 63 | 70 | } |
| 64 | 71 | |
| 65 | - public int getTotal(String key) { | |
| 66 | - CatalogData catalogData = data.get(key); | |
| 72 | + public int getTotal(String deviceId) { | |
| 73 | + CatalogData catalogData = data.get(deviceId); | |
| 67 | 74 | if (catalogData == null) return 0; |
| 68 | 75 | return catalogData.getTotal(); |
| 69 | 76 | } |
| 70 | 77 | |
| 71 | - public SyncStatus getSyncStatus(String key) { | |
| 72 | - CatalogData catalogData = data.get(key); | |
| 78 | + public SyncStatus getSyncStatus(String deviceId) { | |
| 79 | + CatalogData catalogData = data.get(deviceId); | |
| 73 | 80 | if (catalogData == null) return null; |
| 74 | 81 | SyncStatus syncStatus = new SyncStatus(); |
| 75 | 82 | syncStatus.setCurrent(catalogData.getChannelList().size()); |
| ... | ... | @@ -78,8 +85,10 @@ public class CatalogDataCatch { |
| 78 | 85 | return syncStatus; |
| 79 | 86 | } |
| 80 | 87 | |
| 81 | - public void del(String key) { | |
| 82 | - data.remove(key); | |
| 88 | + public boolean isSyncRunning(String deviceId) { | |
| 89 | + CatalogData catalogData = data.get(deviceId); | |
| 90 | + if (catalogData == null) return false; | |
| 91 | + return !catalogData.getStatus().equals(CatalogData.CatalogDataStatus.end); | |
| 83 | 92 | } |
| 84 | 93 | |
| 85 | 94 | @Scheduled(fixedRate = 5 * 1000) //每5秒执行一次, 发现数据5秒未更新则移除数据并认为数据接收超时 |
| ... | ... | @@ -92,23 +101,30 @@ public class CatalogDataCatch { |
| 92 | 101 | Calendar calendarBefore30S = Calendar.getInstance(); |
| 93 | 102 | calendarBefore30S.setTime(new Date()); |
| 94 | 103 | calendarBefore30S.set(Calendar.SECOND, calendarBefore30S.get(Calendar.SECOND) - 30); |
| 95 | - for (String key : keys) { | |
| 96 | - CatalogData catalogData = data.get(key); | |
| 97 | - if (catalogData.getLastTime().before(calendarBefore5S.getTime())) { // 超过五秒收不到消息任务超时, 只更新这一部分数据 | |
| 98 | - storager.resetChannels(catalogData.getDevice().getDeviceId(), catalogData.getChannelList()); | |
| 99 | - String errorMsg = "更新成功,共" + catalogData.getTotal() + "条,已更新" + catalogData.getChannelList().size() + "条"; | |
| 104 | + for (String deviceId : keys) { | |
| 105 | + CatalogData catalogData = data.get(deviceId); | |
| 106 | + if ( catalogData.getLastTime().before(calendarBefore5S.getTime())) { // 超过五秒收不到消息任务超时, 只更新这一部分数据 | |
| 107 | + if (catalogData.getStatus().equals(CatalogData.CatalogDataStatus.runIng)) { | |
| 108 | + storager.resetChannels(catalogData.getDevice().getDeviceId(), catalogData.getChannelList()); | |
| 109 | + if (catalogData.getTotal() != catalogData.getChannelList().size()) { | |
| 110 | + String errorMsg = "更新成功,共" + catalogData.getTotal() + "条,已更新" + catalogData.getChannelList().size() + "条"; | |
| 111 | + catalogData.setErrorMsg(errorMsg); | |
| 112 | + } | |
| 113 | + }else if (catalogData.getStatus().equals(CatalogData.CatalogDataStatus.ready)) { | |
| 114 | + String errorMsg = "同步失败,等待回复超时"; | |
| 115 | + catalogData.setErrorMsg(errorMsg); | |
| 116 | + } | |
| 100 | 117 | catalogData.setStatus(CatalogData.CatalogDataStatus.end); |
| 101 | - catalogData.setErrorMsg(errorMsg); | |
| 102 | 118 | } |
| 103 | - if (catalogData.getLastTime().before(calendarBefore30S.getTime())) { // 超过三十秒,如果标记为end则删除 | |
| 104 | - data.remove(key); | |
| 119 | + if (catalogData.getStatus().equals(CatalogData.CatalogDataStatus.end) && catalogData.getLastTime().before(calendarBefore30S.getTime())) { // 超过三十秒,如果标记为end则删除 | |
| 120 | + data.remove(deviceId); | |
| 105 | 121 | } |
| 106 | 122 | } |
| 107 | 123 | } |
| 108 | 124 | |
| 109 | 125 | |
| 110 | - public void setChannelSyncEnd(String key, String errorMsg) { | |
| 111 | - CatalogData catalogData = data.get(key); | |
| 126 | + public void setChannelSyncEnd(String deviceId, String errorMsg) { | |
| 127 | + CatalogData catalogData = data.get(deviceId); | |
| 112 | 128 | if (catalogData == null)return; |
| 113 | 129 | catalogData.setStatus(CatalogData.CatalogDataStatus.end); |
| 114 | 130 | catalogData.setErrorMsg(errorMsg); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/CatalogSubscribeTask.java
| ... | ... | @@ -10,6 +10,8 @@ import org.springframework.scheduling.annotation.Async; |
| 10 | 10 | import javax.sip.Dialog; |
| 11 | 11 | import javax.sip.DialogState; |
| 12 | 12 | import javax.sip.ResponseEvent; |
| 13 | +import java.util.Timer; | |
| 14 | +import java.util.TimerTask; | |
| 13 | 15 | |
| 14 | 16 | /** |
| 15 | 17 | * 目录订阅任务 |
| ... | ... | @@ -20,6 +22,8 @@ public class CatalogSubscribeTask implements ISubscribeTask { |
| 20 | 22 | private final ISIPCommander sipCommander; |
| 21 | 23 | private Dialog dialog; |
| 22 | 24 | |
| 25 | + private Timer timer ; | |
| 26 | + | |
| 23 | 27 | public CatalogSubscribeTask(Device device, ISIPCommander sipCommander) { |
| 24 | 28 | this.device = device; |
| 25 | 29 | this.sipCommander = sipCommander; |
| ... | ... | @@ -27,6 +31,10 @@ public class CatalogSubscribeTask implements ISubscribeTask { |
| 27 | 31 | |
| 28 | 32 | @Override |
| 29 | 33 | public void run() { |
| 34 | + if (timer != null ) { | |
| 35 | + timer.cancel(); | |
| 36 | + timer = null; | |
| 37 | + } | |
| 30 | 38 | sipCommander.catalogSubscribe(device, dialog, eventResult -> { |
| 31 | 39 | if (eventResult.dialog != null || eventResult.dialog.getState().equals(DialogState.CONFIRMED)) { |
| 32 | 40 | dialog = eventResult.dialog; |
| ... | ... | @@ -43,6 +51,13 @@ public class CatalogSubscribeTask implements ISubscribeTask { |
| 43 | 51 | dialog = null; |
| 44 | 52 | // 失败 |
| 45 | 53 | logger.warn("[目录订阅]失败,信令发送失败: {}-{} ", device.getDeviceId(), eventResult.msg); |
| 54 | + timer = new Timer(); | |
| 55 | + timer.schedule(new TimerTask() { | |
| 56 | + @Override | |
| 57 | + public void run() { | |
| 58 | + CatalogSubscribeTask.this.run(); | |
| 59 | + } | |
| 60 | + }, 2000); | |
| 46 | 61 | }); |
| 47 | 62 | } |
| 48 | 63 | |
| ... | ... | @@ -56,9 +71,13 @@ public class CatalogSubscribeTask implements ISubscribeTask { |
| 56 | 71 | * TERMINATED-> Terminated Dialog状态-终止 |
| 57 | 72 | */ |
| 58 | 73 | logger.info("取消目录订阅时dialog状态为{}", DialogState.CONFIRMED); |
| 74 | + if (timer != null ) { | |
| 75 | + timer.cancel(); | |
| 76 | + timer = null; | |
| 77 | + } | |
| 59 | 78 | if (dialog != null && dialog.getState().equals(DialogState.CONFIRMED)) { |
| 60 | 79 | device.setSubscribeCycleForCatalog(0); |
| 61 | - sipCommander.mobilePositionSubscribe(device, dialog, eventResult -> { | |
| 80 | + sipCommander.catalogSubscribe(device, dialog, eventResult -> { | |
| 62 | 81 | ResponseEvent event = (ResponseEvent) eventResult.event; |
| 63 | 82 | if (event.getResponse().getRawContent() != null) { |
| 64 | 83 | // 成功 | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeHandlerTask.java
| ... | ... | @@ -29,7 +29,6 @@ public class MobilePositionSubscribeHandlerTask implements ISubscribeTask { |
| 29 | 29 | private String key; |
| 30 | 30 | |
| 31 | 31 | public MobilePositionSubscribeHandlerTask(IRedisCatchStorage redisCatchStorage, ISIPCommanderForPlatform sipCommanderForPlatform, IVideoManagerStorage storager, String platformId, String sn, String key, SubscribeHolder subscribeInfo) { |
| 32 | - System.out.println("MobilePositionSubscribeHandlerTask 初始化"); | |
| 33 | 32 | this.redisCatchStorage = redisCatchStorage; |
| 34 | 33 | this.storager = storager; |
| 35 | 34 | this.platform = storager.queryParentPlatByServerGBId(platformId); |
| ... | ... | @@ -42,7 +41,6 @@ public class MobilePositionSubscribeHandlerTask implements ISubscribeTask { |
| 42 | 41 | @Override |
| 43 | 42 | public void run() { |
| 44 | 43 | |
| 45 | - logger.info("执行MobilePositionSubscribeHandlerTask"); | |
| 46 | 44 | if (platform == null) return; |
| 47 | 45 | SubscribeInfo subscribe = subscribeHolder.getMobilePositionSubscribe(platform.getServerGBId()); |
| 48 | 46 | if (subscribe != null) { |
| ... | ... | @@ -71,7 +69,6 @@ public class MobilePositionSubscribeHandlerTask implements ISubscribeTask { |
| 71 | 69 | } |
| 72 | 70 | } |
| 73 | 71 | } |
| 74 | - logger.info("结束执行MobilePositionSubscribeHandlerTask"); | |
| 75 | 72 | } |
| 76 | 73 | |
| 77 | 74 | @Override | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java
| ... | ... | @@ -250,7 +250,7 @@ public interface ISIPCommander { |
| 250 | 250 | * |
| 251 | 251 | * @param device 视频设备 |
| 252 | 252 | */ |
| 253 | - boolean catalogQuery(Device device, SipSubscribe.Event errorEvent); | |
| 253 | + boolean catalogQuery(Device device, int sn, SipSubscribe.Event errorEvent); | |
| 254 | 254 | |
| 255 | 255 | /** |
| 256 | 256 | * 查询录像信息 | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| ... | ... | @@ -1208,14 +1208,14 @@ public class SIPCommander implements ISIPCommander { |
| 1208 | 1208 | * @param device 视频设备 |
| 1209 | 1209 | */ |
| 1210 | 1210 | @Override |
| 1211 | - public boolean catalogQuery(Device device, SipSubscribe.Event errorEvent) { | |
| 1211 | + public boolean catalogQuery(Device device, int sn, SipSubscribe.Event errorEvent) { | |
| 1212 | 1212 | try { |
| 1213 | 1213 | StringBuffer catalogXml = new StringBuffer(200); |
| 1214 | 1214 | String charset = device.getCharset(); |
| 1215 | 1215 | catalogXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n"); |
| 1216 | 1216 | catalogXml.append("<Query>\r\n"); |
| 1217 | 1217 | catalogXml.append("<CmdType>Catalog</CmdType>\r\n"); |
| 1218 | - catalogXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | |
| 1218 | + catalogXml.append("<SN>" + sn + "</SN>\r\n"); | |
| 1219 | 1219 | catalogXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n"); |
| 1220 | 1220 | catalogXml.append("</Query>\r\n"); |
| 1221 | 1221 | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
| ... | ... | @@ -32,6 +32,7 @@ import javax.sip.header.*; |
| 32 | 32 | import javax.sip.message.Request; |
| 33 | 33 | import java.lang.reflect.Field; |
| 34 | 34 | import java.text.ParseException; |
| 35 | +import java.util.ArrayList; | |
| 35 | 36 | import java.util.HashSet; |
| 36 | 37 | import java.util.List; |
| 37 | 38 | import java.util.UUID; |
| ... | ... | @@ -215,7 +216,11 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { |
| 215 | 216 | return false; |
| 216 | 217 | } |
| 217 | 218 | try { |
| 218 | - String catalogXml = getCatalogXml(channel, sn, parentPlatform, size); | |
| 219 | + List<DeviceChannel> channels = new ArrayList<>(); | |
| 220 | + if (channel != null) { | |
| 221 | + channels.add(channel); | |
| 222 | + } | |
| 223 | + String catalogXml = getCatalogXml(channels, sn, parentPlatform, size); | |
| 219 | 224 | |
| 220 | 225 | // callid |
| 221 | 226 | CallIdHeader callIdHeader = parentPlatform.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() |
| ... | ... | @@ -239,7 +244,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { |
| 239 | 244 | sendCatalogResponse(channels, parentPlatform, sn, fromTag, 0); |
| 240 | 245 | return true; |
| 241 | 246 | } |
| 242 | - private String getCatalogXml(DeviceChannel channel, String sn, ParentPlatform parentPlatform, int size) { | |
| 247 | + private String getCatalogXml(List<DeviceChannel> channels, String sn, ParentPlatform parentPlatform, int size) { | |
| 243 | 248 | String characterSet = parentPlatform.getCharacterSet(); |
| 244 | 249 | StringBuffer catalogXml = new StringBuffer(600); |
| 245 | 250 | catalogXml.append("<?xml version=\"1.0\" encoding=\"" + characterSet +"\"?>\r\n"); |
| ... | ... | @@ -248,34 +253,38 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { |
| 248 | 253 | catalogXml.append("<SN>" +sn + "</SN>\r\n"); |
| 249 | 254 | catalogXml.append("<DeviceID>" + parentPlatform.getDeviceGBId() + "</DeviceID>\r\n"); |
| 250 | 255 | catalogXml.append("<SumNum>" + size + "</SumNum>\r\n"); |
| 251 | - catalogXml.append("<DeviceList Num=\"1\">\r\n"); | |
| 252 | - catalogXml.append("<Item>\r\n"); | |
| 253 | - if (channel != null) { | |
| 254 | - catalogXml.append("<DeviceID>" + channel.getChannelId() + "</DeviceID>\r\n"); | |
| 255 | - catalogXml.append("<Name>" + channel.getName() + "</Name>\r\n"); | |
| 256 | - catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n"); | |
| 257 | - catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n"); | |
| 258 | - catalogXml.append("<Owner>" + channel.getOwner() + "</Owner>\r\n"); | |
| 259 | - catalogXml.append("<CivilCode>" + channel.getCivilCode() + "</CivilCode>\r\n"); | |
| 260 | - catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n"); | |
| 261 | - catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n"); | |
| 262 | - if (channel.getParentId() != null) { | |
| 263 | - catalogXml.append("<ParentID>" + channel.getParentId() + "</ParentID>\r\n"); | |
| 256 | + catalogXml.append("<DeviceList Num=\"" + channels.size() +"\">\r\n"); | |
| 257 | + if (channels.size() > 0) { | |
| 258 | + for (DeviceChannel channel : channels) { | |
| 259 | + catalogXml.append("<Item>\r\n"); | |
| 260 | + catalogXml.append("<DeviceID>" + channel.getChannelId() + "</DeviceID>\r\n"); | |
| 261 | + catalogXml.append("<Name>" + channel.getName() + "</Name>\r\n"); | |
| 262 | + catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n"); | |
| 263 | + catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n"); | |
| 264 | + if (channel.getParentId() != null) { | |
| 265 | + catalogXml.append("<ParentID>" + channel.getParentId() + "</ParentID>\r\n"); | |
| 266 | + } | |
| 267 | + catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n"); | |
| 268 | + catalogXml.append("<Status>" + (channel.getStatus() == 0?"OFF":"ON") + "</Status>\r\n"); | |
| 269 | + catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n"); | |
| 270 | + if (channel.getChannelType() != 2) { // 业务分组/虚拟组织/行政区划 不设置以下字段 | |
| 271 | + catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n"); | |
| 272 | + catalogXml.append("<Owner>" + channel.getOwner() + "</Owner>\r\n"); | |
| 273 | + catalogXml.append("<CivilCode>" + channel.getCivilCode() + "</CivilCode>\r\n"); | |
| 274 | + catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n"); | |
| 275 | + catalogXml.append("<Longitude>" + channel.getLongitude() + "</Longitude>\r\n"); | |
| 276 | + catalogXml.append("<Latitude>" + channel.getLatitude() + "</Latitude>\r\n"); | |
| 277 | + catalogXml.append("<IPAddress>" + channel.getIpAddress() + "</IPAddress>\r\n"); | |
| 278 | + catalogXml.append("<Port>" + channel.getPort() + "</Port>\r\n"); | |
| 279 | + catalogXml.append("<Info>\r\n"); | |
| 280 | + catalogXml.append("<PTZType>" + channel.getPTZType() + "</PTZType>\r\n"); | |
| 281 | + catalogXml.append("</Info>\r\n"); | |
| 282 | + } | |
| 283 | + | |
| 284 | + catalogXml.append("</Item>\r\n"); | |
| 264 | 285 | } |
| 265 | - catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n"); | |
| 266 | - catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n"); | |
| 267 | - catalogXml.append("<Status>" + (channel.getStatus() == 0?"OFF":"ON") + "</Status>\r\n"); | |
| 268 | - catalogXml.append("<Longitude>" + channel.getLongitude() + "</Longitude>\r\n"); | |
| 269 | - catalogXml.append("<Latitude>" + channel.getLatitude() + "</Latitude>\r\n"); | |
| 270 | - catalogXml.append("<IPAddress>" + channel.getIpAddress() + "</IPAddress>\r\n"); | |
| 271 | - catalogXml.append("<Port>" + channel.getPort() + "</Port>\r\n"); | |
| 272 | - catalogXml.append("<Info>\r\n"); | |
| 273 | - catalogXml.append("<PTZType>" + channel.getPTZType() + "</PTZType>\r\n"); | |
| 274 | - catalogXml.append("</Info>\r\n"); | |
| 275 | 286 | } |
| 276 | 287 | |
| 277 | - | |
| 278 | - catalogXml.append("</Item>\r\n"); | |
| 279 | 288 | catalogXml.append("</DeviceList>\r\n"); |
| 280 | 289 | catalogXml.append("</Response>\r\n"); |
| 281 | 290 | return catalogXml.toString(); |
| ... | ... | @@ -286,15 +295,20 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { |
| 286 | 295 | return; |
| 287 | 296 | } |
| 288 | 297 | try { |
| 289 | - DeviceChannel deviceChannel = channels.get(index); | |
| 290 | - String catalogXml = getCatalogXml(deviceChannel, sn, parentPlatform, channels.size()); | |
| 298 | + List<DeviceChannel> deviceChannels; | |
| 299 | + if (index + parentPlatform.getCatalogGroup() < channels.size()) { | |
| 300 | + deviceChannels = channels.subList(index, index + parentPlatform.getCatalogGroup()); | |
| 301 | + }else { | |
| 302 | + deviceChannels = channels.subList(index, channels.size()); | |
| 303 | + } | |
| 304 | + String catalogXml = getCatalogXml(deviceChannels, sn, parentPlatform, channels.size()); | |
| 291 | 305 | // callid |
| 292 | 306 | CallIdHeader callIdHeader = parentPlatform.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() |
| 293 | 307 | : udpSipProvider.getNewCallId(); |
| 294 | 308 | |
| 295 | 309 | Request request = headerProviderPlarformProvider.createMessageRequest(parentPlatform, catalogXml, fromTag, callIdHeader); |
| 296 | 310 | transmitRequest(parentPlatform, request, null, eventResult -> { |
| 297 | - int indexNext = index + 1; | |
| 311 | + int indexNext = index + parentPlatform.getCatalogGroup(); | |
| 298 | 312 | sendCatalogResponse(channels, parentPlatform, sn, fromTag, indexNext); |
| 299 | 313 | }); |
| 300 | 314 | } catch (SipException | ParseException | InvalidArgumentException e) { |
| ... | ... | @@ -432,13 +446,21 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { |
| 432 | 446 | if (index >= deviceChannels.size()) { |
| 433 | 447 | return true; |
| 434 | 448 | } |
| 449 | + List<DeviceChannel> channels; | |
| 450 | + if (index + parentPlatform.getCatalogGroup() < deviceChannels.size()) { | |
| 451 | + channels = deviceChannels.subList(index, index + parentPlatform.getCatalogGroup()); | |
| 452 | + }else { | |
| 453 | + channels = deviceChannels.subList(index, deviceChannels.size()); | |
| 454 | + } | |
| 435 | 455 | try { |
| 436 | 456 | Integer finalIndex = index; |
| 437 | - String catalogXmlContent = getCatalogXmlContentForCatalogAddOrUpdate(parentPlatform, deviceChannels.get(index ), deviceChannels.size(), type, subscribeInfo); | |
| 457 | + String catalogXmlContent = getCatalogXmlContentForCatalogAddOrUpdate(parentPlatform, channels, | |
| 458 | + deviceChannels.size(), type, subscribeInfo); | |
| 438 | 459 | sendNotify(parentPlatform, catalogXmlContent, subscribeInfo, eventResult -> { |
| 439 | 460 | logger.error("发送NOTIFY通知消息失败。错误:{} {}", eventResult.statusCode, eventResult.msg); |
| 440 | 461 | }, (eventResult -> { |
| 441 | - sendNotifyForCatalogAddOrUpdate(type, parentPlatform, deviceChannels, subscribeInfo, finalIndex + 1); | |
| 462 | + sendNotifyForCatalogAddOrUpdate(type, parentPlatform, deviceChannels, subscribeInfo, | |
| 463 | + finalIndex + parentPlatform.getCatalogGroup()); | |
| 442 | 464 | })); |
| 443 | 465 | } catch (SipException | ParseException e) { |
| 444 | 466 | e.printStackTrace(); |
| ... | ... | @@ -500,11 +522,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { |
| 500 | 522 | |
| 501 | 523 | } |
| 502 | 524 | |
| 503 | - private String getCatalogXmlContentForCatalogAddOrUpdate(ParentPlatform parentPlatform, DeviceChannel channel, int sumNum, String type, SubscribeInfo subscribeInfo) { | |
| 525 | + private String getCatalogXmlContentForCatalogAddOrUpdate(ParentPlatform parentPlatform, List<DeviceChannel> channels, int sumNum, String type, SubscribeInfo subscribeInfo) { | |
| 504 | 526 | StringBuffer catalogXml = new StringBuffer(600); |
| 505 | - if (parentPlatform.getServerGBId().equals(channel.getParentId())) { | |
| 506 | - channel.setParentId(parentPlatform.getDeviceGBId()); | |
| 507 | - } | |
| 527 | + | |
| 508 | 528 | String characterSet = parentPlatform.getCharacterSet(); |
| 509 | 529 | catalogXml.append("<?xml version=\"1.0\" encoding=\"" + characterSet + "\"?>\r\n"); |
| 510 | 530 | catalogXml.append("<Notify>\r\n"); |
| ... | ... | @@ -512,26 +532,35 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { |
| 512 | 532 | catalogXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); |
| 513 | 533 | catalogXml.append("<DeviceID>" + parentPlatform.getDeviceGBId() + "</DeviceID>\r\n"); |
| 514 | 534 | catalogXml.append("<SumNum>1</SumNum>\r\n"); |
| 515 | - catalogXml.append("<DeviceList Num=\"1\">\r\n"); | |
| 516 | - catalogXml.append("<Item>\r\n"); | |
| 517 | - catalogXml.append("<DeviceID>" + channel.getChannelId() + "</DeviceID>\r\n"); | |
| 518 | - catalogXml.append("<Name>" + channel.getName() + "</Name>\r\n"); | |
| 519 | - catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n"); | |
| 520 | - catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n"); | |
| 521 | - catalogXml.append("<Owner>0</Owner>\r\n"); | |
| 522 | - catalogXml.append("<CivilCode>CivilCode</CivilCode>\r\n"); | |
| 523 | - catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n"); | |
| 524 | - catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n"); | |
| 525 | - if (channel.getParentId() != null) { | |
| 526 | - catalogXml.append("<ParentID>" + channel.getParentId() + "</ParentID>\r\n"); | |
| 527 | - } | |
| 528 | - catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n"); | |
| 529 | - catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n"); | |
| 530 | - catalogXml.append("<Status>" + (channel.getStatus() == 0 ? "OFF" : "ON") + "</Status>\r\n"); | |
| 531 | - if (!"presence".equals(subscribeInfo.getEventType())) { | |
| 532 | - catalogXml.append("<Event>" + type + "</Event>\r\n"); | |
| 533 | - } | |
| 534 | - catalogXml.append("</Item>\r\n"); | |
| 535 | + catalogXml.append("<DeviceList Num=\"" + channels.size() + "\">\r\n"); | |
| 536 | + if (channels.size() > 0) { | |
| 537 | + for (DeviceChannel channel : channels) { | |
| 538 | + if (parentPlatform.getServerGBId().equals(channel.getParentId())) { | |
| 539 | + channel.setParentId(parentPlatform.getDeviceGBId()); | |
| 540 | + } | |
| 541 | + catalogXml.append("<Item>\r\n"); | |
| 542 | + catalogXml.append("<DeviceID>" + channel.getChannelId() + "</DeviceID>\r\n"); | |
| 543 | + catalogXml.append("<Name>" + channel.getName() + "</Name>\r\n"); | |
| 544 | + catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n"); | |
| 545 | + catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n"); | |
| 546 | + if (channel.getParentId() != null) { | |
| 547 | + catalogXml.append("<ParentID>" + channel.getParentId() + "</ParentID>\r\n"); | |
| 548 | + } | |
| 549 | + catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n"); | |
| 550 | + catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n"); | |
| 551 | + catalogXml.append("<Status>" + (channel.getStatus() == 0 ? "OFF" : "ON") + "</Status>\r\n"); | |
| 552 | + if (channel.getChannelType() == 2) { // 业务分组/虚拟组织/行政区划 不设置以下属性 | |
| 553 | + catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n"); | |
| 554 | + catalogXml.append("<Owner>0</Owner>\r\n"); | |
| 555 | + catalogXml.append("<CivilCode>CivilCode</CivilCode>\r\n"); | |
| 556 | + catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n"); | |
| 557 | + } | |
| 558 | + if (!"presence".equals(subscribeInfo.getEventType())) { | |
| 559 | + catalogXml.append("<Event>" + type + "</Event>\r\n"); | |
| 560 | + } | |
| 561 | + catalogXml.append("</Item>\r\n"); | |
| 562 | + } | |
| 563 | + } | |
| 535 | 564 | catalogXml.append("</DeviceList>\r\n"); |
| 536 | 565 | catalogXml.append("</Notify>\r\n"); |
| 537 | 566 | return catalogXml.toString(); |
| ... | ... | @@ -553,13 +582,20 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { |
| 553 | 582 | if (index >= deviceChannels.size()) { |
| 554 | 583 | return true; |
| 555 | 584 | } |
| 585 | + List<DeviceChannel> channels; | |
| 586 | + if (index + parentPlatform.getCatalogGroup() < deviceChannels.size()) { | |
| 587 | + channels = deviceChannels.subList(index, index + parentPlatform.getCatalogGroup()); | |
| 588 | + }else { | |
| 589 | + channels = deviceChannels.subList(index, deviceChannels.size()); | |
| 590 | + } | |
| 556 | 591 | try { |
| 557 | 592 | Integer finalIndex = index; |
| 558 | - String catalogXmlContent = getCatalogXmlContentForCatalogOther(parentPlatform, deviceChannels.get(index), type); | |
| 593 | + String catalogXmlContent = getCatalogXmlContentForCatalogOther(parentPlatform, channels, type); | |
| 559 | 594 | sendNotify(parentPlatform, catalogXmlContent, subscribeInfo, eventResult -> { |
| 560 | 595 | logger.error("发送NOTIFY通知消息失败。错误:{} {}", eventResult.statusCode, eventResult.msg); |
| 561 | 596 | }, (eventResult -> { |
| 562 | - sendNotifyForCatalogOther(type, parentPlatform, deviceChannels, subscribeInfo, finalIndex + 1); | |
| 597 | + sendNotifyForCatalogOther(type, parentPlatform, deviceChannels, subscribeInfo, | |
| 598 | + finalIndex + parentPlatform.getCatalogGroup()); | |
| 563 | 599 | })); |
| 564 | 600 | } catch (SipException e) { |
| 565 | 601 | e.printStackTrace(); |
| ... | ... | @@ -574,10 +610,8 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { |
| 574 | 610 | return true; |
| 575 | 611 | } |
| 576 | 612 | |
| 577 | - private String getCatalogXmlContentForCatalogOther(ParentPlatform parentPlatform, DeviceChannel channel, String type) { | |
| 578 | - if (parentPlatform.getServerGBId().equals(channel.getParentId())) { | |
| 579 | - channel.setParentId(parentPlatform.getDeviceGBId()); | |
| 580 | - } | |
| 613 | + private String getCatalogXmlContentForCatalogOther(ParentPlatform parentPlatform, List<DeviceChannel> channels, String type) { | |
| 614 | + | |
| 581 | 615 | String characterSet = parentPlatform.getCharacterSet(); |
| 582 | 616 | StringBuffer catalogXml = new StringBuffer(600); |
| 583 | 617 | catalogXml.append("<?xml version=\"1.0\" encoding=\"" + characterSet + "\"?>\r\n"); |
| ... | ... | @@ -586,11 +620,18 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { |
| 586 | 620 | catalogXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n"); |
| 587 | 621 | catalogXml.append("<DeviceID>" + parentPlatform.getDeviceGBId() + "</DeviceID>\r\n"); |
| 588 | 622 | catalogXml.append("<SumNum>1</SumNum>\r\n"); |
| 589 | - catalogXml.append("<DeviceList Num=\"1\">\r\n"); | |
| 590 | - catalogXml.append("<Item>\r\n"); | |
| 591 | - catalogXml.append("<DeviceID>" + channel.getChannelId() + "</DeviceID>\r\n"); | |
| 592 | - catalogXml.append("<Event>" + type + "</Event>\r\n"); | |
| 593 | - catalogXml.append("</Item>\r\n"); | |
| 623 | + catalogXml.append("<DeviceList Num=\" " + channels.size() + " \">\r\n"); | |
| 624 | + if (channels.size() > 0) { | |
| 625 | + for (DeviceChannel channel : channels) { | |
| 626 | + if (parentPlatform.getServerGBId().equals(channel.getParentId())) { | |
| 627 | + channel.setParentId(parentPlatform.getDeviceGBId()); | |
| 628 | + } | |
| 629 | + catalogXml.append("<Item>\r\n"); | |
| 630 | + catalogXml.append("<DeviceID>" + channel.getChannelId() + "</DeviceID>\r\n"); | |
| 631 | + catalogXml.append("<Event>" + type + "</Event>\r\n"); | |
| 632 | + catalogXml.append("</Item>\r\n"); | |
| 633 | + } | |
| 634 | + } | |
| 594 | 635 | catalogXml.append("</DeviceList>\r\n"); |
| 595 | 636 | catalogXml.append("</Notify>\r\n"); |
| 596 | 637 | return catalogXml.toString(); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
| ... | ... | @@ -397,6 +397,10 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 397 | 397 | logger.info("[ app={}, stream={} ]通道离线,启用流后开始推流",gbStream.getApp(), gbStream.getStream()); |
| 398 | 398 | responseAck(evt, Response.BAD_REQUEST, "channel [" + gbStream.getGbId() + "] offline"); |
| 399 | 399 | }else if ("push".equals(gbStream.getStreamType())) { |
| 400 | + if (!platform.isStartOfflinePush()) { | |
| 401 | + responseAck(evt, Response.TEMPORARILY_UNAVAILABLE, "channel unavailable"); | |
| 402 | + return; | |
| 403 | + } | |
| 400 | 404 | // 发送redis消息以使设备上线 |
| 401 | 405 | logger.info("[ app={}, stream={} ]通道离线,发送redis信息控制设备开始推流",gbStream.getApp(), gbStream.getStream()); |
| 402 | 406 | MessageForPushChannel messageForPushChannel = new MessageForPushChannel(); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java
| ... | ... | @@ -3,7 +3,6 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; |
| 3 | 3 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 4 | 4 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 5 | 5 | import com.genersoft.iot.vmp.gb28181.auth.DigestServerAuthenticationHelper; |
| 6 | -import com.genersoft.iot.vmp.gb28181.auth.RegisterLogicHandler; | |
| 7 | 6 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 8 | 7 | import com.genersoft.iot.vmp.gb28181.bean.WvpSipDate; |
| 9 | 8 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| ... | ... | @@ -42,166 +41,157 @@ import java.util.Locale; |
| 42 | 41 | @Component |
| 43 | 42 | public class RegisterRequestProcessor extends SIPRequestProcessorParent implements InitializingBean, ISIPRequestProcessor { |
| 44 | 43 | |
| 45 | - private Logger logger = LoggerFactory.getLogger(RegisterRequestProcessor.class); | |
| 46 | - | |
| 47 | - public String method = "REGISTER"; | |
| 48 | - | |
| 49 | - @Autowired | |
| 50 | - private SipConfig sipConfig; | |
| 51 | - | |
| 52 | - @Autowired | |
| 53 | - private RegisterLogicHandler handler; | |
| 54 | - | |
| 55 | - @Autowired | |
| 56 | - private IRedisCatchStorage redisCatchStorage; | |
| 57 | - | |
| 58 | - @Autowired | |
| 59 | - private IVideoManagerStorage storager; | |
| 60 | - | |
| 61 | - @Autowired | |
| 62 | - private EventPublisher publisher; | |
| 63 | - | |
| 64 | - @Autowired | |
| 65 | - private SIPProcessorObserver sipProcessorObserver; | |
| 66 | - | |
| 67 | - @Override | |
| 68 | - public void afterPropertiesSet() throws Exception { | |
| 69 | - // 添加消息处理的订阅 | |
| 70 | - sipProcessorObserver.addRequestProcessor(method, this); | |
| 71 | - } | |
| 72 | - | |
| 73 | - /** | |
| 74 | - * 收到注册请求 处理 | |
| 75 | - * @param evt | |
| 76 | - */ | |
| 77 | - @Override | |
| 78 | - public void process(RequestEvent evt) { | |
| 79 | - try { | |
| 80 | - RequestEventExt evtExt = (RequestEventExt)evt; | |
| 81 | - String requestAddress = evtExt.getRemoteIpAddress() + ":" + evtExt.getRemotePort(); | |
| 82 | - logger.info("[{}] 收到注册请求,开始处理", requestAddress); | |
| 83 | - Request request = evt.getRequest(); | |
| 84 | - ExpiresHeader expiresHeader = (ExpiresHeader) request.getHeader(Expires.NAME); | |
| 85 | - Response response = null; | |
| 86 | - boolean passwordCorrect = false; | |
| 87 | - // 注册标志 0:未携带授权头或者密码错误 1:注册成功 2:注销成功 | |
| 88 | - int registerFlag = 0; | |
| 89 | - FromHeader fromHeader = (FromHeader) request.getHeader(FromHeader.NAME); | |
| 90 | - AddressImpl address = (AddressImpl) fromHeader.getAddress(); | |
| 91 | - SipUri uri = (SipUri) address.getURI(); | |
| 92 | - String deviceId = uri.getUser(); | |
| 93 | - Device deviceInRedis = redisCatchStorage.getDevice(deviceId); | |
| 94 | - Device device = storager.queryVideoDevice(deviceId); | |
| 95 | - if (deviceInRedis != null && device == null) { | |
| 96 | - // redis 存在脏数据 | |
| 97 | - redisCatchStorage.clearCatchByDeviceId(deviceId); | |
| 98 | - } | |
| 99 | - AuthorizationHeader authorhead = (AuthorizationHeader) request.getHeader(AuthorizationHeader.NAME); | |
| 100 | - // 校验密码是否正确 | |
| 101 | - if (authorhead != null) { | |
| 102 | - passwordCorrect = new DigestServerAuthenticationHelper().doAuthenticatePlainTextPassword(request, | |
| 103 | - sipConfig.getPassword()); | |
| 104 | - } | |
| 105 | - if (StringUtils.isEmpty(sipConfig.getPassword())){ | |
| 106 | - passwordCorrect = true; | |
| 107 | - } | |
| 108 | - | |
| 109 | - // 未携带授权头或者密码错误 回复401 | |
| 110 | - if (authorhead == null ) { | |
| 111 | - | |
| 112 | - logger.info("[{}] 未携带授权头 回复401", requestAddress); | |
| 113 | - response = getMessageFactory().createResponse(Response.UNAUTHORIZED, request); | |
| 114 | - new DigestServerAuthenticationHelper().generateChallenge(getHeaderFactory(), response, sipConfig.getDomain()); | |
| 115 | - }else { | |
| 116 | - if (!passwordCorrect){ | |
| 117 | - // 注册失败 | |
| 118 | - response = getMessageFactory().createResponse(Response.FORBIDDEN, request); | |
| 119 | - response.setReasonPhrase("wrong password"); | |
| 120 | - logger.info("[{}] 密码/SIP服务器ID错误, 回复403", requestAddress); | |
| 121 | - }else { | |
| 122 | - // 携带授权头并且密码正确 | |
| 123 | - response = getMessageFactory().createResponse(Response.OK, request); | |
| 124 | - // 添加date头 | |
| 125 | - SIPDateHeader dateHeader = new SIPDateHeader(); | |
| 126 | - // 使用自己修改的 | |
| 127 | - WvpSipDate wvpSipDate = new WvpSipDate(Calendar.getInstance(Locale.ENGLISH).getTimeInMillis()); | |
| 128 | - dateHeader.setDate(wvpSipDate); | |
| 129 | - response.addHeader(dateHeader); | |
| 130 | - | |
| 131 | - | |
| 132 | - if (expiresHeader == null) { | |
| 133 | - response = getMessageFactory().createResponse(Response.BAD_REQUEST, request); | |
| 134 | - ServerTransaction serverTransaction = getServerTransaction(evt); | |
| 135 | - serverTransaction.sendResponse(response); | |
| 136 | - if (serverTransaction.getDialog() != null) serverTransaction.getDialog().delete(); | |
| 137 | - return; | |
| 138 | - } | |
| 139 | - // 添加Contact头 | |
| 140 | - response.addHeader(request.getHeader(ContactHeader.NAME)); | |
| 141 | - // 添加Expires头 | |
| 142 | - response.addHeader(request.getExpires()); | |
| 143 | - | |
| 144 | - // 获取到通信地址等信息 | |
| 145 | - ViaHeader viaHeader = (ViaHeader) request.getHeader(ViaHeader.NAME); | |
| 146 | - String received = viaHeader.getReceived(); | |
| 147 | - int rPort = viaHeader.getRPort(); | |
| 148 | - // 解析本地地址替代 | |
| 149 | - if (StringUtils.isEmpty(received) || rPort == -1) { | |
| 150 | - received = viaHeader.getHost(); | |
| 151 | - rPort = viaHeader.getPort(); | |
| 152 | - } | |
| 153 | - // | |
| 154 | - | |
| 155 | - if (device == null) { | |
| 156 | - device = new Device(); | |
| 157 | - device.setStreamMode("UDP"); | |
| 158 | - device.setCharset("GB2312"); | |
| 159 | - device.setDeviceId(deviceId); | |
| 160 | - device.setFirsRegister(true); | |
| 161 | - }else { | |
| 162 | - if (device.getOnline() == 0) { | |
| 163 | - device.setFirsRegister(true); | |
| 164 | - } | |
| 165 | - } | |
| 166 | - device.setIp(received); | |
| 167 | - device.setPort(rPort); | |
| 168 | - device.setHostAddress(received.concat(":").concat(String.valueOf(rPort))); | |
| 169 | - // 注销成功 | |
| 170 | - if (expiresHeader.getExpires() == 0) { | |
| 171 | - registerFlag = 2; | |
| 172 | - } | |
| 173 | - // 注册成功 | |
| 174 | - else { | |
| 175 | - device.setExpires(expiresHeader.getExpires()); | |
| 176 | - registerFlag = 1; | |
| 177 | - // 判断TCP还是UDP | |
| 178 | - boolean isTcp = false; | |
| 179 | - ViaHeader reqViaHeader = (ViaHeader) request.getHeader(ViaHeader.NAME); | |
| 180 | - String transport = reqViaHeader.getTransport(); | |
| 181 | - if (transport.equals("TCP")) { | |
| 182 | - isTcp = true; | |
| 183 | - } | |
| 184 | - device.setTransport(isTcp ? "TCP" : "UDP"); | |
| 185 | - } | |
| 186 | - } | |
| 187 | - } | |
| 188 | - | |
| 189 | - ServerTransaction serverTransaction = getServerTransaction(evt); | |
| 190 | - serverTransaction.sendResponse(response); | |
| 191 | - if (serverTransaction.getDialog() != null) serverTransaction.getDialog().delete(); | |
| 192 | - // 注册成功 | |
| 193 | - // 保存到redis | |
| 194 | - if (registerFlag == 1 ) { | |
| 195 | - logger.info("[{}] 注册成功! deviceId:" + device.getDeviceId(), requestAddress); | |
| 196 | - publisher.onlineEventPublish(device, VideoManagerConstants.EVENT_ONLINE_REGISTER, expiresHeader.getExpires()); | |
| 197 | - } else if (registerFlag == 2) { | |
| 198 | - logger.info("[{}] 注销成功! deviceId:" + device.getDeviceId(), requestAddress); | |
| 199 | - publisher.outlineEventPublish(device.getDeviceId(), VideoManagerConstants.EVENT_OUTLINE_UNREGISTER); | |
| 200 | - } | |
| 201 | - } catch (SipException | InvalidArgumentException | NoSuchAlgorithmException | ParseException e) { | |
| 202 | - e.printStackTrace(); | |
| 203 | - } | |
| 204 | - | |
| 205 | - } | |
| 44 | + private final Logger logger = LoggerFactory.getLogger(RegisterRequestProcessor.class); | |
| 45 | + | |
| 46 | + public String method = "REGISTER"; | |
| 47 | + | |
| 48 | + @Autowired | |
| 49 | + private SipConfig sipConfig; | |
| 50 | + | |
| 51 | + @Autowired | |
| 52 | + private IRedisCatchStorage redisCatchStorage; | |
| 53 | + | |
| 54 | + @Autowired | |
| 55 | + private IVideoManagerStorage storager; | |
| 56 | + | |
| 57 | + @Autowired | |
| 58 | + private EventPublisher publisher; | |
| 59 | + | |
| 60 | + @Autowired | |
| 61 | + private SIPProcessorObserver sipProcessorObserver; | |
| 62 | + | |
| 63 | + @Override | |
| 64 | + public void afterPropertiesSet() throws Exception { | |
| 65 | + // 添加消息处理的订阅 | |
| 66 | + sipProcessorObserver.addRequestProcessor(method, this); | |
| 67 | + } | |
| 68 | + | |
| 69 | + /** | |
| 70 | + * 收到注册请求 处理 | |
| 71 | + * | |
| 72 | + * @param evt | |
| 73 | + */ | |
| 74 | + @Override | |
| 75 | + public void process(RequestEvent evt) { | |
| 76 | + try { | |
| 77 | + RequestEventExt evtExt = (RequestEventExt) evt; | |
| 78 | + String requestAddress = evtExt.getRemoteIpAddress() + ":" + evtExt.getRemotePort(); | |
| 79 | + logger.info("[{}] 收到注册请求,开始处理", requestAddress); | |
| 80 | + Request request = evt.getRequest(); | |
| 81 | + ExpiresHeader expiresHeader = (ExpiresHeader) request.getHeader(Expires.NAME); | |
| 82 | + Response response = null; | |
| 83 | + boolean passwordCorrect = false; | |
| 84 | + // 注册标志 0:未携带授权头或者密码错误 1:注册成功 2:注销成功 | |
| 85 | + int registerFlag = 0; | |
| 86 | + FromHeader fromHeader = (FromHeader) request.getHeader(FromHeader.NAME); | |
| 87 | + AddressImpl address = (AddressImpl) fromHeader.getAddress(); | |
| 88 | + SipUri uri = (SipUri) address.getURI(); | |
| 89 | + String deviceId = uri.getUser(); | |
| 90 | + | |
| 91 | + AuthorizationHeader authHead = (AuthorizationHeader) request.getHeader(AuthorizationHeader.NAME); | |
| 92 | + if (authHead == null) { | |
| 93 | + logger.info("[{}] 未携带授权头 回复401", requestAddress); | |
| 94 | + response = getMessageFactory().createResponse(Response.UNAUTHORIZED, request); | |
| 95 | + new DigestServerAuthenticationHelper().generateChallenge(getHeaderFactory(), response, sipConfig.getDomain()); | |
| 96 | + sendResponse(evt, response); | |
| 97 | + return; | |
| 98 | + } | |
| 99 | + | |
| 100 | + // 校验密码是否正确 | |
| 101 | + passwordCorrect = StringUtils.isEmpty(sipConfig.getPassword()) || | |
| 102 | + new DigestServerAuthenticationHelper().doAuthenticatePlainTextPassword(request, sipConfig.getPassword()); | |
| 103 | + // 未携带授权头或者密码错误 回复401 | |
| 104 | + | |
| 105 | + if (!passwordCorrect) { | |
| 106 | + // 注册失败 | |
| 107 | + response = getMessageFactory().createResponse(Response.FORBIDDEN, request); | |
| 108 | + response.setReasonPhrase("wrong password"); | |
| 109 | + logger.info("[{}] 密码/SIP服务器ID错误, 回复403", requestAddress); | |
| 110 | + sendResponse(evt, response); | |
| 111 | + return; | |
| 112 | + } | |
| 113 | + | |
| 114 | + Device deviceInRedis = redisCatchStorage.getDevice(deviceId); | |
| 115 | + Device device = storager.queryVideoDevice(deviceId); | |
| 116 | + if (deviceInRedis != null && device == null) { | |
| 117 | + // redis 存在脏数据 | |
| 118 | + redisCatchStorage.clearCatchByDeviceId(deviceId); | |
| 119 | + } | |
| 120 | + // 携带授权头并且密码正确 | |
| 121 | + response = getMessageFactory().createResponse(Response.OK, request); | |
| 122 | + // 添加date头 | |
| 123 | + SIPDateHeader dateHeader = new SIPDateHeader(); | |
| 124 | + // 使用自己修改的 | |
| 125 | + WvpSipDate wvpSipDate = new WvpSipDate(Calendar.getInstance(Locale.ENGLISH).getTimeInMillis()); | |
| 126 | + dateHeader.setDate(wvpSipDate); | |
| 127 | + response.addHeader(dateHeader); | |
| 128 | + | |
| 129 | + if (expiresHeader == null) { | |
| 130 | + response = getMessageFactory().createResponse(Response.BAD_REQUEST, request); | |
| 131 | + ServerTransaction serverTransaction = getServerTransaction(evt); | |
| 132 | + serverTransaction.sendResponse(response); | |
| 133 | + if (serverTransaction.getDialog() != null) serverTransaction.getDialog().delete(); | |
| 134 | + return; | |
| 135 | + } | |
| 136 | + // 添加Contact头 | |
| 137 | + response.addHeader(request.getHeader(ContactHeader.NAME)); | |
| 138 | + // 添加Expires头 | |
| 139 | + response.addHeader(request.getExpires()); | |
| 140 | + | |
| 141 | + // 获取到通信地址等信息 | |
| 142 | + ViaHeader viaHeader = (ViaHeader) request.getHeader(ViaHeader.NAME); | |
| 143 | + String received = viaHeader.getReceived(); | |
| 144 | + int rPort = viaHeader.getRPort(); | |
| 145 | + // 解析本地地址替代 | |
| 146 | + if (StringUtils.isEmpty(received) || rPort == -1) { | |
| 147 | + received = viaHeader.getHost(); | |
| 148 | + rPort = viaHeader.getPort(); | |
| 149 | + } | |
| 150 | + if (device == null) { | |
| 151 | + device = new Device(); | |
| 152 | + device.setStreamMode("UDP"); | |
| 153 | + device.setCharset("GB2312"); | |
| 154 | + device.setDeviceId(deviceId); | |
| 155 | + device.setFirsRegister(true); | |
| 156 | + } else { | |
| 157 | + device.setFirsRegister(device.getOnline() == 0); | |
| 158 | + } | |
| 159 | + device.setIp(received); | |
| 160 | + device.setPort(rPort); | |
| 161 | + device.setHostAddress(received.concat(":").concat(String.valueOf(rPort))); | |
| 162 | + if (expiresHeader.getExpires() == 0) { | |
| 163 | + // 注销成功 | |
| 164 | + registerFlag = 2; | |
| 165 | + } else { | |
| 166 | + // 注册成功 | |
| 167 | + device.setExpires(expiresHeader.getExpires()); | |
| 168 | + registerFlag = 1; | |
| 169 | + // 判断TCP还是UDP | |
| 170 | + ViaHeader reqViaHeader = (ViaHeader) request.getHeader(ViaHeader.NAME); | |
| 171 | + String transport = reqViaHeader.getTransport(); | |
| 172 | + device.setTransport("TCP".equals(transport) ? "TCP" : "UDP"); | |
| 173 | + } | |
| 174 | + | |
| 175 | + sendResponse(evt, response); | |
| 176 | + // 注册成功 | |
| 177 | + // 保存到redis | |
| 178 | + if (registerFlag == 1) { | |
| 179 | + logger.info("[{}] 注册成功! deviceId:" + deviceId, requestAddress); | |
| 180 | + publisher.onlineEventPublish(device, VideoManagerConstants.EVENT_ONLINE_REGISTER, expiresHeader.getExpires()); | |
| 181 | + } else if (registerFlag == 2) { | |
| 182 | + logger.info("[{}] 注销成功! deviceId:" + deviceId, requestAddress); | |
| 183 | + publisher.outlineEventPublish(deviceId, VideoManagerConstants.EVENT_OUTLINE_UNREGISTER); | |
| 184 | + } | |
| 185 | + } catch (SipException | InvalidArgumentException | NoSuchAlgorithmException | ParseException e) { | |
| 186 | + e.printStackTrace(); | |
| 187 | + } | |
| 188 | + | |
| 189 | + } | |
| 190 | + | |
| 191 | + private void sendResponse(RequestEvent evt, Response response) throws InvalidArgumentException, SipException { | |
| 192 | + ServerTransaction serverTransaction = getServerTransaction(evt); | |
| 193 | + serverTransaction.sendResponse(response); | |
| 194 | + if (serverTransaction.getDialog() != null) serverTransaction.getDialog().delete(); | |
| 195 | + } | |
| 206 | 196 | |
| 207 | 197 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/CatalogNotifyMessageHandler.java
| ... | ... | @@ -79,7 +79,7 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple |
| 79 | 79 | deviceChannel.setParental(1); |
| 80 | 80 | deviceChannel.setParentId(catalog.getParentId()); |
| 81 | 81 | deviceChannel.setRegisterWay(1); |
| 82 | - deviceChannel.setCivilCode(parentPlatform.getDeviceGBId().substring(0,6)); | |
| 82 | + deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision()); | |
| 83 | 83 | deviceChannel.setModel("live"); |
| 84 | 84 | deviceChannel.setOwner("wvp-pro"); |
| 85 | 85 | deviceChannel.setSecrecy("0"); |
| ... | ... | @@ -116,7 +116,7 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple |
| 116 | 116 | deviceChannel.setStatus(1); |
| 117 | 117 | deviceChannel.setParentId(gbStream.getCatalogId()); |
| 118 | 118 | deviceChannel.setRegisterWay(1); |
| 119 | - deviceChannel.setCivilCode(parentPlatform.getDeviceGBId().substring(0,6)); | |
| 119 | + deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision()); | |
| 120 | 120 | deviceChannel.setModel("live"); |
| 121 | 121 | deviceChannel.setOwner("wvp-pro"); |
| 122 | 122 | deviceChannel.setParental(0); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java
| ... | ... | @@ -83,20 +83,17 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem |
| 83 | 83 | catalog.setParentId(parentPlatform.getDeviceGBId()); |
| 84 | 84 | } |
| 85 | 85 | DeviceChannel deviceChannel = new DeviceChannel(); |
| 86 | + // 通道的类型,0->国标通道 1->直播流通道 2->业务分组/虚拟组织/行政区划 | |
| 87 | + deviceChannel.setChannelType(2); | |
| 86 | 88 | deviceChannel.setChannelId(catalog.getId()); |
| 87 | 89 | deviceChannel.setName(catalog.getName()); |
| 88 | - deviceChannel.setLongitude(0.0); | |
| 89 | - deviceChannel.setLatitude(0.0); | |
| 90 | 90 | deviceChannel.setDeviceId(parentPlatform.getDeviceGBId()); |
| 91 | 91 | deviceChannel.setManufacture("wvp-pro"); |
| 92 | 92 | deviceChannel.setStatus(1); |
| 93 | 93 | deviceChannel.setParental(1); |
| 94 | 94 | deviceChannel.setParentId(catalog.getParentId()); |
| 95 | 95 | deviceChannel.setRegisterWay(1); |
| 96 | - deviceChannel.setCivilCode(parentPlatform.getDeviceGBId().substring(0,6)); | |
| 97 | - deviceChannel.setModel("live"); | |
| 98 | - deviceChannel.setOwner("wvp-pro"); | |
| 99 | - deviceChannel.setSecrecy("0"); | |
| 96 | + deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision()); | |
| 100 | 97 | allChannels.add(deviceChannel); |
| 101 | 98 | } |
| 102 | 99 | } |
| ... | ... | @@ -107,6 +104,8 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem |
| 107 | 104 | channel.setCatalogId(parentPlatform.getDeviceGBId()); |
| 108 | 105 | } |
| 109 | 106 | DeviceChannel deviceChannel = storage.queryChannel(channel.getDeviceId(), channel.getChannelId()); |
| 107 | + // 通道的类型,0->国标通道 1->直播流通道 2->业务分组/虚拟组织/行政区划 | |
| 108 | + deviceChannel.setChannelType(0); | |
| 110 | 109 | deviceChannel.setParental(0); |
| 111 | 110 | deviceChannel.setParentId(channel.getCatalogId()); |
| 112 | 111 | deviceChannel.setCivilCode(parentPlatform.getDeviceGBId().substring(0, 6)); |
| ... | ... | @@ -120,6 +119,8 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem |
| 120 | 119 | gbStream.setCatalogId(null); |
| 121 | 120 | } |
| 122 | 121 | DeviceChannel deviceChannel = new DeviceChannel(); |
| 122 | + // 通道的类型,0->国标通道 1->直播流通道 2->业务分组/虚拟组织/行政区划 | |
| 123 | + deviceChannel.setChannelType(1); | |
| 123 | 124 | deviceChannel.setChannelId(gbStream.getGbId()); |
| 124 | 125 | deviceChannel.setName(gbStream.getName()); |
| 125 | 126 | deviceChannel.setLongitude(gbStream.getLongitude()); |
| ... | ... | @@ -130,7 +131,7 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem |
| 130 | 131 | deviceChannel.setStatus(1); |
| 131 | 132 | deviceChannel.setParentId(gbStream.getCatalogId()); |
| 132 | 133 | deviceChannel.setRegisterWay(1); |
| 133 | - deviceChannel.setCivilCode(parentPlatform.getDeviceGBId().substring(0,6)); | |
| 134 | + deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision()); | |
| 134 | 135 | deviceChannel.setModel("live"); |
| 135 | 136 | deviceChannel.setOwner("wvp-pro"); |
| 136 | 137 | deviceChannel.setParental(0); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java
| ... | ... | @@ -87,23 +87,17 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp |
| 87 | 87 | rootElement = getRootElement(evt, device.getCharset()); |
| 88 | 88 | Element deviceListElement = rootElement.element("DeviceList"); |
| 89 | 89 | Element sumNumElement = rootElement.element("SumNum"); |
| 90 | - if (sumNumElement == null || deviceListElement == null) { | |
| 90 | + Element snElement = rootElement.element("SN"); | |
| 91 | + if (snElement == null || sumNumElement == null || deviceListElement == null) { | |
| 91 | 92 | responseAck(evt, Response.BAD_REQUEST, "xml error"); |
| 92 | 93 | return; |
| 93 | 94 | } |
| 94 | 95 | int sumNum = Integer.parseInt(sumNumElement.getText()); |
| 96 | + | |
| 95 | 97 | if (sumNum == 0) { |
| 96 | 98 | // 数据已经完整接收 |
| 97 | 99 | storager.cleanChannelsForDevice(device.getDeviceId()); |
| 98 | - RequestMessage msg = new RequestMessage(); | |
| 99 | - msg.setKey(key); | |
| 100 | - WVPResult<Object> result = new WVPResult<>(); | |
| 101 | - result.setCode(0); | |
| 102 | - result.setData(device); | |
| 103 | - msg.setData(result); | |
| 104 | - result.setMsg("更新成功,共0条"); | |
| 105 | - deferredResultHolder.invokeAllResult(msg); | |
| 106 | - catalogDataCatch.del(key); | |
| 100 | + catalogDataCatch.setChannelSyncEnd(device.getDeviceId(), null); | |
| 107 | 101 | }else { |
| 108 | 102 | Iterator<Element> deviceListIterator = deviceListElement.elementIterator(); |
| 109 | 103 | if (deviceListIterator != null) { |
| ... | ... | @@ -124,24 +118,18 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp |
| 124 | 118 | |
| 125 | 119 | channelList.add(deviceChannel); |
| 126 | 120 | } |
| 127 | - logger.info("收到来自设备【{}】的通道: {}个,{}/{}", device.getDeviceId(), channelList.size(), catalogDataCatch.get(key) == null ? 0 :catalogDataCatch.get(key).size(), sumNum); | |
| 128 | - catalogDataCatch.put(key, sumNum, device, channelList); | |
| 129 | - if (catalogDataCatch.get(key).size() == sumNum) { | |
| 121 | + int sn = Integer.parseInt(snElement.getText()); | |
| 122 | + catalogDataCatch.put(device.getDeviceId(), sn, sumNum, device, channelList); | |
| 123 | + logger.info("收到来自设备【{}】的通道: {}个,{}/{}", device.getDeviceId(), channelList.size(), catalogDataCatch.get(device.getDeviceId()) == null ? 0 :catalogDataCatch.get(device.getDeviceId()).size(), sumNum); | |
| 124 | + if (catalogDataCatch.get(device.getDeviceId()).size() == sumNum) { | |
| 130 | 125 | // 数据已经完整接收 |
| 131 | - boolean resetChannelsResult = storager.resetChannels(device.getDeviceId(), catalogDataCatch.get(key)); | |
| 132 | - RequestMessage msg = new RequestMessage(); | |
| 133 | - msg.setKey(key); | |
| 134 | - WVPResult<Object> result = new WVPResult<>(); | |
| 135 | - result.setCode(0); | |
| 136 | - result.setData(device); | |
| 137 | - if (resetChannelsResult || sumNum ==0) { | |
| 138 | - result.setMsg("更新成功,共" + sumNum + "条,已更新" + catalogDataCatch.get(key).size() + "条"); | |
| 126 | + boolean resetChannelsResult = storager.resetChannels(device.getDeviceId(), catalogDataCatch.get(device.getDeviceId())); | |
| 127 | + if (!resetChannelsResult) { | |
| 128 | + String errorMsg = "接收成功,写入失败,共" + sumNum + "条,已接收" + catalogDataCatch.get(device.getDeviceId()).size() + "条"; | |
| 129 | + catalogDataCatch.setChannelSyncEnd(device.getDeviceId(), errorMsg); | |
| 139 | 130 | }else { |
| 140 | - result.setMsg("接收成功,写入失败,共" + sumNum + "条,已接收" + catalogDataCatch.get(key).size() + "条"); | |
| 131 | + catalogDataCatch.setChannelSyncEnd(device.getDeviceId(), null); | |
| 141 | 132 | } |
| 142 | - msg.setData(result); | |
| 143 | - deferredResultHolder.invokeAllResult(msg); | |
| 144 | - catalogDataCatch.del(key); | |
| 145 | 133 | } |
| 146 | 134 | } |
| 147 | 135 | // 回复200 OK |
| ... | ... | @@ -229,21 +217,26 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp |
| 229 | 217 | } |
| 230 | 218 | |
| 231 | 219 | public SyncStatus getChannelSyncProgress(String deviceId) { |
| 232 | - String key = DeferredResultHolder.CALLBACK_CMD_CATALOG + deviceId; | |
| 233 | - if (catalogDataCatch.get(key) == null) { | |
| 220 | + if (catalogDataCatch.get(deviceId) == null) { | |
| 234 | 221 | return null; |
| 235 | 222 | }else { |
| 236 | - return catalogDataCatch.getSyncStatus(key); | |
| 223 | + return catalogDataCatch.getSyncStatus(deviceId); | |
| 224 | + } | |
| 225 | + } | |
| 226 | + | |
| 227 | + public boolean isSyncRunning(String deviceId) { | |
| 228 | + if (catalogDataCatch.get(deviceId) == null) { | |
| 229 | + return false; | |
| 230 | + }else { | |
| 231 | + return catalogDataCatch.isSyncRunning(deviceId); | |
| 237 | 232 | } |
| 238 | 233 | } |
| 239 | 234 | |
| 240 | - public void setChannelSyncReady(String deviceId) { | |
| 241 | - String key = DeferredResultHolder.CALLBACK_CMD_CATALOG + deviceId; | |
| 242 | - catalogDataCatch.addReady(key); | |
| 235 | + public void setChannelSyncReady(Device device, int sn) { | |
| 236 | + catalogDataCatch.addReady(device, sn); | |
| 243 | 237 | } |
| 244 | 238 | |
| 245 | 239 | public void setChannelSyncEnd(String deviceId, String errorMsg) { |
| 246 | - String key = DeferredResultHolder.CALLBACK_CMD_CATALOG + deviceId; | |
| 247 | - catalogDataCatch.setChannelSyncEnd(key, errorMsg); | |
| 240 | + catalogDataCatch.setChannelSyncEnd(deviceId, errorMsg); | |
| 248 | 241 | } |
| 249 | 242 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
| ... | ... | @@ -81,7 +81,7 @@ public class ZLMRTPServerFactory { |
| 81 | 81 | return result; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - public int createRTPServer(MediaServerItem mediaServerItem, String streamId) { | |
| 84 | + public int createRTPServer(MediaServerItem mediaServerItem, String streamId, int ssrc) { | |
| 85 | 85 | int result = -1; |
| 86 | 86 | // 查询此rtp server 是否已经存在 |
| 87 | 87 | JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(mediaServerItem, streamId); |
| ... | ... | @@ -94,6 +94,7 @@ public class ZLMRTPServerFactory { |
| 94 | 94 | param.put("enable_tcp", 1); |
| 95 | 95 | param.put("stream_id", streamId); |
| 96 | 96 | param.put("port", 0); |
| 97 | + param.put("ssrc", ssrc); | |
| 97 | 98 | JSONObject openRtpServerResultJson = zlmresTfulUtils.openRtpServer(mediaServerItem, param); |
| 98 | 99 | |
| 99 | 100 | if (openRtpServerResultJson != null) { | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/IDeviceService.java
| ... | ... | @@ -44,15 +44,15 @@ public interface IDeviceService { |
| 44 | 44 | SyncStatus getChannelSyncStatus(String deviceId); |
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | - * 设置通道同步状态 | |
| 47 | + * 查看是否仍在同步 | |
| 48 | 48 | * @param deviceId 设备ID |
| 49 | + * @return | |
| 49 | 50 | */ |
| 50 | - void setChannelSyncReady(String deviceId); | |
| 51 | + Boolean isSyncRunning(String deviceId); | |
| 51 | 52 | |
| 52 | 53 | /** |
| 53 | - * 设置同步结束 | |
| 54 | - * @param deviceId 设备ID | |
| 55 | - * @param errorMsg 错误信息 | |
| 54 | + * 通道同步 | |
| 55 | + * @param device | |
| 56 | 56 | */ |
| 57 | - void setChannelSyncEnd(String deviceId, String errorMsg); | |
| 57 | + void sync(Device device); | |
| 58 | 58 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java
| ... | ... | @@ -44,9 +44,9 @@ public interface IMediaServerService { |
| 44 | 44 | |
| 45 | 45 | void updateVmServer(List<MediaServerItem> mediaServerItemList); |
| 46 | 46 | |
| 47 | - SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId); | |
| 47 | + SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, boolean ssrcCheck); | |
| 48 | 48 | |
| 49 | - SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, boolean isPlayback); | |
| 49 | + SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, boolean ssrcCheck, boolean isPlayback); | |
| 50 | 50 | |
| 51 | 51 | void closeRTPServer(String deviceId, String channelId, String ssrc); |
| 52 | 52 | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
| ... | ... | @@ -41,10 +41,6 @@ public class DeviceServiceImpl implements IDeviceService { |
| 41 | 41 | if (device == null || device.getSubscribeCycleForCatalog() < 0) { |
| 42 | 42 | return false; |
| 43 | 43 | } |
| 44 | - CatalogSubscribeTask task = (CatalogSubscribeTask)dynamicTask.get(device.getDeviceId() + "catalog"); | |
| 45 | - if (task != null && task.getDialogState() != null && task.getDialogState().equals(DialogState.CONFIRMED)) { // 已存在不需要再次添加 | |
| 46 | - return true; | |
| 47 | - } | |
| 48 | 44 | logger.info("[添加目录订阅] 设备{}", device.getDeviceId()); |
| 49 | 45 | // 添加目录订阅 |
| 50 | 46 | CatalogSubscribeTask catalogSubscribeTask = new CatalogSubscribeTask(device, sipCommander); |
| ... | ... | @@ -71,10 +67,6 @@ public class DeviceServiceImpl implements IDeviceService { |
| 71 | 67 | return false; |
| 72 | 68 | } |
| 73 | 69 | logger.info("[添加移动位置订阅] 设备{}", device.getDeviceId()); |
| 74 | - MobilePositionSubscribeTask task = (MobilePositionSubscribeTask)dynamicTask.get(device.getDeviceId() + "mobile_position"); | |
| 75 | - if (task != null && task.getDialogState() != null && task.getDialogState().equals(DialogState.CONFIRMED)) { // 已存在不需要再次添加 | |
| 76 | - return true; | |
| 77 | - } | |
| 78 | 70 | // 添加目录订阅 |
| 79 | 71 | MobilePositionSubscribeTask mobilePositionSubscribeTask = new MobilePositionSubscribeTask(device, sipCommander); |
| 80 | 72 | // 提前开始刷新订阅 |
| ... | ... | @@ -100,12 +92,21 @@ public class DeviceServiceImpl implements IDeviceService { |
| 100 | 92 | } |
| 101 | 93 | |
| 102 | 94 | @Override |
| 103 | - public void setChannelSyncReady(String deviceId) { | |
| 104 | - catalogResponseMessageHandler.setChannelSyncReady(deviceId); | |
| 95 | + public Boolean isSyncRunning(String deviceId) { | |
| 96 | + return catalogResponseMessageHandler.isSyncRunning(deviceId); | |
| 105 | 97 | } |
| 106 | 98 | |
| 107 | 99 | @Override |
| 108 | - public void setChannelSyncEnd(String deviceId, String errorMsg) { | |
| 109 | - catalogResponseMessageHandler.setChannelSyncEnd(deviceId, errorMsg); | |
| 100 | + public void sync(Device device) { | |
| 101 | + if (catalogResponseMessageHandler.isSyncRunning(device.getDeviceId())) { | |
| 102 | + logger.info("开启同步时发现同步已经存在"); | |
| 103 | + return; | |
| 104 | + } | |
| 105 | + int sn = (int)((Math.random()*9+1)*100000); | |
| 106 | + catalogResponseMessageHandler.setChannelSyncReady(device, sn); | |
| 107 | + sipCommander.catalogQuery(device, sn, event -> { | |
| 108 | + String errorMsg = String.format("同步通道失败,错误码: %s, %s", event.statusCode, event.msg); | |
| 109 | + catalogResponseMessageHandler.setChannelSyncEnd(device.getDeviceId(), errorMsg); | |
| 110 | + }); | |
| 110 | 111 | } |
| 111 | 112 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
| ... | ... | @@ -117,12 +117,12 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | @Override |
| 120 | - public SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId) { | |
| 121 | - return openRTPServer(mediaServerItem, streamId, false); | |
| 120 | + public SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, boolean ssrcCheck) { | |
| 121 | + return openRTPServer(mediaServerItem, streamId, ssrcCheck,false); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | @Override |
| 125 | - public SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, boolean isPlayback) { | |
| 125 | + public SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, boolean ssrcCheck, boolean isPlayback) { | |
| 126 | 126 | if (mediaServerItem == null || mediaServerItem.getId() == null) { |
| 127 | 127 | return null; |
| 128 | 128 | } |
| ... | ... | @@ -146,7 +146,7 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 146 | 146 | } |
| 147 | 147 | int rtpServerPort = mediaServerItem.getRtpProxyPort(); |
| 148 | 148 | if (mediaServerItem.isRtpEnable()) { |
| 149 | - rtpServerPort = zlmrtpServerFactory.createRTPServer(mediaServerItem, streamId); | |
| 149 | + rtpServerPort = zlmrtpServerFactory.createRTPServer(mediaServerItem, streamId, ssrcCheck?Integer.parseInt(ssrc):0); | |
| 150 | 150 | } |
| 151 | 151 | redisUtil.set(key, mediaServerItem); |
| 152 | 152 | return new SSRCInfo(rtpServerPort, ssrc, streamId); | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| ... | ... | @@ -188,7 +188,7 @@ public class PlayServiceImpl implements IPlayService { |
| 188 | 188 | if (mediaServerItem.isRtpEnable()) { |
| 189 | 189 | streamId = String.format("%s_%s", device.getDeviceId(), channelId); |
| 190 | 190 | } |
| 191 | - SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId); | |
| 191 | + SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, device.isSsrcCheck()); | |
| 192 | 192 | play(mediaServerItem, ssrcInfo, device, channelId, (mediaServerItemInUse, response)->{ |
| 193 | 193 | if (hookEvent != null) { |
| 194 | 194 | hookEvent.response(mediaServerItem, response); |
| ... | ... | @@ -232,7 +232,7 @@ public class PlayServiceImpl implements IPlayService { |
| 232 | 232 | streamId = String.format("%s_%s", device.getDeviceId(), channelId); |
| 233 | 233 | } |
| 234 | 234 | if (ssrcInfo == null) { |
| 235 | - ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId); | |
| 235 | + ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, device.isSsrcCheck()); | |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | // 超时处理 | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java
| ... | ... | @@ -420,9 +420,6 @@ public class StreamPushServiceImpl implements IStreamPushService { |
| 420 | 420 | continue; |
| 421 | 421 | } |
| 422 | 422 | streamPushItemForPlatform.setPlatformId(platFormInfoArray[0]); |
| 423 | - if (platFormInfoArray[0].equals("34020000002110000001")) { | |
| 424 | - System.out.println(111); | |
| 425 | - } | |
| 426 | 423 | List<GbStream> gbStreamList = platformForEvent.get(platFormInfoArray[0]); |
| 427 | 424 | if (gbStreamList == null) { |
| 428 | 425 | gbStreamList = new ArrayList<>(); | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
| ... | ... | @@ -37,6 +37,7 @@ public interface DeviceMapper { |
| 37 | 37 | "subscribeCycleForMobilePosition," + |
| 38 | 38 | "mobilePositionSubmissionInterval," + |
| 39 | 39 | "subscribeCycleForAlarm," + |
| 40 | + "ssrcCheck," + | |
| 40 | 41 | "online" + |
| 41 | 42 | ") VALUES (" + |
| 42 | 43 | "#{deviceId}," + |
| ... | ... | @@ -59,6 +60,7 @@ public interface DeviceMapper { |
| 59 | 60 | "#{subscribeCycleForMobilePosition}," + |
| 60 | 61 | "#{mobilePositionSubmissionInterval}," + |
| 61 | 62 | "#{subscribeCycleForAlarm}," + |
| 63 | + "#{ssrcCheck}," + | |
| 62 | 64 | "#{online}" + |
| 63 | 65 | ")") |
| 64 | 66 | int add(Device device); |
| ... | ... | @@ -84,6 +86,7 @@ public interface DeviceMapper { |
| 84 | 86 | "<if test=\"subscribeCycleForMobilePosition != null\">, subscribeCycleForMobilePosition=${subscribeCycleForMobilePosition}</if>" + |
| 85 | 87 | "<if test=\"mobilePositionSubmissionInterval != null\">, mobilePositionSubmissionInterval=${mobilePositionSubmissionInterval}</if>" + |
| 86 | 88 | "<if test=\"subscribeCycleForAlarm != null\">, subscribeCycleForAlarm=${subscribeCycleForAlarm}</if>" + |
| 89 | + "<if test=\"ssrcCheck != null\">, ssrcCheck=${ssrcCheck}</if>" + | |
| 87 | 90 | "WHERE deviceId='${deviceId}'"+ |
| 88 | 91 | " </script>"}) |
| 89 | 92 | int update(Device device); | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java
| ... | ... | @@ -16,10 +16,10 @@ public interface ParentPlatformMapper { |
| 16 | 16 | |
| 17 | 17 | @Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " + |
| 18 | 18 | " devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, " + |
| 19 | - " status, shareAllLiveStream, catalogId) " + | |
| 19 | + " status, shareAllLiveStream, startOfflinePush, catalogId, administrativeDivision, catalogGroup) " + | |
| 20 | 20 | " VALUES (${enable}, '${name}', '${serverGBId}', '${serverGBDomain}', '${serverIP}', ${serverPort}, '${deviceGBId}', '${deviceIp}', " + |
| 21 | 21 | " '${devicePort}', '${username}', '${password}', '${expires}', '${keepTimeout}', '${transport}', '${characterSet}', ${ptz}, ${rtcp}, " + |
| 22 | - " ${status}, ${shareAllLiveStream}, #{catalogId})") | |
| 22 | + " ${status}, ${shareAllLiveStream}, ${startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup})") | |
| 23 | 23 | int addParentPlatform(ParentPlatform parentPlatform); |
| 24 | 24 | |
| 25 | 25 | @Update("UPDATE parent_platform " + |
| ... | ... | @@ -42,6 +42,9 @@ public interface ParentPlatformMapper { |
| 42 | 42 | "rtcp=#{rtcp}, " + |
| 43 | 43 | "status=#{status}, " + |
| 44 | 44 | "shareAllLiveStream=#{shareAllLiveStream}, " + |
| 45 | + "startOfflinePush=${startOfflinePush}, " + | |
| 46 | + "catalogGroup=#{catalogGroup}, " + | |
| 47 | + "administrativeDivision=#{administrativeDivision}, " + | |
| 45 | 48 | "catalogId=#{catalogId} " + |
| 46 | 49 | "WHERE id=#{id}") |
| 47 | 50 | int updateParentPlatform(ParentPlatform parentPlatform); | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
| ... | ... | @@ -238,12 +238,15 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { |
| 238 | 238 | |
| 239 | 239 | @Override |
| 240 | 240 | public boolean resetChannels(String deviceId, List<DeviceChannel> deviceChannelList) { |
| 241 | + if (deviceChannelList == null) { | |
| 242 | + return false; | |
| 243 | + } | |
| 241 | 244 | TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); |
| 242 | 245 | // 数据去重 |
| 243 | 246 | List<DeviceChannel> channels = new ArrayList<>(); |
| 244 | 247 | StringBuilder stringBuilder = new StringBuilder(); |
| 245 | 248 | Map<String, Integer> subContMap = new HashMap<>(); |
| 246 | - if (deviceChannelList.size() > 1) { | |
| 249 | + if (deviceChannelList != null && deviceChannelList.size() > 1) { | |
| 247 | 250 | // 数据去重 |
| 248 | 251 | Set<String> gbIdSet = new HashSet<>(); |
| 249 | 252 | for (DeviceChannel deviceChannel : deviceChannelList) { |
| ... | ... | @@ -300,6 +303,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { |
| 300 | 303 | dataSourceTransactionManager.commit(transactionStatus); //手动提交 |
| 301 | 304 | return true; |
| 302 | 305 | }catch (Exception e) { |
| 306 | + e.printStackTrace(); | |
| 303 | 307 | dataSourceTransactionManager.rollback(transactionStatus); |
| 304 | 308 | return false; |
| 305 | 309 | } |
| ... | ... | @@ -415,10 +419,9 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { |
| 415 | 419 | TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); |
| 416 | 420 | boolean result = false; |
| 417 | 421 | try { |
| 418 | - if (platformChannelMapper.delChannelForDeviceId(deviceId) <0 // 删除与国标平台的关联 | |
| 419 | - || deviceChannelMapper.cleanChannelsByDeviceId(deviceId) < 0 // 删除他的通道 | |
| 420 | - || deviceMapper.del(deviceId) < 0 // 移除设备信息 | |
| 421 | - ) { | |
| 422 | + platformChannelMapper.delChannelForDeviceId(deviceId); | |
| 423 | + deviceChannelMapper.cleanChannelsByDeviceId(deviceId); | |
| 424 | + if ( deviceMapper.del(deviceId) < 0 ) { | |
| 422 | 425 | //事务回滚 |
| 423 | 426 | dataSourceTransactionManager.rollback(transactionStatus); |
| 424 | 427 | } |
| ... | ... | @@ -517,6 +520,12 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { |
| 517 | 520 | @Override |
| 518 | 521 | public boolean updateParentPlatform(ParentPlatform parentPlatform) { |
| 519 | 522 | int result = 0; |
| 523 | + if (parentPlatform.getCatalogGroup() == 0) { | |
| 524 | + parentPlatform.setCatalogGroup(1); | |
| 525 | + } | |
| 526 | + if (parentPlatform.getAdministrativeDivision() == null) { | |
| 527 | + parentPlatform.setAdministrativeDivision(parentPlatform.getAdministrativeDivision()); | |
| 528 | + } | |
| 520 | 529 | ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId()); // .getDeviceGBId()); |
| 521 | 530 | if (parentPlatform.getId() == null ) { |
| 522 | 531 | if (parentPlatform.getCatalogId() == null) { |
| ... | ... | @@ -536,6 +545,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { |
| 536 | 545 | parentPlatformCatch.setId(parentPlatform.getServerGBId()); |
| 537 | 546 | redisCatchStorage.delPlatformCatchInfo(parentPlatById.getServerGBId()); |
| 538 | 547 | } |
| 548 | + | |
| 539 | 549 | result = platformMapper.updateParentPlatform(parentPlatform); |
| 540 | 550 | } |
| 541 | 551 | // 更新缓存 |
| ... | ... | @@ -1071,7 +1081,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { |
| 1071 | 1081 | deviceChannel.setParentId(catalog.getParentId()); |
| 1072 | 1082 | deviceChannel.setRegisterWay(1); |
| 1073 | 1083 | // 行政区划应该是Domain的前八位 |
| 1074 | - deviceChannel.setCivilCode(parentPlatByServerGBId.getDeviceGBId().substring(0,6)); | |
| 1084 | + deviceChannel.setCivilCode(parentPlatByServerGBId.getAdministrativeDivision()); | |
| 1075 | 1085 | deviceChannel.setModel("live"); |
| 1076 | 1086 | deviceChannel.setOwner("wvp-pro"); |
| 1077 | 1087 | deviceChannel.setSecrecy("0"); | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
| ... | ... | @@ -164,20 +164,17 @@ public class DeviceQuery { |
| 164 | 164 | logger.debug("设备通道信息同步API调用,deviceId:" + deviceId); |
| 165 | 165 | } |
| 166 | 166 | Device device = storager.queryVideoDevice(deviceId); |
| 167 | - SyncStatus syncStatus = deviceService.getChannelSyncStatus(deviceId); | |
| 167 | + boolean status = deviceService.isSyncRunning(deviceId); | |
| 168 | 168 | // 已存在则返回进度 |
| 169 | - if (syncStatus != null && syncStatus.getErrorMsg() == null) { | |
| 169 | + if (status) { | |
| 170 | 170 | WVPResult<SyncStatus> wvpResult = new WVPResult<>(); |
| 171 | 171 | wvpResult.setCode(0); |
| 172 | - wvpResult.setData(syncStatus); | |
| 172 | + SyncStatus channelSyncStatus = deviceService.getChannelSyncStatus(deviceId); | |
| 173 | + wvpResult.setData(channelSyncStatus); | |
| 173 | 174 | return wvpResult; |
| 174 | 175 | } |
| 175 | - SyncStatus syncStatusReady = new SyncStatus(); | |
| 176 | - deviceService.setChannelSyncReady(deviceId); | |
| 177 | - cmder.catalogQuery(device, event -> { | |
| 178 | - String errorMsg = String.format("同步通道失败,错误码: %s, %s", event.statusCode, event.msg); | |
| 179 | - deviceService.setChannelSyncEnd(deviceId, errorMsg); | |
| 180 | - }); | |
| 176 | + deviceService.sync(device); | |
| 177 | + | |
| 181 | 178 | WVPResult<SyncStatus> wvpResult = new WVPResult<>(); |
| 182 | 179 | wvpResult.setCode(0); |
| 183 | 180 | wvpResult.setMsg("开始同步"); | ... | ... |
web_src/src/components/dialog/SyncChannelProgress.vue
| ... | ... | @@ -61,23 +61,36 @@ export default { |
| 61 | 61 | if (!this.syncFlag) { |
| 62 | 62 | this.syncFlag = true; |
| 63 | 63 | } |
| 64 | - if (res.data.data == null) { | |
| 65 | - this.syncStatus = "success" | |
| 66 | - this.percentage = 100; | |
| 67 | - this.msg = '同步成功'; | |
| 68 | - }else if (res.data.data.total == 0){ | |
| 69 | - this.msg = `等待同步中`; | |
| 70 | - this.timmer = setTimeout(this.getProgress, 300) | |
| 71 | - }else if (res.data.data.errorMsg !== null ){ | |
| 72 | - this.msg = res.data.data.errorMsg; | |
| 73 | - this.syncStatus = "exception" | |
| 74 | - }else { | |
| 75 | - this.total = res.data.data.total; | |
| 76 | - this.current = res.data.data.current; | |
| 77 | - this.percentage = Math.floor(Number(res.data.data.current)/Number(res.data.data.total)* 10000)/100; | |
| 78 | - this.msg = `同步中...[${res.data.data.current}/${res.data.data.total}]`; | |
| 79 | - this.timmer = setTimeout(this.getProgress, 300) | |
| 64 | + | |
| 65 | + if (res.data.data != null) { | |
| 66 | + if (res.data.data.total == 0) { | |
| 67 | + if (res.data.data.errorMsg !== null ){ | |
| 68 | + this.msg = res.data.data.errorMsg; | |
| 69 | + this.syncStatus = "exception" | |
| 70 | + }else { | |
| 71 | + this.msg = `等待同步中`; | |
| 72 | + this.timmer = setTimeout(this.getProgress, 300) | |
| 73 | + } | |
| 74 | + }else { | |
| 75 | + if (res.data.data.total == res.data.data.current) { | |
| 76 | + this.syncStatus = "success" | |
| 77 | + this.percentage = 100; | |
| 78 | + this.msg = '同步成功'; | |
| 79 | + }else { | |
| 80 | + if (res.data.data.errorMsg !== null ){ | |
| 81 | + this.msg = res.data.data.errorMsg; | |
| 82 | + this.syncStatus = "exception" | |
| 83 | + }else { | |
| 84 | + this.total = res.data.data.total; | |
| 85 | + this.current = res.data.data.current; | |
| 86 | + this.percentage = Math.floor(Number(res.data.data.current)/Number(res.data.data.total)* 10000)/100; | |
| 87 | + this.msg = `同步中...[${res.data.data.current}/${res.data.data.total}]`; | |
| 88 | + this.timmer = setTimeout(this.getProgress, 300) | |
| 89 | + } | |
| 90 | + } | |
| 91 | + } | |
| 80 | 92 | } |
| 93 | + | |
| 81 | 94 | }else { |
| 82 | 95 | if (this.syncFlag) { |
| 83 | 96 | this.syncStatus = "success" | ... | ... |
web_src/src/components/dialog/catalogEdit.vue
| ... | ... | @@ -13,11 +13,24 @@ |
| 13 | 13 | <div id="shared" style="margin-top: 1rem;margin-right: 100px;"> |
| 14 | 14 | <el-form ref="form" :rules="rules" :model="form" label-width="140px" > |
| 15 | 15 | <el-form-item label="节点编号" prop="id" > |
| 16 | - <el-input v-model="form.id" :disabled="isEdit"></el-input> | |
| 16 | + <el-tooltip class="item" effect="dark" content="" placement="top-start"> | |
| 17 | + <div slot="content"> | |
| 18 | + 建议的类型: | |
| 19 | + <br/> | |
| 20 | +   行政区划(可选2位/4位/6位/8位/10位数字,例如:130432,表示河北省邯郸市广平县) | |
| 21 | + <br/> | |
| 22 | +   业务分组(第11、12、13位215,例如:34020000002150000001) | |
| 23 | + <br/> | |
| 24 | +   虚拟组织(第11、12、13位216,例如:34020000002160000001) | |
| 25 | + </div> | |
| 26 | + <el-input v-model="form.id" :disabled="isEdit"></el-input> | |
| 27 | + </el-tooltip> | |
| 17 | 28 | </el-form-item> |
| 18 | 29 | <el-form-item label="节点名称" prop="name"> |
| 19 | 30 | <el-input v-model="form.name" clearable></el-input> |
| 20 | 31 | </el-form-item> |
| 32 | + | |
| 33 | + | |
| 21 | 34 | <el-form-item> |
| 22 | 35 | <div style="float: right;"> |
| 23 | 36 | <el-button type="primary" @click="onSubmit" >确认</el-button> | ... | ... |
web_src/src/components/dialog/deviceEdit.vue
| ... | ... | @@ -45,6 +45,9 @@ |
| 45 | 45 | <el-form-item v-if="form.subscribeCycleForMobilePosition > 0" label="移动位置报送间隔" prop="subscribeCycleForCatalog" > |
| 46 | 46 | <el-input v-model="form.mobilePositionSubmissionInterval" clearable ></el-input> |
| 47 | 47 | </el-form-item> |
| 48 | + <el-form-item label="其他选项"> | |
| 49 | + <el-checkbox label="SSRC校验" v-model="form.ssrcCheck" style="float: left"></el-checkbox> | |
| 50 | + </el-form-item> | |
| 48 | 51 | <el-form-item> |
| 49 | 52 | <div style="float: right;"> |
| 50 | 53 | <el-button type="primary" @click="onSubmit" >确认</el-button> | ... | ... |
web_src/src/components/dialog/platformEdit.vue
| ... | ... | @@ -44,6 +44,9 @@ |
| 44 | 44 | <el-form-item label="SIP认证用户名" prop="username"> |
| 45 | 45 | <el-input v-model="platform.username"></el-input> |
| 46 | 46 | </el-form-item> |
| 47 | + <el-form-item label="行政区划" prop="administrativeDivision"> | |
| 48 | + <el-input v-model="platform.administrativeDivision" clearable></el-input> | |
| 49 | + </el-form-item> | |
| 47 | 50 | <el-form-item label="SIP认证密码" prop="password"> |
| 48 | 51 | <el-input v-model="platform.password" ></el-input> |
| 49 | 52 | </el-form-item> |
| ... | ... | @@ -63,6 +66,18 @@ |
| 63 | 66 | <el-option label="TCP" value="TCP"></el-option> |
| 64 | 67 | </el-select> |
| 65 | 68 | </el-form-item> |
| 69 | + <el-form-item label="目录分组" prop="catalogGroup"> | |
| 70 | + <el-select | |
| 71 | + v-model="platform.catalogGroup" | |
| 72 | + style="width: 100%" | |
| 73 | + placeholder="请选择目录分组" | |
| 74 | + > | |
| 75 | + <el-option label="1" value="1"></el-option> | |
| 76 | + <el-option label="2" value="2"></el-option> | |
| 77 | + <el-option label="4" value="4"></el-option> | |
| 78 | + <el-option label="8" value="8"></el-option> | |
| 79 | + </el-select> | |
| 80 | + </el-form-item> | |
| 66 | 81 | <el-form-item label="字符集" prop="characterSet"> |
| 67 | 82 | <el-select |
| 68 | 83 | v-model="platform.characterSet" |
| ... | ... | @@ -77,6 +92,7 @@ |
| 77 | 92 | <el-checkbox label="启用" v-model="platform.enable" @change="checkExpires"></el-checkbox> |
| 78 | 93 | <el-checkbox label="云台控制" v-model="platform.ptz"></el-checkbox> |
| 79 | 94 | <el-checkbox label="共享所有直播流" v-model="platform.shareAllLiveStream"></el-checkbox> |
| 95 | + <el-checkbox label="拉起离线推流" v-model="platform.startOfflinePush"></el-checkbox> | |
| 80 | 96 | </el-form-item> |
| 81 | 97 | <el-form-item> |
| 82 | 98 | <el-button type="primary" @click="onSubmit">{{ |
| ... | ... | @@ -138,6 +154,9 @@ export default { |
| 138 | 154 | transport: "UDP", |
| 139 | 155 | characterSet: "GB2312", |
| 140 | 156 | shareAllLiveStream: false, |
| 157 | + startOfflinePush: false, | |
| 158 | + catalogGroup: 1, | |
| 159 | + administrativeDivision: null, | |
| 141 | 160 | }, |
| 142 | 161 | rules: { |
| 143 | 162 | name: [{ required: true, message: "请输入平台名称", trigger: "blur" }], |
| ... | ... | @@ -175,6 +194,7 @@ export default { |
| 175 | 194 | that.platform.devicePort = res.data.devicePort; |
| 176 | 195 | that.platform.username = res.data.username; |
| 177 | 196 | that.platform.password = res.data.password; |
| 197 | + that.platform.administrativeDivision = res.data.username.substr(0, 6); | |
| 178 | 198 | }).catch(function (error) { |
| 179 | 199 | console.log(error); |
| 180 | 200 | }); |
| ... | ... | @@ -199,6 +219,9 @@ export default { |
| 199 | 219 | this.platform.characterSet = platform.characterSet; |
| 200 | 220 | this.platform.shareAllLiveStream = platform.shareAllLiveStream; |
| 201 | 221 | this.platform.catalogId = platform.catalogId; |
| 222 | + this.platform.startOfflinePush = platform.startOfflinePush; | |
| 223 | + this.platform.catalogGroup = platform.catalogGroup; | |
| 224 | + this.platform.administrativeDivision = platform.administrativeDivision; | |
| 202 | 225 | this.onSubmit_text = "保存"; |
| 203 | 226 | this.saveUrl = "/api/platform/save"; |
| 204 | 227 | } |
| ... | ... | @@ -213,6 +236,10 @@ export default { |
| 213 | 236 | deviceGBIdChange: function () { |
| 214 | 237 | |
| 215 | 238 | this.platform.username = this.platform.deviceGBId ; |
| 239 | + if (this.platform.administrativeDivision == null) { | |
| 240 | + this.platform.administrativeDivision = this.platform.deviceGBId.substr(0, 6); | |
| 241 | + } | |
| 242 | + | |
| 216 | 243 | }, |
| 217 | 244 | onSubmit: function () { |
| 218 | 245 | var that = this; |
| ... | ... | @@ -253,6 +280,7 @@ export default { |
| 253 | 280 | rtcp: false, |
| 254 | 281 | name: null, |
| 255 | 282 | serverGBId: null, |
| 283 | + administrativeDivision: null, | |
| 256 | 284 | serverGBDomain: null, |
| 257 | 285 | serverIP: null, |
| 258 | 286 | serverPort: null, |
| ... | ... | @@ -266,6 +294,8 @@ export default { |
| 266 | 294 | transport: "UDP", |
| 267 | 295 | characterSet: "GB2312", |
| 268 | 296 | shareAllLiveStream: false, |
| 297 | + startOfflinePush: false, | |
| 298 | + catalogGroup: 1, | |
| 269 | 299 | } |
| 270 | 300 | }, |
| 271 | 301 | deviceGBIdExit: async function (deviceGbId) { | ... | ... |