feat: 基站状态记录上报和导出功能

This commit is contained in:
TsMask
2025-02-08 16:59:36 +08:00
parent 7d4984e1d8
commit 3cbbfc44dd
14 changed files with 535 additions and 42 deletions

View File

@@ -0,0 +1,23 @@
--
-- Table structure for table `nb_state`
--
DROP TABLE IF EXISTS `nb_state`;
CREATE TABLE `nb_state` (
`id` int NOT NULL AUTO_INCREMENT,
`ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元类型 AMF MME',
`ne_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元ID',
`rm_uid` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '-' COMMENT '资源唯一标识',
`create_time` bigint DEFAULT '0' COMMENT '创建时间',
`address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '基站IP地址',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '基站名称',
`position` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '基站位置',
`nb_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '-' COMMENT '基站设备名称',
`ue_num` int DEFAULT '0' COMMENT '在线用户数',
`state` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'OFF' COMMENT '基站状态 OFF ON',
`time` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '-' COMMENT '状态时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `uk_type_id_uid_cat` (`ne_type`,`ne_id`,`rm_uid`,`create_time`) USING BTREE COMMENT '唯一网元类型和ID'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='基站状态记录表';
-- Dump completed on 2025-02-08 12:50:13

View File

@@ -151,8 +151,8 @@ INSERT INTO `sys_dict_data` VALUES (1143, 1143, 'log.operate.title.sgwcCDR', '
INSERT INTO `sys_dict_data` VALUES (1144, 1144, 'menu.securityRemark', '安全管理目录', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (1145, 1145, 'menu.system.systemSetRemark', '系统设置菜单', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (1146, 1146, 'menu.system.systemResourceRemark', '系统资源 cpu io network菜单', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (1147, 1147, 'menu.config.configNEFormRemark', '参数配置Form菜单', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (1148, 1148, 'menu.config.configNETreeRemark', '参数配置Tree菜单', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (1147, 1147, 'dictData.offline', '离线', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (1148, 1148, 'dictData.online', '在线', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (1149, 1149, 'menu.neData.baseStation', '基站状态', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (1150, 1150, 'menu.noData', '没有可访问菜单数据!', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (1151, 1151, 'menu.errNameExists', '操作菜单【{name}】失败,菜单名称已存在', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
@@ -188,14 +188,14 @@ INSERT INTO `sys_dict_data` VALUES (1423, 1423, 'dictData.operType.clear', '清
INSERT INTO `sys_dict_data` VALUES (1424, 1424, 'dictData.trace.interface', '接口跟踪', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (1425, 1425, 'dictData.trace.device', '设备跟踪', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (1426, 1426, 'dictData.trace.user', '用户跟踪', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (1427, 1427, 'dictData.logType.download', '下载', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (1428, 1428, 'dictData.logType.activation', '激活', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (1429, 1429, 'dictData.logType.add', '新增', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (1430, 1430, 'dictData.logType.other', '其他', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (1431, 1431, 'dictData.logType.back', '回退', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (1432, 1432, 'dictData.logType.delete', '删除', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (1433, 1433, 'dictData.logType.distribute', '分配', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (1434, 1434, 'dictData.logType.export', '导出', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (1427, 1427, 'nbState.export.id', '编号', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (1428, 1428, 'nbState.export.name', '基站名称', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (1429, 1429, 'nbState.export.position', '基站位置', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (1430, 1430, 'nbState.export.address', 'IP地址', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (1431, 1431, 'nbState.export.nbName', '设备名称', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (1432, 1432, 'nbState.export.ueNum', '在线用户数', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (1433, 1433, 'nbState.export.state', '基站状态', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (1434, 1434, 'nbState.export.time', '变更时间', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (1435, 1435, 'dictData.logType.query', '查询', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (1436, 1436, 'dictData.logType.setup', '设置', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (1437, 1437, 'dictData.logType.update', '更新', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
@@ -205,7 +205,7 @@ INSERT INTO `sys_dict_data` VALUES (1426, 1426, 'dictData.trace.user', '用户
-- INSERT INTO `sys_dict_data` VALUES (1441, 1441, 'dictData.logType.logout', '登出', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (1442, 1442, 'dictData.securityLogType.add', '新增', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (1443, 1443, 'dictData.securityLogType.update', '更新', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (1444, 1444, 'dictData.securityLogType.delete', '删除', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (1444, 1444, 'neHost.okBySSHLink', '设置免密直连成功', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (1445, 1445, 'neHost.banNE', '禁止操作网元', 'i18n_zh', '', '', '1', 'supervisor', 1728640045875, '', 0, '');
INSERT INTO `sys_dict_data` VALUES (1446, 1446, 'dictData.ne_host_type.redis', 'Redis', 'i18n_zh', '', '', '1', 'supervisor', 1728640045875, '', 0, '');
INSERT INTO `sys_dict_data` VALUES (1447, 1447, 'menu.tools.ping', '网络探测测试', 'i18n_zh', '', '', '1', 'supervisor', 1728640045875, '', 0, '');

View File

@@ -151,8 +151,8 @@ INSERT INTO `sys_dict_data` VALUES (3143, 3143, 'log.operate.title.sgwcCDR', 'Ro
INSERT INTO `sys_dict_data` VALUES (3144, 3144, 'menu.securityRemark', 'Security Management Catalog', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (3145, 3145, 'menu.system.systemSetRemark', 'System Settings Menu', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (3146, 3146, 'menu.system.systemResourceRemark', 'System Resources cpu io network menu', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (3147, 3147, 'menu.config.configNEFormRemark', 'Parameter Configuration Form Menu', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (3148, 3148, 'menu.config.configNETreeRemark', 'Parameter Configuration Tree Menu', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (3147, 3147, 'dictData.offline', 'Offline', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (3148, 3148, 'dictData.online', 'Online', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (3149, 3149, 'menu.neData.baseStation', 'Radio State', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (3150, 3150, 'menu.noData', 'There is no accessible menu data!', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (3151, 3151, 'menu.errNameExists', 'Failed to operate menu [{name}], menu name already exists!', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
@@ -188,14 +188,14 @@ INSERT INTO `sys_dict_data` VALUES (3423, 3423, 'dictData.operType.clear', 'Clea
INSERT INTO `sys_dict_data` VALUES (3424, 3424, 'dictData.trace.interface', 'Interface Tracing', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (3425, 3425, 'dictData.trace.device', 'Module Tracing', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (3426, 3426, 'dictData.trace.user', 'User Tracing', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (3427, 3427, 'dictData.logType.download', 'Download', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (3428, 3428, 'dictData.logType.activation', 'Activation', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (3429, 3429, 'dictData.logType.add', 'New', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (3430, 3430, 'dictData.logType.other', 'Other', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (3431, 3431, 'dictData.logType.back', 'Rollback', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (3432, 3432, 'dictData.logType.delete', 'Delete', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (3433, 3433, 'dictData.logType.distribute', 'Assign', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (3434, 3434, 'dictData.logType.export', 'Export', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (3427, 3427, 'nbState.export.id', 'ID', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (3428, 3428, 'nbState.export.name', 'Name', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (3429, 3429, 'nbState.export.position', 'Position', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (3430, 3430, 'nbState.export.address', 'IP Address', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (3431, 3431, 'nbState.export.nbName', 'RanNodeName', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (3432, 3432, 'nbState.export.ueNum', 'UE Number', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (3433, 3433, 'nbState.export.state', 'State', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (3434, 3434, 'nbState.export.time', 'Change Time', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (3435, 3435, 'dictData.logType.query', 'Query', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (3436, 3436, 'dictData.logType.setup', 'Setup', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (3437, 3437, 'dictData.logType.update', 'Update', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
@@ -205,7 +205,7 @@ INSERT INTO `sys_dict_data` VALUES (3426, 3426, 'dictData.trace.user', 'User Tra
-- INSERT INTO `sys_dict_data` VALUES (3441, 3441, 'dictData.logType.logout', 'Logout', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (3442, 3442, 'dictData.securityLogType.add', 'New', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (3443, 3443, 'dictData.securityLogType.update', 'Update', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- INSERT INTO `sys_dict_data` VALUES (3444, 3444, 'dictData.securityLogType.delete', 'Delete', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (3444, 3444, 'neHost.okBySSHLink', 'Setting up a password-free direct connection is successful', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
INSERT INTO `sys_dict_data` VALUES (3445, 3445, 'neHost.banNE', 'Do not operate the NE', 'i18n_en', '', '', '1', 'supervisor', 1728640045875, '', 0, '');
INSERT INTO `sys_dict_data` VALUES (3446, 3446, 'dictData.ne_host_type.redis', 'Redis', 'i18n_en', '', '', '1', 'supervisor', 1728640045875, '', 0, '');
INSERT INTO `sys_dict_data` VALUES (3447, 3447, 'menu.tools.ping', 'Net Probing Test', 'i18n_en', '', '', '1', 'supervisor', 1728640045875, '', 0, '');

View File

@@ -0,0 +1,22 @@
--
-- Table structure for table `nb_state`
--
CREATE TABLE IF NOT EXISTS `nb_state` (
`id` int NOT NULL AUTO_INCREMENT,
`ne_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元类型 AMF MME',
`ne_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '网元ID',
`rm_uid` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '-' COMMENT '资源唯一标识',
`create_time` bigint DEFAULT '0' COMMENT '创建时间',
`address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '基站IP地址',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '基站名称',
`position` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '基站位置',
`nb_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '-' COMMENT '基站设备名称',
`ue_num` int DEFAULT '0' COMMENT '在线用户数',
`state` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'OFF' COMMENT '基站状态 OFF ON',
`time` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '-' COMMENT '状态时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `uk_type_id_uid_cat` (`ne_type`,`ne_id`,`rm_uid`,`create_time`) USING BTREE COMMENT '唯一网元类型和ID'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='基站状态记录表';
-- Dump completed on 2025-02-08 12:50:13

View File

@@ -158,8 +158,8 @@ REPLACE INTO `sys_dict_data` VALUES (1143, 1143, 'log.operate.title.sgwcCDR', '
REPLACE INTO `sys_dict_data` VALUES (1144, 1144, 'menu.securityRemark', '安全管理目录', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (1145, 1145, 'menu.system.systemSetRemark', '系统设置菜单', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (1146, 1146, 'menu.system.systemResourceRemark', '系统资源 cpu io network菜单', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (1147, 1147, 'menu.config.configNEFormRemark', '参数配置Form菜单', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (1148, 1148, 'menu.config.configNETreeRemark', '参数配置Tree菜单', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (1147, 1147, 'dictData.offline', '离线', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (1148, 1148, 'dictData.online', '在线', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (1149, 1149, 'menu.neData.baseStation', '基站状态', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (1150, 1150, 'menu.noData', '没有可访问菜单数据!', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (1151, 1151, 'menu.errNameExists', '操作菜单【{name}】失败,菜单名称已存在', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
@@ -195,14 +195,14 @@ REPLACE INTO `sys_dict_data` VALUES (1423, 1423, 'dictData.operType.clear', '清
REPLACE INTO `sys_dict_data` VALUES (1424, 1424, 'dictData.trace.interface', '接口跟踪', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (1425, 1425, 'dictData.trace.device', '设备跟踪', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (1426, 1426, 'dictData.trace.user', '用户跟踪', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (1427, 1427, 'dictData.logType.download', '下载', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (1428, 1428, 'dictData.logType.activation', '激活', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (1429, 1429, 'dictData.logType.add', '新增', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (1430, 1430, 'dictData.logType.other', '其他', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (1431, 1431, 'dictData.logType.back', '回退', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (1432, 1432, 'dictData.logType.delete', '删除', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (1433, 1433, 'dictData.logType.distribute', '分配', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (1434, 1434, 'dictData.logType.export', '导出', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (1427, 1427, 'nbState.export.id', '编号', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (1428, 1428, 'nbState.export.name', '基站名称', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (1429, 1429, 'nbState.export.position', '基站位置', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (1430, 1430, 'nbState.export.address', 'IP地址', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (1431, 1431, 'nbState.export.nbName', '设备名称', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (1432, 1432, 'nbState.export.ueNum', '在线用户数', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (1433, 1433, 'nbState.export.state', '基站状态', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (1434, 1434, 'nbState.export.time', '变更时间', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (1435, 1435, 'dictData.logType.query', '查询', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (1436, 1436, 'dictData.logType.setup', '设置', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (1437, 1437, 'dictData.logType.update', '更新', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
@@ -212,7 +212,7 @@ REPLACE INTO `sys_dict_data` VALUES (1426, 1426, 'dictData.trace.user', '用户
-- REPLACE INTO `sys_dict_data` VALUES (1441, 1441, 'dictData.logType.logout', '登出', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (1442, 1442, 'dictData.securityLogType.add', '新增', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (1443, 1443, 'dictData.securityLogType.update', '更新', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (1444, 1444, 'dictData.securityLogType.delete', '删除', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (1444, 1444, 'neHost.okBySSHLink', '设置免密直连成功', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (1445, 1445, 'neHost.banNE', '禁止操作网元', 'i18n_zh', '', '', '1', 'supervisor', 1728640045875, '', 0, '');
REPLACE INTO `sys_dict_data` VALUES (1446, 1446, 'dictData.ne_host_type.redis', 'Redis', 'i18n_zh', '', '', '1', 'supervisor', 1728640045875, '', 0, '');
REPLACE INTO `sys_dict_data` VALUES (1447, 1447, 'menu.tools.ping', '网络探测测试', 'i18n_zh', '', '', '1', 'supervisor', 1728640045875, '', 0, '');

View File

@@ -156,6 +156,8 @@ REPLACE INTO `sys_dict_data` VALUES (3143, 3143, 'log.operate.title.sgwcCDR', 'R
REPLACE INTO `sys_dict_data` VALUES (3144, 3144, 'menu.securityRemark', 'Security Management Catalog', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (3145, 3145, 'menu.system.systemSetRemark', 'System Settings Menu', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (3146, 3146, 'menu.system.systemResourceRemark', 'System Resources cpu io network menu', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (3147, 3147, 'dictData.offline', 'Offline', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (3148, 3148, 'dictData.online', 'Online', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (3149, 3149, 'menu.neData.baseStation', 'Radio State', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (3150, 3150, 'menu.noData', 'There is no accessible menu data!', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (3151, 3151, 'menu.errNameExists', 'Failed to operate menu [{name}], menu name already exists!', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
@@ -191,14 +193,14 @@ REPLACE INTO `sys_dict_data` VALUES (3423, 3423, 'dictData.operType.clear', 'Cle
REPLACE INTO `sys_dict_data` VALUES (3424, 3424, 'dictData.trace.interface', 'Interface Tracing', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (3425, 3425, 'dictData.trace.device', 'Module Tracing', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (3426, 3426, 'dictData.trace.user', 'User Tracing', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (3427, 3427, 'dictData.logType.download', 'Download', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (3428, 3428, 'dictData.logType.activation', 'Activation', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (3429, 3429, 'dictData.logType.add', 'New', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (3430, 3430, 'dictData.logType.other', 'Other', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (3431, 3431, 'dictData.logType.back', 'Rollback', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (3432, 3432, 'dictData.logType.delete', 'Delete', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (3433, 3433, 'dictData.logType.distribute', 'Assign', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (3434, 3434, 'dictData.logType.export', 'Export', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (3427, 3427, 'nbState.export.id', 'ID', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (3428, 3428, 'nbState.export.name', 'Name', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (3429, 3429, 'nbState.export.position', 'Position', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (3430, 3430, 'nbState.export.address', 'IP Address', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (3431, 3431, 'nbState.export.nbName', 'RanNodeName', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (3432, 3432, 'nbState.export.ueNum', 'UE Number', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (3433, 3433, 'nbState.export.state', 'State', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (3434, 3434, 'nbState.export.time', 'Change Time', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (3435, 3435, 'dictData.logType.query', 'Query', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (3436, 3436, 'dictData.logType.setup', 'Setup', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (3437, 3437, 'dictData.logType.update', 'Update', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
@@ -208,7 +210,7 @@ REPLACE INTO `sys_dict_data` VALUES (3426, 3426, 'dictData.trace.user', 'User Tr
-- REPLACE INTO `sys_dict_data` VALUES (3441, 3441, 'dictData.logType.logout', 'Logout', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (3442, 3442, 'dictData.securityLogType.add', 'New', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (3443, 3443, 'dictData.securityLogType.update', 'Update', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- REPLACE INTO `sys_dict_data` VALUES (3444, 3444, 'dictData.securityLogType.delete', 'Delete', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (3444, 3444, 'neHost.okBySSHLink', 'Setting up a password-free direct connection is successful', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (3445, 3445, 'neHost.banNE', 'Do not operate the NE', 'i18n_en', '', '', '1', 'supervisor', 1728640045875, '', 0, '');
REPLACE INTO `sys_dict_data` VALUES (3446, 3446, 'dictData.ne_host_type.redis', 'Redis', 'i18n_en', '', '', '1', 'supervisor', 1728640045875, '', 0, '');
REPLACE INTO `sys_dict_data` VALUES (3447, 3447, 'menu.tools.ping', 'Net Probing Test', 'i18n_en', '', '', '1', 'supervisor', 1728640045875, '', 0, '');

View File

@@ -15,6 +15,8 @@ import (
"be.ems/lib/log"
"be.ems/lib/services"
tokenConst "be.ems/src/framework/constants/token"
neDataModel "be.ems/src/modules/network_data/model"
neDataService "be.ems/src/modules/network_data/service"
neService "be.ems/src/modules/network_element/service"
"github.com/go-resty/resty/v2"
"github.com/gorilla/mux"
@@ -76,6 +78,7 @@ type N3iwfUEData struct {
}
var (
UriNBState = config.DefaultUriPrefix + "/ueManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/nbState"
UriNBInfo = config.DefaultUriPrefix + "/ueManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/nbInfo"
UriUEInfo = config.DefaultUriPrefix + "/ueManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/ueInfo"
UriUENum = config.DefaultUriPrefix + "/ueManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/ueNum"
@@ -86,6 +89,7 @@ var (
UriNSSFAvailableAMFs = config.DefaultUriPrefix + "/ueManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/availableAMFs"
UriNSSFSubscriptions = config.DefaultUriPrefix + "/ueManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/subscriptions"
CustomUriNBState = config.UriPrefix + "/ueManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/nbState"
CustomUriNBInfo = config.UriPrefix + "/ueManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/nbInfo"
CustomUriUEInfo = config.UriPrefix + "/ueManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/ueInfo"
CustomUriUENum = config.UriPrefix + "/ueManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/ueNum"
@@ -618,6 +622,73 @@ func GetNBInfoFromNF(w http.ResponseWriter, r *http.Request) {
}
}
// PostNBInfoFromNF 接收Radio数据请求
func PostNBInfoFromNF(w http.ResponseWriter, r *http.Request) {
log.Info("PostNBInfoFromNF processing... ")
neType := ctx.GetParam(r, "elementTypeValue")
var body struct {
NeType string `json:"neType" `
NeName string `json:"neName" `
RmUID string `json:"rmUID"`
StateList []struct {
Address string `json:"address" `
Name string `json:"name" `
Position string `json:"position" `
NbName string `json:"nbName" `
UENum int64 `json:"ueNum" `
State string `json:"state" ` // "OFF" or "ON"
OffTime string `json:"offTime" ` //if State=OFF, will set it
OnTime string `json:"onTime" ` //if State=ON , will set it
}
}
if err := ctx.ShouldBindJSON(r, &body); err != nil {
services.ResponseInternalServerError500ProcessError(w, err)
return
}
neTypeLower := strings.ToLower(body.NeType)
if neType == "" || neType != neTypeLower {
services.ResponseInternalServerError500ProcessError(w, fmt.Errorf("inconsistent network element types"))
return
}
neInfo := neService.NewNeInfo.SelectNeInfoByRmuid(body.RmUID)
if neInfo.RmUID != body.RmUID {
services.ResponseInternalServerError500ProcessError(w, fmt.Errorf("inconsistent network element rmUID"))
return
}
if len(body.StateList) == 0 {
services.ResponseInternalServerError500ProcessError(w, fmt.Errorf("no stateList"))
return
}
nbStateService := neDataService.NewNBState
for _, v := range body.StateList {
if v.Address == "" || v.State == "" {
continue
}
timeStr := v.OffTime
if v.State == "ON" {
timeStr = v.OnTime
}
nbStateService.Insert(neDataModel.NBState{
NeType: neInfo.NeType,
NeId: neInfo.NeId,
RmUid: neInfo.RmUID,
Address: v.Address,
Name: v.Name,
Position: v.Position,
NbName: v.NbName,
UeNum: v.UENum,
State: v.State,
Time: timeStr,
})
}
services.ResponseStatusOK204NoContent(w)
}
// Get Radio Info from NF/NFs
func GetNBInfoAllFromNF(w http.ResponseWriter, r *http.Request) {
log.Info("GetNBInfoAllFromNF processing... ")

View File

@@ -263,6 +263,8 @@ func init() {
// NBInfo
Register("GET", ue.UriNBInfo, ue.GetNBInfoFromNF, nil)
Register("GET", ue.CustomUriNBInfo, ue.GetNBInfoFromNF, nil)
Register("POST", ue.UriNBState, ue.PostNBInfoFromNF, nil)
Register("POST", ue.CustomUriNBState, ue.PostNBInfoFromNF, nil)
// NSSF AvailableAMFs
Register("GET", ue.UriNSSFAvailableAMFs, ue.GetAvailableAMFsFromNSSF, nil)

View File

@@ -22,6 +22,7 @@ var URL_WHITE_LIST = []string{
"/omcNeConfig",
"/cdrEvent",
"/ueEvent",
"/objectType/nbState",
"/upload-ue",
"/oauth/token",
}

View File

@@ -0,0 +1,121 @@
package controller
import (
"fmt"
"time"
"github.com/gin-gonic/gin"
"be.ems/src/framework/i18n"
"be.ems/src/framework/utils/ctx"
"be.ems/src/framework/vo/result"
"be.ems/src/modules/network_data/model"
neDataService "be.ems/src/modules/network_data/service"
neService "be.ems/src/modules/network_element/service"
)
// 实例化控制层 NBStateController 结构体
var NewNBState = &NBStateController{
neInfoService: neService.NewNeInfo,
nbStateService: neDataService.NewNBState,
}
// 基站状态历史记录 AMF/MME
//
// PATH /nb-state
type NBStateController struct {
neInfoService *neService.NeInfo // 网元信息服务
nbStateService *neDataService.NBState // 基站状态服务
}
// 历史记录列表
//
// GET /list
//
// @Tags network_data/amf,network_data/mme
// @Accept json
// @Produce json
// @Param neType query string true "NE Type only AMF/MME" Enums(AMF,MME) default(AMF)
// @Param neId query string true "NE ID" default(001)
// @Param pageNum query number true "pageNum" default(1)
// @Param pageSize query number true "pageSize" default(10)
// @Param startTime query number false "Start time (timestamped milliseconds)" default(1729162507596)
// @Param endTime query number false "End time (timestamped milliseconds)" default(1729164187611)
// @Param sortField query string false "Sort fields, fill in result fields" Enums(id,create_time) default(id)
// @Param sortOrder query string false "Sort by ascending or descending order" Enums(asc,desc) default(asc)
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Base Station Status List
// @Description Base Station Status List
// @Router /nb-state/list [get]
func (s NBStateController) List(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var query model.NBStateQuery
if err := c.ShouldBindQuery(&query); err != nil {
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
return
}
// 查询网元信息 rmUID
neInfo := s.neInfoService.SelectNeInfoByNeTypeAndNeID(query.NeType, query.NeID)
if neInfo.NeId != query.NeID || neInfo.IP == "" {
c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.noNEInfo")))
return
}
query.RmUID = neInfo.RmUID
// 查询数据
rows, total := s.nbStateService.SelectPage(query)
c.JSON(200, result.Ok(map[string]any{"rows": rows, "total": total}))
}
// 历史记录列表导出
//
// POST /export
//
// @Tags network_data/amf,network_data/mme
// @Accept json
// @Produce json
// @Param data body object true "Request Param"
// @Success 200 {object} object "Response Results"
// @Security TokenAuth
// @Summary Base Station Status List Export
// @Description Base Station Status List Export
// @Router /nb-state/export [post]
func (s NBStateController) Export(c *gin.Context) {
language := ctx.AcceptLanguage(c)
// 查询结果,根据查询条件结果,单页最大值限制
var querys model.NBStateQuery
if err := c.ShouldBindBodyWithJSON(&querys); err != nil {
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
return
}
// 限制导出数据集
if querys.PageSize > 10000 {
querys.PageSize = 10000
}
// 查询网元信息 rmUID
neInfo := s.neInfoService.SelectNeInfoByNeTypeAndNeID(querys.NeType, querys.NeID)
if neInfo.NeId != querys.NeID || neInfo.IP == "" {
c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.noNEInfo")))
return
}
querys.RmUID = neInfo.RmUID
rows, total := s.nbStateService.SelectPage(querys)
if total == 0 {
// 导出数据记录为空
c.JSON(200, result.ErrMsg(i18n.TKey(language, "app.common.exportEmpty")))
return
}
// 导出文件名称
fileName := fmt.Sprintf("nb_state_records_export_%d_%d.xlsx", len(rows), time.Now().UnixMilli())
// 导出数据表格
saveFilePath, err := s.nbStateService.ExportXlsx(rows, fileName, language)
if err != nil {
c.JSON(200, result.ErrMsg(err.Error()))
return
}
c.FileAttachment(saveFilePath, fileName)
}

View File

@@ -0,0 +1,36 @@
package model
// NBState 基站状态记录表 nb_state
type NBState struct {
ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"`
NeType string `json:"neType" gorm:"column:ne_type"` // 网元类型 AMF MME
NeId string `json:"neId" gorm:"column:ne_id"` // 网元ID
RmUid string `json:"rmUid" gorm:"column:rm_uid"` // 资源唯一标识
CreateTime int64 `json:"createTime" gorm:"column:create_time"` // 创建时间
Address string `json:"address" gorm:"column:address"` // 基站IP地址
NbName string `json:"nbName" gorm:"column:nb_name"` // 基站设备名称
UeNum int64 `json:"ueNum" gorm:"column:ue_num"` // 在线用户数
Name string `json:"name" gorm:"column:name"` // 基站名称
Position string `json:"position" gorm:"column:position"` // 基站位置
State string `json:"state" gorm:"column:state"` // 基站状态 OFF ON
Time string `json:"time" gorm:"column:time"` // 状态时间
}
// TableName 表名称
func (*NBState) TableName() string {
return "nb_state"
}
// NBStateQuery 查询参数结构体
type NBStateQuery struct {
NeType string `json:"neType" form:"neType" binding:"required"`
NeID string `json:"neId" form:"neId" binding:"required"`
PageNum int64 `json:"pageNum" form:"pageNum" binding:"required"`
PageSize int64 `json:"pageSize" form:"pageSize" binding:"required"`
Status string `json:"status" form:"status"`
StartTime string `json:"startTime" form:"startTime"`
EndTime string `json:"endTime" form:"endTime"`
SortField string `json:"sortField" form:"sortField" binding:"omitempty,oneof=id create_time"` // 排序字段,填写结果字段
SortOrder string `json:"sortOrder" form:"sortOrder" binding:"omitempty,oneof=asc desc"` // 排序升降序asc desc
RmUID string `json:"rmUID" form:"rmUID"`
}

View File

@@ -42,6 +42,19 @@ func Setup(router *gin.Engine) {
)
}
// 基站状态历史记录信息 含AMF/MME
nbStateGroup := neDataGroup.Group("/nb-state")
{
nbStateGroup.GET("/list",
middleware.PreAuthorize(nil),
controller.NewNBState.List,
)
nbStateGroup.POST("/export",
middleware.PreAuthorize(nil),
controller.NewNBState.Export,
)
}
// 网元IMS
imsGroup := neDataGroup.Group("/ims")
{

View File

@@ -0,0 +1,116 @@
package repository
import (
"time"
"be.ems/src/framework/datasource"
"be.ems/src/framework/logger"
"be.ems/src/modules/network_data/model"
)
// 实例化数据层 NBState 结构体
var NewNBState = &NBState{}
// NBState 基站状态记录表 数据层处理
type NBState struct{}
// SelectByPage 分页查询集合
func (r NBState) SelectByPage(query model.NBStateQuery) ([]model.NBState, int64) {
tx := datasource.DB("").Model(&model.NBState{})
// 查询条件拼接
if query.NeType != "" {
tx = tx.Where("ne_type = ?", query.NeType)
}
if query.NeID != "" {
tx = tx.Where("ne_id = ?", query.NeID)
}
if query.RmUID != "" {
tx = tx.Where("rm_uid = ?", query.RmUID)
}
if query.Status != "" {
tx = tx.Where("state = ?", query.Status)
}
if query.StartTime != "" {
startTime := query.StartTime
if len(startTime) == 10 {
startTime = startTime + "000"
}
tx = tx.Where("create_time >= ?", startTime)
}
if query.EndTime != "" {
endTime := query.EndTime
if len(endTime) == 10 {
endTime = endTime + "999"
}
tx = tx.Where("create_time <= ?", endTime)
}
// 查询结果
var total int64 = 0
rows := []model.NBState{}
// 查询数量为0直接返回
if err := tx.Count(&total).Error; err != nil || total <= 0 {
return rows, total
}
// 排序
if query.SortField != "" {
sortField := query.SortField
if query.SortOrder == "desc" {
sortField = sortField + " desc"
}
tx = tx.Order(sortField)
}
// 查询数据分页
pageNum, pageSize := datasource.PageNumSize(query.PageNum, query.PageSize)
tx = tx.Limit(pageSize).Offset(pageSize * pageNum)
err := tx.Find(&rows).Error
if err != nil {
logger.Errorf("query find err => %v", err.Error())
return rows, total
}
return rows, total
}
// SelectByIds 通过ID查询
func (r NBState) SelectByIds(ids []string) []model.NBState {
rows := []model.NBState{}
if len(ids) <= 0 {
return rows
}
tx := datasource.DB("").Model(&model.NBState{})
// 构建查询条件
tx = tx.Where("id in ?", ids)
// 查询数据
if err := tx.Find(&rows).Error; err != nil {
logger.Errorf("query find err => %v", err.Error())
return rows
}
return rows
}
// DeleteByIds 批量删除信息
func (r NBState) DeleteByIds(ids []string) int64 {
if len(ids) <= 0 {
return 0
}
tx := datasource.DB("").Where("id in ?", ids)
if err := tx.Delete(&model.NBState{}).Error; err != nil {
logger.Errorf("delete err => %v", err.Error())
return 0
}
return tx.RowsAffected
}
// Insert 新增信息
func (r NBState) Insert(param model.NBState) int64 {
param.CreateTime = time.Now().UnixMilli()
// 执行插入
if err := datasource.DB("").Create(&param).Error; err != nil {
logger.Errorf("insert err => %v", err.Error())
return 0
}
return param.ID
}

View File

@@ -0,0 +1,86 @@
package service
import (
"fmt"
"strconv"
"be.ems/src/framework/i18n"
"be.ems/src/framework/utils/file"
"be.ems/src/modules/network_data/model"
"be.ems/src/modules/network_data/repository"
)
// 实例化数据层 NBState 结构体
var NewNBState = &NBState{
nbStateRepository: repository.NewNBState,
}
// NBState 基站状态记录表 服务层处理
type NBState struct {
nbStateRepository *repository.NBState // 基站状态记录信息
}
// SelectPage 根据条件分页查询
func (r NBState) SelectPage(query model.NBStateQuery) ([]model.NBState, int64) {
return r.nbStateRepository.SelectByPage(query)
}
// Insert 插入数据
func (r NBState) Insert(item model.NBState) int64 {
return r.nbStateRepository.Insert(item)
}
// DeleteByIds 批量删除信息
func (r NBState) DeleteByIds(ids []string) (int64, error) {
// 检查是否存在
arr := r.nbStateRepository.SelectByIds(ids)
if len(arr) <= 0 {
return 0, fmt.Errorf("not data")
}
if len(arr) == len(ids) {
rows := r.nbStateRepository.DeleteByIds(ids)
return rows, nil
}
// 删除信息失败!
return 0, fmt.Errorf("delete fail")
}
// ExportXlsx 导出数据到 xlsx 文件
func (r NBState) ExportXlsx(rows []model.NBState, fileName, language string) (string, error) {
// 第一行表头标题
headerCells := map[string]string{
"A1": i18n.TKey(language, "nbState.export.id"),
"B1": i18n.TKey(language, "nbState.export.name"),
"C1": i18n.TKey(language, "nbState.export.position"),
"D1": i18n.TKey(language, "nbState.export.address"),
"E1": i18n.TKey(language, "nbState.export.nbName"),
"F1": i18n.TKey(language, "nbState.export.ueNum"),
"G1": i18n.TKey(language, "nbState.export.state"),
"H1": i18n.TKey(language, "nbState.export.time"),
}
// 从第二行开始的数据
dataCells := make([]map[string]any, 0)
for i, row := range rows {
idx := strconv.Itoa(i + 2)
// 角色状态
statusValue := i18n.TKey(language, "dictData.offline")
if row.State == "ON" {
statusValue = i18n.TKey(language, "dictData.online")
}
dataCells = append(dataCells, map[string]any{
"A" + idx: row.ID,
"B" + idx: row.Name,
"C" + idx: row.Position,
"D" + idx: row.Address,
"E" + idx: row.NbName,
"F" + idx: row.UeNum,
"G" + idx: statusValue,
"H" + idx: row.Time,
})
}
// 导出数据表格
return file.WriteSheet(headerCells, dataCells, fileName, "Sheet1")
}