diff --git a/database/install/cb_message.sql b/database/install/cb_message.sql index 531f68ec..bb9db31e 100755 --- a/database/install/cb_message.sql +++ b/database/install/cb_message.sql @@ -11,7 +11,7 @@ Target Server Version : 100622 (10.6.22-MariaDB-0ubuntu0.22.04.1) File Encoding : 65001 - Date: 04/07/2025 16:00:50 + Date: 14/07/2025 17:48:34 */ SET NAMES utf8mb4; @@ -27,11 +27,12 @@ CREATE TABLE `cb_message` ( `ne_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `message_json` varchar(10240) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `status` enum('ACTIVE','INACTIVE') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'INACTIVE', + `detail` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `created_at` bigint(20) NULL DEFAULT current_timestamp(), `updated_at` bigint(20) NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE, INDEX `id`(`id`) USING BTREE, INDEX `idx_ne_time`(`ne_type`, `ne_id`, `created_at`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'CDR事件_MF' ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 57 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'CDR事件_MF' ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1; diff --git a/database/install/ne_host.sql b/database/install/ne_host.sql index 59bae626..db05ded4 100644 --- a/database/install/ne_host.sql +++ b/database/install/ne_host.sql @@ -32,33 +32,5 @@ CREATE TABLE `ne_host` ( -- 初始数据对应网元 INSERT INTO `ne_host` VALUES (1, 'ssh', '1', 'OMC_001_22', '127.0.0.1', 22, 'omcuser', '2', '', '', '', '', '', 'supervisor', 1729063407329, 'supervisor', 1729063818372); INSERT INTO `ne_host` VALUES (2, 'telnet', '1', 'OMC_001_4100', '127.0.0.1', 4100, 'admin', '0', 'NUBonCin4GZgl7o12YjeClE8ToQmYp9KWdhMjSNxc2M=', '', '', '', '', 'supervisor', 1729063407333, 'supervisor', 1729063818375); -INSERT INTO `ne_host` VALUES (3, 'ssh', '1', 'IMS_001_22', '172.16.5.110', 22, 'omcuser', '2', '', '', '', '', '', 'supervisor', 1729063407329, 'supervisor', 1729063818372); -INSERT INTO `ne_host` VALUES (4, 'telnet', '1', 'IMS_001_4100', '172.16.5.110', 4100, 'admin', '0', 'NUBonCin4GZgl7o12YjeClE8ToQmYp9KWdhMjSNxc2M=', '', '', '', '', 'supervisor', 1729063407333, 'supervisor', 1729063818375); -INSERT INTO `ne_host` VALUES (5, 'ssh', '1', 'AMF_001_22', '172.16.5.120', 22, 'omcuser', '2', '', '', '', '', '', 'supervisor', 1729063407329, 'supervisor', 1729063818372); -INSERT INTO `ne_host` VALUES (6, 'telnet', '1', 'AMF_001_4100', '172.16.5.120', 4100, 'admin', '0', 'NUBonCin4GZgl7o12YjeClE8ToQmYp9KWdhMjSNxc2M=', '', '', '', '', 'supervisor', 1729063407333, 'supervisor', 1729063818375); -INSERT INTO `ne_host` VALUES (7, 'ssh', '1', 'AUSF_001_22', '172.16.5.130', 22, 'omcuser', '2', '', '', '', '', '', 'supervisor', 1729063407329, 'supervisor', 1729063818372); -INSERT INTO `ne_host` VALUES (8, 'telnet', '1', 'AUSF_001_4100', '172.16.5.130', 4100, 'admin', '0', 'NUBonCin4GZgl7o12YjeClE8ToQmYp9KWdhMjSNxc2M=', '', '', '', '', 'supervisor', 1729063407333, 'supervisor', 1729063818375); -INSERT INTO `ne_host` VALUES (9, 'ssh', '1', 'UDM_001_22', '172.16.5.140', 22, 'omcuser', '2', '', '', '', '', '', 'supervisor', 1729063407329, 'supervisor', 1729063818372); -INSERT INTO `ne_host` VALUES (10, 'telnet', '1', 'UDM_001_4100', '172.16.5.140', 4100, 'admin', '0', 'NUBonCin4GZgl7o12YjeClE8ToQmYp9KWdhMjSNxc2M=', '', '', '', '', 'supervisor', 1729063407333, 'supervisor', 1729063818375); -INSERT INTO `ne_host` VALUES (11, 'redis', '1', 'UDM_001_6379', '172.16.5.140', 6379, 'udmdb', '0', 'nO3fEhtuKuBkQE5ozsUhNfzn02vhnyxYTEiPn2CIlr4=', '', '', '0', '', 'supervisor', 1728989383529, 'supervisor', 1729065073516); -INSERT INTO `ne_host` VALUES (12, 'ssh', '1', 'SMF_001_22', '172.16.5.150', 22, 'omcuser', '2', '', '', '', '', '', 'supervisor', 1729063407329, 'supervisor', 1729063818372); -INSERT INTO `ne_host` VALUES (13, 'telnet', '1', 'SMF_001_4100', '172.16.5.150', 4100, 'admin', '0', 'NUBonCin4GZgl7o12YjeClE8ToQmYp9KWdhMjSNxc2M=', '', '', '', '', 'supervisor', 1729063407333, 'supervisor', 1729063818375); -INSERT INTO `ne_host` VALUES (14, 'ssh', '1', 'PCF_001_22', '172.16.5.160', 22, 'omcuser', '2', '', '', '', '', '', 'supervisor', 1729063407329, 'supervisor', 1729063818372); -INSERT INTO `ne_host` VALUES (15, 'telnet', '1', 'PCF_001_4100', '172.16.5.160', 4100, 'admin', '0', 'NUBonCin4GZgl7o12YjeClE8ToQmYp9KWdhMjSNxc2M=', '', '', '', '', 'supervisor', 1729063407333, 'supervisor', 1729063818375); -INSERT INTO `ne_host` VALUES (16, 'ssh', '1', 'NSSF_001_22', '172.16.5.170', 22, 'omcuser', '2', '', '', '', '', '', 'supervisor', 1729063407329, 'supervisor', 1729063818372); -INSERT INTO `ne_host` VALUES (17, 'telnet', '1', 'NSSF_001_4100', '172.16.5.170', 4100, 'admin', '0', 'NUBonCin4GZgl7o12YjeClE8ToQmYp9KWdhMjSNxc2M=', '', '', '', '', 'supervisor', 1729063407333, 'supervisor', 1729063818375); -INSERT INTO `ne_host` VALUES (18, 'ssh', '1', 'NRF_001_22', '172.16.5.180', 22, 'omcuser', '2', '', '', '', '', '', 'supervisor', 1729063407329, 'supervisor', 1729063818372); -INSERT INTO `ne_host` VALUES (19, 'telnet', '1', 'NRF_001_4100', '172.16.5.180', 4100, 'admin', '0', 'NUBonCin4GZgl7o12YjeClE8ToQmYp9KWdhMjSNxc2M=', '', '', '', '', 'supervisor', 1729063407333, 'supervisor', 1729063818375); -INSERT INTO `ne_host` VALUES (20, 'ssh', '1', 'UPF_001_22', '172.16.5.190', 22, 'omcuser', '2', '', '', '', '', '', 'supervisor', 1729063407329, 'supervisor', 1729063818372); -INSERT INTO `ne_host` VALUES (21, 'telnet', '1', 'UPF_001_4100', '172.16.5.190', 4100, 'admin', '0', 'NUBonCin4GZgl7o12YjeClE8ToQmYp9KWdhMjSNxc2M=', '', '', '', '', 'supervisor', 1729063407333, 'supervisor', 1729063818375); -INSERT INTO `ne_host` VALUES (22, 'telnet', '1', 'UPF_001_5002', '172.16.5.190', 5002, 'admin', '0', '', '', '', '', '', 'supervisor', 1729063407333, 'supervisor', 1729063818375); -INSERT INTO `ne_host` VALUES (23, 'ssh', '1', 'LMF_001_22', '172.16.5.200', 22, 'omcuser', '2', '', '', '', '', '', 'supervisor', 1729063407329, 'supervisor', 1729063818372); -INSERT INTO `ne_host` VALUES (24, 'telnet', '1', 'LMF_001_4100', '172.16.5.200', 4100, 'admin', '0', 'NUBonCin4GZgl7o12YjeClE8ToQmYp9KWdhMjSNxc2M=', '', '', '', '', 'supervisor', 1729063407333, 'supervisor', 1729063818375); -INSERT INTO `ne_host` VALUES (25, 'ssh', '1', 'NEF_001_22', '172.16.5.210', 22, 'omcuser', '2', '', '', '', '', '', 'supervisor', 1729063407329, 'supervisor', 1729063818372); -INSERT INTO `ne_host` VALUES (26, 'telnet', '1', 'NEF_001_4100', '172.16.5.210', 4100, 'admin', '0', 'NUBonCin4GZgl7o12YjeClE8ToQmYp9KWdhMjSNxc2M=', '', '', '', '', 'supervisor', 1729063407333, 'supervisor', 1729063818375); -INSERT INTO `ne_host` VALUES (27, 'ssh', '1', 'MME_001_22', '172.16.5.220', 22, 'omcuser', '2', '', '', '', '', '', 'supervisor', 1729063407329, 'supervisor', 1729063818372); -INSERT INTO `ne_host` VALUES (28, 'telnet', '1', 'MME_001_4100', '172.16.5.220', 4100, 'admin', '0', 'NUBonCin4GZgl7o12YjeClE8ToQmYp9KWdhMjSNxc2M=', '', '', '', '', 'supervisor', 1729063407333, 'supervisor', 1729063818375); -INSERT INTO `ne_host` VALUES (29, 'ssh', '1', 'N3IWF_001_22', '172.16.5.230', 22, 'omcuser', '2', '', '', '', '', '', 'supervisor', 1729063407329, 'supervisor', 1729063818372); -INSERT INTO `ne_host` VALUES (30, 'telnet', '1', 'N3IWF_001_4100', '172.16.5.230', 4100, 'admin', '0', 'NUBonCin4GZgl7o12YjeClE8ToQmYp9KWdhMjSNxc2M=', '', '', '', '', 'supervisor', 1729063407333, 'supervisor', 1729063818375); SET FOREIGN_KEY_CHECKS=1; diff --git a/database/install/sys_dict_data2_i18n_en.sql b/database/install/sys_dict_data2_i18n_en.sql index b2400f35..35809baa 100644 --- a/database/install/sys_dict_data2_i18n_en.sql +++ b/database/install/sys_dict_data2_i18n_en.sql @@ -33,8 +33,8 @@ INSERT INTO `sys_dict_data` VALUES (3025, 3025, 'menu.security.onlineUser', 'Onl INSERT INTO `sys_dict_data` VALUES (3026, 3026, 'menu.system.job', 'Scheduling Tasks', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); INSERT INTO `sys_dict_data` VALUES (3027, 3027, 'menu.system.jobLog', 'Scheduling Logs', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); INSERT INTO `sys_dict_data` VALUES (3028, 3028, 'menu.tools.help', 'Help Documentation', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); -INSERT INTO `sys_dict_data` VALUES (3029, 3029, 'menu.log.operat', 'Operation logs', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); -INSERT INTO `sys_dict_data` VALUES (3030, 3030, 'menu.log.login', 'Security logs', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); +INSERT INTO `sys_dict_data` VALUES (3029, 3029, 'menu.log.operat', 'Operation Logs', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); +INSERT INTO `sys_dict_data` VALUES (3030, 3030, 'menu.log.login', 'Security Logs', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); INSERT INTO `sys_dict_data` VALUES (3031, 3031, 'menu.security.userRemark', 'User Management Menu', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); INSERT INTO `sys_dict_data` VALUES (3032, 3032, 'menu.security.roleRemark', 'Role Management Menu', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); INSERT INTO `sys_dict_data` VALUES (3033, 3033, 'menu.security.roleUserRemark', 'Assign Roles Embedded Hidden Menu', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); @@ -108,7 +108,7 @@ INSERT INTO `sys_dict_data` VALUES (3100, 3100, 'menu.fault.activemRemark', 'Act INSERT INTO `sys_dict_data` VALUES (3101, 3101, 'menu.logRemark', 'Log Management Catalog', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); INSERT INTO `sys_dict_data` VALUES (3102, 3102, 'menu.log.operatOldRemark', 'Operation log old layui menu', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); INSERT INTO `sys_dict_data` VALUES (3103, 3103, 'menu.log.mmlRemark', 'Operation MML Log', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); -INSERT INTO `sys_dict_data` VALUES (3104, 3104, 'menu.log.alarmRemark', 'Alarm Log Menu', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); +INSERT INTO `sys_dict_data` VALUES (3104, 3104, 'menu.log.alarmRemark', 'Alarm Logs Menu', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); INSERT INTO `sys_dict_data` VALUES (3105, 3105, 'menu.log.securityOldRemark', 'Security Log Old Layui Menu', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); INSERT INTO `sys_dict_data` VALUES (3106, 3106, 'menu.log.forwardingRemark', 'Alarm forward log menu', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); INSERT INTO `sys_dict_data` VALUES (3107, 3107, 'menu.log.setRemark', 'Log Settings menu', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); @@ -521,7 +521,7 @@ INSERT INTO `sys_dict_data` VALUES (4010, 4010, 'dictType.index_status', 'Home S INSERT INTO `sys_dict_data` VALUES (4011, 4011, 'dictType.index_status_remark', 'Network element status colors on the home page', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); INSERT INTO `sys_dict_data` VALUES (4012, 4012, 'dictType.index_status.normal', 'Normal', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); INSERT INTO `sys_dict_data` VALUES (4013, 4013, 'dictType.index_status.abnormal', 'Abnormal', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); -INSERT INTO `sys_dict_data` VALUES (4014, 4014, 'menu.log.neFile', 'NE Log File', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); +INSERT INTO `sys_dict_data` VALUES (4014, 4014, 'menu.log.neFile', 'NE Log Files', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); INSERT INTO `sys_dict_data` VALUES (4015, 4015, 'job.deleteExpiredNeStateRecord', 'Delete Expired NE State Record', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); INSERT INTO `sys_dict_data` VALUES (4016, 4016, 'job.deleteExpiredNeStateRecordRemark', 'Delete expired NE state records regularly and keep them for {duration} days by default.', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); INSERT INTO `sys_dict_data` VALUES (4017, 4017, 'job.getStateFromNE', 'Get state from NEs', 'i18n_en', '', '', '1', 'supervisor', 1700000000000, NULL, 0, ''); diff --git a/database/upgrade/upg_cb_message.sql b/database/upgrade/upg_cb_message.sql index a2ad5ba5..778f1815 100755 --- a/database/upgrade/upg_cb_message.sql +++ b/database/upgrade/upg_cb_message.sql @@ -11,7 +11,7 @@ Target Server Version : 100622 (10.6.22-MariaDB-0ubuntu0.22.04.1) File Encoding : 65001 - Date: 04/07/2025 16:00:38 + Date: 14/07/2025 17:49:03 */ SET NAMES utf8mb4; @@ -26,11 +26,15 @@ CREATE TABLE IF NOT EXISTS `cb_message` ( `ne_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `message_json` varchar(10240) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `status` enum('ACTIVE','INACTIVE') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'INACTIVE', + `detail` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, `created_at` bigint(20) NULL DEFAULT current_timestamp(), `updated_at` bigint(20) NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE, INDEX `id`(`id`) USING BTREE, INDEX `idx_ne_time`(`ne_type`, `ne_id`, `created_at`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'CDR事件_MF' ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 57 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'CDR事件_MF' ROW_FORMAT = Dynamic; + +ALTER TABLE `cb_message` +ADD COLUMN IF NOT EXISTS `detail` varchar(255) NULL AFTER `status`; SET FOREIGN_KEY_CHECKS = 1; diff --git a/database/upgrade/upg_ne_host.sql b/database/upgrade/upg_ne_host.sql new file mode 100644 index 00000000..95fd2345 --- /dev/null +++ b/database/upgrade/upg_ne_host.sql @@ -0,0 +1,34 @@ +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- +-- Table structure for table `ne_host` +-- + +CREATE TABLE IF NOT EXISTS `ne_host` ( + `host_id` bigint NOT NULL AUTO_INCREMENT COMMENT '主机主键', + `host_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '连接类型 ssh telnet redis', + `group_id` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '分组(0默认 1网元 2系统)', + `title` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '标题名称', + `addr` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '主机地址', + `port` int DEFAULT '22' COMMENT '端口 22 4100 6379', + `user` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '认证用户名', + `auth_mode` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '认证模式(0密码 1主机私钥 2已免密)', + `password` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '认证密码', + `private_key` varchar(6000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '认证私钥', + `pass_phrase` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '认证私钥密码', + `db_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '数据库名称', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '备注', + `create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '创建者', + `create_time` bigint DEFAULT '0' COMMENT '创建时间', + `update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '更新者', + `update_time` bigint DEFAULT '0' COMMENT '更新时间', + PRIMARY KEY (`host_id`) USING BTREE, + UNIQUE KEY `uk_type_group_title` (`host_type`,`group_id`,`title`) USING BTREE COMMENT '同组内名称唯一' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='网元主机表'; + +-- 初始数据对应网元 +INSERT IGNORE INTO `ne_host` VALUES (1, 'ssh', '1', 'OMC_001_22', '127.0.0.1', 22, 'omcuser', '2', '', '', '', '', '', 'supervisor', 1729063407329, 'supervisor', 1729063818372); +INSERT IGNORE INTO `ne_host` VALUES (2, 'telnet', '1', 'OMC_001_4100', '127.0.0.1', 4100, 'admin', '0', 'NUBonCin4GZgl7o12YjeClE8ToQmYp9KWdhMjSNxc2M=', '', '', '', '', 'supervisor', 1729063407333, 'supervisor', 1729063818375); + +SET FOREIGN_KEY_CHECKS=1; diff --git a/database/upgrade/upg_sys_dict_data_en.sql b/database/upgrade/upg_sys_dict_data_en.sql index 902310bd..6ca3231f 100644 --- a/database/upgrade/upg_sys_dict_data_en.sql +++ b/database/upgrade/upg_sys_dict_data_en.sql @@ -1,5 +1,12 @@ SET FOREIGN_KEY_CHECKS=0; +REPLACE INTO `sys_dict_data` VALUES (3029, 3029, 'menu.log.operat', 'Operation Logs', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); +REPLACE INTO `sys_dict_data` VALUES (3030, 3030, 'menu.log.login', 'Security Logs', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); +REPLACE INTO `sys_dict_data` VALUES (3092, 3092, 'menu.log.alarm', 'Alarm Logs', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); +REPLACE INTO `sys_dict_data` VALUES (3094, 3094, 'menu.log.forwarding', 'Alarm Forwarding Logs', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); +REPLACE INTO `sys_dict_data` VALUES (3104, 3104, 'menu.log.alarmRemark', 'Alarm Logs Menu', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); +REPLACE INTO `sys_dict_data` VALUES (4014, 4014, 'menu.log.neFile', 'NE Log Files', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); + -- PSAP Menu and Data Dictionary INSERT IGNORE INTO `sys_dict_data` VALUES (25000, 25000, 'menu.psap.agent', 'Agent', 'i18n_en', '', '', '1', 'supervisor', 1721902269805, '', 0, ''); INSERT IGNORE INTO `sys_dict_data` VALUES (25001, 25001, 'menu.psap.agent.callings', 'Calling Information', 'i18n_en', '', '', '1', 'supervisor', 1721902269805, '', 0, ''); diff --git a/database/upgrade/upg_sys_dict_data_zh.sql b/database/upgrade/upg_sys_dict_data_zh.sql index 2455bbf0..f8b53305 100644 --- a/database/upgrade/upg_sys_dict_data_zh.sql +++ b/database/upgrade/upg_sys_dict_data_zh.sql @@ -1,5 +1,12 @@ SET FOREIGN_KEY_CHECKS=0; +REPLACE INTO `sys_dict_data` VALUES (1029, 1029, 'menu.log.operat', '操作日志', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); +REPLACE INTO `sys_dict_data` VALUES (1030, 1030, 'menu.log.login', '安全日志', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); +REPLACE INTO `sys_dict_data` VALUES (1092, 1092, 'menu.log.alarm', '告警日志', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); +REPLACE INTO `sys_dict_data` VALUES (1094, 1094, 'menu.log.forwarding', '告警前转日志', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); +REPLACE INTO `sys_dict_data` VALUES (1104, 1104, 'menu.log.alarmRemark', '告警日志菜单', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); +REPLACE INTO `sys_dict_data` VALUES (2014, 2014, 'menu.log.neFile', '网元日志文件', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL); + -- psap 座席相关字典数据 INSERT IGNORE INTO `sys_dict_data` VALUES (20000, 20000, 'menu.psap.agent', '座席', 'i18n_zh', '', '', '1', 'supervisor', 1721902269805, '', 0, ''); INSERT IGNORE INTO `sys_dict_data` VALUES (20001, 20001, 'menu.psap.agent.callings', '并行话务', 'i18n_zh', '', '', '1', 'supervisor', 1721902269805, '', 0, ''); diff --git a/features/ue/api.go b/features/ue/api.go index a7e98844..973976c1 100644 --- a/features/ue/api.go +++ b/features/ue/api.go @@ -7,17 +7,38 @@ import ( "be.ems/features/ue/mf_callback_ticket" "be.ems/features/ue/mf_calling" "be.ems/lib/log" + "be.ems/src/framework/middleware" "github.com/gin-gonic/gin" ) +// Register registers the UE management routes +// @Description Register UE management routes +// @Tags UE Management +// @Router /api/ue/v1 [get] +func Register(r *gin.RouterGroup) { + log.Info("======init UE management group gin.Engine") + + cbGroup := r.Group("/:neType") + { + cbGroup.POST("/:cbsState", + middleware.PreAuthorize(nil), + PostCBSState, + ) + } +} + func InitSubServiceRoute(r *gin.Engine) { log.Info("======init UE management group gin.Engine") mfGroup := r.Group("/psap/v1/mf") cbeGroup := r.Group("/psap/v1/cbc") + cbsGroup := r.Group("/api/ue/v1") mf_calling.Register(mfGroup) mf_callback_ticket.Register(mfGroup) cb_message.Register(cbeGroup) + Register(cbsGroup) // register other sub modules routes + + log.Info("======init UE management group gin.Engine end") } diff --git a/features/ue/cb_message/controller.go b/features/ue/cb_message/controller.go index 2044709c..467c3bf6 100644 --- a/features/ue/cb_message/controller.go +++ b/features/ue/cb_message/controller.go @@ -86,6 +86,7 @@ func (m *CBMessage) List(c *gin.Context) { "neId": msg.NeId, "messageJson": messageJson, // 这里是解析后的 JSON 对象 "status": msg.Status.Enum(), + "detail": msg.Detail, "createdAt": msg.CreatedAt, "updatedAt": msg.UpdatedAt, } @@ -274,6 +275,7 @@ func (m *CBMessage) GetById(c *gin.Context) { "neId": data.NeId, "messageJson": messageJson, // 这里是解析后的 JSON 对象 "status": data.Status.Enum(), + "detail": data.Detail, "createdAt": data.CreatedAt, "updatedAt": data.UpdatedAt, } diff --git a/features/ue/cb_message/model.go b/features/ue/cb_message/model.go index 61ec73f8..abec3ef9 100644 --- a/features/ue/cb_message/model.go +++ b/features/ue/cb_message/model.go @@ -76,6 +76,7 @@ type CBMessage struct { NeId string `json:"neId" gorm:"column:ne_id"` // 网元ID MessageJson json.RawMessage `json:"messageJson" gorm:"column:message_json"` // 消息内容JSON Status CBEventStatus `json:"status" gorm:"column:status"` // 消息状态 + Detail string `json:"detail" gorm:"column:detail"` // 详情 CreatedAt int64 `json:"createdAt" gorm:"column:created_at"` // 创建时间 UpdatedAt *int64 `json:"updatedAt" gorm:"column:updated_at;autoUpdateTime:false"` // 更新时间 } diff --git a/features/ue/ue.go b/features/ue/ue.go index 7f940bb4..eb4810f5 100644 --- a/features/ue/ue.go +++ b/features/ue/ue.go @@ -18,6 +18,7 @@ import ( 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/gin-gonic/gin" "github.com/go-resty/resty/v2" "github.com/gorilla/mux" ) @@ -830,3 +831,61 @@ func GetUEInfoFileExportNF(w http.ResponseWriter, r *http.Request) { return } } + +var ( + // 走Gin + UriCBSStateG = "/api/ue/v1/:neType/:objectType" + // 走Mux + UriCBSState = config.DefaultUriPrefix + "/ueManagement/v1/elementType/{elementTypeValue}/objectType/cbsState" + CustomUriCBSState = config.UriPrefix + "/ueManagement/v1/elementType/{elementTypeValue}/objectType/cbsState" +) + +// @Description CBSManagement CB消息 +type CBSState struct { + NeName string `json:"neName"` // 网元名称 + RmUID string `json:"rmUID"` // 网元唯一标识 + EventData []struct { + EventName string `json:"eventName"` // 事件名称 + MessageId int64 `json:"messageId"` // 消息ID + Detail string `json:"detail"` // 详情 + } `json:"eventData"` // 事件数据 +} + +// PostCBSState 接收来自CBC的CBS状态信息 +// @Summary Post CBS State +// @Description 接收来自CBC的CBS状态信息 +func PostCBSState(c *gin.Context) { + PostCBSStateFromCBC(c.Writer, c.Request) +} + +// PostCBSStateFromCBC 接收来自CBC的CBS状态信息 +// @Summary Post CBS State from CBC +// @Description 接收来自CBC的CBS状态信息 +// @Tags UE Management +// @Accept json +// @Produce json +func PostCBSStateFromCBC(w http.ResponseWriter, r *http.Request) { + log.Info("PostStateFromCBC processing... ") + + var state CBSState + if err := ctx.ShouldBindJSON(r, &state); err != nil { + log.Error("Failed to Unmarshal CBSState:", err) + services.ResponseInternalServerError500ProcessError(w, err) + return + } + + now := time.Now().UnixMicro() + for _, eventData := range state.EventData { + if err := dborm.DefaultDB().Table("cb_message"). + Where("JSON_EXTRACT(message_json, '$.eventName') = ?", eventData.EventName). + Updates(map[string]any{ + "detail": eventData.Detail, + "updated_at": now, + }).Error; err != nil { + services.ResponseInternalServerError500ProcessError(w, err) + return + } + } + + services.ResponseStatusOK204NoContent(w) +} diff --git a/lib/routes/routes.go b/lib/routes/routes.go index 1a3d6081..52cfda9d 100644 --- a/lib/routes/routes.go +++ b/lib/routes/routes.go @@ -293,6 +293,9 @@ func init() { Register("POST", lm.ExtBackupDataUri, lm.ExtDatabaseBackupData, nil) Register("POST", lm.CustomExtBackupDataUri, lm.ExtDatabaseBackupData, nil) + // CBS management + Register("POST", ue.UriCBSState, ue.PostCBSStateFromCBC, nil) + Register("POST", ue.CustomUriCBSState, ue.PostCBSStateFromCBC, nil) } // To resolv rest POST/PUT/DELETE/PATCH cross domain