weidong 087760aa12 1、将之前平滑算法hardcode的参数做成可配置的;
2、优化求重心算法,xy和z分别求重心
3、增加告警接口类型
2023-11-06 17:44:36 +08:00

236 lines
8.1 KiB
SQL

CREATE TABLE IF NOT EXISTS `UserCfg` (
`id` bigint(20),
`tenant_id` int DEFAULT 0,
`name` varchar(20) NOT NULL,
`pwd` varchar(64) NOT NULL,
`role` varchar(24) NOT NULL,
`locked` boolean DEFAULT false,
`nickname` varchar(20) DEFAULT NULL,
`init_pwd` boolean DEFAULT true,
`mobile` varchar(20) DEFAULT NULL,
`avatar_url` varchar(255) DEFAULT NULL,
`openid` varchar(64) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `TenantCfg` (
`id` int NOT NULL,
`name` varchar(128) NOT NULL,
`create_time` timestamp(3) DEFAULT CURRENT_TIMESTAMP(3),
`contact` varchar(64) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `gnssdevices` (
`id` bigint AUTO_INCREMENT,
`opmode` smallint DEFAULT 0,
`createtime` datetime DEFAULT NULL,
`createuser` varchar(50) DEFAULT NULL,
`updatetime` datetime DEFAULT NULL,
`updateuser` varchar(50) DEFAULT NULL,
`deviceid` varchar(20) NOT NULL,
`name` varchar(50) NOT NULL,
`parentid` varchar(20) DEFAULT NULL,
`devicetype` smallint DEFAULT 0,
`tenantid` int NOT NULL,
`tenantname` varchar(100) NOT NULL,
`project_id` int NOT NULL DEFAULT 0 COMMENT '项目id',
`group_id` int DEFAULT 1,
`calc_group_id` int DEFAULT 1,
`fwd_group_id` int DEFAULT 0,
`syn` bit(1) DEFAULT 0 COMMENT '是否已同步',
`pictures` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `gnssgroup` (
`id` int NOT NULL,
`work_cycle` int DEFAULT 0,
`active_time` int DEFAULT 0,
`active_offset` int DEFAULT 0,
`rs_adv` smallint DEFAULT 0,
`power_mode` smallint DEFAULT 0,
`device_num` int DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `gnssgroupcalc` (
`id` int NOT NULL,
`filter_hour` int DEFAULT NULL COMMENT '平滑窗口',
`xy_threshold` float DEFAULT NULL COMMENT '坏点水平门限',
`z_threshold` float DEFAULT NULL COMMENT '坏点垂直门限',
`auto_filter` bit(1) DEFAULT 0,
`filter_max_hour` int DEFAULT NULL COMMENT '最大平滑窗口',
`shock` float DEFAULT NULL,
`device_num` int DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `gnssgroupfwd` (
`id` int NOT NULL,
`description` varchar(128) DEFAULT NULL,
`type1` smallint DEFAULT 0,
`addr1` varchar(128) DEFAULT NULL,
`port1` int DEFAULT 0,
`type2` smallint DEFAULT 0,
`addr2` varchar(128) DEFAULT NULL,
`port2` int DEFAULT 0,
`fwd_template` longtext,
`device_num` int DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `gnssstatus` (
`id` bigint AUTO_INCREMENT,
`updatetime` datetime DEFAULT NULL,
`devicetime` datetime DEFAULT NULL,
`deviceid` varchar(20) NOT NULL,
`location` varchar(100) DEFAULT NULL,
`roll` float DEFAULT 0,
`pitch` float DEFAULT 0,
`yaw` float DEFAULT 0,
`rssi` int DEFAULT 0,
`voltage` int DEFAULT 0,
`temperature` float DEFAULT 0,
`humidity` float DEFAULT 0,
`satelliteinview` float DEFAULT 0,
`satelliteinuse` float DEFAULT 0,
`txbytes` int DEFAULT 0,
`rxbytes` int DEFAULT 0,
`b562bytes` int DEFAULT 0,
`d3xxbytes` int DEFAULT 0,
`state` smallint DEFAULT 0,
`warning` smallint DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `gnssdevicelocationrecords` (
`id` bigint AUTO_INCREMENT,
`enabled` bit(1) DEFAULT NULL,
`createtime` datetime DEFAULT NULL,
`createuser` varchar(50) CHARACTER SET utf8 DEFAULT NULL,
`updatetime` datetime DEFAULT NULL,
`updateuser` varchar(50) CHARACTER SET utf8 DEFAULT NULL,
`deviceid` varchar(20) CHARACTER SET utf8 NOT NULL,
`b562e` double DEFAULT NULL COMMENT '原始北斗位置东E',
`b562n` double DEFAULT NULL COMMENT '原始北斗位置北N',
`b562d` double DEFAULT NULL COMMENT '原始北斗位置天D',
`r9250e` double DEFAULT NULL,
`r9250n` double DEFAULT NULL,
`r9250d` double DEFAULT NULL,
`resulte` double DEFAULT NULL,
`resultn` double DEFAULT NULL,
`resultd` double DEFAULT NULL,
`tenantid` int NOT NULL,
`rb562e` double DEFAULT NULL COMMENT '相对北斗位置东E',
`rb562d` double DEFAULT NULL COMMENT '相对北斗位置北N',
`rb562n` double DEFAULT NULL COMMENT '相对北斗位置天D',
`pps` int DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_deviceid_time` (`deviceid`,`createtime`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE IF NOT EXISTS `gnssrawdata` (
`id` bigint AUTO_INCREMENT,
`createtime` datetime DEFAULT NULL,
`deviceid` varchar(20) CHARACTER SET utf8 NOT NULL,
`b562e` double DEFAULT NULL COMMENT '原始北斗位置东E',
`b562n` double DEFAULT NULL COMMENT '原始北斗位置北N',
`b562d` double DEFAULT NULL COMMENT '原始北斗位置天D',
`roll` double DEFAULT NULL,
`pitch` double DEFAULT NULL,
`yaw` double DEFAULT NULL,
`shock` double DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE IF NOT EXISTS `gnssmsg` (
`id` bigint AUTO_INCREMENT,
`createtime` datetime DEFAULT NULL,
`deviceid` varchar(20) NOT NULL,
`msgtype` int default 0,
`msglen` int default 0,
`content` varchar(128) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `gnssstatusmsg` (
`id` bigint AUTO_INCREMENT,
`createtime` datetime DEFAULT NULL,
`devicetime` datetime DEFAULT NULL,
`deviceid` varchar(20) NOT NULL,
`roll` float DEFAULT 0,
`pitch` float DEFAULT 0,
`yaw` float DEFAULT 0,
`dtustate` smallint DEFAULT 0,
`rssi` int DEFAULT 0,
`voltage` int DEFAULT 0,
`temperature` float DEFAULT 0,
`humidity` float DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `gnsstrxmsg` (
`id` bigint AUTO_INCREMENT,
`createtime` datetime DEFAULT NULL,
`devicetime` datetime DEFAULT NULL,
`deviceid` varchar(20) NOT NULL,
`uart1txbytes` int DEFAULT 0,
`uart1rxbytes` int DEFAULT 0,
`uart1unknown` int DEFAULT 0,
`uart2txbytes` int DEFAULT 0,
`uart2rxbytes` int DEFAULT 0,
`uart2unknown` int DEFAULT 0,
`servertxbytes` int DEFAULT 0,
`serverrxbytes` int DEFAULT 0,
`b562bytes` int DEFAULT 0,
`d3xxbytes` int DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `metadatas` (
`id` bigint NOT NULL,
`object` varchar(32) NOT NULL,
`keyname` varchar(32) NOT NULL,
`type` varchar(1) NOT NULL,
`mandatory` int NOT NULL,
`message` varchar(64) DEFAULT NULL,
`notes` varchar(256) DEFAULT NULL,
`format` varchar(128) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `object` (`object`,`keyname`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
CREATE TABLE IF NOT EXISTS `attributes` (
`id` bigint NOT NULL,
`object` varchar(32) NOT NULL,
`pid` bigint NOT NULL,
`keyname` varchar(32) NOT NULL,
`type` varchar(1) NOT NULL,
`valuestring` varchar(255) DEFAULT NULL,
`valuenumber` double DEFAULT NULL,
`valuedate` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `object` (`object`,`pid`,`keyname`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
CREATE TABLE IF NOT EXISTS `warninginfo` (
`id` int NOT NULL,
`createtime` datetime DEFAULT NULL,
`devicetime` datetime DEFAULT NULL,
`deviceid` varchar(20) NOT NULL,
`type` smallint DEFAULT NULL,
`info` varchar(64) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `warningcfg` (
`id` int NOT NULL,
`level` smallint DEFAULT 0,
`voltage` smallint DEFAULT NULL,
`rssi` smallint DEFAULT NULL,
`b562_failed_rate` smallint DEFAULT NULL,
`device_rx_unknown` smallint DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;