From c770b0c2170f197ef99144d8ab430ec7cae6d433 Mon Sep 17 00:00:00 2001 From: lin <648540858@qq.com> Date: Wed, 19 Mar 2025 14:05:19 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 数据库/2.7.3/初始化-mysql-2.7.3.sql | 70 +-- .../2.7.3/初始化-postgresql-kingbase-2.7.3.sql | 75 ++-- 数据库/2.7.3/数据库统合-更新.sql | 13 - 数据库/2.7.3/更新-mysql-2.7.1升级到2.7.3.sql | 421 ++++++++++++++++++ 数据库/2.7.3/更新-mysql-2.7.3.sql | 247 ++++++++-- ...更新-postgresql-kingbase-2.7.1升级到2.7.3.sql | 384 ++++++++++++++++ .../2.7.3/更新-postgresql-kingbase-2.7.3.sql | 110 +++-- 7 files changed, 1169 insertions(+), 151 deletions(-) delete mode 100644 数据库/2.7.3/数据库统合-更新.sql create mode 100644 数据库/2.7.3/更新-mysql-2.7.1升级到2.7.3.sql create mode 100644 数据库/2.7.3/更新-postgresql-kingbase-2.7.1升级到2.7.3.sql diff --git a/数据库/2.7.3/初始化-mysql-2.7.3.sql b/数据库/2.7.3/初始化-mysql-2.7.3.sql index c3f5eee7c..7d3a10986 100644 --- a/数据库/2.7.3/初始化-mysql-2.7.3.sql +++ b/数据库/2.7.3/初始化-mysql-2.7.3.sql @@ -1,5 +1,6 @@ /*建表*/ -create table wvp_device +drop table IF EXISTS wvp_device; +create table IF NOT EXISTS wvp_device ( id serial primary key, device_id character varying(50) not null, @@ -39,7 +40,8 @@ create table wvp_device constraint uk_device_device unique (device_id) ); -create table wvp_device_alarm +drop table IF EXISTS wvp_device_alarm; +create table IF NOT EXISTS wvp_device_alarm ( id serial primary key, device_id character varying(50) not null, @@ -54,7 +56,8 @@ create table wvp_device_alarm create_time character varying(50) not null ); -create table wvp_device_mobile_position +drop table IF EXISTS wvp_device_mobile_position; +create table IF NOT EXISTS wvp_device_mobile_position ( id serial primary key, device_id character varying(50) not null, @@ -70,7 +73,8 @@ create table wvp_device_mobile_position create_time character varying(50) ); -create table wvp_device_channel +drop table IF EXISTS wvp_device_channel; +create table IF NOT EXISTS wvp_device_channel ( id serial primary key, device_id character varying(50), @@ -155,7 +159,8 @@ create table wvp_device_channel constraint uk_wvp_unique_channel unique (gb_device_id) ); -create table wvp_media_server +drop table IF EXISTS wvp_media_server; +create table IF NOT EXISTS wvp_media_server ( id character varying(255) primary key, ip character varying(50), @@ -191,7 +196,8 @@ create table wvp_media_server constraint uk_media_server_unique_ip_http_port unique (ip, http_port, server_id) ); -create table wvp_platform +drop table IF EXISTS wvp_platform; +create table IF NOT EXISTS wvp_platform ( id serial primary key, enable bool default false, @@ -231,8 +237,8 @@ create table wvp_platform constraint uk_platform_unique_server_gb_id unique (server_gb_id) ); - -create table wvp_platform_channel +drop table IF EXISTS wvp_platform_channel; +create table IF NOT EXISTS wvp_platform_channel ( id serial primary key, platform_id integer, @@ -275,7 +281,8 @@ create table wvp_platform_channel constraint uk_platform_gb_channel_device_id unique (custom_device_id) ); -create table wvp_platform_group +drop table IF EXISTS wvp_platform_group; +create table IF NOT EXISTS wvp_platform_group ( id serial primary key, platform_id integer, @@ -283,7 +290,8 @@ create table wvp_platform_group constraint uk_wvp_platform_group_platform_id_group_id unique (platform_id, group_id) ); -create table wvp_platform_region +drop table IF EXISTS wvp_platform_region; +create table IF NOT EXISTS wvp_platform_region ( id serial primary key, platform_id integer, @@ -291,7 +299,8 @@ create table wvp_platform_region constraint uk_wvp_platform_region_platform_id_group_id unique (platform_id, region_id) ); -create table wvp_stream_proxy +drop table IF EXISTS wvp_stream_proxy; +create table IF NOT EXISTS wvp_stream_proxy ( id serial primary key, type character varying(50), @@ -317,7 +326,8 @@ create table wvp_stream_proxy constraint uk_stream_proxy_app_stream unique (app, stream) ); -create table wvp_stream_push +drop table IF EXISTS wvp_stream_push; +create table IF NOT EXISTS wvp_stream_push ( id serial primary key, app character varying(255), @@ -333,7 +343,9 @@ create table wvp_stream_push start_offline_push bool default true, constraint uk_stream_push_app_stream unique (app, stream) ); -create table wvp_cloud_record + +drop table IF EXISTS wvp_cloud_record; +create table IF NOT EXISTS wvp_cloud_record ( id serial primary key, app character varying(255), @@ -351,7 +363,8 @@ create table wvp_cloud_record time_len bigint ); -create table wvp_user +drop table IF EXISTS wvp_user; +create table IF NOT EXISTS wvp_user ( id serial primary key, username character varying(255), @@ -363,7 +376,8 @@ create table wvp_user constraint uk_user_username unique (username) ); -create table wvp_user_role +drop table IF EXISTS wvp_user_role; +create table IF NOT EXISTS wvp_user_role ( id serial primary key, name character varying(50), @@ -371,18 +385,10 @@ create table wvp_user_role create_time character varying(50), update_time character varying(50) ); -create table wvp_resources_tree -( - id serial primary key, - is_catalog bool default true, - device_channel_id integer, - gb_stream_id integer, - name character varying(255), - parentId integer, - path character varying(255) -); -create table wvp_user_api_key + +drop table IF EXISTS wvp_user_api_key; +create table IF NOT EXISTS wvp_user_api_key ( id serial primary key, user_id bigint, @@ -403,7 +409,8 @@ VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 1, '2021-04-13 14:14:57' INSERT INTO wvp_user_role VALUES (1, 'admin', '0', '2021-04-13 14:14:57', '2021-04-13 14:14:57'); -CREATE TABLE wvp_common_group +drop table IF EXISTS wvp_common_group; +create table IF NOT EXISTS wvp_common_group ( id serial primary key, device_id varchar(50) NOT NULL, @@ -417,7 +424,8 @@ CREATE TABLE wvp_common_group constraint uk_common_group_device_platform unique (device_id) ); -CREATE TABLE wvp_common_region +drop table IF EXISTS wvp_common_region; +create table IF NOT EXISTS wvp_common_region ( id serial primary key, device_id varchar(50) NOT NULL, @@ -429,7 +437,8 @@ CREATE TABLE wvp_common_region constraint uk_common_region_device_id unique (device_id) ); -create table wvp_record_plan +drop table IF EXISTS wvp_record_plan; +create table IF NOT EXISTS wvp_record_plan ( id serial primary key, snap bool default false, @@ -438,7 +447,8 @@ create table wvp_record_plan update_time character varying(50) ); -create table wvp_record_plan_item +drop table IF EXISTS wvp_record_plan_item; +create table IF NOT EXISTS wvp_record_plan_item ( id serial primary key, start int, diff --git a/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql b/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql index 1d96dba0a..2b9174bdf 100644 --- a/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql +++ b/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql @@ -1,5 +1,6 @@ /*建表*/ -create table wvp_device +drop table IF EXISTS wvp_device; +create table IF NOT EXISTS wvp_device ( id serial primary key, device_id character varying(50) not null, @@ -25,7 +26,7 @@ create table wvp_device charset character varying(50), ssrc_check bool default false, geo_coord_sys character varying(50), - media_server_id character varying(50), + media_server_id character varying(50) default 'auto', custom_name character varying(255), sdp_ip character varying(50), local_ip character varying(50), @@ -39,7 +40,8 @@ create table wvp_device constraint uk_device_device unique (device_id) ); -create table wvp_device_alarm +drop table IF EXISTS wvp_device_alarm; +create table IF NOT EXISTS wvp_device_alarm ( id serial primary key, device_id character varying(50) not null, @@ -54,7 +56,8 @@ create table wvp_device_alarm create_time character varying(50) not null ); -create table wvp_device_mobile_position +drop table IF EXISTS wvp_device_mobile_position; +create table IF NOT EXISTS wvp_device_mobile_position ( id serial primary key, device_id character varying(50) not null, @@ -70,7 +73,8 @@ create table wvp_device_mobile_position create_time character varying(50) ); -create table wvp_device_channel +drop table IF EXISTS wvp_device_channel; +create table IF NOT EXISTS wvp_device_channel ( id serial primary key, device_id character varying(50), @@ -155,7 +159,8 @@ create table wvp_device_channel constraint uk_wvp_unique_channel unique (gb_device_id) ); -create table wvp_media_server +drop table IF EXISTS wvp_media_server; +create table IF NOT EXISTS wvp_media_server ( id character varying(255) primary key, ip character varying(50), @@ -191,7 +196,8 @@ create table wvp_media_server constraint uk_media_server_unique_ip_http_port unique (ip, http_port, server_id) ); -create table wvp_platform +drop table IF EXISTS wvp_platform; +create table IF NOT EXISTS wvp_platform ( id serial primary key, enable bool default false, @@ -231,8 +237,8 @@ create table wvp_platform constraint uk_platform_unique_server_gb_id unique (server_gb_id) ); - -create table wvp_platform_channel +drop table IF EXISTS wvp_platform_channel; +create table IF NOT EXISTS wvp_platform_channel ( id serial primary key, platform_id integer, @@ -275,7 +281,8 @@ create table wvp_platform_channel constraint uk_platform_gb_channel_device_id unique (custom_device_id) ); -create table wvp_platform_group +drop table IF EXISTS wvp_platform_group; +create table IF NOT EXISTS wvp_platform_group ( id serial primary key, platform_id integer, @@ -283,7 +290,8 @@ create table wvp_platform_group constraint uk_wvp_platform_group_platform_id_group_id unique (platform_id, group_id) ); -create table wvp_platform_region +drop table IF EXISTS wvp_platform_region; +create table IF NOT EXISTS wvp_platform_region ( id serial primary key, platform_id integer, @@ -291,7 +299,8 @@ create table wvp_platform_region constraint uk_wvp_platform_region_platform_id_group_id unique (platform_id, region_id) ); -create table wvp_stream_proxy +drop table IF EXISTS wvp_stream_proxy; +create table IF NOT EXISTS wvp_stream_proxy ( id serial primary key, type character varying(50), @@ -317,7 +326,8 @@ create table wvp_stream_proxy constraint uk_stream_proxy_app_stream unique (app, stream) ); -create table wvp_stream_push +drop table IF EXISTS wvp_stream_push; +create table IF NOT EXISTS wvp_stream_push ( id serial primary key, app character varying(255), @@ -333,7 +343,9 @@ create table wvp_stream_push start_offline_push bool default true, constraint uk_stream_push_app_stream unique (app, stream) ); -create table wvp_cloud_record + +drop table IF EXISTS wvp_cloud_record; +create table IF NOT EXISTS wvp_cloud_record ( id serial primary key, app character varying(255), @@ -348,11 +360,11 @@ create table wvp_cloud_record file_path character varying(500), collect bool default false, file_size int8, - time_len int8, - constraint uk_stream_push_app_stream_path unique (app, stream, file_path) + time_len int8 ); -create table wvp_user +drop table IF EXISTS wvp_user; +create table IF NOT EXISTS wvp_user ( id serial primary key, username character varying(255), @@ -364,7 +376,8 @@ create table wvp_user constraint uk_user_username unique (username) ); -create table wvp_user_role +drop table IF EXISTS wvp_user_role; +create table IF NOT EXISTS wvp_user_role ( id serial primary key, name character varying(50), @@ -372,18 +385,10 @@ create table wvp_user_role create_time character varying(50), update_time character varying(50) ); -create table wvp_resources_tree -( - id serial primary key, - is_catalog bool default true, - device_channel_id integer, - gb_stream_id integer, - name character varying(255), - parentId integer, - path character varying(255) -); -create table wvp_user_api_key + +drop table IF EXISTS wvp_user_api_key; +create table IF NOT EXISTS wvp_user_api_key ( id serial primary key, user_id int8, @@ -404,7 +409,8 @@ VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 1, '2021-04-13 14:14:57' INSERT INTO wvp_user_role VALUES (1, 'admin', '0', '2021-04-13 14:14:57', '2021-04-13 14:14:57'); -CREATE TABLE wvp_common_group +drop table IF EXISTS wvp_common_group; +create table IF NOT EXISTS wvp_common_group ( id serial primary key, device_id varchar(50) NOT NULL, @@ -418,7 +424,8 @@ CREATE TABLE wvp_common_group constraint uk_common_group_device_platform unique (device_id) ); -CREATE TABLE wvp_common_region +drop table IF EXISTS wvp_common_region; +create table IF NOT EXISTS wvp_common_region ( id serial primary key, device_id varchar(50) NOT NULL, @@ -430,7 +437,8 @@ CREATE TABLE wvp_common_region constraint uk_common_region_device_id unique (device_id) ); -create table wvp_record_plan +drop table IF EXISTS wvp_record_plan; +create table IF NOT EXISTS wvp_record_plan ( id serial primary key, snap bool default false, @@ -439,7 +447,8 @@ create table wvp_record_plan update_time character varying(50) ); -create table wvp_record_plan_item +drop table IF EXISTS wvp_record_plan_item; +create table IF NOT EXISTS wvp_record_plan_item ( id serial primary key, "start" int, diff --git a/数据库/2.7.3/数据库统合-更新.sql b/数据库/2.7.3/数据库统合-更新.sql deleted file mode 100644 index 8d850262e..000000000 --- a/数据库/2.7.3/数据库统合-更新.sql +++ /dev/null @@ -1,13 +0,0 @@ -/* -* WVP RPC 调用 -*/ -alter table wvp_device add server_id character varying(50); -alter table wvp_media_server add server_id character varying(50); -alter table wvp_stream_proxy add server_id character varying(50); -alter table wvp_cloud_record add server_id character varying(50); -alter table wvp_platform add server_id character varying(50); - -update wvp_device set server_id = "你服务的ID"; -update wvp_media_server set server_id = "你服务的ID"; -update wvp_stream_proxy set server_id = "你服务的ID"; -update wvp_cloud_record set server_id = "你服务的ID"; \ No newline at end of file diff --git a/数据库/2.7.3/更新-mysql-2.7.1升级到2.7.3.sql b/数据库/2.7.3/更新-mysql-2.7.1升级到2.7.3.sql new file mode 100644 index 000000000..ea97f2bcd --- /dev/null +++ b/数据库/2.7.3/更新-mysql-2.7.1升级到2.7.3.sql @@ -0,0 +1,421 @@ +drop table if exists wvp_resources_tree; +drop table if exists wvp_platform_catalog; +drop table if exists wvp_platform_gb_stream; +drop table if exists wvp_platform_gb_channel; +drop table if exists wvp_gb_stream; +drop table if exists wvp_log; +drop table IF EXISTS wvp_device; +drop table IF EXISTS wvp_platform; +drop table IF EXISTS wvp_media_server; +drop table IF EXISTS wvp_device_mobile_position; +drop table IF EXISTS wvp_device_channel; +drop table IF EXISTS wvp_stream_proxy; +drop table IF EXISTS wvp_stream_push; + +create table IF NOT EXISTS wvp_device +( + id serial primary key, + device_id character varying(50) not null, + name character varying(255), + manufacturer character varying(255), + model character varying(255), + firmware character varying(255), + transport character varying(50), + stream_mode character varying(50), + on_line bool default false, + register_time character varying(50), + keepalive_time character varying(50), + ip character varying(50), + create_time character varying(50), + update_time character varying(50), + port integer, + expires integer, + subscribe_cycle_for_catalog integer DEFAULT 0, + subscribe_cycle_for_mobile_position integer DEFAULT 0, + mobile_position_submission_interval integer DEFAULT 5, + subscribe_cycle_for_alarm integer DEFAULT 0, + host_address character varying(50), + charset character varying(50), + ssrc_check bool default false, + geo_coord_sys character varying(50), + media_server_id character varying(50) default 'auto', + custom_name character varying(255), + sdp_ip character varying(50), + local_ip character varying(50), + password character varying(255), + as_message_channel bool default false, + heart_beat_interval integer, + heart_beat_count integer, + position_capability integer, + broadcast_push_after_ack bool default false, + server_id character varying(50), + constraint uk_device_device unique (device_id) +); + +create table if not exists wvp_common_group +( + id bigint unsigned auto_increment primary key, + device_id varchar(50) not null, + name varchar(255) not null, + parent_id int null, + parent_device_id varchar(50) null, + business_group varchar(50) not null, + create_time varchar(50) not null, + update_time varchar(50) not null, + civil_code varchar(50) null, + constraint id + unique (id), + constraint uk_common_group_device_platform + unique (device_id) +); + +create table if not exists wvp_common_region +( + id bigint unsigned auto_increment + primary key, + device_id varchar(50) not null, + name varchar(255) not null, + parent_id int null, + parent_device_id varchar(50) null, + create_time varchar(50) not null, + update_time varchar(50) not null, + constraint id + unique (id), + constraint uk_common_region_device_id + unique (device_id) +); + +create table IF NOT EXISTS wvp_device_channel +( + id serial primary key, + device_id character varying(50), + name character varying(255), + manufacturer character varying(50), + model character varying(50), + owner character varying(50), + civil_code character varying(50), + block character varying(50), + address character varying(50), + parental integer, + parent_id character varying(50), + safety_way integer, + register_way integer, + cert_num character varying(50), + certifiable integer, + err_code integer, + end_time character varying(50), + secrecy integer, + ip_address character varying(50), + port integer, + password character varying(255), + status character varying(50), + longitude double precision, + latitude double precision, + ptz_type integer, + position_type integer, + room_type integer, + use_type integer, + supply_light_type integer, + direction_type integer, + resolution character varying(255), + business_group_id character varying(255), + download_speed character varying(255), + svc_space_support_mod integer, + svc_time_support_mode integer, + create_time character varying(50) not null, + update_time character varying(50) not null, + sub_count integer, + stream_id character varying(255), + has_audio bool default false, + gps_time character varying(50), + stream_identification character varying(50), + channel_type int default 0 not null, + gb_device_id character varying(50), + gb_name character varying(255), + gb_manufacturer character varying(255), + gb_model character varying(255), + gb_owner character varying(255), + gb_civil_code character varying(255), + gb_block character varying(255), + gb_address character varying(255), + gb_parental integer, + gb_parent_id character varying(255), + gb_safety_way integer, + gb_register_way integer, + gb_cert_num character varying(50), + gb_certifiable integer, + gb_err_code integer, + gb_end_time character varying(50), + gb_secrecy integer, + gb_ip_address character varying(50), + gb_port integer, + gb_password character varying(50), + gb_status character varying(50), + gb_longitude double, + gb_latitude double, + gb_business_group_id character varying(50), + gb_ptz_type integer, + gb_position_type integer, + gb_room_type integer, + gb_use_type integer, + gb_supply_light_type integer, + gb_direction_type integer, + gb_resolution character varying(255), + gb_download_speed character varying(255), + gb_svc_space_support_mod integer, + gb_svc_time_support_mode integer, + record_plan_id integer, + data_type integer not null, + data_device_id integer not null, + constraint uk_wvp_unique_channel unique (gb_device_id) +); + +create table IF NOT EXISTS wvp_device_mobile_position +( + id serial primary key, + device_id character varying(50) not null, + channel_id character varying(50) not null, + device_name character varying(255), + time character varying(50), + longitude double precision, + latitude double precision, + altitude double precision, + speed double precision, + direction double precision, + report_source character varying(50), + create_time character varying(50) +); + +create table IF NOT EXISTS wvp_media_server +( + id character varying(255) primary key, + ip character varying(50), + hook_ip character varying(50), + sdp_ip character varying(50), + stream_ip character varying(50), + http_port integer, + http_ssl_port integer, + rtmp_port integer, + rtmp_ssl_port integer, + rtp_proxy_port integer, + rtsp_port integer, + rtsp_ssl_port integer, + flv_port integer, + flv_ssl_port integer, + ws_flv_port integer, + ws_flv_ssl_port integer, + auto_config bool default false, + secret character varying(50), + type character varying(50) default 'zlm', + rtp_enable bool default false, + rtp_port_range character varying(50), + send_rtp_port_range character varying(50), + record_assist_port integer, + default_server bool default false, + create_time character varying(50), + update_time character varying(50), + hook_alive_interval integer, + record_path character varying(255), + record_day integer default 7, + transcode_suffix character varying(255), + server_id character varying(50), + constraint uk_media_server_unique_ip_http_port unique (ip, http_port, server_id) +); + +create table IF NOT EXISTS wvp_platform +( + id serial primary key, + enable bool default false, + name character varying(255), + server_gb_id character varying(50), + server_gb_domain character varying(50), + server_ip character varying(50), + server_port integer, + device_gb_id character varying(50), + device_ip character varying(50), + device_port character varying(50), + username character varying(255), + password character varying(50), + expires character varying(50), + keep_timeout character varying(50), + transport character varying(50), + civil_code character varying(50), + manufacturer character varying(255), + model character varying(255), + address character varying(255), + character_set character varying(50), + ptz bool default false, + rtcp bool default false, + status bool default false, + catalog_group integer, + register_way integer, + secrecy integer, + create_time character varying(50), + update_time character varying(50), + as_message_channel bool default false, + catalog_with_platform integer default 1, + catalog_with_group integer default 1, + catalog_with_region integer default 1, + auto_push_channel bool default true, + send_stream_ip character varying(50), + server_id character varying(50), + constraint uk_platform_unique_server_gb_id unique (server_gb_id) +); + +create table IF NOT EXISTS wvp_stream_proxy +( + id serial primary key, + type character varying(50), + app character varying(255), + stream character varying(255), + src_url character varying(255), + timeout integer, + ffmpeg_cmd_key character varying(255), + rtsp_type character varying(50), + media_server_id character varying(50), + enable_audio bool default false, + enable_mp4 bool default false, + pulling bool default false, + enable bool default false, + enable_remove_none_reader bool default false, + create_time character varying(50), + name character varying(255), + update_time character varying(50), + stream_key character varying(255), + server_id character varying(50), + enable_disable_none_reader bool default false, + relates_media_server_id character varying(50), + constraint uk_stream_proxy_app_stream unique (app, stream) +); + +create table IF NOT EXISTS wvp_stream_push +( + id serial primary key, + app character varying(255), + stream character varying(255), + create_time character varying(50), + media_server_id character varying(50), + server_id character varying(50), + push_time character varying(50), + status bool default false, + update_time character varying(50), + pushing bool default false, + self bool default false, + start_offline_push bool default true, + constraint uk_stream_push_app_stream unique (app, stream) +); + +create table IF NOT EXISTS wvp_platform_channel +( + id serial primary key, + platform_id integer, + device_channel_id integer, + custom_device_id character varying(50), + custom_name character varying(255), + custom_manufacturer character varying(50), + custom_model character varying(50), + custom_owner character varying(50), + custom_civil_code character varying(50), + custom_block character varying(50), + custom_address character varying(50), + custom_parental integer, + custom_parent_id character varying(50), + custom_safety_way integer, + custom_register_way integer, + custom_cert_num character varying(50), + custom_certifiable integer, + custom_err_code integer, + custom_end_time character varying(50), + custom_secrecy integer, + custom_ip_address character varying(50), + custom_port integer, + custom_password character varying(255), + custom_status character varying(50), + custom_longitude double precision, + custom_latitude double precision, + custom_ptz_type integer, + custom_position_type integer, + custom_room_type integer, + custom_use_type integer, + custom_supply_light_type integer, + custom_direction_type integer, + custom_resolution character varying(255), + custom_business_group_id character varying(255), + custom_download_speed character varying(255), + custom_svc_space_support_mod integer, + custom_svc_time_support_mode integer, + constraint uk_platform_gb_channel_platform_id_catalog_id_device_channel_id unique (platform_id, device_channel_id), + constraint uk_platform_gb_channel_device_id unique (custom_device_id) +); + +create table IF NOT EXISTS wvp_platform_group +( + id serial primary key, + platform_id integer, + group_id integer, + constraint uk_wvp_platform_group_platform_id_group_id unique (platform_id, group_id) +); + +create table IF NOT EXISTS wvp_platform_region +( + id serial primary key, + platform_id integer, + region_id integer, + constraint uk_wvp_platform_region_platform_id_group_id unique (platform_id, region_id) +); + +create table IF NOT EXISTS wvp_record_plan +( + id serial primary key, + snap bool default false, + name varchar(255) NOT NULL, + create_time character varying(50), + update_time character varying(50) +); + +create table IF NOT EXISTS wvp_record_plan_item +( + id serial primary key, + start int, + stop int, + week_day int, + plan_id int, + create_time character varying(50), + update_time character varying(50) +); + + + +CREATE PROCEDURE `wvp_20250111`() +BEGIN + + DECLARE serverId VARCHAR(32) DEFAULT '你的服务ID'; + + IF EXISTS (SELECT column_name FROM information_schema.STATISTICS + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and INDEX_NAME = 'uk_stream_push_app_stream_path') + THEN + alter table wvp_cloud_record drop index uk_stream_push_app_stream_path ; + END IF; + + IF EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and column_name = 'folder') + THEN + alter table wvp_cloud_record modify folder varchar(500) null; + END IF; + + IF EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and column_name = 'file_path') + THEN + alter table wvp_cloud_record modify file_path varchar(500) null; + END IF; + + IF not EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and column_name = 'server_id') + THEN + alter table wvp_cloud_record add server_id character varying(50); + update wvp_cloud_record set server_id = serverId; + END IF; +END; +call wvp_20250111(); +DROP PROCEDURE wvp_20250111; + diff --git a/数据库/2.7.3/更新-mysql-2.7.3.sql b/数据库/2.7.3/更新-mysql-2.7.3.sql index 3cbc87297..247c536f4 100644 --- a/数据库/2.7.3/更新-mysql-2.7.3.sql +++ b/数据库/2.7.3/更新-mysql-2.7.3.sql @@ -1,64 +1,235 @@ +/* +* 20240528 +*/ +CREATE PROCEDURE `wvp_20240528`() +BEGIN + IF NOT EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_media_server' and column_name = 'transcode_suffix') + THEN + ALTER TABLE wvp_media_server ADD transcode_suffix character varying(255); + END IF; + + IF not EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_media_server' and column_name = 'type') + THEN + alter table wvp_media_server + add type character varying(50) default 'zlm'; + END IF; + + IF not EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_media_server' and column_name = 'flv_port') + THEN + alter table wvp_media_server add flv_port integer; + END IF; + + IF not EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_media_server' and column_name = 'flv_ssl_port') + THEN + alter table wvp_media_server add flv_ssl_port integer; + END IF; + + IF not EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_media_server' and column_name = 'ws_flv_port') + THEN + alter table wvp_media_server add ws_flv_port integer; + END IF; + + IF not EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_media_server' and column_name = 'ws_flv_ssl_port') + THEN + alter table wvp_media_server add ws_flv_ssl_port integer; + END IF; +END; +call wvp_20240528(); +DROP PROCEDURE wvp_20240528; + +create table IF NOT EXISTS wvp_user_api_key ( + id serial primary key , + user_id bigint, + app character varying(255) , + api_key text, + expired_at bigint, + remark character varying(255), + enable bool default true, + create_time character varying(50), + update_time character varying(50) +); + /* * 20241222 */ -alter table wvp_device_channel - drop index uk_wvp_device_channel_unique_device_channel; -alter table wvp_device_channel - drop index uk_wvp_unique_stream_push_id; -alter table wvp_device_channel - drop index uk_wvp_unique_stream_proxy_id; +CREATE PROCEDURE `wvp_20241222`() +BEGIN + IF EXISTS (SELECT column_name FROM information_schema.STATISTICS + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and INDEX_NAME = 'uk_wvp_device_channel_unique_device_channel') + THEN + alter table wvp_device_channel drop index uk_wvp_device_channel_unique_device_channel; + END IF; -alter table wvp_device_channel - add data_type integer not null; + IF EXISTS (SELECT column_name FROM information_schema.STATISTICS + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and INDEX_NAME = 'uk_wvp_unique_stream_push_id') + THEN + alter table wvp_device_channel drop index uk_wvp_unique_stream_push_id; + END IF; -alter table wvp_device_channel - add data_device_id integer not null; + IF EXISTS (SELECT column_name FROM information_schema.STATISTICS + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and INDEX_NAME = 'uk_wvp_unique_stream_proxy_id') + THEN + alter table wvp_device_channel drop index uk_wvp_unique_stream_proxy_id; + END IF; -update wvp_device_channel wdc INNER JOIN - (SELECT id, device_db_id from wvp_device_channel where device_db_id is not null ) ct on ct.id = wdc.id -set wdc.data_type = 1, wdc.data_device_id = ct.device_db_id where wdc.device_db_id is not null; + IF not EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'data_type') + THEN + alter table wvp_device_channel add data_type integer not null; + END IF; -update wvp_device_channel wdc INNER JOIN - (SELECT id, stream_push_id from wvp_device_channel where stream_push_id is not null ) ct on ct.id = wdc.id -set wdc.data_type = 2, wdc.data_device_id = ct.stream_push_id where wdc.stream_push_id is not null; + IF not EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'data_device_id') + THEN + alter table wvp_device_channel add data_device_id integer not null; + END IF; -update wvp_device_channel wdc INNER JOIN - (SELECT id, stream_proxy_id from wvp_device_channel where stream_proxy_id is not null ) ct on ct.id = wdc.id -set wdc.data_type = 3, wdc.data_device_id = ct.stream_proxy_id where wdc.stream_proxy_id is not null; + IF EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'device_db_id') + THEN + update wvp_device_channel wdc INNER JOIN + (SELECT id, device_db_id from wvp_device_channel where device_db_id is not null ) ct on ct.id = wdc.id + set wdc.data_type = 1, wdc.data_device_id = ct.device_db_id where wdc.device_db_id is not null; + alter table wvp_device_channel drop device_db_id; + END IF; -alter table wvp_device_channel drop device_db_id; -alter table wvp_device_channel drop stream_push_id; -alter table wvp_device_channel drop stream_proxy_id; + IF EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'stream_push_id') + THEN + update wvp_device_channel wdc INNER JOIN + (SELECT id, stream_push_id from wvp_device_channel where stream_push_id is not null ) ct on ct.id = wdc.id + set wdc.data_type = 2, wdc.data_device_id = ct.stream_push_id where wdc.stream_push_id is not null; + alter table wvp_device_channel drop stream_push_id; + END IF; + + IF EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'stream_proxy_id') + THEN + update wvp_device_channel wdc INNER JOIN + (SELECT id, stream_proxy_id from wvp_device_channel where stream_proxy_id is not null ) ct on ct.id = wdc.id + set wdc.data_type = 3, wdc.data_device_id = ct.stream_proxy_id where wdc.stream_proxy_id is not null; + alter table wvp_device_channel drop stream_proxy_id; + END IF; +END; +call wvp_20241222(); +DROP PROCEDURE wvp_20241222; /* * 20241231 */ -alter table wvp_stream_proxy add relates_media_server_id character varying(50); +CREATE PROCEDURE `wvp_20241231`() +BEGIN + IF not EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_stream_proxy' and column_name = 'relates_media_server_id') + THEN + alter table wvp_stream_proxy add relates_media_server_id character varying(50); + END IF; +END; +call wvp_20241231(); +DROP PROCEDURE wvp_20241231; + /* * 20250111 */ -drop index uk_stream_push_app_stream_path on wvp_cloud_record; -alter table wvp_cloud_record change folder folder varchar(500) null; -alter table wvp_cloud_record change file_path file_path varchar(500) null; +CREATE PROCEDURE `wvp_20250111`() +BEGIN + IF EXISTS (SELECT column_name FROM information_schema.STATISTICS + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and INDEX_NAME = 'uk_stream_push_app_stream_path') + THEN + alter table wvp_cloud_record drop index uk_stream_push_app_stream_path ; + END IF; + + IF EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and column_name = 'folder') + THEN + alter table wvp_cloud_record modify folder varchar(500) null; + END IF; + + IF EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and column_name = 'file_path') + THEN + alter table wvp_cloud_record modify file_path varchar(500) null; + END IF; +END; +call wvp_20250111(); +DROP PROCEDURE wvp_20250111; + /* * 20250211 */ -alter table wvp_device change keepalive_interval_time heart_beat_interval integer; -alter table wvp_device add heart_beat_count integer; -alter table wvp_device add position_capability integer; +CREATE PROCEDURE `wvp_20250211`() +BEGIN + IF EXISTS (SELECT column_name FROM information_schema.STATISTICS + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device' and column_name = 'keepalive_interval_time') + THEN + alter table wvp_device change keepalive_interval_time heart_beat_interval integer after as_message_channel; + END IF; + + IF not EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device' and column_name = 'heart_beat_count') + THEN + alter table wvp_device add heart_beat_count integer; + END IF; + + IF not EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device' and column_name = 'position_capability') + THEN + alter table wvp_device add position_capability integer; + END IF; +END; +call wvp_20250211(); +DROP PROCEDURE wvp_20250211; + /** * 20250312 */ -alter table wvp_device add server_id character varying(50); -alter table wvp_media_server add server_id character varying(50); -alter table wvp_stream_proxy add server_id character varying(50); -alter table wvp_cloud_record add server_id character varying(50); -alter table wvp_platform add server_id character varying(50); +CREATE PROCEDURE `wvp_20250312`() +BEGIN + DECLARE serverId VARCHAR(32) DEFAULT '你的服务ID'; + IF not EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device' and column_name = 'server_id') + THEN + alter table wvp_device add server_id character varying(50); + update wvp_device set server_id = serverId; + END IF; + + IF not EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_media_server' and column_name = 'server_id') + THEN + alter table wvp_media_server add server_id character varying(50); + update wvp_media_server set server_id = serverId; + END IF; + + IF not EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_stream_proxy' and column_name = 'server_id') + THEN + alter table wvp_stream_proxy add server_id character varying(50); + update wvp_stream_proxy set server_id = serverId; + END IF; + + IF not EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_cloud_record' and column_name = 'server_id') + THEN + alter table wvp_cloud_record add server_id character varying(50); + update wvp_cloud_record set server_id = serverId; + END IF; + + IF not EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_platform' and column_name = 'server_id') + THEN + alter table wvp_platform add server_id character varying(50); + END IF; +END; +call wvp_20250312(); +DROP PROCEDURE wvp_20250312; + -update wvp_device set server_id = "你服务的ID"; -update wvp_media_server set server_id = "你服务的ID"; -update wvp_stream_proxy set server_id = "你服务的ID"; -update wvp_cloud_record set server_id = "你服务的ID"; diff --git a/数据库/2.7.3/更新-postgresql-kingbase-2.7.1升级到2.7.3.sql b/数据库/2.7.3/更新-postgresql-kingbase-2.7.1升级到2.7.3.sql new file mode 100644 index 000000000..43ed0066c --- /dev/null +++ b/数据库/2.7.3/更新-postgresql-kingbase-2.7.1升级到2.7.3.sql @@ -0,0 +1,384 @@ +drop table if exists wvp_resources_tree; +drop table if exists wvp_platform_catalog; +drop table if exists wvp_platform_gb_stream; +drop table if exists wvp_platform_gb_channel; +drop table if exists wvp_gb_stream; +drop table if exists wvp_log; +drop table IF EXISTS wvp_device; +drop table IF EXISTS wvp_platform; +drop table IF EXISTS wvp_media_server; +drop table IF EXISTS wvp_device_mobile_position; +drop table IF EXISTS wvp_device_channel; +drop table IF EXISTS wvp_stream_proxy; +drop table IF EXISTS wvp_stream_push; + +create table IF NOT EXISTS wvp_device +( + id serial primary key, + device_id character varying(50) not null, + name character varying(255), + manufacturer character varying(255), + model character varying(255), + firmware character varying(255), + transport character varying(50), + stream_mode character varying(50), + on_line bool default false, + register_time character varying(50), + keepalive_time character varying(50), + ip character varying(50), + create_time character varying(50), + update_time character varying(50), + port integer, + expires integer, + subscribe_cycle_for_catalog integer DEFAULT 0, + subscribe_cycle_for_mobile_position integer DEFAULT 0, + mobile_position_submission_interval integer DEFAULT 5, + subscribe_cycle_for_alarm integer DEFAULT 0, + host_address character varying(50), + charset character varying(50), + ssrc_check bool default false, + geo_coord_sys character varying(50), + media_server_id character varying(50) default 'auto', + custom_name character varying(255), + sdp_ip character varying(50), + local_ip character varying(50), + password character varying(255), + as_message_channel bool default false, + heart_beat_interval integer, + heart_beat_count integer, + position_capability integer, + broadcast_push_after_ack bool default false, + server_id character varying(50), + constraint uk_device_device unique (device_id) +); + +create table IF NOT EXISTS wvp_device_channel +( + id serial primary key, + device_id character varying(50), + name character varying(255), + manufacturer character varying(50), + model character varying(50), + owner character varying(50), + civil_code character varying(50), + block character varying(50), + address character varying(50), + parental integer, + parent_id character varying(50), + safety_way integer, + register_way integer, + cert_num character varying(50), + certifiable integer, + err_code integer, + end_time character varying(50), + secrecy integer, + ip_address character varying(50), + port integer, + password character varying(255), + status character varying(50), + longitude double precision, + latitude double precision, + ptz_type integer, + position_type integer, + room_type integer, + use_type integer, + supply_light_type integer, + direction_type integer, + resolution character varying(255), + business_group_id character varying(255), + download_speed character varying(255), + svc_space_support_mod integer, + svc_time_support_mode integer, + create_time character varying(50) not null, + update_time character varying(50) not null, + sub_count integer, + stream_id character varying(255), + has_audio bool default false, + gps_time character varying(50), + stream_identification character varying(50), + channel_type int default 0 not null, + gb_device_id character varying(50), + gb_name character varying(255), + gb_manufacturer character varying(255), + gb_model character varying(255), + gb_owner character varying(255), + gb_civil_code character varying(255), + gb_block character varying(255), + gb_address character varying(255), + gb_parental integer, + gb_parent_id character varying(255), + gb_safety_way integer, + gb_register_way integer, + gb_cert_num character varying(50), + gb_certifiable integer, + gb_err_code integer, + gb_end_time character varying(50), + gb_secrecy integer, + gb_ip_address character varying(50), + gb_port integer, + gb_password character varying(50), + gb_status character varying(50), + gb_longitude double precision, + gb_latitude double precision, + gb_business_group_id character varying(50), + gb_ptz_type integer, + gb_position_type integer, + gb_room_type integer, + gb_use_type integer, + gb_supply_light_type integer, + gb_direction_type integer, + gb_resolution character varying(255), + gb_download_speed character varying(255), + gb_svc_space_support_mod integer, + gb_svc_time_support_mode integer, + record_plan_id integer, + data_type integer not null, + data_device_id integer not null, + constraint uk_wvp_unique_channel unique (gb_device_id) +); + +create table IF NOT EXISTS wvp_device_mobile_position +( + id serial primary key, + device_id character varying(50) not null, + channel_id character varying(50) not null, + device_name character varying(255), + time character varying(50), + longitude double precision, + latitude double precision, + altitude double precision, + speed double precision, + direction double precision, + report_source character varying(50), + create_time character varying(50) +); + +create table IF NOT EXISTS wvp_media_server +( + id character varying(255) primary key, + ip character varying(50), + hook_ip character varying(50), + sdp_ip character varying(50), + stream_ip character varying(50), + http_port integer, + http_ssl_port integer, + rtmp_port integer, + rtmp_ssl_port integer, + rtp_proxy_port integer, + rtsp_port integer, + rtsp_ssl_port integer, + flv_port integer, + flv_ssl_port integer, + ws_flv_port integer, + ws_flv_ssl_port integer, + auto_config bool default false, + secret character varying(50), + type character varying(50) default 'zlm', + rtp_enable bool default false, + rtp_port_range character varying(50), + send_rtp_port_range character varying(50), + record_assist_port integer, + default_server bool default false, + create_time character varying(50), + update_time character varying(50), + hook_alive_interval integer, + record_path character varying(255), + record_day integer default 7, + transcode_suffix character varying(255), + server_id character varying(50), + constraint uk_media_server_unique_ip_http_port unique (ip, http_port, server_id) +); + +create table IF NOT EXISTS wvp_common_group +( + id serial primary key, + device_id varchar(50) NOT NULL, + name varchar(255) NOT NULL, + parent_id int, + parent_device_id varchar(50) DEFAULT NULL, + business_group varchar(50) NOT NULL, + create_time varchar(50) NOT NULL, + update_time varchar(50) NOT NULL, + civil_code varchar(50) default null, + constraint uk_common_group_device_platform unique (device_id) +); + +create table IF NOT EXISTS wvp_common_region +( + id serial primary key, + device_id varchar(50) NOT NULL, + name varchar(255) NOT NULL, + parent_id int, + parent_device_id varchar(50) DEFAULT NULL, + create_time varchar(50) NOT NULL, + update_time varchar(50) NOT NULL, + constraint uk_common_region_device_id unique (device_id) +); + +create table IF NOT EXISTS wvp_record_plan +( + id serial primary key, + snap bool default false, + name varchar(255) NOT NULL, + create_time character varying(50), + update_time character varying(50) +); + +create table IF NOT EXISTS wvp_record_plan_item +( + id serial primary key, + "start" int, + stop int, + week_day int, + plan_id int, + create_time character varying(50), + update_time character varying(50) +); + +create table IF NOT EXISTS wvp_platform +( + id serial primary key, + enable bool default false, + name character varying(255), + server_gb_id character varying(50), + server_gb_domain character varying(50), + server_ip character varying(50), + server_port integer, + device_gb_id character varying(50), + device_ip character varying(50), + device_port character varying(50), + username character varying(255), + password character varying(50), + expires character varying(50), + keep_timeout character varying(50), + transport character varying(50), + civil_code character varying(50), + manufacturer character varying(255), + model character varying(255), + address character varying(255), + character_set character varying(50), + ptz bool default false, + rtcp bool default false, + status bool default false, + catalog_group integer, + register_way integer, + secrecy integer, + create_time character varying(50), + update_time character varying(50), + as_message_channel bool default false, + catalog_with_platform integer default 1, + catalog_with_group integer default 1, + catalog_with_region integer default 1, + auto_push_channel bool default true, + send_stream_ip character varying(50), + server_id character varying(50), + constraint uk_platform_unique_server_gb_id unique (server_gb_id) +); + +create table IF NOT EXISTS wvp_platform_channel +( + id serial primary key, + platform_id integer, + device_channel_id integer, + custom_device_id character varying(50), + custom_name character varying(255), + custom_manufacturer character varying(50), + custom_model character varying(50), + custom_owner character varying(50), + custom_civil_code character varying(50), + custom_block character varying(50), + custom_address character varying(50), + custom_parental integer, + custom_parent_id character varying(50), + custom_safety_way integer, + custom_register_way integer, + custom_cert_num character varying(50), + custom_certifiable integer, + custom_err_code integer, + custom_end_time character varying(50), + custom_secrecy integer, + custom_ip_address character varying(50), + custom_port integer, + custom_password character varying(255), + custom_status character varying(50), + custom_longitude double precision, + custom_latitude double precision, + custom_ptz_type integer, + custom_position_type integer, + custom_room_type integer, + custom_use_type integer, + custom_supply_light_type integer, + custom_direction_type integer, + custom_resolution character varying(255), + custom_business_group_id character varying(255), + custom_download_speed character varying(255), + custom_svc_space_support_mod integer, + custom_svc_time_support_mode integer, + constraint uk_platform_gb_channel_platform_id_catalog_id_device_channel_id unique (platform_id, device_channel_id), + constraint uk_platform_gb_channel_device_id unique (custom_device_id) +); + +create table IF NOT EXISTS wvp_platform_group +( + id serial primary key, + platform_id integer, + group_id integer, + constraint uk_wvp_platform_group_platform_id_group_id unique (platform_id, group_id) +); + +create table IF NOT EXISTS wvp_platform_region +( + id serial primary key, + platform_id integer, + region_id integer, + constraint uk_wvp_platform_region_platform_id_group_id unique (platform_id, region_id) +); + +create table IF NOT EXISTS wvp_stream_proxy +( + id serial primary key, + type character varying(50), + app character varying(255), + stream character varying(255), + src_url character varying(255), + timeout integer, + ffmpeg_cmd_key character varying(255), + rtsp_type character varying(50), + media_server_id character varying(50), + enable_audio bool default false, + enable_mp4 bool default false, + pulling bool default false, + enable bool default false, + enable_remove_none_reader bool default false, + create_time character varying(50), + name character varying(255), + update_time character varying(50), + stream_key character varying(255), + server_id character varying(50), + enable_disable_none_reader bool default false, + relates_media_server_id character varying(50), + constraint uk_stream_proxy_app_stream unique (app, stream) +); + +create table IF NOT EXISTS wvp_stream_push +( + id serial primary key, + app character varying(255), + stream character varying(255), + create_time character varying(50), + media_server_id character varying(50), + server_id character varying(50), + push_time character varying(50), + status bool default false, + update_time character varying(50), + pushing bool default false, + self bool default false, + start_offline_push bool default true, + constraint uk_stream_push_app_stream unique (app, stream) +); +alter table wvp_cloud_record add column if not exists server_id character varying(50); +ALTER TABLE wvp_cloud_record DROP CONSTRAINT IF EXISTS uk_stream_push_app_stream_path; +alter table wvp_cloud_record alter folder type varchar(500); +alter table wvp_cloud_record alter file_path type varchar(500); +update wvp_cloud_record set server_id = '你的服务ID'; + diff --git a/数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql b/数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql index 8bc275a8d..9bd7cf2b1 100644 --- a/数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql +++ b/数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql @@ -1,63 +1,99 @@ +/* +* 20240528 +*/ +ALTER TABLE wvp_media_server ADD COLUMN IF NOT EXISTS transcode_suffix character varying(255); +ALTER table wvp_media_server ADD COLUMN IF NOT EXISTS type character varying(50) default 'zlm'; +ALTER table wvp_media_server ADD COLUMN IF NOT EXISTS flv_port integer; +ALTER table wvp_media_server ADD COLUMN IF NOT EXISTS flv_ssl_port integer; +ALTER table wvp_media_server ADD COLUMN IF NOT EXISTS ws_flv_port integer; +ALTER table wvp_media_server ADD COLUMN IF NOT EXISTS ws_flv_ssl_port integer; + + +create table IF NOT EXISTS wvp_user_api_key ( + id serial primary key , + user_id bigint, + app character varying(255) , + api_key text, + expired_at bigint, + remark character varying(255), + enable bool default true, + create_time character varying(50), + update_time character varying(50) +); + /* * 20241222 */ +ALTER TABLE wvp_device_channel drop CONSTRAINT IF EXISTS uk_wvp_device_channel_unique_device_channel; +ALTER TABLE wvp_device_channel DROP CONSTRAINT IF EXISTS uk_wvp_unique_stream_push_id; +ALTER TABLE wvp_device_channel DROP CONSTRAINT IF EXISTS uk_wvp_unique_stream_proxy_id; -alter table wvp_device_channel - drop index uk_wvp_device_channel_unique_device_channel; -alter table wvp_device_channel - drop index uk_wvp_unique_stream_push_id; -alter table wvp_device_channel - drop index uk_wvp_unique_stream_proxy_id; +ALTER TABLE wvp_device_channel ADD COLUMN IF NOT EXISTS data_type integer not null; +ALTER TABLE wvp_device_channel ADD COLUMN IF NOT EXISTS data_device_id integer not null; -alter table wvp_device_channel - add data_type integer not null; +DO $$ + BEGIN + IF EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT current_schema()) and table_name = 'wvp_device_channel' and column_name = 'device_db_id') + THEN + update wvp_device_channel wdc set data_type = 1, data_device_id = + (SELECT device_db_id from wvp_device_channel where device_db_id is not null and id = wdc.id ) + where device_db_id is not null; + END IF; -alter table wvp_device_channel - add data_device_id integer not null; + IF EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT current_schema()) and table_name = 'wvp_device_channel' and column_name = 'stream_push_id') + THEN + update wvp_device_channel wdc set data_type = 2, data_device_id = + (SELECT stream_push_id from wvp_device_channel where stream_push_id is not null and id = wdc.id ) + where stream_push_id is not null; + END IF; -update wvp_device_channel wdc -set data_type = 1, data_device_id = (SELECT device_db_id from wvp_device_channel where device_db_id is not null and id = wdc.id ) where device_db_id is not null; + IF EXISTS (SELECT column_name FROM information_schema.columns + WHERE TABLE_SCHEMA = (SELECT current_schema()) and table_name = 'wvp_device_channel' and column_name = 'stream_proxy_id') + THEN + update wvp_device_channel wdc set data_type = 3, data_device_id = (SELECT stream_proxy_id from wvp_device_channel where stream_proxy_id is not null and id = wdc.id ) + where stream_proxy_id is not null; + END IF; + END $$; -update wvp_device_channel wdc -set data_type = 2, data_device_id = (SELECT stream_push_id from wvp_device_channel where stream_push_id is not null and id = wdc.id ) where stream_push_id is not null; -update wvp_device_channel wdc -set data_type = 3, data_device_id = (SELECT stream_proxy_id from wvp_device_channel where stream_proxy_id is not null and id = wdc.id ) where stream_proxy_id is not null; - -alter table wvp_device_channel drop device_db_id; -alter table wvp_device_channel drop stream_push_id; -alter table wvp_device_channel drop stream_proxy_id; +alter table wvp_device_channel drop column IF EXISTS device_db_id; +alter table wvp_device_channel drop column IF EXISTS stream_push_id; +alter table wvp_device_channel drop column IF EXISTS stream_proxy_id; /* * 20241231 */ -alter table wvp_stream_proxy add relates_media_server_id character varying(50); - +alter table wvp_stream_proxy add column IF NOT EXISTS relates_media_server_id character varying(50); /* * 20250111 */ -drop index uk_stream_push_app_stream_path on wvp_cloud_record; -alter table wvp_cloud_record change folder folder varchar(500) null; -alter table wvp_cloud_record change file_path file_path varchar(500) null; +ALTER TABLE wvp_cloud_record DROP CONSTRAINT IF EXISTS uk_stream_push_app_stream_path; +alter table wvp_cloud_record alter folder type varchar(500); +alter table wvp_cloud_record alter file_path type varchar(500); /* * 20250211 */ -alter table wvp_device change keepalive_interval_time heart_beat_interval integer; -alter table wvp_device add heart_beat_count integer; -alter table wvp_device add position_capability integer; +alter table wvp_device rename keepalive_interval_time to heart_beat_interval; +alter table wvp_device add column if not exists heart_beat_count integer; +alter table wvp_device add column if not exists position_capability integer; /** * 20250312 */ -alter table wvp_device add server_id character varying(50); -alter table wvp_media_server add server_id character varying(50); -alter table wvp_stream_proxy add server_id character varying(50); -alter table wvp_cloud_record add server_id character varying(50); -alter table wvp_platform add server_id character varying(50); +alter table wvp_device add column if not exists server_id character varying(50); +alter table wvp_media_server add column if not exists server_id character varying(50); +alter table wvp_stream_proxy add column if not exists server_id character varying(50); +alter table wvp_cloud_record add column if not exists server_id character varying(50); +alter table wvp_platform add column if not exists server_id character varying(50); + +update wvp_device set server_id = '你的服务ID'; +update wvp_media_server set server_id = '你的服务ID'; +update wvp_stream_proxy set server_id = '你的服务ID'; +update wvp_cloud_record set server_id = '你的服务ID'; + + -update wvp_device set server_id = "你服务的ID"; -update wvp_media_server set server_id = "你服务的ID"; -update wvp_stream_proxy set server_id = "你服务的ID"; -update wvp_cloud_record set server_id = "你服务的ID"; From 1e98f1df65caf41e3807feafc20dc760031ecc71 Mon Sep 17 00:00:00 2001 From: lin <648540858@qq.com> Date: Wed, 19 Mar 2025 14:11:05 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/genersoft/iot/vmp/common/GeneralCallback.java | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 src/main/java/com/genersoft/iot/vmp/common/GeneralCallback.java diff --git a/src/main/java/com/genersoft/iot/vmp/common/GeneralCallback.java b/src/main/java/com/genersoft/iot/vmp/common/GeneralCallback.java deleted file mode 100644 index df07fac5e..000000000 --- a/src/main/java/com/genersoft/iot/vmp/common/GeneralCallback.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.genersoft.iot.vmp.common; - -public interface GeneralCallback{ - void run(int code, String msg, T data); -} From 06de25bb4d78f58405eca9c53c500009abc9fcba Mon Sep 17 00:00:00 2001 From: lin <648540858@qq.com> Date: Wed, 19 Mar 2025 15:45:23 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BD=AC=E7=A0=81?= =?UTF-8?q?=E6=97=B6=E6=8B=89=E6=B5=81=E4=BB=A3=E7=90=86=E6=97=A0=E4=BA=BA?= =?UTF-8?q?=E8=A7=82=E7=9C=8B=E6=97=A0=E6=B3=95=E7=A7=BB=E9=99=A4=E7=9A=84?= =?UTF-8?q?BUG=EF=BC=8C=20=E4=BF=AE=E5=A4=8D=E6=A0=B9=E6=8D=AE=E8=AF=B7?= =?UTF-8?q?=E6=B1=82IP=E8=BF=94=E5=9B=9E=E6=B5=81=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/media/bean/MediaServer.java | 266 +----- .../service/impl/MediaServerServiceImpl.java | 6 +- .../vmp/media/zlm/ZLMHttpHookListener.java | 3 + .../zlm/ZLMMediaServerStatusManager.java | 4 +- .../vmp/media/zlm/dto/ZLMServerConfig.java | 892 +----------------- .../storager/impl/RedisCatchStorageImpl.java | 2 +- 6 files changed, 18 insertions(+), 1155 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/media/bean/MediaServer.java b/src/main/java/com/genersoft/iot/vmp/media/bean/MediaServer.java index 2660cb6a9..431eb29d8 100755 --- a/src/main/java/com/genersoft/iot/vmp/media/bean/MediaServer.java +++ b/src/main/java/com/genersoft/iot/vmp/media/bean/MediaServer.java @@ -3,9 +3,11 @@ package com.genersoft.iot.vmp.media.bean; import com.genersoft.iot.vmp.media.zlm.dto.ZLMServerConfig; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; import org.springframework.util.ObjectUtils; @Schema(description = "流媒体服务信息") +@Data public class MediaServer { @Schema(description = "ID") @@ -135,268 +137,4 @@ public class MediaServer { transcodeSuffix = zlmServerConfig.getTranscodeSuffix(); } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public String getHookIp() { - return hookIp; - } - - public void setHookIp(String hookIp) { - this.hookIp = hookIp; - } - - public String getSdpIp() { - return sdpIp; - } - - public void setSdpIp(String sdpIp) { - this.sdpIp = sdpIp; - } - - public String getStreamIp() { - return streamIp; - } - - public void setStreamIp(String streamIp) { - this.streamIp = streamIp; - } - - public int getHttpPort() { - return httpPort; - } - - public void setHttpPort(int httpPort) { - this.httpPort = httpPort; - } - - public int getHttpSSlPort() { - return httpSSlPort; - } - - public void setHttpSSlPort(int httpSSlPort) { - this.httpSSlPort = httpSSlPort; - } - - public int getRtmpPort() { - return rtmpPort; - } - - public void setRtmpPort(int rtmpPort) { - this.rtmpPort = rtmpPort; - } - - public int getRtmpSSlPort() { - return rtmpSSlPort; - } - - public void setRtmpSSlPort(int rtmpSSlPort) { - this.rtmpSSlPort = rtmpSSlPort; - } - - public int getRtpProxyPort() { - return rtpProxyPort; - } - - public void setRtpProxyPort(int rtpProxyPort) { - this.rtpProxyPort = rtpProxyPort; - } - - public int getRtspPort() { - return rtspPort; - } - - public void setRtspPort(int rtspPort) { - this.rtspPort = rtspPort; - } - - public int getRtspSSLPort() { - return rtspSSLPort; - } - - public void setRtspSSLPort(int rtspSSLPort) { - this.rtspSSLPort = rtspSSLPort; - } - - public boolean isAutoConfig() { - return autoConfig; - } - - public void setAutoConfig(boolean autoConfig) { - this.autoConfig = autoConfig; - } - - public String getSecret() { - return secret; - } - - public void setSecret(String secret) { - this.secret = secret; - } - - public boolean isRtpEnable() { - return rtpEnable; - } - - public void setRtpEnable(boolean rtpEnable) { - this.rtpEnable = rtpEnable; - } - - public String getRtpPortRange() { - return rtpPortRange; - } - - public void setRtpPortRange(String rtpPortRange) { - this.rtpPortRange = rtpPortRange; - } - - public int getRecordAssistPort() { - return recordAssistPort; - } - - public void setRecordAssistPort(int recordAssistPort) { - this.recordAssistPort = recordAssistPort; - } - - public boolean isDefaultServer() { - return defaultServer; - } - - public void setDefaultServer(boolean defaultServer) { - this.defaultServer = defaultServer; - } - - public String getCreateTime() { - return createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(String updateTime) { - this.updateTime = updateTime; - } - - public boolean isStatus() { - return status; - } - - public void setStatus(boolean status) { - this.status = status; - } - - public String getLastKeepaliveTime() { - return lastKeepaliveTime; - } - - public void setLastKeepaliveTime(String lastKeepaliveTime) { - this.lastKeepaliveTime = lastKeepaliveTime; - } - - public Float getHookAliveInterval() { - return hookAliveInterval; - } - - public void setHookAliveInterval(Float hookAliveInterval) { - this.hookAliveInterval = hookAliveInterval; - } - - public String getSendRtpPortRange() { - return sendRtpPortRange; - } - - public void setSendRtpPortRange(String sendRtpPortRange) { - this.sendRtpPortRange = sendRtpPortRange; - } - - public int getRecordDay() { - return recordDay; - } - - public void setRecordDay(int recordDay) { - this.recordDay = recordDay; - } - - public String getRecordPath() { - return recordPath; - } - - public void setRecordPath(String recordPath) { - this.recordPath = recordPath; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public int getFlvPort() { - return flvPort; - } - - public void setFlvPort(int flvPort) { - this.flvPort = flvPort; - } - - public int getFlvSSLPort() { - return flvSSLPort; - } - - public void setFlvSSLPort(int flvSSLPort) { - this.flvSSLPort = flvSSLPort; - } - - public int getWsFlvPort() { - return wsFlvPort; - } - - public void setWsFlvPort(int wsFlvPort) { - this.wsFlvPort = wsFlvPort; - } - - public int getWsFlvSSLPort() { - return wsFlvSSLPort; - } - - public void setWsFlvSSLPort(int wsFlvSSLPort) { - this.wsFlvSSLPort = wsFlvSSLPort; - } - - public String getTranscodeSuffix() { - return transcodeSuffix; - } - - public void setTranscodeSuffix(String transcodeSuffix) { - this.transcodeSuffix = transcodeSuffix; - } - - public String getServerId() { - return serverId; - } - - public void setServerId(String serverId) { - this.serverId = serverId; - } } diff --git a/src/main/java/com/genersoft/iot/vmp/media/service/impl/MediaServerServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/media/service/impl/MediaServerServiceImpl.java index 0a089cf2f..98f9c7518 100755 --- a/src/main/java/com/genersoft/iot/vmp/media/service/impl/MediaServerServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/media/service/impl/MediaServerServiceImpl.java @@ -794,7 +794,11 @@ public class MediaServerServiceImpl implements IMediaServerService { if (streamInfoList == null || streamInfoList.isEmpty()) { return null; }else { - return streamInfoList.get(0); + StreamInfo streamInfo = streamInfoList.get(0); + if (addr != null && !addr.isEmpty()) { + streamInfo.changeStreamIp(addr); + } + return streamInfo; } } diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java index 87aa801ea..9c2cd6b96 100755 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java @@ -177,6 +177,9 @@ public class ZLMHttpHookListener { ret.put("code", 0); return ret; } + if (param.getStream().endsWith(mediaInfo.getTranscodeSuffix())) { + param.setStream(param.getStream().substring(0, param.getStream().lastIndexOf(mediaInfo.getTranscodeSuffix()) - 1)); + } if (!ObjectUtils.isEmpty(mediaInfo.getTranscodeSuffix()) && !"null".equalsIgnoreCase(mediaInfo.getTranscodeSuffix()) && param.getStream().endsWith(mediaInfo.getTranscodeSuffix()) ) { diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaServerStatusManager.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaServerStatusManager.java index 029e46ca8..df105e369 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaServerStatusManager.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaServerStatusManager.java @@ -186,7 +186,6 @@ public class ZLMMediaServerStatusManager { log.info("[ZLM-连接成功] ID:{}, 地址: {}:{}", mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort()); mediaServerItem.setStatus(true); mediaServerItem.setHookAliveInterval(10F); - mediaServerService.update(mediaServerItem); // 发送上线通知 eventPublisher.mediaServerOnlineEventPublish(mediaServerItem); if(mediaServerItem.isAutoConfig()) { @@ -243,6 +242,9 @@ public class ZLMMediaServerStatusManager { if (mediaServerItem.getWsFlvSSLPort() == 0) { mediaServerItem.setWsFlvSSLPort(zlmServerConfig.getHttpSSLport()); } + if (Objects.isNull(mediaServerItem.getTranscodeSuffix())) { + mediaServerItem.setTranscodeSuffix(zlmServerConfig.getTranscodeSuffix()); + } mediaServerItem.setHookAliveInterval(10F); } diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/ZLMServerConfig.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/ZLMServerConfig.java index 05fc57d0a..84ebc3e32 100755 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/ZLMServerConfig.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/ZLMServerConfig.java @@ -2,7 +2,11 @@ package com.genersoft.iot.vmp.media.zlm.dto; import com.alibaba.fastjson2.annotation.JSONField; import com.genersoft.iot.vmp.media.zlm.dto.hook.HookParam; +import lombok.Data; +import lombok.EqualsAndHashCode; +@EqualsAndHashCode(callSuper = true) +@Data public class ZLMServerConfig extends HookParam { @JSONField(name = "api.apiDebug") @@ -334,892 +338,4 @@ public class ZLMServerConfig extends HookParam { @JSONField(name = "transcode.suffix") private String transcodeSuffix; - - public String getHookIp() { - return hookIp; - } - - public void setHookIp(String hookIp) { - this.hookIp = hookIp; - } - - public String getApiDebug() { - return apiDebug; - } - - public void setApiDebug(String apiDebug) { - this.apiDebug = apiDebug; - } - - public String getApiSecret() { - return apiSecret; - } - - public void setApiSecret(String apiSecret) { - this.apiSecret = apiSecret; - } - - public String getFfmpegBin() { - return ffmpegBin; - } - - public void setFfmpegBin(String ffmpegBin) { - this.ffmpegBin = ffmpegBin; - } - - public String getFfmpegCmd() { - return ffmpegCmd; - } - - public void setFfmpegCmd(String ffmpegCmd) { - this.ffmpegCmd = ffmpegCmd; - } - - public String getFfmpegLog() { - return ffmpegLog; - } - - public void setFfmpegLog(String ffmpegLog) { - this.ffmpegLog = ffmpegLog; - } - - public String getGeneralEnableVhost() { - return generalEnableVhost; - } - - public void setGeneralEnableVhost(String generalEnableVhost) { - this.generalEnableVhost = generalEnableVhost; - } - - public String getGeneralMediaServerId() { - return generalMediaServerId; - } - - public void setGeneralMediaServerId(String generalMediaServerId) { - this.generalMediaServerId = generalMediaServerId; - } - - public String getGeneralFlowThreshold() { - return generalFlowThreshold; - } - - public void setGeneralFlowThreshold(String generalFlowThreshold) { - this.generalFlowThreshold = generalFlowThreshold; - } - - public String getGeneralMaxStreamWaitMS() { - return generalMaxStreamWaitMS; - } - - public void setGeneralMaxStreamWaitMS(String generalMaxStreamWaitMS) { - this.generalMaxStreamWaitMS = generalMaxStreamWaitMS; - } - - public int getGeneralStreamNoneReaderDelayMS() { - return generalStreamNoneReaderDelayMS; - } - - public void setGeneralStreamNoneReaderDelayMS(int generalStreamNoneReaderDelayMS) { - this.generalStreamNoneReaderDelayMS = generalStreamNoneReaderDelayMS; - } - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public String getSdpIp() { - return sdpIp; - } - - public void setSdpIp(String sdpIp) { - this.sdpIp = sdpIp; - } - - public String getStreamIp() { - return streamIp; - } - - public void setStreamIp(String streamIp) { - this.streamIp = streamIp; - } - - public String getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(String updateTime) { - this.updateTime = updateTime; - } - - public String getCreateTime() { - return createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getHlsFileBufSize() { - return hlsFileBufSize; - } - - public void setHlsFileBufSize(String hlsFileBufSize) { - this.hlsFileBufSize = hlsFileBufSize; - } - - public String getHlsFilePath() { - return hlsFilePath; - } - - public void setHlsFilePath(String hlsFilePath) { - this.hlsFilePath = hlsFilePath; - } - - public String getHlsSegDur() { - return hlsSegDur; - } - - public void setHlsSegDur(String hlsSegDur) { - this.hlsSegDur = hlsSegDur; - } - - public String getHlsSegNum() { - return hlsSegNum; - } - - public void setHlsSegNum(String hlsSegNum) { - this.hlsSegNum = hlsSegNum; - } - - public String getHookAccessFileExceptHLS() { - return hookAccessFileExceptHLS; - } - - public void setHookAccessFileExceptHLS(String hookAccessFileExceptHLS) { - this.hookAccessFileExceptHLS = hookAccessFileExceptHLS; - } - - public String getHookAdminParams() { - return hookAdminParams; - } - - public void setHookAdminParams(String hookAdminParams) { - this.hookAdminParams = hookAdminParams; - } - - public String getHookEnable() { - return hookEnable; - } - - public void setHookEnable(String hookEnable) { - this.hookEnable = hookEnable; - } - - public String getHookOnFlowReport() { - return hookOnFlowReport; - } - - public void setHookOnFlowReport(String hookOnFlowReport) { - this.hookOnFlowReport = hookOnFlowReport; - } - - public String getHookOnHttpAccess() { - return hookOnHttpAccess; - } - - public void setHookOnHttpAccess(String hookOnHttpAccess) { - this.hookOnHttpAccess = hookOnHttpAccess; - } - - public String getHookOnPlay() { - return hookOnPlay; - } - - public void setHookOnPlay(String hookOnPlay) { - this.hookOnPlay = hookOnPlay; - } - - public String getHookOnPublish() { - return hookOnPublish; - } - - public void setHookOnPublish(String hookOnPublish) { - this.hookOnPublish = hookOnPublish; - } - - public String getHookOnRecordMp4() { - return hookOnRecordMp4; - } - - public void setHookOnRecordMp4(String hookOnRecordMp4) { - this.hookOnRecordMp4 = hookOnRecordMp4; - } - - public String getHookOnRtspAuth() { - return hookOnRtspAuth; - } - - public void setHookOnRtspAuth(String hookOnRtspAuth) { - this.hookOnRtspAuth = hookOnRtspAuth; - } - - public String getHookOnRtspRealm() { - return hookOnRtspRealm; - } - - public void setHookOnRtspRealm(String hookOnRtspRealm) { - this.hookOnRtspRealm = hookOnRtspRealm; - } - - public String getHookOnShellLogin() { - return hookOnShellLogin; - } - - public void setHookOnShellLogin(String hookOnShellLogin) { - this.hookOnShellLogin = hookOnShellLogin; - } - - public String getHookOnStreamChanged() { - return hookOnStreamChanged; - } - - public void setHookOnStreamChanged(String hookOnStreamChanged) { - this.hookOnStreamChanged = hookOnStreamChanged; - } - - public String getHookOnStreamNoneReader() { - return hookOnStreamNoneReader; - } - - public void setHookOnStreamNoneReader(String hookOnStreamNoneReader) { - this.hookOnStreamNoneReader = hookOnStreamNoneReader; - } - - public String getHookOnStreamNotFound() { - return hookOnStreamNotFound; - } - - public void setHookOnStreamNotFound(String hookOnStreamNotFound) { - this.hookOnStreamNotFound = hookOnStreamNotFound; - } - - public String getHookTimeoutSec() { - return hookTimeoutSec; - } - - public void setHookTimeoutSec(String hookTimeoutSec) { - this.hookTimeoutSec = hookTimeoutSec; - } - - public String getHttpCharSet() { - return httpCharSet; - } - - public void setHttpCharSet(String httpCharSet) { - this.httpCharSet = httpCharSet; - } - - public String getHttpKeepAliveSecond() { - return httpKeepAliveSecond; - } - - public void setHttpKeepAliveSecond(String httpKeepAliveSecond) { - this.httpKeepAliveSecond = httpKeepAliveSecond; - } - - public String getHttpMaxReqCount() { - return httpMaxReqCount; - } - - public void setHttpMaxReqCount(String httpMaxReqCount) { - this.httpMaxReqCount = httpMaxReqCount; - } - - public String getHttpMaxReqSize() { - return httpMaxReqSize; - } - - public void setHttpMaxReqSize(String httpMaxReqSize) { - this.httpMaxReqSize = httpMaxReqSize; - } - - public String getHttpNotFound() { - return httpNotFound; - } - - public void setHttpNotFound(String httpNotFound) { - this.httpNotFound = httpNotFound; - } - - public int getHttpPort() { - return httpPort; - } - - public void setHttpPort(int httpPort) { - this.httpPort = httpPort; - } - - public String getHttpRootPath() { - return httpRootPath; - } - - public void setHttpRootPath(String httpRootPath) { - this.httpRootPath = httpRootPath; - } - - public String getHttpSendBufSize() { - return httpSendBufSize; - } - - public void setHttpSendBufSize(String httpSendBufSize) { - this.httpSendBufSize = httpSendBufSize; - } - - public int getHttpSSLport() { - return httpSSLport; - } - - public void setHttpSSLport(int httpSSLport) { - this.httpSSLport = httpSSLport; - } - - public String getMulticastAddrMax() { - return multicastAddrMax; - } - - public void setMulticastAddrMax(String multicastAddrMax) { - this.multicastAddrMax = multicastAddrMax; - } - - public String getMulticastAddrMin() { - return multicastAddrMin; - } - - public void setMulticastAddrMin(String multicastAddrMin) { - this.multicastAddrMin = multicastAddrMin; - } - - public String getMulticastUdpTTL() { - return multicastUdpTTL; - } - - public void setMulticastUdpTTL(String multicastUdpTTL) { - this.multicastUdpTTL = multicastUdpTTL; - } - - public String getRecordAppName() { - return recordAppName; - } - - public void setRecordAppName(String recordAppName) { - this.recordAppName = recordAppName; - } - - public String getRecordFilePath() { - return recordFilePath; - } - - public void setRecordFilePath(String recordFilePath) { - this.recordFilePath = recordFilePath; - } - - public String getRecordFileSecond() { - return recordFileSecond; - } - - public void setRecordFileSecond(String recordFileSecond) { - this.recordFileSecond = recordFileSecond; - } - - public String getRecordFileSampleMS() { - return recordFileSampleMS; - } - - public void setRecordFileSampleMS(String recordFileSampleMS) { - this.recordFileSampleMS = recordFileSampleMS; - } - - public String getRtmpHandshakeSecond() { - return rtmpHandshakeSecond; - } - - public void setRtmpHandshakeSecond(String rtmpHandshakeSecond) { - this.rtmpHandshakeSecond = rtmpHandshakeSecond; - } - - public String getRtmpKeepAliveSecond() { - return rtmpKeepAliveSecond; - } - - public void setRtmpKeepAliveSecond(String rtmpKeepAliveSecond) { - this.rtmpKeepAliveSecond = rtmpKeepAliveSecond; - } - - public String getRtmpModifyStamp() { - return rtmpModifyStamp; - } - - public void setRtmpModifyStamp(String rtmpModifyStamp) { - this.rtmpModifyStamp = rtmpModifyStamp; - } - - public int getRtmpPort() { - return rtmpPort; - } - - public void setRtmpPort(int rtmpPort) { - this.rtmpPort = rtmpPort; - } - - public int getRtmpSslPort() { - return rtmpSslPort; - } - - public void setRtmpSslPort(int rtmpSslPort) { - this.rtmpSslPort = rtmpSslPort; - } - - public String getRtpAudioMtuSize() { - return rtpAudioMtuSize; - } - - public void setRtpAudioMtuSize(String rtpAudioMtuSize) { - this.rtpAudioMtuSize = rtpAudioMtuSize; - } - - public String getRtpClearCount() { - return rtpClearCount; - } - - public void setRtpClearCount(String rtpClearCount) { - this.rtpClearCount = rtpClearCount; - } - - public String getRtpCycleMS() { - return rtpCycleMS; - } - - public void setRtpCycleMS(String rtpCycleMS) { - this.rtpCycleMS = rtpCycleMS; - } - - public String getRtpMaxRtpCount() { - return rtpMaxRtpCount; - } - - public void setRtpMaxRtpCount(String rtpMaxRtpCount) { - this.rtpMaxRtpCount = rtpMaxRtpCount; - } - - public String getRtpVideoMtuSize() { - return rtpVideoMtuSize; - } - - public void setRtpVideoMtuSize(String rtpVideoMtuSize) { - this.rtpVideoMtuSize = rtpVideoMtuSize; - } - - public String getRtpProxyCheckSource() { - return rtpProxyCheckSource; - } - - public void setRtpProxyCheckSource(String rtpProxyCheckSource) { - this.rtpProxyCheckSource = rtpProxyCheckSource; - } - - public String getRtpProxyDumpDir() { - return rtpProxyDumpDir; - } - - public void setRtpProxyDumpDir(String rtpProxyDumpDir) { - this.rtpProxyDumpDir = rtpProxyDumpDir; - } - - public int getRtpProxyPort() { - return rtpProxyPort; - } - - public void setRtpProxyPort(int rtpProxyPort) { - this.rtpProxyPort = rtpProxyPort; - } - - public String getRtpProxyTimeoutSec() { - return rtpProxyTimeoutSec; - } - - public void setRtpProxyTimeoutSec(String rtpProxyTimeoutSec) { - this.rtpProxyTimeoutSec = rtpProxyTimeoutSec; - } - - public String getRtspAuthBasic() { - return rtspAuthBasic; - } - - public void setRtspAuthBasic(String rtspAuthBasic) { - this.rtspAuthBasic = rtspAuthBasic; - } - - public String getRtspHandshakeSecond() { - return rtspHandshakeSecond; - } - - public void setRtspHandshakeSecond(String rtspHandshakeSecond) { - this.rtspHandshakeSecond = rtspHandshakeSecond; - } - - public String getRtspKeepAliveSecond() { - return rtspKeepAliveSecond; - } - - public void setRtspKeepAliveSecond(String rtspKeepAliveSecond) { - this.rtspKeepAliveSecond = rtspKeepAliveSecond; - } - - public int getRtspPort() { - return rtspPort; - } - - public void setRtspPort(int rtspPort) { - this.rtspPort = rtspPort; - } - - public int getRtspSSlport() { - return rtspSSlport; - } - - public void setRtspSSlport(int rtspSSlport) { - this.rtspSSlport = rtspSSlport; - } - - public String getShellMaxReqSize() { - return shellMaxReqSize; - } - - public void setShellMaxReqSize(String shellMaxReqSize) { - this.shellMaxReqSize = shellMaxReqSize; - } - - public String getShellPhell() { - return shellPhell; - } - - public void setShellPhell(String shellPhell) { - this.shellPhell = shellPhell; - } - - public Float getHookAliveInterval() { - return hookAliveInterval; - } - - public void setHookAliveInterval(Float hookAliveInterval) { - this.hookAliveInterval = hookAliveInterval; - } - - public String getPortRange() { - return portRange; - } - - public void setPortRange(String portRange) { - this.portRange = portRange; - } - - public String getApiSnapRoot() { - return apiSnapRoot; - } - - public void setApiSnapRoot(String apiSnapRoot) { - this.apiSnapRoot = apiSnapRoot; - } - - public String getApiDefaultSnap() { - return apiDefaultSnap; - } - - public void setApiDefaultSnap(String apiDefaultSnap) { - this.apiDefaultSnap = apiDefaultSnap; - } - - public String getFfmpegSnap() { - return ffmpegSnap; - } - - public void setFfmpegSnap(String ffmpegSnap) { - this.ffmpegSnap = ffmpegSnap; - } - - public String getFfmpegRestartSec() { - return ffmpegRestartSec; - } - - public void setFfmpegRestartSec(String ffmpegRestartSec) { - this.ffmpegRestartSec = ffmpegRestartSec; - } - - public String getProtocolModifyStamp() { - return protocolModifyStamp; - } - - public void setProtocolModifyStamp(String protocolModifyStamp) { - this.protocolModifyStamp = protocolModifyStamp; - } - - public String getProtocolEnableAudio() { - return protocolEnableAudio; - } - - public void setProtocolEnableAudio(String protocolEnableAudio) { - this.protocolEnableAudio = protocolEnableAudio; - } - - public String getProtocolAddMuteAudio() { - return protocolAddMuteAudio; - } - - public void setProtocolAddMuteAudio(String protocolAddMuteAudio) { - this.protocolAddMuteAudio = protocolAddMuteAudio; - } - - public String getProtocolContinuePushMs() { - return protocolContinuePushMs; - } - - public void setProtocolContinuePushMs(String protocolContinuePushMs) { - this.protocolContinuePushMs = protocolContinuePushMs; - } - - public String getProtocolEnableHls() { - return protocolEnableHls; - } - - public void setProtocolEnableHls(String protocolEnableHls) { - this.protocolEnableHls = protocolEnableHls; - } - - public String getProtocolEnableMp4() { - return protocolEnableMp4; - } - - public void setProtocolEnableMp4(String protocolEnableMp4) { - this.protocolEnableMp4 = protocolEnableMp4; - } - - public String getProtocolEnableRtsp() { - return protocolEnableRtsp; - } - - public void setProtocolEnableRtsp(String protocolEnableRtsp) { - this.protocolEnableRtsp = protocolEnableRtsp; - } - - public String getProtocolEnableRtmp() { - return protocolEnableRtmp; - } - - public void setProtocolEnableRtmp(String protocolEnableRtmp) { - this.protocolEnableRtmp = protocolEnableRtmp; - } - - public String getProtocolEnableTs() { - return protocolEnableTs; - } - - public void setProtocolEnableTs(String protocolEnableTs) { - this.protocolEnableTs = protocolEnableTs; - } - - public String getProtocolEnableFmp4() { - return protocolEnableFmp4; - } - - public void setProtocolEnableFmp4(String protocolEnableFmp4) { - this.protocolEnableFmp4 = protocolEnableFmp4; - } - - public String getProtocolMp4AsPlayer() { - return protocolMp4AsPlayer; - } - - public void setProtocolMp4AsPlayer(String protocolMp4AsPlayer) { - this.protocolMp4AsPlayer = protocolMp4AsPlayer; - } - - public String getProtocolMp4MaxSecond() { - return protocolMp4MaxSecond; - } - - public void setProtocolMp4MaxSecond(String protocolMp4MaxSecond) { - this.protocolMp4MaxSecond = protocolMp4MaxSecond; - } - - public String getProtocolMp4SavePath() { - return protocolMp4SavePath; - } - - public void setProtocolMp4SavePath(String protocolMp4SavePath) { - this.protocolMp4SavePath = protocolMp4SavePath; - } - - public String getProtocolHlsSavePath() { - return protocolHlsSavePath; - } - - public void setProtocolHlsSavePath(String protocolHlsSavePath) { - this.protocolHlsSavePath = protocolHlsSavePath; - } - - public String getProtocolHlsDemand() { - return protocolHlsDemand; - } - - public void setProtocolHlsDemand(String protocolHlsDemand) { - this.protocolHlsDemand = protocolHlsDemand; - } - - public String getProtocolRtspDemand() { - return protocolRtspDemand; - } - - public void setProtocolRtspDemand(String protocolRtspDemand) { - this.protocolRtspDemand = protocolRtspDemand; - } - - public String getProtocolRtmpDemand() { - return protocolRtmpDemand; - } - - public void setProtocolRtmpDemand(String protocolRtmpDemand) { - this.protocolRtmpDemand = protocolRtmpDemand; - } - - public String getProtocolTsDemand() { - return protocolTsDemand; - } - - public void setProtocolTsDemand(String protocolTsDemand) { - this.protocolTsDemand = protocolTsDemand; - } - - public String getProtocolFmp4Demand() { - return protocolFmp4Demand; - } - - public void setProtocolFmp4Demand(String protocolFmp4Demand) { - this.protocolFmp4Demand = protocolFmp4Demand; - } - - public String getGeneralResetWhenRePlay() { - return generalResetWhenRePlay; - } - - public void setGeneralResetWhenRePlay(String generalResetWhenRePlay) { - this.generalResetWhenRePlay = generalResetWhenRePlay; - } - - public String getGeneralMergeWriteMS() { - return generalMergeWriteMS; - } - - public void setGeneralMergeWriteMS(String generalMergeWriteMS) { - this.generalMergeWriteMS = generalMergeWriteMS; - } - - public String getGeneralWaitTrackReadyMs() { - return generalWaitTrackReadyMs; - } - - public void setGeneralWaitTrackReadyMs(String generalWaitTrackReadyMs) { - this.generalWaitTrackReadyMs = generalWaitTrackReadyMs; - } - - public String getGeneralWaitAddTrackMs() { - return generalWaitAddTrackMs; - } - - public void setGeneralWaitAddTrackMs(String generalWaitAddTrackMs) { - this.generalWaitAddTrackMs = generalWaitAddTrackMs; - } - - public String getGeneralUnreadyFrameCache() { - return generalUnreadyFrameCache; - } - - public void setGeneralUnreadyFrameCache(String generalUnreadyFrameCache) { - this.generalUnreadyFrameCache = generalUnreadyFrameCache; - } - - public String getHlsSegRetain() { - return hlsSegRetain; - } - - public void setHlsSegRetain(String hlsSegRetain) { - this.hlsSegRetain = hlsSegRetain; - } - - public String getHlsBroadcastRecordTs() { - return hlsBroadcastRecordTs; - } - - public void setHlsBroadcastRecordTs(String hlsBroadcastRecordTs) { - this.hlsBroadcastRecordTs = hlsBroadcastRecordTs; - } - - public String getHlsDeleteDelaySec() { - return hlsDeleteDelaySec; - } - - public void setHlsDeleteDelaySec(String hlsDeleteDelaySec) { - this.hlsDeleteDelaySec = hlsDeleteDelaySec; - } - - public String getHlsSegKeep() { - return hlsSegKeep; - } - - public void setHlsSegKeep(String hlsSegKeep) { - this.hlsSegKeep = hlsSegKeep; - } - - public String getHookOnServerStarted() { - return hookOnServerStarted; - } - - public void setHookOnServerStarted(String hookOnServerStarted) { - this.hookOnServerStarted = hookOnServerStarted; - } - - public String getHookOnServerKeepalive() { - return hookOnServerKeepalive; - } - - public void setHookOnServerKeepalive(String hookOnServerKeepalive) { - this.hookOnServerKeepalive = hookOnServerKeepalive; - } - - public String getHookOnSendRtpStopped() { - return hookOnSendRtpStopped; - } - - public void setHookOnSendRtpStopped(String hookOnSendRtpStopped) { - this.hookOnSendRtpStopped = hookOnSendRtpStopped; - } - - public String getHookOnRtpServerTimeout() { - return hookOnRtpServerTimeout; - } - - public void setHookOnRtpServerTimeout(String hookOnRtpServerTimeout) { - this.hookOnRtpServerTimeout = hookOnRtpServerTimeout; - } - - public String getTranscodeSuffix() { - return transcodeSuffix; - } - - public void setTranscodeSuffix(String transcodeSuffix) { - this.transcodeSuffix = transcodeSuffix; - } } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java index 4521b0b79..634f6cc22 100755 --- a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java @@ -500,7 +500,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { public void removePushListItem(String app, String stream, String mediaServerId) { String key = VideoManagerConstants.PUSH_STREAM_LIST + app + "_" + stream; MediaInfo param = (MediaInfo)redisTemplate.opsForValue().get(key); - if (param != null && param.getMediaServer().getId().equalsIgnoreCase(mediaServerId)) { + if (param != null) { redisTemplate.delete(key); } } From ccafa0ea01d9bbdc1a6d65ac294a47219fbfcd89 Mon Sep 17 00:00:00 2001 From: lin <648540858@qq.com> Date: Wed, 19 Mar 2025 16:22:38 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=8E=A8=E6=B5=81?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=8A=B6=E6=80=81=E6=9B=B4=E6=96=B0=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/gb28181/dao/provider/ChannelProvider.java | 2 +- .../vmp/service/redisMsg/RedisPushStreamStatusMsgListener.java | 2 +- .../iot/vmp/streamPush/service/impl/StreamPushServiceImpl.java | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java index 8509e0725..0941cf2dc 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java @@ -373,7 +373,7 @@ public class ChannelProvider { StringBuilder sqlBuild = new StringBuilder(); sqlBuild.append(BASE_SQL); - sqlBuild.append(" where channel_type = 0 and data_type = #{dataType} and data_device_id in ( "); + sqlBuild.append(" where channel_type = 0 and data_type = #{dataType} and data_device_id in ( "); Collection ids = (Collection)params.get("streamPushList"); boolean first = true; for (StreamPush streamPush : ids) { diff --git a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamStatusMsgListener.java b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamStatusMsgListener.java index 6f1b3d109..d5d2b68c0 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamStatusMsgListener.java +++ b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamStatusMsgListener.java @@ -92,7 +92,7 @@ public class RedisPushStreamStatusMsgListener implements MessageListener, Applic streamPushService.online(streamStatusMessage.getOnlineStreams()); } } catch (Exception e) { - log.warn("[REDIS消息-推流设备状态变化] 发现未处理的异常, \r\n{}", JSON.toJSONString(msg)); + log.warn("[REDIS消息-推流设备状态变化] 发现未处理的异常, \r\n{}", JSON.parseObject(msg.getBody())); log.error("[REDIS消息-推流设备状态变化] 异常内容: ", e); } } diff --git a/src/main/java/com/genersoft/iot/vmp/streamPush/service/impl/StreamPushServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/streamPush/service/impl/StreamPushServiceImpl.java index acfb564ab..72e03468c 100755 --- a/src/main/java/com/genersoft/iot/vmp/streamPush/service/impl/StreamPushServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/streamPush/service/impl/StreamPushServiceImpl.java @@ -471,6 +471,9 @@ public class StreamPushServiceImpl implements IStreamPushService { public void online(List onlineStreams) { // 更新部分设备上线streamPushService List streamPushList = streamPushMapper.getListFromRedis(onlineStreams); + if (streamPushList.isEmpty()) { + return; + } List commonGBChannelList = gbChannelService.queryListByStreamPushList(streamPushList); gbChannelService.online(commonGBChannelList); } From ec74488b4a0f99a228d682c58aeeb1557df0f9bf Mon Sep 17 00:00:00 2001 From: lin <648540858@qq.com> Date: Thu, 20 Mar 2025 09:21:01 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BD=E6=A0=87?= =?UTF-8?q?=E7=BA=A7=E8=81=94=E6=B3=A8=E5=86=8C=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/genersoft/iot/vmp/conf/SipConfig.java | 2 +- .../genersoft/iot/vmp/conf/UserSetting.java | 6 ++++ .../iot/vmp/gb28181/bean/CommonGBChannel.java | 12 ++++++++ .../gb28181/dao/CommonGBChannelMapper.java | 14 ++++++--- .../gb28181/service/IGbChannelService.java | 6 ++-- .../service/impl/GbChannelServiceImpl.java | 14 +++++---- .../service/impl/PlatformServiceImpl.java | 21 +++++++++++--- .../transmit/SIPProcessorObserver.java | 20 ++++++------- .../cmd/impl/SIPCommanderForPlatform.java | 4 +-- .../iot/vmp/service/bean/GPSMsgInfo.java | 10 +++---- .../service/redisMsg/RedisGpsMsgListener.java | 25 +++++++++++----- .../iot/vmp/streamPush/bean/StreamPush.java | 24 +++++++++++++++ .../service/IStreamPushService.java | 2 -- .../service/impl/StreamPushServiceImpl.java | 14 --------- src/main/resources/配置详情.yml | 2 ++ 数据库/2.7.3/初始化-mysql-2.7.3.sql | 3 ++ .../2.7.3/初始化-postgresql-kingbase-2.7.3.sql | 3 ++ 数据库/2.7.3/更新-mysql-2.7.1升级到2.7.3.sql | 3 ++ 数据库/2.7.3/更新-mysql-2.7.3.sql | 29 +++++++++++++++++++ ...更新-postgresql-kingbase-2.7.1升级到2.7.3.sql | 3 ++ .../2.7.3/更新-postgresql-kingbase-2.7.3.sql | 6 ++++ 21 files changed, 166 insertions(+), 57 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/conf/SipConfig.java b/src/main/java/com/genersoft/iot/vmp/conf/SipConfig.java index 67c926e61..6be84b0a9 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/SipConfig.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/SipConfig.java @@ -34,5 +34,5 @@ public class SipConfig { private boolean alarm = false; - private long timeout = 150; + private long timeout = 500; } diff --git a/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java b/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java index ca346dfab..c4f2c4bae 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java @@ -190,5 +190,11 @@ public class UserSetting { */ private boolean autoRegisterPlatform = false; + /** + * 按需发送推流设备位置, 默认发送移动位置订阅时如果位置不变则不发送, 设置为false按照国标间隔持续发送 + */ + private boolean sendPositionOnDemand = true; + + } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java index 43c22cb2f..755fc8876 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java @@ -86,6 +86,18 @@ public class CommonGBChannel { @Schema(description = "国标-纬度 WGS-84坐标系") private Double gbLatitude; + @Schema(description = "") + private Double gpsAltitude; + + @Schema(description = "") + private Double gpsSpeed; + + @Schema(description = "") + private Double gpsDirection; + + @Schema(description = "") + private String gbGpsTime; + @Schema(description = "国标-虚拟组织所属的业务分组ID") private String gbBusinessGroupId; diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java index 3b71eb1da..efa826c36 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.dao; import com.genersoft.iot.vmp.gb28181.bean.*; import com.genersoft.iot.vmp.gb28181.dao.provider.ChannelProvider; +import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; import com.genersoft.iot.vmp.streamPush.bean.StreamPush; import org.apache.ibatis.annotations.*; import org.springframework.stereotype.Repository; @@ -451,13 +452,18 @@ public interface CommonGBChannelMapper { List queryListByStreamPushList(@Param("dataType") Integer dataType, List streamPushList); @Update(value = {" "}) - void updateGpsByDeviceIdForStreamPush(@Param("dataType") Integer dataType, List channels); + void updateGpsByDeviceId(List gpsMsgInfoList); @SelectProvider(type = ChannelProvider.class, method = "queryList") List queryList(@Param("query") String query, @Param("online") Boolean online, diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelService.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelService.java index 82c9b4066..0aa27dd71 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelService.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelService.java @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.service; import com.genersoft.iot.vmp.gb28181.bean.*; import com.genersoft.iot.vmp.service.bean.ErrorCallback; +import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; import com.genersoft.iot.vmp.streamPush.bean.StreamPush; import com.github.pagehelper.PageInfo; @@ -84,8 +85,6 @@ public interface IGbChannelService { List queryListByStreamPushList(List streamPushList); - void updateGpsByDeviceIdForStreamPush(List channels); - PageInfo queryList(int page, int count, String query, Boolean online, Boolean hasRecordPlan, Integer channelType); void queryRecordInfo(CommonGBChannel channel, String startTime, String endTime, ErrorCallback callback); @@ -97,4 +96,7 @@ public interface IGbChannelService { PageInfo queryListByParentForUnusual(int page, int count, String query, Boolean online, Integer channelType); void clearChannelParent(Boolean all, List channelIds); + + void updateGPSFromGPSMsgInfo(List gpsMsgInfoList); + } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java index aaceab224..2019a0bdc 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java @@ -13,6 +13,7 @@ import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService; import com.genersoft.iot.vmp.gb28181.service.IGbChannelService; import com.genersoft.iot.vmp.gb28181.service.IPlatformChannelService; import com.genersoft.iot.vmp.service.bean.ErrorCallback; +import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; import com.genersoft.iot.vmp.streamPush.bean.StreamPush; import com.genersoft.iot.vmp.utils.DateUtil; import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; @@ -715,11 +716,6 @@ public class GbChannelServiceImpl implements IGbChannelService { return commonGBChannelMapper.queryListByStreamPushList(ChannelDataType.STREAM_PUSH.value, streamPushList); } - @Override - public void updateGpsByDeviceIdForStreamPush(List channels) { - commonGBChannelMapper.updateGpsByDeviceIdForStreamPush(ChannelDataType.STREAM_PUSH.value, channels); - } - @Override public PageInfo queryList(int page, int count, String query, Boolean online, Boolean hasRecordPlan, Integer channelType) { PageHelper.startPage(page, count); @@ -797,4 +793,12 @@ public class GbChannelServiceImpl implements IGbChannelService { } commonGBChannelMapper.removeParentIdByChannelIds(channelIdsForClear); } + + @Override + public void updateGPSFromGPSMsgInfo(List gpsMsgInfoList) { + if (gpsMsgInfoList == null || gpsMsgInfoList.isEmpty()) { + return; + } + commonGBChannelMapper.updateGpsByDeviceId(gpsMsgInfoList); + } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java index f76c0dc81..af96adcd5 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java @@ -559,12 +559,25 @@ public class PlatformServiceImpl implements IPlatformService { } for (CommonGBChannel channel : channelList) { GPSMsgInfo gpsMsgInfo = redisCatchStorage.getGpsMsgInfo(channel.getGbDeviceId()); + + // 无最新位置则发送当前位置 + if (gpsMsgInfo != null && (gpsMsgInfo.getLng() == 0 && gpsMsgInfo.getLat() == 0)) { + gpsMsgInfo = null; + } + + if (gpsMsgInfo == null && !userSetting.isSendPositionOnDemand()){ + gpsMsgInfo = new GPSMsgInfo(); + gpsMsgInfo.setId(channel.getGbDeviceId()); + gpsMsgInfo.setLng(channel.getGbLongitude()); + gpsMsgInfo.setLat(channel.getGbLatitude()); + gpsMsgInfo.setAltitude(channel.getGpsAltitude()); + gpsMsgInfo.setSpeed(channel.getGpsSpeed()); + gpsMsgInfo.setDirection(channel.getGpsDirection()); + gpsMsgInfo.setTime(channel.getGbGpsTime()); + } + // 无最新位置不发送 if (gpsMsgInfo != null) { - // 经纬度都为0不发送 - if (gpsMsgInfo.getLng() == 0 && gpsMsgInfo.getLat() == 0) { - continue; - } // 发送GPS消息 try { commanderForPlatform.sendNotifyMobilePosition(platform, gpsMsgInfo, channel, subscribe); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPProcessorObserver.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPProcessorObserver.java index b7892dbd3..0fb336397 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPProcessorObserver.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPProcessorObserver.java @@ -84,18 +84,16 @@ public class SIPProcessorObserver implements ISIPProcessorObserver { // Success if (((status >= Response.OK) && (status < Response.MULTIPLE_CHOICES)) || status == Response.UNAUTHORIZED) { - if (status != Response.UNAUTHORIZED && responseEvent.getResponse() != null && !sipSubscribe.isEmpty() ) { - CallIdHeader callIdHeader = response.getCallIdHeader(); - CSeqHeader cSeqHeader = response.getCSeqHeader(); - if (callIdHeader != null) { - SipEvent sipEvent = sipSubscribe.getSubscribe(callIdHeader.getCallId() + cSeqHeader.getSeqNumber()); - if (sipEvent != null) { - if (sipEvent.getOkEvent() != null) { - SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult<>(responseEvent); - sipEvent.getOkEvent().response(eventResult); - } - sipSubscribe.removeSubscribe(callIdHeader.getCallId() + cSeqHeader.getSeqNumber()); + CallIdHeader callIdHeader = response.getCallIdHeader(); + CSeqHeader cSeqHeader = response.getCSeqHeader(); + if (callIdHeader != null) { + SipEvent sipEvent = sipSubscribe.getSubscribe(callIdHeader.getCallId() + cSeqHeader.getSeqNumber()); + if (sipEvent != null) { + if (sipEvent.getOkEvent() != null) { + SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult<>(responseEvent); + sipEvent.getOkEvent().response(eventResult); } + sipSubscribe.removeSubscribe(callIdHeader.getCallId() + cSeqHeader.getSeqNumber()); } } ISIPResponseProcessor sipRequestProcessor = responseProcessorMap.get(response.getCSeqHeader().getMethod()); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderForPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderForPlatform.java index 5e5a207b6..bce60a796 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderForPlatform.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderForPlatform.java @@ -136,7 +136,7 @@ public class SIPCommanderForPlatform implements ISIPCommanderForPlatform { if (errorEvent != null ) { errorEvent.response(event); } - }, okEvent, 5L); + }, okEvent, 2000L); } @Override @@ -369,7 +369,7 @@ public class SIPCommanderForPlatform implements ISIPCommanderForPlatform { .append("MobilePosition\r\n") .append("" + (int)((Math.random()*9+1)*100000) + "\r\n") .append("" + channel.getGbDeviceId() + "\r\n") - .append("\r\n") + .append("\r\n") .append("" + gpsMsgInfo.getLng() + "\r\n") .append("" + gpsMsgInfo.getLat() + "\r\n") .append("" + gpsMsgInfo.getSpeed() + "\r\n") diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/GPSMsgInfo.java b/src/main/java/com/genersoft/iot/vmp/service/bean/GPSMsgInfo.java index 7156985c6..fca4751d3 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/bean/GPSMsgInfo.java +++ b/src/main/java/com/genersoft/iot/vmp/service/bean/GPSMsgInfo.java @@ -30,7 +30,7 @@ public class GPSMsgInfo { /** * 速度,单位:km/h (可选) */ - private double speed; + private Double speed; /** * 产生通知时间, 时间格式: 2020-01-14T14:32:12 @@ -40,23 +40,23 @@ public class GPSMsgInfo { /** * 方向,取值为当前摄像头方向与正北方的顺时针夹角,取值范围0°~360°,单位:(°)(可选) */ - private String direction; + private Double direction; /** * 海拔高度,单位:m(可选) */ - private String altitude; + private Double altitude; private boolean stored; public static GPSMsgInfo getInstance(MobilePosition mobilePosition) { GPSMsgInfo gpsMsgInfo = new GPSMsgInfo(); gpsMsgInfo.setChannelId(mobilePosition.getChannelId()); - gpsMsgInfo.setAltitude(mobilePosition.getAltitude() + ""); + gpsMsgInfo.setAltitude(mobilePosition.getAltitude()); gpsMsgInfo.setLng(mobilePosition.getLongitude()); gpsMsgInfo.setLat(mobilePosition.getLatitude()); gpsMsgInfo.setSpeed(mobilePosition.getSpeed()); - gpsMsgInfo.setDirection(mobilePosition.getDirection() + ""); + gpsMsgInfo.setDirection(mobilePosition.getDirection()); gpsMsgInfo.setTime(DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(mobilePosition.getTime())); return gpsMsgInfo; } diff --git a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGpsMsgListener.java b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGpsMsgListener.java index bd34dd6f6..0c19ab986 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGpsMsgListener.java +++ b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGpsMsgListener.java @@ -1,9 +1,11 @@ package com.genersoft.iot.vmp.service.redisMsg; import com.alibaba.fastjson2.JSON; +import com.genersoft.iot.vmp.gb28181.service.IGbChannelService; import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.streamPush.service.IStreamPushService; +import com.genersoft.iot.vmp.utils.DateUtil; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; @@ -15,9 +17,11 @@ import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; /** - * 接收来自redis的GPS更新通知, 此处只针对推流设备 + * 接收来自redis的GPS更新通知 * * @author lin * 监听: SUBSCRIBE VM_MSG_GPS @@ -33,6 +37,9 @@ public class RedisGpsMsgListener implements MessageListener { @Autowired private IStreamPushService streamPushService; + @Autowired + private IGbChannelService channelService; + private final ConcurrentLinkedQueue taskQueue = new ConcurrentLinkedQueue<>(); @@ -42,7 +49,7 @@ public class RedisGpsMsgListener implements MessageListener { taskQueue.offer(message); } - @Scheduled(fixedDelay = 200) //每400毫秒执行一次 + @Scheduled(fixedDelay = 200, timeUnit = TimeUnit.MILLISECONDS) //每400毫秒执行一次 public void executeTaskQueue() { if (taskQueue.isEmpty()) { return; @@ -61,6 +68,7 @@ public class RedisGpsMsgListener implements MessageListener { for (Message msg : messageDataList) { try { GPSMsgInfo gpsMsgInfo = JSON.parseObject(msg.getBody(), GPSMsgInfo.class); + gpsMsgInfo.setTime(DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(gpsMsgInfo.getTime())); log.info("[REDIS的位置变化通知], {}", JSON.toJSONString(gpsMsgInfo)); // 只是放入redis缓存起来 redisCatchStorage.updateGpsMsgInfo(gpsMsgInfo); @@ -74,15 +82,18 @@ public class RedisGpsMsgListener implements MessageListener { /** * 定时将经纬度更新到数据库 */ - @Scheduled(fixedDelay = 2 * 1000) //每2秒执行一次 + @Scheduled(fixedDelay = 2, timeUnit = TimeUnit.SECONDS) //每2秒执行一次 public void execute() { // 需要查询到 List gpsMsgInfoList = redisCatchStorage.getAllGpsMsgInfo(); if (!gpsMsgInfoList.isEmpty()) { - streamPushService.updateGPSFromGPSMsgInfo(gpsMsgInfoList); - for (GPSMsgInfo msgInfo : gpsMsgInfoList) { - msgInfo.setStored(true); - redisCatchStorage.updateGpsMsgInfo(msgInfo); + gpsMsgInfoList = gpsMsgInfoList.stream().filter(gpsMsgInfo -> !gpsMsgInfo.isStored()).collect(Collectors.toList());; + if (!gpsMsgInfoList.isEmpty()) { + channelService.updateGPSFromGPSMsgInfo(gpsMsgInfoList); + for (GPSMsgInfo msgInfo : gpsMsgInfoList) { + msgInfo.setStored(true); + redisCatchStorage.updateGpsMsgInfo(msgInfo); + } } } } diff --git a/src/main/java/com/genersoft/iot/vmp/streamPush/bean/StreamPush.java b/src/main/java/com/genersoft/iot/vmp/streamPush/bean/StreamPush.java index ef4517bdd..5b282c2d7 100755 --- a/src/main/java/com/genersoft/iot/vmp/streamPush/bean/StreamPush.java +++ b/src/main/java/com/genersoft/iot/vmp/streamPush/bean/StreamPush.java @@ -77,6 +77,30 @@ public class StreamPush extends CommonGBChannel implements Comparable ids); - void updateGPSFromGPSMsgInfo(List gpsMsgInfoList); } diff --git a/src/main/java/com/genersoft/iot/vmp/streamPush/service/impl/StreamPushServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/streamPush/service/impl/StreamPushServiceImpl.java index 72e03468c..f8e5e7da3 100755 --- a/src/main/java/com/genersoft/iot/vmp/streamPush/service/impl/StreamPushServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/streamPush/service/impl/StreamPushServiceImpl.java @@ -16,7 +16,6 @@ import com.genersoft.iot.vmp.media.service.IMediaServerService; import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; import com.genersoft.iot.vmp.media.zlm.dto.hook.OriginType; import com.genersoft.iot.vmp.service.ISendRtpServerService; -import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.streamPush.bean.StreamPush; @@ -586,17 +585,4 @@ public class StreamPushServiceImpl implements IStreamPushService { streamPushMapper.batchDel(streamPushList); gbChannelService.delete(ids); } - - @Override - public void updateGPSFromGPSMsgInfo(List gpsMsgInfoList) { - List channels = new ArrayList<>(); - for (GPSMsgInfo gpsMsgInfo : gpsMsgInfoList) { - CommonGBChannel channel = new CommonGBChannel(); - channel.setGbDeviceId(gpsMsgInfo.getId()); - channel.setGbLongitude(gpsMsgInfo.getLng()); - channel.setGbLatitude(gpsMsgInfo.getLat()); - channels.add(channel); - } - gbChannelService.updateGpsByDeviceIdForStreamPush(channels); - } } diff --git a/src/main/resources/配置详情.yml b/src/main/resources/配置详情.yml index a501da9e7..dd76aa9e6 100644 --- a/src/main/resources/配置详情.yml +++ b/src/main/resources/配置详情.yml @@ -249,6 +249,8 @@ user-settings: jwk-file: classpath:jwk.json # wvp集群模式下如果注册向上级的wvp奔溃,则自动选择一个其他wvp继续注册到上级 auto-register-platform: true + # 按需发送位置, 默认发送移动位置订阅时如果位置不变则不发送, 设置为false按照国标间隔持续发送 + send-position-on-demand: true # 关闭在线文档(生产环境建议关闭) springdoc: diff --git a/数据库/2.7.3/初始化-mysql-2.7.3.sql b/数据库/2.7.3/初始化-mysql-2.7.3.sql index 7d3a10986..0d0a4f2c7 100644 --- a/数据库/2.7.3/初始化-mysql-2.7.3.sql +++ b/数据库/2.7.3/初始化-mysql-2.7.3.sql @@ -156,6 +156,9 @@ create table IF NOT EXISTS wvp_device_channel record_plan_id integer, data_type integer not null, data_device_id integer not null, + gps_speed double precision, + gps_altitude double precision, + gps_direction double precision, constraint uk_wvp_unique_channel unique (gb_device_id) ); diff --git a/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql b/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql index 2b9174bdf..05d04538e 100644 --- a/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql +++ b/数据库/2.7.3/初始化-postgresql-kingbase-2.7.3.sql @@ -156,6 +156,9 @@ create table IF NOT EXISTS wvp_device_channel record_plan_id integer, data_type integer not null, data_device_id integer not null, + gps_speed double precision, + gps_altitude double precision, + gps_direction double precision, constraint uk_wvp_unique_channel unique (gb_device_id) ); diff --git a/数据库/2.7.3/更新-mysql-2.7.1升级到2.7.3.sql b/数据库/2.7.3/更新-mysql-2.7.1升级到2.7.3.sql index ea97f2bcd..36b92b390 100644 --- a/数据库/2.7.3/更新-mysql-2.7.1升级到2.7.3.sql +++ b/数据库/2.7.3/更新-mysql-2.7.1升级到2.7.3.sql @@ -167,6 +167,9 @@ create table IF NOT EXISTS wvp_device_channel record_plan_id integer, data_type integer not null, data_device_id integer not null, + gps_speed double precision, + gps_altitude double precision, + gps_direction double precision, constraint uk_wvp_unique_channel unique (gb_device_id) ); diff --git a/数据库/2.7.3/更新-mysql-2.7.3.sql b/数据库/2.7.3/更新-mysql-2.7.3.sql index 247c536f4..63dc4ddee 100644 --- a/数据库/2.7.3/更新-mysql-2.7.3.sql +++ b/数据库/2.7.3/更新-mysql-2.7.3.sql @@ -233,3 +233,32 @@ call wvp_20250312(); DROP PROCEDURE wvp_20250312; +/* +* 20250319 +*/ +CREATE PROCEDURE `wvp_20250319`() +BEGIN + IF NOT EXISTS (SELECT column_name FROM information_schema.STATISTICS + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'gps_speed') + THEN + alter table wvp_device_channel add gps_speed double precision; + END IF; + + IF NOT EXISTS (SELECT column_name FROM information_schema.STATISTICS + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'gps_altitude') + THEN + alter table wvp_device_channel add gps_altitude double precision; + END IF; + + IF NOT EXISTS (SELECT column_name FROM information_schema.STATISTICS + WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'gps_direction') + THEN + alter table wvp_device_channel add gps_direction double precision; + END IF; +END; +call wvp_20250319(); +DROP PROCEDURE wvp_20250319; + + + + diff --git a/数据库/2.7.3/更新-postgresql-kingbase-2.7.1升级到2.7.3.sql b/数据库/2.7.3/更新-postgresql-kingbase-2.7.1升级到2.7.3.sql index 43ed0066c..b312323f2 100644 --- a/数据库/2.7.3/更新-postgresql-kingbase-2.7.1升级到2.7.3.sql +++ b/数据库/2.7.3/更新-postgresql-kingbase-2.7.1升级到2.7.3.sql @@ -134,6 +134,9 @@ create table IF NOT EXISTS wvp_device_channel record_plan_id integer, data_type integer not null, data_device_id integer not null, + gps_speed double precision, + gps_altitude double precision, + gps_direction double precision, constraint uk_wvp_unique_channel unique (gb_device_id) ); diff --git a/数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql b/数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql index 9bd7cf2b1..2de2d1efe 100644 --- a/数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql +++ b/数据库/2.7.3/更新-postgresql-kingbase-2.7.3.sql @@ -95,5 +95,11 @@ update wvp_media_server set server_id = '你的服务ID'; update wvp_stream_proxy set server_id = '你的服务ID'; update wvp_cloud_record set server_id = '你的服务ID'; +/* +* 20250319 +*/ +alter table wvp_device_channel add column if not exists gps_speed double precision; +alter table wvp_device_channel add column if not exists gps_altitude double precision; +alter table wvp_device_channel add column if not exists gps_direction double precision; From b2072073a93c9613ed7968db5d139b388ae7d90a Mon Sep 17 00:00:00 2001 From: lin <648540858@qq.com> Date: Thu, 20 Mar 2025 09:56:35 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BD=E6=A0=87?= =?UTF-8?q?=E7=BA=A7=E8=81=94=E6=8E=A8=E9=80=81=E4=BD=8D=E7=BD=AE=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java | 2 +- .../genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java | 4 ++++ .../iot/vmp/gb28181/service/impl/PlatformServiceImpl.java | 3 ++- .../notify/cmd/MobilePositionNotifyMessageHandler.java | 2 +- web_src/src/components/channelList.vue | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java index 755fc8876..39e121fdf 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java @@ -96,7 +96,7 @@ public class CommonGBChannel { private Double gpsDirection; @Schema(description = "") - private String gbGpsTime; + private String gpsTime; @Schema(description = "国标-虚拟组织所属的业务分组ID") private String gbBusinessGroupId; diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java index c69a32d5c..c437eee0f 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java @@ -262,6 +262,10 @@ public interface PlatformChannelMapper { " wdc.data_device_id,\n" + " wdc.create_time,\n" + " wdc.update_time,\n" + + " wdc.gps_altitude,\n" + + " wdc.gps_speed,\n" + + " wdc.gps_direction,\n" + + " wdc.gps_time,\n" + " coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" + " coalesce(wpgc.custom_name, wdc.gb_name, wdc.name) as gb_name,\n" + " coalesce(wpgc.custom_manufacturer, wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" + diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java index af96adcd5..8f5f6223f 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java @@ -565,6 +565,7 @@ public class PlatformServiceImpl implements IPlatformService { gpsMsgInfo = null; } + if (gpsMsgInfo == null && !userSetting.isSendPositionOnDemand()){ gpsMsgInfo = new GPSMsgInfo(); gpsMsgInfo.setId(channel.getGbDeviceId()); @@ -573,7 +574,7 @@ public class PlatformServiceImpl implements IPlatformService { gpsMsgInfo.setAltitude(channel.getGpsAltitude()); gpsMsgInfo.setSpeed(channel.getGpsSpeed()); gpsMsgInfo.setDirection(channel.getGpsDirection()); - gpsMsgInfo.setTime(channel.getGbGpsTime()); + gpsMsgInfo.setTime(channel.getGpsTime()); } // 无最新位置不发送 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MobilePositionNotifyMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MobilePositionNotifyMessageHandler.java index f8bb55703..b25eef3d3 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MobilePositionNotifyMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MobilePositionNotifyMessageHandler.java @@ -78,7 +78,7 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen String channelId = getText(rootElementAfterCharset, "DeviceID"); DeviceChannel deviceChannel = deviceChannelService.getOne(device.getDeviceId(), channelId); if (deviceChannel == null) { - log.warn("[解析报警消息] 未找到通道:{}/{}", device.getDeviceId(), channelId); + log.warn("[解析移动位置通知] 未找到通道:{}/{}", device.getDeviceId(), channelId); continue; } diff --git a/web_src/src/components/channelList.vue b/web_src/src/components/channelList.vue index f20ad566f..f62535908 100755 --- a/web_src/src/components/channelList.vue +++ b/web_src/src/components/channelList.vue @@ -65,7 +65,7 @@ - +