diff --git a/README.md b/README.md index 1071d39d..63afb06e 100644 --- a/README.md +++ b/README.md @@ -41,11 +41,11 @@ | 依赖 | 版本 | |-----------------------------|------------| | Spring Boot | 2.7.13 | -| Spring Cloud | 2021.0.7 | +| Spring Cloud | 2021.0.8 | | Spring Cloud Alibaba | 2021.0.5.0 | | Spring Authorization Server | 0.4.3 | | Mybatis Plus | 3.5.3.1 | -| hutool | 5.8.20 | +| hutool | 5.8.1 | ### 模块说明 @@ -60,6 +60,7 @@ pig ├── pig-common-datasource -- 动态数据源包 ├── pig-common-job -- xxl-job 封装 ├── pig-common-log -- 日志服务 + ├── pig-common-oss -- 文件上传工具类 ├── pig-common-mybatis -- mybatis 扩展封装 ├── pig-common-seata -- 分布式事务 ├── pig-common-security -- 安全工具类 @@ -74,8 +75,7 @@ pig └── pig-visual └── pig-monitor -- 服务监控 [5001] ├── pig-codegen -- 图形化代码生成 [5002] - ├── pig-sentinel-dashboard -- 流量高可用 [5003] - └── pig-xxl-job-admin -- 分布式定时任务管理台 [5004] + └── pig-quartz -- 定时任务管理台 [5007] ``` ### 本地开发 运行 diff --git a/db/pig.sql b/db/pig.sql index afa97a07..c42cd8e5 100644 --- a/db/pig.sql +++ b/db/pig.sql @@ -2,69 +2,47 @@ DROP DATABASE IF EXISTS `pig`; CREATE DATABASE `pig` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; -SET NAMES utf8; +SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; USE `pig`; -DROP TABLE IF EXISTS `sys_dept` ; --- 创建表 `sys_dept` + +-- ---------------------------- +-- Table structure for sys_dept +-- ---------------------------- +DROP TABLE IF EXISTS `sys_dept`; CREATE TABLE `sys_dept` ( - `dept_id` bigint NOT NULL COMMENT '部门ID', - `name` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '部门名称', - `sort_order` int NOT NULL DEFAULT '0' COMMENT '排序值', - `del_flag` char(1) COLLATE utf8mb4_bin DEFAULT '0' COMMENT '删除标记 -1:已删除 0:正常', - `parent_id` bigint DEFAULT NULL COMMENT '父部门ID', - `create_time` datetime DEFAULT NULL COMMENT '创建时间', - `create_by` varchar(64) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '创建人', - `update_time` datetime DEFAULT NULL COMMENT '修改时间', - `update_by` varchar(64) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '更新人', - PRIMARY KEY (`dept_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT='部门管理'; + `dept_id` bigint NOT NULL COMMENT '部门ID', + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '部门名称', + `sort_order` int NOT NULL DEFAULT '0' COMMENT '排序', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ' ' COMMENT '创建人', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ' ' COMMENT '修改人', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '修改时间', + `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标志', + `parent_id` bigint DEFAULT NULL COMMENT '父级部门ID', + PRIMARY KEY (`dept_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='部门管理'; -- ---------------------------- -- Records of sys_dept -- ---------------------------- BEGIN; -INSERT INTO `sys_dept` VALUES (1, '总经办', 0, '0', 0, '2020-03-13 13:13:16', ' ', '2020-03-13 13:14:31', ' '); -INSERT INTO `sys_dept` VALUES (2, '行政中心', 0, '0', 1, '2020-03-13 13:13:30', ' ', '2021-12-31 06:59:56', ' '); -INSERT INTO `sys_dept` VALUES (3, '技术中心', 0, '0', 1, '2020-03-13 13:14:55', ' ', '2021-12-31 06:59:56', ' '); -INSERT INTO `sys_dept` VALUES (4, '运营中心', 0, '0', 1, '2020-03-13 13:15:15', ' ', '2021-12-31 06:59:56', ' '); -INSERT INTO `sys_dept` VALUES (5, '研发中心', 0, '0', 3, '2020-03-13 13:15:34', ' ', '2021-12-31 06:59:56', ' '); -INSERT INTO `sys_dept` VALUES (6, '产品中心', 0, '0', 3, '2020-03-13 13:15:49', ' ', '2021-12-31 06:59:56', ' '); -INSERT INTO `sys_dept` VALUES (7, '测试中心', 0, '0', 3, '2020-03-13 13:16:02', ' ', '2021-12-31 06:59:56', ' '); -COMMIT; - -DROP TABLE IF EXISTS `sys_dept_relation`; --- 创建表 `sys_dept_relation` -CREATE TABLE `sys_dept_relation` ( - `ancestor` bigint NOT NULL COMMENT '祖先节点', - `descendant` bigint NOT NULL COMMENT '后代节点', - PRIMARY KEY (`ancestor`,`descendant`), - KEY `idx1` (`ancestor`), - KEY `idx2` (`descendant`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT='部门关系表'; - --- ---------------------------- --- Records of sys_dept_relation --- ---------------------------- -BEGIN; -INSERT INTO `sys_dept_relation` VALUES (1, 1); -INSERT INTO `sys_dept_relation` VALUES (1, 2); -INSERT INTO `sys_dept_relation` VALUES (1, 3); -INSERT INTO `sys_dept_relation` VALUES (1, 4); -INSERT INTO `sys_dept_relation` VALUES (1, 5); -INSERT INTO `sys_dept_relation` VALUES (1, 6); -INSERT INTO `sys_dept_relation` VALUES (1, 7); -INSERT INTO `sys_dept_relation` VALUES (2, 2); -INSERT INTO `sys_dept_relation` VALUES (3, 3); -INSERT INTO `sys_dept_relation` VALUES (3, 5); -INSERT INTO `sys_dept_relation` VALUES (3, 6); -INSERT INTO `sys_dept_relation` VALUES (3, 7); -INSERT INTO `sys_dept_relation` VALUES (4, 4); -INSERT INTO `sys_dept_relation` VALUES (5, 5); -INSERT INTO `sys_dept_relation` VALUES (6, 6); -INSERT INTO `sys_dept_relation` VALUES (7, 7); +INSERT INTO `sys_dept` VALUES (1, '总裁办', 1, 'admin', 'admin', '2023-04-03 13:04:47', '2023-04-03 13:07:49', '0', 0); +INSERT INTO `sys_dept` VALUES (2, '技术部', 2, 'admin', 'admin', '2023-04-03 13:04:47', '2023-04-03 13:04:47', '0', 1); +INSERT INTO `sys_dept` VALUES (3, '市场部', 3, 'admin', 'admin', '2023-04-03 13:04:47', '2023-04-03 13:04:47', '0', 1); +INSERT INTO `sys_dept` VALUES (4, '销售部', 4, 'admin', 'admin', '2023-04-03 13:04:47', '2023-04-03 13:04:47', '0', 1); +INSERT INTO `sys_dept` VALUES (5, '财务部', 5, 'admin', 'admin', '2023-04-03 13:04:47', '2023-04-03 13:04:47', '0', 1); +INSERT INTO `sys_dept` VALUES (6, '人事行政部', 6, 'admin', 'admin', '2023-04-03 13:04:47', '2023-04-03 13:53:36', '1', 1); +INSERT INTO `sys_dept` VALUES (7, '研发部', 7, 'admin', 'admin', '2023-04-03 13:04:47', '2023-04-03 13:04:47', '0', 2); +INSERT INTO `sys_dept` VALUES (8, 'UI设计部', 11, 'admin', 'admin', '2023-04-03 13:04:47', '2023-04-03 13:04:47', '0', 7); +INSERT INTO `sys_dept` VALUES (9, '产品部', 12, 'admin', 'admin', '2023-04-03 13:04:47', '2023-04-03 13:04:47', '0', 2); +INSERT INTO `sys_dept` VALUES (10, '渠道部', 13, 'admin', 'admin', '2023-04-03 13:04:47', '2023-04-03 13:04:47', '0', 3); +INSERT INTO `sys_dept` VALUES (11, '推广部', 14, 'admin', 'admin', '2023-04-03 13:04:47', '2023-04-03 13:04:47', '0', 3); +INSERT INTO `sys_dept` VALUES (12, '客服部', 15, 'admin', 'admin', '2023-04-03 13:04:47', '2023-04-03 13:04:47', '0', 4); +INSERT INTO `sys_dept` VALUES (13, '财务会计部', 16, 'admin', 'admin', '2023-04-03 13:04:47', '2023-04-03 13:04:47', '0', 5); +INSERT INTO `sys_dept` VALUES (14, '审计风控部', 17, 'admin', 'admin', '2023-04-03 13:04:47', '2023-04-03 14:06:57', '0', 5); COMMIT; -- ---------------------------- @@ -72,33 +50,51 @@ COMMIT; -- ---------------------------- DROP TABLE IF EXISTS `sys_dict`; CREATE TABLE `sys_dict` ( - `id` bigint NOT NULL, - `dict_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '标识', - `description` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '描述', - `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '备注', - `system_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '0' COMMENT '是否是系统内置', - `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '0' COMMENT '删除标记', - `create_time` datetime DEFAULT NULL COMMENT '创建时间', - `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '创建人', - `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '更新人', - `update_time` datetime DEFAULT NULL COMMENT '更新时间', - PRIMARY KEY (`id`) USING BTREE, - KEY `sys_dict_del_flag` (`del_flag`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='字典表'; + `id` bigint NOT NULL COMMENT '编号', + `dict_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '字典类型', + `description` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '描述', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ' ' COMMENT '创建人', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ' ' COMMENT '修改人', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `remarks` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注信息', + `system_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '系统标志', + `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标志', + PRIMARY KEY (`id`) USING BTREE, + KEY `sys_dict_del_flag` (`del_flag`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='字典表'; -- ---------------------------- -- Records of sys_dict -- ---------------------------- BEGIN; -INSERT INTO `sys_dict` VALUES (1, 'dict_type', '字典类型', NULL, '0', '0', '2019-05-16 14:16:20', '', 'admin', '2021-12-29 12:29:18'); -INSERT INTO `sys_dict` VALUES (2, 'log_type', '日志类型', NULL, '0', '0', '2020-03-13 14:21:01', '', 'admin', '2021-12-29 12:30:14'); -INSERT INTO `sys_dict` VALUES (3, 'ds_type', '驱动类型', NULL, '0', '0', '2021-10-15 16:24:35', '', 'admin', '2021-12-29 12:30:18'); -INSERT INTO `sys_dict` VALUES (4, 'param_type', '参数配置', '检索、原文、报表、安全、文档、消息、其他', '1', '0', '2022-03-25 20:51:26', 'admin', 'admin', '2022-03-25 20:51:26'); -INSERT INTO `sys_dict` VALUES (5, 'status_type', '租户状态', '租户状态', '1', '0', '2022-03-25 20:56:51', 'admin', 'admin', '2022-03-25 20:56:51'); -INSERT INTO `sys_dict` VALUES (6, 'menu_type_status', '菜单类型', NULL, '1', '0', '2022-09-18 17:12:05', 'admin', 'admin', '2022-09-18 17:12:05'); -INSERT INTO `sys_dict` VALUES (7, 'dict_css_type', '字典项展示样式', NULL, '1', '0', '2022-09-28 21:37:23', 'admin', 'admin', '2022-09-28 21:37:23'); -INSERT INTO `sys_dict` VALUES (8, 'keepalive_status', '菜单是否开启缓冲', NULL, '1', '0', '2022-09-28 21:46:12', 'admin', 'admin', '2022-09-28 21:46:12'); -INSERT INTO `sys_dict` VALUES (9, 'user_lock_flag', '用户锁定标记', NULL, '1', '0', '2022-09-28 21:51:39', 'admin', 'admin', '2022-09-28 21:51:39'); +INSERT INTO `sys_dict` VALUES (1, 'log_type', '日志类型', ' ', ' ', '2019-03-19 11:06:44', '2019-03-19 11:06:44', '异常、正常', '1', '0'); +INSERT INTO `sys_dict` VALUES (2, 'social_type', '社交登录', ' ', ' ', '2019-03-19 11:09:44', '2019-03-19 11:09:44', '微信、QQ', '1', '0'); +INSERT INTO `sys_dict` VALUES (3, 'job_type', '定时任务类型', ' ', ' ', '2019-03-19 11:22:21', '2019-03-19 11:22:21', 'quartz', '1', '0'); +INSERT INTO `sys_dict` VALUES (4, 'job_status', '定时任务状态', ' ', ' ', '2019-03-19 11:24:57', '2019-03-19 11:24:57', '发布状态、运行状态', '1', '0'); +INSERT INTO `sys_dict` VALUES (5, 'job_execute_status', '定时任务执行状态', ' ', ' ', '2019-03-19 11:26:15', '2019-03-19 11:26:15', '正常、异常', '1', '0'); +INSERT INTO `sys_dict` VALUES (6, 'misfire_policy', '定时任务错失执行策略', ' ', ' ', '2019-03-19 11:27:19', '2019-03-19 11:27:19', '周期', '1', '0'); +INSERT INTO `sys_dict` VALUES (7, 'gender', '性别', ' ', ' ', '2019-03-27 13:44:06', '2019-03-27 13:44:06', '微信用户性别', '1', '0'); +INSERT INTO `sys_dict` VALUES (8, 'subscribe', '订阅状态', ' ', ' ', '2019-03-27 13:48:33', '2019-03-27 13:48:33', '公众号订阅状态', '1', '0'); +INSERT INTO `sys_dict` VALUES (9, 'response_type', '回复', ' ', ' ', '2019-03-28 21:29:21', '2019-03-28 21:29:21', '微信消息是否已回复', '1', '0'); +INSERT INTO `sys_dict` VALUES (10, 'param_type', '参数配置', ' ', ' ', '2019-04-29 18:20:47', '2019-04-29 18:20:47', '检索、原文、报表、安全、文档、消息、其他', '1', '0'); +INSERT INTO `sys_dict` VALUES (11, 'status_type', '租户状态', ' ', ' ', '2019-05-15 16:31:08', '2019-05-15 16:31:08', '租户状态', '1', '0'); +INSERT INTO `sys_dict` VALUES (12, 'dict_type', '字典类型', ' ', ' ', '2019-05-16 14:16:20', '2019-05-16 14:20:16', '系统类不能修改', '1', '0'); +INSERT INTO `sys_dict` VALUES (13, 'channel_type', '支付类型', ' ', ' ', '2019-05-16 14:16:20', '2019-05-16 14:20:16', '系统类不能修改', '1', '0'); +INSERT INTO `sys_dict` VALUES (14, 'grant_types', '授权类型', ' ', ' ', '2019-08-13 07:34:10', '2019-08-13 07:34:10', NULL, '1', '0'); +INSERT INTO `sys_dict` VALUES (15, 'style_type', '前端风格', ' ', ' ', '2020-02-07 03:49:28', '2020-02-07 03:50:40', '0-Avue 1-element', '1', '0'); +INSERT INTO `sys_dict` VALUES (16, 'captcha_flag_types', '验证码开关', ' ', ' ', '2020-11-18 06:53:25', '2020-11-18 06:53:25', '是否校验验证码', '1', '0'); +INSERT INTO `sys_dict` VALUES (17, 'enc_flag_types', '前端密码加密', ' ', ' ', '2020-11-18 06:54:44', '2020-11-18 06:54:44', '前端密码是否加密传输', '1', '0'); +INSERT INTO `sys_dict` VALUES (18, 'lock_flag', '用户状态', 'admin', ' ', '2023-02-01 16:55:31', NULL, NULL, '1', '0'); +INSERT INTO `sys_dict` VALUES (19, 'ds_config_type', '数据连接类型', 'admin', ' ', '2023-02-06 18:36:59', NULL, NULL, '1', '0'); +INSERT INTO `sys_dict` VALUES (20, 'common_status', '通用状态', 'admin', ' ', '2023-02-09 11:02:08', NULL, NULL, '1', '0'); +INSERT INTO `sys_dict` VALUES (21, 'app_social_type', 'app社交登录', 'admin', ' ', '2023-02-10 11:11:06', NULL, 'app社交登录', '1', '0'); +INSERT INTO `sys_dict` VALUES (22, 'yes_no_type', '是否', 'admin', ' ', '2023-02-20 23:25:04', NULL, NULL, '1', '0'); +INSERT INTO `sys_dict` VALUES (23, 'repType', '微信消息类型', 'admin', ' ', '2023-02-24 15:08:25', NULL, NULL, '0', '0'); +INSERT INTO `sys_dict` VALUES (24, 'leave_status', '请假状态', 'admin', ' ', '2023-03-02 22:50:15', NULL, NULL, '0', '0'); +INSERT INTO `sys_dict` VALUES (25, 'schedule_type', '日程类型', 'admin', ' ', '2023-03-06 14:49:18', NULL, NULL, '0', '0'); +INSERT INTO `sys_dict` VALUES (26, 'schedule_status', '日程状态', 'admin', ' ', '2023-03-06 14:52:57', NULL, NULL, '0', '0'); +INSERT INTO `sys_dict` VALUES (27, 'ds_type', '代码生成器支持的数据库类型', 'admin', ' ', '2023-03-12 09:57:59', NULL, NULL, '1', '0'); COMMIT; -- ---------------------------- @@ -106,113 +102,134 @@ COMMIT; -- ---------------------------- DROP TABLE IF EXISTS `sys_dict_item`; CREATE TABLE `sys_dict_item` ( - `id` bigint NOT NULL, - `dict_id` bigint NOT NULL COMMENT '字典ID', - `dict_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '字典标识', - `value` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '值', - `label` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '标签', - `type` varchar(100) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '字典类型', - `description` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '描述', - `sort_order` int NOT NULL DEFAULT '0' COMMENT '排序(升序)', - `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT ' ' COMMENT '备注', - `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '0' COMMENT '删除标记', - `create_time` datetime DEFAULT NULL COMMENT '创建时间', - `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '创建人', - `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '修改人', - `update_time` datetime DEFAULT NULL COMMENT '更新时间', - PRIMARY KEY (`id`) USING BTREE, - KEY `sys_dict_value` (`value`) USING BTREE, - KEY `sys_dict_label` (`label`) USING BTREE, - KEY `sys_dict_del_flag` (`del_flag`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='字典项'; + `id` bigint NOT NULL COMMENT '编号', + `dict_id` bigint NOT NULL COMMENT '字典ID', + `item_value` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '字典项值', + `label` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '字典项名称', + `dict_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '字典类型', + `description` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '字典项描述', + `sort_order` int NOT NULL DEFAULT '0' COMMENT '排序(升序)', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ' ' COMMENT '创建人', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ' ' COMMENT '修改人', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `remarks` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注信息', + `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标志', + PRIMARY KEY (`id`) USING BTREE, + KEY `sys_dict_value` (`item_value`) USING BTREE, + KEY `sys_dict_label` (`label`) USING BTREE, + KEY `sys_dict_item_del_flag` (`del_flag`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='字典项'; -- ---------------------------- -- Records of sys_dict_item -- ---------------------------- BEGIN; -INSERT INTO `sys_dict_item` VALUES (1, 1, 'dict_type', '1', '系统类', NULL, '系统类字典', 0, ' ', '0', '2019-05-16 14:20:40', NULL, NULL, '2019-05-16 14:20:40'); -INSERT INTO `sys_dict_item` VALUES (2, 1, 'dict_type', '0', '业务类', NULL, '业务类字典', 0, ' ', '0', '2019-05-16 14:20:59', NULL, NULL, '2019-05-16 14:20:59'); -INSERT INTO `sys_dict_item` VALUES (3, 2, 'log_type', '0', '正常', NULL, '正常', 0, ' ', '0', '2020-03-13 14:23:22', NULL, NULL, '2020-03-13 14:23:22'); -INSERT INTO `sys_dict_item` VALUES (4, 2, 'log_type', '9', '异常', NULL, '异常', 0, ' ', '0', '2020-03-13 14:23:35', NULL, NULL, '2020-03-13 14:23:35'); -INSERT INTO `sys_dict_item` VALUES (5, 3, 'ds_type', 'com.mysql.cj.jdbc.Driver', 'MYSQL8', NULL, 'MYSQL8', 0, ' ', '0', NULL, NULL, NULL, NULL); -INSERT INTO `sys_dict_item` VALUES (6, 3, 'ds_type', 'com.mysql.jdbc.Driver', 'MYSQL5', NULL, 'MYSQL5', 0, ' ', '0', NULL, NULL, NULL, NULL); -INSERT INTO `sys_dict_item` VALUES (7, 3, 'ds_type', 'oracle.jdbc.OracleDriver', 'Oracle', NULL, 'Oracle', 0, ' ', '0', NULL, NULL, NULL, NULL); -INSERT INTO `sys_dict_item` VALUES (8, 3, 'ds_type', 'org.mariadb.jdbc.Driver', 'mariadb', NULL, 'mariadb', 0, ' ', '0', NULL, NULL, NULL, NULL); -INSERT INTO `sys_dict_item` VALUES (9, 3, 'ds_type', 'com.microsoft.sqlserver.jdbc.SQLServerDriver', 'sqlserver2005+', NULL, 'sqlserver2005+', 0, ' ', '0', NULL, NULL, NULL, NULL); -INSERT INTO `sys_dict_item` VALUES (10, 3, 'ds_type', 'com.microsoft.jdbc.sqlserver.SQLServerDriver', 'sqlserver2000', NULL, 'sqlserver2000', 0, ' ', '0', NULL, NULL, NULL, NULL); -INSERT INTO `sys_dict_item` VALUES (11, 3, 'ds_type', 'com.ibm.db2.jcc.DB2Driver', 'db2', NULL, 'db2', 0, ' ', '0', NULL, NULL, NULL, NULL); -INSERT INTO `sys_dict_item` VALUES (12, 3, 'ds_type', 'org.postgresql.Driver', 'postgresql', NULL, 'postgresql', 0, ' ', '0', NULL, NULL, NULL, NULL); -INSERT INTO `sys_dict_item` VALUES (13, 4, 'param_type', '1', '检索', NULL, '检索', 0, '检索', '0', '2022-03-25 20:51:51', 'admin', 'admin', '2022-03-25 20:51:51'); -INSERT INTO `sys_dict_item` VALUES (14, 4, 'param_type', '2', '原文', NULL, '原文', 1, '原文', '0', '2022-03-25 20:52:06', 'admin', 'admin', '2022-03-25 20:52:06'); -INSERT INTO `sys_dict_item` VALUES (15, 4, 'param_type', '3', '报表', NULL, '报表', 2, '报表', '0', '2022-03-25 20:52:16', 'admin', 'admin', '2022-03-25 20:52:16'); -INSERT INTO `sys_dict_item` VALUES (16, 4, 'param_type', '4', '安全', NULL, '安全', 3, '安全', '0', '2022-03-25 20:52:32', 'admin', 'admin', '2022-03-25 20:52:32'); -INSERT INTO `sys_dict_item` VALUES (17, 4, 'param_type', '5', '文档', NULL, '文档', 4, '文档', '0', '2022-03-25 20:52:52', 'admin', 'admin', '2022-03-25 20:52:52'); -INSERT INTO `sys_dict_item` VALUES (18, 4, 'param_type', '6', '消息', NULL, '消息', 5, '消息', '0', '2022-03-25 20:53:07', 'admin', 'admin', '2022-03-25 20:53:07'); -INSERT INTO `sys_dict_item` VALUES (19, 4, 'param_type', '9', '其他', NULL, '其他', 6, '其他', '0', '2022-03-25 20:54:50', 'admin', 'admin', '2022-03-25 20:54:50'); -INSERT INTO `sys_dict_item` VALUES (20, 4, 'param_type', '0', '默认', NULL, '默认', 7, '默认', '0', '2022-03-25 20:55:23', 'admin', 'admin', '2022-03-25 20:55:23'); -INSERT INTO `sys_dict_item` VALUES (21, 5, 'status_type', '0', '正常', NULL, '状态正常', 0, '状态正常', '0', '2022-03-25 20:57:12', 'admin', 'admin', '2022-03-25 20:57:12'); -INSERT INTO `sys_dict_item` VALUES (22, 5, 'status_type', '9', '冻结', NULL, '状态冻结', 1, '状态冻结', '0', '2022-03-25 20:57:34', 'admin', 'admin', '2022-03-25 20:57:34'); -INSERT INTO `sys_dict_item` VALUES (23, 6, 'menu_type_status', '0', '菜单', NULL, '菜单', 0, ' ', '0', '2022-09-18 17:15:52', 'admin', 'admin', '2022-09-18 17:15:52'); -INSERT INTO `sys_dict_item` VALUES (24, 6, 'menu_type_status', '1', '按钮', 'success', '按钮', 1, ' ', '0', '2022-09-18 17:16:06', 'admin', 'admin', '2022-09-18 17:16:06'); -INSERT INTO `sys_dict_item` VALUES (25, 7, 'dict_css_type', 'success', 'success', 'success', 'success', 2, ' ', '0', '2022-09-28 21:41:49', 'admin', 'admin', '2022-09-28 21:41:49'); -INSERT INTO `sys_dict_item` VALUES (26, 7, 'dict_css_type', 'info', 'info', 'info', 'info', 3, ' ', '0', '2022-09-28 21:41:59', 'admin', 'admin', '2022-09-28 21:41:59'); -INSERT INTO `sys_dict_item` VALUES (27, 7, 'dict_css_type', 'warning', 'warning', 'warning', 'warning', 4, ' ', '0', '2022-09-28 21:42:09', 'admin', 'admin', '2022-09-28 21:42:09'); -INSERT INTO `sys_dict_item` VALUES (28, 7, 'dict_css_type', 'danger', 'danger', 'danger', 'danger', 5, ' ', '0', '2022-09-28 21:42:19', 'admin', 'admin', '2022-09-28 21:42:19'); -INSERT INTO `sys_dict_item` VALUES (29, 8, 'keepalive_status', '0', '否', 'info', '不开启缓冲', 0, ' ', '0', '2022-09-28 21:46:32', 'admin', 'admin', '2022-09-28 21:46:32'); -INSERT INTO `sys_dict_item` VALUES (30, 8, 'keepalive_status', '1', '是', NULL, '开启缓冲', 1, ' ', '0', '2022-09-28 21:46:54', 'admin', 'admin', '2022-09-28 21:46:54'); -INSERT INTO `sys_dict_item` VALUES (31, 9, 'user_lock_flag', '0', '正常', NULL, '正常状态', 0, ' ', '0', '2022-09-28 21:51:55', 'admin', 'admin', '2022-09-28 21:51:55'); -INSERT INTO `sys_dict_item` VALUES (32, 9, 'user_lock_flag', '9', '锁定', 'info', '已锁定', 9, ' ', '0', '2022-09-28 21:52:13', 'admin', 'admin', '2022-09-28 21:52:13'); +INSERT INTO `sys_dict_item` VALUES (1, 1, '9', '异常', 'log_type', '日志异常', 1, ' ', ' ', '2019-03-19 11:08:59', '2019-03-25 12:49:13', '', '0'); +INSERT INTO `sys_dict_item` VALUES (2, 1, '0', '正常', 'log_type', '日志正常', 0, ' ', ' ', '2019-03-19 11:09:17', '2019-03-25 12:49:18', '', '0'); +INSERT INTO `sys_dict_item` VALUES (3, 2, 'WX', '微信', 'social_type', '微信登录', 0, ' ', ' ', '2019-03-19 11:10:02', '2019-03-25 12:49:36', '', '0'); +INSERT INTO `sys_dict_item` VALUES (4, 2, 'QQ', 'QQ', 'social_type', 'QQ登录', 1, ' ', ' ', '2019-03-19 11:10:14', '2019-03-25 12:49:36', '', '0'); +INSERT INTO `sys_dict_item` VALUES (5, 3, '1', 'java类', 'job_type', 'java类', 1, ' ', ' ', '2019-03-19 11:22:37', '2019-03-25 12:49:36', '', '0'); +INSERT INTO `sys_dict_item` VALUES (6, 3, '2', 'spring bean', 'job_type', 'spring bean容器实例', 2, ' ', ' ', '2019-03-19 11:23:05', '2019-03-25 12:49:36', '', '0'); +INSERT INTO `sys_dict_item` VALUES (7, 3, '9', '其他', 'job_type', '其他类型', 9, ' ', ' ', '2019-03-19 11:23:31', '2019-03-25 12:49:36', '', '0'); +INSERT INTO `sys_dict_item` VALUES (8, 3, '3', 'Rest 调用', 'job_type', 'Rest 调用', 3, ' ', ' ', '2019-03-19 11:23:57', '2019-03-25 12:49:36', '', '0'); +INSERT INTO `sys_dict_item` VALUES (9, 3, '4', 'jar', 'job_type', 'jar类型', 4, ' ', ' ', '2019-03-19 11:24:20', '2019-03-25 12:49:36', '', '0'); +INSERT INTO `sys_dict_item` VALUES (10, 4, '1', '未发布', 'job_status', '未发布', 1, ' ', ' ', '2019-03-19 11:25:18', '2019-03-25 12:49:36', '', '0'); +INSERT INTO `sys_dict_item` VALUES (11, 4, '2', '运行中', 'job_status', '运行中', 2, ' ', ' ', '2019-03-19 11:25:31', '2019-03-25 12:49:36', '', '0'); +INSERT INTO `sys_dict_item` VALUES (12, 4, '3', '暂停', 'job_status', '暂停', 3, ' ', ' ', '2019-03-19 11:25:42', '2019-03-25 12:49:36', '', '0'); +INSERT INTO `sys_dict_item` VALUES (13, 5, '0', '正常', 'job_execute_status', '正常', 0, ' ', ' ', '2019-03-19 11:26:27', '2019-03-25 12:49:36', '', '0'); +INSERT INTO `sys_dict_item` VALUES (14, 5, '1', '异常', 'job_execute_status', '异常', 1, ' ', ' ', '2019-03-19 11:26:41', '2019-03-25 12:49:36', '', '0'); +INSERT INTO `sys_dict_item` VALUES (15, 6, '1', '错失周期立即执行', 'misfire_policy', '错失周期立即执行', 1, ' ', ' ', '2019-03-19 11:27:45', '2019-03-25 12:49:36', '', '0'); +INSERT INTO `sys_dict_item` VALUES (16, 6, '2', '错失周期执行一次', 'misfire_policy', '错失周期执行一次', 2, ' ', ' ', '2019-03-19 11:27:57', '2019-03-25 12:49:36', '', '0'); +INSERT INTO `sys_dict_item` VALUES (17, 6, '3', '下周期执行', 'misfire_policy', '下周期执行', 3, ' ', ' ', '2019-03-19 11:28:08', '2019-03-25 12:49:36', '', '0'); +INSERT INTO `sys_dict_item` VALUES (18, 7, '1', '男', 'gender', '微信-男', 0, ' ', ' ', '2019-03-27 13:45:13', '2019-03-27 13:45:13', '微信-男', '0'); +INSERT INTO `sys_dict_item` VALUES (19, 7, '2', '女', 'gender', '女-微信', 1, ' ', ' ', '2019-03-27 13:45:34', '2019-03-27 13:45:34', '女-微信', '0'); +INSERT INTO `sys_dict_item` VALUES (20, 7, '0', '未知', 'gender', 'x性别未知', 3, ' ', ' ', '2019-03-27 13:45:57', '2019-03-27 13:45:57', 'x性别未知', '0'); +INSERT INTO `sys_dict_item` VALUES (21, 8, '0', '未关注', 'subscribe', '公众号-未关注', 0, ' ', ' ', '2019-03-27 13:49:07', '2019-03-27 13:49:07', '公众号-未关注', '0'); +INSERT INTO `sys_dict_item` VALUES (22, 8, '1', '已关注', 'subscribe', '公众号-已关注', 1, ' ', ' ', '2019-03-27 13:49:26', '2019-03-27 13:49:26', '公众号-已关注', '0'); +INSERT INTO `sys_dict_item` VALUES (23, 9, '0', '未回复', 'response_type', '微信消息-未回复', 0, ' ', ' ', '2019-03-28 21:29:47', '2019-03-28 21:29:47', '微信消息-未回复', '0'); +INSERT INTO `sys_dict_item` VALUES (24, 9, '1', '已回复', 'response_type', '微信消息-已回复', 1, ' ', ' ', '2019-03-28 21:30:08', '2019-03-28 21:30:08', '微信消息-已回复', '0'); +INSERT INTO `sys_dict_item` VALUES (25, 10, '1', '检索', 'param_type', '检索', 0, ' ', ' ', '2019-04-29 18:22:17', '2019-04-29 18:22:17', '检索', '0'); +INSERT INTO `sys_dict_item` VALUES (26, 10, '2', '原文', 'param_type', '原文', 0, ' ', ' ', '2019-04-29 18:22:27', '2019-04-29 18:22:27', '原文', '0'); +INSERT INTO `sys_dict_item` VALUES (27, 10, '3', '报表', 'param_type', '报表', 0, ' ', ' ', '2019-04-29 18:22:36', '2019-04-29 18:22:36', '报表', '0'); +INSERT INTO `sys_dict_item` VALUES (28, 10, '4', '安全', 'param_type', '安全', 0, ' ', ' ', '2019-04-29 18:22:46', '2019-04-29 18:22:46', '安全', '0'); +INSERT INTO `sys_dict_item` VALUES (29, 10, '5', '文档', 'param_type', '文档', 0, ' ', ' ', '2019-04-29 18:22:56', '2019-04-29 18:22:56', '文档', '0'); +INSERT INTO `sys_dict_item` VALUES (30, 10, '6', '消息', 'param_type', '消息', 0, ' ', ' ', '2019-04-29 18:23:05', '2019-04-29 18:23:05', '消息', '0'); +INSERT INTO `sys_dict_item` VALUES (31, 10, '9', '其他', 'param_type', '其他', 0, ' ', ' ', '2019-04-29 18:23:16', '2019-04-29 18:23:16', '其他', '0'); +INSERT INTO `sys_dict_item` VALUES (32, 10, '0', '默认', 'param_type', '默认', 0, ' ', ' ', '2019-04-29 18:23:30', '2019-04-29 18:23:30', '默认', '0'); +INSERT INTO `sys_dict_item` VALUES (33, 11, '0', '正常', 'status_type', '状态正常', 0, ' ', ' ', '2019-05-15 16:31:34', '2019-05-16 22:30:46', '状态正常', '0'); +INSERT INTO `sys_dict_item` VALUES (34, 11, '9', '冻结', 'status_type', '状态冻结', 1, ' ', ' ', '2019-05-15 16:31:56', '2019-05-16 22:30:50', '状态冻结', '0'); +INSERT INTO `sys_dict_item` VALUES (35, 12, '1', '系统类', 'dict_type', '系统类字典', 0, ' ', ' ', '2019-05-16 14:20:40', '2019-05-16 14:20:40', '不能修改删除', '0'); +INSERT INTO `sys_dict_item` VALUES (36, 12, '0', '业务类', 'dict_type', '业务类字典', 0, ' ', ' ', '2019-05-16 14:20:59', '2019-05-16 14:20:59', '可以修改', '0'); +INSERT INTO `sys_dict_item` VALUES (37, 2, 'GITEE', '码云', 'social_type', '码云', 2, ' ', ' ', '2019-06-28 09:59:12', '2019-06-28 09:59:12', '码云', '0'); +INSERT INTO `sys_dict_item` VALUES (38, 2, 'OSC', '开源中国', 'social_type', '开源中国登录', 2, ' ', ' ', '2019-06-28 10:04:32', '2019-06-28 10:04:32', '', '0'); +INSERT INTO `sys_dict_item` VALUES (39, 14, 'password', '密码模式', 'grant_types', '支持oauth密码模式', 0, ' ', ' ', '2019-08-13 07:35:28', '2019-08-13 07:35:28', NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (40, 14, 'authorization_code', '授权码模式', 'grant_types', 'oauth2 授权码模式', 1, ' ', ' ', '2019-08-13 07:36:07', '2019-08-13 07:36:07', NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (41, 14, 'client_credentials', '客户端模式', 'grant_types', 'oauth2 客户端模式', 2, ' ', ' ', '2019-08-13 07:36:30', '2019-08-13 07:36:30', NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (42, 14, 'refresh_token', '刷新模式', 'grant_types', 'oauth2 刷新token', 3, ' ', ' ', '2019-08-13 07:36:54', '2019-08-13 07:36:54', NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (43, 14, 'implicit', '简化模式', 'grant_types', 'oauth2 简化模式', 4, ' ', ' ', '2019-08-13 07:39:32', '2019-08-13 07:39:32', NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (44, 15, '0', 'Avue', 'style_type', 'Avue风格', 0, ' ', ' ', '2020-02-07 03:52:52', '2020-02-07 03:52:52', '', '0'); +INSERT INTO `sys_dict_item` VALUES (45, 15, '1', 'element', 'style_type', 'element-ui', 1, ' ', ' ', '2020-02-07 03:53:12', '2020-02-07 03:53:12', '', '0'); +INSERT INTO `sys_dict_item` VALUES (46, 16, '0', '关', 'captcha_flag_types', '不校验验证码', 0, ' ', ' ', '2020-11-18 06:53:58', '2020-11-18 06:53:58', '不校验验证码 -0', '0'); +INSERT INTO `sys_dict_item` VALUES (47, 16, '1', '开', 'captcha_flag_types', '校验验证码', 1, ' ', ' ', '2020-11-18 06:54:15', '2020-11-18 06:54:15', '不校验验证码-1', '0'); +INSERT INTO `sys_dict_item` VALUES (48, 17, '0', '否', 'enc_flag_types', '不加密', 0, ' ', ' ', '2020-11-18 06:55:31', '2020-11-18 06:55:31', '不加密-0', '0'); +INSERT INTO `sys_dict_item` VALUES (49, 17, '1', '是', 'enc_flag_types', '加密', 1, ' ', ' ', '2020-11-18 06:55:51', '2020-11-18 06:55:51', '加密-1', '0'); +INSERT INTO `sys_dict_item` VALUES (50, 13, 'MERGE_PAY', '聚合支付', 'channel_type', '聚合支付', 1, ' ', ' ', '2019-05-30 19:08:08', '2019-06-18 13:51:53', '聚合支付', '0'); +INSERT INTO `sys_dict_item` VALUES (51, 2, 'CAS', 'CAS登录', 'social_type', 'CAS 单点登录系统', 3, ' ', ' ', '2022-02-18 13:56:25', '2022-02-18 13:56:28', NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (52, 2, 'DINGTALK', '钉钉', 'social_type', '钉钉', 3, ' ', ' ', '2022-02-18 13:56:25', '2022-02-18 13:56:28', NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (53, 2, 'WEIXIN_CP', '企业微信', 'social_type', '企业微信', 3, ' ', ' ', '2022-02-18 13:56:25', '2022-02-18 13:56:28', NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (54, 15, '2', 'APP', 'style_type', 'uview风格', 1, ' ', ' ', '2020-02-07 03:53:12', '2020-02-07 03:53:12', '', '0'); +INSERT INTO `sys_dict_item` VALUES (55, 13, 'ALIPAY_WAP', '支付宝支付', 'channel_type', '支付宝支付', 1, ' ', ' ', '2019-05-30 19:08:08', '2019-06-18 13:51:53', '聚合支付', '0'); +INSERT INTO `sys_dict_item` VALUES (56, 13, 'WEIXIN_MP', '微信支付', 'channel_type', '微信支付', 1, ' ', ' ', '2019-05-30 19:08:08', '2019-06-18 13:51:53', '聚合支付', '0'); +INSERT INTO `sys_dict_item` VALUES (57, 14, 'mobile', 'mobile', 'grant_types', '移动端登录', 5, 'admin', ' ', '2023-01-29 17:21:42', NULL, NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (58, 18, '0', '有效', 'lock_flag', '有效', 0, 'admin', ' ', '2023-02-01 16:56:00', NULL, NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (59, 18, '9', '禁用', 'lock_flag', '禁用', 1, 'admin', ' ', '2023-02-01 16:56:09', NULL, NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (60, 15, '4', 'vue3', 'style_type', 'element-plus', 4, 'admin', ' ', '2023-02-06 13:52:43', NULL, NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (61, 19, '0', '主机', 'ds_config_type', '主机', 0, 'admin', ' ', '2023-02-06 18:37:23', NULL, NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (62, 19, '1', 'JDBC', 'ds_config_type', 'jdbc', 2, 'admin', ' ', '2023-02-06 18:37:34', NULL, NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (63, 20, 'false', '否', 'common_status', '否', 1, 'admin', ' ', '2023-02-09 11:02:39', NULL, NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (64, 20, 'true', '是', 'common_status', '是', 2, 'admin', ' ', '2023-02-09 11:02:52', NULL, NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (65, 21, 'MINI', '小程序', 'app_social_type', '小程序登录', 0, 'admin', ' ', '2023-02-10 11:11:41', NULL, NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (66, 22, '0', '否', 'yes_no_type', '0', 0, 'admin', ' ', '2023-02-20 23:35:23', NULL, '0', '0'); +INSERT INTO `sys_dict_item` VALUES (67, 22, '1', '是', 'yes_no_type', '1', 0, 'admin', ' ', '2023-02-20 23:35:37', NULL, '1', '0'); +INSERT INTO `sys_dict_item` VALUES (69, 23, 'text', '文本', 'repType', '文本', 0, 'admin', ' ', '2023-02-24 15:08:45', NULL, NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (70, 23, 'image', '图片', 'repType', '图片', 0, 'admin', ' ', '2023-02-24 15:08:56', NULL, NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (71, 23, 'voice', '语音', 'repType', '语音', 0, 'admin', ' ', '2023-02-24 15:09:08', NULL, NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (72, 23, 'video', '视频', 'repType', '视频', 0, 'admin', ' ', '2023-02-24 15:09:18', NULL, NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (73, 23, 'shortvideo', '小视频', 'repType', '小视频', 0, 'admin', ' ', '2023-02-24 15:09:29', NULL, NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (74, 23, 'location', '地理位置', 'repType', '地理位置', 0, 'admin', ' ', '2023-02-24 15:09:41', NULL, NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (75, 23, 'link', '链接消息', 'repType', '链接消息', 0, 'admin', ' ', '2023-02-24 15:09:49', NULL, NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (76, 23, 'event', '事件推送', 'repType', '事件推送', 0, 'admin', ' ', '2023-02-24 15:09:57', NULL, NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (77, 24, '0', '未提交', 'leave_status', '未提交', 0, 'admin', ' ', '2023-03-02 22:50:45', NULL, '未提交', '0'); +INSERT INTO `sys_dict_item` VALUES (78, 24, '1', '审批中', 'leave_status', '审批中', 0, 'admin', ' ', '2023-03-02 22:50:57', NULL, '审批中', '0'); +INSERT INTO `sys_dict_item` VALUES (79, 24, '2', '完成', 'leave_status', '完成', 0, 'admin', ' ', '2023-03-02 22:51:06', NULL, '完成', '0'); +INSERT INTO `sys_dict_item` VALUES (80, 24, '9', '驳回', 'leave_status', '驳回', 0, 'admin', ' ', '2023-03-02 22:51:20', NULL, NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (81, 25, 'record', '日程记录', 'schedule_type', '日程记录', 0, 'admin', ' ', '2023-03-06 14:50:01', NULL, NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (82, 25, 'plan', '计划', 'schedule_type', '计划类型', 0, 'admin', ' ', '2023-03-06 14:50:29', NULL, NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (83, 26, '0', '计划中', 'schedule_status', '日程状态', 0, 'admin', ' ', '2023-03-06 14:53:18', NULL, NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (84, 26, '1', '已开始', 'schedule_status', '已开始', 0, 'admin', ' ', '2023-03-06 14:53:33', NULL, NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (85, 26, '3', '已结束', 'schedule_status', '已结束', 0, 'admin', ' ', '2023-03-06 14:53:41', NULL, NULL, '0'); +INSERT INTO `sys_dict_item` VALUES (86, 27, 'mysql', 'mysql', 'ds_type', 'mysql', 0, 'admin', ' ', '2023-03-12 09:58:11', NULL, NULL, '0'); COMMIT; - --- ---------------------------- --- Table structure for sys_public_param --- ---------------------------- -DROP TABLE IF EXISTS `sys_public_param`; --- 创建表 `sys_public_param` -CREATE TABLE `sys_public_param` ( - `public_id` bigint(0) NOT NULL COMMENT '编号', - `public_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '参数名称', - `public_key` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '参数键名', - `public_value` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '参数键值', - `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '0' COMMENT '状态,1-启用,0-禁用', - `validate_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '校验码', - `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT ' ' COMMENT '创建人', - `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT ' ' COMMENT '修改人', - `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', - `update_time` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间', - `public_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '0' COMMENT '参数类型,1-系统参数,2-业务参数', - `system_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '0' COMMENT '是否为系统内置参数,1-是,0-否', - PRIMARY KEY (`public_id`) USING BTREE -) ENGINE = InnoDB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_bin COMMENT = '公共参数配置表'; - --- ---------------------------- --- Records of sys_public_param --- ---------------------------- -BEGIN; -INSERT INTO `sys_public_param` VALUES (1, '接口文档不显示的字段', 'GEN_HIDDEN_COLUMNS', 'tenant_id', '0', '', ' ', ' ', '2020-05-12 04:25:19', NULL, '9', '1'); -INSERT INTO `sys_public_param` VALUES (2, '注册用户默认角色', 'USER_DEFAULT_ROLE', 'GENERAL_USER', '0', '', 'admin', 'admin', '2022-03-30 10:00:57', '2022-03-30 02:05:59', '2', '1'); -COMMIT; - - -- ---------------------------- -- Table structure for sys_file -- ---------------------------- DROP TABLE IF EXISTS `sys_file`; CREATE TABLE `sys_file` ( - `id` bigint NOT NULL COMMENT '文件ID', - `file_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '文件名称', - `bucket_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '文件存储桶名称', - `original` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '原始文件名', - `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '文件类型', - `file_size` bigint DEFAULT NULL COMMENT '文件大小', - `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '0' COMMENT '删除标志:0-正常,1-删除', - `create_time` datetime DEFAULT NULL COMMENT '创建时间', - `update_time` datetime DEFAULT NULL COMMENT '修改时间', - `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '创建者', - `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '更新人', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='文件管理表'; + `id` bigint NOT NULL COMMENT '编号', + `file_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '文件名', + `bucket_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '文件存储桶名称', + `original` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '原始文件名', + `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '文件类型', + `file_size` bigint DEFAULT NULL COMMENT '文件大小', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ' ' COMMENT '创建人', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ' ' COMMENT '修改人', + `create_time` datetime DEFAULT NULL COMMENT '上传时间', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标志', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='文件管理表'; -- ---------------------------- -- Records of sys_file @@ -225,119 +242,147 @@ COMMIT; -- ---------------------------- DROP TABLE IF EXISTS `sys_log`; CREATE TABLE `sys_log` ( - `id` bigint NOT NULL, - `type` char(1) COLLATE utf8mb4_bin DEFAULT '1' COMMENT '日志类型', - `title` varchar(255) COLLATE utf8mb4_bin DEFAULT '' COMMENT '日志标题', - `service_id` varchar(32) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '服务ID', - `remote_addr` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '操作IP地址', - `user_agent` varchar(1000) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '用户代理', - `request_uri` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '请求URI', - `method` varchar(10) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '操作方式', - `params` text COLLATE utf8mb4_bin COMMENT '操作提交的数据', - `time` bigint DEFAULT NULL COMMENT '执行时间', - `del_flag` char(1) COLLATE utf8mb4_bin DEFAULT '0' COMMENT '删除标记', - `exception` text COLLATE utf8mb4_bin COMMENT '异常信息', - `create_time` datetime DEFAULT NULL COMMENT '创建时间', - `update_time` datetime DEFAULT NULL COMMENT '更新时间', - `create_by` varchar(64) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '创建人', - `update_by` varchar(64) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '更新人', - PRIMARY KEY (`id`), - KEY `sys_log_create_by` (`create_by`), - KEY `sys_log_request_uri` (`request_uri`), - KEY `sys_log_type` (`type`), - KEY `sys_log_create_date` (`create_time`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT='日志表'; + `id` bigint NOT NULL COMMENT '编号', + `log_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '日志类型', + `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '日志标题', + `service_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '服务ID', + `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT ' ' COMMENT '创建人', + `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT ' ' COMMENT '修改人', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `remote_addr` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '远程地址', + `user_agent` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '用户代理', + `request_uri` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '请求URI', + `method` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '请求方法', + `params` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '请求参数', + `time` bigint DEFAULT NULL COMMENT '执行时间', + `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标志', + `exception` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '异常信息', + PRIMARY KEY (`id`) USING BTREE, + KEY `sys_log_request_uri` (`request_uri`) USING BTREE, + KEY `sys_log_type` (`log_type`) USING BTREE, + KEY `sys_log_create_date` (`create_time`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='日志表'; --- ---------------------------- --- Records of sys_log --- ---------------------------- -BEGIN; -COMMIT; -- ---------------------------- -- Table structure for sys_menu -- ---------------------------- DROP TABLE IF EXISTS `sys_menu`; CREATE TABLE `sys_menu` ( - `menu_id` bigint NOT NULL, - `name` varchar(32) COLLATE utf8mb4_bin NOT NULL COMMENT '菜单名称', - `permission` varchar(32) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '菜单权限标识', - `path` varchar(128) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '前端URL', - `parent_id` bigint DEFAULT NULL COMMENT '父菜单ID', - `icon` varchar(32) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '图标', - `sort_order` int NOT NULL DEFAULT '0' COMMENT '排序值', - `keep_alive` char(1) COLLATE utf8mb4_bin DEFAULT '0' COMMENT '0-开启,1- 关闭', - `type` char(1) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '菜单类型 (0菜单 1按钮)', - `del_flag` char(1) COLLATE utf8mb4_bin DEFAULT '0' COMMENT '逻辑删除标记(0--正常 1--删除)', - `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '创建人', - `create_time` datetime DEFAULT NULL COMMENT '创建时间', - `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '修改人', - `update_time` datetime DEFAULT NULL COMMENT '更新时间', - PRIMARY KEY (`menu_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT='菜单权限表'; + `menu_id` bigint NOT NULL COMMENT '菜单ID', + `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '菜单名称', + `en_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '英文名称', + `permission` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '权限标识', + `path` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '路由路径', + `parent_id` bigint DEFAULT NULL COMMENT '父菜单ID', + `icon` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '菜单图标', + `visible` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '1' COMMENT '是否可见,0隐藏,1显示', + `sort_order` int DEFAULT '1' COMMENT '排序值,越小越靠前', + `keep_alive` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '是否缓存,0否,1是', + `embedded` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '是否内嵌,0否,1是', + `menu_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '菜单类型,0目录,1菜单,2按钮', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ' ' COMMENT '创建人', + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ' ' COMMENT '修改人', + `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标志,0未删除,1已删除', + PRIMARY KEY (`menu_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='菜单权限表'; -- ---------------------------- -- Records of sys_menu -- ---------------------------- BEGIN; -INSERT INTO `sys_menu` VALUES ('1000', '权限管理', null, '/admin', '-1', 'icon-quanxianguanli', '1', '0', '0', '0', ' ', '2018-09-28 08:29:53', ' ', '2020-03-11 23:58:18'); -INSERT INTO `sys_menu` VALUES ('1100', '用户管理', null, '/admin/user/index', '1000', 'icon-yonghuguanli', '0', '0', '0', '0', ' ', '2017-11-02 22:24:37', ' ', '2020-03-12 00:12:57'); -INSERT INTO `sys_menu` VALUES ('1101', '用户新增', 'sys_user_add', null, '1100', null, '0', '0', '1', '0', ' ', '2017-11-08 09:52:09', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('1102', '用户修改', 'sys_user_edit', null, '1100', null, '0', '0', '1', '0', ' ', '2017-11-08 09:52:48', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('1103', '用户删除', 'sys_user_del', null, '1100', null, '0', '0', '1', '0', ' ', '2017-11-08 09:54:01', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('1104', '导入导出', 'sys_user_import_export', null, '1100', null, '0', '0', '1', '0', ' ', '2017-11-08 09:54:01', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('1200', '菜单管理', null, '/admin/menu/index', '1000', 'icon-caidanguanli', '1', '0', '0', '0', ' ', '2017-11-08 09:57:27', ' ', '2020-03-12 00:13:52'); -INSERT INTO `sys_menu` VALUES ('1201', '菜单新增', 'sys_menu_add', null, '1200', null, '0', '0', '1', '0', ' ', '2017-11-08 10:15:53', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('1202', '菜单修改', 'sys_menu_edit', null, '1200', null, '0', '0', '1', '0', ' ', '2017-11-08 10:16:23', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('1203', '菜单删除', 'sys_menu_del', null, '1200', null, '0', '0', '1', '0', ' ', '2017-11-08 10:16:43', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('1300', '角色管理', null, '/admin/role/index', '1000', 'icon-jiaoseguanli', '2', '0', '0', '0', ' ', '2017-11-08 10:13:37', ' ', '2020-03-12 00:15:40'); -INSERT INTO `sys_menu` VALUES ('1301', '角色新增', 'sys_role_add', null, '1300', null, '0', '0', '1', '0', ' ', '2017-11-08 10:14:18', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('1302', '角色修改', 'sys_role_edit', null, '1300', null, '0', '0', '1', '0', ' ', '2017-11-08 10:14:41', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('1303', '角色删除', 'sys_role_del', null, '1300', null, '0', '0', '1', '0', ' ', '2017-11-08 10:14:59', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('1304', '分配权限', 'sys_role_perm', null, '1300', null, '0', '0', '1', '0', ' ', '2018-04-20 07:22:55', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('1305', '导入导出', 'sys_role_import_export', null, '1300', null, '0', '0', '1', '0', 'admin', '2022-03-21 11:14:52', 'admin', '2022-03-21 11:15:07'); -INSERT INTO `sys_menu` VALUES ('1400', '部门管理', null, '/admin/dept/index', '1000', 'icon-web-icon-', '3', '0', '0', '0', ' ', '2018-01-20 13:17:19', ' ', '2020-03-12 00:15:44'); -INSERT INTO `sys_menu` VALUES ('1401', '部门新增', 'sys_dept_add', null, '1400', null, '0', '0', '1', '0', ' ', '2018-01-20 14:56:16', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('1402', '部门修改', 'sys_dept_edit', null, '1400', null, '0', '0', '1', '0', ' ', '2018-01-20 14:56:59', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('1403', '部门删除', 'sys_dept_del', null, '1400', null, '0', '0', '1', '0', ' ', '2018-01-20 14:57:28', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('1500', '岗位管理', '', '/admin/post/index', '1000', 'icon-gangweiguanli', '4', '0', '0', '0', null, '2018-01-20 13:17:19', 'admin', '2022-11-10 21:35:55'); -INSERT INTO `sys_menu` VALUES ('1501', '岗位查看', 'sys_post_get', null, '1500', '1', '0', '0', '1', '0', null, '2018-05-15 21:35:18', 'admin', '2022-03-15 17:32:54'); -INSERT INTO `sys_menu` VALUES ('1502', '岗位新增', 'sys_post_add', null, '1500', '1', '1', '0', '1', '0', null, '2018-05-15 21:35:18', 'admin', '2022-03-15 17:32:48'); -INSERT INTO `sys_menu` VALUES ('1503', '岗位修改', 'sys_post_edit', null, '1500', '1', '2', '0', '1', '0', null, '2018-05-15 21:35:18', 'admin', '2022-03-15 17:33:10'); -INSERT INTO `sys_menu` VALUES ('1504', '岗位删除', 'sys_post_del', null, '1500', '1', '3', '0', '1', '0', null, '2018-05-15 21:35:18', 'admin', '2022-03-15 17:33:27'); -INSERT INTO `sys_menu` VALUES ('1505', '导入导出', 'sys_post_import_export', null, '1500', null, '4', '0', '1', '0', 'admin', '2022-03-21 12:53:05', 'admin', '2022-03-21 12:53:05'); -INSERT INTO `sys_menu` VALUES ('2000', '系统管理', null, '/setting', '-1', 'icon-wxbgongju1', '2', '0', '0', '0', '', '2017-11-07 20:56:00', 'admin', '2022-11-10 21:42:39'); -INSERT INTO `sys_menu` VALUES ('2100', '日志管理', null, '/admin/log/index', '2000', 'icon-rizhiguanli', '3', '0', '0', '0', ' ', '2017-11-20 14:06:22', ' ', '2020-03-12 00:15:49'); -INSERT INTO `sys_menu` VALUES ('2101', '日志删除', 'sys_log_del', null, '2100', null, '0', '0', '1', '0', ' ', '2017-11-20 20:37:37', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('2102', '导入导出', 'sys_log_import_export', null, '2100', null, '0', '0', '1', '0', ' ', '2017-11-08 09:54:01', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('2200', '字典管理', null, '/admin/dict/index', '2000', 'icon-tubiaozhizuomoban-27', '2', '0', '0', '0', '', '2017-11-29 11:30:52', 'admin', '2022-11-10 21:38:09'); -INSERT INTO `sys_menu` VALUES ('2201', '字典删除', 'sys_dict_del', null, '2200', null, '0', '0', '1', '0', ' ', '2017-11-29 11:30:11', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('2202', '字典新增', 'sys_dict_add', null, '2200', null, '0', '0', '1', '0', ' ', '2018-05-11 22:34:55', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('2203', '字典修改', 'sys_dict_edit', null, '2200', null, '0', '0', '1', '0', ' ', '2018-05-11 22:36:03', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('2300', '令牌管理', null, '/admin/token/index', '2000', 'icon-lingpaiguanli', '4', '0', '0', '0', '', '2018-09-04 05:58:41', 'admin', '2022-11-10 21:38:33'); -INSERT INTO `sys_menu` VALUES ('2301', '令牌删除', 'sys_token_del', null, '2300', null, '0', '0', '1', '0', ' ', '2018-09-04 05:59:50', ' ', '2020-03-13 12:57:34'); -INSERT INTO `sys_menu` VALUES ('2400', '终端管理', '', '/admin/client/index', '2000', 'icon-shouji', '0', '0', '0', '0', ' ', '2018-01-20 13:17:19', ' ', '2020-03-12 00:15:54'); -INSERT INTO `sys_menu` VALUES ('2401', '客户端新增', 'sys_client_add', null, '2400', '1', '0', '0', '1', '0', ' ', '2018-05-15 21:35:18', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('2402', '客户端修改', 'sys_client_edit', null, '2400', null, '0', '0', '1', '0', ' ', '2018-05-15 21:37:06', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('2403', '客户端删除', 'sys_client_del', null, '2400', null, '0', '0', '1', '0', ' ', '2018-05-15 21:39:16', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('2600', '文件管理', null, '/admin/file/index', '2000', 'icon-wenjianjiawenjianguanli', '1', '0', '0', '0', '', '2018-06-26 10:50:32', 'admin', '2022-11-10 21:35:40'); -INSERT INTO `sys_menu` VALUES ('2601', '文件删除', 'sys_file_del', null, '2600', null, '0', '0', '1', '0', ' ', '2017-11-29 11:30:11', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('2602', '文件新增', 'sys_file_add', null, '2600', null, '0', '0', '1', '0', ' ', '2018-05-11 22:34:55', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('2603', '文件修改', 'sys_file_edit', null, '2600', null, '0', '0', '1', '0', ' ', '2018-05-11 22:36:03', ' ', '2021-05-25 06:48:34'); -INSERT INTO `sys_menu` VALUES ('2700', '参数管理', null, '/admin/param/index', '2000', 'icon-canshu', '5', '0', '0', '0', 'admin', '2022-03-25 20:40:27', 'admin', '2022-11-10 21:38:50'); -INSERT INTO `sys_menu` VALUES ('2701', '参数新增', 'sys_publicparam_add', null, '2700', null, '0', '0', '1', '0', 'admin', '2022-03-25 20:45:05', 'admin', '2022-03-25 20:45:05'); -INSERT INTO `sys_menu` VALUES ('2702', '参数删除', 'sys_publicparam_del', null, '2700', null, '1', '0', '1', '0', 'admin', '2022-03-25 20:45:43', 'admin', '2022-03-25 20:45:43'); -INSERT INTO `sys_menu` VALUES ('2703', '参数修改', 'sys_publicparam_edit', null, '2700', null, '3', '0', '1', '0', 'admin', '2022-03-25 20:46:04', 'admin', '2022-03-25 20:46:04'); -INSERT INTO `sys_menu` VALUES ('3000', '开发平台', null, '/gen', '-1', 'icon-keshihuapingtaiicon_zujian', '3', '1', '0', '0', '', '2020-03-11 22:15:40', 'admin', '2022-11-10 21:39:25'); -INSERT INTO `sys_menu` VALUES ('3100', '数据源管理', null, '/gen/datasource', '3000', 'icon-shujuyuan', '3', '1', '0', '0', '', '2020-03-11 22:17:05', 'admin', '2022-11-10 21:40:27'); -INSERT INTO `sys_menu` VALUES ('3200', '代码生成', null, '/gen/index', '3000', 'icon-didaima', '0', '0', '0', '0', '', '2020-03-11 22:23:42', 'admin', '2022-11-10 21:39:54'); -INSERT INTO `sys_menu` VALUES ('3300', '表单管理', null, '/gen/form', '3000', 'icon-biaodanguanli', '1', '1', '0', '0', '', '2020-03-11 22:19:32', 'admin', '2022-11-10 21:40:06'); -INSERT INTO `sys_menu` VALUES ('3301', '表单新增', 'gen_form_add', null, '3300', '', '0', '0', '1', '0', ' ', '2018-05-15 21:35:18', ' ', '2020-03-11 22:39:08'); -INSERT INTO `sys_menu` VALUES ('3302', '表单修改', 'gen_form_edit', null, '3300', '', '0', '0', '1', '0', ' ', '2018-05-15 21:35:18', ' ', '2020-03-11 22:39:09'); -INSERT INTO `sys_menu` VALUES ('3303', '表单删除', 'gen_form_del', null, '3300', '', '0', '0', '1', '0', ' ', '2018-05-15 21:35:18', ' ', '2020-03-11 22:39:11'); -INSERT INTO `sys_menu` VALUES ('3400', '表单设计', null, '/gen/design', '3000', 'icon-sheji', '2', '1', '0', '0', '', '2020-03-11 22:18:05', 'admin', '2022-11-10 21:40:16'); -INSERT INTO `sys_menu` VALUES ('4000', '服务监控', null, 'http://localhost:5001/login', '-1', 'icon-iconset0265', '4', '0', '0', '0', 'admin', '2022-03-21 09:44:50', 'admin', '2022-11-10 21:42:17'); -INSERT INTO `sys_menu` VALUES ('9999', '系统官网', null, 'https://pig4cloud.com/#/', '-1', 'icon-web-icon-', '999', '0', '0', '0', '', '2019-01-17 17:05:19', 'admin', '2022-11-10 21:40:53'); +INSERT INTO `sys_menu` VALUES (1000, '权限管理', 'authorization', NULL, '/admin', -1, 'iconfont icon-icon-', '1', 0, '0', '0', '0', '', '2018-09-28 08:29:53', 'admin', '2023-03-12 22:32:52', '0'); +INSERT INTO `sys_menu` VALUES (1100, '用户管理', 'user', NULL, '/admin/user/index', 1000, 'ele-User', '1', 1, '0', '0', '0', '', '2017-11-02 22:24:37', 'admin', '2023-07-05 10:28:22', '0'); +INSERT INTO `sys_menu` VALUES (1101, '用户新增', NULL, 'sys_user_add', NULL, 1100, NULL, '1', 1, '0', NULL, '1', ' ', '2017-11-08 09:52:09', ' ', '2021-05-25 03:12:55', '0'); +INSERT INTO `sys_menu` VALUES (1102, '用户修改', NULL, 'sys_user_edit', NULL, 1100, NULL, '1', 1, '0', NULL, '1', ' ', '2017-11-08 09:52:48', ' ', '2021-05-25 03:12:55', '0'); +INSERT INTO `sys_menu` VALUES (1103, '用户删除', NULL, 'sys_user_del', NULL, 1100, NULL, '1', 1, '0', NULL, '1', ' ', '2017-11-08 09:54:01', ' ', '2021-05-25 03:12:55', '0'); +INSERT INTO `sys_menu` VALUES (1104, '导入导出', NULL, 'sys_user_export', NULL, 1100, NULL, '1', 1, '0', NULL, '1', ' ', '2017-11-08 09:54:01', ' ', '2021-05-25 03:12:55', '0'); +INSERT INTO `sys_menu` VALUES (1200, '菜单管理', 'menu', NULL, '/admin/menu/index', 1000, 'iconfont icon-caidan', '1', 2, '0', '0', '0', '', '2017-11-08 09:57:27', 'admin', '2023-07-05 10:28:17', '0'); +INSERT INTO `sys_menu` VALUES (1201, '菜单新增', NULL, 'sys_menu_add', NULL, 1200, NULL, '1', 1, '0', NULL, '1', ' ', '2017-11-08 10:15:53', ' ', '2021-05-25 03:12:55', '0'); +INSERT INTO `sys_menu` VALUES (1202, '菜单修改', NULL, 'sys_menu_edit', NULL, 1200, NULL, '1', 1, '0', NULL, '1', ' ', '2017-11-08 10:16:23', ' ', '2021-05-25 03:12:55', '0'); +INSERT INTO `sys_menu` VALUES (1203, '菜单删除', NULL, 'sys_menu_del', NULL, 1200, NULL, '1', 1, '0', NULL, '1', ' ', '2017-11-08 10:16:43', ' ', '2021-05-25 03:12:55', '0'); +INSERT INTO `sys_menu` VALUES (1300, '角色管理', 'role', NULL, '/admin/role/index', 1000, 'iconfont icon-gerenzhongxin', '1', 3, '0', NULL, '0', '', '2017-11-08 10:13:37', 'admin', '2023-07-05 10:28:13', '0'); +INSERT INTO `sys_menu` VALUES (1301, '角色新增', NULL, 'sys_role_add', NULL, 1300, NULL, '1', 1, '0', NULL, '1', ' ', '2017-11-08 10:14:18', ' ', '2021-05-25 03:12:55', '0'); +INSERT INTO `sys_menu` VALUES (1302, '角色修改', NULL, 'sys_role_edit', NULL, 1300, NULL, '1', 1, '0', NULL, '1', ' ', '2017-11-08 10:14:41', ' ', '2021-05-25 03:12:55', '0'); +INSERT INTO `sys_menu` VALUES (1303, '角色删除', NULL, 'sys_role_del', NULL, 1300, NULL, '1', 1, '0', NULL, '1', ' ', '2017-11-08 10:14:59', ' ', '2021-05-25 03:12:55', '0'); +INSERT INTO `sys_menu` VALUES (1304, '分配权限', NULL, 'sys_role_perm', NULL, 1300, NULL, '1', 1, '0', NULL, '1', ' ', '2018-04-20 07:22:55', ' ', '2021-05-25 03:12:55', '0'); +INSERT INTO `sys_menu` VALUES (1305, '角色导入导出', NULL, 'sys_role_export', NULL, 1300, NULL, '1', 4, '0', NULL, '1', ' ', '2022-03-26 15:54:34', ' ', NULL, '0'); +INSERT INTO `sys_menu` VALUES (1400, '部门管理', 'dept', NULL, '/admin/dept/index', 1000, 'iconfont icon-zidingyibuju', '1', 4, '0', NULL, '0', '', '2018-01-20 13:17:19', 'admin', '2023-07-05 10:28:07', '0'); +INSERT INTO `sys_menu` VALUES (1401, '部门新增', NULL, 'sys_dept_add', NULL, 1400, NULL, '1', 1, '0', NULL, '1', ' ', '2018-01-20 14:56:16', ' ', '2021-05-25 03:12:55', '0'); +INSERT INTO `sys_menu` VALUES (1402, '部门修改', NULL, 'sys_dept_edit', NULL, 1400, NULL, '1', 1, '0', NULL, '1', ' ', '2018-01-20 14:56:59', ' ', '2021-05-25 03:12:55', '0'); +INSERT INTO `sys_menu` VALUES (1403, '部门删除', NULL, 'sys_dept_del', NULL, 1400, NULL, '1', 1, '0', NULL, '1', ' ', '2018-01-20 14:57:28', ' ', '2021-05-25 03:12:55', '0'); +INSERT INTO `sys_menu` VALUES (1600, '岗位管理', 'post', NULL, '/admin/post/index', 1000, 'iconfont icon--chaifenhang', '1', 5, '1', '0', '0', '', '2022-03-26 13:04:14', 'admin', '2023-07-05 10:28:03', '0'); +INSERT INTO `sys_menu` VALUES (1601, '岗位信息查看', NULL, 'sys_post_view', NULL, 1600, NULL, '1', 0, '0', NULL, '1', ' ', '2022-03-26 13:05:34', ' ', NULL, '0'); +INSERT INTO `sys_menu` VALUES (1602, '岗位信息新增', NULL, 'sys_post_add', NULL, 1600, NULL, '1', 1, '0', NULL, '1', ' ', '2022-03-26 13:06:00', ' ', NULL, '0'); +INSERT INTO `sys_menu` VALUES (1603, '岗位信息修改', NULL, 'sys_post_edit', NULL, 1600, NULL, '1', 2, '0', NULL, '1', ' ', '2022-03-26 13:06:31', ' ', '2022-03-26 13:06:38', '0'); +INSERT INTO `sys_menu` VALUES (1604, '岗位信息删除', NULL, 'sys_post_del', NULL, 1600, NULL, '1', 3, '0', NULL, '1', ' ', '2022-03-26 13:06:31', ' ', NULL, '0'); +INSERT INTO `sys_menu` VALUES (1605, '岗位导入导出', NULL, 'sys_post_export', NULL, 1600, NULL, '1', 4, '0', NULL, '1', ' ', '2022-03-26 13:06:31', ' ', '2022-03-26 06:32:02', '0'); +INSERT INTO `sys_menu` VALUES (2000, '系统管理', 'system', NULL, '/system', -1, 'iconfont icon-quanjushezhi_o', '1', 1, '0', NULL, '0', '', '2017-11-07 20:56:00', 'admin', '2023-07-05 10:27:58', '0'); +INSERT INTO `sys_menu` VALUES (2001, '日志管理', 'log', NULL, '/admin/logs', 2000, 'ele-Cloudy', '1', 0, '0', '0', '0', 'admin', '2023-03-02 12:26:42', 'admin', '2023-07-05 10:27:53', '0'); +INSERT INTO `sys_menu` VALUES (2100, '操作日志', 'operation', NULL, '/admin/log/index', 2001, 'iconfont icon-jinridaiban', '1', 2, '0', '0', '0', '', '2017-11-20 14:06:22', 'admin', '2023-07-05 10:27:49', '0'); +INSERT INTO `sys_menu` VALUES (2101, '日志删除', NULL, 'sys_log_del', NULL, 2100, NULL, '1', 1, '0', NULL, '1', ' ', '2017-11-20 20:37:37', ' ', '2021-05-25 03:12:55', '0'); +INSERT INTO `sys_menu` VALUES (2102, '导入导出', NULL, 'sys_log_export', NULL, 2100, NULL, '1', 1, '0', NULL, '1', ' ', '2017-11-08 09:54:01', ' ', '2021-05-25 03:12:55', '0'); +INSERT INTO `sys_menu` VALUES (2200, '字典管理', 'dict', NULL, '/admin/dict/index', 2000, 'iconfont icon-zhongduancanshuchaxun', '1', 6, '0', NULL, '0', '', '2017-11-29 11:30:52', 'admin', '2023-07-05 10:27:37', '0'); +INSERT INTO `sys_menu` VALUES (2201, '字典删除', NULL, 'sys_dict_del', NULL, 2200, NULL, '1', 1, '0', NULL, '1', ' ', '2017-11-29 11:30:11', ' ', '2021-05-25 03:12:55', '0'); +INSERT INTO `sys_menu` VALUES (2202, '字典新增', NULL, 'sys_dict_add', NULL, 2200, NULL, '1', 1, '0', NULL, '1', ' ', '2018-05-11 22:34:55', ' ', '2021-05-25 03:12:55', '0'); +INSERT INTO `sys_menu` VALUES (2203, '字典修改', NULL, 'sys_dict_edit', NULL, 2200, NULL, '1', 1, '0', NULL, '1', ' ', '2018-05-11 22:36:03', ' ', '2021-05-25 03:12:55', '0'); +INSERT INTO `sys_menu` VALUES (2210, '参数管理', 'parameter', NULL, '/admin/param/index', 2000, 'iconfont icon-wenducanshu-05', '1', 7, '1', NULL, '0', '', '2019-04-29 22:16:50', 'admin', '2023-02-16 15:24:51', '0'); +INSERT INTO `sys_menu` VALUES (2211, '参数新增', NULL, 'sys_syspublicparam_add', NULL, 2210, NULL, '1', 1, '0', NULL, '1', ' ', '2019-04-29 22:17:36', ' ', '2020-03-24 08:57:11', '0'); +INSERT INTO `sys_menu` VALUES (2212, '参数删除', NULL, 'sys_syspublicparam_del', NULL, 2210, NULL, '1', 1, '0', NULL, '1', ' ', '2019-04-29 22:17:55', ' ', '2020-03-24 08:57:12', '0'); +INSERT INTO `sys_menu` VALUES (2213, '参数编辑', NULL, 'sys_syspublicparam_edit', NULL, 2210, NULL, '1', 1, '0', NULL, '1', ' ', '2019-04-29 22:18:14', ' ', '2020-03-24 08:57:13', '0'); +INSERT INTO `sys_menu` VALUES (2300, '代码生成', 'code', NULL, '/gen/table/index', 9000, 'iconfont icon-zhongduancanshu', '1', 1, '0', '0', '0', '', '2018-01-20 13:17:19', 'admin', '2023-02-20 13:54:35', '0'); +INSERT INTO `sys_menu` VALUES (2400, '终端管理', 'client', NULL, '/admin/client/index', 2000, 'iconfont icon-gongju', '1', 9, '1', NULL, '0', '', '2018-01-20 13:17:19', 'admin', '2023-02-16 15:25:28', '0'); +INSERT INTO `sys_menu` VALUES (2401, '客户端新增', NULL, 'sys_client_add', NULL, 2400, '1', '1', 1, '0', NULL, '1', ' ', '2018-05-15 21:35:18', ' ', '2021-05-25 03:12:55', '0'); +INSERT INTO `sys_menu` VALUES (2402, '客户端修改', NULL, 'sys_client_edit', NULL, 2400, NULL, '1', 1, '0', NULL, '1', ' ', '2018-05-15 21:37:06', ' ', '2021-05-25 03:12:55', '0'); +INSERT INTO `sys_menu` VALUES (2403, '客户端删除', NULL, 'sys_client_del', NULL, 2400, NULL, '1', 1, '0', NULL, '1', ' ', '2018-05-15 21:39:16', ' ', '2021-05-25 03:12:55', '0'); +INSERT INTO `sys_menu` VALUES (2500, '密钥管理', 'key', NULL, '/admin/social/index', 2000, 'iconfont icon-quanxian', '1', 10, '0', NULL, '0', '', '2018-01-20 13:17:19', 'admin', '2023-02-16 15:26:16', '0'); +INSERT INTO `sys_menu` VALUES (2501, '密钥新增', NULL, 'sys_social_details_add', NULL, 2500, '1', '1', 0, '0', NULL, '1', ' ', '2018-05-15 21:35:18', ' ', '2020-03-24 08:57:19', '0'); +INSERT INTO `sys_menu` VALUES (2502, '密钥修改', NULL, 'sys_social_details_edit', NULL, 2500, '1', '1', 1, '0', NULL, '1', ' ', '2018-05-15 21:35:18', ' ', '2020-03-24 08:57:19', '0'); +INSERT INTO `sys_menu` VALUES (2503, '密钥删除', NULL, 'sys_social_details_del', NULL, 2500, '1', '1', 2, '0', NULL, '1', ' ', '2018-05-15 21:35:18', ' ', '2020-03-24 08:57:23', '0'); +INSERT INTO `sys_menu` VALUES (2600, '令牌管理', 'token', NULL, '/admin/token/index', 2000, 'ele-Key', '1', 11, '0', NULL, '0', '', '2018-09-04 05:58:41', 'admin', '2023-02-16 15:28:28', '0'); +INSERT INTO `sys_menu` VALUES (2601, '令牌删除', NULL, 'sys_token_del', NULL, 2600, NULL, '1', 1, '0', NULL, '1', ' ', '2018-09-04 05:59:50', ' ', '2020-03-24 08:57:24', '0'); +INSERT INTO `sys_menu` VALUES (2800, 'Quartz管理', 'quartz', NULL, '/daemon/job-manage/index', 2000, 'ele-AlarmClock', '1', 8, '0', NULL, '0', '', '2018-01-20 13:17:19', 'admin', '2023-02-16 15:25:06', '0'); +INSERT INTO `sys_menu` VALUES (2810, '任务新增', NULL, 'job_sys_job_add', NULL, 2800, '1', '1', 0, '0', NULL, '1', ' ', '2018-05-15 21:35:18', ' ', '2020-03-24 08:57:26', '0'); +INSERT INTO `sys_menu` VALUES (2820, '任务修改', NULL, 'job_sys_job_edit', NULL, 2800, '1', '1', 0, '0', NULL, '1', ' ', '2018-05-15 21:35:18', ' ', '2020-03-24 08:57:27', '0'); +INSERT INTO `sys_menu` VALUES (2830, '任务删除', NULL, 'job_sys_job_del', NULL, 2800, '1', '1', 0, '0', NULL, '1', ' ', '2018-05-15 21:35:18', ' ', '2020-03-24 08:57:28', '0'); +INSERT INTO `sys_menu` VALUES (2840, '任务暂停', NULL, 'job_sys_job_shutdown_job', NULL, 2800, '1', '1', 0, '0', NULL, '1', ' ', '2018-05-15 21:35:18', ' ', '2020-03-24 08:57:28', '0'); +INSERT INTO `sys_menu` VALUES (2850, '任务开始', NULL, 'job_sys_job_start_job', NULL, 2800, '1', '1', 0, '0', NULL, '1', ' ', '2018-05-15 21:35:18', ' ', '2020-03-24 08:57:29', '0'); +INSERT INTO `sys_menu` VALUES (2860, '任务刷新', NULL, 'job_sys_job_refresh_job', NULL, 2800, '1', '1', 0, '0', NULL, '1', ' ', '2018-05-15 21:35:18', ' ', '2020-03-24 08:57:30', '0'); +INSERT INTO `sys_menu` VALUES (2870, '执行任务', NULL, 'job_sys_job_run_job', NULL, 2800, '1', '1', 0, '0', NULL, '1', ' ', '2019-08-08 15:35:18', ' ', '2020-03-24 08:57:31', '0'); +INSERT INTO `sys_menu` VALUES (2871, '导出', NULL, 'job_sys_job_export', NULL, 2800, NULL, '1', 0, '0', '0', '1', 'admin', '2023-03-06 15:26:13', ' ', NULL, '0'); +INSERT INTO `sys_menu` VALUES (2900, '国际化管理', 'i18n', NULL, '/admin/i18n/index', 2000, 'iconfont icon-zhongyingzhuanhuan', '1', 8, '0', NULL, '0', '', NULL, 'admin', '2023-02-16 15:25:18', '0'); +INSERT INTO `sys_menu` VALUES (2901, '系统表-国际化查看', NULL, 'sys_i18n_view', NULL, 2900, '1', '1', 0, '0', NULL, '1', ' ', NULL, ' ', NULL, '0'); +INSERT INTO `sys_menu` VALUES (2902, '系统表-国际化新增', NULL, 'sys_i18n_add', NULL, 2900, '1', '1', 1, '0', NULL, '1', ' ', NULL, ' ', NULL, '0'); +INSERT INTO `sys_menu` VALUES (2903, '系统表-国际化修改', NULL, 'sys_i18n_edit', NULL, 2900, '1', '1', 2, '0', NULL, '1', ' ', NULL, ' ', NULL, '0'); +INSERT INTO `sys_menu` VALUES (2904, '系统表-国际化删除', NULL, 'sys_i18n_del', NULL, 2900, '1', '1', 3, '0', NULL, '1', ' ', NULL, ' ', NULL, '0'); +INSERT INTO `sys_menu` VALUES (2905, '导入导出', NULL, 'sys_i18n_export', NULL, 2900, '1', '1', 3, '0', NULL, '1', ' ', NULL, ' ', NULL, '0'); +INSERT INTO `sys_menu` VALUES (2906, '文件管理', 'file', NULL, '/admin/file/index', 2000, 'ele-Files', '1', 6, '0', NULL, '0', '', '2019-06-25 12:44:46', 'admin', '2023-02-16 15:24:42', '0'); +INSERT INTO `sys_menu` VALUES (2907, '删除文件', NULL, 'sys_file_del', NULL, 2906, NULL, '1', 1, '0', NULL, '1', ' ', '2019-06-25 13:41:41', ' ', '2020-03-24 08:58:42', '0'); +INSERT INTO `sys_menu` VALUES (4000, '系统监控', 'monitor', NULL, '/daemon', -1, 'iconfont icon-shuju', '1', 3, '0', '0', '0', 'admin', '2023-02-06 20:20:47', 'admin', '2023-02-23 20:01:07', '0'); +INSERT INTO `sys_menu` VALUES (4001, '文档扩展', 'doc', NULL, 'http://pig-gateway:9999/swagger-ui.html', 4000, 'iconfont icon-biaodan', '1', 2, '0', '1', '0', '', '2018-06-26 10:50:32', 'admin', '2023-02-23 20:01:29', '0'); +INSERT INTO `sys_menu` VALUES (4002, '缓存监控', 'cache', NULL, '/ext/cache', 4000, 'iconfont icon-shuju', '1', 1, '0', '0', '0', 'admin', '2023-05-29 15:12:59', 'admin', '2023-06-06 11:58:41', '0'); +INSERT INTO `sys_menu` VALUES (9000, '开发平台', 'develop', NULL, '/gen', -1, 'iconfont icon-shuxingtu', '1', 9, '0', '0', '0', '', '2019-08-12 09:35:16', 'admin', '2023-07-05 10:25:27', '0'); +INSERT INTO `sys_menu` VALUES (9005, '数据源管理', 'datasource', NULL, '/gen/datasource/index', 9000, 'ele-Coin', '1', 0, '0', NULL, '0', '', '2019-08-12 09:42:11', 'admin', '2023-07-05 10:26:56', '0'); +INSERT INTO `sys_menu` VALUES (9006, '表单设计', 'Form Design', NULL, '/gen/design/index', 9000, 'iconfont icon-AIshiyanshi', '0', 2, '0', '0', '0', '', '2019-08-16 10:08:56', 'admin', '2023-02-23 14:06:50', '0'); +INSERT INTO `sys_menu` VALUES (9007, '生成页面', 'generation', NULL, '/gen/gener/index', 9000, 'iconfont icon-tongzhi4', '0', 0, '0', '0', '0', 'admin', '2023-02-20 09:58:23', 'admin', '2023-07-05 10:27:06', '0'); +INSERT INTO `sys_menu` VALUES (9050, '元数据管理', 'metadata', NULL, '/gen/metadata', 9000, 'iconfont icon--chaifenhang', '1', 9, '0', '0', '0', '', '2018-07-27 01:13:21', 'admin', '2023-07-05 10:27:13', '0'); +INSERT INTO `sys_menu` VALUES (9051, '模板管理', 'template', NULL, '/gen/template/index', 9050, 'iconfont icon--chaifenhang', '1', 5, '0', '0', '0', 'admin', '2023-02-21 11:22:54', 'admin', '2023-07-05 10:27:18', '0'); +INSERT INTO `sys_menu` VALUES (9052, '查询', NULL, 'codegen_template_view', NULL, 9051, NULL, '0', 0, '0', '0', '1', 'admin', '2023-02-21 12:33:03', 'admin', '2023-02-21 13:50:54', '0'); +INSERT INTO `sys_menu` VALUES (9053, '增加', NULL, 'codegen_template_add', NULL, 9051, NULL, '1', 0, '0', '0', '1', 'admin', '2023-02-21 13:34:10', 'admin', '2023-02-21 13:39:49', '0'); +INSERT INTO `sys_menu` VALUES (9054, '新增', NULL, 'codegen_template_add', NULL, 9051, NULL, '0', 1, '0', '0', '1', 'admin', '2023-02-21 13:51:32', ' ', NULL, '0'); +INSERT INTO `sys_menu` VALUES (9055, '导出', NULL, 'codegen_template_export', NULL, 9051, NULL, '0', 2, '0', '0', '1', 'admin', '2023-02-21 13:51:58', ' ', NULL, '0'); +INSERT INTO `sys_menu` VALUES (9056, '删除', NULL, 'codegen_template_del', NULL, 9051, NULL, '0', 3, '0', '0', '1', 'admin', '2023-02-21 13:52:16', ' ', NULL, '0'); +INSERT INTO `sys_menu` VALUES (9057, '编辑', NULL, 'codegen_template_edit', NULL, 9051, NULL, '0', 4, '0', '0', '1', 'admin', '2023-02-21 13:52:58', ' ', NULL, '0'); +INSERT INTO `sys_menu` VALUES (9059, '模板分组', 'group', NULL, '/gen/group/index', 9050, 'iconfont icon-shuxingtu', '1', 6, '0', '0', '0', 'admin', '2023-02-21 15:06:50', 'admin', '2023-07-05 10:27:22', '0'); +INSERT INTO `sys_menu` VALUES (9060, '查询', NULL, 'codegen_group_view', NULL, 9059, NULL, '0', 0, '0', '0', '1', 'admin', '2023-02-21 15:08:07', ' ', NULL, '0'); +INSERT INTO `sys_menu` VALUES (9061, '新增', NULL, 'codegen_group_add', NULL, 9059, NULL, '0', 0, '0', '0', '1', 'admin', '2023-02-21 15:08:28', ' ', NULL, '0'); +INSERT INTO `sys_menu` VALUES (9062, '修改', NULL, 'codegen_group_edit', NULL, 9059, NULL, '0', 0, '0', '0', '1', 'admin', '2023-02-21 15:08:43', ' ', NULL, '0'); +INSERT INTO `sys_menu` VALUES (9063, '删除', NULL, 'codegen_group_del', NULL, 9059, NULL, '0', 0, '0', '0', '1', 'admin', '2023-02-21 15:09:02', ' ', NULL, '0'); +INSERT INTO `sys_menu` VALUES (9064, '导出', NULL, 'codegen_group_export', NULL, 9059, NULL, '0', 0, '0', '0', '1', 'admin', '2023-02-21 15:09:22', ' ', NULL, '0'); +INSERT INTO `sys_menu` VALUES (9065, '字段管理', 'field', NULL, '/gen/field-type/index', 9050, 'iconfont icon-fuwenben', '1', 0, '0', '0', '0', 'admin', '2023-02-23 20:05:09', 'admin', '2023-07-05 10:27:31', '0'); COMMIT; -- ---------------------------- @@ -345,78 +390,98 @@ COMMIT; -- ---------------------------- DROP TABLE IF EXISTS `sys_oauth_client_details`; CREATE TABLE `sys_oauth_client_details` ( - `client_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '客户端ID', - `resource_ids` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '资源列表', - `client_secret` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '客户端密钥', - `scope` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '域', - `authorized_grant_types` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '认证类型', - `web_server_redirect_uri` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '重定向地址', - `authorities` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '角色列表', - `access_token_validity` int DEFAULT NULL COMMENT 'token 有效期', - `refresh_token_validity` int DEFAULT NULL COMMENT '刷新令牌有效期', - `additional_information` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '令牌扩展字段JSON', - `autoapprove` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '是否自动放行', - `create_time` datetime DEFAULT NULL COMMENT '创建时间', - `update_time` datetime DEFAULT NULL COMMENT '更新时间', - `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '创建人', - `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '更新人', - PRIMARY KEY (`client_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT='终端信息表'; + `id` bigint NOT NULL COMMENT 'ID', + `client_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户端ID', + `resource_ids` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '资源ID集合', + `client_secret` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '客户端秘钥', + `scope` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '授权范围', + `authorized_grant_types` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '授权类型', + `web_server_redirect_uri` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '回调地址', + `authorities` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '权限集合', + `access_token_validity` int DEFAULT NULL COMMENT '访问令牌有效期(秒)', + `refresh_token_validity` int DEFAULT NULL COMMENT '刷新令牌有效期(秒)', + `additional_information` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '附加信息', + `autoapprove` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '自动授权', + `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记,0未删除,1已删除', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ' ' COMMENT '创建人', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ' ' COMMENT '修改人', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='终端信息表'; -- ---------------------------- -- Records of sys_oauth_client_details -- ---------------------------- BEGIN; -INSERT INTO `sys_oauth_client_details` VALUES ('app', NULL, 'app', 'server', 'app,refresh_token', NULL, NULL, NULL, NULL, NULL, 'true', NULL, NULL, NULL, NULL); -INSERT INTO `sys_oauth_client_details` VALUES ('daemon', NULL, 'daemon', 'server', 'password,refresh_token', NULL, NULL, NULL, NULL, NULL, 'true', NULL, NULL, NULL, NULL); -INSERT INTO `sys_oauth_client_details` VALUES ('gen', NULL, 'gen', 'server', 'password,refresh_token', NULL, NULL, NULL, NULL, NULL, 'true', NULL, NULL, NULL, NULL); -INSERT INTO `sys_oauth_client_details` VALUES ('pig', NULL, 'pig', 'server', 'password,app,refresh_token,authorization_code,client_credentials', 'https://pigx.vip', NULL, NULL, NULL, NULL, 'true', NULL, NULL, NULL, NULL); -INSERT INTO `sys_oauth_client_details` VALUES ('test', NULL, 'test', 'server', 'password,app,refresh_token', NULL, NULL, NULL, NULL, NULL, 'true', NULL, NULL, NULL, NULL); -INSERT INTO `sys_oauth_client_details` VALUES ('client', NULL, 'client', 'server', 'client_credentials', NULL, NULL, NULL, NULL, NULL, 'true', NULL, NULL, NULL, NULL); +INSERT INTO `sys_oauth_client_details` VALUES (1, 'app', NULL, 'app', 'server', 'password,refresh_token,authorization_code,client_credentials,mobile', 'http://localhost:4040/sso1/login,http://localhost:4041/sso1/login,http://localhost:8080/renren-admin/sys/oauth2-sso,http://localhost:8090/sys/oauth2-sso', NULL, 43200, 2592001, '{\"enc_flag\":\"1\",\"captcha_flag\":\"1\",\"online_quantity\":\"1\"}', 'true', '0', '', 'admin', NULL, '2023-02-09 13:54:54'); +INSERT INTO `sys_oauth_client_details` VALUES (2, 'daemon', NULL, 'daemon', 'server', 'password,refresh_token', NULL, NULL, 43200, 2592001, '{\"enc_flag\":\"1\",\"captcha_flag\":\"1\"}', 'true', '0', ' ', ' ', NULL, NULL); +INSERT INTO `sys_oauth_client_details` VALUES (3, 'gen', NULL, 'gen', 'server', 'password,refresh_token', NULL, NULL, 43200, 2592001, '{\"enc_flag\":\"1\",\"captcha_flag\":\"1\"}', 'true', '0', ' ', ' ', NULL, NULL); +INSERT INTO `sys_oauth_client_details` VALUES (4, 'mp', NULL, 'mp', 'server', 'password,refresh_token', NULL, NULL, 43200, 2592001, '{\"enc_flag\":\"1\",\"captcha_flag\":\"1\"}', 'true', '0', ' ', ' ', NULL, NULL); +INSERT INTO `sys_oauth_client_details` VALUES (5, 'pig', NULL, 'pig', 'server', 'password,refresh_token,authorization_code,client_credentials,mobile', 'http://localhost:4040/sso1/login,http://localhost:4041/sso1/login,http://localhost:8080/renren-admin/sys/oauth2-sso,http://localhost:8090/sys/oauth2-sso', NULL, 43200, 2592001, '{\"enc_flag\":\"1\",\"captcha_flag\":\"1\",\"online_quantity\":\"1\"}', 'false', '0', '', 'admin', NULL, '2023-03-08 11:32:41'); +INSERT INTO `sys_oauth_client_details` VALUES (6, 'test', NULL, 'test', 'server', 'password,refresh_token', NULL, NULL, 43200, 2592001, '{ \"enc_flag\":\"1\",\"captcha_flag\":\"0\"}', 'true', '0', ' ', ' ', NULL, NULL); +INSERT INTO `sys_oauth_client_details` VALUES (7, 'social', NULL, 'social', 'server', 'password,refresh_token,mobile', NULL, NULL, 43200, 2592001, '{ \"enc_flag\":\"0\",\"captcha_flag\":\"0\"}', 'true', '0', ' ', ' ', NULL, NULL); COMMIT; -- ---------------------------- -- Table structure for sys_post -- ---------------------------- DROP TABLE IF EXISTS `sys_post`; -CREATE TABLE `sys_post` ( - `post_id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '岗位ID', - `post_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '岗位编码', - `post_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '岗位名称', - `post_sort` int(0) NOT NULL COMMENT '岗位排序', - `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '0' COMMENT '是否删除 -1:已删除 0:正常', - `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', - `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '创建人', - `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', - `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '更新人', - `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '备注信息', - PRIMARY KEY (`post_id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT = '岗位信息表'; +CREATE TABLE `sys_post` ( + `post_id` bigint NOT NULL COMMENT '岗位ID', + `post_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '岗位编码', + `post_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '岗位名称', + `post_sort` int NOT NULL COMMENT '岗位排序', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '岗位描述', + `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '是否删除 -1:已删除 0:正常', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '创建人', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '更新人', + PRIMARY KEY (`post_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='岗位信息表'; -- ---------------------------- -- Records of sys_post -- ---------------------------- BEGIN; -INSERT INTO `sys_post` VALUES (1, 'user', '员工', 2, '0', '2022-03-19 10:05:15', 'admin', '2022-03-19 10:42:28', 'admin', '打工人'); -INSERT INTO `sys_post` VALUES (2, 'cto', 'cto', 0, '0', '2022-03-19 10:06:20', 'admin', '2022-03-19 10:06:20', 'admin', 'cto666'); -INSERT INTO `sys_post` VALUES (3, 'boss', '董事长', -1, '0', '2022-03-19 10:06:35', 'admin', '2022-03-19 10:42:44', 'admin', '大boss'); +INSERT INTO `sys_post` VALUES (1, 'CTO', 'CTO', 0, 'CTOOO', '0', '2022-03-26 13:48:17', '', '2023-03-08 16:03:35', 'admin'); COMMIT; -- ---------------------------- --- Table structure for sys_user_post +-- Table structure for sys_public_param -- ---------------------------- -DROP TABLE IF EXISTS `sys_user_post`; -CREATE TABLE `sys_user_post` ( - `user_id` bigint(0) NOT NULL COMMENT '用户ID', - `post_id` bigint(0) NOT NULL COMMENT '岗位ID', - PRIMARY KEY (`user_id`, `post_id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT = '用户与岗位关联表'; +DROP TABLE IF EXISTS `sys_public_param`; +CREATE TABLE `sys_public_param` ( + `public_id` bigint NOT NULL COMMENT '编号', + `public_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '名称', + `public_key` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '键', + `public_value` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '值', + `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '状态,0禁用,1启用', + `validate_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '校验码', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ' ' COMMENT '创建人', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ' ' COMMENT '修改人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `public_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '类型,0未知,1系统,2业务', + `system_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '系统标识,0非系统,1系统', + `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记,0未删除,1已删除', + PRIMARY KEY (`public_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='公共参数配置表'; -- ---------------------------- --- Records of sys_user_post +-- Records of sys_public_param -- ---------------------------- BEGIN; -INSERT INTO `sys_user_post` VALUES (1, 1); +INSERT INTO `sys_public_param` VALUES (1, '租户默认来源', 'TENANT_DEFAULT_ID', '1', '0', '', ' ', ' ', '2020-05-12 04:03:46', '2020-06-20 08:56:30', '2', '0', '1'); +INSERT INTO `sys_public_param` VALUES (2, '租户默认部门名称', 'TENANT_DEFAULT_DEPTNAME', '租户默认部门', '0', '', ' ', ' ', '2020-05-12 03:36:32', NULL, '2', '1', '0'); +INSERT INTO `sys_public_param` VALUES (3, '租户默认账户', 'TENANT_DEFAULT_USERNAME', 'admin', '0', '', ' ', ' ', '2020-05-12 04:05:04', NULL, '2', '1', '0'); +INSERT INTO `sys_public_param` VALUES (4, '租户默认密码', 'TENANT_DEFAULT_PASSWORD', '123456', '0', '', ' ', ' ', '2020-05-12 04:05:24', NULL, '2', '1', '0'); +INSERT INTO `sys_public_param` VALUES (5, '租户默认角色编码', 'TENANT_DEFAULT_ROLECODE', 'ROLE_ADMIN', '0', '', ' ', ' ', '2020-05-12 04:05:57', NULL, '2', '1', '0'); +INSERT INTO `sys_public_param` VALUES (6, '租户默认角色名称', 'TENANT_DEFAULT_ROLENAME', '租户默认角色', '0', '', ' ', ' ', '2020-05-12 04:06:19', NULL, '2', '1', '0'); +INSERT INTO `sys_public_param` VALUES (7, '表前缀', 'GEN_TABLE_PREFIX', 'tb_', '0', '', ' ', ' ', '2020-05-12 04:23:04', NULL, '9', '1', '0'); +INSERT INTO `sys_public_param` VALUES (8, '接口文档不显示的字段', 'GEN_HIDDEN_COLUMNS', 'tenant_id', '0', '', ' ', ' ', '2020-05-12 04:25:19', NULL, '9', '1', '0'); +INSERT INTO `sys_public_param` VALUES (9, '注册用户默认角色', 'USER_DEFAULT_ROLE', 'GENERAL_USER', '0', NULL, ' ', ' ', '2022-03-31 16:52:24', NULL, '2', '1', '0'); COMMIT; -- ---------------------------- @@ -424,25 +489,25 @@ COMMIT; -- ---------------------------- DROP TABLE IF EXISTS `sys_role`; CREATE TABLE `sys_role` ( - `role_id` bigint NOT NULL COMMENT '角色ID', - `role_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '角色名称', - `role_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '角色代码', - `role_desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '角色描述', - `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '0' COMMENT '删除标识:0-正常,1-删除', - `create_time` datetime DEFAULT NULL COMMENT '创建时间', - `update_time` datetime DEFAULT NULL COMMENT '修改时间', - `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '修改人', - `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '创建人', - PRIMARY KEY (`role_id`), - UNIQUE KEY `role_idx1_role_code` (`role_code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT='系统角色表'; + `role_id` bigint NOT NULL COMMENT '角色ID', + `role_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '角色名称', + `role_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '角色编码', + `role_desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '角色描述', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ' ' COMMENT '创建人', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ' ' COMMENT '修改人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记,0未删除,1已删除', + PRIMARY KEY (`role_id`) USING BTREE, + KEY `role_idx1_role_code` (`role_code`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='系统角色表'; -- ---------------------------- -- Records of sys_role -- ---------------------------- BEGIN; -INSERT INTO `sys_role` VALUES (1, '管理员', 'ROLE_ADMIN', '管理员', '0', '2017-10-29 15:45:51', '2018-12-26 14:09:11', NULL, NULL); -INSERT INTO `sys_role` VALUES (2, '普通用户','GENERAL_USER', '普通用户', '0', '2022-03-30 09:59:24', '2022-03-30 09:59:24', 'admin', 'admin'); +INSERT INTO `sys_role` VALUES (1, '管理员', 'ROLE_ADMIN', '管理员', '', 'admin', '2017-10-29 15:45:51', '2023-07-07 14:55:07', '0'); +INSERT INTO `sys_role` VALUES (2, '普通用户', 'GENERAL_USER', '普通用户', '', 'admin', '2022-03-31 17:03:15', '2023-04-03 02:28:51', '0'); COMMIT; -- ---------------------------- @@ -450,10 +515,10 @@ COMMIT; -- ---------------------------- DROP TABLE IF EXISTS `sys_role_menu`; CREATE TABLE `sys_role_menu` ( - `role_id` bigint NOT NULL COMMENT '角色ID', - `menu_id` bigint NOT NULL COMMENT '菜单ID', - PRIMARY KEY (`role_id`,`menu_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT='角色菜单表'; + `role_id` bigint NOT NULL COMMENT '角色ID', + `menu_id` bigint NOT NULL COMMENT '菜单ID', + PRIMARY KEY (`role_id`,`menu_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='角色菜单表'; -- ---------------------------- -- Records of sys_role_menu @@ -479,13 +544,14 @@ INSERT INTO `sys_role_menu` VALUES (1, 1400); INSERT INTO `sys_role_menu` VALUES (1, 1401); INSERT INTO `sys_role_menu` VALUES (1, 1402); INSERT INTO `sys_role_menu` VALUES (1, 1403); -INSERT INTO `sys_role_menu` VALUES (1, 1500); -INSERT INTO `sys_role_menu` VALUES (1, 1501); -INSERT INTO `sys_role_menu` VALUES (1, 1502); -INSERT INTO `sys_role_menu` VALUES (1, 1503); -INSERT INTO `sys_role_menu` VALUES (1, 1504); -INSERT INTO `sys_role_menu` VALUES (1, 1505); +INSERT INTO `sys_role_menu` VALUES (1, 1600); +INSERT INTO `sys_role_menu` VALUES (1, 1601); +INSERT INTO `sys_role_menu` VALUES (1, 1602); +INSERT INTO `sys_role_menu` VALUES (1, 1603); +INSERT INTO `sys_role_menu` VALUES (1, 1604); +INSERT INTO `sys_role_menu` VALUES (1, 1605); INSERT INTO `sys_role_menu` VALUES (1, 2000); +INSERT INTO `sys_role_menu` VALUES (1, 2001); INSERT INTO `sys_role_menu` VALUES (1, 2100); INSERT INTO `sys_role_menu` VALUES (1, 2101); INSERT INTO `sys_role_menu` VALUES (1, 2102); @@ -493,32 +559,63 @@ INSERT INTO `sys_role_menu` VALUES (1, 2200); INSERT INTO `sys_role_menu` VALUES (1, 2201); INSERT INTO `sys_role_menu` VALUES (1, 2202); INSERT INTO `sys_role_menu` VALUES (1, 2203); +INSERT INTO `sys_role_menu` VALUES (1, 2210); +INSERT INTO `sys_role_menu` VALUES (1, 2211); +INSERT INTO `sys_role_menu` VALUES (1, 2212); +INSERT INTO `sys_role_menu` VALUES (1, 2213); INSERT INTO `sys_role_menu` VALUES (1, 2300); -INSERT INTO `sys_role_menu` VALUES (1, 2301); INSERT INTO `sys_role_menu` VALUES (1, 2400); INSERT INTO `sys_role_menu` VALUES (1, 2401); INSERT INTO `sys_role_menu` VALUES (1, 2402); INSERT INTO `sys_role_menu` VALUES (1, 2403); +INSERT INTO `sys_role_menu` VALUES (1, 2500); +INSERT INTO `sys_role_menu` VALUES (1, 2501); +INSERT INTO `sys_role_menu` VALUES (1, 2502); +INSERT INTO `sys_role_menu` VALUES (1, 2503); INSERT INTO `sys_role_menu` VALUES (1, 2600); INSERT INTO `sys_role_menu` VALUES (1, 2601); -INSERT INTO `sys_role_menu` VALUES (1, 2602); -INSERT INTO `sys_role_menu` VALUES (1, 2603); -INSERT INTO `sys_role_menu` VALUES (1, 2700); -INSERT INTO `sys_role_menu` VALUES (1, 2701); -INSERT INTO `sys_role_menu` VALUES (1, 2702); -INSERT INTO `sys_role_menu` VALUES (1, 2703); -INSERT INTO `sys_role_menu` VALUES (1, 3000); -INSERT INTO `sys_role_menu` VALUES (1, 3100); -INSERT INTO `sys_role_menu` VALUES (1, 3200); -INSERT INTO `sys_role_menu` VALUES (1, 3300); -INSERT INTO `sys_role_menu` VALUES (1, 3301); -INSERT INTO `sys_role_menu` VALUES (1, 3302); -INSERT INTO `sys_role_menu` VALUES (1, 3303); -INSERT INTO `sys_role_menu` VALUES (1, 3400); +INSERT INTO `sys_role_menu` VALUES (1, 2800); +INSERT INTO `sys_role_menu` VALUES (1, 2810); +INSERT INTO `sys_role_menu` VALUES (1, 2820); +INSERT INTO `sys_role_menu` VALUES (1, 2830); +INSERT INTO `sys_role_menu` VALUES (1, 2840); +INSERT INTO `sys_role_menu` VALUES (1, 2850); +INSERT INTO `sys_role_menu` VALUES (1, 2860); +INSERT INTO `sys_role_menu` VALUES (1, 2870); +INSERT INTO `sys_role_menu` VALUES (1, 2871); +INSERT INTO `sys_role_menu` VALUES (1, 2900); +INSERT INTO `sys_role_menu` VALUES (1, 2901); +INSERT INTO `sys_role_menu` VALUES (1, 2902); +INSERT INTO `sys_role_menu` VALUES (1, 2903); +INSERT INTO `sys_role_menu` VALUES (1, 2904); +INSERT INTO `sys_role_menu` VALUES (1, 2905); +INSERT INTO `sys_role_menu` VALUES (1, 2906); +INSERT INTO `sys_role_menu` VALUES (1, 2907); INSERT INTO `sys_role_menu` VALUES (1, 4000); -INSERT INTO `sys_role_menu` VALUES (1, 9999); +INSERT INTO `sys_role_menu` VALUES (1, 4001); +INSERT INTO `sys_role_menu` VALUES (1, 4002); +INSERT INTO `sys_role_menu` VALUES (1, 9000); +INSERT INTO `sys_role_menu` VALUES (1, 9005); +INSERT INTO `sys_role_menu` VALUES (1, 9006); +INSERT INTO `sys_role_menu` VALUES (1, 9007); +INSERT INTO `sys_role_menu` VALUES (1, 9050); +INSERT INTO `sys_role_menu` VALUES (1, 9051); +INSERT INTO `sys_role_menu` VALUES (1, 9052); +INSERT INTO `sys_role_menu` VALUES (1, 9053); +INSERT INTO `sys_role_menu` VALUES (1, 9054); +INSERT INTO `sys_role_menu` VALUES (1, 9055); +INSERT INTO `sys_role_menu` VALUES (1, 9056); +INSERT INTO `sys_role_menu` VALUES (1, 9057); +INSERT INTO `sys_role_menu` VALUES (1, 9059); +INSERT INTO `sys_role_menu` VALUES (1, 9060); +INSERT INTO `sys_role_menu` VALUES (1, 9061); +INSERT INTO `sys_role_menu` VALUES (1, 9062); +INSERT INTO `sys_role_menu` VALUES (1, 9063); +INSERT INTO `sys_role_menu` VALUES (1, 9064); +INSERT INTO `sys_role_menu` VALUES (1, 9065); INSERT INTO `sys_role_menu` VALUES (2, 4000); -INSERT INTO `sys_role_menu` VALUES (2, 9999); +INSERT INTO `sys_role_menu` VALUES (2, 4001); +INSERT INTO `sys_role_menu` VALUES (2, 4002); COMMIT; -- ---------------------------- @@ -526,28 +623,56 @@ COMMIT; -- ---------------------------- DROP TABLE IF EXISTS `sys_user`; CREATE TABLE `sys_user` ( - `user_id` bigint NOT NULL, - `username` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '用户名', - `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '密码', - `salt` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '随机盐', - `phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '简介', - `avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '头像', - `dept_id` bigint DEFAULT NULL COMMENT '部门ID', - `lock_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '0' COMMENT '0-正常,9-锁定', - `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '0' COMMENT '0-正常,1-删除', - `create_time` datetime DEFAULT NULL COMMENT '创建时间', - `update_time` datetime DEFAULT NULL COMMENT '修改时间', - `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '创建者', - `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '更新人', - PRIMARY KEY (`user_id`), - KEY `user_idx1_username` (`username`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT='用户表'; + `user_id` bigint NOT NULL COMMENT '用户ID', + `username` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '用户名', + `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '密码', + `salt` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '盐值', + `phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '电话号码', + `avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '头像', + `nickname` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '昵称', + `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '姓名', + `email` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '邮箱地址', + `dept_id` bigint DEFAULT NULL COMMENT '所属部门ID', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ' ' COMMENT '创建人', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ' ' COMMENT '修改人', + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + `lock_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '锁定标记,0未锁定,9已锁定', + `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记,0未删除,1已删除', + `wx_openid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '微信登录openId', + `mini_openid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '小程序openId', + `qq_openid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'QQ openId', + `gitee_login` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '码云标识', + `osc_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '开源中国标识', + `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '所属租户ID', + PRIMARY KEY (`user_id`) USING BTREE, + KEY `user_wx_openid` (`wx_openid`) USING BTREE, + KEY `user_qq_openid` (`qq_openid`) USING BTREE, + KEY `user_idx1_username` (`username`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='用户表'; -- ---------------------------- -- Records of sys_user -- ---------------------------- BEGIN; -INSERT INTO `sys_user` VALUES (1, 'admin', '$2a$10$RpFJjxYiXdEsAGnWp/8fsOetMuOON96Ntk/Ym2M/RKRyU0GZseaDC', NULL, '17034642999', '', 1, '0', '0', '2018-04-20 07:15:18', '2019-01-31 14:29:07', NULL, NULL); +INSERT INTO `sys_user` VALUES (1, 'admin', '$2a$10$c/Ae0pRjJtMZg3BnvVpO.eIK6WYWVbKTzqgdy3afR7w.vd.xi3Mgy', '', '17034642999', '/admin/sys-file/s3demo/7ff4ca6b7bf446f3a5a13ac016dc21af.png', '管理员', '管理员', 'pig4cloud@qq.com', 4, ' ', 'admin', '2018-04-20 07:15:18', '2023-07-07 14:55:40', '0', '0', NULL, 'oBxPy5E-v82xWGsfzZVzkD3wEX64', NULL, 'log4j', NULL, 1); +COMMIT; + +-- ---------------------------- +-- Table structure for sys_user_post +-- ---------------------------- +DROP TABLE IF EXISTS `sys_user_post`; +CREATE TABLE `sys_user_post` ( + `user_id` bigint NOT NULL COMMENT '用户ID', + `post_id` bigint NOT NULL COMMENT '岗位ID', + PRIMARY KEY (`user_id`,`post_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='用户与岗位关联表'; + +-- ---------------------------- +-- Records of sys_user_post +-- ---------------------------- +BEGIN; +INSERT INTO `sys_user_post` VALUES (1, 1); COMMIT; -- ---------------------------- @@ -555,16 +680,17 @@ COMMIT; -- ---------------------------- DROP TABLE IF EXISTS `sys_user_role`; CREATE TABLE `sys_user_role` ( - `user_id` bigint NOT NULL COMMENT '用户ID', - `role_id` bigint NOT NULL COMMENT '角色ID', - PRIMARY KEY (`user_id`,`role_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT='用户角色表'; + `user_id` bigint NOT NULL COMMENT '用户ID', + `role_id` bigint NOT NULL COMMENT '角色ID', + PRIMARY KEY (`user_id`,`role_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='用户角色表'; -- ---------------------------- -- Records of sys_user_role -- ---------------------------- BEGIN; INSERT INTO `sys_user_role` VALUES (1, 1); +INSERT INTO `sys_user_role` VALUES (1676492190299299842, 2); COMMIT; SET FOREIGN_KEY_CHECKS = 1; diff --git a/db/pig_codegen.sql b/db/pig_codegen.sql index 791d1393..98a0d741 100644 --- a/db/pig_codegen.sql +++ b/db/pig_codegen.sql @@ -4,26 +4,30 @@ CREATE DATABASE `pig_codegen` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; - -USE `pig_codegen`; +USE pig_codegen; -- ---------------------------- -- Table structure for gen_datasource_conf -- ---------------------------- DROP TABLE IF EXISTS `gen_datasource_conf`; CREATE TABLE `gen_datasource_conf` ( - `id` bigint NOT NULL COMMENT '数据源ID', - `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '数据源名称', - `url` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'jdbc-url', - `username` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '用户名', - `password` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '密码', - `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '0' COMMENT '删除标记', - `create_time` datetime DEFAULT NULL COMMENT '创建时间', - `create_by` varchar(64) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '创建人', - `update_time` datetime DEFAULT NULL COMMENT '修改时间', - `update_by` varchar(64) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '更新人', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='数据源表'; + `id` bigint NOT NULL COMMENT '主键', + `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '别名', + `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'jdbcurl', + `username` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '用户名', + `password` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '密码', + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新', + `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记', + `tenant_id` bigint DEFAULT NULL COMMENT '租户ID', + `ds_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '数据库类型', + `conf_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '配置类型', + `ds_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '数据库名称', + `instance` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '实例', + `port` int DEFAULT NULL COMMENT '端口', + `host` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '主机', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='数据源表'; -- ---------------------------- -- Records of gen_datasource_conf @@ -32,26 +36,219 @@ BEGIN; COMMIT; -- ---------------------------- --- Table structure for gen_form_conf +-- Table structure for gen_field_type -- ---------------------------- -DROP TABLE IF EXISTS `gen_form_conf`; -CREATE TABLE `gen_form_conf` ( - `id` bigint NOT NULL COMMENT '表单配置ID', - `table_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '表名', - `form_info` json NOT NULL COMMENT '表单信息', - `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT '0' COMMENT '删除标记', - `create_time` datetime DEFAULT NULL COMMENT '创建时间', - `create_by` varchar(64) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '创建人', - `update_time` datetime DEFAULT NULL COMMENT '修改时间', - `update_by` varchar(64) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '更新人', - PRIMARY KEY (`id`) USING BTREE, - KEY `table_name` (`table_name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='表单配置'; +DROP TABLE IF EXISTS `gen_field_type`; +CREATE TABLE `gen_field_type` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id', + `column_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '字段类型', + `attr_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '属性类型', + `package_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '属性包名', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人', + `update_time` datetime DEFAULT NULL COMMENT '修改时间', + `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人', + `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记', + PRIMARY KEY (`id`), + UNIQUE KEY `column_type` (`column_type`) +) ENGINE=InnoDB AUTO_INCREMENT=1634915190321451010 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='字段类型管理'; -- ---------------------------- --- Records of gen_form_conf +-- Records of gen_field_type +-- ---------------------------- +BEGIN; +INSERT INTO `gen_field_type` VALUES (1, 'datetime', 'LocalDateTime', 'java.time.LocalDateTime', '2023-02-06 08:45:10', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (2, 'date', 'LocalDate', 'java.time.LocalDate', '2023-02-06 08:45:10', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (3, 'tinyint', 'Integer', NULL, '2023-02-06 08:45:11', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (4, 'smallint', 'Integer', NULL, '2023-02-06 08:45:11', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (5, 'mediumint', 'Integer', NULL, '2023-02-06 08:45:11', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (6, 'int', 'Integer', NULL, '2023-02-06 08:45:11', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (7, 'integer', 'Integer', NULL, '2023-02-06 08:45:11', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (8, 'bigint', 'Long', NULL, '2023-02-06 08:45:11', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (9, 'float', 'Float', NULL, '2023-02-06 08:45:11', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (10, 'double', 'Double', NULL, '2023-02-06 08:45:11', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (11, 'decimal', 'BigDecimal', 'java.math.BigDecimal', '2023-02-06 08:45:11', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (12, 'bit', 'Boolean', NULL, '2023-02-06 08:45:11', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (13, 'char', 'String', NULL, '2023-02-06 08:45:11', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (14, 'varchar', 'String', NULL, '2023-02-06 08:45:11', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (15, 'tinytext', 'String', NULL, '2023-02-06 08:45:11', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (16, 'text', 'String', NULL, '2023-02-06 08:45:11', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (17, 'mediumtext', 'String', NULL, '2023-02-06 08:45:11', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (18, 'longtext', 'String', NULL, '2023-02-06 08:45:11', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (19, 'timestamp', 'LocalDateTime', 'java.time.LocalDateTime', '2023-02-06 08:45:11', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (20, 'NUMBER', 'Integer', NULL, '2023-02-06 08:45:11', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (21, 'BINARY_INTEGER', 'Integer', NULL, '2023-02-06 08:45:12', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (22, 'BINARY_FLOAT', 'Float', NULL, '2023-02-06 08:45:12', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (23, 'BINARY_DOUBLE', 'Double', NULL, '2023-02-06 08:45:12', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (24, 'VARCHAR2', 'String', NULL, '2023-02-06 08:45:12', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (25, 'NVARCHAR', 'String', NULL, '2023-02-06 08:45:12', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (26, 'NVARCHAR2', 'String', NULL, '2023-02-06 08:45:12', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (27, 'CLOB', 'String', NULL, '2023-02-06 08:45:12', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (28, 'int8', 'Long', NULL, '2023-02-06 08:45:12', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (29, 'int4', 'Integer', NULL, '2023-02-06 08:45:12', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (30, 'int2', 'Integer', NULL, '2023-02-06 08:45:12', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (31, 'numeric', 'BigDecimal', 'java.math.BigDecimal', '2023-02-06 08:45:12', NULL, NULL, NULL, '0'); +INSERT INTO `gen_field_type` VALUES (32, 'json', 'String', NULL, '2023-02-06 08:45:12', NULL, NULL, NULL, '0'); +COMMIT; + +-- ---------------------------- +-- Table structure for gen_group +-- ---------------------------- +DROP TABLE IF EXISTS `gen_group`; +CREATE TABLE `gen_group` ( + `id` bigint NOT NULL, + `group_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '分组名称', + `group_desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '分组描述', + `tenant_id` bigint NOT NULL COMMENT '租户ID', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ' ' COMMENT '创建人', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ' ' COMMENT '修改人', + `create_time` datetime DEFAULT NULL COMMENT '创建人', + `update_time` datetime DEFAULT NULL COMMENT '修改人', + `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='模板分组'; + +-- ---------------------------- +-- Records of gen_group +-- ---------------------------- +BEGIN; +INSERT INTO `gen_group` VALUES (1, '单表增删改查', '单表增删改查', 1, ' ', 'admin', NULL, '2023-07-07 15:47:51', '0'); +COMMIT; + +-- ---------------------------- +-- Table structure for gen_table +-- ---------------------------- +DROP TABLE IF EXISTS `gen_table`; +CREATE TABLE `gen_table` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id', + `table_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '表名', + `class_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '类名', + `db_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '数据库类型', + `table_comment` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '说明', + `author` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '作者', + `email` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '邮箱', + `package_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '项目包名', + `version` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '项目版本号', + `i18n` tinyint DEFAULT '1' COMMENT '是否生成带有i18n 0 不带有 1带有', + `style` bigint DEFAULT '0' COMMENT '代码风格', + `child_table_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '子表名称', + `main_field` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '主表关联键', + `child_field` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '子表关联键', + `generator_type` tinyint DEFAULT NULL COMMENT '生成方式 0:zip压缩包 1:自定义目录', + `backend_path` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '后端生成路径', + `frontend_path` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '前端生成路径', + `module_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '模块名', + `function_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '功能名', + `form_layout` tinyint DEFAULT NULL COMMENT '表单布局 1:一列 2:两列', + `ds_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '数据源ID', + `baseclass_id` bigint DEFAULT NULL COMMENT '基类ID', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + PRIMARY KEY (`id`), + UNIQUE KEY `table_name` (`table_name`,`ds_name`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='代码生成表'; + +-- ---------------------------- +-- Records of gen_table -- ---------------------------- BEGIN; COMMIT; +-- ---------------------------- +-- Table structure for gen_table_column +-- ---------------------------- +DROP TABLE IF EXISTS `gen_table_column`; +CREATE TABLE `gen_table_column` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id', + `ds_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '数据源名称', + `table_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '表名称', + `field_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '字段名称', + `field_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '字段类型', + `field_comment` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '字段说明', + `attr_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '属性名', + `attr_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '属性类型', + `package_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '属性包名', + `sort` int DEFAULT NULL COMMENT '排序', + `auto_fill` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '自动填充 DEFAULT、INSERT、UPDATE、INSERT_UPDATE', + `primary_pk` tinyint DEFAULT NULL COMMENT '主键 0:否 1:是', + `base_field` tinyint DEFAULT NULL COMMENT '基类字段 0:否 1:是', + `form_item` tinyint DEFAULT NULL COMMENT '表单项 0:否 1:是', + `form_required` tinyint DEFAULT NULL COMMENT '表单必填 0:否 1:是', + `form_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '表单类型', + `form_validator` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '表单效验', + `grid_item` tinyint DEFAULT NULL COMMENT '列表项 0:否 1:是', + `grid_sort` tinyint DEFAULT NULL COMMENT '列表排序 0:否 1:是', + `query_item` tinyint DEFAULT NULL COMMENT '查询项 0:否 1:是', + `query_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '查询方式', + `query_form_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '查询表单类型', + `field_dict` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '字典类型', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='代码生成表字段'; + +-- ---------------------------- +-- Records of gen_table_column +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gen_template +-- ---------------------------- +DROP TABLE IF EXISTS `gen_template`; +CREATE TABLE `gen_template` ( + `id` bigint NOT NULL COMMENT '主键', + `template_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '模板名称', + `generator_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '模板路径', + `template_desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '模板描述', + `template_code` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '模板代码', + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新', + `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '删除标记', + `tenant_id` bigint NOT NULL COMMENT '租户ID', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ' ' COMMENT '创建人', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ' ' COMMENT '修改人', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='模板'; + +-- ---------------------------- +-- Records of gen_template +-- ---------------------------- +BEGIN; +INSERT INTO `gen_template` VALUES (1, '表格', '${frontendPath}/src/views/${moduleName}/${functionName}/index.vue', '表格不含i18n', '\n\n', '2023-02-23 01:19:35', '2023-07-21 22:12:38', '0', 1, '', 'admin'); +INSERT INTO `gen_template` VALUES (2, '表单', '${frontendPath}/src/views/${moduleName}/${functionName}/form.vue', '表单不含i18n', '\n\n', '2023-02-23 01:19:48', '2023-07-21 22:12:41', '0', 1, '', 'admin'); +INSERT INTO `gen_template` VALUES (3, 'Controller', '${backendPath}/src/main/java/${packagePath}/${moduleName}/controller/${ClassName}Controller.java', '后台Controller', 'package ${package}.${moduleName}.controller;\n\n#if($queryList)\nimport cn.hutool.core.util.StrUtil;\n#end\nimport cn.hutool.core.collection.CollUtil;\nimport com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;\nimport com.baomidou.mybatisplus.core.toolkit.Wrappers;\nimport com.baomidou.mybatisplus.extension.plugins.pagination.Page;\nimport com.pig4cloud.pig.common.core.util.R;\nimport com.pig4cloud.pig.common.log.annotation.SysLog;\nimport ${package}.${moduleName}.entity.${ClassName}Entity;\nimport ${package}.${moduleName}.service.${ClassName}Service;\nimport org.springframework.security.access.prepost.PreAuthorize;\nimport com.pig4cloud.plugin.excel.annotation.ResponseExcel;\nimport io.swagger.v3.oas.annotations.security.SecurityRequirement;\nimport org.springdoc.core.annotations.ParameterObject;\nimport org.springframework.http.HttpHeaders;\nimport io.swagger.v3.oas.annotations.tags.Tag;\nimport io.swagger.v3.oas.annotations.Operation;\nimport lombok.RequiredArgsConstructor;\nimport org.springframework.web.bind.annotation.*;\n\nimport java.util.List;\n\n/**\n * ${tableComment}\n *\n * @author ${author}\n * @date ${datetime}\n */\n@RestController\n@RequiredArgsConstructor\n@RequestMapping(\"/${functionName}\" )\n@Tag(description = \"${functionName}\" , name = \"${tableComment}管理\" )\n@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)\npublic class ${ClassName}Controller {\n\n private final ${ClassName}Service ${className}Service;\n\n /**\n * 分页查询\n * @param page 分页对象\n * @param ${className} ${tableComment}\n * @return\n */\n @Operation(summary = \"分页查询\" , description = \"分页查询\" )\n @GetMapping(\"/page\" )\n @PreAuthorize(\"@pms.hasPermission(\'${moduleName}_${functionName}_view\')\" )\n public R get${ClassName}Page(@ParameterObject Page page,@ParameterObject ${ClassName}Entity ${className}) {\n LambdaQueryWrapper<${ClassName}Entity> wrapper = Wrappers.lambdaQuery();\n#foreach ($field in $queryList)\n#set($getAttrName=$str.getProperty($field.attrName))\n#set($var=\"${className}.$getAttrName()\")\n#if($field.queryType == \'=\')\n wrapper.eq(StrUtil.isNotBlank($var),${ClassName}Entity::$getAttrName,$var);\n#elseif( $field.queryType == \'like\' )\n wrapper.like(StrUtil.isNotBlank($var),${ClassName}Entity::$getAttrName,$var);\n#elseif( $field.queryType == \'!-\' )\n wrapper.ne(StrUtil.isNotBlank($var),${ClassName}Entity::$getAttrName,$var);\n#elseif( $field.queryType == \'>\' )\n wrapper.gt(StrUtil.isNotBlank($var),${ClassName}Entity::$getAttrName,$var);\n#elseif( $field.queryType == \'<\' )\n wrapper.lt(StrUtil.isNotBlank($var),${ClassName}Entity::$getAttrName,$var);\n#elseif( $field.queryType == \'>=\' )\n wrapper.ge(StrUtil.isNotBlank($var),${ClassName}Entity::$getAttrName,$var);\n#elseif( $field.queryType == \'<=\' )\n wrapper.le(StrUtil.isNotBlank($var),${ClassName}Entity::$getAttrName,$var);\n#elseif( $field.queryType == \'left like\' )\n wrapper.likeLeft(StrUtil.isNotBlank($var),${ClassName}Entity::$getAttrName,$var);\n#elseif( $field.queryType == \'right like\' )\n wrapper.likeRight(StrUtil.isNotBlank($var),${ClassName}Entity::$getAttrName,$var);\n#end\n#end\n return R.ok(${className}Service.page(page, wrapper));\n }\n\n\n /**\n * 通过id查询${tableComment}\n * @param ${pk.attrName} id\n * @return R\n */\n @Operation(summary = \"通过id查询\" , description = \"通过id查询\" )\n @GetMapping(\"/{${pk.attrName}}\" )\n @PreAuthorize(\"@pms.hasPermission(\'${moduleName}_${functionName}_view\')\" )\n public R getById(@PathVariable(\"${pk.attrName}\" ) ${pk.attrType} ${pk.attrName}) {\n return R.ok(${className}Service.getById(${pk.attrName}));\n }\n\n /**\n * 新增${tableComment}\n * @param ${className} ${tableComment}\n * @return R\n */\n @Operation(summary = \"新增${tableComment}\" , description = \"新增${tableComment}\" )\n @SysLog(\"新增${tableComment}\" )\n @PostMapping\n @PreAuthorize(\"@pms.hasPermission(\'${moduleName}_${functionName}_add\')\" )\n public R save(@RequestBody ${ClassName}Entity ${className}) {\n return R.ok(${className}Service.save(${className}));\n }\n\n /**\n * 修改${tableComment}\n * @param ${className} ${tableComment}\n * @return R\n */\n @Operation(summary = \"修改${tableComment}\" , description = \"修改${tableComment}\" )\n @SysLog(\"修改${tableComment}\" )\n @PutMapping\n @PreAuthorize(\"@pms.hasPermission(\'${moduleName}_${functionName}_edit\')\" )\n public R updateById(@RequestBody ${ClassName}Entity ${className}) {\n return R.ok(${className}Service.updateById(${className}));\n }\n\n /**\n * 通过id删除${tableComment}\n * @param ids ${pk.attrName}列表\n * @return R\n */\n @Operation(summary = \"通过id删除${tableComment}\" , description = \"通过id删除${tableComment}\" )\n @SysLog(\"通过id删除${tableComment}\" )\n @DeleteMapping\n @PreAuthorize(\"@pms.hasPermission(\'${moduleName}_${functionName}_del\')\" )\n public R removeById(@RequestBody ${pk.attrType}[] ids) {\n return R.ok(${className}Service.removeBatchByIds(CollUtil.toList(ids)));\n }\n\n\n /**\n * 导出excel 表格\n * @param ${className} 查询条件\n * @return excel 文件流\n */\n @ResponseExcel\n @GetMapping(\"/export\")\n @PreAuthorize(\"@pms.hasPermission(\'${moduleName}_${functionName}_export\')\" )\n public List<${ClassName}Entity> export(${ClassName}Entity ${className}) {\n return ${className}Service.list(Wrappers.query(${className}));\n }\n}', '2023-02-23 01:16:17', '2023-07-21 22:02:51', '0', 1, ' ', ' '); +INSERT INTO `gen_template` VALUES (4, 'Service', '${backendPath}/src/main/java/${packagePath}/${moduleName}/service/${ClassName}Service.java', 'Service', 'package ${package}.${moduleName}.service;\n\n#if($ChildClassName)\nimport com.github.yulichang.extension.mapping.base.MPJDeepService;\nimport ${package}.${moduleName}.entity.${ChildClassName}Entity;\n#else\nimport com.baomidou.mybatisplus.extension.service.IService;\n#end\nimport ${package}.${moduleName}.entity.${ClassName}Entity;\n\n#if($ChildClassName)\npublic interface ${ClassName}Service extends MPJDeepService<${ClassName}Entity> {\n Boolean saveDeep(${ClassName}Entity ${className});\n\n Boolean updateDeep(${ClassName}Entity ${className});\n\n Boolean removeDeep(Long[] ids);\n\n Boolean removeChild(Long[] ids);\n#else\npublic interface ${ClassName}Service extends IService<${ClassName}Entity> {\n#end\n\n}', '2023-02-23 01:16:53', '2023-06-04 10:35:25', '0', 1, ' ', ' '); +INSERT INTO `gen_template` VALUES (5, 'ServiceImpl', '${backendPath}/src/main/java/${packagePath}/${moduleName}/service/impl/${ClassName}ServiceImpl.java', 'ServiceImpl', 'package ${package}.${moduleName}.service.impl;\n\nimport com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;\nimport ${package}.${moduleName}.entity.${ClassName}Entity;\nimport ${package}.${moduleName}.mapper.${ClassName}Mapper;\nimport ${package}.${moduleName}.service.${ClassName}Service;\nimport org.springframework.stereotype.Service;\n#if($ChildClassName)\nimport cn.hutool.core.collection.CollUtil;\nimport com.baomidou.mybatisplus.core.toolkit.Wrappers;\nimport ${package}.${moduleName}.entity.${ChildClassName}Entity;\nimport ${package}.${moduleName}.mapper.${ChildClassName}Mapper;\nimport org.springframework.transaction.annotation.Transactional;\nimport lombok.RequiredArgsConstructor;\nimport java.util.Objects;\n#end\n/**\n * ${tableComment}\n *\n * @author ${author}\n * @date ${datetime}\n */\n@Service\n#if($ChildClassName)\n@RequiredArgsConstructor\n#end\npublic class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${ClassName}Entity> implements ${ClassName}Service {\n#if($ChildClassName)\n private final ${ChildClassName}Mapper ${childClassName}Mapper;\n\n @Override\n @Transactional(rollbackFor = Exception.class)\n public Boolean saveDeep(${ClassName}Entity ${className}) {\n baseMapper.insert(${className});\n for (${ChildClassName}Entity ${childClassName} : ${className}.get${ChildClassName}List()) {\n ${childClassName}.$str.setProperty($childField)(${className}.$str.getProperty($mainField)());\n ${childClassName}Mapper.insert( ${childClassName});\n }\n\n return Boolean.TRUE;\n }\n\n @Override\n @Transactional(rollbackFor = Exception.class)\n public Boolean updateDeep(${ClassName}Entity ${className}) {\n baseMapper.updateById(${className});\n for (${ChildClassName}Entity ${childClassName} : ${className}.get${ChildClassName}List()) {\n#foreach ($field in $childFieldList)\n#if($field.primaryPk)\n#set($getChildPkName=$str.getProperty($field.attrName))\n#end\n#end\n if (Objects.isNull(${childClassName}.$getChildPkName())) {\n ${childClassName}.$str.setProperty($childField)(${className}.getId());\n ${childClassName}Mapper.insert(${childClassName});\n } else {\n ${childClassName}Mapper.updateById(${childClassName});\n }\n }\n return Boolean.TRUE;\n }\n\n @Override\n @Transactional(rollbackFor = Exception.class)\n public Boolean removeDeep(Long[] ids) {\n baseMapper.deleteBatchIds(CollUtil.toList(ids));\n ${childClassName}Mapper.delete(Wrappers.<${ChildClassName}Entity>lambdaQuery().in(${ChildClassName}Entity::$str.getProperty($childField), ids));\n return Boolean.TRUE;\n }\n\n @Override\n @Transactional(rollbackFor = Exception.class)\n public Boolean removeChild(Long[] ids) {\n ${childClassName}Mapper.deleteBatchIds(CollUtil.toList(ids));\n return Boolean.TRUE;\n }\n#end\n}', '2023-02-23 01:17:36', '2023-06-04 10:35:21', '0', 1, ' ', ' '); +INSERT INTO `gen_template` VALUES (6, '实体', '${backendPath}/src/main/java/${packagePath}/${moduleName}/entity/${ClassName}Entity.java', 'Entity', 'package ${package}.${moduleName}.entity;\n\nimport com.baomidou.mybatisplus.annotation.*;\nimport com.baomidou.mybatisplus.extension.activerecord.Model;\nimport io.swagger.v3.oas.annotations.media.Schema;\nimport lombok.Data;\nimport lombok.EqualsAndHashCode;\n#foreach($import in $importList)\nimport $import;\n#end\n#if($ChildClassName)\nimport com.alibaba.excel.annotation.ExcelIgnore;\nimport com.github.yulichang.annotation.EntityMapping;\nimport java.util.List;\n#end\n\n/**\n * ${tableComment}\n *\n * @author ${author}\n * @date ${datetime}\n */\n@Data\n@TableName(\"${tableName}\")\n@EqualsAndHashCode(callSuper = true)\n@Schema(description = \"${tableComment}\")\npublic class ${ClassName}Entity extends Model<${ClassName}Entity> {\n\n#foreach ($field in $fieldList)\n#if(${field.fieldComment})#set($comment=${field.fieldComment})#else #set($comment=${field.attrName})#end\n\n /**\n * $comment\n */\n#if($field.primaryPk)\n @TableId(type = IdType.ASSIGN_ID)\n#end\n#if($field.autoFill == \'INSERT\')\n @TableField(fill = FieldFill.INSERT)\n#elseif($field.autoFill == \'INSERT_UPDATE\')\n @TableField(fill = FieldFill.INSERT_UPDATE)\n#elseif($field.autoFill == \'UPDATE\')\n @TableField(fill = FieldFill.UPDATE)\n#end\n#if($field.fieldName == \'del_flag\')\n @TableLogic\n @TableField(fill = FieldFill.INSERT)\n#end\n @Schema(description=\"$comment\"#if($field.hidden),hidden=$field.hidden#end)\n private $field.attrType $field.attrName;\n#end\n#if($ChildClassName)\n @ExcelIgnore\n @TableField(exist = false)\n @EntityMapping(thisField = \"$mainField\", joinField = \"$childField\")\n private List<${ChildClassName}Entity> ${childClassName}List;\n#end\n}', '2023-02-23 01:17:53', '2023-06-04 10:45:15', '0', 1, ' ', ' '); +INSERT INTO `gen_template` VALUES (7, 'Mapper', '${backendPath}/src/main/java/${packagePath}/${moduleName}/mapper/${ClassName}Mapper.java', 'Mapper', 'package ${package}.${moduleName}.mapper;\n\nimport com.baomidou.mybatisplus.core.mapper.BaseMapper;\n#if($ChildClassName)\nimport ${package}.${moduleName}.entity.${ChildClassName}Entity;\n#else\nimport ${package}.${moduleName}.entity.${ClassName}Entity;\n#end\nimport org.apache.ibatis.annotations.Mapper;\n\n@Mapper\n#if($ChildClassName)\npublic interface ${ChildClassName}Mapper extends BaseMapper<${ChildClassName}Entity> {\n#else\npublic interface ${ClassName}Mapper extends BaseMapper<${ClassName}Entity> {\n#end\n\n}', '2023-02-23 01:18:18', '2023-07-21 22:01:14', '0', 1, ' ', ' '); +INSERT INTO `gen_template` VALUES (8, 'Mapper.xml', '${backendPath}/src/main/resources/mapper/${ClassName}Mapper.xml', 'Mapper.xml', '\n\n\n\n\n \n#foreach ($field in $fieldList)\n #if($field.primaryPk)\n \n #end\n #if(!$field.primaryPk)\n \n #end\n#end\n \n', '2023-02-23 01:18:35', '2023-06-04 10:34:56', '0', 1, ' ', ' '); +INSERT INTO `gen_template` VALUES (9, '权限菜单', '${backendPath}/menu/${functionName}_menu.sql', 'menu.sql', '-- 该脚本不要直接执行, 注意维护菜单的父节点ID 默认 父节点-1 , 默认租户 1\n#set($menuId=${dateTool.getSystemTime()})\n\n -- 菜单SQL\n insert into `sys_menu` ( `menu_id`,`parent_id`, `path`, `permission`, `menu_type`, `icon`, `del_flag`, `create_time`, `sort_order`, `update_time`, `name`)\n values (${menuId}, \'-1\', \'/${moduleName}/${functionName}/index\', \'\', \'0\', \'icon-bangzhushouji\', \'0\', null , \'8\', null , \'${tableComment}管理\');\n\n-- 按钮父菜单ID\n set @parentId = @@identity;\n\n-- 菜单对应按钮SQL\n insert into `sys_menu` ( `menu_id`,`parent_id`, `permission`, `menu_type`, `path`, `icon`, `del_flag`, `create_time`, `sort_order`, `update_time`, `name`)\n values (${math.add($menuId,1)},${menuId}, \'${moduleName}_${functionName}_view\', \'1\', null, \'1\', \'0\', null, \'0\', null, \'${tableComment}查看\');\n\n insert into `sys_menu` ( `menu_id`,`parent_id`, `permission`, `menu_type`, `path`, `icon`, `del_flag`, `create_time`, `sort_order`, `update_time`, `name`)\n values (${math.add($menuId,2)},${menuId}, \'${moduleName}_${functionName}_add\', \'1\', null, \'1\', \'0\', null, \'1\', null, \'${tableComment}新增\');\n\n insert into `sys_menu` (`menu_id`, `parent_id`, `permission`, `menu_type`, `path`, `icon`, `del_flag`, `create_time`, `sort_order`, `update_time`, `name`)\n values (${math.add($menuId,3)},${menuId}, \'${moduleName}_${functionName}_edit\', \'1\', null, \'1\', \'0\', null, \'2\', null, \'${tableComment}修改\');\n\n insert into `sys_menu` (`menu_id`, `parent_id`, `permission`, `menu_type`, `path`, `icon`, `del_flag`, `create_time`, `sort_order`, `update_time`, `name`)\n values (${math.add($menuId,4)},${menuId}, \'${moduleName}_${functionName}_del\', \'1\', null, \'1\', \'0\', null, \'3\', null, \'${tableComment}删除\');\n\n insert into `sys_menu` ( `menu_id`,`parent_id`, `permission`, `menu_type`, `path`, `icon`, `del_flag`, `create_time`, `sort_order`, `update_time`, `name`)\n values (${math.add($menuId,5)},${menuId}, \'${moduleName}_${functionName}_export\', \'1\', null, \'1\', \'0\', null, \'3\', null, \'导入导出\');', '2023-02-23 01:19:08', '2023-07-21 22:08:16', '0', 1, ' ', ' '); +INSERT INTO `gen_template` VALUES (10, 'api.ts', '${frontendPath}/src/api/${moduleName}/${functionName}.ts', 'api.ts', 'import request from \"/@/utils/request\"\n\nexport function fetchList(query?: Object) {\n return request({\n url: \'/${moduleName}/${functionName}/page\',\n method: \'get\',\n params: query\n })\n}\n\nexport function addObj(obj?: Object) {\n return request({\n url: \'/${moduleName}/${functionName}\',\n method: \'post\',\n data: obj\n })\n}\n\nexport function getObj(id?: string) {\n return request({\n url: \'/${moduleName}/${functionName}/\' + id,\n method: \'get\'\n })\n}\n\nexport function delObjs(ids?: Object) {\n return request({\n url: \'/${moduleName}/${functionName}\',\n method: \'delete\',\n data: ids\n })\n}\n\nexport function putObj(obj?: Object) {\n return request({\n url: \'/${moduleName}/${functionName}\',\n method: \'put\',\n data: obj\n })\n}\n\n#if($ChildClassName)\nexport function delChildObj(ids?: Object) {\n return request({\n url: \'/${moduleName}/${functionName}/child\',\n method: \'delete\',\n data: ids\n })\n}\n#end', '2023-02-23 01:19:23', '2023-06-04 10:34:17', '0', 1, ' ', ' '); +COMMIT; + +-- ---------------------------- +-- Table structure for gen_template_group +-- ---------------------------- +DROP TABLE IF EXISTS `gen_template_group`; +CREATE TABLE `gen_template_group` ( + `group_id` bigint NOT NULL COMMENT '分组id', + `template_id` bigint NOT NULL COMMENT '模板id', + PRIMARY KEY (`group_id`,`template_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='模板分组关联表'; + +-- ---------------------------- +-- Records of gen_template_group +-- ---------------------------- +BEGIN; +INSERT INTO `gen_template_group` VALUES (1, 1); +INSERT INTO `gen_template_group` VALUES (1, 2); +INSERT INTO `gen_template_group` VALUES (1, 3); +INSERT INTO `gen_template_group` VALUES (1, 4); +INSERT INTO `gen_template_group` VALUES (1, 5); +INSERT INTO `gen_template_group` VALUES (1, 6); +INSERT INTO `gen_template_group` VALUES (1, 7); +INSERT INTO `gen_template_group` VALUES (1, 8); +INSERT INTO `gen_template_group` VALUES (1, 9); +INSERT INTO `gen_template_group` VALUES (1, 10); +COMMIT; + SET FOREIGN_KEY_CHECKS = 1; diff --git a/db/pig_config.sql b/db/pig_config.sql index 3a404bb0..ba73c3da 100644 --- a/db/pig_config.sql +++ b/db/pig_config.sql @@ -37,13 +37,13 @@ CREATE TABLE `config_info` ( -- Records of config_info -- ---------------------------- BEGIN; -INSERT INTO `config_info` VALUES (1, 'application-dev.yml', 'DEFAULT_GROUP', '# 配置文件加密根密码\njasypt:\n encryptor:\n password: pig\n algorithm: PBEWithMD5AndDES\n iv-generator-classname: org.jasypt.iv.NoIvGenerator\n \n# Spring 相关\nspring:\n cache:\n type: redis\n redis:\n host: pig-redis\n cloud:\n sentinel:\n eager: true\n transport:\n dashboard: pig-sentinel:5003\n\n# 暴露监控端点\nmanagement:\n endpoints:\n web:\n exposure:\n include: \"*\" \n endpoint:\n health:\n show-details: ALWAYS\n\n\n# feign 配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 10000\n readTimeout: 10000\n compression:\n request:\n enabled: true\n response:\n enabled: true\n\n# mybaits-plus配置\nmybatis-plus:\n mapper-locations: classpath:/mapper/*Mapper.xml\n global-config:\n banner: false\n db-config:\n id-type: auto\n table-underline: true\n logic-delete-value: 1\n logic-not-delete-value: 0\n configuration:\n map-underscore-to-camel-case: true\n\n# swagger 配置\nswagger:\n enabled: true\n title: Pig Swagger API\n gateway: http://${GATEWAY_HOST:pig-gateway}:${GATEWAY-PORT:9999}\n token-url: ${swagger.gateway}/auth/oauth2/token\n scope: server\n services:\n pig-upms-biz: admin\n pig-codegen: gen', '81f8bae4b8125fd198704f797268c6b5', '2022-05-08 12:10:37', '2023-02-28 14:45:23', 'nacos', '127.0.0.1', '', '', '', '', '', 'yaml', '', ''); +INSERT INTO `config_info` VALUES (1, 'application-dev.yml', 'DEFAULT_GROUP', '# 配置文件加密根密码\njasypt:\n encryptor:\n password: pig\n algorithm: PBEWithMD5AndDES\n iv-generator-classname: org.jasypt.iv.NoIvGenerator\n \n# Spring 相关\nspring:\n cache:\n type: redis\n redis:\n host: pig-redis\n cloud:\n sentinel:\n eager: true\n transport:\n dashboard: pig-sentinel:5003\n\n# 暴露监控端点\nmanagement:\n endpoints:\n web:\n exposure:\n include: \"*\" \n endpoint:\n health:\n show-details: ALWAYS\n\n\n# feign 配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 10000\n readTimeout: 10000\n compression:\n request:\n enabled: true\n response:\n enabled: true\n\n# mybaits-plus配置\nmybatis-plus:\n mapper-locations: classpath:/mapper/*Mapper.xml\n type-handlers-package: com.pig4cloud.pig.common.mybatis.handler\n global-config:\n banner: false\n db-config:\n id-type: auto\n table-underline: true\n logic-delete-value: 1\n logic-not-delete-value: 0\n configuration:\n map-underscore-to-camel-case: true\n shrink-whitespaces-in-sql: true\n# swagger 配置\nswagger:\n enabled: true\n title: Pig Swagger API\n gateway: http://${GATEWAY_HOST:pig-gateway}:${GATEWAY-PORT:9999}\n token-url: ${swagger.gateway}/auth/oauth2/token\n scope: server\n services:\n pig-upms-biz: admin\n pig-codegen: gen', 'a07e272a112eaa8d4f7ea2a257bf5076', '2022-05-08 12:10:37', '2023-08-17 21:20:45', 'nacos', '127.0.0.1', '', '', '', '', '', 'yaml', '', ''); INSERT INTO `config_info` VALUES (2, 'pig-auth-dev.yml', 'DEFAULT_GROUP', '# 数据源\nspring:\n freemarker:\n allow-request-override: false\n allow-session-override: false\n cache: true\n charset: UTF-8\n check-template-location: true\n content-type: text/html\n enabled: true\n expose-request-attributes: false\n expose-session-attributes: false\n expose-spring-macro-helpers: true\n prefer-file-system-access: true\n suffix: .ftl\n template-loader-path: classpath:/templates/', '74f53b71c7799aa754da75662378b93c', '2022-05-08 12:10:37', '2022-06-04 14:15:35', 'nacos', '127.0.0.1', '', '', '', '', '', 'yaml', '', ''); INSERT INTO `config_info` VALUES (3, 'pig-codegen-dev.yml', 'DEFAULT_GROUP', '# 数据源配置\nspring:\n datasource:\n type: com.zaxxer.hikari.HikariDataSource\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: root\n password: root\n url: jdbc:mysql://pig-mysql:3306/pig_codegen?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true\n resources:\n static-locations: classpath:/static/,classpath:/views/\n', 'cf786dbe3b07074fc187bf2eab3266b1', '2022-05-08 12:10:37', '2023-01-28 14:05:36', '', '0:0:0:0:0:0:0:1', '', '', '', '', '', 'yaml', '', ''); -INSERT INTO `config_info` VALUES (4, 'pig-gateway-dev.yml', 'DEFAULT_GROUP', 'spring:\n cloud:\n gateway:\n locator:\n enabled: true\n routes:\n # 认证中心\n - id: pig-auth\n uri: lb://pig-auth\n predicates:\n - Path=/auth/**\n filters:\n # 验证码处理\n - ValidateCodeGatewayFilter\n # 前端密码解密\n - PasswordDecoderFilter\n #UPMS 模块\n - id: pig-upms-biz\n uri: lb://pig-upms-biz\n predicates:\n - Path=/admin/**\n filters:\n # 限流配置\n - name: RequestRateLimiter\n args:\n key-resolver: \'#{@remoteAddrKeyResolver}\'\n redis-rate-limiter.replenishRate: 100\n redis-rate-limiter.burstCapacity: 200\n # 代码生成模块\n - id: pig-codegen\n uri: lb://pig-codegen\n predicates:\n - Path=/gen/**\n # 固定路由转发配置 无修改\n - id: openapi\n uri: lb://pig-gateway\n predicates:\n - Path=/v3/api-docs/**\n filters:\n - RewritePath=/v3/api-docs/(?.*), /$\\{path}/$\\{path}/v3/api-docs\n\ngateway:\n encode-key: \'thanks,pig4cloud\'\n ignore-clients:\n - test\n - client', '000988cf0102382d3f23df35027b47fd', '2022-05-08 12:10:37', '2022-06-07 14:00:11', 'nacos', '127.0.0.1', '', '', '', '', '', 'yaml', '', ''); +INSERT INTO `config_info` VALUES (4, 'pig-gateway-dev.yml', 'DEFAULT_GROUP', 'spring:\n cloud:\n gateway:\n locator:\n enabled: true\n routes:\n # 认证中心\n - id: pig-auth\n uri: lb://pig-auth\n predicates:\n - Path=/auth/**\n filters:\n # 验证码处理\n - ValidateCodeGatewayFilter\n # 前端密码解密\n - PasswordDecoderFilter\n #UPMS 模块\n - id: pig-upms-biz\n uri: lb://pig-upms-biz\n predicates:\n - Path=/admin/**\n filters:\n # 限流配置\n - name: RequestRateLimiter\n args:\n key-resolver: \'#{@remoteAddrKeyResolver}\'\n redis-rate-limiter.replenishRate: 100\n redis-rate-limiter.burstCapacity: 200\n # 代码生成模块\n - id: pig-codegen\n uri: lb://pig-codegen\n predicates:\n - Path=/gen/**\n # 代码生成模块\n - id: pig-quartz\n uri: lb://pig-quartz\n predicates:\n - Path=/job/**\n # 固定路由转发配置 无修改\n - id: openapi\n uri: lb://pig-gateway\n predicates:\n - Path=/v3/api-docs/**\n filters:\n - RewritePath=/v3/api-docs/(?.*), /$\\{path}/$\\{path}/v3/api-docs\n\ngateway:\n encode-key: \'thanks,pig4cloud\'\n ignore-clients:\n - test\n - client', 'cde041935aeeb2a5f59bf3b56d78f56d', '2022-05-08 12:10:37', '2023-07-05 13:50:59', 'nacos', '0:0:0:0:0:0:0:1', '', '', '', '', '', 'yaml', '', ''); INSERT INTO `config_info` VALUES (5, 'pig-monitor-dev.yml', 'DEFAULT_GROUP', 'spring:\n autoconfigure:\n exclude: com.pig4cloud.pig.common.core.config.JacksonConfiguration\n # 安全配置\n security:\n user:\n name: ENC(8Hk2ILNJM8UTOuW/Xi75qg==) # pig\n password: ENC(o6cuPFfUevmTbkmBnE67Ow====) # pig\n', '650bdfa15f60f3faa84dfe6e6878b8cf', '2022-05-08 12:10:37', '2022-05-08 12:10:37', NULL, '127.0.0.1', '', '', NULL, NULL, NULL, 'yaml', NULL, ''); -INSERT INTO `config_info` VALUES (6, 'pig-upms-biz-dev.yml', 'DEFAULT_GROUP', '# 数据源\nspring:\n datasource:\n type: com.zaxxer.hikari.HikariDataSource\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: root\n password: root\n url: jdbc:mysql://pig-mysql:3306/pig?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true\n\n# 文件上传相关 支持阿里云、华为云、腾讯、minio\noss:\n endpoint: http://minio.pig4cloud.com\n accessKey: lengleng\n secretKey: lengleng\n bucket-name: tmp', '899d2431d91da0d521378cc7fa61268d', '2022-05-08 12:10:37', '2023-01-28 14:01:46', '', '0:0:0:0:0:0:0:1', '', '', '', '', '', 'yaml', '', ''); -INSERT INTO `config_info` VALUES (7, 'pig-xxl-job-admin-dev.yml', 'DEFAULT_GROUP', '# xxl\nxxl:\n job:\n accessToken: default_token\n i18n: zh_CN\n logretentiondays: 30\n triggerpool:\n fast.max: 200\n slow.max: 200\n\n# mybatis\nmybatis:\n mapper-locations: classpath:/mybatis-mapper/*Mapper.xml\n\nspring:\n datasource:\n url: jdbc:mysql://${MYSQL_HOST:pig-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pig_job}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n mvc:\n static-path-pattern: /static/**\n freemarker:\n suffix: .ftl\n request-context-attribute: request\n settings:\n number_format: 0.##########\n mail:\n host: smtp.mxhichina.com\n port: 465\n from: xxxx@gitee.wang\n username: xxxx@gitee.wang\n password: xxxx\n properties:\n mail:\n smtp:\n auth: true\n ssl.enable: true\n starttls.enable: false\n required: false\n# spring boot admin 配置\n\nmanagement:\n health:\n mail:\n enabled: false\n endpoints:\n web:\n exposure:\n include: \'*\'\n endpoint:\n health:\n show-details: ALWAYS\n\n', 'b67cbbd37c8b42cdc6521780b3ed742a', '2022-11-27 17:23:42', '2022-11-27 17:28:01', 'nacos', '0:0:0:0:0:0:0:1', '', '', '', '', '', 'yaml', '', ''); +INSERT INTO `config_info` VALUES (6, 'pig-upms-biz-dev.yml', 'DEFAULT_GROUP', '# 数据源\nspring:\n datasource:\n type: com.zaxxer.hikari.HikariDataSource\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: root\n password: root\n url: jdbc:mysql://pig-mysql:3306/pig?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true\n\n# 文件上传相关 支持阿里云、华为云、腾讯、minio\nfile:\n bucketName: s3demo \n local:\n enable: true\n base-path: /Users/lengleng/Downloads/img', '48f8db128aeb5debb331bae49ff37908', '2022-05-08 12:10:37', '2023-07-07 14:44:09', 'nacos', '0:0:0:0:0:0:0:1', '', '', '', '', '', 'yaml', '', ''); +INSERT INTO `config_info` VALUES (7, 'pig-quartz-dev.yml', 'DEFAULT_GROUP', 'spring:\n datasource:\n type: com.zaxxer.hikari.HikariDataSource\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: root\n password: root\n url: jdbc:mysql://pig-mysql:4000/pig_job?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true\n quartz:\n #相关属性配置\n properties:\n org:\n quartz:\n scheduler:\n instanceName: clusteredScheduler\n instanceId: AUTO\n jobStore:\n class: org.springframework.scheduling.quartz.LocalDataSourceJobStore\n driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate\n tablePrefix: QRTZ_\n isClustered: true\n clusterCheckinInterval: 10000\n useProperties: false\n threadPool:\n class: org.quartz.simpl.SimpleThreadPool\n threadCount: 50\n threadPriority: 5\n threadsInheritContextClassLoaderOfInitializingThread: true\n #数据库方式\n job-store-type: jdbc\n #初始化表结构 (第一次启动自动创建表,后续改成never 即可)\n jdbc:\n initialize-schema: always\n\n', '7a2859cbd056ef554b6163f5c70dfcf5', '2023-07-02 12:24:33', '2023-08-17 20:44:54', 'nacos', '127.0.0.1', '', '', '', '', '', 'yaml', '', ''); COMMIT; -- ---------------------------- diff --git a/db/pig_job.sql b/db/pig_job.sql index 76617829..f78adefa 100644 --- a/db/pig_job.sql +++ b/db/pig_job.sql @@ -2,119 +2,57 @@ DROP DATABASE IF EXISTS `pig_job`; CREATE DATABASE `pig_job` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; -use `pig_job`; +USE pig_job; -SET NAMES utf8mb4; - -CREATE TABLE `xxl_job_info` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `job_group` int(11) NOT NULL COMMENT '执行器主键ID', - `job_desc` varchar(255) NOT NULL, - `add_time` datetime DEFAULT NULL, - `update_time` datetime DEFAULT NULL, - `author` varchar(64) DEFAULT NULL COMMENT '作者', - `alarm_email` varchar(255) DEFAULT NULL COMMENT '报警邮件', - `schedule_type` varchar(50) NOT NULL DEFAULT 'NONE' COMMENT '调度类型', - `schedule_conf` varchar(128) DEFAULT NULL COMMENT '调度配置,值含义取决于调度类型', - `misfire_strategy` varchar(50) NOT NULL DEFAULT 'DO_NOTHING' COMMENT '调度过期策略', - `executor_route_strategy` varchar(50) DEFAULT NULL COMMENT '执行器路由策略', - `executor_handler` varchar(255) DEFAULT NULL COMMENT '执行器任务handler', - `executor_param` varchar(512) DEFAULT NULL COMMENT '执行器任务参数', - `executor_block_strategy` varchar(50) DEFAULT NULL COMMENT '阻塞处理策略', - `executor_timeout` int(11) NOT NULL DEFAULT '0' COMMENT '任务执行超时时间,单位秒', - `executor_fail_retry_count` int(11) NOT NULL DEFAULT '0' COMMENT '失败重试次数', - `glue_type` varchar(50) NOT NULL COMMENT 'GLUE类型', - `glue_source` mediumtext COMMENT 'GLUE源代码', - `glue_remark` varchar(128) DEFAULT NULL COMMENT 'GLUE备注', - `glue_updatetime` datetime DEFAULT NULL COMMENT 'GLUE更新时间', - `child_jobid` varchar(255) DEFAULT NULL COMMENT '子任务ID,多个逗号分隔', - `trigger_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '调度状态:0-停止,1-运行', - `trigger_last_time` bigint(13) NOT NULL DEFAULT '0' COMMENT '上次调度时间', - `trigger_next_time` bigint(13) NOT NULL DEFAULT '0' COMMENT '下次调度时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; - -CREATE TABLE `xxl_job_log` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `job_group` int(11) NOT NULL COMMENT '执行器主键ID', - `job_id` int(11) NOT NULL COMMENT '任务,主键ID', - `executor_address` varchar(255) DEFAULT NULL COMMENT '执行器地址,本次执行的地址', - `executor_handler` varchar(255) DEFAULT NULL COMMENT '执行器任务handler', - `executor_param` varchar(512) DEFAULT NULL COMMENT '执行器任务参数', - `executor_sharding_param` varchar(20) DEFAULT NULL COMMENT '执行器任务分片参数,格式如 1/2', - `executor_fail_retry_count` int(11) NOT NULL DEFAULT '0' COMMENT '失败重试次数', - `trigger_time` datetime DEFAULT NULL COMMENT '调度-时间', - `trigger_code` int(11) NOT NULL COMMENT '调度-结果', - `trigger_msg` text COMMENT '调度-日志', - `handle_time` datetime DEFAULT NULL COMMENT '执行-时间', - `handle_code` int(11) NOT NULL COMMENT '执行-状态', - `handle_msg` text COMMENT '执行-日志', - `alarm_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '告警状态:0-默认、1-无需告警、2-告警成功、3-告警失败', - PRIMARY KEY (`id`), - KEY `I_trigger_time` (`trigger_time`), - KEY `I_handle_code` (`handle_code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; - -CREATE TABLE `xxl_job_log_report` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `trigger_day` datetime DEFAULT NULL COMMENT '调度-时间', - `running_count` int(11) NOT NULL DEFAULT '0' COMMENT '运行中-日志数量', - `suc_count` int(11) NOT NULL DEFAULT '0' COMMENT '执行成功-日志数量', - `fail_count` int(11) NOT NULL DEFAULT '0' COMMENT '执行失败-日志数量', - `update_time` datetime DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `i_trigger_day` (`trigger_day`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; - -CREATE TABLE `xxl_job_logglue` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `job_id` int(11) NOT NULL COMMENT '任务,主键ID', - `glue_type` varchar(50) DEFAULT NULL COMMENT 'GLUE类型', - `glue_source` mediumtext COMMENT 'GLUE源代码', - `glue_remark` varchar(128) NOT NULL COMMENT 'GLUE备注', - `add_time` datetime DEFAULT NULL, - `update_time` datetime DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; - -CREATE TABLE `xxl_job_registry` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `registry_group` varchar(50) NOT NULL, - `registry_key` varchar(255) NOT NULL, - `registry_value` varchar(255) NOT NULL, - `update_time` datetime DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `i_g_k_v` (`registry_group`,`registry_key`,`registry_value`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; - -CREATE TABLE `xxl_job_group` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `app_name` varchar(64) NOT NULL COMMENT '执行器AppName', - `title` varchar(12) NOT NULL COMMENT '执行器名称', - `address_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '执行器地址类型:0=自动注册、1=手动录入', - `address_list` text COMMENT '执行器地址列表,多地址逗号分隔', - `update_time` datetime DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; - -CREATE TABLE `xxl_job_user` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `username` varchar(50) NOT NULL COMMENT '账号', - `password` varchar(50) NOT NULL COMMENT '密码', - `role` tinyint(4) NOT NULL COMMENT '角色:0-普通用户、1-管理员', - `permission` varchar(255) DEFAULT NULL COMMENT '权限:执行器ID列表,多个逗号分割', - PRIMARY KEY (`id`), - UNIQUE KEY `i_username` (`username`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; - -CREATE TABLE `xxl_job_lock` ( - `lock_name` varchar(50) NOT NULL COMMENT '锁名称', - PRIMARY KEY (`lock_name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; - -INSERT INTO `xxl_job_group`(`id`, `app_name`, `title`, `address_type`, `address_list`, `update_time`) VALUES (1, 'xxl-job-executor-sample', '示例执行器', 0, NULL, '2018-11-03 22:21:31' ); -INSERT INTO `xxl_job_info`(`id`, `job_group`, `job_desc`, `add_time`, `update_time`, `author`, `alarm_email`, `schedule_type`, `schedule_conf`, `misfire_strategy`, `executor_route_strategy`, `executor_handler`, `executor_param`, `executor_block_strategy`, `executor_timeout`, `executor_fail_retry_count`, `glue_type`, `glue_source`, `glue_remark`, `glue_updatetime`, `child_jobid`) VALUES (1, 1, '测试任务1', '2018-11-03 22:21:31', '2018-11-03 22:21:31', 'XXL', '', 'CRON', '0 0 0 * * ? *', 'DO_NOTHING', 'FIRST', 'demoJobHandler', '', 'SERIAL_EXECUTION', 0, 0, 'BEAN', '', 'GLUE代码初始化', '2018-11-03 22:21:31', ''); -INSERT INTO `xxl_job_user`(`id`, `username`, `password`, `role`, `permission`) VALUES (1, 'admin', 'e10adc3949ba59abbe56e057f20f883e', 1, NULL); -INSERT INTO `xxl_job_lock` ( `lock_name`) VALUES ( 'schedule_lock'); +-- ---------------------------- +-- Table structure for sys_job +-- ---------------------------- +DROP TABLE IF EXISTS `sys_job`; +CREATE TABLE `sys_job` ( + `job_id` bigint NOT NULL COMMENT '任务id', + `job_name` varchar(64) CHARACTER SET utf8mb4 NOT NULL COMMENT '任务名称', + `job_group` varchar(64) CHARACTER SET utf8mb4 NOT NULL COMMENT '任务组名', + `job_order` char(1) CHARACTER SET utf8mb4 DEFAULT '1' COMMENT '组内执行顺利,值越大执行优先级越高,最大值9,最小值1', + `job_type` char(1) CHARACTER SET utf8mb4 NOT NULL DEFAULT '1' COMMENT '1、java类;2、spring bean名称;3、rest调用;4、jar调用;9其他', + `execute_path` varchar(500) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT 'job_type=3时,rest调用地址,仅支持rest get协议,需要增加String返回值,0成功,1失败;job_type=4时,jar路径;其它值为空', + `class_name` varchar(500) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT 'job_type=1时,类完整路径;job_type=2时,spring bean名称;其它值为空', + `method_name` varchar(500) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '任务方法', + `method_params_value` varchar(2000) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '参数值', + `cron_expression` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT 'cron执行表达式', + `misfire_policy` varchar(20) CHARACTER SET utf8mb4 DEFAULT '3' COMMENT '错失执行策略(1错失周期立即执行 2错失周期执行一次 3下周期执行)', + `job_tenant_type` char(1) CHARACTER SET utf8mb4 DEFAULT '1' COMMENT '1、多租户任务;2、非多租户任务', + `job_status` char(1) CHARACTER SET utf8mb4 DEFAULT '0' COMMENT '状态(1、未发布;2、运行中;3、暂停;4、删除;)', + `job_execute_status` char(1) CHARACTER SET utf8mb4 DEFAULT '0' COMMENT '状态(0正常 1异常)', + `create_by` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', + `start_time` timestamp NULL DEFAULT NULL COMMENT '初次执行时间', + `previous_time` timestamp NULL DEFAULT NULL COMMENT '上次执行时间', + `next_time` timestamp NULL DEFAULT NULL COMMENT '下次执行时间', + `remark` varchar(500) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '备注信息', + PRIMARY KEY (`job_id`,`job_name`,`job_group`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='定时任务调度表'; +-- ---------------------------- +DROP TABLE IF EXISTS `sys_job_log`; +CREATE TABLE `sys_job_log` ( + `job_log_id` bigint NOT NULL COMMENT '任务日志ID', + `job_id` bigint NOT NULL COMMENT '任务id', + `job_name` varchar(64) CHARACTER SET utf8 DEFAULT NULL COMMENT '任务名称', + `job_group` varchar(64) CHARACTER SET utf8 DEFAULT NULL COMMENT '任务组名', + `job_order` char(1) CHARACTER SET utf8 DEFAULT NULL COMMENT '组内执行顺利,值越大执行优先级越高,最大值9,最小值1', + `job_type` char(1) CHARACTER SET utf8 NOT NULL DEFAULT '1' COMMENT '1、java类;2、spring bean名称;3、rest调用;4、jar调用;9其他', + `execute_path` varchar(500) CHARACTER SET utf8 DEFAULT NULL COMMENT 'job_type=3时,rest调用地址,仅支持post协议;job_type=4时,jar路径;其它值为空', + `class_name` varchar(500) CHARACTER SET utf8 DEFAULT NULL COMMENT 'job_type=1时,类完整路径;job_type=2时,spring bean名称;其它值为空', + `method_name` varchar(500) CHARACTER SET utf8 DEFAULT NULL COMMENT '任务方法', + `method_params_value` varchar(2000) CHARACTER SET utf8 DEFAULT NULL COMMENT '参数值', + `cron_expression` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT 'cron执行表达式', + `job_message` varchar(500) CHARACTER SET utf8 DEFAULT NULL COMMENT '日志信息', + `job_log_status` char(1) CHARACTER SET utf8 DEFAULT '0' COMMENT '执行状态(0正常 1失败)', + `execute_time` varchar(30) CHARACTER SET utf8 DEFAULT NULL COMMENT '执行时间', + `exception_info` varchar(2000) CHARACTER SET utf8 DEFAULT '' COMMENT '异常信息', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + PRIMARY KEY (`job_log_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='定时任务执行日志表'; commit; diff --git a/docker-compose.yml b/docker-compose.yml index 3380751d..bebfe470 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,12 +9,20 @@ services: restart: always container_name: pig-mysql image: pig-mysql + ports: + - 3306:3306 + networks: + - spring_cloud_default pig-redis: image: redis:7.0.0 + ports: + - 6379:6379 restart: always container_name: pig-redis hostname: pig-redis + networks: + - spring_cloud_default pig-register: build: @@ -25,6 +33,8 @@ services: container_name: pig-register hostname: pig-register image: pig-register + networks: + - spring_cloud_default pig-gateway: build: @@ -35,6 +45,8 @@ services: container_name: pig-gateway hostname: pig-gateway image: pig-gateway + networks: + - spring_cloud_default pig-auth: build: @@ -43,6 +55,8 @@ services: container_name: pig-auth hostname: pig-auth image: pig-auth + networks: + - spring_cloud_default pig-upms: build: @@ -51,6 +65,8 @@ services: container_name: pig-upms hostname: pig-upms image: pig-upms + networks: + - spring_cloud_default pig-monitor: build: @@ -61,15 +77,8 @@ services: container_name: pig-monitor hostname: pig-monitor image: pig-monitor - - pig-sentinel: - build: - context: ./pig-visual/pig-sentinel-dashboard - restart: always - image: pig-sentinel - container_name: pig-sentinel - ports: - - 5003:5003 + networks: + - spring_cloud_default pig-codegen: build: @@ -78,13 +87,19 @@ services: container_name: pig-codegen hostname: pig-codegen image: pig-codegen + networks: + - spring_cloud_default - pig-job: + pig-quartz: build: - context: ./pig-visual/pig-xxl-job-admin + context: ./pig-visual/pig-quartz restart: always - container_name: pig-job - hostname: pig-job - image: pig-job - ports: - - 5004:5004 + image: pig-quartz + container_name: pig-quartz + networks: + - spring_cloud_default + +networks: + spring_cloud_default: + name: spring_cloud_default + driver: bridge diff --git a/pig-auth/pom.xml b/pig-auth/pom.xml index 9557d78d..50348180 100755 --- a/pig-auth/pom.xml +++ b/pig-auth/pom.xml @@ -21,7 +21,7 @@ com.pig4cloud pig - 3.6.7 + 3.7.0-JDK8 pig-auth diff --git a/pig-auth/src/main/java/com/pig4cloud/pig/auth/endpoint/PigTokenEndpoint.java b/pig-auth/src/main/java/com/pig4cloud/pig/auth/endpoint/PigTokenEndpoint.java index 51b358ed..a9c951da 100644 --- a/pig-auth/src/main/java/com/pig4cloud/pig/auth/endpoint/PigTokenEndpoint.java +++ b/pig-auth/src/main/java/com/pig4cloud/pig/auth/endpoint/PigTokenEndpoint.java @@ -27,6 +27,7 @@ import com.pig4cloud.pig.admin.api.vo.TokenVo; import com.pig4cloud.pig.auth.support.handler.PigAuthenticationFailureEventHandler; import com.pig4cloud.pig.common.core.constant.CacheConstants; import com.pig4cloud.pig.common.core.constant.CommonConstants; +import com.pig4cloud.pig.common.core.constant.SecurityConstants; import com.pig4cloud.pig.common.core.util.R; import com.pig4cloud.pig.common.core.util.RetOps; import com.pig4cloud.pig.common.core.util.SpringContextHolder; @@ -34,6 +35,8 @@ import com.pig4cloud.pig.common.security.annotation.Inner; import com.pig4cloud.pig.common.security.util.OAuth2EndpointUtils; import com.pig4cloud.pig.common.security.util.OAuth2ErrorCodesExpand; import com.pig4cloud.pig.common.security.util.OAuthClientException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; @@ -59,8 +62,6 @@ import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.security.Principal; import java.util.List; import java.util.Map; @@ -107,7 +108,8 @@ public class PigTokenEndpoint { @RequestParam(OAuth2ParameterNames.CLIENT_ID) String clientId, @RequestParam(OAuth2ParameterNames.SCOPE) String scope, @RequestParam(OAuth2ParameterNames.STATE) String state) { - SysOauthClientDetails clientDetails = RetOps.of(clientDetailsService.getClientDetailsById(clientId)) + SysOauthClientDetails clientDetails = RetOps + .of(clientDetailsService.getClientDetailsById(clientId, SecurityConstants.FROM_IN)) .getData() .orElseThrow(() -> new OAuthClientException("clientId 不合法")); diff --git a/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/base/OAuth2ResourceOwnerBaseAuthenticationConverter.java b/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/base/OAuth2ResourceOwnerBaseAuthenticationConverter.java index 2f681311..9082042e 100644 --- a/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/base/OAuth2ResourceOwnerBaseAuthenticationConverter.java +++ b/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/base/OAuth2ResourceOwnerBaseAuthenticationConverter.java @@ -1,6 +1,7 @@ package com.pig4cloud.pig.auth.support.base; import com.pig4cloud.pig.common.security.util.OAuth2EndpointUtils; +import javax.servlet.http.HttpServletRequest; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.oauth2.core.OAuth2ErrorCodes; @@ -9,7 +10,6 @@ import org.springframework.security.web.authentication.AuthenticationConverter; import org.springframework.util.MultiValueMap; import org.springframework.util.StringUtils; -import javax.servlet.http.HttpServletRequest; import java.util.Arrays; import java.util.HashSet; import java.util.Map; diff --git a/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/base/OAuth2ResourceOwnerBaseAuthenticationProvider.java b/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/base/OAuth2ResourceOwnerBaseAuthenticationProvider.java index 0ef6892c..22044ec1 100644 --- a/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/base/OAuth2ResourceOwnerBaseAuthenticationProvider.java +++ b/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/base/OAuth2ResourceOwnerBaseAuthenticationProvider.java @@ -3,7 +3,6 @@ package com.pig4cloud.pig.auth.support.base; import cn.hutool.extra.spring.SpringUtil; import com.pig4cloud.pig.common.security.util.OAuth2ErrorCodesExpand; import com.pig4cloud.pig.common.security.util.ScopeException; -import lombok.extern.slf4j.Slf4j; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.context.support.MessageSourceAccessor; @@ -36,7 +35,6 @@ import java.util.function.Supplier; * * 处理自定义授权 */ -@Slf4j public abstract class OAuth2ResourceOwnerBaseAuthenticationProvider implements AuthenticationProvider { @@ -111,29 +109,29 @@ public abstract class OAuth2ResourceOwnerBaseAuthenticationProvider authorizedScopes; // Default to configured scopes - if (!CollectionUtils.isEmpty(resourceOwnerBaseAuthentication.getScopes())) { - for (String requestedScope : resourceOwnerBaseAuthentication.getScopes()) { + if (!CollectionUtils.isEmpty(resouceOwnerBaseAuthentication.getScopes())) { + for (String requestedScope : resouceOwnerBaseAuthentication.getScopes()) { if (!registeredClient.getScopes().contains(requestedScope)) { throw new OAuth2AuthenticationException(OAuth2ErrorCodes.INVALID_SCOPE); } } - authorizedScopes = new LinkedHashSet<>(resourceOwnerBaseAuthentication.getScopes()); + authorizedScopes = new LinkedHashSet<>(resouceOwnerBaseAuthentication.getScopes()); } else { - throw new ScopeException(OAuth2ErrorCodesExpand.SCOPE_IS_EMPTY); + authorizedScopes = new LinkedHashSet<>(); } - Map reqParameters = resourceOwnerBaseAuthentication.getAdditionalParameters(); + Map reqParameters = resouceOwnerBaseAuthentication.getAdditionalParameters(); try { UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = buildToken(reqParameters); @@ -149,14 +147,14 @@ public abstract class OAuth2ResourceOwnerBaseAuthenticationProvider logout.logoutSuccessHandler(new SsoLogoutSuccessHandler()) + .deleteCookies("JSESSIONID") + .invalidateHttpSession(true)) // SSO登出成功处理 + + .csrf(AbstractHttpConfigurer::disable); } } diff --git a/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/core/PigDaoAuthenticationProvider.java b/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/core/PigDaoAuthenticationProvider.java index 1be78b53..67463377 100644 --- a/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/core/PigDaoAuthenticationProvider.java +++ b/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/core/PigDaoAuthenticationProvider.java @@ -1,11 +1,11 @@ package com.pig4cloud.pig.auth.support.core; import cn.hutool.core.util.StrUtil; -import cn.hutool.extra.servlet.ServletUtil; import cn.hutool.extra.spring.SpringUtil; import com.pig4cloud.pig.common.core.constant.SecurityConstants; import com.pig4cloud.pig.common.core.util.WebUtils; import com.pig4cloud.pig.common.security.service.PigUserDetailsService; +import javax.servlet.http.HttpServletRequest; import lombok.SneakyThrows; import org.springframework.core.Ordered; import org.springframework.security.authentication.BadCredentialsException; @@ -24,7 +24,6 @@ import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames; import org.springframework.security.web.authentication.www.BasicAuthenticationConverter; import org.springframework.util.Assert; -import javax.servlet.http.HttpServletRequest; import java.util.Comparator; import java.util.Map; import java.util.Optional; @@ -70,7 +69,7 @@ public class PigDaoAuthenticationProvider extends AbstractUserDetailsAuthenticat // app 模式不用校验密码 String grantType = WebUtils.getRequest().get().getParameter(OAuth2ParameterNames.GRANT_TYPE); - if (StrUtil.equals(SecurityConstants.APP, grantType)) { + if (StrUtil.equals(SecurityConstants.MOBILE, grantType)) { return; } @@ -89,15 +88,15 @@ public class PigDaoAuthenticationProvider extends AbstractUserDetailsAuthenticat @SneakyThrows @Override + protected final UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication) { prepareTimingAttackProtection(); HttpServletRequest request = WebUtils.getRequest() .orElseThrow( (Supplier) () -> new InternalAuthenticationServiceException("web request is empty")); - Map paramMap = ServletUtil.getParamMap(request); - String grantType = paramMap.get(OAuth2ParameterNames.GRANT_TYPE); - String clientId = paramMap.get(OAuth2ParameterNames.CLIENT_ID); + String grantType = WebUtils.getRequest().get().getParameter(OAuth2ParameterNames.GRANT_TYPE); + String clientId = WebUtils.getRequest().get().getParameter(OAuth2ParameterNames.CLIENT_ID); if (StrUtil.isBlank(clientId)) { clientId = basicConvert.convert(request).getName(); diff --git a/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/handler/FormAuthenticationFailureHandler.java b/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/handler/FormAuthenticationFailureHandler.java index f4c0ad5f..636af33e 100644 --- a/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/handler/FormAuthenticationFailureHandler.java +++ b/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/handler/FormAuthenticationFailureHandler.java @@ -19,14 +19,13 @@ package com.pig4cloud.pig.auth.support.handler; import cn.hutool.core.util.CharsetUtil; import cn.hutool.http.HttpUtil; import com.pig4cloud.pig.common.core.util.WebUtils; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.authentication.AuthenticationFailureHandler; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - /** * @author lengleng * @date 2022-06-02 diff --git a/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/handler/PigAuthenticationFailureEventHandler.java b/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/handler/PigAuthenticationFailureEventHandler.java index 979282e1..cdf42d2a 100644 --- a/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/handler/PigAuthenticationFailureEventHandler.java +++ b/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/handler/PigAuthenticationFailureEventHandler.java @@ -23,10 +23,11 @@ import com.pig4cloud.pig.common.core.constant.SecurityConstants; import com.pig4cloud.pig.common.core.util.MsgUtils; import com.pig4cloud.pig.common.core.util.R; import com.pig4cloud.pig.common.core.util.SpringContextHolder; -import com.pig4cloud.pig.common.core.util.WebUtils; import com.pig4cloud.pig.common.log.event.SysLogEvent; import com.pig4cloud.pig.common.log.util.LogTypeEnum; import com.pig4cloud.pig.common.log.util.SysLogUtils; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; @@ -38,8 +39,6 @@ import org.springframework.security.oauth2.core.OAuth2AuthenticationException; import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames; import org.springframework.security.web.authentication.AuthenticationFailureHandler; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** @@ -67,7 +66,7 @@ public class PigAuthenticationFailureEventHandler implements AuthenticationFailu log.info("用户:{} 登录失败,异常:{}", username, exception.getLocalizedMessage()); SysLog logVo = SysLogUtils.getSysLog(); logVo.setTitle("登录失败"); - logVo.setType(LogTypeEnum.ERROR.getType()); + logVo.setLogType(LogTypeEnum.ERROR.getType()); logVo.setException(exception.getLocalizedMessage()); // 发送异步日志事件 String startTimeStr = request.getHeader(CommonConstants.REQUEST_START_TIME); @@ -76,10 +75,7 @@ public class PigAuthenticationFailureEventHandler implements AuthenticationFailu Long endTime = System.currentTimeMillis(); logVo.setTime(endTime - startTime); } - - logVo.setServiceId(WebUtils.getClientId()); logVo.setCreateBy(username); - logVo.setUpdateBy(username); SpringContextHolder.publishEvent(new SysLogEvent(logVo)); // 写出错误信息 sendErrorResponse(request, response, exception); @@ -103,7 +99,7 @@ public class PigAuthenticationFailureEventHandler implements AuthenticationFailu // 手机号登录 String grantType = request.getParameter(OAuth2ParameterNames.GRANT_TYPE); - if (SecurityConstants.APP.equals(grantType)) { + if (SecurityConstants.MOBILE.equals(grantType)) { errorMessage = MsgUtils.getSecurityMessage("AbstractUserDetailsAuthenticationProvider.smsBadCredentials"); } diff --git a/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/handler/PigAuthenticationSuccessEventHandler.java b/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/handler/PigAuthenticationSuccessEventHandler.java index 09e6f01f..40dff7d5 100644 --- a/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/handler/PigAuthenticationSuccessEventHandler.java +++ b/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/handler/PigAuthenticationSuccessEventHandler.java @@ -24,24 +24,23 @@ import com.pig4cloud.pig.common.core.constant.SecurityConstants; import com.pig4cloud.pig.common.core.util.SpringContextHolder; import com.pig4cloud.pig.common.log.event.SysLogEvent; import com.pig4cloud.pig.common.log.util.SysLogUtils; +import com.pig4cloud.pig.common.security.component.PigCustomOAuth2AccessTokenResponseHttpMessageConverter; import com.pig4cloud.pig.common.security.service.PigUser; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.server.ServletServerHttpResponse; import org.springframework.security.core.Authentication; -import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.oauth2.core.OAuth2AccessToken; import org.springframework.security.oauth2.core.OAuth2RefreshToken; import org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse; -import org.springframework.security.oauth2.core.http.converter.OAuth2AccessTokenResponseHttpMessageConverter; import org.springframework.security.oauth2.server.authorization.authentication.OAuth2AccessTokenAuthenticationToken; import org.springframework.security.web.authentication.AuthenticationSuccessHandler; import org.springframework.util.CollectionUtils; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.time.temporal.ChronoUnit; import java.util.Map; @@ -53,7 +52,7 @@ import java.util.Map; @Slf4j public class PigAuthenticationSuccessEventHandler implements AuthenticationSuccessHandler { - private final HttpMessageConverter accessTokenHttpResponseConverter = new OAuth2AccessTokenResponseHttpMessageConverter(); + private final HttpMessageConverter accessTokenHttpResponseConverter = new PigCustomOAuth2AccessTokenResponseHttpMessageConverter(); /** * Called when a user has been successfully authenticated. @@ -72,10 +71,7 @@ public class PigAuthenticationSuccessEventHandler implements AuthenticationSucce // 发送异步日志事件 PigUser userInfo = (PigUser) map.get(SecurityConstants.DETAILS_USER); log.info("用户:{} 登录成功", userInfo.getName()); - // 避免 race condition - SecurityContext context = SecurityContextHolder.createEmptyContext(); - context.setAuthentication(accessTokenAuthentication); - SecurityContextHolder.setContext(context); + SecurityContextHolder.getContext().setAuthentication(accessTokenAuthentication); SysLog logVo = SysLogUtils.getSysLog(); logVo.setTitle("登录成功"); String startTimeStr = request.getHeader(CommonConstants.REQUEST_START_TIME); @@ -84,10 +80,7 @@ public class PigAuthenticationSuccessEventHandler implements AuthenticationSucce Long endTime = System.currentTimeMillis(); logVo.setTime(endTime - startTime); } - - logVo.setServiceId(accessTokenAuthentication.getRegisteredClient().getClientId()); logVo.setCreateBy(userInfo.getName()); - logVo.setUpdateBy(userInfo.getName()); SpringContextHolder.publishEvent(new SysLogEvent(logVo)); } @@ -121,6 +114,7 @@ public class PigAuthenticationSuccessEventHandler implements AuthenticationSucce // 无状态 注意删除 context 上下文的信息 SecurityContextHolder.clearContext(); + this.accessTokenHttpResponseConverter.write(accessTokenResponse, null, httpResponse); } diff --git a/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/handler/PigLogoutSuccessEventHandler.java b/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/handler/PigLogoutSuccessEventHandler.java index b929345b..cbd10860 100644 --- a/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/handler/PigLogoutSuccessEventHandler.java +++ b/pig-auth/src/main/java/com/pig4cloud/pig/auth/support/handler/PigLogoutSuccessEventHandler.java @@ -70,7 +70,6 @@ public class PigLogoutSuccessEventHandler implements ApplicationListenercom.pig4cloud pig-common-bom - 3.6.7 + 3.7.0-JDK8 pom pig-common-bom @@ -15,7 +15,7 @@ ${project.version} - 2.7.10 + 2.7.13 UTF-8 2.17.1 1.8 @@ -25,15 +25,17 @@ 1.2.83 1.6.9 2.2.0 - 3.5.3.1 + 3.5.3.2 + 4.1.3 8.0.33 1.6.1 1.2.6 7.1 + 1.11.543 1.0.5 2.0.2 2.3.5 - 5.8.20 + 5.8.21 2.7.4 1.8.4 @@ -91,6 +93,11 @@ pig-common-xss ${pig.common.version} + + com.pig4cloud + pig-common-oss + ${pig.common.version} + com.pig4cloud pig-upms-api @@ -134,6 +141,18 @@ excel-spring-boot-starter ${excel.version} + + + com.baomidou + dynamic-datasource-spring-boot-starter + ${dynamic-ds.version} + + + + com.amazonaws + aws-java-sdk-s3 + ${aws.version} + io.springboot.sms diff --git a/pig-common/pig-common-core/pom.xml b/pig-common/pig-common-core/pom.xml index 6b3a2332..205af844 100755 --- a/pig-common/pig-common-core/pom.xml +++ b/pig-common/pig-common-core/pom.xml @@ -21,7 +21,7 @@ com.pig4cloud pig-common - 3.6.7 + 3.7.0-JDK8 pig-common-core diff --git a/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/constant/CacheConstants.java b/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/constant/CacheConstants.java index 0de69d68..cc4e6174 100644 --- a/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/constant/CacheConstants.java +++ b/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/constant/CacheConstants.java @@ -29,11 +29,6 @@ public interface CacheConstants { */ String PROJECT_OAUTH_ACCESS = "token::access_token"; - /** - * oauth 缓存令牌前缀 - */ - String PROJECT_OAUTH_TOKEN = "pig_oauth:token:"; - /** * 验证码前缀 */ @@ -54,6 +49,11 @@ public interface CacheConstants { */ String DICT_DETAILS = "dict_details"; + /** + * 角色信息缓存 + */ + String ROLE_DETAILS = "role_details"; + /** * oauth 客户端信息 */ diff --git a/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/constant/SecurityConstants.java b/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/constant/SecurityConstants.java index 15b2a312..acda5fa6 100755 --- a/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/constant/SecurityConstants.java +++ b/pig-common/pig-common-core/src/main/java/com/pig4cloud/pig/common/core/constant/SecurityConstants.java @@ -65,7 +65,7 @@ public interface SecurityConstants { /** * 手机号登录 */ - String APP = "app"; + String MOBILE = "mobile"; /** * {bcrypt} 加密的特征码 @@ -92,6 +92,11 @@ public interface SecurityConstants { */ String DETAILS_USER = "user_info"; + /** + * 用户ID + */ + String DETAILS_USER_ID = "user_id"; + /** * 协议字段 */ @@ -120,7 +125,7 @@ public interface SecurityConstants { /** * 短信登录 参数名称 */ - String SMS_PARAMETER_NAME = "phone"; + String SMS_PARAMETER_NAME = "mobile"; /** * 授权码模式confirm diff --git a/pig-common/pig-common-datasource/pom.xml b/pig-common/pig-common-datasource/pom.xml index e03d585e..31a09b9d 100644 --- a/pig-common/pig-common-datasource/pom.xml +++ b/pig-common/pig-common-datasource/pom.xml @@ -16,28 +16,31 @@ --> - - pig-common - com.pig4cloud - 3.6.7 - - 4.0.0 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + pig-common + com.pig4cloud + 3.7.0-JDK8 + + 4.0.0 - com.pig4cloud - pig-common-datasource + com.pig4cloud + pig-common-datasource - jar + jar - pig 动态切换数据源 + pig 动态切换数据源 - - - - com.baomidou - dynamic-datasource-spring-boot-starter - ${dynamic-ds.version} - - + + + + com.baomidou + dynamic-datasource-spring-boot-starter + + + jakarta.servlet + jakarta.servlet-api + + diff --git a/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/DynamicDataSourceAutoConfiguration.java b/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/DynamicDataSourceAutoConfiguration.java index 6492235c..1d88abcf 100644 --- a/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/DynamicDataSourceAutoConfiguration.java +++ b/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/DynamicDataSourceAutoConfiguration.java @@ -16,17 +16,29 @@ package com.pig4cloud.pig.common.datasource; +import com.baomidou.dynamic.datasource.creator.DataSourceCreator; +import com.baomidou.dynamic.datasource.creator.DefaultDataSourceCreator; +import com.baomidou.dynamic.datasource.creator.hikaricp.HikariDataSourceCreator; +import com.baomidou.dynamic.datasource.processor.DsHeaderProcessor; import com.baomidou.dynamic.datasource.processor.DsProcessor; +import com.baomidou.dynamic.datasource.processor.DsSessionProcessor; +import com.baomidou.dynamic.datasource.processor.DsSpelExpressionProcessor; import com.baomidou.dynamic.datasource.provider.DynamicDataSourceProvider; +import com.pig4cloud.pig.common.datasource.config.ClearTtlDataSourceFilter; import com.pig4cloud.pig.common.datasource.config.DataSourceProperties; import com.pig4cloud.pig.common.datasource.config.JdbcDynamicDataSourceProvider; import com.pig4cloud.pig.common.datasource.config.LastParamDsProcessor; import org.jasypt.encryption.StringEncryptor; +import org.springframework.beans.factory.BeanFactory; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.expression.BeanFactoryResolver; + +import java.util.ArrayList; +import java.util.List; /** * @author lengleng @@ -39,15 +51,57 @@ import org.springframework.context.annotation.Configuration; @EnableConfigurationProperties(DataSourceProperties.class) public class DynamicDataSourceAutoConfiguration { + /** + * 动态数据源提供者 + * @param defaultDataSourceCreator 默认数据源创建器 + * @param stringEncryptor 字符串加密器 + * @param properties 数据源配置属性 + * @return 动态数据源提供者 + */ @Bean - public DynamicDataSourceProvider dynamicDataSourceProvider(StringEncryptor stringEncryptor, - DataSourceProperties properties) { - return new JdbcDynamicDataSourceProvider(stringEncryptor, properties); + public DynamicDataSourceProvider dynamicDataSourceProvider(DefaultDataSourceCreator defaultDataSourceCreator, + StringEncryptor stringEncryptor, DataSourceProperties properties) { + return new JdbcDynamicDataSourceProvider(defaultDataSourceCreator, stringEncryptor, properties); } + /** + * 获取数据源处理器 + * @return 数据源处理器 + */ @Bean - public DsProcessor dsProcessor() { - return new LastParamDsProcessor(); + public DsProcessor dsProcessor(BeanFactory beanFactory) { + DsProcessor lastParamDsProcessor = new LastParamDsProcessor(); + DsProcessor headerProcessor = new DsHeaderProcessor(); + DsProcessor sessionProcessor = new DsSessionProcessor(); + DsSpelExpressionProcessor spelExpressionProcessor = new DsSpelExpressionProcessor(); + spelExpressionProcessor.setBeanResolver(new BeanFactoryResolver(beanFactory)); + lastParamDsProcessor.setNextProcessor(headerProcessor); + headerProcessor.setNextProcessor(sessionProcessor); + sessionProcessor.setNextProcessor(spelExpressionProcessor); + return lastParamDsProcessor; + } + + /** + * 默认数据源创建器 + * @param hikariDataSourceCreator Hikari数据源创建器 + * @return 默认数据源创建器 + */ + @Bean + public DefaultDataSourceCreator defaultDataSourceCreator(HikariDataSourceCreator hikariDataSourceCreator) { + DefaultDataSourceCreator defaultDataSourceCreator = new DefaultDataSourceCreator(); + List creators = new ArrayList<>(); + creators.add(hikariDataSourceCreator); + defaultDataSourceCreator.setCreators(creators); + return defaultDataSourceCreator; + } + + /** + * 清除Ttl数据源过滤器 + * @return 清除Ttl数据源过滤器 + */ + @Bean + public ClearTtlDataSourceFilter clearTtlDsFilter() { + return new ClearTtlDataSourceFilter(); } } diff --git a/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/config/ClearTtlDataSourceFilter.java b/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/config/ClearTtlDataSourceFilter.java new file mode 100644 index 00000000..e485d170 --- /dev/null +++ b/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/config/ClearTtlDataSourceFilter.java @@ -0,0 +1,34 @@ +package com.pig4cloud.pig.common.datasource.config; + +import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; +import org.springframework.core.Ordered; +import org.springframework.web.filter.GenericFilterBean; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import java.io.IOException; + +/** + * @author lengleng + * @date 2020/12/11 + *

+ * 清空上文的DS 设置避免污染当前线程 + */ +public class ClearTtlDataSourceFilter extends GenericFilterBean implements Ordered { + + @Override + public int getOrder() { + return Integer.MIN_VALUE; + } + + @Override + public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) + throws IOException, ServletException { + DynamicDataSourceContextHolder.clear(); + filterChain.doFilter(servletRequest, servletResponse); + DynamicDataSourceContextHolder.clear(); + } + +} diff --git a/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/config/JdbcDynamicDataSourceProvider.java b/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/config/JdbcDynamicDataSourceProvider.java index 9f8e81a8..ca1433da 100644 --- a/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/config/JdbcDynamicDataSourceProvider.java +++ b/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/config/JdbcDynamicDataSourceProvider.java @@ -16,8 +16,9 @@ package com.pig4cloud.pig.common.datasource.config; +import com.baomidou.dynamic.datasource.creator.DataSourceProperty; +import com.baomidou.dynamic.datasource.creator.DefaultDataSourceCreator; import com.baomidou.dynamic.datasource.provider.AbstractJdbcDataSourceProvider; -import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty; import com.pig4cloud.pig.common.datasource.support.DataSourceConstants; import org.jasypt.encryption.StringEncryptor; @@ -39,8 +40,10 @@ public class JdbcDynamicDataSourceProvider extends AbstractJdbcDataSourceProvide private final StringEncryptor stringEncryptor; - public JdbcDynamicDataSourceProvider(StringEncryptor stringEncryptor, DataSourceProperties properties) { - super(properties.getDriverClassName(), properties.getUrl(), properties.getUsername(), properties.getPassword()); + public JdbcDynamicDataSourceProvider(DefaultDataSourceCreator defaultDataSourceCreator, + StringEncryptor stringEncryptor, DataSourceProperties properties) { + super(defaultDataSourceCreator, properties.getDriverClassName(), properties.getUrl(), properties.getUsername(), + properties.getPassword()); this.stringEncryptor = stringEncryptor; this.properties = properties; } diff --git a/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/enums/DsConfTypeEnum.java b/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/enums/DsConfTypeEnum.java new file mode 100644 index 00000000..2289806f --- /dev/null +++ b/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/enums/DsConfTypeEnum.java @@ -0,0 +1,30 @@ +package com.pig4cloud.pig.common.datasource.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author lengleng + * @date 2020/12/11 + *

+ * 数据源配置类型 + */ +@Getter +@AllArgsConstructor +public enum DsConfTypeEnum { + + /** + * 主机链接 + */ + HOST(0, "主机链接"), + + /** + * JDBC链接 + */ + JDBC(1, "JDBC链接"); + + private final Integer type; + + private final String description; + +} diff --git a/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/enums/DsJdbcUrlEnum.java b/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/enums/DsJdbcUrlEnum.java new file mode 100644 index 00000000..ccdad2e4 --- /dev/null +++ b/pig-common/pig-common-datasource/src/main/java/com/pig4cloud/pig/common/datasource/enums/DsJdbcUrlEnum.java @@ -0,0 +1,72 @@ +package com.pig4cloud.pig.common.datasource.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; + +/** + * @author lengleng + * @date 2020/12/11 + *

+ * jdbc-url + */ +@Getter +@AllArgsConstructor +public enum DsJdbcUrlEnum { + + /** + * mysql 数据库 + */ + MYSQL("mysql", + "jdbc:mysql://%s:%s/%s?characterEncoding=utf8" + + "&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true" + + "&useLegacyDatetimeCode=false&allowMultiQueries=true&allowPublicKeyRetrieval=true", + "select 1", "mysql8 链接"), + + /** + * pg 数据库 + */ + PG("pg", "jdbc:postgresql://%s:%s/%s", "select 1", "postgresql 链接"), + + /** + * SQL SERVER + */ + MSSQL("mssql", "jdbc:sqlserver://%s:%s;database=%s;characterEncoding=UTF-8", "select 1", "sqlserver 链接"), + + /** + * oracle + */ + ORACLE("oracle", "jdbc:oracle:thin:@%s:%s:%s", "select 1 from dual", "oracle 链接"), + + /** + * db2 + */ + DB2("db2", "jdbc:db2://%s:%s/%s", "select 1 from sysibm.sysdummy1", "DB2 TYPE4 连接"), + + /** + * 达梦 + */ + DM("dm", "jdbc:dm://%s:%s/%s", "select 1 from dual", "达梦连接"), + + /** + * pg 数据库 + */ + HIGHGO("highgo", "jdbc:highgo://%s:%s/%s", "select 1", "highgo 链接"); + + private final String dbName; + + private final String url; + + private final String validationQuery; + + private final String description; + + public static DsJdbcUrlEnum get(String dsType) { + return Arrays.stream(DsJdbcUrlEnum.values()) + .filter(dsJdbcUrlEnum -> dsType.equals(dsJdbcUrlEnum.getDbName())) + .findFirst() + .get(); + } + +} diff --git a/pig-common/pig-common-feign/pom.xml b/pig-common/pig-common-feign/pom.xml index 0f2332db..82832f37 100755 --- a/pig-common/pig-common-feign/pom.xml +++ b/pig-common/pig-common-feign/pom.xml @@ -21,7 +21,7 @@ com.pig4cloud pig-common - 3.6.7 + 3.7.0-JDK8 4.0.0 diff --git a/pig-common/pig-common-job/pom.xml b/pig-common/pig-common-job/pom.xml index 6c5b166a..911f1770 100755 --- a/pig-common/pig-common-job/pom.xml +++ b/pig-common/pig-common-job/pom.xml @@ -23,13 +23,13 @@ com.pig4cloud pig-common - 3.6.7 + 3.7.0-JDK8 pig-common-job jar - pig 定时任务,基于xxl-job + pig 定时任务,基于xxl-job 支持自动发现 diff --git a/pig-common/pig-common-log/pom.xml b/pig-common/pig-common-log/pom.xml index b01f6f38..c77d56c3 100755 --- a/pig-common/pig-common-log/pom.xml +++ b/pig-common/pig-common-log/pom.xml @@ -21,7 +21,7 @@ com.pig4cloud pig-common - 3.6.7 + 3.7.0-JDK8 pig-common-log diff --git a/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/LogAutoConfiguration.java b/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/LogAutoConfiguration.java index ef0d1622..1f3b46ff 100755 --- a/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/LogAutoConfiguration.java +++ b/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/LogAutoConfiguration.java @@ -18,9 +18,10 @@ package com.pig4cloud.pig.common.log; import com.pig4cloud.pig.admin.api.feign.RemoteLogService; import com.pig4cloud.pig.common.log.aspect.SysLogAspect; +import com.pig4cloud.pig.common.log.config.PigLogProperties; import com.pig4cloud.pig.common.log.event.SysLogListener; -import lombok.RequiredArgsConstructor; -import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableAsync; @@ -30,14 +31,14 @@ import org.springframework.scheduling.annotation.EnableAsync; * @date 2019/2/1 日志自动配置 */ @EnableAsync -@RequiredArgsConstructor -@ConditionalOnWebApplication @Configuration(proxyBeanMethods = false) +@EnableConfigurationProperties(PigLogProperties.class) +@ConditionalOnProperty(value = "security.log.enabled", matchIfMissing = true) public class LogAutoConfiguration { @Bean - public SysLogListener sysLogListener(RemoteLogService remoteLogService) { - return new SysLogListener(remoteLogService); + public SysLogListener sysLogListener(PigLogProperties logProperties, RemoteLogService remoteLogService) { + return new SysLogListener(remoteLogService, logProperties); } @Bean diff --git a/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/aspect/SysLogAspect.java b/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/aspect/SysLogAspect.java index 4d984530..59619c74 100755 --- a/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/aspect/SysLogAspect.java +++ b/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/aspect/SysLogAspect.java @@ -17,11 +17,12 @@ package com.pig4cloud.pig.common.log.aspect; import cn.hutool.core.util.StrUtil; -import com.pig4cloud.pig.admin.api.entity.SysLog; import com.pig4cloud.pig.common.core.util.SpringContextHolder; import com.pig4cloud.pig.common.log.event.SysLogEvent; +import com.pig4cloud.pig.common.log.event.SysLogEventSource; import com.pig4cloud.pig.common.log.util.LogTypeEnum; import com.pig4cloud.pig.common.log.util.SysLogUtils; +import lombok.RequiredArgsConstructor; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.ProceedingJoinPoint; @@ -37,6 +38,7 @@ import org.springframework.expression.EvaluationContext; */ @Aspect @Slf4j +@RequiredArgsConstructor public class SysLogAspect { @Around("@annotation(sysLog)") @@ -62,9 +64,12 @@ public class SysLogAspect { } } - SysLog logVo = SysLogUtils.getSysLog(); + SysLogEventSource logVo = SysLogUtils.getSysLog(); logVo.setTitle(value); - + // 获取请求body参数 + if (StrUtil.isBlank(logVo.getParams())) { + logVo.setBody(point.getArgs()); + } // 发送异步日志事件 Long startTime = System.currentTimeMillis(); Object obj; @@ -73,7 +78,7 @@ public class SysLogAspect { obj = point.proceed(); } catch (Exception e) { - logVo.setType(LogTypeEnum.ERROR.getType()); + logVo.setLogType(LogTypeEnum.ERROR.getType()); logVo.setException(e.getMessage()); throw e; } diff --git a/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/config/PigLogProperties.java b/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/config/PigLogProperties.java new file mode 100644 index 00000000..5891ada1 --- /dev/null +++ b/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/config/PigLogProperties.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2019-2029, Dreamlu 卢春梦 (596392912@qq.com & www.dreamlu.net). + *

+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.gnu.org/licenses/lgpl.html + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.pig4cloud.pig.common.log.config; + +import lombok.Getter; +import lombok.Setter; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.properties.ConfigurationProperties; + +import java.util.List; + +/** + * 日志配置类 + * + * @author L.cm + */ +@Getter +@Setter +@ConfigurationProperties(PigLogProperties.PREFIX) +public class PigLogProperties { + + public static final String PREFIX = "security.log"; + + /** + * 开启日志记录 + */ + private boolean enabled = true; + + /** + * 放行字段,password,mobile,idcard,phone + */ + @Value("${security.log.exclude-fields:password,mobile,idcard,phone}") + private List excludeFields; + + /** + * 请求报文最大存储长度 + */ + private Integer maxLength = 2000; + +} diff --git a/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/event/SysLogEventSource.java b/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/event/SysLogEventSource.java new file mode 100644 index 00000000..a1bf7da7 --- /dev/null +++ b/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/event/SysLogEventSource.java @@ -0,0 +1,20 @@ +package com.pig4cloud.pig.common.log.event; + +import com.pig4cloud.pig.admin.api.entity.SysLog; +import lombok.Data; + +/** + * spring event log + * + * @author lengleng + * @date 2023/8/11 + */ +@Data +public class SysLogEventSource extends SysLog { + + /** + * 参数重写成object + */ + private Object body; + +} diff --git a/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/event/SysLogListener.java b/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/event/SysLogListener.java index 162ab829..581db9c5 100755 --- a/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/event/SysLogListener.java +++ b/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/event/SysLogListener.java @@ -16,29 +16,74 @@ package com.pig4cloud.pig.common.log.event; +import cn.hutool.core.util.StrUtil; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ser.FilterProvider; +import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; +import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; import com.pig4cloud.pig.admin.api.entity.SysLog; import com.pig4cloud.pig.admin.api.feign.RemoteLogService; +import com.pig4cloud.pig.common.core.constant.SecurityConstants; +import com.pig4cloud.pig.common.core.jackson.PigJavaTimeModule; +import com.pig4cloud.pig.common.log.config.PigLogProperties; import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.InitializingBean; import org.springframework.context.event.EventListener; import org.springframework.core.annotation.Order; import org.springframework.scheduling.annotation.Async; +import java.util.Objects; + /** * @author lengleng 异步监听日志事件 */ @Slf4j @RequiredArgsConstructor -public class SysLogListener { +public class SysLogListener implements InitializingBean { + + // new 一个 避免日志脱敏策略影响全局ObjectMapper + private final static ObjectMapper objectMapper = new ObjectMapper(); private final RemoteLogService remoteLogService; + private final PigLogProperties logProperties; + + @SneakyThrows @Async @Order @EventListener(SysLogEvent.class) public void saveSysLog(SysLogEvent event) { - SysLog sysLog = (SysLog) event.getSource(); - remoteLogService.saveLog(sysLog); + SysLogEventSource source = (SysLogEventSource) event.getSource(); + SysLog sysLog = new SysLog(); + BeanUtils.copyProperties(source, sysLog); + + // json 格式刷参数放在异步中处理,提升性能 + if (Objects.nonNull(source.getBody())) { + String params = objectMapper.writeValueAsString(source.getBody()); + sysLog.setParams(StrUtil.subPre(params, logProperties.getMaxLength())); + } + + remoteLogService.saveLog(sysLog, SecurityConstants.FROM_IN); + } + + @Override + public void afterPropertiesSet() { + objectMapper.addMixIn(Object.class, PropertyFilterMixIn.class); + String[] ignorableFieldNames = logProperties.getExcludeFields().toArray(new String[0]); + + FilterProvider filters = new SimpleFilterProvider().addFilter("filter properties by name", + SimpleBeanPropertyFilter.serializeAllExcept(ignorableFieldNames)); + objectMapper.setFilterProvider(filters); + objectMapper.registerModule(new PigJavaTimeModule()); + } + + @JsonFilter("filter properties by name") + class PropertyFilterMixIn { + } } diff --git a/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/init/ApplicationLoggerInitializer.java b/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/init/ApplicationLoggerInitializer.java index 8f22ed6d..1ba935a0 100644 --- a/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/init/ApplicationLoggerInitializer.java +++ b/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/init/ApplicationLoggerInitializer.java @@ -36,6 +36,9 @@ public class ApplicationLoggerInitializer implements EnvironmentPostProcessor, O // spring boot admin 直接加载日志 System.setProperty("logging.file.name", String.format("%s/%s/debug.log", logBase, appName)); + + // 避免 sentinel 1.8.4+ 心跳日志过大 + System.setProperty("csp.sentinel.log.level", "OFF"); } @Override diff --git a/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/util/SysLogUtils.java b/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/util/SysLogUtils.java index 6046cfe9..f8ac27f3 100755 --- a/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/util/SysLogUtils.java +++ b/pig-common/pig-common-log/src/main/java/com/pig4cloud/pig/common/log/util/SysLogUtils.java @@ -17,13 +17,17 @@ package com.pig4cloud.pig.common.log.util; import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.URLUtil; +import cn.hutool.extra.servlet.JakartaServletUtil; import cn.hutool.extra.servlet.ServletUtil; import cn.hutool.http.HttpUtil; -import com.pig4cloud.pig.admin.api.entity.SysLog; import com.pig4cloud.pig.common.core.constant.SecurityConstants; +import com.pig4cloud.pig.common.core.util.SpringContextHolder; +import com.pig4cloud.pig.common.log.config.PigLogProperties; +import com.pig4cloud.pig.common.log.event.SysLogEventSource; import lombok.experimental.UtilityClass; -import org.springframework.core.LocalVariableTableParameterNameDiscoverer; +import org.springframework.core.StandardReflectionParameterNameDiscoverer; import org.springframework.expression.EvaluationContext; import org.springframework.expression.Expression; import org.springframework.expression.spel.standard.SpelExpressionParser; @@ -37,6 +41,7 @@ import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; import java.lang.reflect.Method; +import java.util.Map; import java.util.Objects; /** @@ -47,40 +52,26 @@ import java.util.Objects; @UtilityClass public class SysLogUtils { - public SysLog getSysLog() { + public SysLogEventSource getSysLog() { HttpServletRequest request = ((ServletRequestAttributes) Objects .requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest(); - SysLog sysLog = new SysLog(); - sysLog.setType(LogTypeEnum.NORMAL.getType()); - sysLog.setRemoteAddr(ServletUtil.getClientIP(request)); + SysLogEventSource sysLog = new SysLogEventSource(); + sysLog.setLogType(LogTypeEnum.NORMAL.getType()); sysLog.setRequestUri(URLUtil.getPath(request.getRequestURI())); sysLog.setMethod(request.getMethod()); + sysLog.setRemoteAddr(ServletUtil.getClientIP(request)); sysLog.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT)); - sysLog.setParams(HttpUtil.toParams(request.getParameterMap())); sysLog.setCreateBy(getUsername()); - sysLog.setUpdateBy(getUsername()); sysLog.setServiceId(getClientId()); + + // get 参数脱敏 + PigLogProperties logProperties = SpringContextHolder.getBean(PigLogProperties.class); + Map paramsMap = MapUtil.removeAny(request.getParameterMap(), + ArrayUtil.toArray(logProperties.getExcludeFields(), String.class)); + sysLog.setParams(HttpUtil.toParams(paramsMap)); return sysLog; } - /** - * 获取客户端 - * @return clientId - */ - private String getClientId() { - Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - if (authentication == null) { - return null; - } - - Object principal = authentication.getPrincipal(); - if (principal instanceof OAuth2AuthenticatedPrincipal) { - OAuth2AuthenticatedPrincipal auth2Authentication = (OAuth2AuthenticatedPrincipal) principal; - return MapUtil.getStr(auth2Authentication.getAttributes(), SecurityConstants.CLIENT_ID); - } - return null; - } - /** * 获取用户名称 * @return username @@ -114,7 +105,7 @@ public class SysLogUtils { * @return 装载参数的容器 */ public EvaluationContext getContext(Object[] arguments, Method signatureMethod) { - String[] parameterNames = new LocalVariableTableParameterNameDiscoverer().getParameterNames(signatureMethod); + String[] parameterNames = new StandardReflectionParameterNameDiscoverer().getParameterNames(signatureMethod); EvaluationContext context = new StandardEvaluationContext(); if (parameterNames == null) { return context; @@ -125,4 +116,22 @@ public class SysLogUtils { return context; } + /** + * 获取客户端 + * @return clientId + */ + private String getClientId() { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication == null) { + return null; + } + + Object principal = authentication.getPrincipal(); + if (principal instanceof OAuth2AuthenticatedPrincipal) { + OAuth2AuthenticatedPrincipal auth2Authentication = (OAuth2AuthenticatedPrincipal) principal; + return MapUtil.getStr(auth2Authentication.getAttributes(), SecurityConstants.CLIENT_ID); + } + return null; + } + } diff --git a/pig-common/pig-common-log/src/main/resources/META-INF/spring-configuration-metadata.json b/pig-common/pig-common-log/src/main/resources/META-INF/spring-configuration-metadata.json new file mode 100644 index 00000000..951a9beb --- /dev/null +++ b/pig-common/pig-common-log/src/main/resources/META-INF/spring-configuration-metadata.json @@ -0,0 +1,30 @@ +{ + "groups": [ + { + "name": "security.log", + "type": "com.pig4cloud.pig.common.log.config.PigLogProperties", + "sourceType": "com.pig4cloud.pig.common.log.config.PigLogProperties" + } + ], + "properties": [ + { + "name": "security.log.enabled", + "type": "java.lang.Boolean", + "description": "开启日志记录", + "sourceType": "com.pig4cloud.pig.common.log.config.PigLogProperties" + }, + { + "name": "security.log.exclude-fields", + "type": "java.util.List", + "description": "放行字段,password,mobile,idcard,phone", + "sourceType": "com.pig4cloud.pig.common.log.config.PigLogProperties" + }, + { + "name": "security.log.max-length", + "type": "java.lang.Integer", + "description": "请求报文最大存储长度", + "sourceType": "com.pig4cloud.pig.common.log.config.PigLogProperties" + } + ], + "hints": [] +} diff --git a/pig-common/pig-common-log/src/main/resources/META-INF/spring.factories b/pig-common/pig-common-log/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 7f7301ba..00000000 --- a/pig-common/pig-common-log/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,3 +0,0 @@ -# https://github.com/spring-projects/spring-boot/issues/31252 -org.springframework.boot.env.EnvironmentPostProcessor=\ - com.pig4cloud.pig.common.log.init.ApplicationLoggerInitializer diff --git a/pig-common/pig-common-mybatis/pom.xml b/pig-common/pig-common-mybatis/pom.xml index c2d0b5da..3b0d1b3e 100755 --- a/pig-common/pig-common-mybatis/pom.xml +++ b/pig-common/pig-common-mybatis/pom.xml @@ -21,7 +21,7 @@ com.pig4cloud pig-common - 3.6.7 + 3.7.0-JDK8 pig-common-mybatis @@ -45,17 +45,12 @@ com.baomidou mybatis-plus-extension - + io.swagger.core.v3 swagger-annotations - - javax.servlet - javax.servlet-api - provided - org.springframework spring-webmvc @@ -67,5 +62,9 @@ spring-security-core true + + com.pig4cloud + pig-common-core + diff --git a/pig-common/pig-common-mybatis/src/main/java/com/pig4cloud/pig/common/mybatis/config/MybatisPlusMetaObjectHandler.java b/pig-common/pig-common-mybatis/src/main/java/com/pig4cloud/pig/common/mybatis/config/MybatisPlusMetaObjectHandler.java index fb84043d..67b0f7cf 100644 --- a/pig-common/pig-common-mybatis/src/main/java/com/pig4cloud/pig/common/mybatis/config/MybatisPlusMetaObjectHandler.java +++ b/pig-common/pig-common-mybatis/src/main/java/com/pig4cloud/pig/common/mybatis/config/MybatisPlusMetaObjectHandler.java @@ -2,8 +2,10 @@ package com.pig4cloud.pig.common.mybatis.config; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; +import com.pig4cloud.pig.common.core.constant.CommonConstants; import lombok.extern.slf4j.Slf4j; import org.apache.ibatis.reflection.MetaObject; +import org.springframework.security.authentication.AnonymousAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.util.ClassUtils; @@ -25,10 +27,13 @@ public class MybatisPlusMetaObjectHandler implements MetaObjectHandler { log.debug("mybatis plus start insert fill ...."); LocalDateTime now = LocalDateTime.now(); - fillValIfNullByName("createTime", now, metaObject, false); - fillValIfNullByName("updateTime", now, metaObject, false); - fillValIfNullByName("createBy", getUserName(), metaObject, false); - fillValIfNullByName("updateBy", getUserName(), metaObject, false); + fillValIfNullByName("createTime", now, metaObject, true); + fillValIfNullByName("updateTime", now, metaObject, true); + fillValIfNullByName("createBy", getUserName(), metaObject, true); + fillValIfNullByName("updateBy", getUserName(), metaObject, true); + + // 删除标记自动填充 + fillValIfNullByName("delFlag", CommonConstants.STATUS_NORMAL, metaObject, true); } @Override @@ -46,6 +51,11 @@ public class MybatisPlusMetaObjectHandler implements MetaObjectHandler { * @param isCover 是否覆盖原有值,避免更新操作手动入参 */ private static void fillValIfNullByName(String fieldName, Object fieldVal, MetaObject metaObject, boolean isCover) { + // 0. 如果填充值为空 + if (fieldVal == null) { + return; + } + // 1. 没有 set 方法 if (!metaObject.hasSetter(fieldName)) { return; @@ -69,9 +79,15 @@ public class MybatisPlusMetaObjectHandler implements MetaObjectHandler { */ private String getUserName() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + // 匿名接口直接返回 + if (authentication instanceof AnonymousAuthenticationToken) { + return null; + } + if (Optional.ofNullable(authentication).isPresent()) { return authentication.getName(); } + return null; } diff --git a/pig-common/pig-common-mybatis/src/main/java/com/pig4cloud/pig/common/mybatis/handler/JsonLongArrayTypeHandler.java b/pig-common/pig-common-mybatis/src/main/java/com/pig4cloud/pig/common/mybatis/handler/JsonLongArrayTypeHandler.java new file mode 100644 index 00000000..005c3ea2 --- /dev/null +++ b/pig-common/pig-common-mybatis/src/main/java/com/pig4cloud/pig/common/mybatis/handler/JsonLongArrayTypeHandler.java @@ -0,0 +1,56 @@ +package com.pig4cloud.pig.common.mybatis.handler; + +import cn.hutool.core.convert.Convert; +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.StrUtil; +import lombok.SneakyThrows; +import org.apache.ibatis.type.BaseTypeHandler; +import org.apache.ibatis.type.JdbcType; +import org.apache.ibatis.type.MappedJdbcTypes; +import org.apache.ibatis.type.MappedTypes; + +import java.sql.CallableStatement; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +/** + * Mybatis数组,符串互转 + *

+ * MappedJdbcTypes 数据库中的数据类型 MappedTypes java中的的数据类型 + * + * @author xuzihui + * @date 2019-11-20 + */ +@MappedTypes(value = { Long[].class }) +@MappedJdbcTypes(value = JdbcType.VARCHAR) +public class JsonLongArrayTypeHandler extends BaseTypeHandler { + + @Override + public void setNonNullParameter(PreparedStatement ps, int i, Long[] parameter, JdbcType jdbcType) + throws SQLException { + ps.setString(i, ArrayUtil.join(parameter, StrUtil.COMMA)); + } + + @Override + @SneakyThrows + public Long[] getNullableResult(ResultSet rs, String columnName) { + String reString = rs.getString(columnName); + return Convert.toLongArray(reString); + } + + @Override + @SneakyThrows + public Long[] getNullableResult(ResultSet rs, int columnIndex) { + String reString = rs.getString(columnIndex); + return Convert.toLongArray(reString); + } + + @Override + @SneakyThrows + public Long[] getNullableResult(CallableStatement cs, int columnIndex) { + String reString = cs.getString(columnIndex); + return Convert.toLongArray(reString); + } + +} diff --git a/pig-common/pig-common-mybatis/src/main/java/com/pig4cloud/pig/common/mybatis/handler/JsonStringArrayTypeHandler.java b/pig-common/pig-common-mybatis/src/main/java/com/pig4cloud/pig/common/mybatis/handler/JsonStringArrayTypeHandler.java new file mode 100644 index 00000000..017ca4d2 --- /dev/null +++ b/pig-common/pig-common-mybatis/src/main/java/com/pig4cloud/pig/common/mybatis/handler/JsonStringArrayTypeHandler.java @@ -0,0 +1,56 @@ +package com.pig4cloud.pig.common.mybatis.handler; + +import cn.hutool.core.convert.Convert; +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.StrUtil; +import lombok.SneakyThrows; +import org.apache.ibatis.type.BaseTypeHandler; +import org.apache.ibatis.type.JdbcType; +import org.apache.ibatis.type.MappedJdbcTypes; +import org.apache.ibatis.type.MappedTypes; + +import java.sql.CallableStatement; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +/** + * Mybatis数组,符串互转 + *

+ * MappedJdbcTypes 数据库中的数据类型 MappedTypes java中的的数据类型 + * + * @author xuzihui + * @date 2019-11-20 + */ +@MappedTypes(value = { String[].class }) +@MappedJdbcTypes(value = JdbcType.VARCHAR) +public class JsonStringArrayTypeHandler extends BaseTypeHandler { + + @Override + public void setNonNullParameter(PreparedStatement ps, int i, String[] parameter, JdbcType jdbcType) + throws SQLException { + ps.setString(i, ArrayUtil.join(parameter, StrUtil.COMMA)); + } + + @Override + @SneakyThrows + public String[] getNullableResult(ResultSet rs, String columnName) { + String reString = rs.getString(columnName); + return Convert.toStrArray(reString); + } + + @Override + @SneakyThrows + public String[] getNullableResult(ResultSet rs, int columnIndex) { + String reString = rs.getString(columnIndex); + return Convert.toStrArray(reString); + } + + @Override + @SneakyThrows + public String[] getNullableResult(CallableStatement cs, int columnIndex) { + String reString = cs.getString(columnIndex); + return Convert.toStrArray(reString); + } + +} diff --git a/pig-common/pig-common-mybatis/src/main/java/com/pig4cloud/pig/common/mybatis/resolver/SqlFilterArgumentResolver.java b/pig-common/pig-common-mybatis/src/main/java/com/pig4cloud/pig/common/mybatis/resolver/SqlFilterArgumentResolver.java index 683b13e0..3b9a9a20 100644 --- a/pig-common/pig-common-mybatis/src/main/java/com/pig4cloud/pig/common/mybatis/resolver/SqlFilterArgumentResolver.java +++ b/pig-common/pig-common-mybatis/src/main/java/com/pig4cloud/pig/common/mybatis/resolver/SqlFilterArgumentResolver.java @@ -21,6 +21,7 @@ package com.pig4cloud.pig.common.mybatis.resolver; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.metadata.OrderItem; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import javax.servlet.http.HttpServletRequest; import lombok.extern.slf4j.Slf4j; import org.springframework.core.MethodParameter; import org.springframework.web.bind.support.WebDataBinderFactory; @@ -28,7 +29,6 @@ import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.method.support.ModelAndViewContainer; -import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; import java.util.Arrays; import java.util.List; diff --git a/pig-common/pig-common-oss/pom.xml b/pig-common/pig-common-oss/pom.xml new file mode 100755 index 00000000..13c33d0a --- /dev/null +++ b/pig-common/pig-common-oss/pom.xml @@ -0,0 +1,27 @@ + + + 4.0.0 + + com.pig4cloud + pig-common + 3.7.0-JDK8 + + + pig-common-oss + jar + + pig 文件系统依赖 + + + + com.amazonaws + aws-java-sdk-s3 + + + cn.hutool + hutool-core + + + diff --git a/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/FileAutoConfiguration.java b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/FileAutoConfiguration.java new file mode 100755 index 00000000..2227b953 --- /dev/null +++ b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/FileAutoConfiguration.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.common.file; + +import com.pig4cloud.pig.common.file.core.FileProperties; +import com.pig4cloud.pig.common.file.local.LocalFileAutoConfiguration; +import com.pig4cloud.pig.common.file.oss.OssAutoConfiguration; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Import; + +/** + * aws 自动配置类 + * + * @author lengleng + * @author 858695266 + */ +@Import({ LocalFileAutoConfiguration.class, OssAutoConfiguration.class }) +@EnableConfigurationProperties({ FileProperties.class }) +public class FileAutoConfiguration { + +} diff --git a/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/core/FileProperties.java b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/core/FileProperties.java new file mode 100755 index 00000000..e225cd95 --- /dev/null +++ b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/core/FileProperties.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.common.file.core; + +import com.pig4cloud.pig.common.file.local.LocalFileProperties; +import com.pig4cloud.pig.common.file.oss.OssProperties; +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * 文件 配置信息 + * + * @author lengleng + *

+ * bucket 设置公共读权限 + */ +@Data +@ConfigurationProperties(prefix = "file") +public class FileProperties { + + /** + * 默认的存储桶名称 + */ + private String bucketName = "local"; + + /** + * 本地文件配置信息 + */ + private LocalFileProperties local; + + /** + * oss 文件配置信息 + */ + private OssProperties oss; + +} diff --git a/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/core/FileTemplate.java b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/core/FileTemplate.java new file mode 100644 index 00000000..c9e95785 --- /dev/null +++ b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/core/FileTemplate.java @@ -0,0 +1,87 @@ +package com.pig4cloud.pig.common.file.core; + +import com.amazonaws.services.s3.model.Bucket; +import com.amazonaws.services.s3.model.S3Object; +import com.amazonaws.services.s3.model.S3ObjectSummary; +import org.springframework.beans.factory.InitializingBean; + +import java.io.InputStream; +import java.util.List; + +/** + * 文件操作模板 + * + * @author lengleng + * @date 2022/4/19 + */ +public interface FileTemplate extends InitializingBean { + + /** + * 创建bucket + * @param bucketName bucket名称 + */ + void createBucket(String bucketName); + + /** + * 获取全部bucket + *

+ * + * API Documentation + */ + List getAllBuckets(); + + /** + * @param bucketName bucket名称 + * @see + */ + void removeBucket(String bucketName); + + /** + * 上传文件 + * @param bucketName bucket名称 + * @param objectName 文件名称 + * @param stream 文件流 + * @param contextType 文件类型 + * @throws Exception + */ + void putObject(String bucketName, String objectName, InputStream stream, String contextType) throws Exception; + + /** + * 上传文件 + * @param bucketName bucket名称 + * @param objectName 文件名称 + * @param stream 文件流 + * @param contextType 文件类型 + * @throws Exception + */ + void putObject(String bucketName, String objectName, InputStream stream) throws Exception; + + /** + * 获取文件 + * @param bucketName bucket名称 + * @param objectName 文件名称 + * @return 二进制流 API Documentation + */ + S3Object getObject(String bucketName, String objectName); + + void removeObject(String bucketName, String objectName) throws Exception; + + /** + * @throws Exception + */ + @Override + default void afterPropertiesSet() throws Exception { + } + + /** + * 根据文件前置查询文件 + * @param bucketName bucket名称 + * @param prefix 前缀 + * @param recursive 是否递归查询 + * @return S3ObjectSummary 列表 + * @see AWS + * API Documentation + */ + List getAllObjectsByPrefix(String bucketName, String prefix, boolean recursive); + +} diff --git a/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/local/LocalFileAutoConfiguration.java b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/local/LocalFileAutoConfiguration.java new file mode 100755 index 00000000..bf34b0c3 --- /dev/null +++ b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/local/LocalFileAutoConfiguration.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.common.file.local; + +import com.pig4cloud.pig.common.file.core.FileProperties; +import com.pig4cloud.pig.common.file.core.FileTemplate; +import lombok.AllArgsConstructor; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; + +/** + * aws 自动配置类 + * + * @author lengleng + * @author 858695266 + */ +@AllArgsConstructor +public class LocalFileAutoConfiguration { + + private final FileProperties properties; + + @Bean + @ConditionalOnMissingBean(LocalFileTemplate.class) + @ConditionalOnProperty(name = "file.local.enable", havingValue = "true", matchIfMissing = true) + public FileTemplate localFileTemplate() { + return new LocalFileTemplate(properties); + } + +} diff --git a/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/local/LocalFileProperties.java b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/local/LocalFileProperties.java new file mode 100755 index 00000000..7cf833e9 --- /dev/null +++ b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/local/LocalFileProperties.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.common.file.local; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * 本地文件 配置信息 + * + * @author lengleng + *

+ * bucket 设置公共读权限 + */ +@Data +@ConfigurationProperties(prefix = "local") +public class LocalFileProperties { + + /** + * 是否开启 + */ + private boolean enable; + + /** + * 默认路径 + */ + private String basePath; + +} diff --git a/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/local/LocalFileTemplate.java b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/local/LocalFileTemplate.java new file mode 100644 index 00000000..295186df --- /dev/null +++ b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/local/LocalFileTemplate.java @@ -0,0 +1,139 @@ +package com.pig4cloud.pig.common.file.local; + +import cn.hutool.core.io.FileUtil; +import com.amazonaws.services.s3.model.Bucket; +import com.amazonaws.services.s3.model.S3Object; +import com.amazonaws.services.s3.model.S3ObjectSummary; +import com.pig4cloud.pig.common.file.core.FileProperties; +import com.pig4cloud.pig.common.file.core.FileTemplate; +import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; + +import java.io.File; +import java.io.InputStream; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 本地文件读取模式 + * + * @author lengleng + * @date 2022/4/19 + */ +@RequiredArgsConstructor +public class LocalFileTemplate implements FileTemplate { + + private final FileProperties properties; + + /** + * 创建bucket + * @param bucketName bucket名称 + */ + @Override + public void createBucket(String bucketName) { + FileUtil.mkdir(properties.getLocal().getBasePath() + FileUtil.FILE_SEPARATOR + bucketName); + } + + /** + * 获取全部bucket + *

+ *

+ * API Documentation + */ + @Override + public List getAllBuckets() { + return Arrays.stream(FileUtil.ls(properties.getLocal().getBasePath())) + .filter(FileUtil::isDirectory) + .map(dir -> new Bucket(dir.getName())) + .collect(Collectors.toList()); + } + + /** + * @param bucketName bucket名称 + * @see + */ + @Override + public void removeBucket(String bucketName) { + FileUtil.del(properties.getLocal().getBasePath() + FileUtil.FILE_SEPARATOR + bucketName); + } + + /** + * 上传文件 + * @param bucketName bucket名称 + * @param objectName 文件名称 + * @param stream 文件流 + * @param contextType 文件类型 + */ + @Override + public void putObject(String bucketName, String objectName, InputStream stream, String contextType) { + // 当 Bucket 不存在时创建 + String dir = properties.getLocal().getBasePath() + FileUtil.FILE_SEPARATOR + bucketName; + if (!FileUtil.isDirectory(properties.getLocal().getBasePath() + FileUtil.FILE_SEPARATOR + bucketName)) { + createBucket(bucketName); + } + + // 写入文件 + File file = FileUtil.file(dir + FileUtil.FILE_SEPARATOR + objectName); + FileUtil.writeFromStream(stream, file); + } + + /** + * 获取文件 + * @param bucketName bucket名称 + * @param objectName 文件名称 + * @return 二进制流 API Documentation + */ + @Override + @SneakyThrows + public S3Object getObject(String bucketName, String objectName) { + String dir = properties.getLocal().getBasePath() + FileUtil.FILE_SEPARATOR + bucketName; + S3Object s3Object = new S3Object(); + s3Object.setObjectContent(FileUtil.getInputStream(dir + FileUtil.FILE_SEPARATOR + objectName)); + return s3Object; + } + + /** + * @param bucketName + * @param objectName + * @throws Exception + */ + @Override + public void removeObject(String bucketName, String objectName) throws Exception { + String dir = properties.getLocal().getBasePath() + FileUtil.FILE_SEPARATOR + bucketName; + FileUtil.del(dir + FileUtil.FILE_SEPARATOR + objectName); + } + + /** + * 上传文件 + * @param bucketName bucket名称 + * @param objectName 文件名称 + * @param stream 文件流 + * @throws Exception + */ + @Override + public void putObject(String bucketName, String objectName, InputStream stream) throws Exception { + putObject(bucketName, objectName, stream, null); + } + + /** + * 根据文件前置查询文件 + * @param bucketName bucket名称 + * @param prefix 前缀 + * @param recursive 是否递归查询 + * @return S3ObjectSummary 列表 + * @see AWS + * API Documentation + */ + @Override + public List getAllObjectsByPrefix(String bucketName, String prefix, boolean recursive) { + String dir = properties.getLocal().getBasePath() + FileUtil.FILE_SEPARATOR + bucketName; + + return Arrays.stream(FileUtil.ls(dir)).filter(file -> file.getName().startsWith(prefix)).map(file -> { + S3ObjectSummary summary = new S3ObjectSummary(); + summary.setKey(file.getName()); + return new S3ObjectSummary(); + }).collect(Collectors.toList()); + } + +} diff --git a/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/oss/OssAutoConfiguration.java b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/oss/OssAutoConfiguration.java new file mode 100755 index 00000000..e0b31449 --- /dev/null +++ b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/oss/OssAutoConfiguration.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.common.file.oss; + +import com.pig4cloud.pig.common.file.core.FileProperties; +import com.pig4cloud.pig.common.file.core.FileTemplate; +import com.pig4cloud.pig.common.file.oss.http.OssEndpoint; +import com.pig4cloud.pig.common.file.oss.service.OssTemplate; +import lombok.AllArgsConstructor; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Primary; + +/** + * aws 自动配置类 + * + * @author lengleng + * @author 858695266 + */ +@AllArgsConstructor +public class OssAutoConfiguration { + + private final FileProperties properties; + + @Bean + @Primary + @ConditionalOnMissingBean(OssTemplate.class) + @ConditionalOnProperty(name = "file.oss.enable", havingValue = "true") + public FileTemplate ossTemplate() { + return new OssTemplate(properties); + } + + @Bean + @ConditionalOnMissingBean + @ConditionalOnProperty(name = "file.oss.info", havingValue = "true") + public OssEndpoint ossEndpoint(OssTemplate template) { + return new OssEndpoint(template); + } + +} diff --git a/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/oss/OssProperties.java b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/oss/OssProperties.java new file mode 100755 index 00000000..a1cad010 --- /dev/null +++ b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/oss/OssProperties.java @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.common.file.oss; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * aws 配置信息 + * + * @author lengleng + * @author 858695266 配置文件添加: oss: enable: true endpoint: http://127.0.0.1:9000 # + * pathStyleAccess 采用nginx反向代理或者AWS S3 配置成true,支持第三方云存储配置成false pathStyleAccess: false + * access-key: lengleng secret-key: lengleng bucket-name: lengleng region: custom-domain: + * https://oss.xxx.com/lengleng + *

+ * bucket 设置公共读权限 + */ +@Data +@ConfigurationProperties(prefix = "oss") +public class OssProperties { + + /** + * 对象存储服务的URL + */ + private String endpoint; + + /** + * 自定义域名 + */ + private String customDomain; + + /** + * true path-style nginx 反向代理和S3默认支持 pathStyle {http://endpoint/bucketname} false + * supports virtual-hosted-style 阿里云等需要配置为 virtual-hosted-style + * 模式{http://bucketname.endpoint} + */ + private Boolean pathStyleAccess = true; + + /** + * 应用ID + */ + private String appId; + + /** + * 区域 + */ + private String region; + + /** + * Access key就像用户ID,可以唯一标识你的账户 + */ + private String accessKey; + + /** + * Secret key是你账户的密码 + */ + private String secretKey; + + /** + * 最大线程数,默认: 100 + */ + private Integer maxConnections = 100; + +} diff --git a/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/oss/http/OssEndpoint.java b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/oss/http/OssEndpoint.java new file mode 100755 index 00000000..4ab42ca7 --- /dev/null +++ b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/oss/http/OssEndpoint.java @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.common.file.oss.http; + +import com.amazonaws.services.s3.model.Bucket; +import com.amazonaws.services.s3.model.S3Object; +import com.amazonaws.services.s3.model.S3ObjectSummary; +import com.pig4cloud.pig.common.file.oss.service.OssTemplate; +import lombok.AllArgsConstructor; +import lombok.Cleanup; +import lombok.SneakyThrows; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * aws 对外提供服务端点 + * + * @author lengleng + * @author 858695266 + *

+ * oss.info + */ +@RestController +@AllArgsConstructor +@RequestMapping("/oss") +@ConditionalOnProperty(name = "file.oss.info", havingValue = "true") +public class OssEndpoint { + + private final OssTemplate template; + + /** + * Bucket Endpoints + */ + @SneakyThrows + @PostMapping("/bucket/{bucketName}") + public Bucket createBucker(@PathVariable String bucketName) { + + template.createBucket(bucketName); + return template.getBucket(bucketName).get(); + + } + + @SneakyThrows + @GetMapping("/bucket") + public List getBuckets() { + return template.getAllBuckets(); + } + + @SneakyThrows + @GetMapping("/bucket/{bucketName}") + public Bucket getBucket(@PathVariable String bucketName) { + return template.getBucket(bucketName).orElseThrow(() -> new IllegalArgumentException("Bucket Name not found!")); + } + + @SneakyThrows + @DeleteMapping("/bucket/{bucketName}") + @ResponseStatus(HttpStatus.ACCEPTED) + public void deleteBucket(@PathVariable String bucketName) { + template.removeBucket(bucketName); + } + + /** + * Object Endpoints + */ + @SneakyThrows + @PostMapping("/object/{bucketName}") + public S3Object createObject(@RequestBody MultipartFile object, @PathVariable String bucketName) { + String name = object.getOriginalFilename(); + @Cleanup + InputStream inputStream = object.getInputStream(); + template.putObject(bucketName, name, inputStream, object.getSize(), object.getContentType()); + return template.getObjectInfo(bucketName, name); + + } + + @SneakyThrows + @PostMapping("/object/{bucketName}/{objectName}") + public S3Object createObject(@RequestBody MultipartFile object, @PathVariable String bucketName, + @PathVariable String objectName) { + @Cleanup + InputStream inputStream = object.getInputStream(); + template.putObject(bucketName, objectName, inputStream, object.getSize(), object.getContentType()); + return template.getObjectInfo(bucketName, objectName); + + } + + @SneakyThrows + @GetMapping("/object/{bucketName}/{objectName}") + public List filterObject(@PathVariable String bucketName, @PathVariable String objectName) { + + return template.getAllObjectsByPrefix(bucketName, objectName, true); + + } + + @SneakyThrows + @GetMapping("/object/{bucketName}/{objectName}/{expires}") + public Map getObject(@PathVariable String bucketName, @PathVariable String objectName, + @PathVariable Integer expires) { + Map responseBody = new HashMap<>(8); + // Put Object info + responseBody.put("bucket", bucketName); + responseBody.put("object", objectName); + responseBody.put("url", template.getObjectURL(bucketName, objectName, expires)); + responseBody.put("expires", expires); + return responseBody; + } + + @SneakyThrows + @ResponseStatus(HttpStatus.ACCEPTED) + @DeleteMapping("/object/{bucketName}/{objectName}/") + public void deleteObject(@PathVariable String bucketName, @PathVariable String objectName) { + + template.removeObject(bucketName, objectName); + } + +} diff --git a/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/oss/service/OssTemplate.java b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/oss/service/OssTemplate.java new file mode 100755 index 00000000..fd6bd119 --- /dev/null +++ b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/oss/service/OssTemplate.java @@ -0,0 +1,240 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.common.file.oss.service; + +import com.amazonaws.ClientConfiguration; +import com.amazonaws.auth.AWSCredentials; +import com.amazonaws.auth.AWSCredentialsProvider; +import com.amazonaws.auth.AWSStaticCredentialsProvider; +import com.amazonaws.auth.BasicAWSCredentials; +import com.amazonaws.client.builder.AwsClientBuilder; +import com.amazonaws.services.s3.AmazonS3; +import com.amazonaws.services.s3.AmazonS3Client; +import com.amazonaws.services.s3.model.*; +import com.amazonaws.util.IOUtils; +import com.pig4cloud.pig.common.file.core.FileProperties; +import com.pig4cloud.pig.common.file.core.FileTemplate; +import lombok.Cleanup; +import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; +import org.springframework.beans.factory.InitializingBean; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.net.URL; +import java.util.*; + +/** + * aws-s3 通用存储操作 支持所有兼容s3协议的云存储: {阿里云OSS,腾讯云COS,七牛云,京东云,minio 等} + * + * @author lengleng + * @author 858695266 + * @date 2020/5/23 6:36 上午 + * @since 1.0 + */ +@RequiredArgsConstructor +public class OssTemplate implements InitializingBean, FileTemplate { + + private final FileProperties properties; + + private AmazonS3 amazonS3; + + /** + * 创建bucket + * @param bucketName bucket名称 + */ + @SneakyThrows + public void createBucket(String bucketName) { + if (!amazonS3.doesBucketExistV2(bucketName)) { + amazonS3.createBucket((bucketName)); + } + } + + /** + * 获取全部bucket + *

+ * + * @see AWS + * API Documentation + */ + @SneakyThrows + public List getAllBuckets() { + return amazonS3.listBuckets(); + } + + /** + * @param bucketName bucket名称 + * @see AWS + * API Documentation + */ + @SneakyThrows + public Optional getBucket(String bucketName) { + return amazonS3.listBuckets().stream().filter(b -> b.getName().equals(bucketName)).findFirst(); + } + + /** + * @param bucketName bucket名称 + * @see AWS API + * Documentation + */ + @SneakyThrows + public void removeBucket(String bucketName) { + amazonS3.deleteBucket(bucketName); + } + + /** + * 根据文件前置查询文件 + * @param bucketName bucket名称 + * @param prefix 前缀 + * @param recursive 是否递归查询 + * @return S3ObjectSummary 列表 + * @see AWS + * API Documentation + */ + @SneakyThrows + public List getAllObjectsByPrefix(String bucketName, String prefix, boolean recursive) { + ObjectListing objectListing = amazonS3.listObjects(bucketName, prefix); + return new ArrayList<>(objectListing.getObjectSummaries()); + } + + /** + * 获取文件外链 + * @param bucketName bucket名称 + * @param objectName 文件名称 + * @param expires 过期时间 <=7 + * @return url + * @see AmazonS3#generatePresignedUrl(String bucketName, String key, Date expiration) + */ + @SneakyThrows + public String getObjectURL(String bucketName, String objectName, Integer expires) { + Date date = new Date(); + Calendar calendar = new GregorianCalendar(); + calendar.setTime(date); + calendar.add(Calendar.DAY_OF_MONTH, expires); + URL url = amazonS3.generatePresignedUrl(bucketName, objectName, calendar.getTime()); + return url.toString(); + } + + /** + * 获取文件 + * @param bucketName bucket名称 + * @param objectName 文件名称 + * @return 二进制流 + * @see AWS + * API Documentation + */ + @SneakyThrows + public S3Object getObject(String bucketName, String objectName) { + return amazonS3.getObject(bucketName, objectName); + } + + /** + * 上传文件 + * @param bucketName bucket名称 + * @param objectName 文件名称 + * @param stream 文件流 + * @throws Exception + */ + public void putObject(String bucketName, String objectName, InputStream stream) throws Exception { + putObject(bucketName, objectName, stream, stream.available(), "application/octet-stream"); + } + + /** + * 上传文件 + * @param bucketName bucket名称 + * @param objectName 文件名称 + * @param stream 文件流 + * @param contextType 文件类型 + * @throws Exception + */ + public void putObject(String bucketName, String objectName, InputStream stream, String contextType) + throws Exception { + putObject(bucketName, objectName, stream, stream.available(), contextType); + } + + /** + * 上传文件 + * @param bucketName bucket名称 + * @param objectName 文件名称 + * @param stream 文件流 + * @param size 大小 + * @param contextType 类型 + * @throws Exception + * @see AWS + * API Documentation + */ + public PutObjectResult putObject(String bucketName, String objectName, InputStream stream, long size, + String contextType) throws Exception { + // String fileName = getFileName(objectName); + byte[] bytes = IOUtils.toByteArray(stream); + ObjectMetadata objectMetadata = new ObjectMetadata(); + objectMetadata.setContentLength(size); + objectMetadata.setContentType(contextType); + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + // 上传 + return amazonS3.putObject(bucketName, objectName, byteArrayInputStream, objectMetadata); + + } + + /** + * 获取文件信息 + * @param bucketName bucket名称 + * @param objectName 文件名称 + * @see AWS + * API Documentation + */ + public S3Object getObjectInfo(String bucketName, String objectName) throws Exception { + @Cleanup + S3Object object = amazonS3.getObject(bucketName, objectName); + return object; + } + + /** + * 删除文件 + * @param bucketName bucket名称 + * @param objectName 文件名称 + * @throws Exception + * @see AWS API + * Documentation + */ + public void removeObject(String bucketName, String objectName) throws Exception { + amazonS3.deleteObject(bucketName, objectName); + } + + @Override + public void afterPropertiesSet() { + ClientConfiguration clientConfiguration = new ClientConfiguration(); + clientConfiguration.setMaxConnections(properties.getOss().getMaxConnections()); + + AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration( + properties.getOss().getEndpoint(), properties.getOss().getRegion()); + AWSCredentials awsCredentials = new BasicAWSCredentials(properties.getOss().getAccessKey(), + properties.getOss().getSecretKey()); + AWSCredentialsProvider awsCredentialsProvider = new AWSStaticCredentialsProvider(awsCredentials); + this.amazonS3 = AmazonS3Client.builder() + .withEndpointConfiguration(endpointConfiguration) + .withClientConfiguration(clientConfiguration) + .withCredentials(awsCredentialsProvider) + .disableChunkedEncoding() + .withPathStyleAccessEnabled(properties.getOss().getPathStyleAccess()) + .build(); + } + +} diff --git a/pig-common/pig-common-oss/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/pig-common/pig-common-oss/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..ae145c04 --- /dev/null +++ b/pig-common/pig-common-oss/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.pig4cloud.pig.common.file.FileAutoConfiguration diff --git a/pig-common/pig-common-seata/pom.xml b/pig-common/pig-common-seata/pom.xml index d227a7fc..8d995c62 100755 --- a/pig-common/pig-common-seata/pom.xml +++ b/pig-common/pig-common-seata/pom.xml @@ -23,7 +23,7 @@ com.pig4cloud pig-common - 3.6.7 + 3.7.0-JDK8 pig-common-seata diff --git a/pig-common/pig-common-security/pom.xml b/pig-common/pig-common-security/pom.xml index 46652e78..9cd6769e 100755 --- a/pig-common/pig-common-security/pom.xml +++ b/pig-common/pig-common-security/pom.xml @@ -21,7 +21,7 @@ com.pig4cloud pig-common - 3.6.7 + 3.7.0-JDK8 pig-common-security diff --git a/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/component/PigCustomOAuth2AccessTokenResponseHttpMessageConverter.java b/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/component/PigCustomOAuth2AccessTokenResponseHttpMessageConverter.java new file mode 100644 index 00000000..378240fc --- /dev/null +++ b/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/component/PigCustomOAuth2AccessTokenResponseHttpMessageConverter.java @@ -0,0 +1,51 @@ +package com.pig4cloud.pig.common.security.component; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.pig4cloud.pig.common.core.util.SpringContextHolder; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.core.convert.converter.Converter; +import org.springframework.http.HttpOutputMessage; +import org.springframework.http.MediaType; +import org.springframework.http.converter.GenericHttpMessageConverter; +import org.springframework.http.converter.HttpMessageNotWritableException; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.security.oauth2.core.endpoint.DefaultOAuth2AccessTokenResponseMapConverter; +import org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse; +import org.springframework.security.oauth2.core.http.converter.OAuth2AccessTokenResponseHttpMessageConverter; + +import java.util.Map; + +/** + * 扩展原生的实现,支持 Long2String + * + * @author lengleng + * @date 2023/6/28 + */ +public class PigCustomOAuth2AccessTokenResponseHttpMessageConverter + extends OAuth2AccessTokenResponseHttpMessageConverter { + + private static final ParameterizedTypeReference> STRING_OBJECT_MAP = new ParameterizedTypeReference>() { + }; + + private Converter> accessTokenResponseParametersConverter = new DefaultOAuth2AccessTokenResponseMapConverter(); + + @Override + protected void writeInternal(OAuth2AccessTokenResponse tokenResponse, HttpOutputMessage outputMessage) + throws HttpMessageNotWritableException { + try { + Map tokenResponseParameters = this.accessTokenResponseParametersConverter + .convert(tokenResponse); + + ObjectMapper objectMapper = SpringContextHolder.getBean(ObjectMapper.class); + GenericHttpMessageConverter jsonMessageConverter = new MappingJackson2HttpMessageConverter( + objectMapper); + jsonMessageConverter.write(tokenResponseParameters, STRING_OBJECT_MAP.getType(), MediaType.APPLICATION_JSON, + outputMessage); + } + catch (Exception ex) { + throw new HttpMessageNotWritableException( + "An error occurred writing the OAuth 2.0 Access Token Response: " + ex.getMessage(), ex); + } + } + +} diff --git a/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/service/PigAppUserDetailsServiceImpl.java b/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/service/PigAppUserDetailsServiceImpl.java index 2da51253..93a718af 100755 --- a/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/service/PigAppUserDetailsServiceImpl.java +++ b/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/service/PigAppUserDetailsServiceImpl.java @@ -16,6 +16,7 @@ package com.pig4cloud.pig.common.security.service; +import com.pig4cloud.pig.admin.api.dto.UserDTO; import com.pig4cloud.pig.admin.api.dto.UserInfo; import com.pig4cloud.pig.admin.api.feign.RemoteUserService; import com.pig4cloud.pig.common.core.constant.CacheConstants; @@ -54,7 +55,9 @@ public class PigAppUserDetailsServiceImpl implements PigUserDetailsService { return (PigUser) cache.get(phone).get(); } - R result = remoteUserService.infoByMobile(phone); + UserDTO userDTO = new UserDTO(); + userDTO.setPhone(phone); + R result = remoteUserService.info(userDTO, SecurityConstants.FROM_IN); UserDetails userDetails = getUserDetails(result); if (cache != null) { @@ -80,7 +83,7 @@ public class PigAppUserDetailsServiceImpl implements PigUserDetailsService { */ @Override public boolean support(String clientId, String grantType) { - return SecurityConstants.APP.equals(grantType); + return SecurityConstants.MOBILE.equals(grantType); } } diff --git a/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/service/PigRemoteRegisteredClientRepository.java b/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/service/PigRemoteRegisteredClientRepository.java index 65583c1e..35c62955 100644 --- a/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/service/PigRemoteRegisteredClientRepository.java +++ b/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/service/PigRemoteRegisteredClientRepository.java @@ -19,7 +19,6 @@ import org.springframework.security.oauth2.server.authorization.client.Registere import org.springframework.security.oauth2.server.authorization.settings.ClientSettings; import org.springframework.security.oauth2.server.authorization.settings.OAuth2TokenFormat; import org.springframework.security.oauth2.server.authorization.settings.TokenSettings; -import org.springframework.util.StringUtils; import java.time.Duration; import java.util.Arrays; @@ -56,7 +55,6 @@ public class PigRemoteRegisteredClientRepository implements RegisteredClientRepo */ @Override public void save(RegisteredClient registeredClient) { - throw new UnsupportedOperationException(); } /** @@ -87,48 +85,46 @@ public class PigRemoteRegisteredClientRepository implements RegisteredClientRepo @Cacheable(value = CacheConstants.CLIENT_DETAILS_KEY, key = "#clientId", unless = "#result == null") public RegisteredClient findByClientId(String clientId) { - SysOauthClientDetails clientDetails = RetOps.of(clientDetailsService.getClientDetailsById(clientId)) - .getData() - .orElseThrow(() -> new OAuth2AuthorizationCodeRequestAuthenticationException( - new OAuth2Error("客户端查询异常,请检查数据库链接"), null)); + SysOauthClientDetails clientDetails = RetOps + .of(clientDetailsService.getClientDetailsById(clientId, SecurityConstants.FROM_IN)) + .getData() + .orElseThrow(() -> new OAuth2AuthorizationCodeRequestAuthenticationException( + new OAuth2Error("客户端查询异常,请检查数据库链接"), null)); RegisteredClient.Builder builder = RegisteredClient.withId(clientDetails.getClientId()) - .clientId(clientDetails.getClientId()) - .clientSecret(SecurityConstants.NOOP + clientDetails.getClientSecret()) - .clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_POST) - .clientAuthenticationMethods(clientAuthenticationMethods -> { - clientAuthenticationMethods.add(ClientAuthenticationMethod.CLIENT_SECRET_BASIC); - clientAuthenticationMethods.add(ClientAuthenticationMethod.CLIENT_SECRET_POST); - }); + .clientId(clientDetails.getClientId()) + .clientSecret(SecurityConstants.NOOP + clientDetails.getClientSecret()) + .clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_BASIC); + + + for (String authorizedGrantType : clientDetails.getAuthorizedGrantTypes()) { + builder.authorizationGrantType(new AuthorizationGrantType(authorizedGrantType)); + } - // 授权模式 - Optional.ofNullable(clientDetails.getAuthorizedGrantTypes()) - .ifPresent(grants -> StringUtils.commaDelimitedListToSet(grants) - .forEach(s -> builder.authorizationGrantType(new AuthorizationGrantType(s)))); // 回调地址 Optional.ofNullable(clientDetails.getWebServerRedirectUri()) - .ifPresent(redirectUri -> Arrays.stream(redirectUri.split(StrUtil.COMMA)) - .filter(StrUtil::isNotBlank) - .forEach(builder::redirectUri)); + .ifPresent(redirectUri -> Arrays.stream(redirectUri.split(StrUtil.COMMA)) + .filter(StrUtil::isNotBlank) + .forEach(builder::redirectUri)); // scope Optional.ofNullable(clientDetails.getScope()) - .ifPresent(scope -> Arrays.stream(scope.split(StrUtil.COMMA)) - .filter(StrUtil::isNotBlank) - .forEach(builder::scope)); + .ifPresent(scope -> Arrays.stream(scope.split(StrUtil.COMMA)) + .filter(StrUtil::isNotBlank) + .forEach(builder::scope)); return builder - .tokenSettings(TokenSettings.builder() - .accessTokenFormat(OAuth2TokenFormat.REFERENCE) - .accessTokenTimeToLive(Duration.ofSeconds( - Optional.ofNullable(clientDetails.getAccessTokenValidity()).orElse(accessTokenValiditySeconds))) - .refreshTokenTimeToLive(Duration.ofSeconds(Optional.ofNullable(clientDetails.getRefreshTokenValidity()) - .orElse(refreshTokenValiditySeconds))) - .build()) - .clientSettings(ClientSettings.builder() - .requireAuthorizationConsent(!BooleanUtil.toBoolean(clientDetails.getAutoapprove())) - .build()) - .build(); + .tokenSettings(TokenSettings.builder() + .accessTokenFormat(OAuth2TokenFormat.REFERENCE) + .accessTokenTimeToLive(Duration.ofSeconds( + Optional.ofNullable(clientDetails.getAccessTokenValidity()).orElse(accessTokenValiditySeconds))) + .refreshTokenTimeToLive(Duration.ofSeconds(Optional.ofNullable(clientDetails.getRefreshTokenValidity()) + .orElse(refreshTokenValiditySeconds))) + .build()) + .clientSettings(ClientSettings.builder() + .requireAuthorizationConsent(!BooleanUtil.toBoolean(clientDetails.getAutoapprove())) + .build()) + .build(); } diff --git a/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/service/PigUserDetailsServiceImpl.java b/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/service/PigUserDetailsServiceImpl.java index 0eb0b862..a997a928 100755 --- a/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/service/PigUserDetailsServiceImpl.java +++ b/pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/service/PigUserDetailsServiceImpl.java @@ -16,9 +16,11 @@ package com.pig4cloud.pig.common.security.service; +import com.pig4cloud.pig.admin.api.dto.UserDTO; import com.pig4cloud.pig.admin.api.dto.UserInfo; import com.pig4cloud.pig.admin.api.feign.RemoteUserService; import com.pig4cloud.pig.common.core.constant.CacheConstants; +import com.pig4cloud.pig.common.core.constant.SecurityConstants; import com.pig4cloud.pig.common.core.util.R; import lombok.RequiredArgsConstructor; import lombok.SneakyThrows; @@ -55,7 +57,9 @@ public class PigUserDetailsServiceImpl implements PigUserDetailsService { return (PigUser) cache.get(username).get(); } - R result = remoteUserService.info(username); + UserDTO userDTO = new UserDTO(); + userDTO.setUsername(username); + R result = remoteUserService.info(userDTO, SecurityConstants.FROM_IN); UserDetails userDetails = getUserDetails(result); if (cache != null) { cache.put(username, userDetails); diff --git a/pig-common/pig-common-swagger/pom.xml b/pig-common/pig-common-swagger/pom.xml index 50015985..e5374f45 100644 --- a/pig-common/pig-common-swagger/pom.xml +++ b/pig-common/pig-common-swagger/pom.xml @@ -24,7 +24,7 @@ com.pig4cloud pig-common - 3.6.7 + 3.7.0-JDK8 pig-common-swagger diff --git a/pig-common/pig-common-xss/pom.xml b/pig-common/pig-common-xss/pom.xml index 615fd489..400dbb07 100755 --- a/pig-common/pig-common-xss/pom.xml +++ b/pig-common/pig-common-xss/pom.xml @@ -6,7 +6,7 @@ com.pig4cloud pig-common - 3.6.7 + 3.7.0-JDK8 pig-common-xss diff --git a/pig-common/pom.xml b/pig-common/pom.xml index 15908dee..a41efaab 100755 --- a/pig-common/pom.xml +++ b/pig-common/pom.xml @@ -21,7 +21,7 @@ com.pig4cloud pig - 3.6.7 + 3.7.0-JDK8 pig-common @@ -36,6 +36,7 @@ pig-common-job pig-common-log pig-common-mybatis + pig-common-oss pig-common-seata pig-common-security pig-common-feign diff --git a/pig-gateway/pom.xml b/pig-gateway/pom.xml index 9e4ea278..f0dd6548 100755 --- a/pig-gateway/pom.xml +++ b/pig-gateway/pom.xml @@ -21,7 +21,7 @@ com.pig4cloud pig - 3.6.7 + 3.7.0-JDK8 pig-gateway diff --git a/pig-gateway/src/main/java/com/pig4cloud/pig/gateway/config/SpringDocConfiguration.java b/pig-gateway/src/main/java/com/pig4cloud/pig/gateway/config/SpringDocConfiguration.java index 9b24743b..b5a259eb 100644 --- a/pig-gateway/src/main/java/com/pig4cloud/pig/gateway/config/SpringDocConfiguration.java +++ b/pig-gateway/src/main/java/com/pig4cloud/pig/gateway/config/SpringDocConfiguration.java @@ -21,11 +21,11 @@ import java.util.Map; * swagger 3.0 展示 */ @Configuration(proxyBeanMethods = false) +@ConditionalOnProperty(name = "springdoc.api-docs.enabled", matchIfMissing = true) public class SpringDocConfiguration { @Bean @Lazy(false) - @ConditionalOnProperty(name = "springdoc.api-docs.enabled", matchIfMissing = true) public List apis(SwaggerUiConfigParameters swaggerUiConfigParameters, SwaggerDocProperties swaggerProperties) { List groups = new ArrayList<>(); diff --git a/pig-register/Dockerfile b/pig-register/Dockerfile old mode 100755 new mode 100644 diff --git a/pig-register/pom.xml b/pig-register/pom.xml old mode 100755 new mode 100644 index 0c3f3af1..ccd1201d --- a/pig-register/pom.xml +++ b/pig-register/pom.xml @@ -12,101 +12,102 @@ limitations under the License. --> - 4.0.0 - - com.pig4cloud - pig - 3.6.7 - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + + com.pig4cloud + pig + 3.7.0-JDK8 + - pig-register - jar - pig-register - nacos 注册配置中心 + pig-register + jar + pig-register + nacos 注册配置中心 - - 2.2.3 - + + 2.2.4 + - - - io.springboot.nacos - nacos-config - ${nacos.version} - - - org.apache.tomcat.embed - tomcat-embed-jasper - + + + io.springboot.nacos + nacos-config + ${nacos.version} + + + org.apache.tomcat.embed + tomcat-embed-jasper + - - io.springboot.nacos - nacos-naming - ${nacos.version} - + + io.springboot.nacos + nacos-naming + ${nacos.version} + - - io.springboot.nacos - nacos-istio - ${nacos.version} - + + io.springboot.nacos + nacos-istio + ${nacos.version} + - - io.springboot.nacos - nacos-plugin-default-impl - ${nacos.version} - + + io.springboot.nacos + nacos-plugin-default-impl + ${nacos.version} + - - io.springboot.nacos - nacos-prometheus - ${nacos.version} - + + io.springboot.nacos + nacos-prometheus + ${nacos.version} + - - org.springframework.boot - spring-boot-starter-security - + + org.springframework.boot + spring-boot-starter-security + - - cn.hutool - hutool-system - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - io.fabric8 - docker-maven-plugin - - - - - src/main/resources - true - - **/*.woff - **/*.woff2 - **/*.ttf - **/*.eot - - - - src/main/resources - false - - **/*.woff - **/*.woff2 - **/*.ttf - **/*.eot - - - - + + cn.hutool + hutool-system + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + io.fabric8 + docker-maven-plugin + + + + + src/main/resources + true + + **/*.woff + **/*.woff2 + **/*.ttf + **/*.eot + + + + src/main/resources + false + + **/*.woff + **/*.woff2 + **/*.ttf + **/*.eot + + + + diff --git a/pig-register/src/main/java/com/alibaba/nacos/PigNacosApplication.java b/pig-register/src/main/java/com/alibaba/nacos/PigNacosApplication.java old mode 100755 new mode 100644 index 42abdf46..eaef4fb9 --- a/pig-register/src/main/java/com/alibaba/nacos/PigNacosApplication.java +++ b/pig-register/src/main/java/com/alibaba/nacos/PigNacosApplication.java @@ -46,6 +46,7 @@ public class PigNacosApplication { System.setProperty(ConfigConstants.AUTH_ENABLED, "true"); System.setProperty(ConfigConstants.LOG_BASEDIR, "logs"); System.setProperty(ConfigConstants.LOG_ENABLED, "false"); + System.setProperty(ConfigConstants.NACOS_CONTEXT_PATH, "/nacos"); return true; } diff --git a/pig-register/src/main/java/com/alibaba/nacos/config/ConfigConstants.java b/pig-register/src/main/java/com/alibaba/nacos/config/ConfigConstants.java old mode 100755 new mode 100644 index 91133f54..b4998e42 --- a/pig-register/src/main/java/com/alibaba/nacos/config/ConfigConstants.java +++ b/pig-register/src/main/java/com/alibaba/nacos/config/ConfigConstants.java @@ -45,4 +45,9 @@ public interface ConfigConstants { */ String LOG_ENABLED = "server.tomcat.accesslog.enabled"; + /** + * 路径 nacos context path + */ + String NACOS_CONTEXT_PATH = "server.servlet.contextPath"; + } diff --git a/pig-register/src/main/java/com/alibaba/nacos/config/ConsoleConfig.java b/pig-register/src/main/java/com/alibaba/nacos/config/ConsoleConfig.java index b5dbe6e8..be96ebcb 100644 --- a/pig-register/src/main/java/com/alibaba/nacos/config/ConsoleConfig.java +++ b/pig-register/src/main/java/com/alibaba/nacos/config/ConsoleConfig.java @@ -16,7 +16,6 @@ package com.alibaba.nacos.config; -import com.alibaba.nacos.console.filter.XssFilter; import com.alibaba.nacos.core.code.ControllerMethodsCache; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; @@ -65,17 +64,11 @@ public class ConsoleConfig { config.addAllowedHeader("*"); config.setMaxAge(18000L); config.addAllowedMethod("*"); - config.addAllowedOriginPattern("*"); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); source.registerCorsConfiguration("/**", config); return new CorsFilter(source); } - @Bean - public XssFilter xssFilter() { - return new XssFilter(); - } - @Bean public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization() { return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(ZoneId.systemDefault().toString()); diff --git a/pig-register/src/main/java/com/alibaba/nacos/console/controller/ServerStateController.java b/pig-register/src/main/java/com/alibaba/nacos/console/controller/ServerStateController.java index 8eac3c71..1bceefa5 100644 --- a/pig-register/src/main/java/com/alibaba/nacos/console/controller/ServerStateController.java +++ b/pig-register/src/main/java/com/alibaba/nacos/console/controller/ServerStateController.java @@ -16,18 +16,19 @@ package com.alibaba.nacos.console.controller; +import cn.hutool.core.io.FileUtil; import com.alibaba.nacos.common.model.RestResult; import com.alibaba.nacos.common.model.RestResultUtils; -import com.alibaba.nacos.sys.env.EnvUtil; import com.alibaba.nacos.sys.module.ModuleState; import com.alibaba.nacos.sys.module.ModuleStateHolder; -import com.alibaba.nacos.sys.utils.DiskUtils; +import lombok.SneakyThrows; +import org.springframework.core.io.ClassPathResource; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import java.io.File; +import java.nio.charset.Charset; import java.util.HashMap; import java.util.Map; @@ -40,7 +41,7 @@ import java.util.Map; @RequestMapping("/v1/console/server") public class ServerStateController { - private static final String ANNOUNCEMENT_FILE = "announcement.conf"; + private static final String ANNOUNCEMENT_FILE = "conf/announcement.conf"; /** * Get server state of current server. @@ -55,14 +56,11 @@ public class ServerStateController { return ResponseEntity.ok().body(serverState); } + @SneakyThrows @GetMapping("/announcement") public RestResult getAnnouncement() { - File announcementFile = new File(EnvUtil.getConfPath(), ANNOUNCEMENT_FILE); - String announcement = null; - if (announcementFile.exists() && announcementFile.isFile()) { - announcement = DiskUtils.readFile(announcementFile); - } - return RestResultUtils.success(announcement); + ClassPathResource resource = new ClassPathResource(ANNOUNCEMENT_FILE); + return RestResultUtils.success(FileUtil.readString(resource.getFile(), Charset.defaultCharset())); } } diff --git a/pig-register/src/main/resources/META-INF/nacos-default.properties b/pig-register/src/main/resources/META-INF/nacos-default.properties deleted file mode 100644 index 04aa6500..00000000 --- a/pig-register/src/main/resources/META-INF/nacos-default.properties +++ /dev/null @@ -1,78 +0,0 @@ -# -# Copyright 1999-2018 Alibaba Group Holding Ltd. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Console Default Properties - -spring.mvc.view.prefix=/jsp/ -# the default suffix of page -spring.mvc.view.suffix=.jsp -spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration -#logging.level.root=DEBUG - -# P0 key,For Debug. whether use address-server; true:use; false:not use;default:true -useAddressServer=true - -# whether open interInterFaceFilter; true:open; false:close; if open, others can't call inner interface. default:false -openInnerInterfaceFilter=false - -# quickStart stip dumpAll;only dump change config -isQuickStart=false - -# server notify each otherd -notifyConnectTimeout=200 - -# server notify each other -notifySocketTimeout=8000 - -# whether health check -isHealthCheck=true - -# health check max fail count -maxHealthCheckFailCount=12 - -# whether open spas; true:open; false:close -OPEN_SPAS=true - -nacos.cmdb.dumpTaskInterval=3600 -nacos.cmdb.eventTaskInterval=10 -nacos.cmdb.labelTaskInterval=300 -nacos.cmdb.loadDataAtStart=false - -#management.endpoints.web.exposure.include=* - -#spring.security.enabled=false -#management.security=false -#security.basic.enabled=false -#nacos.security.ignore.urls=/** -nacos.security.ignore.urls=/,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-ui/public/**,/v1/auth/login,/v1/console/health,/v1/cs/**,/v1/ns/**,/v1/cmdb/**,/actuator/** - -management.metrics.export.elastic.enabled=false -#management.metrics.export.elastic.host=http://localhost:9200 - -# metrics for influx -management.metrics.export.influx.enabled=false -#management.metrics.export.influx.db=springboot -#management.metrics.export.influx.uri=http://localhost:8086 -#management.metrics.export.influx.auto-create-db=true -#management.metrics.export.influx.consistency=one -#management.metrics.export.influx.compressed=true - -server.tomcat.accesslog.enabled=true -server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D -# default current work dir -server.tomcat.basedir= - - diff --git a/pig-register/src/main/resources/META-INF/schema.sql b/pig-register/src/main/resources/META-INF/schema.sql deleted file mode 100644 index db17fcb1..00000000 --- a/pig-register/src/main/resources/META-INF/schema.sql +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -CREATE SCHEMA nacos AUTHORIZATION nacos; - -CREATE TABLE config_info ( - id bigint NOT NULL generated by default as identity, - data_id varchar(255) NOT NULL, - group_id varchar(128) NOT NULL, - tenant_id varchar(128) default '', - app_name varchar(128), - content CLOB, - md5 varchar(32) DEFAULT NULL, - gmt_create timestamp NOT NULL DEFAULT '2010-05-05 00:00:00', - gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00', - src_user varchar(128) DEFAULT NULL, - src_ip varchar(20) DEFAULT NULL, - c_desc varchar(256) DEFAULT NULL, - c_use varchar(64) DEFAULT NULL, - effect varchar(64) DEFAULT NULL, - type varchar(64) DEFAULT NULL, - c_schema LONG VARCHAR DEFAULT NULL, - encrypted_data_key LONG VARCHAR DEFAULT NULL, - constraint configinfo_id_key PRIMARY KEY (id), - constraint uk_configinfo_datagrouptenant UNIQUE (data_id,group_id,tenant_id)); - -CREATE INDEX configinfo_dataid_key_idx ON config_info(data_id); -CREATE INDEX configinfo_groupid_key_idx ON config_info(group_id); -CREATE INDEX configinfo_dataid_group_key_idx ON config_info(data_id, group_id); - -CREATE TABLE his_config_info ( - id bigint NOT NULL, - nid bigint NOT NULL generated by default as identity, - data_id varchar(255) NOT NULL, - group_id varchar(128) NOT NULL, - tenant_id varchar(128) default '', - app_name varchar(128), - content CLOB, - md5 varchar(32) DEFAULT NULL, - gmt_create timestamp NOT NULL DEFAULT '2010-05-05 00:00:00.000', - gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00.000', - src_user varchar(128), - src_ip varchar(20) DEFAULT NULL, - op_type char(10) DEFAULT NULL, - encrypted_data_key LONG VARCHAR DEFAULT NULL, - constraint hisconfiginfo_nid_key PRIMARY KEY (nid)); - -CREATE INDEX hisconfiginfo_dataid_key_idx ON his_config_info(data_id); -CREATE INDEX hisconfiginfo_gmt_create_idx ON his_config_info(gmt_create); -CREATE INDEX hisconfiginfo_gmt_modified_idx ON his_config_info(gmt_modified); - - -CREATE TABLE config_info_beta ( - id bigint NOT NULL generated by default as identity, - data_id varchar(255) NOT NULL, - group_id varchar(128) NOT NULL, - tenant_id varchar(128) default '', - app_name varchar(128), - content CLOB, - beta_ips varchar(1024), - md5 varchar(32) DEFAULT NULL, - gmt_create timestamp NOT NULL DEFAULT '2010-05-05 00:00:00', - gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00', - src_user varchar(128), - src_ip varchar(20) DEFAULT NULL, - encrypted_data_key LONG VARCHAR DEFAULT NULL, - constraint configinfobeta_id_key PRIMARY KEY (id), - constraint uk_configinfobeta_datagrouptenant UNIQUE (data_id,group_id,tenant_id)); - -CREATE TABLE config_info_tag ( - id bigint NOT NULL generated by default as identity, - data_id varchar(255) NOT NULL, - group_id varchar(128) NOT NULL, - tenant_id varchar(128) default '', - tag_id varchar(128) NOT NULL, - app_name varchar(128), - content CLOB, - md5 varchar(32) DEFAULT NULL, - gmt_create timestamp NOT NULL DEFAULT '2010-05-05 00:00:00', - gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00', - src_user varchar(128), - src_ip varchar(20) DEFAULT NULL, - constraint configinfotag_id_key PRIMARY KEY (id), - constraint uk_configinfotag_datagrouptenanttag UNIQUE (data_id,group_id,tenant_id,tag_id)); - -CREATE TABLE config_info_aggr ( - id bigint NOT NULL generated by default as identity, - data_id varchar(255) NOT NULL, - group_id varchar(128) NOT NULL, - tenant_id varchar(128) default '', - datum_id varchar(255) NOT NULL, - app_name varchar(128), - content CLOB, - gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00', - constraint configinfoaggr_id_key PRIMARY KEY (id), - constraint uk_configinfoaggr_datagrouptenantdatum UNIQUE (data_id,group_id,tenant_id,datum_id)); - -CREATE TABLE app_list ( - id bigint NOT NULL generated by default as identity, - app_name varchar(128) NOT NULL, - is_dynamic_collect_disabled smallint DEFAULT 0, - last_sub_info_collected_time timestamp DEFAULT '1970-01-01 08:00:00.0', - sub_info_lock_owner varchar(128), - sub_info_lock_time timestamp DEFAULT '1970-01-01 08:00:00.0', - constraint applist_id_key PRIMARY KEY (id), - constraint uk_appname UNIQUE (app_name)); - -CREATE TABLE app_configdata_relation_subs ( - id bigint NOT NULL generated by default as identity, - app_name varchar(128) NOT NULL, - data_id varchar(255) NOT NULL, - group_id varchar(128) NOT NULL, - gmt_modified timestamp DEFAULT '2010-05-05 00:00:00', - constraint configdatarelationsubs_id_key PRIMARY KEY (id), - constraint uk_app_sub_config_datagroup UNIQUE (app_name, data_id, group_id)); - - -CREATE TABLE app_configdata_relation_pubs ( - id bigint NOT NULL generated by default as identity, - app_name varchar(128) NOT NULL, - data_id varchar(255) NOT NULL, - group_id varchar(128) NOT NULL, - gmt_modified timestamp DEFAULT '2010-05-05 00:00:00', - constraint configdatarelationpubs_id_key PRIMARY KEY (id), - constraint uk_app_pub_config_datagroup UNIQUE (app_name, data_id, group_id)); - -CREATE TABLE config_tags_relation ( - id bigint NOT NULL, - tag_name varchar(128) NOT NULL, - tag_type varchar(64) DEFAULT NULL, - data_id varchar(255) NOT NULL, - group_id varchar(128) NOT NULL, - tenant_id varchar(128) DEFAULT '', - nid bigint NOT NULL generated by default as identity, - constraint config_tags_id_key PRIMARY KEY (nid), - constraint uk_configtagrelation_configidtag UNIQUE (id, tag_name, tag_type)); - -CREATE INDEX config_tags_tenant_id_idx ON config_tags_relation(tenant_id); - -CREATE TABLE group_capacity ( - id bigint NOT NULL generated by default as identity, - group_id varchar(128) DEFAULT '', - quota int DEFAULT 0, - usage int DEFAULT 0, - max_size int DEFAULT 0, - max_aggr_count int DEFAULT 0, - max_aggr_size int DEFAULT 0, - max_history_count int DEFAULT 0, - gmt_create timestamp DEFAULT '2010-05-05 00:00:00', - gmt_modified timestamp DEFAULT '2010-05-05 00:00:00', - constraint group_capacity_id_key PRIMARY KEY (id), - constraint uk_group_id UNIQUE (group_id)); - -CREATE TABLE tenant_capacity ( - id bigint NOT NULL generated by default as identity, - tenant_id varchar(128) DEFAULT '', - quota int DEFAULT 0, - usage int DEFAULT 0, - max_size int DEFAULT 0, - max_aggr_count int DEFAULT 0, - max_aggr_size int DEFAULT 0, - max_history_count int DEFAULT 0, - gmt_create timestamp DEFAULT '2010-05-05 00:00:00', - gmt_modified timestamp DEFAULT '2010-05-05 00:00:00', - constraint tenant_capacity_id_key PRIMARY KEY (id), - constraint uk_tenant_id UNIQUE (tenant_id)); - -CREATE TABLE tenant_info ( - id bigint NOT NULL generated by default as identity, - kp varchar(128) NOT NULL, - tenant_id varchar(128) DEFAULT '', - tenant_name varchar(128) DEFAULT '', - tenant_desc varchar(256) DEFAULT NULL, - create_source varchar(32) DEFAULT NULL, - gmt_create bigint NOT NULL, - gmt_modified bigint NOT NULL, - constraint tenant_info_id_key PRIMARY KEY (id), - constraint uk_tenant_info_kptenantid UNIQUE (kp,tenant_id)); -CREATE INDEX tenant_info_tenant_id_idx ON tenant_info(tenant_id); - -CREATE TABLE users ( - username varchar(50) NOT NULL PRIMARY KEY, - password varchar(500) NOT NULL, - enabled boolean NOT NULL DEFAULT true -); - -CREATE TABLE roles ( - username varchar(50) NOT NULL, - role varchar(50) NOT NULL, - constraint uk_username_role UNIQUE (username,role) -); - -CREATE TABLE permissions ( - role varchar(50) NOT NULL, - resource varchar(512) NOT NULL, - action varchar(8) NOT NULL, - constraint uk_role_permission UNIQUE (role,resource,action) -); - -INSERT INTO users (username, password, enabled) VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', TRUE); - -INSERT INTO roles (username, role) VALUES ('nacos', 'ROLE_ADMIN'); diff --git a/pig-register/src/main/resources/application.yml b/pig-register/src/main/resources/application.yml old mode 100755 new mode 100644 index 58899527..d27db8b1 --- a/pig-register/src/main/resources/application.yml +++ b/pig-register/src/main/resources/application.yml @@ -2,16 +2,16 @@ server: port: 8848 #如何修改 pig-register 启动端口 >: https://t.cn/A6XGvTdb tomcat: basedir: logs - error: - include-message: always + servlet: + context-path: /nacos db: num: 1 user: ${MYSQL_USER:root} password: ${MYSQL_PWD:root} url: - 0: jdbc:mysql://${MYSQL_HOST:pig-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pig_config}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true - pool.config.connectionTimeout: 30000 + 0: jdbc:mysql://${MYSQL_HOST:pig-mysql}:${MYSQL_PORT:4000}/${MYSQL_DB:pig_config}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true + nacos: core: @@ -21,10 +21,11 @@ nacos: key: serverIdentity value: security plugin.nacos.token.secret.key: SecretKey012345678901234567890123456789012345678901234567890123456789 + enabled: false system.type: nacos security: ignore: - urls: /actuator/**,/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/** + urls: /,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/** spring: datasource: diff --git a/pig-register/src/main/resources/conf/announcement.conf b/pig-register/src/main/resources/conf/announcement.conf new file mode 100644 index 00000000..e241c201 --- /dev/null +++ b/pig-register/src/main/resources/conf/announcement.conf @@ -0,0 +1 @@ +无论您是多年编程的高级工程师,还是刚刚入门的实习生,部署请完全参考微服务开发平台部署手册操作。 diff --git a/pig-register/src/main/resources/nacos-version.txt b/pig-register/src/main/resources/nacos-version.txt old mode 100755 new mode 100644 index cf199263..0a7561c5 --- a/pig-register/src/main/resources/nacos-version.txt +++ b/pig-register/src/main/resources/nacos-version.txt @@ -1 +1 @@ -version=2.2.3 +version=2.2.4 diff --git a/pig-upms/pig-upms-api/pom.xml b/pig-upms/pig-upms-api/pom.xml index 9fae9627..eee770ce 100755 --- a/pig-upms/pig-upms-api/pom.xml +++ b/pig-upms/pig-upms-api/pom.xml @@ -21,7 +21,7 @@ com.pig4cloud pig-upms - 3.6.7 + 3.7.0-JDK8 pig-upms-api @@ -36,15 +36,10 @@ com.pig4cloud pig-common-core - - - io.swagger.core.v3 - swagger-annotations - - com.pig4cloud - pig-common-feign + org.springframework.cloud + spring-cloud-openfeign-core true diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/dto/AppSmsDTO.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/dto/AppSmsDTO.java deleted file mode 100644 index 2069903a..00000000 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/dto/AppSmsDTO.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.pig4cloud.pig.admin.api.dto; - -import lombok.Data; - -import javax.validation.constraints.NotBlank; - -/** - * 客户端请求验证码 - * - * @author lengleng - * @date 2022/10/13 - */ -@Data -public class AppSmsDTO { - - /** - * 手机号 - */ - @NotBlank(message = "手机号不能为空") - private String phone; - - /** - * 手机号是否存在数据库 - */ - private Boolean exist; - -} diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/dto/RoleDTO.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/dto/RoleDTO.java deleted file mode 100755 index 5f5f0fdb..00000000 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/dto/RoleDTO.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.pig4cloud.pig.admin.api.dto; - -import com.pig4cloud.pig.admin.api.entity.SysRole; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * @author lengleng - * @date 2019/2/1 角色Dto - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class RoleDTO extends SysRole { - - /** - * 角色部门Id - */ - private Long roleDeptId; - - /** - * 部门名称 - */ - private String deptName; - -} diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/dto/SysLogDTO.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/dto/SysLogDTO.java index fc66c8fe..d7a64a68 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/dto/SysLogDTO.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/dto/SysLogDTO.java @@ -1,6 +1,7 @@ package com.pig4cloud.pig.admin.api.dto; import io.swagger.v3.oas.annotations.media.Schema; +import javax.validation.constraints.NotBlank; import lombok.Data; import java.time.LocalDateTime; @@ -16,20 +17,75 @@ import java.time.LocalDateTime; public class SysLogDTO { /** - * 查询日志类型 + * 编号 */ - @Schema(description = "日志类型") - private String type; + private Long id; + + /** + * 日志类型 + */ + @NotBlank(message = "日志类型不能为空") + private String logType; + + /** + * 日志标题 + */ + @NotBlank(message = "日志标题不能为空") + private String title; + + /** + * 创建者 + */ + private String createBy; + + /** + * 更新时间 + */ + private LocalDateTime updateTime; + + /** + * 操作IP地址 + */ + private String remoteAddr; + + /** + * 用户代理 + */ + private String userAgent; + + /** + * 请求URI + */ + private String requestUri; + + /** + * 操作方式 + */ + private String method; + + /** + * 操作提交的数据 + */ + private String params; + + /** + * 执行时间 + */ + private Long time; + + /** + * 异常信息 + */ + private String exception; + + /** + * 服务ID + */ + private String serviceId; /** * 创建时间区间 [开始时间,结束时间] */ - @Schema(description = "创建时间区间") private LocalDateTime[] createTime; - /** - * 请求IP - */ - private String remoteAddr; - } diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/dto/UserDTO.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/dto/UserDTO.java index 972b2b46..287bae3f 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/dto/UserDTO.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/dto/UserDTO.java @@ -1,22 +1,26 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.api.dto; import com.pig4cloud.pig.admin.api.entity.SysUser; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; @@ -24,17 +28,23 @@ import java.util.List; /** * @author lengleng - * @date 2019/2/1 + * @date 2017/11/5 */ @Data +@Schema(description = "系统用户传输对象") @EqualsAndHashCode(callSuper = true) public class UserDTO extends SysUser { /** * 角色ID */ + @Schema(description = "角色id集合") private List role; + /** + * 部门id + */ + @Schema(description = "部门id") private Long deptId; /** @@ -45,11 +55,7 @@ public class UserDTO extends SysUser { /** * 新密码 */ + @Schema(description = "新密码") private String newpassword1; - /** - * 验证码 - */ - private String code; - } diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/dto/UserInfo.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/dto/UserInfo.java index 789f51e3..d0558648 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/dto/UserInfo.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/dto/UserInfo.java @@ -1,67 +1,54 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.api.dto; -import com.pig4cloud.pig.admin.api.entity.SysPost; -import com.pig4cloud.pig.admin.api.entity.SysRole; import com.pig4cloud.pig.admin.api.entity.SysUser; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import java.io.Serializable; -import java.util.List; /** * @author lengleng - * @date 2019/2/1 - *

- * commit('SET_ROLES', data) commit('SET_NAME', data) commit('SET_AVATAR', data) - * commit('SET_INTRODUCTION', data) commit('SET_PERMISSIONS', data) + * @date 2017/11/11 */ @Data +@Schema(description = "用户信息") public class UserInfo implements Serializable { /** * 用户基本信息 */ + @Schema(description = "用户基本信息") private SysUser sysUser; /** * 权限标识集合 */ + @Schema(description = "权限标识集合") private String[] permissions; /** * 角色集合 */ + @Schema(description = "角色标识集合") private Long[] roles; - /** - * 角色集合 - */ - private List roleList; - - /** - * 岗位集合 - */ - private Long[] posts; - - /** - * 岗位集合 - */ - private List postList; - } diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysDept.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysDept.java index 6d84605d..7315b857 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysDept.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysDept.java @@ -1,31 +1,33 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.api.entity; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.pig4cloud.pig.common.mybatis.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; import io.swagger.v3.oas.annotations.media.Schema; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import lombok.Data; import lombok.EqualsAndHashCode; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; /** *

@@ -33,12 +35,12 @@ import javax.validation.constraints.NotNull; *

* * @author lengleng - * @since 2019/2/1 + * @since 2018-01-22 */ -@Schema(description = "部门") @Data +@Schema(description = "部门") @EqualsAndHashCode(callSuper = true) -public class SysDept extends BaseEntity { +public class SysDept extends Model { private static final long serialVersionUID = 1L; @@ -50,16 +52,44 @@ public class SysDept extends BaseEntity { * 部门名称 */ @NotBlank(message = "部门名称不能为空") - @Schema(description = "部门名称", required = true) + @Schema(description = "部门名称") private String name; /** * 排序 */ - @NotNull(message = "部门排序值不能为空") - @Schema(description = "排序值", required = true) + @NotNull(message = "排序值不能为空") + @Schema(description = "排序值") private Integer sortOrder; + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建人") + private String createBy; + + /** + * 修改人 + */ + @TableField(fill = FieldFill.UPDATE) + @Schema(description = "修改人") + private String updateBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @TableField(fill = FieldFill.UPDATE) + private LocalDateTime updateTime; + /** * 父级部门id */ @@ -67,9 +97,11 @@ public class SysDept extends BaseEntity { private Long parentId; /** - * 是否删除 -1:已删除 0:正常 + * 是否删除 1:已删除 0:正常 */ @TableLogic + @Schema(description = "删除标记,1:已删除,0:正常") + @TableField(fill = FieldFill.INSERT) private String delFlag; } diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysDeptRelation.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysDeptRelation.java index 8fbfea7f..133622cc 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysDeptRelation.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysDeptRelation.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.api.entity; @@ -27,10 +30,10 @@ import lombok.EqualsAndHashCode; *

* * @author lengleng - * @since 2019/2/1 + * @since 2018-01-22 */ -@Schema(description = "部门关系") @Data +@Schema(description = "部门关系") @EqualsAndHashCode(callSuper = true) public class SysDeptRelation extends Model { diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysDict.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysDict.java index 28434df2..31b9829a 100755 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysDict.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysDict.java @@ -1,28 +1,29 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) */ package com.pig4cloud.pig.admin.api.entity; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.pig4cloud.pig.common.mybatis.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; +import java.time.LocalDateTime; + /** * 字典表 * @@ -32,7 +33,7 @@ import lombok.EqualsAndHashCode; @Data @Schema(description = "字典类型") @EqualsAndHashCode(callSuper = true) -public class SysDict extends BaseEntity { +public class SysDict extends Model { private static final long serialVersionUID = 1L; @@ -46,8 +47,8 @@ public class SysDict extends BaseEntity { /** * 类型 */ - @Schema(description = "字典key") - private String dictKey; + @Schema(description = "字典类型") + private String dictType; /** * 描述 @@ -55,6 +56,20 @@ public class SysDict extends BaseEntity { @Schema(description = "字典描述") private String description; + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 更新时间 + */ + @Schema(description = "更新时间") + @TableField(fill = FieldFill.UPDATE) + private LocalDateTime updateTime; + /** * 是否是系统内置 */ @@ -65,12 +80,27 @@ public class SysDict extends BaseEntity { * 备注信息 */ @Schema(description = "备注信息") - private String remark; + private String remarks; + + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建人") + private String createBy; + + /** + * 修改人 + */ + @TableField(fill = FieldFill.UPDATE) + @Schema(description = "修改人") + private String updateBy; /** * 删除标记 */ @TableLogic + @TableField(fill = FieldFill.INSERT) @Schema(description = "删除标记,1:已删除,0:正常") private String delFlag; diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysDictItem.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysDictItem.java index 410edfbd..eed39f70 100755 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysDictItem.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysDictItem.java @@ -1,28 +1,30 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) */ package com.pig4cloud.pig.admin.api.entity; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.pig4cloud.pig.common.mybatis.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; +import java.time.LocalDateTime; + /** * 字典项 * @@ -32,7 +34,7 @@ import lombok.EqualsAndHashCode; @Data @Schema(description = "字典项") @EqualsAndHashCode(callSuper = true) -public class SysDictItem extends BaseEntity { +public class SysDictItem extends Model { private static final long serialVersionUID = 1L; @@ -49,17 +51,12 @@ public class SysDictItem extends BaseEntity { @Schema(description = "所属字典类id") private Long dictId; - /** - * 所属字典类id - */ - @Schema(description = "所属字典类key") - private String dictKey; - /** * 数据值 */ @Schema(description = "数据值") - private String value; + @JsonProperty(value = "value") + private String itemValue; /** * 标签名 @@ -71,7 +68,7 @@ public class SysDictItem extends BaseEntity { * 类型 */ @Schema(description = "类型") - private String type; + private String dictType; /** * 描述 @@ -85,16 +82,45 @@ public class SysDictItem extends BaseEntity { @Schema(description = "排序值,默认升序") private Integer sortOrder; + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建人") + private String createBy; + + /** + * 修改人 + */ + @TableField(fill = FieldFill.UPDATE) + @Schema(description = "修改人") + private String updateBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建时间") + private LocalDateTime createTime; + + /** + * 更新时间 + */ + @TableField(fill = FieldFill.UPDATE) + @Schema(description = "更新时间") + private LocalDateTime updateTime; + /** * 备注信息 */ @Schema(description = "备注信息") - private String remark; + private String remarks; /** * 删除标记 */ @TableLogic + @TableField(fill = FieldFill.INSERT) @Schema(description = "删除标记,1:已删除,0:正常") private String delFlag; diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysFile.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysFile.java index 78882a35..c86ec837 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysFile.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysFile.java @@ -17,13 +17,14 @@ package com.pig4cloud.pig.admin.api.entity; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.pig4cloud.pig.common.mybatis.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; +import java.time.LocalDateTime; + /** * 文件管理 * @@ -31,8 +32,9 @@ import lombok.EqualsAndHashCode; * @date 2019-06-18 17:18:42 */ @Data +@Schema(description = "文件") @EqualsAndHashCode(callSuper = true) -public class SysFile extends BaseEntity { +public class SysFile extends Model { private static final long serialVersionUID = 1L; @@ -40,37 +42,73 @@ public class SysFile extends BaseEntity { * 编号 */ @TableId(type = IdType.ASSIGN_ID) + @Schema(description = "文件编号") private Long id; /** * 文件名 */ + @Schema(description = "文件名") private String fileName; /** * 原文件名 */ + @Schema(description = "原始文件名") private String original; /** * 容器名称 */ + @Schema(description = "存储桶名称") private String bucketName; /** * 文件类型 */ + @Schema(description = "文件类型") private String type; /** * 文件大小 */ + @Schema(description = "文件大小") private Long fileSize; + /** + * 上传人 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建者") + private String createBy; + + /** + * 上传时间 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建时间") + private LocalDateTime createTime; + + /** + * 更新人 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "更新者") + private String updateBy; + + /** + * 更新时间 + */ + @TableField(fill = FieldFill.UPDATE) + @Schema(description = "更新时间") + private LocalDateTime updateTime; + /** * 删除标识:1-删除,0-正常 */ @TableLogic - private Integer delFlag; + @TableField(fill = FieldFill.INSERT) + @Schema(description = "删除标记,1:已删除,0:正常") + private String delFlag; } diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysLog.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysLog.java index f532c95c..61ba452c 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysLog.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysLog.java @@ -1,34 +1,33 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.api.entity; import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelProperty; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import com.pig4cloud.pig.common.mybatis.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.*; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - import javax.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; /** *

@@ -36,21 +35,20 @@ import javax.validation.constraints.NotBlank; *

* * @author lengleng - * @since 2019/2/1 + * @since 2017-11-20 */ @Data -@EqualsAndHashCode(callSuper = true) -public class SysLog extends BaseEntity { +@Schema(description = "日志") +public class SysLog implements Serializable { private static final long serialVersionUID = 1L; /** * 编号 */ - @TableId(value = "id", type = IdType.ASSIGN_ID) + @TableId(type = IdType.ASSIGN_ID) @ExcelProperty("日志编号") @Schema(description = "日志编号") - @JsonSerialize(using = ToStringSerializer.class) private Long id; /** @@ -59,7 +57,7 @@ public class SysLog extends BaseEntity { @NotBlank(message = "日志类型不能为空") @ExcelProperty("日志类型(0-正常 9-错误)") @Schema(description = "日志类型") - private String type; + private String logType; /** * 日志标题 @@ -69,24 +67,47 @@ public class SysLog extends BaseEntity { @Schema(description = "日志标题") private String title; + /** + * 创建者 + */ + @ExcelProperty("创建人") + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @ExcelProperty("创建时间") + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建时间") + private LocalDateTime createTime; + + /** + * 更新时间 + */ + @ExcelIgnore + @TableField(fill = FieldFill.UPDATE) + @Schema(description = "更新时间") + private LocalDateTime updateTime; + /** * 操作IP地址 */ - @ExcelProperty("IP") + @ExcelProperty("操作ip地址") @Schema(description = "操作ip地址") private String remoteAddr; /** - * 用户浏览器 + * 用户代理 */ - @ExcelProperty("浏览器类型") @Schema(description = "用户代理") private String userAgent; /** * 请求URI */ - @ExcelProperty("请求URI") + @ExcelProperty("浏览器") @Schema(description = "请求uri") private String requestUri; @@ -100,14 +121,14 @@ public class SysLog extends BaseEntity { /** * 操作提交的数据 */ - @ExcelProperty("请求参数") - @Schema(description = "数据") + @ExcelProperty("提交数据") + @Schema(description = "提交数据") private String params; /** * 执行时间 */ - @ExcelProperty("方法执行时间") + @ExcelProperty("执行时间") @Schema(description = "方法执行时间") private Long time; @@ -130,6 +151,8 @@ public class SysLog extends BaseEntity { */ @TableLogic @ExcelIgnore + @TableField(fill = FieldFill.INSERT) + @Schema(description = "删除标记,1:已删除,0:正常") private String delFlag; } diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysMenu.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysMenu.java index 3fb7b1b4..aa3aecf2 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysMenu.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysMenu.java @@ -1,31 +1,33 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.api.entity; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.pig4cloud.pig.common.mybatis.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; import io.swagger.v3.oas.annotations.media.Schema; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import lombok.Data; import lombok.EqualsAndHashCode; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; /** *

@@ -33,11 +35,12 @@ import javax.validation.constraints.NotNull; *

* * @author lengleng - * @since 2019/2/1 + * @since 2017-11-08 */ @Data +@Schema(description = "菜单") @EqualsAndHashCode(callSuper = true) -public class SysMenu extends BaseEntity { +public class SysMenu extends Model { private static final long serialVersionUID = 1L; @@ -55,6 +58,12 @@ public class SysMenu extends BaseEntity { @Schema(description = "菜单名称") private String name; + /** + * 菜单名称 + */ + @Schema(description = "菜单名称") + private String enName; + /** * 菜单权限标识 */ @@ -75,11 +84,17 @@ public class SysMenu extends BaseEntity { private String icon; /** - * 前端URL + * 前端路由标识路径,默认和 comment 保持一致 过期 */ @Schema(description = "前端路由标识路径") private String path; + /** + * 菜单显示隐藏控制 + */ + @Schema(description = "菜单是否显示") + private String visible; + /** * 排序值 */ @@ -90,7 +105,8 @@ public class SysMenu extends BaseEntity { * 菜单类型 (0菜单 1按钮) */ @NotNull(message = "菜单类型不能为空") - private String type; + @Schema(description = "菜单类型,0:菜单 1:按钮") + private String menuType; /** * 路由缓冲 @@ -98,10 +114,43 @@ public class SysMenu extends BaseEntity { @Schema(description = "路由缓冲") private String keepAlive; + @Schema(description = "菜单是否内嵌") + private String embedded; + + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建人") + private String createBy; + + /** + * 修改人 + */ + @TableField(fill = FieldFill.UPDATE) + @Schema(description = "修改人") + private String updateBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建时间") + private LocalDateTime createTime; + + /** + * 更新时间 + */ + @TableField(fill = FieldFill.UPDATE) + @Schema(description = "更新时间") + private LocalDateTime updateTime; + /** * 0--正常 1--删除 */ @TableLogic + @TableField(fill = FieldFill.INSERT) + @Schema(description = "删除标记,1:已删除,0:正常") private String delFlag; } diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysOauthClientDetails.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysOauthClientDetails.java index 76043bac..fdf164fb 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysOauthClientDetails.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysOauthClientDetails.java @@ -1,29 +1,32 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.api.entity; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.pig4cloud.pig.common.mybatis.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; import io.swagger.v3.oas.annotations.media.Schema; +import javax.validation.constraints.NotBlank; import lombok.Data; import lombok.EqualsAndHashCode; -import javax.validation.constraints.NotBlank; +import java.time.LocalDateTime; /** *

@@ -31,19 +34,23 @@ import javax.validation.constraints.NotBlank; *

* * @author lengleng - * @since 2019/2/1 + * @since 2018-05-15 */ @Data +@Schema(description = "客户端信息") @EqualsAndHashCode(callSuper = true) -public class SysOauthClientDetails extends BaseEntity { +public class SysOauthClientDetails extends Model { private static final long serialVersionUID = 1L; + @TableId(value = "id", type = IdType.ASSIGN_ID) + @Schema(description = "id") + private Long id; + /** * 客户端ID */ @NotBlank(message = "client_id 不能为空") - @TableId(value = "client_id", type = IdType.INPUT) @Schema(description = "客户端id") private String clientId; @@ -68,10 +75,10 @@ public class SysOauthClientDetails extends BaseEntity { private String scope; /** - * 授权方式(A,B,C) + * 授权方式[A,B,C] */ @Schema(description = "授权方式") - private String authorizedGrantTypes; + private String[] authorizedGrantTypes; /** * 回调地址 @@ -109,4 +116,40 @@ public class SysOauthClientDetails extends BaseEntity { @Schema(description = "是否自动放行") private String autoapprove; + /** + * 删除标记 + */ + @TableLogic + @TableField(fill = FieldFill.INSERT) + @Schema(description = "删除标记,1:已删除,0:正常") + private String delFlag; + + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建人") + private String createBy; + + /** + * 修改人 + */ + @TableField(fill = FieldFill.UPDATE) + @Schema(description = "修改人") + private String updateBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建时间") + private LocalDateTime createTime; + + /** + * 更新时间 + */ + @TableField(fill = FieldFill.UPDATE) + @Schema(description = "更新时间") + private LocalDateTime updateTime; + } diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysPost.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysPost.java index 5cd02780..af606376 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysPost.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysPost.java @@ -14,65 +14,101 @@ * this software without specific prior written permission. * Author: lengleng (wangiegie@gmail.com) */ + package com.pig4cloud.pig.admin.api.entity; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.pig4cloud.pig.common.mybatis.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; import io.swagger.v3.oas.annotations.media.Schema; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import lombok.Data; import lombok.EqualsAndHashCode; +import java.time.LocalDateTime; + /** - * 岗位管理 + * 岗位信息表 * * @author fxz - * @date 2022-03-15 17:18:40 + * @date 2022-03-26 12:50:43 */ @Data @TableName("sys_post") @EqualsAndHashCode(callSuper = true) @Schema(description = "岗位信息表") -public class SysPost extends BaseEntity { +public class SysPost extends Model { - private static final long serialVersionUID = -8744622014102311894L; + private static final long serialVersionUID = 1L; /** * 岗位ID */ - @TableId(type = IdType.ASSIGN_ID) + @TableId(value = "post_id", type = IdType.ASSIGN_ID) @Schema(description = "岗位ID") private Long postId; /** * 岗位编码 */ + @NotBlank(message = "岗位编码不能为空") @Schema(description = "岗位编码") private String postCode; /** * 岗位名称 */ + @NotBlank(message = "岗位名称不能为空") @Schema(description = "岗位名称") private String postName; /** * 岗位排序 */ + @NotNull(message = "排序值不能为空") @Schema(description = "岗位排序") private Integer postSort; + /** + * 岗位描述 + */ + @Schema(description = "岗位描述") + private String remark; + + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建人") + private String createBy; + + /** + * 修改人 + */ + @TableField(fill = FieldFill.UPDATE) + @Schema(description = "修改人") + private String updateBy; + /** * 是否删除 -1:已删除 0:正常 */ + @TableLogic + @TableField(fill = FieldFill.INSERT) @Schema(description = "是否删除 -1:已删除 0:正常") private String delFlag; /** - * 备注信息 + * 创建时间 */ - @Schema(description = "备注信息") - private String remark; + @Schema(description = "创建时间") + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 更新时间 + */ + @Schema(description = "更新时间") + @TableField(fill = FieldFill.UPDATE) + private LocalDateTime updateTime; } diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysPublicParam.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysPublicParam.java index 51893a77..a6eb7416 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysPublicParam.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysPublicParam.java @@ -17,13 +17,14 @@ package com.pig4cloud.pig.admin.api.entity; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.pig4cloud.pig.common.mybatis.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; +import java.time.LocalDateTime; + /** * 公共参数配置 * @@ -33,7 +34,7 @@ import lombok.EqualsAndHashCode; @Data @Schema(description = "公共参数") @EqualsAndHashCode(callSuper = true) -public class SysPublicParam extends BaseEntity { +public class SysPublicParam extends Model { private static final long serialVersionUID = 1L; @@ -86,4 +87,40 @@ public class SysPublicParam extends BaseEntity { @Schema(description = "类型[1-检索;2-原文...]", example = "1") private String publicType; + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建人") + private String createBy; + + /** + * 修改人 + */ + @TableField(fill = FieldFill.UPDATE) + @Schema(description = "修改人") + private String updateBy; + + /** + * 删除标记 + */ + @TableLogic + @TableField(fill = FieldFill.INSERT) + @Schema(description = "删除标记,1:已删除,0:正常") + private String delFlag; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建时间") + private LocalDateTime createTime; + + /** + * 更新时间 + */ + @TableField(fill = FieldFill.UPDATE) + @Schema(description = "更新时间") + private LocalDateTime updateTime; + } diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysRole.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysRole.java index 2599ef4a..b64b8581 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysRole.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysRole.java @@ -1,30 +1,32 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.api.entity; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.pig4cloud.pig.common.mybatis.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; import io.swagger.v3.oas.annotations.media.Schema; +import javax.validation.constraints.NotBlank; import lombok.Data; import lombok.EqualsAndHashCode; -import javax.validation.constraints.NotBlank; +import java.time.LocalDateTime; /** *

@@ -32,11 +34,12 @@ import javax.validation.constraints.NotBlank; *

* * @author lengleng - * @since 2019/2/1 + * @since 2017-10-29 */ @Data +@Schema(description = "角色") @EqualsAndHashCode(callSuper = true) -public class SysRole extends BaseEntity { +public class SysRole extends Model { private static final long serialVersionUID = 1L; @@ -44,22 +47,51 @@ public class SysRole extends BaseEntity { @Schema(description = "角色编号") private Long roleId; - @NotBlank(message = "角色名称 不能为空") + @NotBlank(message = "角色名称不能为空") @Schema(description = "角色名称") private String roleName; - @NotBlank(message = "角色标识 不能为空") + @NotBlank(message = "角色标识不能为空") @Schema(description = "角色标识") private String roleCode; - @NotBlank(message = "角色描述 不能为空") @Schema(description = "角色描述") private String roleDesc; + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建人") + private String createBy; + + /** + * 修改人 + */ + @TableField(fill = FieldFill.UPDATE) + @Schema(description = "修改人") + private String updateBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @TableField(fill = FieldFill.UPDATE) + private LocalDateTime updateTime; + /** * 删除标识(0-正常,1-删除) */ @TableLogic + @TableField(fill = FieldFill.INSERT) + @Schema(description = "删除标记,1:已删除,0:正常") private String delFlag; } diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysRoleMenu.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysRoleMenu.java index 5573bcb7..bdc264f7 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysRoleMenu.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysRoleMenu.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.api.entity; @@ -27,9 +30,10 @@ import lombok.EqualsAndHashCode; *

* * @author lengleng - * @since 2019/2/1 + * @since 2017-10-29 */ @Data +@Schema(description = "角色菜单") @EqualsAndHashCode(callSuper = true) public class SysRoleMenu extends Model { diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysUser.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysUser.java index 919f1461..0c4c9142 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysUser.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysUser.java @@ -1,29 +1,31 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.api.entity; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.*; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.pig4cloud.pig.common.mybatis.base.BaseEntity; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; /** *

@@ -31,11 +33,11 @@ import lombok.EqualsAndHashCode; *

* * @author lengleng - * @since 2019/2/1 + * @since 2017-10-29 */ @Data -@EqualsAndHashCode(callSuper = true) -public class SysUser extends BaseEntity { +@Schema(description = "用户") +public class SysUser implements Serializable { private static final long serialVersionUID = 1L; @@ -49,7 +51,7 @@ public class SysUser extends BaseEntity { /** * 用户名 */ - @Schema(title = "用户名") + @Schema(description = "用户名") private String username; /** @@ -65,6 +67,42 @@ public class SysUser extends BaseEntity { @Schema(description = "随机盐") private String salt; + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建人") + private String createBy; + + /** + * 修改人 + */ + @TableField(fill = FieldFill.UPDATE) + @Schema(description = "修改人") + private String updateBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建时间") + private LocalDateTime createTime; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.UPDATE) + @Schema(description = "修改时间") + private LocalDateTime updateTime; + + /** + * 0-正常,1-删除 + */ + @TableLogic + @TableField(fill = FieldFill.INSERT) + @Schema(description = "删除标记,1:已删除,0:正常") + private String delFlag; + /** * 锁定标记 */ @@ -90,9 +128,51 @@ public class SysUser extends BaseEntity { private Long deptId; /** - * 0-正常,1-删除 + * 微信openid */ - @TableLogic - private String delFlag; + @Schema(description = "微信openid") + private String wxOpenid; + + /** + * 微信小程序openId + */ + @Schema(description = "微信小程序openid") + private String miniOpenid; + + /** + * QQ openid + */ + @Schema(description = "QQ openid") + private String qqOpenid; + + /** + * 码云唯一标识 + */ + @Schema(description = "码云唯一标识") + private String giteeLogin; + + /** + * 开源中国唯一标识 + */ + @Schema(description = "开源中国唯一标识") + private String oscId; + + /** + * 昵称 + */ + @Schema(description = "昵称") + private String nickname; + + /** + * 姓名 + */ + @Schema(description = "姓名") + private String name; + + /** + * 邮箱 + */ + @Schema(description = "邮箱") + private String email; } diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysUserRole.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysUserRole.java index 93d4e63c..ffb92d8e 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysUserRole.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysUserRole.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.api.entity; @@ -27,9 +30,10 @@ import lombok.EqualsAndHashCode; *

* * @author lengleng - * @since 2019/2/1 + * @since 2017-10-29 */ @Data +@Schema(description = "用户角色") @EqualsAndHashCode(callSuper = true) public class SysUserRole extends Model { diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteClientDetailsService.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteClientDetailsService.java index e130bd89..af15361f 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteClientDetailsService.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteClientDetailsService.java @@ -26,6 +26,7 @@ import com.pig4cloud.pig.common.core.util.R; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestHeader; import java.util.List; @@ -39,16 +40,19 @@ public interface RemoteClientDetailsService { /** * 通过clientId 查询客户端信息 * @param clientId 用户名 + * @param from 调用标志 * @return R */ - @GetMapping(value = "/client/getClientDetailsById/{clientId}", headers = SecurityConstants.HEADER_FROM_IN) - R getClientDetailsById(@PathVariable("clientId") String clientId); + @GetMapping("/client/getClientDetailsById/{clientId}") + R getClientDetailsById(@PathVariable("clientId") String clientId, + @RequestHeader(SecurityConstants.FROM) String from); /** * 查询全部客户端 + * @param from 调用标识 * @return R */ - @GetMapping(value = "/client/list", headers = SecurityConstants.HEADER_FROM_IN) - R> listClientDetails(); + @GetMapping("/client/list") + R> listClientDetails(@RequestHeader(SecurityConstants.FROM) String from); } diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteDeptService.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteDeptService.java deleted file mode 100644 index 197b3015..00000000 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteDeptService.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.pig4cloud.pig.admin.api.feign; - -import com.pig4cloud.pig.common.core.constant.SecurityConstants; -import com.pig4cloud.pig.common.core.constant.ServiceNameConstants; -import com.pig4cloud.pig.common.core.util.R; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; - -import java.util.List; - -/** - * @author hccake - */ -@FeignClient(contextId = "remoteDeptService", value = ServiceNameConstants.UMPS_SERVICE) -public interface RemoteDeptService { - - /** - * 查收子级id列表 - * @return 返回子级id列表 - */ - @GetMapping(value = "/dept/child-id/{deptId}", headers = SecurityConstants.HEADER_FROM_IN) - R> listChildDeptId(@PathVariable("deptId") Long deptId); - -} diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteLogService.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteLogService.java old mode 100755 new mode 100644 index f4fd260d..b547825d --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteLogService.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteLogService.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.api.feign; @@ -23,10 +26,11 @@ import com.pig4cloud.pig.common.core.util.R; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; /** * @author lengleng - * @date 2019/2/1 + * @date 2018/6/28 */ @FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.UMPS_SERVICE) public interface RemoteLogService { @@ -34,9 +38,10 @@ public interface RemoteLogService { /** * 保存日志 * @param sysLog 日志实体 + * @param from 是否内部调用 * @return succes、false */ - @PostMapping(value = "/log", headers = SecurityConstants.HEADER_FROM_IN) - R saveLog(@RequestBody SysLog sysLog); + @PostMapping("/log/save") + R saveLog(@RequestBody SysLog sysLog, @RequestHeader(SecurityConstants.FROM) String from); } diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteParamService.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteParamService.java index deb214bc..712f45bc 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteParamService.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteParamService.java @@ -6,6 +6,7 @@ import com.pig4cloud.pig.common.core.util.R; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestHeader; /** * @author lengleng @@ -19,9 +20,10 @@ public interface RemoteParamService { /** * 通过key 查询参数配置 * @param key key + * @param from 声明成内部调用,避免MQ 等无法调用 * @return */ - @GetMapping(value = "/param/publicValue/{key}", headers = SecurityConstants.HEADER_FROM_IN) - R getByKey(@PathVariable("key") String key); + @GetMapping("/param/publicValue/{key}") + R getByKey(@PathVariable("key") String key, @RequestHeader(SecurityConstants.FROM) String from); } diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteTokenService.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteTokenService.java old mode 100755 new mode 100644 index 7976fef9..85d64872 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteTokenService.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteTokenService.java @@ -1,21 +1,23 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) */ package com.pig4cloud.pig.admin.api.feign; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.pig4cloud.pig.common.core.constant.SecurityConstants; import com.pig4cloud.pig.common.core.constant.ServiceNameConstants; import com.pig4cloud.pig.common.core.util.R; @@ -26,25 +28,39 @@ import java.util.Map; /** * @author lengleng - * @date 2019/2/1 + * @date 2018/9/4 */ @FeignClient(contextId = "remoteTokenService", value = ServiceNameConstants.AUTH_SERVICE) public interface RemoteTokenService { /** * 分页查询token 信息 + * @param from 内部调用标志 * @param params 分页参数 + * @param from 内部调用标志 * @return page */ - @PostMapping(value = "/token/page", headers = SecurityConstants.HEADER_FROM_IN) - R getTokenPage(@RequestBody Map params); + @PostMapping("/token/page") + R getTokenPage(@RequestBody Map params, @RequestHeader(SecurityConstants.FROM) String from); /** * 删除token + * @param from 内部调用标志 * @param token token + * @param from 内部调用标志 * @return */ - @DeleteMapping(value = "/token/{token}", headers = SecurityConstants.HEADER_FROM_IN) - R removeToken(@PathVariable("token") String token); + @DeleteMapping("/token/{token}") + R removeTokenById(@PathVariable("token") String token, @RequestHeader(SecurityConstants.FROM) String from); + + /** + * 校验令牌获取用户信息 + * @param token + * @param from + * @return + */ + @GetMapping("/token/query-token") + R> queryToken(@RequestParam("token") String token, + @RequestHeader(SecurityConstants.FROM) String from); } diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteUserService.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteUserService.java old mode 100755 new mode 100644 index 0af6d9ba..e1f6b4da --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteUserService.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteUserService.java @@ -1,62 +1,59 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.api.feign; +import com.pig4cloud.pig.admin.api.dto.UserDTO; import com.pig4cloud.pig.admin.api.dto.UserInfo; import com.pig4cloud.pig.common.core.constant.SecurityConstants; import com.pig4cloud.pig.common.core.constant.ServiceNameConstants; import com.pig4cloud.pig.common.core.util.R; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.cloud.openfeign.SpringQueryMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestParam; - -import java.util.List; -import java.util.Set; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestHeader; /** * @author lengleng - * @date 2019/2/1 + * @date 2018/6/22 */ @FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.UMPS_SERVICE) public interface RemoteUserService { /** * 通过用户名查询用户、角色信息 + * @param user 用户查询对象 + * @param from 调用标志 + * @return R + */ + @GetMapping("/user/info/query") + R info(@SpringQueryMap UserDTO user, @RequestHeader(SecurityConstants.FROM) String from); + + /** + * 锁定用户 * @param username 用户名 - * @return R + * @param from 调用标识 + * @return */ - @GetMapping(value = "/user/info/{username}", headers = SecurityConstants.HEADER_FROM_IN) - R info(@PathVariable("username") String username); - - /** - * 通过手机号码查询用户、角色信息 - * @param phone 手机号码 - * @return R - */ - @GetMapping(value = "/app/info/{phone}", headers = SecurityConstants.HEADER_FROM_IN) - R infoByMobile(@PathVariable("phone") String phone); - - /** - * 根据部门id,查询对应的用户 id 集合 - * @param deptIds 部门id 集合 - * @return 用户 id 集合 - */ - @GetMapping(value = "/user/ids", headers = SecurityConstants.HEADER_FROM_IN) - R> listUserIdByDeptIds(@RequestParam("deptIds") Set deptIds); + @PutMapping("/user/lock/{username}") + R lockUser(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM) String from); } diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/util/DictResolver.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/util/DictResolver.java index 6c7a7193..136b9ea8 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/util/DictResolver.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/util/DictResolver.java @@ -57,7 +57,7 @@ public class DictResolver { SysDictItem sysDictItem = getDictItemByItemLabel(type, itemLabel); - return ObjectUtils.isNotEmpty(sysDictItem) ? sysDictItem.getValue() : StringPool.EMPTY; + return ObjectUtils.isNotEmpty(sysDictItem) ? sysDictItem.getItemValue() : StringPool.EMPTY; } /** @@ -72,7 +72,7 @@ public class DictResolver { List dictItemList = getDictItemsByType(type); if (CollectionUtils.isNotEmpty(dictItemList)) { - return dictItemList.stream().filter(item -> itemValue.equals(item.getValue())).findFirst().orElse(null); + return dictItemList.stream().filter(item -> itemValue.equals(item.getItemValue())).findFirst().orElse(null); } return null; diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/util/ParamResolver.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/util/ParamResolver.java index 9b4e43a0..51d0337b 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/util/ParamResolver.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/util/ParamResolver.java @@ -3,6 +3,7 @@ package com.pig4cloud.pig.admin.api.util; import cn.hutool.core.convert.Convert; import cn.hutool.core.util.StrUtil; import com.pig4cloud.pig.admin.api.feign.RemoteParamService; +import com.pig4cloud.pig.common.core.constant.SecurityConstants; import com.pig4cloud.pig.common.core.util.SpringContextHolder; import lombok.experimental.UtilityClass; @@ -43,7 +44,7 @@ public class ParamResolver { RemoteParamService remoteParamService = SpringContextHolder.getBean(RemoteParamService.class); - String result = remoteParamService.getByKey(key).getData(); + String result = remoteParamService.getByKey(key, SecurityConstants.FROM_IN).getData(); if (StrUtil.isNotBlank(result)) { return Convert.convert(clazz, result); diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/DeptExcelVo.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/DeptExcelVo.java new file mode 100644 index 00000000..13b36058 --- /dev/null +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/DeptExcelVo.java @@ -0,0 +1,44 @@ +package com.pig4cloud.pig.admin.api.vo; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.pig4cloud.plugin.excel.annotation.ExcelLine; +import javax.validation.constraints.NotBlank; +import lombok.Data; + +import java.io.Serializable; + +/** + * 部门导入导出 + */ +@Data +public class DeptExcelVo implements Serializable { + + /** + * 导入时候回显行号 + */ + @ExcelLine + @ExcelIgnore + private Long lineNum; + + /** + * 上级部门 + */ + @NotBlank(message = "上级部门不能为空") + @ExcelProperty("上级部门") + private String parentName; + + /** + * 部门名称 + */ + @NotBlank(message = "部门名称不能为空") + @ExcelProperty("部门名称") + private String name; + + /** + * 排序 + */ + @ExcelProperty(value = "排序值") + private Integer sortOrder; + +} diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/ImageCode.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/ImageCode.java deleted file mode 100644 index 1256a5f6..00000000 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/ImageCode.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.pig4cloud.pig.admin.api.vo; - -import lombok.Data; - -import java.awt.image.BufferedImage; -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * @author lengleng - * @date 2019/2/1 - */ -@Data -public class ImageCode implements Serializable { - - private String code; - - private LocalDateTime expireTime; - - private BufferedImage image; - - public ImageCode(BufferedImage image, String sRand, int defaultImageExpire) { - this.image = image; - this.code = sRand; - this.expireTime = LocalDateTime.now().plusSeconds(defaultImageExpire); - } - -} diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/LogVO.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/LogVO.java deleted file mode 100644 index a62cf6c5..00000000 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/LogVO.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.pig4cloud.pig.admin.api.vo; - -import com.pig4cloud.pig.admin.api.entity.SysLog; -import lombok.Data; - -import java.io.Serializable; - -/** - * @author lengleng - * @date 2019/2/1 - */ -@Data -public class LogVO implements Serializable { - - private static final long serialVersionUID = 1L; - - private SysLog sysLog; - - private String username; - -} diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/PostExcelVO.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/PostExcelVO.java index ca07f30e..d7f030d3 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/PostExcelVO.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/PostExcelVO.java @@ -4,10 +4,10 @@ import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.write.style.ColumnWidth; import com.pig4cloud.plugin.excel.annotation.ExcelLine; -import lombok.Data; - import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; +import lombok.Data; + import java.io.Serializable; import java.time.LocalDateTime; @@ -24,7 +24,7 @@ public class PostExcelVO implements Serializable { private static final long serialVersionUID = 1L; /** - * excel 行号 + * 导入时候回显行号 */ @ExcelLine @ExcelIgnore diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/PreLogVO.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/PreLogVO.java new file mode 100644 index 00000000..de46b1a4 --- /dev/null +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/PreLogVO.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.admin.api.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @author lengleng + * @date 2018/8/27 前端日志vo + */ +@Data +@Schema(description = "前端日志展示对象") +public class PreLogVO { + + /** + * 请求url + */ + @Schema(description = "请求url") + private String url; + + /** + * 请求耗时 + */ + @Schema(description = "请求耗时") + private String time; + + /** + * 请求用户 + */ + @Schema(description = "请求用户") + private String user; + + /** + * 请求结果 + */ + @Schema(description = "请求结果0:成功9:失败") + private String type; + + /** + * 请求传递参数 + */ + @Schema(description = "请求传递参数") + private String message; + + /** + * 异常信息 + */ + @Schema(description = "异常信息") + private String stack; + + /** + * 日志标题 + */ + @Schema(description = "日志标题") + private String info; + +} diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/RoleExcelVO.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/RoleExcelVO.java index b53e9fc7..4cd1ced8 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/RoleExcelVO.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/RoleExcelVO.java @@ -4,9 +4,9 @@ import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.write.style.ColumnWidth; import com.pig4cloud.plugin.excel.annotation.ExcelLine; +import javax.validation.constraints.NotBlank; import lombok.Data; -import javax.validation.constraints.NotBlank; import java.io.Serializable; import java.time.LocalDateTime; @@ -23,7 +23,7 @@ public class RoleExcelVO implements Serializable { private static final long serialVersionUID = 1L; /** - * excel 行号 + * 导入时候回显行号 */ @ExcelLine @ExcelIgnore diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/RoleVO.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/RoleVO.java new file mode 100644 index 00000000..fde0bbec --- /dev/null +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/RoleVO.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.admin.api.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @author lengleng + * @date 2020/2/10 + */ +@Data +@Schema(description = "前端角色展示对象") +public class RoleVO { + + /** + * 角色id + */ + private Long roleId; + + /** + * 菜单列表 + */ + private String menuIds; + +} diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/RoleVo.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/RoleVo.java deleted file mode 100644 index 89691d54..00000000 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/RoleVo.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.pig4cloud.pig.admin.api.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -/** - * @author lengleng - * @date 2020/2/10 - */ -@Data -@Schema(description = "前端角色展示对象") -public class RoleVo { - - /** - * 角色id - */ - private Long roleId; - - /** - * 菜单列表 - */ - private String menuIds; - -} diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserExcelVO.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserExcelVO.java index 255bffbe..a7ad1017 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserExcelVO.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserExcelVO.java @@ -4,9 +4,9 @@ import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.write.style.ColumnWidth; import com.pig4cloud.plugin.excel.annotation.ExcelLine; +import javax.validation.constraints.NotBlank; import lombok.Data; -import javax.validation.constraints.NotBlank; import java.io.Serializable; import java.time.LocalDateTime; @@ -23,7 +23,7 @@ public class UserExcelVO implements Serializable { private static final long serialVersionUID = 1L; /** - * excel 行号 + * 导入时候回显行号 */ @ExcelLine @ExcelIgnore @@ -49,6 +49,27 @@ public class UserExcelVO implements Serializable { @ExcelProperty("手机号") private String phone; + /** + * 手机号 + */ + @NotBlank(message = "昵称不能为空") + @ExcelProperty("昵称") + private String nickname; + + /** + * 手机号 + */ + @NotBlank(message = "姓名不能为空") + @ExcelProperty("姓名") + private String name; + + /** + * 手机号 + */ + @NotBlank(message = "邮箱不能为空") + @ExcelProperty("邮箱") + private String email; + /** * 部门名称 */ @@ -64,10 +85,10 @@ public class UserExcelVO implements Serializable { private String roleNameList; /** - * 岗位列表 + * 角色列表 */ @NotBlank(message = "岗位不能为空") - @ExcelProperty("岗位") + @ExcelProperty("岗位名称") private String postNameList; /** diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserInfoVO.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserInfoVO.java deleted file mode 100644 index 32195cc4..00000000 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserInfoVO.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.pig4cloud.pig.admin.api.vo; - -import com.pig4cloud.pig.admin.api.entity.SysUser; -import lombok.Data; - -import java.io.Serializable; - -/** - * @author lengleng - * @date 2019/2/1 - *

- * commit('SET_ROLES', data) commit('SET_NAME', data) commit('SET_AVATAR', data) - * commit('SET_INTRODUCTION', data) commit('SET_PERMISSIONS', data) - */ -@Data -public class UserInfoVO implements Serializable { - - /** - * 用户基本信息 - */ - private SysUser sysUser; - - /** - * 权限标识集合 - */ - private String[] permissions; - - /** - * 角色集合 - */ - private Long[] roles; - -} diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserVO.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserVO.java index 4692eda5..a42f357a 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserVO.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserVO.java @@ -1,23 +1,27 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.api.vo; import com.pig4cloud.pig.admin.api.entity.SysPost; import com.pig4cloud.pig.admin.api.entity.SysRole; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import java.io.Serializable; @@ -26,9 +30,10 @@ import java.util.List; /** * @author lengleng - * @date 2019/2/1 + * @date 2017/10/29 */ @Data +@Schema(description = "前端用户展示对象") public class UserVO implements Serializable { private static final long serialVersionUID = 1L; @@ -36,66 +41,103 @@ public class UserVO implements Serializable { /** * 主键ID */ + @Schema(description = "主键") private Long userId; /** * 用户名 */ + @Schema(description = "用户名") private String username; /** * 密码 */ + @Schema(description = "密码") private String password; /** * 随机盐 */ + @Schema(description = "随机盐") private String salt; + /** + * 微信openid + */ + @Schema(description = "微信open id") + private String wxOpenid; + + /** + * QQ openid + */ + @Schema(description = "qq open id") + private String qqOpenid; + + /** + * gitee openid + */ + @Schema(description = "gitee open id") + private String giteeOpenId; + + /** + * 开源中国 openid + */ + @Schema(description = "开源中国 open id") + private String oscOpenId; + /** * 创建时间 */ + @Schema(description = "创建时间") private LocalDateTime createTime; /** * 修改时间 */ + @Schema(description = "修改时间") private LocalDateTime updateTime; /** * 0-正常,1-删除 */ + @Schema(description = "删除标记,1:已删除,0:正常") private String delFlag; /** * 锁定标记 */ + @Schema(description = "锁定标记,0:正常,9:已锁定") private String lockFlag; /** - * 简介 + * 手机号 */ + @Schema(description = "手机号") private String phone; /** * 头像 */ + @Schema(description = "头像") private String avatar; /** * 部门ID */ + @Schema(description = "所属部门") private Long deptId; /** * 部门名称 */ + @Schema(description = "所属部门名称") private String deptName; /** * 角色列表 */ + @Schema(description = "拥有的角色列表") private List roleList; /** @@ -103,4 +145,22 @@ public class UserVO implements Serializable { */ private List postList; + /** + * 昵称 + */ + @Schema(description = "昵称") + private String nickname; + + /** + * 姓名 + */ + @Schema(description = "姓名") + private String name; + + /** + * 邮箱 + */ + @Schema(description = "邮箱") + private String email; + } diff --git a/pig-upms/pig-upms-api/src/main/resources/META-INF/spring/org.springframework.cloud.openfeign.FeignClient.imports b/pig-upms/pig-upms-api/src/main/resources/META-INF/spring/org.springframework.cloud.openfeign.FeignClient.imports deleted file mode 100644 index 9eca72e4..00000000 --- a/pig-upms/pig-upms-api/src/main/resources/META-INF/spring/org.springframework.cloud.openfeign.FeignClient.imports +++ /dev/null @@ -1,7 +0,0 @@ -com.pig4cloud.pig.admin.api.feign.RemoteClientDetailsService -com.pig4cloud.pig.admin.api.feign.RemoteDictService -com.pig4cloud.pig.admin.api.feign.RemoteDeptService -com.pig4cloud.pig.admin.api.feign.RemoteLogService -com.pig4cloud.pig.admin.api.feign.RemoteTokenService -com.pig4cloud.pig.admin.api.feign.RemoteUserService -com.pig4cloud.pig.admin.api.feign.RemoteParamService diff --git a/pig-upms/pig-upms-biz/pom.xml b/pig-upms/pig-upms-biz/pom.xml index ce53f69e..fd72d7e6 100644 --- a/pig-upms/pig-upms-biz/pom.xml +++ b/pig-upms/pig-upms-biz/pom.xml @@ -21,7 +21,7 @@ com.pig4cloud pig-upms - 3.6.7 + 3.7.0-JDK8 pig-upms-biz @@ -37,8 +37,8 @@ - com.pig4cloud.plugin - oss-spring-boot-starter + com.pig4cloud + pig-common-oss diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/PigAdminApplication.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/PigAdminApplication.java index 219f5011..8d593923 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/PigAdminApplication.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/PigAdminApplication.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin; @@ -25,11 +28,13 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient; /** * @author lengleng - * @date 2018年06月21日 用户统一管理系统 + * @date 2018年06月21日 + *

+ * 用户统一管理系统 */ @EnablePigDoc -@EnablePigResourceServer @EnablePigFeignClients +@EnablePigResourceServer @EnableDiscoveryClient @SpringBootApplication public class PigAdminApplication { diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/AppController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/AppController.java deleted file mode 100644 index 5e4540ec..00000000 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/AppController.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.pig4cloud.pig.admin.controller; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.pig4cloud.pig.admin.api.dto.AppSmsDTO; -import com.pig4cloud.pig.admin.api.dto.UserInfo; -import com.pig4cloud.pig.admin.api.entity.SysUser; -import com.pig4cloud.pig.admin.service.AppService; -import com.pig4cloud.pig.admin.service.SysUserService; -import com.pig4cloud.pig.common.core.exception.ErrorCodes; -import com.pig4cloud.pig.common.core.util.MsgUtils; -import com.pig4cloud.pig.common.core.util.R; -import com.pig4cloud.pig.common.security.annotation.Inner; -import io.swagger.v3.oas.annotations.security.SecurityRequirement; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.AllArgsConstructor; -import org.springframework.http.HttpHeaders; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - -/** - * @author lengleng - * @date 2021/9/16 移动端登录 - */ -@RestController -@AllArgsConstructor -@RequestMapping("/app") -@Tag(name = "移动端登录模块") -@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) -public class AppController { - - private final AppService appService; - - private final SysUserService userService; - - /** - * 发送手机验证码 - * @param sms 请求手机对象 - * @return code - */ - @Inner(value = false) - @PostMapping("/sms") - public R sendSmsCode(@Valid @RequestBody AppSmsDTO sms) { - return appService.sendSmsCode(sms); - } - - /** - * 获取指定用户全部信息 - * @param phone 手机号 - * @return 用户信息 - */ - @Inner - @GetMapping("/info/{phone}") - public R infoByMobile(@PathVariable String phone) { - SysUser user = userService.getOne(Wrappers.query().lambda().eq(SysUser::getPhone, phone)); - if (user == null) { - return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_USER_USERINFO_EMPTY, phone)); - } - return R.ok(userService.getUserInfo(user)); - } - -} diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysClientController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysClientController.java new file mode 100644 index 00000000..708fa28f --- /dev/null +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysClientController.java @@ -0,0 +1,165 @@ +/* + * + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + * + */ + +package com.pig4cloud.pig.admin.controller; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.pig4cloud.pig.admin.api.entity.SysOauthClientDetails; +import com.pig4cloud.pig.admin.service.SysOauthClientDetailsService; +import com.pig4cloud.pig.common.core.util.R; +import com.pig4cloud.pig.common.log.annotation.SysLog; +import com.pig4cloud.pig.common.security.annotation.Inner; +import com.pig4cloud.plugin.excel.annotation.ResponseExcel; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import javax.validation.Valid; +import lombok.AllArgsConstructor; +import org.springdoc.api.annotations.ParameterObject; +import org.springframework.http.HttpHeaders; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author lengleng + * @since 2018-05-15 + */ +@RestController +@AllArgsConstructor +@RequestMapping("/client") +@Tag(description = "client", name = "客户端管理模块") +@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) +public class SysClientController { + + private final SysOauthClientDetailsService clientDetailsService; + + /** + * 通过ID查询 + * @param clientId clientId + * @return SysOauthClientDetails + */ + @GetMapping("/{clientId}") + public R getByClientId(@PathVariable String clientId) { + SysOauthClientDetails details = clientDetailsService + .getOne(Wrappers.lambdaQuery().eq(SysOauthClientDetails::getClientId, clientId)); + return R.ok(details); + } + + /** + * 简单分页查询 + * @param page 分页对象 + * @param sysOauthClientDetails 系统终端 + * @return + */ + @GetMapping("/page") + public R getOauthClientDetailsPage(@ParameterObject Page page, + @ParameterObject SysOauthClientDetails sysOauthClientDetails) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() + .like(StrUtil.isNotBlank(sysOauthClientDetails.getClientId()), SysOauthClientDetails::getClientId, + sysOauthClientDetails.getClientId()) + .like(StrUtil.isNotBlank(sysOauthClientDetails.getClientSecret()), SysOauthClientDetails::getClientSecret, + sysOauthClientDetails.getClientSecret()); + return R.ok(clientDetailsService.page(page, wrapper)); + } + + /** + * 添加 + * @param clientDetails 实体 + * @return success/false + */ + @SysLog("添加终端") + @PostMapping + @PreAuthorize("@pms.hasPermission('sys_client_add')") + public R add(@Valid @RequestBody SysOauthClientDetails clientDetails) { + return R.ok(clientDetailsService.saveClient(clientDetails)); + } + + /** + * 删除 + * @param ids ID 列表 + * @return success/false + */ + @SysLog("删除终端") + @DeleteMapping + @PreAuthorize("@pms.hasPermission('sys_client_del')") + public R removeById(@RequestBody Long[] ids) { + clientDetailsService.removeBatchByIds(CollUtil.toList(ids)); + return R.ok(); + } + + /** + * 编辑 + * @param clientDetails 实体 + * @return success/false + */ + @SysLog("编辑终端") + @PutMapping + @PreAuthorize("@pms.hasPermission('sys_client_edit')") + public R update(@Valid @RequestBody SysOauthClientDetails clientDetails) { + return R.ok(clientDetailsService.updateClientById(clientDetails)); + } + + @Inner(false) + @GetMapping("/getClientDetailsById/{clientId}") + public R getClientDetailsById(@PathVariable String clientId) { + return R.ok(clientDetailsService.getOne( + Wrappers.lambdaQuery().eq(SysOauthClientDetails::getClientId, clientId), false)); + } + + /** + * 查询全部客户端 + * @return + */ + @Inner(false) + @GetMapping("/list") + public R listClients() { + return R.ok(clientDetailsService.list()); + } + + /** + * 同步缓存字典 + * @return R + */ + @SysLog("同步终端") + @PutMapping("/sync") + public R sync() { + return clientDetailsService.syncClientCache(); + } + + /** + * 导出所有客户端 + * @return excel + */ + @ResponseExcel + @SysLog("导出excel") + @GetMapping("/export") + public List export(SysOauthClientDetails sysOauthClientDetails) { + return clientDetailsService.list(Wrappers.query(sysOauthClientDetails)); + } + +} diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysDeptController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysDeptController.java index c0e4a2bd..de2fb587 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysDeptController.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysDeptController.java @@ -1,35 +1,41 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ + package com.pig4cloud.pig.admin.controller; -import cn.hutool.core.lang.tree.Tree; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.pig4cloud.pig.admin.api.entity.SysDept; +import com.pig4cloud.pig.admin.api.vo.DeptExcelVo; import com.pig4cloud.pig.admin.service.SysDeptService; import com.pig4cloud.pig.common.core.util.R; import com.pig4cloud.pig.common.log.annotation.SysLog; -import com.pig4cloud.pig.common.security.annotation.Inner; +import com.pig4cloud.plugin.excel.annotation.RequestExcel; +import com.pig4cloud.plugin.excel.annotation.ResponseExcel; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; +import javax.validation.Valid; +import lombok.AllArgsConstructor; import org.springframework.http.HttpHeaders; import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; +import java.time.LocalDateTime; import java.util.List; /** @@ -38,12 +44,12 @@ import java.util.List; *

* * @author lengleng - * @since 2019/2/1 + * @since 2018-01-20 */ @RestController -@RequiredArgsConstructor +@AllArgsConstructor @RequestMapping("/dept") -@Tag(name = "部门管理模块") +@Tag(description = "dept", name = "部门管理模块") @SecurityRequirement(name = HttpHeaders.AUTHORIZATION) public class SysDeptController { @@ -54,27 +60,27 @@ public class SysDeptController { * @param id ID * @return SysDept */ - @GetMapping("/{id:\\d+}") - public R getById(@PathVariable Long id) { + @GetMapping("/{id}") + public R getById(@PathVariable Long id) { return R.ok(sysDeptService.getById(id)); } /** - * 返回树形菜单集合 - * @return 树形菜单 + * 查询全部部门 */ - @GetMapping(value = "/tree") - public R>> listDeptTrees() { - return R.ok(sysDeptService.listDeptTrees()); + @GetMapping("/list") + public R list() { + return R.ok(sysDeptService.list()); } /** - * 返回当前用户树形菜单集合 + * 返回树形菜单集合 + * @param deptName 部门名称 * @return 树形菜单 */ - @GetMapping(value = "/user-tree") - public R>> listCurrentUserDeptTrees() { - return R.ok(sysDeptService.listCurrentUserDeptTrees()); + @GetMapping(value = "/tree") + public R getTree(String deptName) { + return R.ok(sysDeptService.selectTree(deptName)); } /** @@ -85,8 +91,8 @@ public class SysDeptController { @SysLog("添加部门") @PostMapping @PreAuthorize("@pms.hasPermission('sys_dept_add')") - public R save(@Valid @RequestBody SysDept sysDept) { - return R.ok(sysDeptService.saveDept(sysDept)); + public R save(@Valid @RequestBody SysDept sysDept) { + return R.ok(sysDeptService.save(sysDept)); } /** @@ -95,9 +101,9 @@ public class SysDeptController { * @return success/false */ @SysLog("删除部门") - @DeleteMapping("/{id:\\d+}") + @DeleteMapping("/{id}") @PreAuthorize("@pms.hasPermission('sys_dept_del')") - public R removeById(@PathVariable Long id) { + public R removeById(@PathVariable Long id) { return R.ok(sysDeptService.removeDeptById(id)); } @@ -109,30 +115,40 @@ public class SysDeptController { @SysLog("编辑部门") @PutMapping @PreAuthorize("@pms.hasPermission('sys_dept_edit')") - public R update(@Valid @RequestBody SysDept sysDept) { - return R.ok(sysDeptService.updateDeptById(sysDept)); + public R update(@Valid @RequestBody SysDept sysDept) { + sysDept.setUpdateTime(LocalDateTime.now()); + return R.ok(sysDeptService.updateById(sysDept)); } /** - * 根据部门名查询部门信息 - * @param deptName 部门名 - * @return SysDept + * 查收子级列表 + * @return 返回子级 */ - @GetMapping("/details/{deptName}") - public R user(@PathVariable String deptName) { - SysDept condition = new SysDept(); - condition.setName(deptName); - return R.ok(sysDeptService.getOne(new QueryWrapper<>(condition))); + @GetMapping(value = "/getDescendantList/{deptId}") + public R getDescendantList(@PathVariable Long deptId) { + return R.ok(sysDeptService.listDescendant(deptId)); } /** - * 查收子级id列表 - * @return 返回子级id列表 + * 导出部门 + * @return */ - @Inner - @GetMapping(value = "/child-id/{deptId:\\d+}") - public R> listChildDeptId(@PathVariable Long deptId) { - return R.ok(sysDeptService.listChildDeptId(deptId)); + @ResponseExcel + @GetMapping("/export") + public List export() { + return sysDeptService.listExcelVo(); + } + + /** + * 导入部门 + * @param excelVOList + * @param bindingResult + * @return + */ + @PostMapping("import") + public R importDept(@RequestExcel List excelVOList, BindingResult bindingResult) { + + return sysDeptService.importDept(excelVOList, bindingResult); } } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysDictController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysDictController.java index 02403680..1a30028c 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysDictController.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysDictController.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.controller; @@ -27,16 +30,18 @@ import com.pig4cloud.pig.admin.service.SysDictService; import com.pig4cloud.pig.common.core.constant.CacheConstants; import com.pig4cloud.pig.common.core.util.R; import com.pig4cloud.pig.common.log.annotation.SysLog; +import com.pig4cloud.plugin.excel.annotation.ResponseExcel; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; +import javax.validation.Valid; +import lombok.AllArgsConstructor; +import org.springdoc.api.annotations.ParameterObject; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.http.HttpHeaders; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; import java.util.List; /** @@ -48,52 +53,58 @@ import java.util.List; * @since 2019-03-19 */ @RestController -@RequiredArgsConstructor +@AllArgsConstructor @RequestMapping("/dict") -@Tag(name = "字典管理模块") +@Tag(description = "dict", name = "字典管理模块") @SecurityRequirement(name = HttpHeaders.AUTHORIZATION) public class SysDictController { - private final SysDictItemService sysDictItemService; - private final SysDictService sysDictService; + private final SysDictItemService sysDictItemService; + /** * 通过ID查询字典信息 * @param id ID * @return 字典信息 */ - @GetMapping("/{id:\\d+}") - public R getById(@PathVariable Long id) { + @GetMapping("/details/{id}") + public R getById(@PathVariable Long id) { return R.ok(sysDictService.getById(id)); } + /** + * 查询字典信息 + * @param query 查询信息 + * @return 字典信息 + */ + @GetMapping("/details") + public R getDetails(@ParameterObject SysDict query) { + return R.ok(sysDictService.getOne(Wrappers.query(query), false)); + } + /** * 分页查询字典信息 * @param page 分页对象 * @return 分页对象 */ @GetMapping("/page") - public R> getDictPage(Page page, SysDict sysDict) { + public R getDictPage(@ParameterObject Page page, @ParameterObject SysDict sysDict) { return R.ok(sysDictService.page(page, Wrappers.lambdaQuery() - .like(StrUtil.isNotBlank(sysDict.getDictKey()), SysDict::getDictKey, sysDict.getDictKey()) .eq(StrUtil.isNotBlank(sysDict.getSystemFlag()), SysDict::getSystemFlag, sysDict.getSystemFlag()) - .orderByDesc(SysDict::getUpdateTime))); + .like(StrUtil.isNotBlank(sysDict.getDictType()), SysDict::getDictType, sysDict.getDictType()))); } /** * 通过字典类型查找字典 - * @param key 类型 + * @param type 类型 * @return 同类型字典 */ - @GetMapping("/key/{key}") - @Cacheable(value = CacheConstants.DICT_DETAILS, key = "#key") - public R> getDictByKey(@PathVariable String key) { - return R.ok(sysDictItemService.list(Wrappers.query() - .lambda() - .eq(SysDictItem::getDictKey, key) - .orderByAsc(SysDictItem::getSortOrder))); + @GetMapping("/type/{type}") + @Cacheable(value = CacheConstants.DICT_DETAILS, key = "#type", unless = "#result.data.isEmpty()") + public R> getDictByType(@PathVariable String type) { + return R.ok(sysDictItemService.list(Wrappers.query().lambda().eq(SysDictItem::getDictType, type))); } /** @@ -104,21 +115,22 @@ public class SysDictController { @SysLog("添加字典") @PostMapping @PreAuthorize("@pms.hasPermission('sys_dict_add')") - public R save(@Valid @RequestBody SysDict sysDict) { - return R.ok(sysDictService.save(sysDict)); + public R save(@Valid @RequestBody SysDict sysDict) { + sysDictService.save(sysDict); + return R.ok(sysDict); } /** * 删除字典,并且清除字典缓存 - * @param id ID + * @param ids ID * @return R */ @SysLog("删除字典") - @DeleteMapping("/{id:\\d+}") + @DeleteMapping @PreAuthorize("@pms.hasPermission('sys_dict_del')") - public R removeById(@PathVariable Long id) { - sysDictService.removeDict(id); - return R.ok(); + @CacheEvict(value = CacheConstants.DICT_DETAILS, allEntries = true) + public R removeById(@RequestBody Long[] ids) { + return R.ok(sysDictService.removeDictByIds(ids)); } /** @@ -130,8 +142,20 @@ public class SysDictController { @SysLog("修改字典") @PreAuthorize("@pms.hasPermission('sys_dict_edit')") public R updateById(@Valid @RequestBody SysDict sysDict) { - sysDictService.updateDict(sysDict); - return R.ok(); + return sysDictService.updateDict(sysDict); + } + + /** + * 分页查询 + * @param name 名称或者字典项 + * @return + */ + @GetMapping("/list") + public R getDictList(String name) { + return R.ok(sysDictService.list(Wrappers.lambdaQuery() + .like(StrUtil.isNotBlank(name), SysDict::getDictType, name) + .or() + .like(StrUtil.isNotBlank(name), SysDict::getDescription, name))); } /** @@ -141,7 +165,7 @@ public class SysDictController { * @return */ @GetMapping("/item/page") - public R> getSysDictItemPage(Page page, SysDictItem sysDictItem) { + public R getSysDictItemPage(Page page, SysDictItem sysDictItem) { return R.ok(sysDictItemService.page(page, Wrappers.query(sysDictItem))); } @@ -150,11 +174,21 @@ public class SysDictController { * @param id id * @return R */ - @GetMapping("/item/{id:\\d+}") - public R getDictItemById(@PathVariable("id") Long id) { + @GetMapping("/item/details/{id}") + public R getDictItemById(@PathVariable("id") Long id) { return R.ok(sysDictItemService.getById(id)); } + /** + * 查询字典项详情 + * @param query 查询条件 + * @return R + */ + @GetMapping("/item/details") + public R getDictItemDetails(SysDictItem query) { + return R.ok(sysDictItemService.getOne(Wrappers.query(query), false)); + } + /** * 新增字典项 * @param sysDictItem 字典项 @@ -163,7 +197,7 @@ public class SysDictController { @SysLog("新增字典项") @PostMapping("/item") @CacheEvict(value = CacheConstants.DICT_DETAILS, allEntries = true) - public R save(@RequestBody SysDictItem sysDictItem) { + public R save(@RequestBody SysDictItem sysDictItem) { return R.ok(sysDictItemService.save(sysDictItem)); } @@ -175,8 +209,7 @@ public class SysDictController { @SysLog("修改字典项") @PutMapping("/item") public R updateById(@RequestBody SysDictItem sysDictItem) { - sysDictItemService.updateDictItem(sysDictItem); - return R.ok(); + return sysDictItemService.updateDictItem(sysDictItem); } /** @@ -185,18 +218,25 @@ public class SysDictController { * @return R */ @SysLog("删除字典项") - @DeleteMapping("/item/{id:\\d+}") + @DeleteMapping("/item/{id}") public R removeDictItemById(@PathVariable Long id) { - sysDictItemService.removeDictItem(id); - return R.ok(); + return sysDictItemService.removeDictItem(id); } - @SysLog("清除字典缓存") - @DeleteMapping("/cache") - @PreAuthorize("@pms.hasPermission('sys_dict_del')") - public R clearDictCache() { - sysDictService.clearDictCache(); - return R.ok(); + /** + * 同步缓存字典 + * @return R + */ + @SysLog("同步字典") + @PutMapping("/sync") + public R sync() { + return sysDictService.syncDictCache(); + } + + @ResponseExcel + @GetMapping("/export") + public List export(SysDictItem sysDictItem) { + return sysDictItemService.list(Wrappers.query(sysDictItem)); } } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysFileController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysFileController.java index 59ed9868..0b1af97e 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysFileController.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysFileController.java @@ -19,7 +19,7 @@ package com.pig4cloud.pig.admin.controller; import cn.hutool.core.io.IoUtil; import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.pig4cloud.pig.admin.api.entity.SysFile; @@ -30,26 +30,26 @@ import com.pig4cloud.pig.common.security.annotation.Inner; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; +import javax.servlet.http.HttpServletResponse; +import lombok.AllArgsConstructor; import lombok.SneakyThrows; +import org.springdoc.api.annotations.ParameterObject; import org.springframework.core.io.ClassPathResource; import org.springframework.http.HttpHeaders; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; -import javax.servlet.http.HttpServletResponse; - /** * 文件管理 * * @author Luckly - * @date 2021-09-11 + * @date 2019-06-18 17:18:42 */ @RestController -@RequiredArgsConstructor +@AllArgsConstructor @RequestMapping("/sys-file") -@Tag(name = "文件管理模块") +@Tag(description = "sys-file", name = "文件管理") @SecurityRequirement(name = HttpHeaders.AUTHORIZATION) public class SysFileController { @@ -63,22 +63,26 @@ public class SysFileController { */ @Operation(summary = "分页查询", description = "分页查询") @GetMapping("/page") - public R> getSysFilePage(Page page, SysFile sysFile) { - return R.ok(sysFileService.page(page, Wrappers.lambdaQuery() - .like(StrUtil.isNotBlank(sysFile.getFileName()), SysFile::getFileName, sysFile.getFileName()))); + public R getSysFilePage(@ParameterObject Page page, @ParameterObject SysFile sysFile) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() + .like(StrUtil.isNotBlank(sysFile.getOriginal()), SysFile::getOriginal, sysFile.getOriginal()); + return R.ok(sysFileService.page(page, wrapper)); } /** * 通过id删除文件管理 - * @param id id + * @param ids id 列表 * @return R */ @Operation(summary = "通过id删除文件管理", description = "通过id删除文件管理") @SysLog("删除文件管理") - @DeleteMapping("/{id:\\d+}") + @DeleteMapping @PreAuthorize("@pms.hasPermission('sys_file_del')") - public R removeById(@PathVariable Long id) { - return R.ok(sysFileService.deleteFile(id)); + public R removeById(@RequestBody Long[] ids) { + for (Long id : ids) { + sysFileService.deleteFile(id); + } + return R.ok(); } /** @@ -110,23 +114,11 @@ public class SysFileController { * @param response 本地文件 */ @SneakyThrows - @GetMapping("/local/{fileName}") + @GetMapping("/local/file/{fileName}") public void localFile(@PathVariable String fileName, HttpServletResponse response) { ClassPathResource resource = new ClassPathResource("file/" + fileName); response.setContentType("application/octet-stream; charset=UTF-8"); IoUtil.copy(resource.getInputStream(), response.getOutputStream()); } - /** - * 获取文件外网的访问地址 - * @param bucket - * @param fileName - * @return - */ - @Inner(false) - @GetMapping("/online/{bucket}/{fileName}") - public R onlineFile(@PathVariable String bucket, @PathVariable String fileName) { - return R.ok(sysFileService.onlineFile(bucket, fileName)); - } - } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysLogController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysLogController.java index f33d031d..0cc74fa7 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysLogController.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysLogController.java @@ -1,21 +1,26 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ + package com.pig4cloud.pig.admin.controller; -import com.baomidou.mybatisplus.core.metadata.IPage; +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.pig4cloud.pig.admin.api.dto.SysLogDTO; import com.pig4cloud.pig.admin.api.entity.SysLog; @@ -25,12 +30,13 @@ import com.pig4cloud.pig.common.security.annotation.Inner; import com.pig4cloud.plugin.excel.annotation.ResponseExcel; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; +import javax.validation.Valid; +import lombok.AllArgsConstructor; +import org.springdoc.api.annotations.ParameterObject; import org.springframework.http.HttpHeaders; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; import java.util.List; /** @@ -39,12 +45,12 @@ import java.util.List; *

* * @author lengleng - * @since 2019/2/1 + * @since 2017-11-20 */ @RestController -@RequiredArgsConstructor +@AllArgsConstructor @RequestMapping("/log") -@Tag(name = "日志管理模块") +@Tag(description = "log", name = "日志管理模块") @SecurityRequirement(name = HttpHeaders.AUTHORIZATION) public class SysLogController { @@ -57,19 +63,19 @@ public class SysLogController { * @return */ @GetMapping("/page") - public R> getLogPage(Page page, SysLogDTO sysLog) { + public R getLogPage(@ParameterObject Page page, @ParameterObject SysLogDTO sysLog) { return R.ok(sysLogService.getLogByPage(page, sysLog)); } /** - * 删除日志 - * @param id ID + * 批量删除日志 + * @param ids ID * @return success/false */ - @DeleteMapping("/{id:\\d+}") + @DeleteMapping @PreAuthorize("@pms.hasPermission('sys_log_del')") - public R removeById(@PathVariable Long id) { - return R.ok(sysLogService.removeById(id)); + public R removeByIds(@RequestBody Long[] ids) { + return R.ok(sysLogService.removeBatchByIds(CollUtil.toList(ids))); } /** @@ -78,21 +84,21 @@ public class SysLogController { * @return success/false */ @Inner - @PostMapping - public R save(@Valid @RequestBody SysLog sysLog) { - return R.ok(sysLogService.save(sysLog)); + @PostMapping("/save") + public R save(@Valid @RequestBody SysLog sysLog) { + return R.ok(sysLogService.saveLog(sysLog)); } /** * 导出excel 表格 * @param sysLog 查询条件 - * @return EXCEL + * @return */ @ResponseExcel @GetMapping("/export") - @PreAuthorize("@pms.hasPermission('sys_log_import_export')") - public List export(SysLogDTO sysLog) { - return sysLogService.getLogList(sysLog); + @PreAuthorize("@pms.hasPermission('sys_log_export')") + public List export(SysLog sysLog) { + return sysLogService.list(Wrappers.query(sysLog)); } } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysMenuController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysMenuController.java index 6b9e057e..1eb3fd1e 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysMenuController.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysMenuController.java @@ -1,22 +1,24 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.controller; -import cn.hutool.core.lang.tree.Tree; import com.pig4cloud.pig.admin.api.entity.SysMenu; import com.pig4cloud.pig.admin.service.SysMenuService; import com.pig4cloud.pig.common.core.util.R; @@ -24,14 +26,13 @@ import com.pig4cloud.pig.common.log.annotation.SysLog; import com.pig4cloud.pig.common.security.util.SecurityUtils; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; +import javax.validation.Valid; +import lombok.AllArgsConstructor; import org.springframework.http.HttpHeaders; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; -import java.util.Collection; -import java.util.List; +import java.util.HashSet; import java.util.Set; import java.util.stream.Collectors; @@ -40,9 +41,9 @@ import java.util.stream.Collectors; * @date 2017/10/31 */ @RestController -@RequiredArgsConstructor +@AllArgsConstructor @RequestMapping("/menu") -@Tag(name = "菜单管理模块") +@Tag(description = "menu", name = "菜单管理模块") @SecurityRequirement(name = HttpHeaders.AUTHORIZATION) public class SysMenuController { @@ -50,29 +51,27 @@ public class SysMenuController { /** * 返回当前用户的树形菜单集合 + * @param type 类型 * @param parentId 父节点ID * @return 当前用户的树形菜单 */ @GetMapping - public R>> getUserMenu(Long parentId) { + public R getUserMenu(String type, Long parentId) { // 获取符合条件的菜单 - Set menuSet = SecurityUtils.getRoles() - .stream() - .map(sysMenuService::findMenuByRoleId) - .flatMap(Collection::stream) - .collect(Collectors.toSet()); - return R.ok(sysMenuService.filterMenu(menuSet, parentId)); + Set all = new HashSet<>(); + SecurityUtils.getRoles().forEach(roleId -> all.addAll(sysMenuService.findMenuByRoleId(roleId))); + return R.ok(sysMenuService.filterMenu(all, type, parentId)); } /** * 返回树形菜单集合 - * @param lazy 是否是懒加载 * @param parentId 父节点ID + * @param menuName 菜单名称 * @return 树形菜单 */ @GetMapping(value = "/tree") - public R>> getTree(boolean lazy, Long parentId) { - return R.ok(sysMenuService.treeMenu(lazy, parentId)); + public R getTree(Long parentId, String menuName, String type) { + return R.ok(sysMenuService.treeMenu(parentId, menuName, type)); } /** @@ -81,7 +80,7 @@ public class SysMenuController { * @return 属性集合 */ @GetMapping("/tree/{roleId}") - public R> getRoleTree(@PathVariable Long roleId) { + public R getRoleTree(@PathVariable Long roleId) { return R .ok(sysMenuService.findMenuByRoleId(roleId).stream().map(SysMenu::getMenuId).collect(Collectors.toList())); } @@ -91,20 +90,20 @@ public class SysMenuController { * @param id 菜单ID * @return 菜单详细信息 */ - @GetMapping("/{id:\\d+}") - public R getById(@PathVariable Long id) { + @GetMapping("/{id}") + public R getById(@PathVariable Long id) { return R.ok(sysMenuService.getById(id)); } /** * 新增菜单 * @param sysMenu 菜单信息 - * @return 含ID 菜单信息 + * @return success/false */ @SysLog("新增菜单") @PostMapping @PreAuthorize("@pms.hasPermission('sys_menu_add')") - public R save(@Valid @RequestBody SysMenu sysMenu) { + public R save(@Valid @RequestBody SysMenu sysMenu) { sysMenuService.save(sysMenu); return R.ok(sysMenu); } @@ -115,10 +114,10 @@ public class SysMenuController { * @return success/false */ @SysLog("删除菜单") - @DeleteMapping("/{id:\\d+}") + @DeleteMapping("/{id}") @PreAuthorize("@pms.hasPermission('sys_menu_del')") - public R removeById(@PathVariable Long id) { - return R.ok(sysMenuService.removeMenuById(id)); + public R removeById(@PathVariable Long id) { + return sysMenuService.removeMenuById(id); } /** @@ -129,19 +128,8 @@ public class SysMenuController { @SysLog("更新菜单") @PutMapping @PreAuthorize("@pms.hasPermission('sys_menu_edit')") - public R update(@Valid @RequestBody SysMenu sysMenu) { + public R update(@Valid @RequestBody SysMenu sysMenu) { return R.ok(sysMenuService.updateMenuById(sysMenu)); } - /** - * 清除菜单缓存 - */ - @SysLog("清除菜单缓存") - @DeleteMapping("/cache") - @PreAuthorize("@pms.hasPermission('sys_menu_del')") - public R clearMenuCache() { - sysMenuService.clearMenuCache(); - return R.ok(); - } - } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysMobileController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysMobileController.java new file mode 100644 index 00000000..31f5d084 --- /dev/null +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysMobileController.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.admin.controller; + +import com.pig4cloud.pig.admin.service.SysMobileService; +import com.pig4cloud.pig.common.core.util.R; +import com.pig4cloud.pig.common.security.annotation.Inner; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; +import org.springframework.http.HttpHeaders; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author lengleng + * @date 2018/11/14 + *

+ * 手机验证码 + */ +@RestController +@AllArgsConstructor +@RequestMapping("/mobile") +@Tag(description = "mobile", name = "手机管理模块") +@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) +public class SysMobileController { + + private final SysMobileService mobileService; + + @Inner(value = false) + @GetMapping("/{mobile}") + public R sendSmsCode(@PathVariable String mobile) { + return mobileService.sendSmsCode(mobile); + } + +} diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysOauthClientDetailsController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysOauthClientDetailsController.java deleted file mode 100644 index d01aad33..00000000 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysOauthClientDetailsController.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.pig4cloud.pig.admin.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.pig4cloud.pig.admin.api.entity.SysOauthClientDetails; -import com.pig4cloud.pig.admin.service.SysOauthClientDetailsService; -import com.pig4cloud.pig.common.core.util.R; -import com.pig4cloud.pig.common.log.annotation.SysLog; -import com.pig4cloud.pig.common.security.annotation.Inner; -import io.swagger.v3.oas.annotations.security.SecurityRequirement; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpHeaders; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.util.List; - -/** - *

- * 前端控制器 - *

- * - * @author lengleng - * @since 2018-05-15 - */ -@RestController -@RequiredArgsConstructor -@RequestMapping("/client") -@Tag(name = "客户端管理模块") -@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) -public class SysOauthClientDetailsController { - - private final SysOauthClientDetailsService sysOauthClientDetailsService; - - /** - * 通过ID查询 - * @param clientId 客户端id - * @return SysOauthClientDetails - */ - @GetMapping("/{clientId}") - public R> getByClientId(@PathVariable String clientId) { - return R.ok(sysOauthClientDetailsService - .list(Wrappers.lambdaQuery().eq(SysOauthClientDetails::getClientId, clientId))); - } - - /** - * 简单分页查询 - * @param page 分页对象 - * @param sysOauthClientDetails 系统终端 - * @return - */ - @GetMapping("/page") - public R> getOauthClientDetailsPage(Page page, - SysOauthClientDetails sysOauthClientDetails) { - return R.ok(sysOauthClientDetailsService.page(page, Wrappers.query(sysOauthClientDetails))); - } - - /** - * 添加 - * @param sysOauthClientDetails 实体 - * @return success/false - */ - @SysLog("添加终端") - @PostMapping - @PreAuthorize("@pms.hasPermission('sys_client_add')") - public R add(@Valid @RequestBody SysOauthClientDetails sysOauthClientDetails) { - return R.ok(sysOauthClientDetailsService.save(sysOauthClientDetails)); - } - - /** - * 删除 - * @param id ID - * @return success/false - */ - @SysLog("删除终端") - @DeleteMapping("/{id}") - @PreAuthorize("@pms.hasPermission('sys_client_del')") - public R removeById(@PathVariable String id) { - return R.ok(sysOauthClientDetailsService.removeClientDetailsById(id)); - } - - /** - * 编辑 - * @param sysOauthClientDetails 实体 - * @return success/false - */ - @SysLog("编辑终端") - @PutMapping - @PreAuthorize("@pms.hasPermission('sys_client_edit')") - public R update(@Valid @RequestBody SysOauthClientDetails sysOauthClientDetails) { - return R.ok(sysOauthClientDetailsService.updateClientDetailsById(sysOauthClientDetails)); - } - - @SysLog("清除终端缓存") - @DeleteMapping("/cache") - @PreAuthorize("@pms.hasPermission('sys_client_del')") - public R clearClientCache() { - sysOauthClientDetailsService.clearClientCache(); - return R.ok(); - } - - @Inner - @GetMapping("/getClientDetailsById/{clientId}") - public R getClientDetailsById(@PathVariable String clientId) { - return R.ok(sysOauthClientDetailsService.getOne( - Wrappers.lambdaQuery().eq(SysOauthClientDetails::getClientId, clientId), false)); - } - -} diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysPostController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysPostController.java index b8bffb48..3cffca0e 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysPostController.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysPostController.java @@ -17,6 +17,8 @@ package com.pig4cloud.pig.admin.controller; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.pig4cloud.pig.admin.api.entity.SysPost; @@ -30,6 +32,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; +import org.springdoc.api.annotations.ParameterObject; import org.springframework.http.HttpHeaders; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.BindingResult; @@ -38,13 +41,15 @@ import org.springframework.web.bind.annotation.*; import java.util.List; /** + * 岗位信息表 + * * @author fxz - * @date 2022-03-15 17:18:40 + * @date 2022-03-26 12:50:43 */ @RestController @RequiredArgsConstructor @RequestMapping("/post") -@Tag(name = "岗位管理模块") +@Tag(description = "post", name = "岗位信息表管理") @SecurityRequirement(name = HttpHeaders.AUTHORIZATION) public class SysPostController { @@ -62,13 +67,15 @@ public class SysPostController { /** * 分页查询 * @param page 分页对象 + * @param sysPost 岗位信息表 * @return */ - @Operation(summary = "分页查询", description = "分页查询") + @Operation(description = "分页查询", summary = "分页查询") @GetMapping("/page") - @PreAuthorize("@pms.hasPermission('sys_post_get')") - public R getSysPostPage(Page page) { - return R.ok(sysPostService.page(page, Wrappers.lambdaQuery().orderByAsc(SysPost::getPostSort))); + @PreAuthorize("@pms.hasPermission('sys_post_view')") + public R getSysPostPage(@ParameterObject Page page, @ParameterObject SysPost sysPost) { + return R.ok(sysPostService.page(page, Wrappers.lambdaQuery() + .like(StrUtil.isNotBlank(sysPost.getPostName()), SysPost::getPostName, sysPost.getPostName()))); } /** @@ -76,19 +83,31 @@ public class SysPostController { * @param postId id * @return R */ - @Operation(summary = "通过id查询", description = "通过id查询") - @GetMapping("/{postId}") - @PreAuthorize("@pms.hasPermission('sys_post_get')") + @Operation(description = "通过id查询", summary = "通过id查询") + @GetMapping("/details/{postId}") + @PreAuthorize("@pms.hasPermission('sys_post_view')") public R getById(@PathVariable("postId") Long postId) { return R.ok(sysPostService.getById(postId)); } + /** + * 查询岗位信息信息 + * @param query 查询条件 + * @return R + */ + @Operation(description = "查询角色信息", summary = "查询角色信息") + @GetMapping("/details") + @PreAuthorize("@pms.hasPermission('sys_post_view')") + public R getDetails(SysPost query) { + return R.ok(sysPostService.getOne(Wrappers.query(query), false)); + } + /** * 新增岗位信息表 * @param sysPost 岗位信息表 * @return R */ - @Operation(summary = "新增岗位信息表", description = "新增岗位信息表") + @Operation(description = "新增岗位信息表", summary = "新增岗位信息表") @SysLog("新增岗位信息表") @PostMapping @PreAuthorize("@pms.hasPermission('sys_post_add')") @@ -101,7 +120,7 @@ public class SysPostController { * @param sysPost 岗位信息表 * @return R */ - @Operation(summary = "修改岗位信息表", description = "修改岗位信息表") + @Operation(description = "修改岗位信息表", summary = "修改岗位信息表") @SysLog("修改岗位信息表") @PutMapping @PreAuthorize("@pms.hasPermission('sys_post_edit')") @@ -111,24 +130,24 @@ public class SysPostController { /** * 通过id删除岗位信息表 - * @param postId id + * @param ids id 列表 * @return R */ - @Operation(summary = "通过id删除岗位信息表", description = "通过id删除岗位信息表") + @Operation(description = "通过id删除岗位信息表", summary = "通过id删除岗位信息表") @SysLog("通过id删除岗位信息表") - @DeleteMapping("/{postId}") + @DeleteMapping @PreAuthorize("@pms.hasPermission('sys_post_del')") - public R removeById(@PathVariable Long postId) { - return R.ok(sysPostService.removeById(postId)); + public R removeById(@RequestBody Long[] ids) { + return R.ok(sysPostService.removeBatchByIds(CollUtil.toList(ids))); } /** * 导出excel 表格 - * @return + * @return excel 文件流 */ @ResponseExcel @GetMapping("/export") - @PreAuthorize("@pms.hasPermission('sys_post_import_export')") + @PreAuthorize("@pms.hasPermission('sys_post_export')") public List export() { return sysPostService.listPost(); } @@ -140,7 +159,7 @@ public class SysPostController { * @return ok fail */ @PostMapping("/import") - @PreAuthorize("@pms.hasPermission('sys_post_import_export')") + @PreAuthorize("@pms.hasPermission('sys_post_export')") public R importRole(@RequestExcel List excelVOList, BindingResult bindingResult) { return sysPostService.importPost(excelVOList, bindingResult); } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysPublicParamController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysPublicParamController.java index b3975718..0facfc9b 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysPublicParamController.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysPublicParamController.java @@ -18,6 +18,7 @@ package com.pig4cloud.pig.admin.controller; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.pig4cloud.pig.admin.api.entity.SysPublicParam; @@ -25,14 +26,18 @@ import com.pig4cloud.pig.admin.service.SysPublicParamService; import com.pig4cloud.pig.common.core.util.R; import com.pig4cloud.pig.common.log.annotation.SysLog; import com.pig4cloud.pig.common.security.annotation.Inner; +import com.pig4cloud.plugin.excel.annotation.ResponseExcel; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; +import lombok.AllArgsConstructor; +import org.springdoc.api.annotations.ParameterObject; import org.springframework.http.HttpHeaders; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; +import java.util.List; + /** * 公共参数 * @@ -40,9 +45,9 @@ import org.springframework.web.bind.annotation.*; * @date 2019-04-29 */ @RestController -@RequiredArgsConstructor +@AllArgsConstructor @RequestMapping("/param") -@Tag(name = "公共参数配置") +@Tag(description = "param", name = "公共参数配置") @SecurityRequirement(name = HttpHeaders.AUTHORIZATION) public class SysPublicParamController { @@ -54,7 +59,7 @@ public class SysPublicParamController { * @return */ @Inner(value = false) - @Operation(summary = "查询公共参数值", description = "根据key查询公共参数值") + @Operation(description = "查询公共参数值", summary = "根据key查询公共参数值") @GetMapping("/publicValue/{publicKey}") public R publicKey(@PathVariable("publicKey") String publicKey) { return R.ok(sysPublicParamService.getSysPublicParamKeyToValue(publicKey)); @@ -66,15 +71,18 @@ public class SysPublicParamController { * @param sysPublicParam 公共参数 * @return */ - @Operation(summary = "分页查询", description = "分页查询") + @Operation(description = "分页查询", summary = "分页查询") @GetMapping("/page") - public R getSysPublicParamPage(Page page, SysPublicParam sysPublicParam) { - return R.ok(sysPublicParamService.page(page, - Wrappers.lambdaQuery() - .like(StrUtil.isNotBlank(sysPublicParam.getPublicName()), SysPublicParam::getPublicName, - sysPublicParam.getPublicName()) - .like(StrUtil.isNotBlank(sysPublicParam.getPublicKey()), SysPublicParam::getPublicKey, - sysPublicParam.getPublicKey()))); + public R getSysPublicParamPage(@ParameterObject Page page, @ParameterObject SysPublicParam sysPublicParam) { + LambdaUpdateWrapper wrapper = Wrappers.lambdaUpdate() + .like(StrUtil.isNotBlank(sysPublicParam.getPublicName()), SysPublicParam::getPublicName, + sysPublicParam.getPublicName()) + .like(StrUtil.isNotBlank(sysPublicParam.getPublicKey()), SysPublicParam::getPublicKey, + sysPublicParam.getPublicKey()) + .eq(StrUtil.isNotBlank(sysPublicParam.getSystemFlag()), SysPublicParam::getSystemFlag, + sysPublicParam.getSystemFlag()); + + return R.ok(sysPublicParamService.page(page, wrapper)); } /** @@ -82,21 +90,26 @@ public class SysPublicParamController { * @param publicId id * @return R */ - @Operation(summary = "通过id查询公共参数", description = "通过id查询公共参数") - @GetMapping("/{publicId}") + @Operation(description = "通过id查询公共参数", summary = "通过id查询公共参数") + @GetMapping("/details/{publicId}") public R getById(@PathVariable("publicId") Long publicId) { return R.ok(sysPublicParamService.getById(publicId)); } + @GetMapping("/details") + public R getDetail(@ParameterObject SysPublicParam param) { + return R.ok(sysPublicParamService.getOne(Wrappers.query(param), false)); + } + /** * 新增公共参数 * @param sysPublicParam 公共参数 * @return R */ - @Operation(summary = "新增公共参数", description = "新增公共参数") + @Operation(description = "新增公共参数", summary = "新增公共参数") @SysLog("新增公共参数") @PostMapping - @PreAuthorize("@pms.hasPermission('sys_publicparam_add')") + @PreAuthorize("@pms.hasPermission('sys_syspublicparam_add')") public R save(@RequestBody SysPublicParam sysPublicParam) { return R.ok(sysPublicParamService.save(sysPublicParam)); } @@ -106,25 +119,36 @@ public class SysPublicParamController { * @param sysPublicParam 公共参数 * @return R */ - @Operation(summary = "修改公共参数", description = "修改公共参数") + @Operation(description = "修改公共参数", summary = "修改公共参数") @SysLog("修改公共参数") @PutMapping - @PreAuthorize("@pms.hasPermission('sys_publicparam_edit')") + @PreAuthorize("@pms.hasPermission('sys_syspublicparam_edit')") public R updateById(@RequestBody SysPublicParam sysPublicParam) { return sysPublicParamService.updateParam(sysPublicParam); } /** * 通过id删除公共参数 - * @param publicId id + * @param ids ids * @return R */ - @Operation(summary = "删除公共参数", description = "删除公共参数") + @Operation(description = "删除公共参数", summary = "删除公共参数") @SysLog("删除公共参数") - @DeleteMapping("/{publicId}") - @PreAuthorize("@pms.hasPermission('sys_publicparam_del')") - public R removeById(@PathVariable Long publicId) { - return sysPublicParamService.removeParam(publicId); + @DeleteMapping + @PreAuthorize("@pms.hasPermission('sys_syspublicparam_del')") + public R removeById(@RequestBody Long[] ids) { + return R.ok(sysPublicParamService.removeParamByIds(ids)); + } + + /** + * 导出excel 表格 + * @return + */ + @ResponseExcel + @GetMapping("/export") + @PreAuthorize("@pms.hasPermission('sys_syspublicparam_edit')") + public List export() { + return sysPublicParamService.list(); } /** @@ -133,6 +157,7 @@ public class SysPublicParamController { */ @SysLog("同步参数") @PutMapping("/sync") + @PreAuthorize("@pms.hasPermission('sys_syspublicparam_edit')") public R sync() { return sysPublicParamService.syncParamCache(); } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysRegisterController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysRegisterController.java index 8ee36fec..a73d66be 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysRegisterController.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysRegisterController.java @@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RestController; /** * @author lengleng * @date 2022/3/30 - * + *

* 客户端注册功能 register.user = false */ @RestController diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysRoleController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysRoleController.java index fc657136..843152dd 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysRoleController.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysRoleController.java @@ -1,69 +1,83 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.controller; -import com.baomidou.mybatisplus.core.metadata.IPage; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.pig4cloud.pig.admin.api.entity.SysRole; import com.pig4cloud.pig.admin.api.vo.RoleExcelVO; -import com.pig4cloud.pig.admin.api.vo.RoleVo; -import com.pig4cloud.pig.admin.service.SysRoleMenuService; +import com.pig4cloud.pig.admin.api.vo.RoleVO; import com.pig4cloud.pig.admin.service.SysRoleService; +import com.pig4cloud.pig.common.core.constant.CacheConstants; import com.pig4cloud.pig.common.core.util.R; import com.pig4cloud.pig.common.log.annotation.SysLog; import com.pig4cloud.plugin.excel.annotation.RequestExcel; import com.pig4cloud.plugin.excel.annotation.ResponseExcel; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; +import javax.validation.Valid; +import lombok.AllArgsConstructor; +import org.springdoc.api.annotations.ParameterObject; +import org.springframework.cache.annotation.CacheEvict; import org.springframework.http.HttpHeaders; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; import java.util.List; /** * @author lengleng - * @date 2019/2/1 + * @date 2020-02-10 */ @RestController -@RequiredArgsConstructor +@AllArgsConstructor @RequestMapping("/role") -@Tag(name = "角色管理模块") +@Tag(description = "role", name = "角色管理模块") @SecurityRequirement(name = HttpHeaders.AUTHORIZATION) public class SysRoleController { private final SysRoleService sysRoleService; - private final SysRoleMenuService sysRoleMenuService; - /** * 通过ID查询角色信息 * @param id ID * @return 角色信息 */ - @GetMapping("/{id:\\d+}") - public R getById(@PathVariable Long id) { + @GetMapping("/details/{id}") + public R getById(@PathVariable Long id) { return R.ok(sysRoleService.getById(id)); } + /** + * 查询角色信息 + * @param query 查询条件 + * @return 角色信息 + */ + @GetMapping("/details") + public R getDetails(@ParameterObject SysRole query) { + return R.ok(sysRoleService.getOne(Wrappers.query(query), false)); + } + /** * 添加角色 * @param sysRole 角色信息 @@ -72,7 +86,8 @@ public class SysRoleController { @SysLog("添加角色") @PostMapping @PreAuthorize("@pms.hasPermission('sys_role_add')") - public R save(@Valid @RequestBody SysRole sysRole) { + @CacheEvict(value = CacheConstants.ROLE_DETAILS, allEntries = true) + public R save(@Valid @RequestBody SysRole sysRole) { return R.ok(sysRoleService.save(sysRole)); } @@ -84,20 +99,22 @@ public class SysRoleController { @SysLog("修改角色") @PutMapping @PreAuthorize("@pms.hasPermission('sys_role_edit')") - public R update(@Valid @RequestBody SysRole sysRole) { + @CacheEvict(value = CacheConstants.ROLE_DETAILS, allEntries = true) + public R update(@Valid @RequestBody SysRole sysRole) { return R.ok(sysRoleService.updateById(sysRole)); } /** * 删除角色 - * @param id + * @param ids * @return */ @SysLog("删除角色") - @DeleteMapping("/{id:\\d+}") + @DeleteMapping @PreAuthorize("@pms.hasPermission('sys_role_del')") - public R removeById(@PathVariable Long id) { - return R.ok(sysRoleService.removeRoleById(id)); + @CacheEvict(value = CacheConstants.ROLE_DETAILS, allEntries = true) + public R removeById(@RequestBody Long[] ids) { + return R.ok(sysRoleService.removeRoleByIds(ids)); } /** @@ -105,18 +122,20 @@ public class SysRoleController { * @return 角色列表 */ @GetMapping("/list") - public R> listRoles() { + public R listRoles() { return R.ok(sysRoleService.list(Wrappers.emptyWrapper())); } /** * 分页查询角色信息 * @param page 分页对象 + * @param role 查询条件 * @return 分页对象 */ @GetMapping("/page") - public R> getRolePage(Page page) { - return R.ok(sysRoleService.page(page, Wrappers.emptyWrapper())); + public R getRolePage(Page page, SysRole role) { + return R.ok(sysRoleService.page(page, Wrappers.lambdaQuery() + .like(StrUtil.isNotBlank(role.getRoleName()), SysRole::getRoleName, role.getRoleName()))); } /** @@ -127,8 +146,18 @@ public class SysRoleController { @SysLog("更新角色菜单") @PutMapping("/menu") @PreAuthorize("@pms.hasPermission('sys_role_perm')") - public R saveRoleMenus(@RequestBody RoleVo roleVo) { - return R.ok(sysRoleMenuService.saveRoleMenus(roleVo.getRoleId(), roleVo.getMenuIds())); + public R saveRoleMenus(@RequestBody RoleVO roleVo) { + return R.ok(sysRoleService.updateRoleMenus(roleVo)); + } + + /** + * 通过角色ID 查询角色列表 + * @param roleIdList 角色ID + * @return + */ + @PostMapping("/getRoleList") + public R getRoleList(@RequestBody List roleIdList) { + return R.ok(sysRoleService.findRolesByRoleIds(roleIdList, CollUtil.join(roleIdList, StrUtil.UNDERLINE))); } /** @@ -137,7 +166,7 @@ public class SysRoleController { */ @ResponseExcel @GetMapping("/export") - @PreAuthorize("@pms.hasPermission('sys_role_import_export')") + @PreAuthorize("@pms.hasPermission('sys_role_export')") public List export() { return sysRoleService.listRole(); } @@ -149,7 +178,7 @@ public class SysRoleController { * @return ok fail */ @PostMapping("/import") - @PreAuthorize("@pms.hasPermission('sys_role_import_export')") + @PreAuthorize("@pms.hasPermission('sys_role_export')") public R importRole(@RequestExcel List excelVOList, BindingResult bindingResult) { return sysRoleService.importRole(excelVOList, bindingResult); } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysSystemInfoController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysSystemInfoController.java new file mode 100644 index 00000000..4318abc7 --- /dev/null +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysSystemInfoController.java @@ -0,0 +1,59 @@ +package com.pig4cloud.pig.admin.controller; + +import com.pig4cloud.pig.common.core.util.R; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.springframework.data.redis.connection.RedisServerCommands; +import org.springframework.data.redis.core.RedisCallback; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.http.HttpHeaders; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.*; + +@RestController +@RequestMapping("/system") +@RequiredArgsConstructor +@Tag(description = "system", name = "系统监控") +@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) +public class SysSystemInfoController { + + private final RedisTemplate redisTemplate; + + /** + * 缓存监控 + * @return R + */ + @GetMapping("/cache") + public R cache() { + Properties info = (Properties) redisTemplate.execute((RedisCallback) RedisServerCommands::info); + Properties commandStats = (Properties) redisTemplate + .execute((RedisCallback) connection -> connection.info("commandstats")); + Object dbSize = redisTemplate.execute((RedisCallback) RedisServerCommands::dbSize); + + if (commandStats == null) { + return R.failed("获取异常"); + } + + Map result = new HashMap<>(3); + result.put("info", info); + result.put("dbSize", dbSize); + + List> pieList = new ArrayList<>(); + commandStats.stringPropertyNames().forEach(key -> { + Map data = new HashMap<>(2); + String property = commandStats.getProperty(key); + data.put("name", StringUtils.removeStart(key, "cmdstat_")); + data.put("value", StringUtils.substringBetween(property, "calls=", ",usec")); + pieList.add(data); + }); + + result.put("commandStats", pieList); + return R.ok(result); + } + +} diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysTokenController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysTokenController.java new file mode 100644 index 00000000..77c31f03 --- /dev/null +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysTokenController.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.admin.controller; + +import com.pig4cloud.pig.admin.api.feign.RemoteTokenService; +import com.pig4cloud.pig.common.core.constant.SecurityConstants; +import com.pig4cloud.pig.common.core.util.R; +import com.pig4cloud.pig.common.log.annotation.SysLog; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; +import org.springframework.http.HttpHeaders; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Map; + +/** + * @author lengleng + * @date 2018/9/4 getTokenPage 管理 + */ +@RestController +@AllArgsConstructor +@RequestMapping("/token") +@Tag(description = "token", name = "令牌管理模块") +@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) +public class SysTokenController { + + private final RemoteTokenService remoteTokenService; + + /** + * 分页token 信息 + * @param params 参数集 + * @return token集合 + */ + @RequestMapping("/page") + public R getTokenPage(@RequestBody Map params) { + return remoteTokenService.getTokenPage(params, SecurityConstants.FROM_IN); + } + + /** + * 删除 + * @param tokens tokens + * @return success/false + */ + @SysLog("删除用户token") + @DeleteMapping("/delete") + @PreAuthorize("@pms.hasPermission('sys_token_del')") + public R removeById(@RequestBody String[] tokens) { + for (String token : tokens) { + remoteTokenService.removeTokenById(token, SecurityConstants.FROM_IN); + } + return R.ok(); + } + +} diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysUserController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysUserController.java index ae65ff8f..48f2467f 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysUserController.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysUserController.java @@ -1,109 +1,95 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.controller; -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.pig4cloud.pig.admin.api.dto.UserDTO; -import com.pig4cloud.pig.admin.api.dto.UserInfo; import com.pig4cloud.pig.admin.api.entity.SysUser; import com.pig4cloud.pig.admin.api.vo.UserExcelVO; -import com.pig4cloud.pig.admin.api.vo.UserInfoVO; -import com.pig4cloud.pig.admin.api.vo.UserVO; import com.pig4cloud.pig.admin.service.SysUserService; +import com.pig4cloud.pig.common.core.constant.CommonConstants; import com.pig4cloud.pig.common.core.exception.ErrorCodes; import com.pig4cloud.pig.common.core.util.MsgUtils; import com.pig4cloud.pig.common.core.util.R; import com.pig4cloud.pig.common.log.annotation.SysLog; import com.pig4cloud.pig.common.security.annotation.Inner; import com.pig4cloud.pig.common.security.util.SecurityUtils; -import com.pig4cloud.pig.common.xss.core.XssCleanIgnore; import com.pig4cloud.plugin.excel.annotation.RequestExcel; import com.pig4cloud.plugin.excel.annotation.ResponseExcel; +import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; +import javax.validation.Valid; +import lombok.AllArgsConstructor; +import org.springdoc.api.annotations.ParameterObject; import org.springframework.http.HttpHeaders; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; import java.util.List; -import java.util.Set; /** * @author lengleng - * @date 2019/2/1 + * @date 2018/12/16 */ @RestController -@RequiredArgsConstructor +@AllArgsConstructor @RequestMapping("/user") -@Tag(name = "用户管理模块") +@Tag(description = "user", name = "用户管理模块") @SecurityRequirement(name = HttpHeaders.AUTHORIZATION) public class SysUserController { private final SysUserService userService; + /** + * 获取指定用户全部信息 + * @return 用户信息 + */ + @Inner + @GetMapping(value = { "/info/query" }) + public R info(@RequestParam(required = false) String username, @RequestParam(required = false) String phone) { + SysUser user = userService.getOne(Wrappers.query() + .lambda() + .eq(StrUtil.isNotBlank(username), SysUser::getUsername, username) + .eq(StrUtil.isNotBlank(phone), SysUser::getPhone, phone)); + if (user == null) { + return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_USER_USERINFO_EMPTY, username)); + } + return R.ok(userService.findUserInfo(user)); + } + /** * 获取当前用户全部信息 * @return 用户信息 */ @GetMapping(value = { "/info" }) - public R info() { + public R info() { String username = SecurityUtils.getUser().getUsername(); SysUser user = userService.getOne(Wrappers.query().lambda().eq(SysUser::getUsername, username)); if (user == null) { return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_USER_QUERY_ERROR)); } - UserInfo userInfo = userService.getUserInfo(user); - UserInfoVO vo = new UserInfoVO(); - vo.setSysUser(userInfo.getSysUser()); - vo.setRoles(userInfo.getRoles()); - vo.setPermissions(userInfo.getPermissions()); - return R.ok(vo); - } - - /** - * 获取指定用户全部信息 - * @return 用户信息 - */ - @Inner - @GetMapping("/info/{username}") - public R info(@PathVariable String username) { - SysUser user = userService.getOne(Wrappers.query().lambda().eq(SysUser::getUsername, username)); - if (user == null) { - return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_USER_USERINFO_EMPTY, username)); - } - return R.ok(userService.getUserInfo(user)); - } - - /** - * 根据部门id,查询对应的用户 id 集合 - * @param deptIds 部门id 集合 - * @return 用户 id 集合 - */ - @Inner - @GetMapping("/ids") - public R> listUserIdByDeptIds(@RequestParam("deptIds") Set deptIds) { - return R.ok(userService.listUserIdByDeptIds(deptIds)); + return R.ok(userService.findUserInfo(user)); } /** @@ -111,37 +97,34 @@ public class SysUserController { * @param id ID * @return 用户信息 */ - @GetMapping("/{id:\\d+}") - public R user(@PathVariable Long id) { - return R.ok(userService.getUserVoById(id)); + @GetMapping("/details/{id}") + public R user(@PathVariable Long id) { + return R.ok(userService.selectUserVoById(id)); } /** - * 判断用户是否存在 - * @param userDTO 查询条件 - * @return + * 查询用户信息 + * @param query 查询条件 + * @return 不为空返回用户名 */ - @Inner(false) - @GetMapping("/check/exist") - public R isExist(UserDTO userDTO) { - List sysUserList = userService.list(new QueryWrapper<>(userDTO)); - if (CollUtil.isNotEmpty(sysUserList)) { - return R.ok(Boolean.TRUE, MsgUtils.getMessage(ErrorCodes.SYS_USER_EXISTING)); - } - return R.ok(Boolean.FALSE); + @Inner(value = false) + @GetMapping("/details") + public R getDetails(@ParameterObject SysUser query) { + SysUser sysUser = userService.getOne(Wrappers.query(query), false); + return R.ok(sysUser == null ? null : CommonConstants.SUCCESS); } /** * 删除用户信息 - * @param id ID + * @param ids ID * @return R */ @SysLog("删除用户信息") - @DeleteMapping("/{id:\\d+}") + @DeleteMapping @PreAuthorize("@pms.hasPermission('sys_user_del')") - public R userDel(@PathVariable Long id) { - SysUser sysUser = userService.getById(id); - return R.ok(userService.removeUserById(sysUser)); + @Operation(summary = "删除用户", description = "根据ID删除用户") + public R userDel(@RequestBody Long[] ids) { + return R.ok(userService.deleteUserByIds(ids)); } /** @@ -151,23 +134,21 @@ public class SysUserController { */ @SysLog("添加用户") @PostMapping - @XssCleanIgnore({ "password" }) @PreAuthorize("@pms.hasPermission('sys_user_add')") - public R user(@RequestBody UserDTO userDto) { + public R user(@RequestBody UserDTO userDto) { return R.ok(userService.saveUser(userDto)); } /** - * 管理员更新用户信息 + * 更新用户信息 * @param userDto 用户信息 * @return R */ @SysLog("更新用户信息") @PutMapping - @XssCleanIgnore({ "password" }) @PreAuthorize("@pms.hasPermission('sys_user_edit')") - public R updateUser(@Valid @RequestBody UserDTO userDto) { - return userService.updateUser(userDto); + public R updateUser(@Valid @RequestBody UserDTO userDto) { + return R.ok(userService.updateUser(userDto)); } /** @@ -177,32 +158,21 @@ public class SysUserController { * @return 用户集合 */ @GetMapping("/page") - public R> getUserPage(Page page, UserDTO userDTO) { - return R.ok(userService.getUserWithRolePage(page, userDTO)); + public R getUserPage(@ParameterObject Page page, @ParameterObject UserDTO userDTO) { + return R.ok(userService.getUsersWithRolePage(page, userDTO)); } /** - * 个人修改个人信息 + * 修改个人信息 * @param userDto userDto * @return success/false */ @SysLog("修改个人信息") @PutMapping("/edit") - @XssCleanIgnore({ "password", "newpassword1" }) - public R updateUserInfo(@Valid @RequestBody UserDTO userDto) { - userDto.setUsername(SecurityUtils.getUser().getUsername()); + public R updateUserInfo(@Valid @RequestBody UserDTO userDto) { return userService.updateUserInfo(userDto); } - /** - * @param username 用户名称 - * @return 上级部门用户列表 - */ - @GetMapping("/ancestor/{username}") - public R> listAncestorUsers(@PathVariable String username) { - return R.ok(userService.listAncestorUsersByUsername(username)); - } - /** * 导出excel 表格 * @param userDTO 查询条件 @@ -210,8 +180,8 @@ public class SysUserController { */ @ResponseExcel @GetMapping("/export") - @PreAuthorize("@pms.hasPermission('sys_user_import_export')") - public List export(UserDTO userDTO) { + @PreAuthorize("@pms.hasPermission('sys_user_export')") + public List export(UserDTO userDTO) { return userService.listUser(userDTO); } @@ -222,9 +192,32 @@ public class SysUserController { * @return R */ @PostMapping("/import") - @PreAuthorize("@pms.hasPermission('sys_user_import_export')") + @PreAuthorize("@pms.hasPermission('sys_user_export')") public R importUser(@RequestExcel List excelVOList, BindingResult bindingResult) { return userService.importUser(excelVOList, bindingResult); } + /** + * 锁定指定用户 + * @param username 用户名 + * @return R + */ + @Inner + @PutMapping("/lock/{username}") + public R lockUser(@PathVariable String username) { + return userService.lockUser(username); + } + + @PutMapping("/password") + public R password(@RequestBody UserDTO userDto) { + String username = SecurityUtils.getUser().getUsername(); + userDto.setUsername(username); + return userService.changePassword(userDto); + } + + @PostMapping("/check") + public R check(String password) { + return userService.checkPassword(password); + } + } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/TokenController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/TokenController.java deleted file mode 100644 index 3d53f91f..00000000 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/TokenController.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.pig4cloud.pig.admin.controller; - -import com.pig4cloud.pig.admin.api.feign.RemoteTokenService; -import com.pig4cloud.pig.common.core.util.R; -import io.swagger.v3.oas.annotations.security.SecurityRequirement; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpHeaders; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import java.util.Map; - -/** - * @author lengleng - * @date 2018/9/4 getTokenPage 管理 - */ -@RestController -@RequiredArgsConstructor -@RequestMapping("/token") -@Tag(name = "令牌管理模块") -@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) -public class TokenController { - - private final RemoteTokenService remoteTokenService; - - /** - * 分页token 信息 - * @param params 参数集 - * @return token集合 - */ - @GetMapping("/page") - public R token(@RequestParam Map params) { - return remoteTokenService.getTokenPage(params); - } - - /** - * 删除 - * @param id ID - * @return success/false - */ - @DeleteMapping("/{id}") - @PreAuthorize("@pms.hasPermission('sys_token_del')") - public R delete(@PathVariable String id) { - return remoteTokenService.removeToken(id); - } - -} diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysDeptMapper.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysDeptMapper.java index fe8c985a..534eb299 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysDeptMapper.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysDeptMapper.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.mapper; @@ -20,23 +23,15 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.pig4cloud.pig.admin.api.entity.SysDept; import org.apache.ibatis.annotations.Mapper; -import java.util.List; - /** *

* 部门管理 Mapper 接口 *

* * @author lengleng - * @since 2019/2/1 + * @since 2018-01-20 */ @Mapper public interface SysDeptMapper extends BaseMapper { - /** - * 关联dept——relation - * @return 数据列表 - */ - List listDepts(); - } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysDeptRelationMapper.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysDeptRelationMapper.java deleted file mode 100644 index ed1dd96d..00000000 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysDeptRelationMapper.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.pig4cloud.pig.admin.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.pig4cloud.pig.admin.api.entity.SysDeptRelation; -import org.apache.ibatis.annotations.Mapper; - -/** - *

- * Mapper 接口 - *

- * - * @author lengleng - * @since 2019/2/1 - */ -@Mapper -public interface SysDeptRelationMapper extends BaseMapper { - - /** - * 删除部门节点关系 - * @param deptRelation 待删除的某一个部门节点 - */ - void deleteDeptRelations(SysDeptRelation deptRelation); - - /** - * 删除部门节点关系,同时删除所有关联此部门子节点的部门关系 - * @param id 待删除的部门节点ID - */ - void deleteDeptRelationsById(Long id); - - /** - * 新增部门节点关系 - * @param deptRelation 待新增的部门节点关系 - */ - void insertDeptRelations(SysDeptRelation deptRelation); - -} diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysDictItemMapper.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysDictItemMapper.java index 14b7d1db..90161017 100755 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysDictItemMapper.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysDictItemMapper.java @@ -1,17 +1,18 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) */ package com.pig4cloud.pig.admin.mapper; diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysDictMapper.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysDictMapper.java index 4993e29e..5f13551a 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysDictMapper.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysDictMapper.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.mapper; diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysLogMapper.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysLogMapper.java index 140accba..2f0d8440 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysLogMapper.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysLogMapper.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.mapper; @@ -26,7 +29,7 @@ import org.apache.ibatis.annotations.Mapper; *

* * @author lengleng - * @since 2019/2/1 + * @since 2017-11-20 */ @Mapper public interface SysLogMapper extends BaseMapper { diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysMenuMapper.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysMenuMapper.java index 9622ba7f..86c65c2f 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysMenuMapper.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysMenuMapper.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.mapper; @@ -20,7 +23,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.pig4cloud.pig.admin.api.entity.SysMenu; import org.apache.ibatis.annotations.Mapper; -import java.util.Set; +import java.util.List; /** *

@@ -28,7 +31,7 @@ import java.util.Set; *

* * @author lengleng - * @since 2019/2/1 + * @since 2017-10-29 */ @Mapper public interface SysMenuMapper extends BaseMapper { @@ -38,6 +41,6 @@ public interface SysMenuMapper extends BaseMapper { * @param roleId 角色ID * @return */ - Set listMenusByRoleId(Long roleId); + List listMenusByRoleId(Long roleId); } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysOauthClientDetailsMapper.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysOauthClientDetailsMapper.java index 124097e7..d1a2c9c8 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysOauthClientDetailsMapper.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysOauthClientDetailsMapper.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.mapper; @@ -26,7 +29,7 @@ import org.apache.ibatis.annotations.Mapper; *

* * @author lengleng - * @since 2019/2/1 + * @since 2018-05-15 */ @Mapper public interface SysOauthClientDetailsMapper extends BaseMapper { diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysPostMapper.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysPostMapper.java index 46078d6b..e4824679 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysPostMapper.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysPostMapper.java @@ -24,10 +24,10 @@ import org.apache.ibatis.annotations.Mapper; import java.util.List; /** - * 岗位管理表 mapper接口 + * 岗位信息表 * * @author fxz - * @date 2022-03-15 17:18:40 + * @date 2022-03-26 12:50:43 */ @Mapper public interface SysPostMapper extends BaseMapper { diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysRoleMapper.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysRoleMapper.java index 6779e35a..8bed21e5 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysRoleMapper.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysRoleMapper.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.mapper; @@ -28,7 +31,7 @@ import java.util.List; *

* * @author lengleng - * @since 2019/2/1 + * @since 2017-10-29 */ @Mapper public interface SysRoleMapper extends BaseMapper { diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysRoleMenuMapper.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysRoleMenuMapper.java index b6196ab4..556f5037 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysRoleMenuMapper.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysRoleMenuMapper.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.mapper; @@ -26,7 +29,7 @@ import org.apache.ibatis.annotations.Mapper; *

* * @author lengleng - * @since 2019/2/1 + * @since 2017-10-29 */ @Mapper public interface SysRoleMenuMapper extends BaseMapper { diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysUserMapper.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysUserMapper.java index 58fdaf1d..99b20667 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysUserMapper.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysUserMapper.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.mapper; @@ -33,7 +36,7 @@ import java.util.List; *

* * @author lengleng - * @since 2019/2/1 + * @since 2017-10-29 */ @Mapper public interface SysUserMapper extends BaseMapper { @@ -49,6 +52,7 @@ public interface SysUserMapper extends BaseMapper { * 分页查询用户信息(含角色) * @param page 分页 * @param userDTO 查询参数 + * @param dataScope * @return list */ IPage getUserVosPage(Page page, @Param("query") UserDTO userDTO); @@ -63,6 +67,7 @@ public interface SysUserMapper extends BaseMapper { /** * 查询用户列表 * @param userDTO 查询条件 + * @param dataScope 数据权限声明 * @return */ List selectVoList(@Param("query") UserDTO userDTO); diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysUserRoleMapper.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysUserRoleMapper.java index e0de4b70..ded96389 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysUserRoleMapper.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysUserRoleMapper.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.mapper; @@ -19,7 +22,6 @@ package com.pig4cloud.pig.admin.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.pig4cloud.pig.admin.api.entity.SysUserRole; import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; /** *

@@ -27,18 +29,9 @@ import org.apache.ibatis.annotations.Param; *

* * @author lengleng - * @since 2019/2/1 + * @since 2017-10-29 */ @Mapper public interface SysUserRoleMapper extends BaseMapper { - /** - * 根据用户Id删除该用户的角色关系 - * @param userId 用户ID - * @return boolean - * @author 寻欢·李 - * @date 2017年12月7日 16:31:38 - */ - Boolean deleteByUserId(@Param("userId") Long userId); - } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDeptRelationService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDeptRelationService.java deleted file mode 100644 index 72cbb950..00000000 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDeptRelationService.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.pig4cloud.pig.admin.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.pig4cloud.pig.admin.api.entity.SysDept; -import com.pig4cloud.pig.admin.api.entity.SysDeptRelation; - -/** - *

- * 服务类 - *

- * - * @author lengleng - * @since 2019/2/1 - */ -public interface SysDeptRelationService extends IService { - - /** - * 新建部门关系 - * @param sysDept 部门 - */ - void saveDeptRelation(SysDept sysDept); - - /** - * 通过ID删除部门关系 - * @param id - */ - void removeDeptRelationById(Long id); - - /** - * 更新部门关系 - * @param relation - */ - void updateDeptRelation(SysDeptRelation relation); - -} diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDeptService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDeptService.java index 2005be34..4153e6ea 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDeptService.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDeptService.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.service; @@ -19,6 +22,9 @@ package com.pig4cloud.pig.admin.service; import cn.hutool.core.lang.tree.Tree; import com.baomidou.mybatisplus.extension.service.IService; import com.pig4cloud.pig.admin.api.entity.SysDept; +import com.pig4cloud.pig.admin.api.vo.DeptExcelVo; +import com.pig4cloud.pig.common.core.util.R; +import org.springframework.validation.BindingResult; import java.util.List; @@ -28,28 +34,16 @@ import java.util.List; *

* * @author lengleng - * @since 2019/2/1 + * @since 2018-01-20 */ public interface SysDeptService extends IService { /** * 查询部门树菜单 + * @param deptName 部门名称 * @return 树 */ - List> listDeptTrees(); - - /** - * 查询用户部门树 - * @return - */ - List> listCurrentUserDeptTrees(); - - /** - * 添加信息部门 - * @param sysDept - * @return - */ - Boolean saveDept(SysDept sysDept); + List> selectTree(String deptName); /** * 删除部门 @@ -58,18 +52,15 @@ public interface SysDeptService extends IService { */ Boolean removeDeptById(Long id); - /** - * 更新部门 - * @param sysDept 部门信息 - * @return 成功、失败 - */ - Boolean updateDeptById(SysDept sysDept); + List listExcelVo(); + + R importDept(List excelVOList, BindingResult bindingResult); /** - * 查找指定部门的子部门id列表 - * @param deptId 部门id - * @return List + * 获取部门的所有后代部门列表 + * @param deptId 部门ID + * @return 后代部门列表 */ - List listChildDeptId(Long deptId); + List listDescendant(Long deptId); } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDictItemService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDictItemService.java index d9af4afe..8963eb3c 100755 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDictItemService.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDictItemService.java @@ -1,22 +1,24 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) */ package com.pig4cloud.pig.admin.service; import com.baomidou.mybatisplus.extension.service.IService; import com.pig4cloud.pig.admin.api.entity.SysDictItem; +import com.pig4cloud.pig.common.core.util.R; /** * 字典项 @@ -31,13 +33,13 @@ public interface SysDictItemService extends IService { * @param id 字典项ID * @return */ - void removeDictItem(Long id); + R removeDictItem(Long id); /** * 更新字典项 * @param item 字典项 * @return */ - void updateDictItem(SysDictItem item); + R updateDictItem(SysDictItem item); } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDictService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDictService.java index 58ff67c4..90779628 100755 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDictService.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDictService.java @@ -1,22 +1,24 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) */ package com.pig4cloud.pig.admin.service; import com.baomidou.mybatisplus.extension.service.IService; import com.pig4cloud.pig.admin.api.entity.SysDict; +import com.pig4cloud.pig.common.core.util.R; /** * 字典表 @@ -28,21 +30,22 @@ public interface SysDictService extends IService { /** * 根据ID 删除字典 - * @param id + * @param ids ID列表 * @return */ - void removeDict(Long id); + R removeDictByIds(Long[] ids); /** * 更新字典 * @param sysDict 字典 * @return */ - void updateDict(SysDict sysDict); + R updateDict(SysDict sysDict); /** - * 清除缓存 + * 同步缓存 (清空缓存) + * @return R */ - void clearDictCache(); + R syncDictCache(); } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysFileService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysFileService.java index 3d49531e..a203ddb7 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysFileService.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysFileService.java @@ -20,9 +20,8 @@ package com.pig4cloud.pig.admin.service; import com.baomidou.mybatisplus.extension.service.IService; import com.pig4cloud.pig.admin.api.entity.SysFile; import com.pig4cloud.pig.common.core.util.R; -import org.springframework.web.multipart.MultipartFile; - import javax.servlet.http.HttpServletResponse; +import org.springframework.web.multipart.MultipartFile; /** * 文件管理 @@ -54,12 +53,4 @@ public interface SysFileService extends IService { */ Boolean deleteFile(Long id); - /** - * 获取外网访问地址 - * @param bucket - * @param fileName - * @return - */ - String onlineFile(String bucket, String fileName); - } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysLogService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysLogService.java index e81ccccb..7fe4dc7b 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysLogService.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysLogService.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.service; @@ -21,15 +24,13 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.pig4cloud.pig.admin.api.dto.SysLogDTO; import com.pig4cloud.pig.admin.api.entity.SysLog; -import java.util.List; - /** *

* 日志表 服务类 *

* * @author lengleng - * @since 2019/2/1 + * @since 2017-11-20 */ public interface SysLogService extends IService { @@ -39,13 +40,13 @@ public interface SysLogService extends IService { * @param sysLog * @return */ - Page getLogByPage(Page page, SysLogDTO sysLog); + Page getLogByPage(Page page, SysLogDTO sysLog); /** - * 列表查询日志 - * @param sysLog 查询条件 - * @return List + * 插入日志 + * @param sysLog 日志对象 + * @return true/false */ - List getLogList(SysLogDTO sysLog); + Boolean saveLog(SysLog sysLog); } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysMenuService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysMenuService.java index 6b842e50..c1594d85 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysMenuService.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysMenuService.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.service; @@ -19,6 +22,7 @@ package com.pig4cloud.pig.admin.service; import cn.hutool.core.lang.tree.Tree; import com.baomidou.mybatisplus.extension.service.IService; import com.pig4cloud.pig.admin.api.entity.SysMenu; +import com.pig4cloud.pig.common.core.util.R; import java.util.List; import java.util.Set; @@ -29,7 +33,7 @@ import java.util.Set; *

* * @author lengleng - * @since 2019/2/1 + * @since 2017-10-29 */ public interface SysMenuService extends IService { @@ -38,14 +42,14 @@ public interface SysMenuService extends IService { * @param roleId 角色ID * @return 菜单列表 */ - Set findMenuByRoleId(Long roleId); + List findMenuByRoleId(Long roleId); /** * 级联删除菜单 * @param id 菜单ID - * @return true成功, false失败 + * @return 成功、失败 */ - Boolean removeMenuById(Long id); + R removeMenuById(Long id); /** * 更新菜单信息 @@ -56,23 +60,18 @@ public interface SysMenuService extends IService { /** * 构建树 - * @param lazy 是否是懒加载 * @param parentId 父节点ID + * @param menuName 菜单名称 * @return */ - List> treeMenu(boolean lazy, Long parentId); + List> treeMenu(Long parentId, String menuName, String type); /** * 查询菜单 - * @param menuSet + * @param voSet * @param parentId * @return */ - List> filterMenu(Set menuSet, Long parentId); - - /** - * 清除菜单缓存 - */ - void clearMenuCache(); + List> filterMenu(Set voSet, String type, Long parentId); } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/AppService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysMobileService.java similarity index 78% rename from pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/AppService.java rename to pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysMobileService.java index 80981864..d102831e 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/AppService.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysMobileService.java @@ -17,28 +17,19 @@ package com.pig4cloud.pig.admin.service; -import com.pig4cloud.pig.admin.api.dto.AppSmsDTO; import com.pig4cloud.pig.common.core.util.R; /** * @author lengleng * @date 2018/11/14 */ -public interface AppService { +public interface SysMobileService { /** * 发送手机验证码 - * @param sms phone + * @param mobile mobile * @return code */ - R sendSmsCode(AppSmsDTO sms); - - /** - * 校验验证码 - * @param phone 手机号 - * @param code 验证码 - * @return - */ - boolean check(String phone, String code); + R sendSmsCode(String mobile); } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysOauthClientDetailsService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysOauthClientDetailsService.java index ce4026c7..110c7c99 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysOauthClientDetailsService.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysOauthClientDetailsService.java @@ -1,23 +1,28 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.service; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.pig4cloud.pig.admin.api.entity.SysOauthClientDetails; +import com.pig4cloud.pig.common.core.util.R; /** *

@@ -25,27 +30,36 @@ import com.pig4cloud.pig.admin.api.entity.SysOauthClientDetails; *

* * @author lengleng - * @since 2019/2/1 + * @since 2018-05-15 */ public interface SysOauthClientDetailsService extends IService { /** - * 通过ID删除客户端 - * @param id + * 根据客户端信息 + * @param clientDetails * @return */ - Boolean removeClientDetailsById(String id); + Boolean updateClientById(SysOauthClientDetails clientDetails); /** - * 修改客户端信息 - * @param sysOauthClientDetails + * 添加客户端 + * @param clientDetails * @return */ - Boolean updateClientDetailsById(SysOauthClientDetails sysOauthClientDetails); + Boolean saveClient(SysOauthClientDetails clientDetails); /** - * 清除客户端缓存 + * 分页查询客户端信息 + * @param page + * @param query + * @return */ - void clearClientCache(); + Page queryPage(Page page, SysOauthClientDetails query); + + /** + * 同步缓存 (清空缓存) + * @return R + */ + R syncClientCache(); } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysPostService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysPostService.java index 6bd2ea6c..e7349fa3 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysPostService.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysPostService.java @@ -26,13 +26,19 @@ import org.springframework.validation.BindingResult; import java.util.List; /** - * 岗位管理 服务类 + * 岗位信息表 * * @author fxz - * @date 2022-03-15 17:18:40 + * @date 2022-03-26 12:50:43 */ public interface SysPostService extends IService { + /** + * 导出excel 表格 + * @return + */ + List listPost(); + /** * 导入岗位 * @param excelVOList 岗位列表 @@ -41,10 +47,4 @@ public interface SysPostService extends IService { */ R importPost(List excelVOList, BindingResult bindingResult); - /** - * 导出excel 表格 - * @return - */ - List listPost(); - } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysPublicParamService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysPublicParamService.java index a834f9f2..e6f50ee4 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysPublicParamService.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysPublicParamService.java @@ -45,10 +45,10 @@ public interface SysPublicParamService extends IService { /** * 删除参数 - * @param publicId + * @param publicIds 参数列表 * @return */ - R removeParam(Long publicId); + R removeParamByIds(Long[] publicIds); /** * 同步缓存 diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysRoleMenuService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysRoleMenuService.java index f8f5c084..73a13c6e 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysRoleMenuService.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysRoleMenuService.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.service; @@ -25,13 +28,13 @@ import com.pig4cloud.pig.admin.api.entity.SysRoleMenu; *

* * @author lengleng - * @since 2019/2/1 + * @since 2017-10-29 */ public interface SysRoleMenuService extends IService { /** * 更新角色菜单 - * @param roleId 角色 + * @param roleId 角色ID * @param menuIds 菜单ID拼成的字符串,每个id之间根据逗号分隔 * @return */ diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysRoleService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysRoleService.java index c00b36a1..cbd3e5c1 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysRoleService.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysRoleService.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.service; @@ -19,6 +22,7 @@ package com.pig4cloud.pig.admin.service; import com.baomidou.mybatisplus.extension.service.IService; import com.pig4cloud.pig.admin.api.entity.SysRole; import com.pig4cloud.pig.admin.api.vo.RoleExcelVO; +import com.pig4cloud.pig.admin.api.vo.RoleVO; import com.pig4cloud.pig.common.core.util.R; import org.springframework.validation.BindingResult; @@ -30,16 +34,38 @@ import java.util.List; *

* * @author lengleng - * @since 2019/2/1 + * @since 2017-10-29 */ public interface SysRoleService extends IService { /** - * 通过角色ID,删除角色 - * @param id + * 通过用户ID,查询角色信息 + * @param userId * @return */ - Boolean removeRoleById(Long id); + List findRolesByUserId(Long userId); + + /** + * 根据角色ID 查询角色列表 + * @param roleIdList 角色ID列表 + * @param key 缓存key + * @return + */ + List findRolesByRoleIds(List roleIdList, String key); + + /** + * 通过角色ID,删除角色 + * @param ids + * @return + */ + Boolean removeRoleByIds(Long[] ids); + + /** + * 根据角色菜单列表 + * @param roleVo 角色&菜单列表 + * @return + */ + Boolean updateRoleMenus(RoleVO roleVo); /** * 导入角色 diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysUserRoleService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysUserRoleService.java index 6860414f..b86a402a 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysUserRoleService.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysUserRoleService.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.service; @@ -25,7 +28,7 @@ import com.pig4cloud.pig.admin.api.entity.SysUserRole; *

* * @author lengleng - * @since 2019/2/1 + * @since 2017-10-29 */ public interface SysUserRoleService extends IService { diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysUserService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysUserService.java index f58f39c5..cfcdfa0a 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysUserService.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysUserService.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.service; @@ -28,11 +31,10 @@ import com.pig4cloud.pig.common.core.util.R; import org.springframework.validation.BindingResult; import java.util.List; -import java.util.Set; /** * @author lengleng - * @date 2019/2/1 + * @date 2017/10/31 */ public interface SysUserService extends IService { @@ -41,7 +43,7 @@ public interface SysUserService extends IService { * @param sysUser 用户 * @return userInfo */ - UserInfo getUserInfo(SysUser sysUser); + UserInfo findUserInfo(SysUser sysUser); /** * 分页查询用户信息(含有角色信息) @@ -49,19 +51,19 @@ public interface SysUserService extends IService { * @param userDTO 参数列表 * @return */ - IPage getUserWithRolePage(Page page, UserDTO userDTO); + IPage getUsersWithRolePage(Page page, UserDTO userDTO); /** * 删除用户 - * @param sysUser 用户 + * @param ids 用户 * @return boolean */ - Boolean removeUserById(SysUser sysUser); + Boolean deleteUserByIds(Long[] ids); /** * 更新当前用户基本信息 * @param userDto 用户信息 - * @return Boolean 操作成功返回true,操作失败返回false + * @return Boolean */ R updateUserInfo(UserDTO userDto); @@ -70,21 +72,14 @@ public interface SysUserService extends IService { * @param userDto 用户信息 * @return */ - R updateUser(UserDTO userDto); + Boolean updateUser(UserDTO userDto); /** * 通过ID查询用户信息 * @param id 用户ID * @return 用户信息 */ - UserVO getUserVoById(Long id); - - /** - * 查询上级部门的用户信息 - * @param username 用户名 - * @return R - */ - List listAncestorUsersByUsername(String username); + UserVO selectUserVoById(Long id); /** * 保存用户信息 @@ -108,13 +103,6 @@ public interface SysUserService extends IService { */ R importUser(List excelVOList, BindingResult bindingResult); - /** - * 根据部门 id 列表查询对应的用户 id 集合 - * @param deptIds 部门 id 列表 - * @return userIdList - */ - List listUserIdByDeptIds(Set deptIds); - /** * 注册用户 * @param userDto 用户信息 @@ -122,4 +110,25 @@ public interface SysUserService extends IService { */ R registerUser(UserDTO userDto); + /** + * 锁定用户 + * @param username + * @return + */ + R lockUser(String username); + + /** + * 修改密码 + * @param userDto 用户信息 + * @return + */ + R changePassword(UserDTO userDto); + + /** + * 校验密码 + * @param password 密码明文 + * @return + */ + R checkPassword(String password); + } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDeptRelationServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDeptRelationServiceImpl.java deleted file mode 100644 index 3f077e3d..00000000 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDeptRelationServiceImpl.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.pig4cloud.pig.admin.service.impl; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.pig4cloud.pig.admin.api.entity.SysDept; -import com.pig4cloud.pig.admin.api.entity.SysDeptRelation; -import com.pig4cloud.pig.admin.mapper.SysDeptRelationMapper; -import com.pig4cloud.pig.admin.service.SysDeptRelationService; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; -import java.util.stream.Collectors; - -/** - *

- * 服务实现类 - *

- * - * @author lengleng - * @since 2019/2/1 - */ -@Service -@RequiredArgsConstructor -public class SysDeptRelationServiceImpl extends ServiceImpl - implements SysDeptRelationService { - - private final SysDeptRelationMapper sysDeptRelationMapper; - - /** - * 维护部门关系 - * @param sysDept 部门 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void saveDeptRelation(SysDept sysDept) { - // 增加部门关系表 - List relationList = sysDeptRelationMapper.selectList( - Wrappers.query().lambda().eq(SysDeptRelation::getDescendant, sysDept.getParentId())) - .stream() - .map(relation -> { - relation.setDescendant(sysDept.getDeptId()); - return relation; - }) - .collect(Collectors.toList()); - if (CollUtil.isNotEmpty(relationList)) { - this.saveBatch(relationList); - } - - // 自己也要维护到关系表中 - SysDeptRelation own = new SysDeptRelation(); - own.setDescendant(sysDept.getDeptId()); - own.setAncestor(sysDept.getDeptId()); - sysDeptRelationMapper.insert(own); - } - - /** - * 通过ID删除部门关系 - * @param id - */ - @Override - public void removeDeptRelationById(Long id) { - baseMapper.deleteDeptRelationsById(id); - } - - /** - * 更新部门关系 - * @param relation - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void updateDeptRelation(SysDeptRelation relation) { - baseMapper.deleteDeptRelations(relation); - baseMapper.insertDeptRelations(relation); - } - -} diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDeptServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDeptServiceImpl.java index ade640ef..31cd166c 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDeptServiceImpl.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDeptServiceImpl.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.service.impl; @@ -20,17 +23,20 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.lang.tree.Tree; import cn.hutool.core.lang.tree.TreeNode; import cn.hutool.core.lang.tree.TreeUtil; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.pig4cloud.pig.admin.api.entity.SysDept; -import com.pig4cloud.pig.admin.api.entity.SysDeptRelation; +import com.pig4cloud.pig.admin.api.vo.DeptExcelVo; import com.pig4cloud.pig.admin.mapper.SysDeptMapper; -import com.pig4cloud.pig.admin.service.SysDeptRelationService; import com.pig4cloud.pig.admin.service.SysDeptService; -import com.pig4cloud.pig.common.security.util.SecurityUtils; -import lombok.RequiredArgsConstructor; +import com.pig4cloud.pig.common.core.util.R; +import com.pig4cloud.plugin.excel.vo.ErrorMessage; +import lombok.AllArgsConstructor; +import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.BindingResult; import java.util.*; import java.util.stream.Collectors; @@ -41,26 +47,13 @@ import java.util.stream.Collectors; *

* * @author lengleng - * @since 2019/2/1 + * @since 2018-01-20 */ @Service -@RequiredArgsConstructor +@AllArgsConstructor public class SysDeptServiceImpl extends ServiceImpl implements SysDeptService { - private final SysDeptRelationService sysDeptRelationService; - - /** - * 添加信息部门 - * @param dept 部门 - * @return - */ - @Override - @Transactional(rollbackFor = Exception.class) - public Boolean saveDept(SysDept dept) { - this.save(dept); - sysDeptRelationService.saveDeptRelation(dept); - return Boolean.TRUE; - } + private final SysDeptMapper deptMapper; /** * 删除部门 @@ -71,85 +64,26 @@ public class SysDeptServiceImpl extends ServiceImpl impl @Transactional(rollbackFor = Exception.class) public Boolean removeDeptById(Long id) { // 级联删除部门 - List idList = sysDeptRelationService - .list(Wrappers.query().lambda().eq(SysDeptRelation::getAncestor, id)) - .stream() - .map(SysDeptRelation::getDescendant) - .collect(Collectors.toList()); + List idList = this.listDescendant(id).stream().map(SysDept::getDeptId).collect(Collectors.toList()); - if (CollUtil.isNotEmpty(idList)) { - this.removeByIds(idList); - } + Optional.ofNullable(idList).filter(CollUtil::isNotEmpty).ifPresent(this::removeByIds); - // 删除部门级联关系 - sysDeptRelationService.removeDeptRelationById(id); return Boolean.TRUE; } - /** - * 更新部门 - * @param sysDept 部门信息 - * @return 成功、失败 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public Boolean updateDeptById(SysDept sysDept) { - // 更新部门状态 - this.updateById(sysDept); - // 更新部门关系 - SysDeptRelation relation = new SysDeptRelation(); - relation.setAncestor(sysDept.getParentId()); - relation.setDescendant(sysDept.getDeptId()); - sysDeptRelationService.updateDeptRelation(relation); - return Boolean.TRUE; - } - - @Override - public List listChildDeptId(Long deptId) { - List deptRelations = sysDeptRelationService.list(Wrappers.lambdaQuery() - .eq(SysDeptRelation::getAncestor, deptId) - .ne(SysDeptRelation::getDescendant, deptId)); - if (CollUtil.isNotEmpty(deptRelations)) { - return deptRelations.stream().map(SysDeptRelation::getDescendant).collect(Collectors.toList()); - } - return new ArrayList<>(); - } - /** * 查询全部部门树 - * @return 树 + * @param deptName + * @return 树 部门名称 */ @Override - public List> listDeptTrees() { - return getDeptTree(this.list(Wrappers.emptyWrapper()), 0L); - } + public List> selectTree(String deptName) { + // 查询全部部门 + List deptAllList = deptMapper + .selectList(Wrappers.lambdaQuery().like(StrUtil.isNotBlank(deptName), SysDept::getName, deptName)); - /** - * 查询用户部门树 - * @return - */ - @Override - public List> listCurrentUserDeptTrees() { - Long deptId = SecurityUtils.getUser().getDeptId(); - List descendantIdList = sysDeptRelationService - .list(Wrappers.query().lambda().eq(SysDeptRelation::getAncestor, deptId)) - .stream() - .map(SysDeptRelation::getDescendant) - .collect(Collectors.toList()); - - List deptList = baseMapper.selectBatchIds(descendantIdList); - Optional dept = deptList.stream().filter(item -> item.getDeptId().intValue() == deptId).findFirst(); - return getDeptTree(deptList, dept.isPresent() ? dept.get().getParentId() : 0L); - } - - /** - * 构建部门树 - * @param depts 部门 - * @param parentId 父级id - * @return - */ - private List> getDeptTree(List depts, Long parentId) { - List> collect = depts.stream() + // 权限内部门 + List> collect = deptAllList.stream() .filter(dept -> dept.getDeptId().intValue() != dept.getParentId()) .sorted(Comparator.comparingInt(SysDept::getSortOrder)) .map(dept -> { @@ -158,15 +92,119 @@ public class SysDeptServiceImpl extends ServiceImpl impl treeNode.setParentId(dept.getParentId()); treeNode.setName(dept.getName()); treeNode.setWeight(dept.getSortOrder()); - // 扩展属性 - Map extra = new HashMap<>(2); + // 有权限不返回标识 + Map extra = new HashMap<>(8); extra.put("createTime", dept.getCreateTime()); treeNode.setExtra(extra); return treeNode; }) .collect(Collectors.toList()); - return TreeUtil.build(collect, parentId); + // 模糊查询 不组装树结构 直接返回 表格方便编辑 + if (StrUtil.isNotBlank(deptName)) { + return collect.stream().map(node -> { + Tree tree = new Tree<>(); + tree.putAll(node.getExtra()); + BeanUtils.copyProperties(node, tree); + return tree; + }).collect(Collectors.toList()); + } + + return TreeUtil.build(collect, 0L); + } + + /** + * 导出部门 + * @return + */ + @Override + public List listExcelVo() { + List list = this.list(); + List deptExcelVos = list.stream().map(item -> { + DeptExcelVo deptExcelVo = new DeptExcelVo(); + deptExcelVo.setName(item.getName()); + Optional first = this.list() + .stream() + .filter(it -> item.getParentId().equals(it.getDeptId())) + .map(SysDept::getName) + .findFirst(); + deptExcelVo.setParentName(first.orElse("根部门")); + deptExcelVo.setSortOrder(item.getSortOrder()); + return deptExcelVo; + }).collect(Collectors.toList()); + return deptExcelVos; + } + + @Override + public R importDept(List excelVOList, BindingResult bindingResult) { + List errorMessageList = (List) bindingResult.getTarget(); + + List deptList = this.list(); + for (DeptExcelVo item : excelVOList) { + Set errorMsg = new HashSet<>(); + boolean exsitUsername = deptList.stream().anyMatch(sysDept -> item.getName().equals(sysDept.getName())); + if (exsitUsername) { + errorMsg.add("部门名称已经存在"); + } + SysDept one = this.getOne(Wrappers.lambdaQuery().eq(SysDept::getName, item.getParentName())); + if (item.getParentName().equals("根部门")) { + one = new SysDept(); + one.setDeptId(0L); + } + if (one == null) { + errorMsg.add("上级部门不存在"); + } + if (CollUtil.isEmpty(errorMsg)) { + SysDept sysDept = new SysDept(); + sysDept.setName(item.getName()); + sysDept.setParentId(one.getDeptId()); + sysDept.setSortOrder(item.getSortOrder()); + baseMapper.insert(sysDept); + } + else { + // 数据不合法情况 + errorMessageList.add(new ErrorMessage(item.getLineNum(), errorMsg)); + } + } + if (CollUtil.isNotEmpty(errorMessageList)) { + return R.failed(errorMessageList); + } + return R.ok(null, "部门导入成功"); + } + + /** + * 查询所有子节点 (包含当前节点) + * @param deptId 部门ID 目标部门ID + * @return ID + */ + @Override + public List listDescendant(Long deptId) { + // 查询全部部门 + List allDeptList = baseMapper.selectList(Wrappers.emptyWrapper()); + + // 递归查询所有子节点 + List resDeptList = new ArrayList<>(); + recursiveDept(allDeptList, deptId, resDeptList); + + // 添加当前节点 + resDeptList.addAll(allDeptList.stream() + .filter(sysDept -> deptId.equals(sysDept.getDeptId())) + .collect(Collectors.toList())); + return resDeptList; + } + + /** + * 递归查询所有子节点。 + * @param allDeptList 所有部门列表 + * @param parentId 父部门ID + * @param resDeptList 结果集合 + */ + private void recursiveDept(List allDeptList, Long parentId, List resDeptList) { + // 使用 Stream API 进行筛选和遍历 + allDeptList.stream().filter(sysDept -> sysDept.getParentId().equals(parentId)).forEach(sysDept -> { + resDeptList.add(sysDept); + recursiveDept(allDeptList, sysDept.getDeptId(), resDeptList); + }); } } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDictItemServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDictItemServiceImpl.java index b43e6dc6..b265c8cf 100755 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDictItemServiceImpl.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDictItemServiceImpl.java @@ -1,17 +1,18 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) */ package com.pig4cloud.pig.admin.service.impl; @@ -25,10 +26,10 @@ import com.pig4cloud.pig.common.core.constant.CacheConstants; import com.pig4cloud.pig.common.core.constant.enums.DictTypeEnum; import com.pig4cloud.pig.common.core.exception.ErrorCodes; import com.pig4cloud.pig.common.core.util.MsgUtils; -import lombok.RequiredArgsConstructor; +import com.pig4cloud.pig.common.core.util.R; +import lombok.AllArgsConstructor; import org.springframework.cache.annotation.CacheEvict; import org.springframework.stereotype.Service; -import org.springframework.util.Assert; /** * 字典项 @@ -37,7 +38,7 @@ import org.springframework.util.Assert; * @date 2019/03/19 */ @Service -@RequiredArgsConstructor +@AllArgsConstructor public class SysDictItemServiceImpl extends ServiceImpl implements SysDictItemService { private final SysDictService dictService; @@ -49,14 +50,15 @@ public class SysDictItemServiceImpl extends ServiceImpl implements SysDictService { private final SysDictItemMapper dictItemMapper; /** * 根据ID 删除字典 - * @param id 字典ID + * @param ids 字典ID 列表 * @return */ @Override @Transactional(rollbackFor = Exception.class) @CacheEvict(value = CacheConstants.DICT_DETAILS, allEntries = true) - public void removeDict(Long id) { - SysDict dict = this.getById(id); - // 系统内置 - Assert.state(!DictTypeEnum.SYSTEM.getType().equals(dict.getSystemFlag()), - MsgUtils.getMessage(ErrorCodes.SYS_DICT_DELETE_SYSTEM)); - baseMapper.deleteById(id); - dictItemMapper.delete(Wrappers.lambdaQuery().eq(SysDictItem::getDictId, id)); + public R removeDictByIds(Long[] ids) { + + List dictIdList = baseMapper.selectBatchIds(CollUtil.toList(ids)) + .stream() + .filter(sysDict -> !sysDict.getSystemFlag().equals(DictTypeEnum.SYSTEM.getType()))// 系统内置类型不删除 + .map(SysDict::getId) + .collect(Collectors.toList()); + + baseMapper.deleteBatchIds(dictIdList); + + dictItemMapper.delete(Wrappers.lambdaQuery().in(SysDictItem::getDictId, dictIdList)); + return R.ok(); } /** @@ -67,19 +77,25 @@ public class SysDictServiceImpl extends ServiceImpl impl * @return */ @Override - @CacheEvict(value = CacheConstants.DICT_DETAILS, key = "#dict.dictKey") - public void updateDict(SysDict dict) { + @CacheEvict(value = CacheConstants.DICT_DETAILS, key = "#dict.dictType") + public R updateDict(SysDict dict) { SysDict sysDict = this.getById(dict.getId()); // 系统内置 - Assert.state(!DictTypeEnum.SYSTEM.getType().equals(sysDict.getSystemFlag()), - MsgUtils.getMessage(ErrorCodes.SYS_DICT_UPDATE_SYSTEM)); + if (DictTypeEnum.SYSTEM.getType().equals(sysDict.getSystemFlag())) { + return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_DICT_UPDATE_SYSTEM)); + } this.updateById(dict); + return R.ok(dict); } + /** + * 同步缓存 (清空缓存) + * @return R + */ @Override @CacheEvict(value = CacheConstants.DICT_DETAILS, allEntries = true) - public void clearDictCache() { - + public R syncDictCache() { + return R.ok(); } } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysFileServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysFileServiceImpl.java index 15973b1c..d9ccb48c 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysFileServiceImpl.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysFileServiceImpl.java @@ -26,8 +26,9 @@ import com.pig4cloud.pig.admin.api.entity.SysFile; import com.pig4cloud.pig.admin.mapper.SysFileMapper; import com.pig4cloud.pig.admin.service.SysFileService; import com.pig4cloud.pig.common.core.util.R; -import com.pig4cloud.plugin.oss.OssProperties; -import com.pig4cloud.plugin.oss.service.OssTemplate; +import com.pig4cloud.pig.common.file.core.FileProperties; +import com.pig4cloud.pig.common.file.core.FileTemplate; +import javax.servlet.http.HttpServletResponse; import lombok.AllArgsConstructor; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; @@ -35,11 +36,10 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; -import javax.servlet.http.HttpServletResponse; -import java.time.Duration; -import java.time.temporal.ChronoUnit; +import java.io.InputStream; import java.util.HashMap; import java.util.Map; +import java.util.Objects; /** * 文件管理 @@ -52,9 +52,9 @@ import java.util.Map; @AllArgsConstructor public class SysFileServiceImpl extends ServiceImpl implements SysFileService { - private final OssProperties ossProperties; + private final FileTemplate fileTemplate; - private final OssTemplate ossTemplate; + private final FileProperties properties; /** * 上传文件 @@ -65,13 +65,12 @@ public class SysFileServiceImpl extends ServiceImpl impl public R uploadFile(MultipartFile file) { String fileName = IdUtil.simpleUUID() + StrUtil.DOT + FileUtil.extName(file.getOriginalFilename()); Map resultMap = new HashMap<>(4); - resultMap.put("bucketName", ossProperties.getBucketName()); + resultMap.put("bucketName", properties.getBucketName()); resultMap.put("fileName", fileName); - resultMap.put("url", String.format("/admin/sys-file/%s/%s", ossProperties.getBucketName(), fileName)); + resultMap.put("url", String.format("/admin/sys-file/%s/%s", properties.getBucketName(), fileName)); - try { - ossTemplate.putObject(ossProperties.getBucketName(), fileName, file.getContentType(), - file.getInputStream()); + try (InputStream inputStream = file.getInputStream()) { + fileTemplate.putObject(properties.getBucketName(), fileName, inputStream, file.getContentType()); // 文件管理数据记录,收集管理追踪文件 fileLog(file, fileName); } @@ -90,7 +89,7 @@ public class SysFileServiceImpl extends ServiceImpl impl */ @Override public void getFile(String bucket, String fileName, HttpServletResponse response) { - try (S3Object s3Object = ossTemplate.getObject(bucket, fileName)) { + try (S3Object s3Object = fileTemplate.getObject(bucket, fileName)) { response.setContentType("application/octet-stream; charset=UTF-8"); IoUtil.copy(s3Object.getObjectContent(), response.getOutputStream()); } @@ -109,7 +108,10 @@ public class SysFileServiceImpl extends ServiceImpl impl @Transactional(rollbackFor = Exception.class) public Boolean deleteFile(Long id) { SysFile file = this.getById(id); - ossTemplate.removeObject(ossProperties.getBucketName(), file.getFileName()); + if (Objects.isNull(file)) { + return Boolean.FALSE; + } + fileTemplate.removeObject(properties.getBucketName(), file.getFileName()); return this.removeById(id); } @@ -124,19 +126,8 @@ public class SysFileServiceImpl extends ServiceImpl impl sysFile.setOriginal(file.getOriginalFilename()); sysFile.setFileSize(file.getSize()); sysFile.setType(FileUtil.extName(file.getOriginalFilename())); - sysFile.setBucketName(ossProperties.getBucketName()); + sysFile.setBucketName(properties.getBucketName()); this.save(sysFile); } - /** - * 默认获取文件的在线地址 - * @param bucket - * @param fileName - * @return - */ - @Override - public String onlineFile(String bucket, String fileName) { - return ossTemplate.getObjectURL(bucket, fileName, Duration.of(7, ChronoUnit.DAYS)); - } - } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysLogServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysLogServiceImpl.java index eb04d3f6..f956a0ae 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysLogServiceImpl.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysLogServiceImpl.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.service.impl; @@ -27,8 +30,7 @@ import com.pig4cloud.pig.admin.api.entity.SysLog; import com.pig4cloud.pig.admin.mapper.SysLogMapper; import com.pig4cloud.pig.admin.service.SysLogService; import org.springframework.stereotype.Service; - -import java.util.List; +import org.springframework.transaction.annotation.Transactional; /** *

@@ -36,42 +38,37 @@ import java.util.List; *

* * @author lengleng - * @since 2019/2/1 + * @since 2017-11-20 */ @Service public class SysLogServiceImpl extends ServiceImpl implements SysLogService { @Override public Page getLogByPage(Page page, SysLogDTO sysLog) { - return baseMapper.selectPage(page, buildQueryWrapper(sysLog)); - } - /** - * 列表查询日志 - * @param sysLog 查询条件 - * @return List - */ - @Override - public List getLogList(SysLogDTO sysLog) { - return baseMapper.selectList(buildQueryWrapper(sysLog)); - } - - /** - * 构建查询的 wrapper - * @param sysLog 查询条件 - * @return LambdaQueryWrapper - */ - private LambdaQueryWrapper buildQueryWrapper(SysLogDTO sysLog) { - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() - .eq(StrUtil.isNotBlank(sysLog.getType()), SysLog::getType, sysLog.getType()) - .like(StrUtil.isNotBlank(sysLog.getRemoteAddr()), SysLog::getRemoteAddr, sysLog.getRemoteAddr()); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); + if (StrUtil.isNotBlank(sysLog.getLogType())) { + wrapper.eq(SysLog::getLogType, sysLog.getLogType()); + } if (ArrayUtil.isNotEmpty(sysLog.getCreateTime())) { wrapper.ge(SysLog::getCreateTime, sysLog.getCreateTime()[0]) .le(SysLog::getCreateTime, sysLog.getCreateTime()[1]); } - return wrapper; + return baseMapper.selectPage(page, wrapper); + } + + /** + * 插入日志 + * @param sysLog 日志对象 + * @return true/false + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean saveLog(SysLog sysLog) { + baseMapper.insert(sysLog); + return Boolean.TRUE; } } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysMenuServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysMenuServiceImpl.java index 22663d06..37aa8629 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysMenuServiceImpl.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysMenuServiceImpl.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.service.impl; @@ -20,6 +23,7 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.lang.tree.Tree; import cn.hutool.core.lang.tree.TreeNode; import cn.hutool.core.lang.tree.TreeUtil; +import cn.hutool.core.util.BooleanUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -33,19 +37,22 @@ import com.pig4cloud.pig.common.core.constant.CommonConstants; import com.pig4cloud.pig.common.core.constant.enums.MenuTypeEnum; import com.pig4cloud.pig.common.core.exception.ErrorCodes; import com.pig4cloud.pig.common.core.util.MsgUtils; -import lombok.RequiredArgsConstructor; +import com.pig4cloud.pig.common.core.util.R; +import javax.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.Assert; -import javax.validation.constraints.NotNull; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.function.Function; +import java.util.function.Predicate; import java.util.stream.Collectors; /** @@ -57,34 +64,31 @@ import java.util.stream.Collectors; * @since 2017-10-29 */ @Service -@RequiredArgsConstructor +@AllArgsConstructor +@Slf4j public class SysMenuServiceImpl extends ServiceImpl implements SysMenuService { private final SysRoleMenuMapper sysRoleMenuMapper; @Override - @Cacheable(value = CacheConstants.MENU_DETAILS, key = "#roleId + '_menu'", unless = "#result == null") - public Set findMenuByRoleId(Long roleId) { + @Cacheable(value = CacheConstants.MENU_DETAILS, key = "#roleId", unless = "#result.isEmpty()") + public List findMenuByRoleId(Long roleId) { return baseMapper.listMenusByRoleId(roleId); } - /** - * 级联删除菜单 - * @param id 菜单ID - * @return true成功, false失败 - */ @Override @Transactional(rollbackFor = Exception.class) @CacheEvict(value = CacheConstants.MENU_DETAILS, allEntries = true) - public Boolean removeMenuById(Long id) { + public R removeMenuById(Long id) { // 查询父节点为当前节点的节点 List menuList = this.list(Wrappers.query().lambda().eq(SysMenu::getParentId, id)); - - Assert.isTrue(CollUtil.isEmpty(menuList), MsgUtils.getMessage(ErrorCodes.SYS_MENU_DELETE_EXISTING)); + if (CollUtil.isNotEmpty(menuList)) { + return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_MENU_DELETE_EXISTING)); + } sysRoleMenuMapper.delete(Wrappers.query().lambda().eq(SysRoleMenu::getMenuId, id)); // 删除当前菜单及其子菜单 - return this.removeById(id); + return R.ok(this.removeById(id)); } @Override @@ -95,57 +99,54 @@ public class SysMenuServiceImpl extends ServiceImpl impl /** * 构建树查询 1. 不是懒加载情况,查询全部 2. 是懒加载,根据parentId 查询 2.1 父节点为空,则查询ID -1 - * @param lazy 是否是懒加载 * @param parentId 父节点ID + * @param menuName 菜单名称 * @return */ @Override - public List> treeMenu(boolean lazy, Long parentId) { - if (!lazy) { - List> collect = baseMapper - .selectList(Wrappers.lambdaQuery().orderByAsc(SysMenu::getSortOrder)) - .stream() - .map(getNodeFunction()) - .collect(Collectors.toList()); - - return TreeUtil.build(collect, CommonConstants.MENU_TREE_ROOT_ID); - } - + public List> treeMenu(Long parentId, String menuName, String type) { Long parent = parentId == null ? CommonConstants.MENU_TREE_ROOT_ID : parentId; List> collect = baseMapper - .selectList( - Wrappers.lambdaQuery().eq(SysMenu::getParentId, parent).orderByAsc(SysMenu::getSortOrder)) + .selectList(Wrappers.lambdaQuery() + .like(StrUtil.isNotBlank(menuName), SysMenu::getName, menuName) + .eq(StrUtil.isNotBlank(type), SysMenu::getMenuType, type) + .orderByAsc(SysMenu::getSortOrder)) .stream() .map(getNodeFunction()) .collect(Collectors.toList()); + // 模糊查询 不组装树结构 直接返回 表格方便编辑 + if (StrUtil.isNotBlank(menuName)) { + return collect.stream().map(node -> { + Tree tree = new Tree<>(); + tree.putAll(node.getExtra()); + BeanUtils.copyProperties(node, tree); + return tree; + }).collect(Collectors.toList()); + } + return TreeUtil.build(collect, parent); } /** * 查询菜单 * @param all 全部菜单 + * @param type 类型 * @param parentId 父节点ID * @return */ @Override - public List> filterMenu(Set all, Long parentId) { + public List> filterMenu(Set all, String type, Long parentId) { List> collect = all.stream() - .filter(menu -> MenuTypeEnum.LEFT_MENU.getType().equals(menu.getType())) - .filter(menu -> StrUtil.isNotBlank(menu.getPath())) + .filter(menuTypePredicate(type)) .map(getNodeFunction()) .collect(Collectors.toList()); + Long parent = parentId == null ? CommonConstants.MENU_TREE_ROOT_ID : parentId; return TreeUtil.build(collect, parent); } - @Override - @CacheEvict(value = CacheConstants.MENU_DETAILS, allEntries = true) - public void clearMenuCache() { - - } - @NotNull private Function> getNodeFunction() { return menu -> { @@ -156,16 +157,42 @@ public class SysMenuServiceImpl extends ServiceImpl impl node.setWeight(menu.getSortOrder()); // 扩展属性 Map extra = new HashMap<>(); - extra.put("icon", menu.getIcon()); extra.put("path", menu.getPath()); - extra.put("type", menu.getType()); + extra.put("menuType", menu.getMenuType()); extra.put("permission", menu.getPermission()); - extra.put("label", menu.getName()); extra.put("sortOrder", menu.getSortOrder()); - extra.put("keepAlive", menu.getKeepAlive()); + + // 适配 vue3 + Map meta = new HashMap<>(); + meta.put("title", menu.getName()); + meta.put("isLink", menu.getPath() != null && menu.getPath().startsWith("http") ? menu.getPath() : ""); + meta.put("isHide", !BooleanUtil.toBooleanObject(menu.getVisible())); + meta.put("isKeepAlive", BooleanUtil.toBooleanObject(menu.getKeepAlive())); + meta.put("isAffix", false); + meta.put("isIframe", BooleanUtil.toBooleanObject(menu.getEmbedded())); + meta.put("icon", menu.getIcon()); + // 增加英文 + meta.put("enName", menu.getEnName()); + + extra.put("meta", meta); node.setExtra(extra); return node; }; } + /** + * menu 类型断言 + * @param type 类型 + * @return Predicate + */ + private Predicate menuTypePredicate(String type) { + return vo -> { + if (MenuTypeEnum.TOP_MENU.getDescription().equals(type)) { + return MenuTypeEnum.TOP_MENU.getType().equals(vo.getMenuType()); + } + // 其他查询 左侧 + 顶部 + return !MenuTypeEnum.BUTTON.getType().equals(vo.getMenuType()); + }; + } + } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/AppServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysMobileServiceImpl.java similarity index 64% rename from pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/AppServiceImpl.java rename to pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysMobileServiceImpl.java index a68246b5..14876597 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/AppServiceImpl.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysMobileServiceImpl.java @@ -17,24 +17,23 @@ package com.pig4cloud.pig.admin.service.impl; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.RandomUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.pig4cloud.pig.admin.api.dto.AppSmsDTO; import com.pig4cloud.pig.admin.api.entity.SysUser; import com.pig4cloud.pig.admin.mapper.SysUserMapper; -import com.pig4cloud.pig.admin.service.AppService; +import com.pig4cloud.pig.admin.service.SysMobileService; import com.pig4cloud.pig.common.core.constant.CacheConstants; import com.pig4cloud.pig.common.core.constant.SecurityConstants; import com.pig4cloud.pig.common.core.exception.ErrorCodes; import com.pig4cloud.pig.common.core.util.MsgUtils; import com.pig4cloud.pig.common.core.util.R; -import io.springboot.sms.core.SmsClient; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; -import java.util.Objects; +import java.util.List; import java.util.concurrent.TimeUnit; /** @@ -46,58 +45,39 @@ import java.util.concurrent.TimeUnit; @Slf4j @Service @AllArgsConstructor -public class AppServiceImpl implements AppService { +public class SysMobileServiceImpl implements SysMobileService { private final RedisTemplate redisTemplate; private final SysUserMapper userMapper; - private final SmsClient smsClient; - /** * 发送手机验证码 TODO: 调用短信网关发送验证码,测试返回前端 - * @param sms 手机号 + * @param mobile mobile * @return code */ @Override - public R sendSmsCode(AppSmsDTO sms) { - Object codeObj = redisTemplate.opsForValue().get(CacheConstants.DEFAULT_CODE_KEY + sms.getPhone()); + public R sendSmsCode(String mobile) { + List userList = userMapper + .selectList(Wrappers.query().lambda().eq(SysUser::getPhone, mobile)); + + if (CollUtil.isEmpty(userList)) { + log.info("手机号未注册:{}", mobile); + return R.ok(Boolean.FALSE, MsgUtils.getMessage(ErrorCodes.SYS_APP_PHONE_UNREGISTERED, mobile)); + } + + Object codeObj = redisTemplate.opsForValue().get(CacheConstants.DEFAULT_CODE_KEY + mobile); if (codeObj != null) { - log.info("手机号验证码未过期:{},{}", sms.getPhone(), codeObj); + log.info("手机号验证码未过期:{},{}", mobile, codeObj); return R.ok(Boolean.FALSE, MsgUtils.getMessage(ErrorCodes.SYS_APP_SMS_OFTEN)); } - // 校验手机号是否存在 sys_user 表 - if (sms.getExist() - && !userMapper.exists(Wrappers.lambdaQuery().eq(SysUser::getPhone, sms.getPhone()))) { - return R.ok(Boolean.FALSE, MsgUtils.getMessage(ErrorCodes.SYS_APP_PHONE_UNREGISTERED, sms.getPhone())); - } - String code = RandomUtil.randomNumbers(Integer.parseInt(SecurityConstants.CODE_SIZE)); - log.info("手机号生成验证码成功:{},{}", sms.getPhone(), code); + log.debug("手机号生成验证码成功:{},{}", mobile, code); redisTemplate.opsForValue() - .set(CacheConstants.DEFAULT_CODE_KEY + sms.getPhone(), code, SecurityConstants.CODE_TIME, TimeUnit.SECONDS); - - // 调用短信通道发送 - this.smsClient.sendCode(code, sms.getPhone()); + .set(CacheConstants.DEFAULT_CODE_KEY + mobile, code, SecurityConstants.CODE_TIME, TimeUnit.SECONDS); return R.ok(Boolean.TRUE, code); } - /** - * 校验验证码 - * @param phone 手机号 - * @param code 验证码 - * @return - */ - @Override - public boolean check(String phone, String code) { - Object codeObj = redisTemplate.opsForValue().get(CacheConstants.DEFAULT_CODE_KEY + phone); - - if (Objects.isNull(codeObj)) { - return false; - } - return codeObj.equals(code); - } - } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysOauthClientDetailsServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysOauthClientDetailsServiceImpl.java index 60dbdb81..2e267c7a 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysOauthClientDetailsServiceImpl.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysOauthClientDetailsServiceImpl.java @@ -1,28 +1,36 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.service.impl; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.pig4cloud.pig.admin.api.entity.SysOauthClientDetails; import com.pig4cloud.pig.admin.mapper.SysOauthClientDetailsMapper; import com.pig4cloud.pig.admin.service.SysOauthClientDetailsService; import com.pig4cloud.pig.common.core.constant.CacheConstants; +import com.pig4cloud.pig.common.core.util.R; +import lombok.RequiredArgsConstructor; import org.springframework.cache.annotation.CacheEvict; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; /** *

@@ -30,23 +38,13 @@ import org.springframework.stereotype.Service; *

* * @author lengleng - * @since 2019/2/1 + * @since 2018-05-15 */ @Service +@RequiredArgsConstructor public class SysOauthClientDetailsServiceImpl extends ServiceImpl implements SysOauthClientDetailsService { - /** - * 通过ID删除客户端 - * @param id - * @return - */ - @Override - @CacheEvict(value = CacheConstants.CLIENT_DETAILS_KEY, key = "#id") - public Boolean removeClientDetailsById(String id) { - return this.removeById(id); - } - /** * 根据客户端信息 * @param clientDetails @@ -54,17 +52,50 @@ public class SysOauthClientDetailsServiceImpl extends ServiceImpl implements SysPostService { diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysPublicParamServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysPublicParamServiceImpl.java index 677065fd..2fff4c42 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysPublicParamServiceImpl.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysPublicParamServiceImpl.java @@ -17,6 +17,7 @@ package com.pig4cloud.pig.admin.service.impl; +import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.pig4cloud.pig.admin.api.entity.SysPublicParam; @@ -32,6 +33,9 @@ import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; +import java.util.List; +import java.util.stream.Collectors; + /** * 公共参数配置 * @@ -73,18 +77,18 @@ public class SysPublicParamServiceImpl extends ServiceImpl idList = this.baseMapper.selectBatchIds(CollUtil.toList(publicIds)) + .stream() + .filter(p -> !p.getSystemFlag().equals(DictTypeEnum.SYSTEM.getType()))// 系统内置的跳过不能删除 + .map(SysPublicParam::getPublicId) + .collect(Collectors.toList()); + return R.ok(this.removeBatchByIds(idList)); } /** diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysRoleMenuServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysRoleMenuServiceImpl.java index f57049a7..afdd1016 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysRoleMenuServiceImpl.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysRoleMenuServiceImpl.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.service.impl; @@ -23,14 +26,14 @@ import com.pig4cloud.pig.admin.api.entity.SysRoleMenu; import com.pig4cloud.pig.admin.mapper.SysRoleMenuMapper; import com.pig4cloud.pig.admin.service.SysRoleMenuService; import com.pig4cloud.pig.common.core.constant.CacheConstants; -import lombok.RequiredArgsConstructor; +import lombok.AllArgsConstructor; import org.springframework.cache.CacheManager; +import org.springframework.cache.annotation.CacheEvict; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; import java.util.List; -import java.util.Objects; import java.util.stream.Collectors; /** @@ -39,10 +42,10 @@ import java.util.stream.Collectors; *

* * @author lengleng - * @since 2019/2/1 + * @since 2017-10-29 */ @Service -@RequiredArgsConstructor +@AllArgsConstructor public class SysRoleMenuServiceImpl extends ServiceImpl implements SysRoleMenuService { private final CacheManager cacheManager; @@ -54,6 +57,7 @@ public class SysRoleMenuServiceImpl extends ServiceImplquery().lambda().eq(SysRoleMenu::getRoleId, roleId)); @@ -68,10 +72,9 @@ public class SysRoleMenuServiceImpl extends ServiceImpl * * @author lengleng - * @since 2019/2/1 + * @since 2017-10-29 */ @Service -@RequiredArgsConstructor +@AllArgsConstructor public class SysRoleServiceImpl extends ServiceImpl implements SysRoleService { - private final SysRoleMenuMapper sysRoleMenuMapper; + private SysRoleMenuService roleMenuService; + + /** + * 通过用户ID,查询角色信息 + * @param userId + * @return + */ + @Override + public List findRolesByUserId(Long userId) { + return baseMapper.listRolesByUserId(userId); + } + + /** + * 根据角色ID 查询角色列表,注意缓存删除 + * @param roleIdList 角色ID列表 + * @param key 缓存key + * @return + */ + @Override + @Cacheable(value = CacheConstants.ROLE_DETAILS, key = "#key", unless = "#result.isEmpty()") + public List findRolesByRoleIds(List roleIdList, String key) { + return baseMapper.selectBatchIds(roleIdList); + } /** * 通过角色ID,删除角色,并清空角色菜单缓存 - * @param id + * @param ids * @return */ @Override @Transactional(rollbackFor = Exception.class) - @CacheEvict(value = CacheConstants.MENU_DETAILS, allEntries = true) - public Boolean removeRoleById(Long id) { - sysRoleMenuMapper.delete(Wrappers.update().lambda().eq(SysRoleMenu::getRoleId, id)); - return this.removeById(id); + public Boolean removeRoleByIds(Long[] ids) { + roleMenuService + .remove(Wrappers.update().lambda().in(SysRoleMenu::getRoleId, CollUtil.toList(ids))); + return this.removeBatchByIds(CollUtil.toList(ids)); + } + + /** + * 根据角色菜单列表 + * @param roleVo 角色&菜单列表 + * @return + */ + @Override + public Boolean updateRoleMenus(RoleVO roleVo) { + return roleMenuService.saveRoleMenus(roleVo.getRoleId(), roleVo.getMenuIds()); } /** diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserRoleServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserRoleServiceImpl.java index 4fb064d0..820d420b 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserRoleServiceImpl.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserRoleServiceImpl.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.service.impl; @@ -28,7 +31,7 @@ import org.springframework.stereotype.Service; *

* * @author lengleng - * @since 2019/2/1 + * @since 2017-10-29 */ @Service public class SysUserRoleServiceImpl extends ServiceImpl implements SysUserRoleService { diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserServiceImpl.java index 136739bd..ba0d1097 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserServiceImpl.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysUserServiceImpl.java @@ -1,17 +1,20 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package com.pig4cloud.pig.admin.service.impl; @@ -19,6 +22,7 @@ package com.pig4cloud.pig.admin.service.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -29,26 +33,27 @@ import com.pig4cloud.pig.admin.api.entity.*; import com.pig4cloud.pig.admin.api.util.ParamResolver; import com.pig4cloud.pig.admin.api.vo.UserExcelVO; import com.pig4cloud.pig.admin.api.vo.UserVO; -import com.pig4cloud.pig.admin.mapper.*; -import com.pig4cloud.pig.admin.service.AppService; -import com.pig4cloud.pig.admin.service.SysMenuService; -import com.pig4cloud.pig.admin.service.SysUserService; +import com.pig4cloud.pig.admin.mapper.SysUserMapper; +import com.pig4cloud.pig.admin.mapper.SysUserPostMapper; +import com.pig4cloud.pig.admin.mapper.SysUserRoleMapper; +import com.pig4cloud.pig.admin.service.*; import com.pig4cloud.pig.common.core.constant.CacheConstants; import com.pig4cloud.pig.common.core.constant.CommonConstants; -import com.pig4cloud.pig.common.core.constant.enums.MenuTypeEnum; import com.pig4cloud.pig.common.core.exception.ErrorCodes; import com.pig4cloud.pig.common.core.util.MsgUtils; import com.pig4cloud.pig.common.core.util.R; +import com.pig4cloud.pig.common.security.util.SecurityUtils; import com.pig4cloud.plugin.excel.vo.ErrorMessage; -import lombok.RequiredArgsConstructor; +import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; +import org.springframework.cache.Cache; +import org.springframework.cache.CacheManager; import org.springframework.cache.annotation.CacheEvict; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.Assert; import org.springframework.validation.BindingResult; import java.time.LocalDateTime; @@ -57,29 +62,29 @@ import java.util.stream.Collectors; /** * @author lengleng - * @date 2019/2/1 + * @date 2017/10/31 */ @Slf4j @Service -@RequiredArgsConstructor +@AllArgsConstructor public class SysUserServiceImpl extends ServiceImpl implements SysUserService { private static final PasswordEncoder ENCODER = new BCryptPasswordEncoder(); - private final AppService appService; - - private final SysRoleMapper sysRoleMapper; - - private final SysDeptMapper sysDeptMapper; - private final SysMenuService sysMenuService; - private final SysPostMapper sysPostMapper; + private final SysRoleService sysRoleService; + + private final SysPostService sysPostService; + + private final SysDeptService sysDeptService; private final SysUserRoleMapper sysUserRoleMapper; private final SysUserPostMapper sysUserPostMapper; + private final CacheManager cacheManager; + /** * 保存用户信息 * @param userDto DTO 对象 @@ -91,14 +96,9 @@ public class SysUserServiceImpl extends ServiceImpl impl SysUser sysUser = new SysUser(); BeanUtils.copyProperties(userDto, sysUser); sysUser.setDelFlag(CommonConstants.STATUS_NORMAL); + sysUser.setCreateBy(userDto.getUsername()); sysUser.setPassword(ENCODER.encode(userDto.getPassword())); baseMapper.insert(sysUser); - userDto.getRole().stream().map(roleId -> { - SysUserRole userRole = new SysUserRole(); - userRole.setUserId(sysUser.getUserId()); - userRole.setRoleId(roleId); - return userRole; - }).forEach(sysUserRoleMapper::insert); // 保存用户岗位信息 Optional.ofNullable(userDto.getPost()).ifPresent(posts -> { posts.stream().map(postId -> { @@ -108,6 +108,24 @@ public class SysUserServiceImpl extends ServiceImpl impl return userPost; }).forEach(sysUserPostMapper::insert); }); + + // 如果角色为空,赋默认角色 + if (CollUtil.isEmpty(userDto.getRole())) { + // 获取默认角色编码 + String defaultRole = ParamResolver.getStr("USER_DEFAULT_ROLE"); + // 默认角色 + SysRole sysRole = sysRoleService + .getOne(Wrappers.lambdaQuery().eq(SysRole::getRoleCode, defaultRole)); + userDto.setRole(Collections.singletonList(sysRole.getRoleId())); + } + + // 插入用户角色关系表 + userDto.getRole().stream().map(roleId -> { + SysUserRole userRole = new SysUserRole(); + userRole.setUserId(sysUser.getUserId()); + userRole.setRoleId(roleId); + return userRole; + }).forEach(sysUserRoleMapper::insert); return Boolean.TRUE; } @@ -117,28 +135,27 @@ public class SysUserServiceImpl extends ServiceImpl impl * @return */ @Override - public UserInfo getUserInfo(SysUser sysUser) { + public UserInfo findUserInfo(SysUser sysUser) { UserInfo userInfo = new UserInfo(); userInfo.setSysUser(sysUser); - // 设置角色列表 - List roleList = sysRoleMapper.listRolesByUserId(sysUser.getUserId()); - userInfo.setRoleList(roleList); // 设置角色列表 (ID) - List roleIds = roleList.stream().map(SysRole::getRoleId).collect(Collectors.toList()); + List roleIds = sysRoleService.findRolesByUserId(sysUser.getUserId()) + .stream() + .map(SysRole::getRoleId) + .collect(Collectors.toList()); userInfo.setRoles(ArrayUtil.toArray(roleIds, Long.class)); - // 设置岗位列表 - List postList = sysPostMapper.listPostsByUserId(sysUser.getUserId()); - userInfo.setPostList(postList); - // 设置权限列表(menu.permission) - Set permissions = roleIds.stream() - .map(sysMenuService::findMenuByRoleId) - .flatMap(Collection::stream) - .filter(m -> MenuTypeEnum.BUTTON.getType().equals(m.getType())) - .map(SysMenu::getPermission) - .filter(StrUtil::isNotBlank) - .collect(Collectors.toSet()); - userInfo.setPermissions(ArrayUtil.toArray(permissions, String.class)); + // 设置权限列表(menu.permission) + Set permissions = new HashSet<>(); + roleIds.forEach(roleId -> { + List permissionList = sysMenuService.findMenuByRoleId(roleId) + .stream() + .filter(menu -> StrUtil.isNotEmpty(menu.getPermission())) + .map(SysMenu::getPermission) + .collect(Collectors.toList()); + permissions.addAll(permissionList); + }); + userInfo.setPermissions(ArrayUtil.toArray(permissions, String.class)); return userInfo; } @@ -149,7 +166,7 @@ public class SysUserServiceImpl extends ServiceImpl impl * @return */ @Override - public IPage getUserWithRolePage(Page page, UserDTO userDTO) { + public IPage getUsersWithRolePage(Page page, UserDTO userDTO) { return baseMapper.getUserVosPage(page, userDTO); } @@ -159,22 +176,27 @@ public class SysUserServiceImpl extends ServiceImpl impl * @return 用户信息 */ @Override - public UserVO getUserVoById(Long id) { + public UserVO selectUserVoById(Long id) { return baseMapper.getUserVoById(id); } /** * 删除用户 - * @param sysUser 用户 + * @param ids 用户ID 列表 * @return Boolean */ @Override - @CacheEvict(value = CacheConstants.USER_DETAILS, key = "#sysUser.username") - public Boolean removeUserById(SysUser sysUser) { - sysUserRoleMapper.deleteByUserId(sysUser.getUserId()); - // 删除用户职位关系 - sysUserPostMapper.delete(Wrappers.lambdaQuery().eq(SysUserPost::getUserId, sysUser.getUserId())); - this.removeById(sysUser.getUserId()); + @Transactional(rollbackFor = Exception.class) + public Boolean deleteUserByIds(Long[] ids) { + // 删除 spring cache + List userList = baseMapper.selectBatchIds(CollUtil.toList(ids)); + Cache cache = cacheManager.getCache(CacheConstants.USER_DETAILS); + for (SysUser sysUser : userList) { + cache.evict(sysUser.getUsername()); + } + + sysUserRoleMapper.delete(Wrappers.lambdaQuery().in(SysUserRole::getUserId, CollUtil.toList(ids))); + this.removeBatchByIds(CollUtil.toList(ids)); return Boolean.TRUE; } @@ -183,73 +205,47 @@ public class SysUserServiceImpl extends ServiceImpl impl public R updateUserInfo(UserDTO userDto) { UserVO userVO = baseMapper.getUserVoByUsername(userDto.getUsername()); - // 判断手机号是否修改,更新手机号校验验证码 - if (!StrUtil.equals(userVO.getPhone(), userDto.getPhone())) { - if (!appService.check(userDto.getPhone(), userDto.getCode())) { - return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_APP_SMS_ERROR)); - } - } - - // 修改密码逻辑 SysUser sysUser = new SysUser(); - if (StrUtil.isNotBlank(userDto.getNewpassword1())) { - Assert.isTrue(ENCODER.matches(userDto.getPassword(), userVO.getPassword()), - MsgUtils.getMessage(ErrorCodes.SYS_USER_UPDATE_PASSWORDERROR)); - sysUser.setPassword(ENCODER.encode(userDto.getNewpassword1())); - } sysUser.setPhone(userDto.getPhone()); sysUser.setUserId(userVO.getUserId()); sysUser.setAvatar(userDto.getAvatar()); + sysUser.setNickname(userDto.getNickname()); + sysUser.setName(userDto.getName()); + sysUser.setEmail(userDto.getEmail()); return R.ok(this.updateById(sysUser)); } @Override @Transactional(rollbackFor = Exception.class) @CacheEvict(value = CacheConstants.USER_DETAILS, key = "#userDto.username") - public R updateUser(UserDTO userDto) { + public Boolean updateUser(UserDTO userDto) { + // 更新用户表信息 SysUser sysUser = new SysUser(); BeanUtils.copyProperties(userDto, sysUser); sysUser.setUpdateTime(LocalDateTime.now()); - if (StrUtil.isNotBlank(userDto.getPassword())) { sysUser.setPassword(ENCODER.encode(userDto.getPassword())); } this.updateById(sysUser); - sysUserRoleMapper - .delete(Wrappers.update().lambda().eq(SysUserRole::getUserId, userDto.getUserId())); - userDto.getRole().forEach(roleId -> { + // 更新用户角色表 + sysUserRoleMapper.delete(Wrappers.lambdaQuery().eq(SysUserRole::getUserId, userDto.getUserId())); + userDto.getRole().stream().map(roleId -> { SysUserRole userRole = new SysUserRole(); userRole.setUserId(sysUser.getUserId()); userRole.setRoleId(roleId); - userRole.insert(); - }); + return userRole; + }).forEach(SysUserRole::insert); + + // 更新用户岗位表 sysUserPostMapper.delete(Wrappers.lambdaQuery().eq(SysUserPost::getUserId, userDto.getUserId())); - userDto.getPost().forEach(postId -> { + userDto.getPost().stream().map(postId -> { SysUserPost userPost = new SysUserPost(); userPost.setUserId(sysUser.getUserId()); userPost.setPostId(postId); - userPost.insert(); - }); - return R.ok(); - } - - /** - * 查询上级部门的用户信息 - * @param username 用户名 - * @return R - */ - @Override - public List listAncestorUsersByUsername(String username) { - SysUser sysUser = this.getOne(Wrappers.query().lambda().eq(SysUser::getUsername, username)); - - SysDept sysDept = sysDeptMapper.selectById(sysUser.getDeptId()); - if (sysDept == null) { - return null; - } - - Long parentId = sysDept.getParentId(); - return this.list(Wrappers.query().lambda().eq(SysUser::getDeptId, parentId)); + return userPost; + }).forEach(SysUserPost::insert); + return Boolean.TRUE; } /** @@ -259,6 +255,7 @@ public class SysUserServiceImpl extends ServiceImpl impl */ @Override public List listUser(UserDTO userDTO) { + // 根据数据权限查询全部的用户信息 List voList = baseMapper.selectVoList(userDTO); // 转换成execl 对象输出 List userExcelVOList = voList.stream().map(userVO -> { @@ -289,21 +286,21 @@ public class SysUserServiceImpl extends ServiceImpl impl public R importUser(List excelVOList, BindingResult bindingResult) { // 通用校验获取失败的数据 List errorMessageList = (List) bindingResult.getTarget(); - - // 个性化校验逻辑 - List userList = this.list(); - List deptList = sysDeptMapper.selectList(Wrappers.emptyWrapper()); - List roleList = sysRoleMapper.selectList(Wrappers.emptyWrapper()); - List postList = sysPostMapper.selectList(Wrappers.emptyWrapper()); + List deptList = sysDeptService.list(); + List roleList = sysRoleService.list(); + List postList = sysPostService.list(); // 执行数据插入操作 组装 UserDto for (UserExcelVO excel : excelVOList) { + // 个性化校验逻辑 + List userList = this.list(); + Set errorMsg = new HashSet<>(); // 校验用户名是否存在 - boolean existUserName = userList.stream() + boolean exsitUserName = userList.stream() .anyMatch(sysUser -> excel.getUsername().equals(sysUser.getUsername())); - if (existUserName) { + if (exsitUserName) { errorMsg.add(MsgUtils.getMessage(ErrorCodes.SYS_USER_USERNAME_EXISTING, excel.getUsername())); } @@ -325,7 +322,7 @@ public class SysUserServiceImpl extends ServiceImpl impl errorMsg.add(MsgUtils.getMessage(ErrorCodes.SYS_ROLE_ROLENAME_INEXISTENCE, excel.getRoleNameList())); } - // 判断输入的岗位名称列表是否合法 + // 判断输入的部门名称列表是否合法 List postNameList = StrUtil.split(excel.getPostNameList(), StrUtil.COMMA); List postCollList = postList.stream() .filter(post -> postNameList.stream().anyMatch(name -> post.getPostName().equals(name))) @@ -352,13 +349,6 @@ public class SysUserServiceImpl extends ServiceImpl impl return R.ok(); } - @Override - public List listUserIdByDeptIds(Set deptIds) { - return this.listObjs( - Wrappers.lambdaQuery(SysUser.class).select(SysUser::getUserId).in(SysUser::getDeptId, deptIds), - Long.class::cast); - } - /** * 插入excel User */ @@ -367,15 +357,19 @@ public class SysUserServiceImpl extends ServiceImpl impl UserDTO userDTO = new UserDTO(); userDTO.setUsername(excel.getUsername()); userDTO.setPhone(excel.getPhone()); + userDTO.setNickname(excel.getNickname()); + userDTO.setName(excel.getName()); + userDTO.setEmail(excel.getEmail()); // 批量导入初始密码为手机号 userDTO.setPassword(userDTO.getPhone()); // 根据部门名称查询部门ID userDTO.setDeptId(deptOptional.get().getDeptId()); + // 插入岗位名称 + List postIdList = postCollList.stream().map(SysPost::getPostId).collect(Collectors.toList()); + userDTO.setPost(postIdList); // 根据角色名称查询角色ID List roleIdList = roleCollList.stream().map(SysRole::getRoleId).collect(Collectors.toList()); userDTO.setRole(roleIdList); - List postIdList = postCollList.stream().map(SysPost::getPostId).collect(Collectors.toList()); - userDTO.setPost(postIdList); // 插入用户 this.saveUser(userDTO); } @@ -386,30 +380,76 @@ public class SysUserServiceImpl extends ServiceImpl impl * @return success/false */ @Override + @Transactional(rollbackFor = Exception.class) public R registerUser(UserDTO userDto) { - // 校验验证码 - if (!appService.check(userDto.getPhone(), userDto.getCode())) { - return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_APP_SMS_ERROR)); - } - // 判断用户名是否存在 SysUser sysUser = this.getOne(Wrappers.lambdaQuery().eq(SysUser::getUsername, userDto.getUsername())); if (sysUser != null) { - return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_USER_USERNAME_EXISTING, userDto.getUsername())); + String message = MsgUtils.getMessage(ErrorCodes.SYS_USER_USERNAME_EXISTING, userDto.getUsername()); + return R.failed(message); } - - // 获取默认角色编码 - String defaultRole = ParamResolver.getStr("USER_DEFAULT_ROLE"); - // 默认角色 - SysRole sysRole = sysRoleMapper - .selectOne(Wrappers.lambdaQuery().eq(SysRole::getRoleCode, defaultRole)); - - if (sysRole == null) { - return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_PARAM_CONFIG_ERROR, "USER_DEFAULT_ROLE")); - } - - userDto.setRole(Collections.singletonList(sysRole.getRoleId())); return R.ok(saveUser(userDto)); } + /** + * 锁定用户 + * @param username 用户名 + * @return + */ + @Override + @CacheEvict(value = CacheConstants.USER_DETAILS, key = "#username") + public R lockUser(String username) { + SysUser sysUser = baseMapper.selectOne(Wrappers.lambdaQuery().eq(SysUser::getUsername, username)); + + if (Objects.nonNull(sysUser)) { + sysUser.setLockFlag(CommonConstants.STATUS_LOCK); + baseMapper.updateById(sysUser); + } + return R.ok(); + } + + @Override + @CacheEvict(value = CacheConstants.USER_DETAILS, key = "#userDto.username") + public R changePassword(UserDTO userDto) { + UserVO userVO = baseMapper.getUserVoByUsername(userDto.getUsername()); + if (Objects.isNull(userVO)) { + return R.failed("用户不存在"); + } + + if (StrUtil.isEmpty(userDto.getPassword())) { + return R.failed("原密码不能为空"); + } + + if (!ENCODER.matches(userDto.getPassword(), userVO.getPassword())) { + log.info("原密码错误,修改个人信息失败:{}", userDto.getUsername()); + return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_USER_UPDATE_PASSWORDERROR)); + } + + if (StrUtil.isEmpty(userDto.getNewpassword1())) { + return R.failed("新密码不能为空"); + } + String password = ENCODER.encode(userDto.getNewpassword1()); + + this.update(Wrappers.lambdaUpdate() + .set(SysUser::getPassword, password) + .eq(SysUser::getUserId, userVO.getUserId())); + return R.ok(); + } + + @Override + public R checkPassword(String password) { + String username = SecurityUtils.getUser().getUsername(); + SysUser condition = new SysUser(); + condition.setUsername(username); + SysUser sysUser = this.getOne(new QueryWrapper<>(condition)); + + if (!ENCODER.matches(password, sysUser.getPassword())) { + log.info("原密码错误"); + return R.failed("密码输入错误"); + } + else { + return R.ok(); + } + } + } diff --git a/pig-upms/pig-upms-biz/src/main/resources/file/approle.xlsx b/pig-upms/pig-upms-biz/src/main/resources/file/approle.xlsx new file mode 100644 index 00000000..0c986e8b Binary files /dev/null and b/pig-upms/pig-upms-biz/src/main/resources/file/approle.xlsx differ diff --git a/pig-upms/pig-upms-biz/src/main/resources/file/dept.xlsx b/pig-upms/pig-upms-biz/src/main/resources/file/dept.xlsx new file mode 100644 index 00000000..69439e53 Binary files /dev/null and b/pig-upms/pig-upms-biz/src/main/resources/file/dept.xlsx differ diff --git a/pig-upms/pig-upms-biz/src/main/resources/file/user.xlsx b/pig-upms/pig-upms-biz/src/main/resources/file/user.xlsx index b67ee8ff..bb557ba5 100644 Binary files a/pig-upms/pig-upms-biz/src/main/resources/file/user.xlsx and b/pig-upms/pig-upms-biz/src/main/resources/file/user.xlsx differ diff --git a/pig-upms/pig-upms-biz/src/main/resources/logback-spring.xml b/pig-upms/pig-upms-biz/src/main/resources/logback-spring.xml old mode 100755 new mode 100644 index 58a4eacd..c0ce9c5b --- a/pig-upms/pig-upms-biz/src/main/resources/logback-spring.xml +++ b/pig-upms/pig-upms-biz/src/main/resources/logback-spring.xml @@ -1,77 +1,68 @@ - + 小技巧: 在根pom里面设置统一存放路径,统一管理方便维护 + + /Users/lengleng + + 1. 其他模块加日志输出,直接copy本文件放在resources 目录即可 + 2. 注意修改 的value模块 +--> - - - - - - - - - - - - ${CONSOLE_LOG_PATTERN} - - + + + + + + + + + + + ${CONSOLE_LOG_PATTERN} + + - - - ${log.path}/debug.log - - ${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz - 50MB - 30 - - - %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n - - + + + ${log.path}/debug.log + + ${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz + 50MB + 30 + + + ${CONSOLE_LOG_PATTERN} + + - - - ${log.path}/error.log - - ${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz - 50MB - 30 - - - %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n - - - ERROR - - + + + ${log.path}/error.log + + ${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz + 50MB + 30 + + + ${CONSOLE_LOG_PATTERN} + + + ERROR + + - - - - + + + + - - - - - - + + + + + + diff --git a/pig-upms/pig-upms-biz/src/main/resources/mapper/SysDeptMapper.xml b/pig-upms/pig-upms-biz/src/main/resources/mapper/SysDeptMapper.xml index 69fd6f98..25dcf129 100644 --- a/pig-upms/pig-upms-biz/src/main/resources/mapper/SysDeptMapper.xml +++ b/pig-upms/pig-upms-biz/src/main/resources/mapper/SysDeptMapper.xml @@ -1,48 +1,23 @@ - - - - - - - - - - - - - - - diff --git a/pig-upms/pig-upms-biz/src/main/resources/mapper/SysDeptRelationMapper.xml b/pig-upms/pig-upms-biz/src/main/resources/mapper/SysDeptRelationMapper.xml deleted file mode 100644 index 5f5ddcb9..00000000 --- a/pig-upms/pig-upms-biz/src/main/resources/mapper/SysDeptRelationMapper.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - DELETE - FROM sys_dept_relation - WHERE descendant IN (SELECT temp.descendant - FROM (SELECT descendant FROM sys_dept_relation WHERE ancestor = #{descendant}) temp) - AND ancestor IN (SELECT temp.ancestor - FROM (SELECT ancestor - FROM sys_dept_relation - WHERE descendant = #{descendant} - AND ancestor != descendant) temp) - - - - - DELETE - FROM sys_dept_relation - WHERE descendant IN ( - SELECT temp.descendant - FROM ( - SELECT descendant - FROM sys_dept_relation - WHERE ancestor = #{id} - ) temp - ) - - - - - INSERT INTO sys_dept_relation (ancestor, descendant) - SELECT a.ancestor, b.descendant - FROM sys_dept_relation a - CROSS JOIN sys_dept_relation b - WHERE a.descendant = #{ancestor} - AND b.ancestor = #{descendant} - - diff --git a/pig-upms/pig-upms-biz/src/main/resources/mapper/SysMenuMapper.xml b/pig-upms/pig-upms-biz/src/main/resources/mapper/SysMenuMapper.xml index 202a6ede..57198f75 100644 --- a/pig-upms/pig-upms-biz/src/main/resources/mapper/SysMenuMapper.xml +++ b/pig-upms/pig-upms-biz/src/main/resources/mapper/SysMenuMapper.xml @@ -1,18 +1,21 @@ @@ -21,40 +24,53 @@ + - + - + - + + + + + diff --git a/pig-upms/pig-upms-biz/src/main/resources/mapper/SysPostMapper.xml b/pig-upms/pig-upms-biz/src/main/resources/mapper/SysPostMapper.xml index bbcb22fc..eaf29278 100644 --- a/pig-upms/pig-upms-biz/src/main/resources/mapper/SysPostMapper.xml +++ b/pig-upms/pig-upms-biz/src/main/resources/mapper/SysPostMapper.xml @@ -1,5 +1,4 @@ - @@ -26,27 +29,21 @@ - - - - diff --git a/pig-upms/pig-upms-biz/src/main/resources/mapper/SysUserMapper.xml b/pig-upms/pig-upms-biz/src/main/resources/mapper/SysUserMapper.xml index ef261cbc..2b3ed9f7 100644 --- a/pig-upms/pig-upms-biz/src/main/resources/mapper/SysUserMapper.xml +++ b/pig-upms/pig-upms-biz/src/main/resources/mapper/SysUserMapper.xml @@ -1,179 +1,203 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + u.user_id, + u.username, + u.password, + u.salt, + u.phone, + u.avatar, + u.wx_openid, + u.qq_openid, + u.dept_id, + u.del_flag, + u.lock_flag, + u.tenant_id, + u.create_by, + u.create_time ucreate_time, + u.update_time uupdate_time, + r.role_id, + r.role_name, + r.role_code, + r.role_desc, + r.create_time rcreate_time, + r.update_time rupdate_time + - - sys_user.user_id, - sys_user.username, - sys_user.`password`, - sys_user.salt, - sys_user.phone, - sys_user.avatar, - sys_user.dept_id, - sys_user.create_time AS ucreate_time, - sys_user.update_time AS uupdate_time, - sys_user.del_flag AS udel_flag, - sys_user.lock_flag AS lock_flag, - sys_user.dept_id AS deptId, - r.role_id, - r.role_name, - r.role_code, - r.role_desc, - r.create_time AS rcreate_time, - r.update_time AS rupdate_time - + + u.user_id, + u.username, + u.password, + u.salt, + u.phone, + u.avatar, + u.wx_openid, + u.qq_openid, + u.gitee_login, + u.osc_id, + u.del_flag, + u.lock_flag, + u.tenant_id, + u.nickname, + u.name, + u.email, + u.create_by, + u.create_time ucreate_time, + u.update_time uupdate_time, + d.name dept_name, + d.dept_id + - - sys_user.user_id, - sys_user.username, - sys_user.`password`, - sys_user.salt, - sys_user.phone, - sys_user.avatar, - sys_user.create_time AS ucreate_time, - sys_user.update_time AS uupdate_time, - sys_user.del_flag AS udel_flag, - sys_user.lock_flag AS lock_flag, - r.role_id, - r.role_name, - r.role_code, - r.role_desc, - r.create_time AS rcreate_time, - r.update_time AS rupdate_time, - d.name AS deptName, - d.dept_id AS deptId - + - + - + - SELECT sys_user.user_id, - sys_user.username, - sys_user.salt, - sys_user.phone, - sys_user.avatar, - sys_user.dept_id, - sys_user.create_time AS ucreate_time, - sys_user.update_time AS uupdate_time, - sys_user.del_flag AS udel_flag, - sys_user.lock_flag AS lock_flag, - sys_user.dept_id AS deptId, - sys_dept.name AS deptName - FROM sys_user - LEFT JOIN sys_dept ON sys_dept.dept_id = sys_user.dept_id - - sys_user.del_flag = '0' - - - and sys_user.username LIKE #{usernameLike} - - - ORDER BY sys_user.create_time DESC - + + ORDER BY u.create_time DESC + + - + diff --git a/pig-upms/pig-upms-biz/src/main/resources/mapper/SysUserRoleMapper.xml b/pig-upms/pig-upms-biz/src/main/resources/mapper/SysUserRoleMapper.xml deleted file mode 100644 index de2a62a7..00000000 --- a/pig-upms/pig-upms-biz/src/main/resources/mapper/SysUserRoleMapper.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - DELETE FROM sys_user_role WHERE user_id = #{userId} - - - diff --git a/pig-upms/pom.xml b/pig-upms/pom.xml index 629b8138..3d2c7258 100755 --- a/pig-upms/pom.xml +++ b/pig-upms/pom.xml @@ -21,7 +21,7 @@ com.pig4cloud pig - 3.6.7 + 3.7.0-JDK8 pig-upms diff --git a/pig-visual/pig-codegen/pom.xml b/pig-visual/pig-codegen/pom.xml index 6c5ebb1e..43d7e552 100755 --- a/pig-visual/pig-codegen/pom.xml +++ b/pig-visual/pig-codegen/pom.xml @@ -22,7 +22,7 @@ com.pig4cloud pig-visual - 3.6.7 + 3.7.0-JDK8 pig-codegen @@ -65,6 +65,10 @@ mysql-connector-j + + cn.hutool + hutool-json + com.pig4cloud pig-common-core @@ -95,6 +99,12 @@ velocity-tools-generic ${velocity.tool.version} + + + io.springboot.plugin + screw-spring-boot-starter + ${screw.version} + org.springframework.boot diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/PigCodeGenApplication.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/PigCodeGenApplication.java index 53135fe4..9fb7b06e 100755 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/PigCodeGenApplication.java +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/PigCodeGenApplication.java @@ -1,17 +1,18 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) */ package com.pig4cloud.pig.codegen; @@ -19,21 +20,19 @@ package com.pig4cloud.pig.codegen; import com.pig4cloud.pig.common.datasource.annotation.EnableDynamicDataSource; import com.pig4cloud.pig.common.feign.annotation.EnablePigFeignClients; import com.pig4cloud.pig.common.security.annotation.EnablePigResourceServer; -import com.pig4cloud.pig.common.swagger.annotation.EnablePigDoc; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; /** * @author lengleng - * @date 2020/03/11 代码生成模块 + * @date 2018/07/29 代码生成模块 */ -@EnablePigDoc @EnableDynamicDataSource @EnablePigFeignClients @EnableDiscoveryClient -@SpringBootApplication @EnablePigResourceServer +@SpringBootApplication public class PigCodeGenApplication { public static void main(String[] args) { diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenDsConfController.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenDsConfController.java index 60bd7ae9..ec22c8ed 100755 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenDsConfController.java +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenDsConfController.java @@ -1,34 +1,42 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) */ package com.pig4cloud.pig.codegen.controller; -import com.baomidou.mybatisplus.core.metadata.IPage; +import cn.hutool.core.io.IoUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.ContentType; +import cn.smallbun.screw.boot.config.Screw; +import cn.smallbun.screw.boot.properties.ScrewProperties; +import com.baomidou.dynamic.datasource.DynamicRoutingDataSource; +import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.pig4cloud.pig.codegen.entity.GenDatasourceConf; import com.pig4cloud.pig.codegen.service.GenDatasourceConfService; import com.pig4cloud.pig.common.core.util.R; -import com.pig4cloud.pig.common.log.annotation.SysLog; -import io.swagger.v3.oas.annotations.security.SecurityRequirement; -import io.swagger.v3.oas.annotations.tags.Tag; +import com.pig4cloud.pig.common.core.util.SpringContextHolder; +import com.pig4cloud.pig.common.security.annotation.Inner; import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; import org.springframework.http.HttpHeaders; import org.springframework.web.bind.annotation.*; -import java.util.List; +import javax.servlet.http.HttpServletResponse; +import javax.sql.DataSource; /** * 数据源管理 @@ -39,12 +47,12 @@ import java.util.List; @RestController @RequiredArgsConstructor @RequestMapping("/dsconf") -@Tag(name = "数据源管理模块") -@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) public class GenDsConfController { private final GenDatasourceConfService datasourceConfService; + private final Screw screw; + /** * 分页查询 * @param page 分页对象 @@ -52,8 +60,11 @@ public class GenDsConfController { * @return */ @GetMapping("/page") - public R> getSysDatasourceConfPage(Page page, GenDatasourceConf datasourceConf) { - return R.ok(datasourceConfService.page(page, Wrappers.query(datasourceConf))); + public R getSysDatasourceConfPage(Page page, GenDatasourceConf datasourceConf) { + return R.ok(datasourceConfService.page(page, + Wrappers.lambdaQuery() + .like(StrUtil.isNotBlank(datasourceConf.getDsName()), GenDatasourceConf::getDsName, + datasourceConf.getDsName()))); } /** @@ -61,7 +72,8 @@ public class GenDsConfController { * @return */ @GetMapping("/list") - public R> list() { + @Inner(value = false) + public R list() { return R.ok(datasourceConfService.list()); } @@ -71,7 +83,7 @@ public class GenDsConfController { * @return R */ @GetMapping("/{id}") - public R getById(@PathVariable("id") Long id) { + public R getById(@PathVariable("id") Long id) { return R.ok(datasourceConfService.getById(id)); } @@ -80,9 +92,8 @@ public class GenDsConfController { * @param datasourceConf 数据源表 * @return R */ - @SysLog("新增数据源表") @PostMapping - public R save(@RequestBody GenDatasourceConf datasourceConf) { + public R save(@RequestBody GenDatasourceConf datasourceConf) { return R.ok(datasourceConfService.saveDsByEnc(datasourceConf)); } @@ -91,21 +102,42 @@ public class GenDsConfController { * @param conf 数据源表 * @return R */ - @SysLog("修改数据源表") @PutMapping - public R updateById(@RequestBody GenDatasourceConf conf) { + public R updateById(@RequestBody GenDatasourceConf conf) { return R.ok(datasourceConfService.updateDsByEnc(conf)); } /** * 通过id删除数据源表 - * @param id id + * @param ids id * @return R */ - @SysLog("删除数据源表") - @DeleteMapping("/{id}") - public R removeById(@PathVariable Long id) { - return R.ok(datasourceConfService.removeByDsId(id)); + @DeleteMapping + public R removeById(@RequestBody Long[] ids) { + return R.ok(datasourceConfService.removeByDsId(ids)); + } + + /** + * 查询数据源对应的文档 + * @param dsName 数据源名称 + */ + @SneakyThrows + @GetMapping("/doc") + public void generatorDoc(String dsName, HttpServletResponse response) { + // 设置指定的数据源 + DynamicRoutingDataSource dynamicRoutingDataSource = SpringContextHolder.getBean(DynamicRoutingDataSource.class); + DynamicDataSourceContextHolder.push(dsName); + DataSource dataSource = dynamicRoutingDataSource.determineDataSource(); + + // 设置指定的目标表 + ScrewProperties screwProperties = SpringContextHolder.getBean(ScrewProperties.class); + + // 生成 + byte[] data = screw.documentGeneration(dataSource, screwProperties).toByteArray(); + response.reset(); + response.addHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(data.length)); + response.setContentType(ContentType.OCTET_STREAM.getValue()); + IoUtil.write(response.getOutputStream(), Boolean.TRUE, data); } } diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenFieldTypeController.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenFieldTypeController.java new file mode 100644 index 00000000..e0b8e8e7 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenFieldTypeController.java @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.codegen.controller; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.pig4cloud.pig.codegen.entity.GenFieldType; +import com.pig4cloud.pig.codegen.service.GenFieldTypeService; +import com.pig4cloud.pig.common.core.util.R; +import com.pig4cloud.pig.common.log.annotation.SysLog; +import com.pig4cloud.plugin.excel.annotation.ResponseExcel; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpHeaders; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 列属性 + * + * @author pigx code generator + * @date 2023-02-06 20:16:01 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/fieldtype") +@Tag(description = "fieldtype", name = "列属性管理") +@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) +public class GenFieldTypeController { + + private final GenFieldTypeService fieldTypeService; + + /** + * 分页查询 + * @param page 分页对象 + * @param fieldType 列属性 + * @return + */ + @Operation(summary = "分页查询", description = "分页查询") + @GetMapping("/page") + public R getFieldTypePage(Page page, GenFieldType fieldType) { + return R.ok(fieldTypeService.page(page, + Wrappers.lambdaQuery() + .like(StrUtil.isNotBlank(fieldType.getColumnType()), GenFieldType::getColumnType, + fieldType.getColumnType()))); + } + + @Operation(summary = "查询列表", description = "查询列表") + @GetMapping("/list") + public R list(GenFieldType fieldType) { + return R.ok(fieldTypeService.list(Wrappers.query(fieldType))); + } + + /** + * 通过id查询列属性 + * @param id id + * @return R + */ + @Operation(summary = "通过id查询", description = "通过id查询") + @GetMapping("/details/{id}") + public R getById(@PathVariable("id") Long id) { + return R.ok(fieldTypeService.getById(id)); + } + + @GetMapping("/details") + public R getDetails(GenFieldType query) { + return R.ok(fieldTypeService.getOne(Wrappers.query(query), false)); + } + + /** + * 新增列属性 + * @param fieldType 列属性 + * @return R + */ + @Operation(summary = "新增列属性", description = "新增列属性") + @SysLog("新增列属性") + @PostMapping + public R save(@RequestBody GenFieldType fieldType) { + return R.ok(fieldTypeService.save(fieldType)); + } + + /** + * 修改列属性 + * @param fieldType 列属性 + * @return R + */ + @Operation(summary = "修改列属性", description = "修改列属性") + @SysLog("修改列属性") + @PutMapping + public R updateById(@RequestBody GenFieldType fieldType) { + return R.ok(fieldTypeService.updateById(fieldType)); + } + + /** + * 通过id删除列属性 + * @param ids id + * @return R + */ + @Operation(summary = "通过id删除列属性", description = "通过id删除列属性") + @SysLog("通过id删除列属性") + @DeleteMapping + public R removeById(@RequestBody Long[] ids) { + return R.ok(fieldTypeService.removeBatchByIds(CollUtil.toList(ids))); + } + + /** + * 导出excel 表格 + * @param fieldType 查询条件 + * @return excel 文件流 + */ + @ResponseExcel + @GetMapping("/export") + public List export(GenFieldType fieldType) { + return fieldTypeService.list(Wrappers.query(fieldType)); + } + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenFormConfController.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenFormConfController.java deleted file mode 100755 index 23c01a28..00000000 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenFormConfController.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.pig4cloud.pig.codegen.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.pig4cloud.pig.codegen.entity.GenFormConf; -import com.pig4cloud.pig.codegen.service.GenFormConfService; -import com.pig4cloud.pig.common.core.util.R; -import com.pig4cloud.pig.common.log.annotation.SysLog; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.security.SecurityRequirement; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpHeaders; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -/** - * 表单管理 - * - * @author lengleng - * @date 2019-08-12 15:55:35 - */ -@RestController -@RequiredArgsConstructor -@RequestMapping("/form") -@Tag(name = "表单管理") -@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) -public class GenFormConfController { - - private final GenFormConfService genRecordService; - - /** - * 分页查询 - * @param page 分页对象 - * @param formConf 生成记录 - * @return - */ - @Operation(summary = "分页查询", description = "分页查询") - @GetMapping("/page") - public R> getGenFormConfPage(Page page, GenFormConf formConf) { - return R.ok(genRecordService.page(page, Wrappers.query(formConf))); - } - - /** - * 通过id查询生成记录 - * @param id id - * @return R - */ - @Operation(summary = "通过id查询", description = "通过id查询") - @GetMapping("/{id}") - public R getById(@PathVariable("id") Integer id) { - return R.ok(genRecordService.getById(id)); - } - - /** - * 通过id查询生成记录 - * @param dsName 数据源ID - * @param tableName tableName - * @return R - */ - @Operation(summary = "通过tableName查询表单信息") - @GetMapping("/info") - public R form(String dsName, String tableName) { - return R.ok(genRecordService.getForm(dsName, tableName)); - } - - /** - * 新增生成记录 - * @param formConf 生成记录 - * @return R - */ - @Operation(summary = "新增生成记录", description = "新增生成记录") - @SysLog("新增生成记录") - @PostMapping - @PreAuthorize("@pms.hasPermission('gen_form_add')") - public R save(@RequestBody GenFormConf formConf) { - return R.ok(genRecordService.save(formConf)); - } - - /** - * 通过id删除生成记录 - * @param id id - * @return R - */ - @Operation(summary = "通过id删除生成记录", description = "通过id删除生成记录") - @SysLog("通过id删除生成记录") - @DeleteMapping("/{id}") - @PreAuthorize("@pms.hasPermission('gen_form_del')") - public R removeById(@PathVariable Long id) { - return R.ok(genRecordService.removeById(id)); - } - -} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenGroupController.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenGroupController.java new file mode 100644 index 00000000..c603101f --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenGroupController.java @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.codegen.controller; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.pig4cloud.pig.codegen.entity.GenGroupEntity; +import com.pig4cloud.pig.codegen.service.GenGroupService; +import com.pig4cloud.pig.codegen.util.vo.GroupVo; +import com.pig4cloud.pig.codegen.util.vo.TemplateGroupDTO; +import com.pig4cloud.pig.common.core.util.R; +import com.pig4cloud.pig.common.log.annotation.SysLog; +import com.pig4cloud.plugin.excel.annotation.ResponseExcel; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpHeaders; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 模板分组 + * + * @author PIG + * @date 2023-02-21 20:01:53 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/group") +@Tag(description = "group", name = "模板分组管理") +@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) +public class GenGroupController { + + private final GenGroupService genGroupService; + + /** + * 分页查询 + * @param page 分页对象 + * @param genGroup 模板分组 + * @return + */ + @Operation(summary = "分页查询", description = "分页查询") + @GetMapping("/page") + @PreAuthorize("@pms.hasPermission('codegen_group_view')") + public R getgenGroupPage(Page page, GenGroupEntity genGroup) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() + .like(genGroup.getId() != null, GenGroupEntity::getId, genGroup.getId()) + .like(StrUtil.isNotEmpty(genGroup.getGroupName()), GenGroupEntity::getGroupName, genGroup.getGroupName()); + return R.ok(genGroupService.page(page, wrapper)); + } + + /** + * 通过id查询模板分组 + * @param id id + * @return R + */ + @Operation(summary = "通过id查询", description = "通过id查询") + @GetMapping("/{id}") + @PreAuthorize("@pms.hasPermission('codegen_group_view')") + public R getById(@PathVariable("id") Long id) { + return R.ok(genGroupService.getGroupVoById(id)); + } + + /** + * 新增模板分组 + * @param genTemplateGroup 模板分组 + * @return R + */ + @Operation(summary = "新增模板分组", description = "新增模板分组") + @SysLog("新增模板分组") + @PostMapping + @PreAuthorize("@pms.hasPermission('codegen_group_add')") + public R save(@RequestBody TemplateGroupDTO genTemplateGroup) { + genGroupService.saveGenGroup(genTemplateGroup); + return R.ok(); + } + + /** + * 修改模板分组 + * @param groupVo 模板分组 + * @return R + */ + @Operation(summary = "修改模板分组", description = "修改模板分组") + @SysLog("修改模板分组") + @PutMapping + @PreAuthorize("@pms.hasPermission('codegen_group_edit')") + public R updateById(@RequestBody GroupVo groupVo) { + genGroupService.updateGroupAndTemplateById(groupVo); + return R.ok(); + } + + /** + * 通过id删除模板分组 + * @param ids id列表 + * @return R + */ + @Operation(summary = "通过id删除模板分组", description = "通过id删除模板分组") + @SysLog("通过id删除模板分组") + @DeleteMapping + @PreAuthorize("@pms.hasPermission('codegen_group_del')") + public R removeById(@RequestBody Long[] ids) { + genGroupService.delGroupAndTemplate(ids); + return R.ok(); + } + + /** + * 导出excel 表格 + * @param genGroup 查询条件 + * @return excel 文件流 + */ + @ResponseExcel + @GetMapping("/export") + @PreAuthorize("@pms.hasPermission('codegen_group_export')") + public List export(GenGroupEntity genGroup) { + return genGroupService.list(Wrappers.query(genGroup)); + } + + @GetMapping("/list") + @Operation(summary = "查询列表", description = "查询列表") + public R list() { + List list = genGroupService.list(); + return R.ok(list); + } + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenTableController.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenTableController.java new file mode 100644 index 00000000..4ee48193 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenTableController.java @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.codegen.controller; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.pig4cloud.pig.codegen.entity.GenTable; +import com.pig4cloud.pig.codegen.entity.GenTableColumnEntity; +import com.pig4cloud.pig.codegen.service.GenTableColumnService; +import com.pig4cloud.pig.codegen.service.GenTableService; +import com.pig4cloud.pig.common.core.util.R; +import com.pig4cloud.pig.common.log.annotation.SysLog; +import com.pig4cloud.plugin.excel.annotation.ResponseExcel; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpHeaders; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 列属性 + * + * @author pigx code generator + * @date 2023-02-06 20:34:55 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/table") +@Tag(description = "table", name = "列属性管理") +@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) +public class GenTableController { + + private final GenTableColumnService tableColumnService; + + private final GenTableService tableService; + + /** + * 分页查询 + * @param page 分页对象 + * @param table 列属性 + * @return + */ + @Operation(summary = "分页查询", description = "分页查询") + @GetMapping("/page") + public R getTablePage(Page page, GenTable table) { + + return R.ok(tableService.list(page, table)); + } + + /** + * 通过id查询列属性 + * @param id id + * @return R + */ + @Operation(summary = "通过id查询", description = "通过id查询") + @GetMapping("/{id}") + public R getById(@PathVariable("id") Long id) { + return R.ok(tableService.getById(id)); + } + + /** + * 新增列属性 + * @param table 列属性 + * @return R + */ + @Operation(summary = "新增列属性", description = "新增列属性") + @SysLog("新增列属性") + @PostMapping + public R save(@RequestBody GenTable table) { + return R.ok(tableService.save(table)); + } + + /** + * 修改列属性 + * @param table 列属性 + * @return R + */ + @Operation(summary = "修改列属性", description = "修改列属性") + @SysLog("修改列属性") + @PutMapping + public R updateById(@RequestBody GenTable table) { + return R.ok(tableService.updateById(table)); + } + + /** + * 通过id删除列属性 + * @param id id + * @return R + */ + @Operation(summary = "通过id删除列属性", description = "通过id删除列属性") + @SysLog("通过id删除列属性") + @DeleteMapping("/{id}") + public R removeById(@PathVariable Long id) { + return R.ok(tableService.removeById(id)); + } + + /** + * 导出excel 表格 + * @param table 查询条件 + * @return excel 文件流 + */ + @ResponseExcel + @GetMapping("/export") + public List export(GenTable table) { + return tableService.list(Wrappers.query(table)); + } + + @GetMapping("/list/{dsName}") + public R listTable(@PathVariable("dsName") String dsName) { + return R.ok(tableService.queryDsAllTable(dsName)); + } + + @GetMapping("/column/{dsName}/{tableName}") + public R column(@PathVariable("dsName") String dsName, @PathVariable String tableName) { + return R.ok(tableService.queryColumn(dsName, tableName)); + } + + /** + * 获取表信息 + * @param dsName 数据源 + * @param tableName 表名称 + */ + @GetMapping("/{dsName}/{tableName}") + public R info(@PathVariable("dsName") String dsName, @PathVariable String tableName) { + return R.ok(tableService.queryOrBuildTable(dsName, tableName)); + } + + /** + * 同步表信息 + * @param dsName 数据源 + * @param tableName 表名称 + */ + @GetMapping("/sync/{dsName}/{tableName}") + public R sync(@PathVariable("dsName") String dsName, @PathVariable String tableName) { + // 表配置删除 + tableService.remove( + Wrappers.lambdaQuery().eq(GenTable::getDsName, dsName).eq(GenTable::getTableName, tableName)); + // 字段配置删除 + tableColumnService.remove(Wrappers.lambdaQuery() + .eq(GenTableColumnEntity::getDsName, dsName) + .eq(GenTableColumnEntity::getTableName, tableName)); + return R.ok(tableService.queryOrBuildTable(dsName, tableName)); + } + + /** + * 修改表字段数据 + * @param dsName 数据源 + * @param tableName 表名称 + * @param tableFieldList 字段列表 + */ + @PutMapping("/field/{dsName}/{tableName}") + public R updateTableField(@PathVariable("dsName") String dsName, @PathVariable String tableName, + @RequestBody List tableFieldList) { + tableColumnService.updateTableField(dsName, tableName, tableFieldList); + return R.ok(); + } + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenTemplateController.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenTemplateController.java new file mode 100644 index 00000000..4b122c5f --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenTemplateController.java @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.codegen.controller; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.pig4cloud.pig.codegen.entity.GenTemplateEntity; +import com.pig4cloud.pig.codegen.service.GenTemplateService; +import com.pig4cloud.pig.common.core.util.R; +import com.pig4cloud.pig.common.log.annotation.SysLog; +import com.pig4cloud.plugin.excel.annotation.ResponseExcel; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpHeaders; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 模板 + * + * @author PIG + * @date 2023-02-21 17:15:44 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/template") +@Tag(description = "template", name = "模板管理") +@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) +public class GenTemplateController { + + private final GenTemplateService genTemplateService; + + /** + * 分页查询 + * @param page 分页对象 + * @param genTemplate 模板 + * @return + */ + @Operation(summary = "分页查询", description = "分页查询") + @GetMapping("/page") + @PreAuthorize("@pms.hasPermission('codegen_template_view')") + public R getgenTemplatePage(Page page, GenTemplateEntity genTemplate) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() + .like(genTemplate.getId() != null, GenTemplateEntity::getId, genTemplate.getId()) + .like(StrUtil.isNotEmpty(genTemplate.getTemplateName()), GenTemplateEntity::getTemplateName, + genTemplate.getTemplateName()); + return R.ok(genTemplateService.page(page, wrapper)); + } + + /** + * 查询全部模板 + * @return + */ + @Operation(summary = "查询全部", description = "查询全部") + @GetMapping("/list") + @PreAuthorize("@pms.hasPermission('codegen_template_view')") + public R list() { + return R.ok(genTemplateService.list(Wrappers.emptyWrapper())); + } + + /** + * 通过id查询模板 + * @param id id + * @return R + */ + @Operation(summary = "通过id查询", description = "通过id查询") + @GetMapping("/{id}") + @PreAuthorize("@pms.hasPermission('codegen_template_view')") + public R getById(@PathVariable("id") Long id) { + return R.ok(genTemplateService.getById(id)); + } + + /** + * 新增模板 + * @param genTemplate 模板 + * @return R + */ + @Operation(summary = "新增模板", description = "新增模板") + @SysLog("新增模板") + @PostMapping + @PreAuthorize("@pms.hasPermission('codegen_template_add')") + public R save(@RequestBody GenTemplateEntity genTemplate) { + return R.ok(genTemplateService.save(genTemplate)); + } + + /** + * 修改模板 + * @param genTemplate 模板 + * @return R + */ + @Operation(summary = "修改模板", description = "修改模板") + @SysLog("修改模板") + @PutMapping + @PreAuthorize("@pms.hasPermission('codegen_template_edit')") + public R updateById(@RequestBody GenTemplateEntity genTemplate) { + return R.ok(genTemplateService.updateById(genTemplate)); + } + + /** + * 通过id删除模板 + * @param ids id列表 + * @return R + */ + @Operation(summary = "通过id删除模板", description = "通过id删除模板") + @SysLog("通过id删除模板") + @DeleteMapping + @PreAuthorize("@pms.hasPermission('codegen_template_del')") + public R removeById(@RequestBody Long[] ids) { + return R.ok(genTemplateService.removeBatchByIds(CollUtil.toList(ids))); + } + + /** + * 导出excel 表格 + * @param genTemplate 查询条件 + * @return excel 文件流 + */ + @ResponseExcel + @GetMapping("/export") + @PreAuthorize("@pms.hasPermission('codegen_template_export')") + public List export(GenTemplateEntity genTemplate) { + return genTemplateService.list(Wrappers.query(genTemplate)); + } + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenTemplateGroupController.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenTemplateGroupController.java new file mode 100644 index 00000000..aeba3601 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GenTemplateGroupController.java @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.codegen.controller; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.pig4cloud.pig.codegen.entity.GenTemplateGroupEntity; +import com.pig4cloud.pig.codegen.service.GenTemplateGroupService; +import com.pig4cloud.pig.common.core.util.R; +import com.pig4cloud.pig.common.log.annotation.SysLog; +import com.pig4cloud.plugin.excel.annotation.ResponseExcel; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpHeaders; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 模板分组关联表 + * + * @author PIG + * @date 2023-02-22 09:25:15 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/templateGroup") +@Tag(description = "templateGroup", name = "模板分组关联表管理") +@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) +public class GenTemplateGroupController { + + private final GenTemplateGroupService genTemplateGroupService; + + /** + * 分页查询 + * @param page 分页对象 + * @param genTemplateGroup 模板分组关联表 + * @return + */ + @Operation(summary = "分页查询", description = "分页查询") + @GetMapping("/page") + @PreAuthorize("@pms.hasPermission('codegen_templateGroup_view')") + public R getgenTemplateGroupPage(Page page, GenTemplateGroupEntity genTemplateGroup) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); + return R.ok(genTemplateGroupService.page(page, wrapper)); + } + + /** + * 通过id查询模板分组关联表 + * @param groupId id + * @return R + */ + @Operation(summary = "通过id查询", description = "通过id查询") + @GetMapping("/{groupId}") + @PreAuthorize("@pms.hasPermission('codegen_templateGroup_view')") + public R getById(@PathVariable("groupId") Long groupId) { + return R.ok(genTemplateGroupService.getById(groupId)); + } + + /** + * 新增模板分组关联表 + * @param genTemplateGroup 模板分组关联表 + * @return R + */ + @Operation(summary = "新增模板分组关联表", description = "新增模板分组关联表") + @SysLog("新增模板分组关联表") + @PostMapping + @PreAuthorize("@pms.hasPermission('codegen_templateGroup_add')") + public R save(@RequestBody GenTemplateGroupEntity genTemplateGroup) { + return R.ok(genTemplateGroupService.save(genTemplateGroup)); + } + + /** + * 修改模板分组关联表 + * @param genTemplateGroup 模板分组关联表 + * @return R + */ + @Operation(summary = "修改模板分组关联表", description = "修改模板分组关联表") + @SysLog("修改模板分组关联表") + @PutMapping + @PreAuthorize("@pms.hasPermission('codegen_templateGroup_edit')") + public R updateById(@RequestBody GenTemplateGroupEntity genTemplateGroup) { + return R.ok(genTemplateGroupService.updateById(genTemplateGroup)); + } + + /** + * 通过id删除模板分组关联表 + * @param ids groupId列表 + * @return R + */ + @Operation(summary = "通过id删除模板分组关联表", description = "通过id删除模板分组关联表") + @SysLog("通过id删除模板分组关联表") + @DeleteMapping + @PreAuthorize("@pms.hasPermission('codegen_templateGroup_del')") + public R removeById(@RequestBody Long[] ids) { + return R.ok(genTemplateGroupService.removeBatchByIds(CollUtil.toList(ids))); + } + + /** + * 导出excel 表格 + * @param genTemplateGroup 查询条件 + * @return excel 文件流 + */ + @ResponseExcel + @GetMapping("/export") + @PreAuthorize("@pms.hasPermission('codegen_templateGroup_export')") + public List export(GenTemplateGroupEntity genTemplateGroup) { + return genTemplateGroupService.list(Wrappers.query(genTemplateGroup)); + } + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GeneratorController.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GeneratorController.java index 978e8d30..5d7fa0f1 100755 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GeneratorController.java +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/controller/GeneratorController.java @@ -1,37 +1,39 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) */ package com.pig4cloud.pig.codegen.controller; import cn.hutool.core.io.IoUtil; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.pig4cloud.pig.codegen.entity.GenConfig; +import cn.hutool.core.util.StrUtil; import com.pig4cloud.pig.codegen.service.GeneratorService; import com.pig4cloud.pig.common.core.util.R; -import io.swagger.v3.oas.annotations.security.SecurityRequirement; -import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import lombok.SneakyThrows; import org.springframework.http.HttpHeaders; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletResponse; +import java.io.ByteArrayOutputStream; import java.util.List; import java.util.Map; +import java.util.zip.ZipOutputStream; /** * 代码生成器 @@ -42,47 +44,61 @@ import java.util.Map; @RestController @RequiredArgsConstructor @RequestMapping("/generator") -@Tag(name = "代码生成模块") -@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) public class GeneratorController { private final GeneratorService generatorService; /** - * 列表 - * @param tableName 参数集 - * @param dsName 数据源编号 - * @return 数据库表 + * ZIP 下载生成代码 + * @param tableIds 数据表ID + * @param response 流输出对象 */ - @GetMapping("/page") - public R>>> getPage(Page page, String tableName, String dsName) { - return R.ok(generatorService.getPage(page, tableName, dsName)); + @SneakyThrows + @GetMapping("/download") + public void download(String tableIds, HttpServletResponse response) { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + ZipOutputStream zip = new ZipOutputStream(outputStream); + + // 生成代码 + for (String tableId : tableIds.split(StrUtil.COMMA)) { + generatorService.downloadCode(Long.parseLong(tableId), zip); + } + + IoUtil.close(zip); + + // zip压缩包数据 + byte[] data = outputStream.toByteArray(); + + response.reset(); + response.setHeader(HttpHeaders.CONTENT_DISPOSITION, String.format("attachment; filename=%s.zip", tableIds)); + response.addHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(data.length)); + response.setContentType("application/octet-stream; charset=UTF-8"); + IoUtil.write(response.getOutputStream(), false, data); + } + + /** + * 目标目录生成代码 + */ + @ResponseBody + @GetMapping("/code") + public R code(String tableIds) throws Exception { + // 生成代码 + for (String tableId : tableIds.split(StrUtil.COMMA)) { + generatorService.generatorCode(Long.valueOf(tableId)); + } + + return R.ok(); } /** * 预览代码 - * @param genConfig 数据表配置 + * @param tableId 表ID * @return */ - @GetMapping("/preview") - public R> previewCode(GenConfig genConfig) { - return R.ok(generatorService.previewCode(genConfig)); - } - - /** - * 生成代码 - */ @SneakyThrows - @PostMapping("/code") - public void generatorCode(@RequestBody GenConfig genConfig, HttpServletResponse response) { - byte[] data = generatorService.generatorCode(genConfig); - response.reset(); - response.setHeader(HttpHeaders.CONTENT_DISPOSITION, - String.format("attachment; filename=%s.zip", genConfig.getTableName())); - response.addHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(data.length)); - response.setContentType("application/octet-stream; charset=UTF-8"); - - IoUtil.write(response.getOutputStream(), Boolean.TRUE, data); + @GetMapping("/preview") + public List> preview(Long tableId) { + return generatorService.preview(tableId); } } diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/ColumnEntity.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/ColumnEntity.java index 1755b4fa..bcbc8919 100755 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/ColumnEntity.java +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/ColumnEntity.java @@ -1,17 +1,18 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) */ package com.pig4cloud.pig.codegen.entity; @@ -35,6 +36,11 @@ public class ColumnEntity { */ private String dataType; + /** + * JAVA 数据类型 + */ + private String javaType; + /** * 备注 */ diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenConfig.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenConfig.java index dbbc6173..7a6789fb 100644 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenConfig.java +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenConfig.java @@ -1,17 +1,18 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) */ package com.pig4cloud.pig.codegen.entity; @@ -61,7 +62,7 @@ public class GenConfig { private String comments; /** - * 代码风格 0 - avue 1 - element + * 代码风格 0 - avue 1 - element 2 - uview */ private String style; diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenDatasourceConf.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenDatasourceConf.java index caec1e5c..ca85bcc8 100755 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenDatasourceConf.java +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenDatasourceConf.java @@ -1,28 +1,28 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) */ package com.pig4cloud.pig.codegen.entity; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.baomidou.mybatisplus.annotation.TableName; -import com.pig4cloud.pig.common.mybatis.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; import lombok.Data; import lombok.EqualsAndHashCode; +import java.time.LocalDateTime; + /** * 数据源表 * @@ -32,7 +32,9 @@ import lombok.EqualsAndHashCode; @Data @TableName("gen_datasource_conf") @EqualsAndHashCode(callSuper = true) -public class GenDatasourceConf extends BaseEntity { +public class GenDatasourceConf extends Model { + + private static final long serialVersionUID = 1L; /** * 主键 @@ -46,10 +48,40 @@ public class GenDatasourceConf extends BaseEntity { private String name; /** - * jdbcurl + * 数据库类型 + */ + private String dsType; + + /** + * 配置类型 (0 主机形式 | 1 url形式) + */ + private Integer confType; + + /** + * 主机地址 + */ + private String host; + + /** + * 端口 + */ + private Integer port; + + /** + * jdbc-url */ private String url; + /** + * 实例 + */ + private String instance; + + /** + * 数据库名称 + */ + private String dsName; + /** * 用户名 */ @@ -61,9 +93,22 @@ public class GenDatasourceConf extends BaseEntity { private String password; /** - * 删除标记 + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.UPDATE) + private LocalDateTime updateTime; + + /** + * 0-正常,1-删除 */ @TableLogic + @TableField(fill = FieldFill.INSERT) private String delFlag; } diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenFieldType.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenFieldType.java new file mode 100644 index 00000000..8a5da8b4 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenFieldType.java @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.codegen.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; + +/** + * 列属性 + * + * @author pigx code generator + * @date 2023-02-06 20:16:01 + */ +@Data +@TableName("gen_field_type") +@EqualsAndHashCode(callSuper = true) +@Schema(description = "列属性") +public class GenFieldType extends Model { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(type = IdType.ASSIGN_ID) + @Schema(description = "id") + private Long id; + + /** + * 字段类型 + */ + @Schema(description = "字段类型") + private String columnType; + + /** + * 属性类型 + */ + @Schema(description = "属性类型") + private String attrType; + + /** + * 属性包名 + */ + @Schema(description = "属性包名") + private String packageName; + + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建人") + private String createBy; + + /** + * 修改人 + */ + @TableField(fill = FieldFill.UPDATE) + @Schema(description = "修改人") + private String updateBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @TableField(fill = FieldFill.UPDATE) + private LocalDateTime updateTime; + + /** + * 删除标识(0-正常,1-删除) + */ + @TableLogic + @TableField(fill = FieldFill.INSERT) + @Schema(description = "删除标记,1:已删除,0:正常") + private String delFlag; + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenFormConf.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenFormConf.java deleted file mode 100755 index 2f68a3b8..00000000 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenFormConf.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.pig4cloud.pig.codegen.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.pig4cloud.pig.common.mybatis.base.BaseEntity; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 生成记录 - * - * @author lengleng - * @date 2019-08-12 15:55:35 - */ -@Data -@TableName("gen_form_conf") -@Schema(description = "生成记录") -@EqualsAndHashCode(callSuper = true) -public class GenFormConf extends BaseEntity { - - /** - * ID - */ - @TableId(type = IdType.ASSIGN_ID) - @Schema(description = "ID") - private Long id; - - /** - * 表名称 - */ - @Schema(description = "表名称") - private String tableName; - - /** - * 表单信息 - */ - @Schema(description = "表单信息") - private String formInfo; - - /** - * 删除标记 - */ - @Schema(description = "删除标记") - private String delFlag; - -} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenGroupEntity.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenGroupEntity.java new file mode 100644 index 00000000..5418808b --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenGroupEntity.java @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.codegen.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; + +/** + * 模板分组 + * + * @author PIG + * @date 2023-02-21 20:01:53 + */ +@Data +@TableName("gen_group") +@EqualsAndHashCode(callSuper = true) +@Schema(description = "模板分组") +public class GenGroupEntity extends Model { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(type = IdType.ASSIGN_ID) + @Schema(description = "id") + private Long id; + + /** + * 分组名称 + */ + @Schema(description = "分组名称") + private String groupName; + + /** + * 分组描述 + */ + @Schema(description = "分组描述") + @TableField(fill = FieldFill.INSERT) + private String groupDesc; + + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建人") + private String createBy; + + /** + * 修改人 + */ + @TableField(fill = FieldFill.UPDATE) + @Schema(description = "修改人") + private String updateBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @TableField(fill = FieldFill.UPDATE) + private LocalDateTime updateTime; + + /** + * 删除标识(0-正常,1-删除) + */ + @TableLogic + @TableField(fill = FieldFill.INSERT) + @Schema(description = "删除标记,1:已删除,0:正常") + private String delFlag; + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenTable.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenTable.java new file mode 100644 index 00000000..0ef736ae --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenTable.java @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.codegen.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * 列属性 + * + * @author pigx code generator + * @date 2023-02-06 20:34:55 + */ +@Data +@TableName("gen_table") +@EqualsAndHashCode(callSuper = true) +@Schema(description = "列属性") +public class GenTable extends Model { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(type = IdType.ASSIGN_ID) + @Schema(description = "id") + private Long id; + + /** + * 数据源名称 + */ + @Schema(description = "数据源名称") + private String dsName; + + /** + * 数据源类型 + */ + @Schema(description = "数据源类型") + private String dbType; + + /** + * 表名 + */ + @Schema(description = "表名") + private String tableName; + + /** + * 类名 + */ + @Schema(description = "类名") + private String className; + + /** + * 说明 + */ + @Schema(description = "说明") + private String tableComment; + + /** + * 作者 + */ + @Schema(description = "作者") + private String author; + + /** + * 邮箱 + */ + @Schema(description = "邮箱") + private String email; + + /** + * 项目包名 + */ + @Schema(description = "项目包名") + private String packageName; + + /** + * 项目版本号 + */ + @Schema(description = "项目版本号") + private String version; + + /** + * 生成方式 0:zip压缩包 1:自定义目录 + */ + @Schema(description = "生成方式 0:zip压缩包 1:自定义目录") + private Integer generatorType; + + /** + * 后端生成路径 + */ + @Schema(description = "后端生成路径") + private String backendPath; + + /** + * 前端生成路径 + */ + @Schema(description = "前端生成路径") + private String frontendPath; + + /** + * 模块名 + */ + @Schema(description = "模块名") + private String moduleName; + + /** + * 功能名 + */ + @Schema(description = "功能名") + private String functionName; + + /** + * 表单布局 1:一列 2:两列 + */ + @Schema(description = "表单布局 1:一列 2:两列") + private Integer formLayout; + + /** + * 基类ID + */ + @Schema(description = "基类ID") + private Long baseclassId; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private LocalDateTime createTime; + + /** + * 代码生成风格 + */ + private Long style; + + /** + * 字段列表 + */ + @TableField(exist = false) + private List fieldList; + + /** + * 代码风格(模版分组信息) + */ + @TableField(exist = false) + private List groupList; + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenTableColumnEntity.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenTableColumnEntity.java new file mode 100755 index 00000000..a54612b7 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenTableColumnEntity.java @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.codegen.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author lengleng + * @date 2023-02-06 + * + * 记录表字段的配置信息 + */ +@Data +@TableName("gen_table_column") +@EqualsAndHashCode(callSuper = true) +public class GenTableColumnEntity extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + private Long id; + + /** + * 数据源名 + */ + private String dsName; + + /** + * 表名称 + */ + private String tableName; + + /** + * 字段名称 + */ + private String fieldName; + + /** + * 排序 + */ + private Integer sort; + + /** + * 字段类型 + */ + private String fieldType; + + /** + * 字段说明 + */ + private String fieldComment; + + /** + * 属性名 + */ + private String attrName; + + /** + * 属性类型 + */ + private String attrType; + + /** + * 属性包名 + */ + private String packageName; + + /** + * 自动填充 + */ + private String autoFill; + + /** + * 主键 0:否 1:是 + */ + private boolean primaryPk; + + /** + * 基类字段 0:否 1:是 + */ + private boolean baseField; + + /** + * 表单项 0:否 1:是 + */ + private boolean formItem; + + /** + * 表单必填 0:否 1:是 + */ + private boolean formRequired; + + /** + * 表单类型 + */ + private String formType; + + /** + * 表单效验 + */ + private String formValidator; + + /** + * 列表项 0:否 1:是 + */ + private boolean gridItem; + + /** + * 列表排序 0:否 1:是 + */ + private boolean gridSort; + + /** + * 查询项 0:否 1:是 + */ + private boolean queryItem; + + /** + * 查询方式 + */ + private String queryType; + + /** + * 查询表单类型 + */ + private String queryFormType; + + /** + * 字段字典类型 + */ + @TableField(updateStrategy = FieldStrategy.IGNORED) + private String fieldDict; + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenTemplateEntity.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenTemplateEntity.java new file mode 100644 index 00000000..10b0f185 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenTemplateEntity.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.codegen.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; + +/** + * 模板 + * + * @author PIG + * @date 2023-02-21 17:15:44 + */ +@Data +@TableName("gen_template") +@EqualsAndHashCode(callSuper = true) +@Schema(description = "模板") +public class GenTemplateEntity extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + @Schema(description = "主键") + private Long id; + + /** + * 模板名称 + */ + @Schema(description = "模板名称") + private String templateName; + + /** + * 模板路径 + */ + @Schema(description = "模板路径") + private String generatorPath; + + /** + * 模板描述 + */ + @Schema(description = "模板描述") + private String templateDesc; + + /** + * 模板代码 + */ + @Schema(description = "模板代码") + private String templateCode; + + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建人") + private String createBy; + + /** + * 修改人 + */ + @TableField(fill = FieldFill.UPDATE) + @Schema(description = "修改人") + private String updateBy; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @TableField(fill = FieldFill.UPDATE) + private LocalDateTime updateTime; + + /** + * 删除标识(0-正常,1-删除) + */ + @TableLogic + @TableField(fill = FieldFill.INSERT) + @Schema(description = "删除标记,1:已删除,0:正常") + private String delFlag; + +} diff --git a/pig-visual/pig-codegen/src/main/resources/template/Entity.java.vm b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenTemplateGroupEntity.java old mode 100755 new mode 100644 similarity index 53% rename from pig-visual/pig-codegen/src/main/resources/template/Entity.java.vm rename to pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenTemplateGroupEntity.java index 8431d722..ebe3e95e --- a/pig-visual/pig-codegen/src/main/resources/template/Entity.java.vm +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/GenTemplateGroupEntity.java @@ -14,45 +14,41 @@ * this software without specific prior written permission. * Author: lengleng (wangiegie@gmail.com) */ -#set($excludeColumns = ["create_time","update_time","create_by","update_by"]) -package ${package}.${moduleName}.entity; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; +package com.pig4cloud.pig.codegen.entity; + import com.baomidou.mybatisplus.annotation.TableName; -import com.pig4cloud.pig.common.mybatis.base.BaseEntity; +import com.baomidou.mybatisplus.extension.activerecord.Model; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; -#if(${hasBigDecimal}) -import java.math.BigDecimal; -#end +import lombok.experimental.Accessors; /** - * ${comments} + * 模板分组关联表 * - * @author ${author} - * @date ${datetime} + * @author PIG + * @date 2023-02-22 09:25:15 */ @Data -@TableName("${tableName}") +@TableName("gen_template_group") +@Accessors(chain = true) @EqualsAndHashCode(callSuper = true) -@Schema(description = "${comments}") -public class ${className} extends BaseEntity { +@Schema(description = "模板分组关联表") +public class GenTemplateGroupEntity extends Model { -#foreach ($column in $columns) -## 排除部分字段 -#if(!$excludeColumns.contains($column.columnName)) - /** - * $column.comments - */ -#if($column.columnName == $pk.columnName) - @TableId(type = IdType.ASSIGN_ID) -#end - @Schema(description ="$column.comments"#if($column.hidden),hidden=$column.hidden#end) - private $column.attrType $column.lowerAttrName; + private static final long serialVersionUID = 1L; -#end -#end + /** + * 分组id + */ + @Schema(description = "分组id") + private Long groupId; + + /** + * 模板id + */ + @Schema(description = "模板id") + private Long templateId; } diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/TableEntity.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/TableEntity.java index a682efae..b909698c 100755 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/TableEntity.java +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/entity/TableEntity.java @@ -1,17 +1,18 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) */ package com.pig4cloud.pig.codegen.entity; @@ -57,4 +58,9 @@ public class TableEntity { */ private String lowerClassName; + /** + * 数据库类型 (用于根据数据库个性化) + */ + private String dbType; + } diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenDatasourceConfMapper.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenDatasourceConfMapper.java index be10be26..6192b5ac 100755 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenDatasourceConfMapper.java +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenDatasourceConfMapper.java @@ -1,17 +1,18 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) */ package com.pig4cloud.pig.codegen.mapper; diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenDynamicMapper.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenDynamicMapper.java new file mode 100755 index 00000000..d20c04fc --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenDynamicMapper.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.codegen.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.LinkedHashMap; +import java.util.List; + +/** + * 动态查询 + * + * @author lengleng + * @date 2022-07-09 + */ +@Mapper +public interface GenDynamicMapper { + + @InterceptorIgnore(tenantLine = "true") + List> dynamicQuerySql(@Param("value") String sq); + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenFieldTypeMapper.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenFieldTypeMapper.java new file mode 100644 index 00000000..0d92ab79 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenFieldTypeMapper.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.codegen.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.pig4cloud.pig.codegen.entity.GenFieldType; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Set; + +/** + * 列属性 + * + * @author pigx code generator + * @date 2023-02-06 20:16:01 + */ +@Mapper +public interface GenFieldTypeMapper extends BaseMapper { + + /** + * 根据tableId,获取包列表 + * @param dsName 数据源名称 + * @param tableName 表名称 + * @return 返回包列表 + */ + Set getPackageByTableId(@Param("dsName") String dsName, @Param("tableName") String tableName); + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenFormConfMapper.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenFormConfMapper.java deleted file mode 100755 index 6a9da95b..00000000 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenFormConfMapper.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.pig4cloud.pig.codegen.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.pig4cloud.pig.codegen.entity.GenFormConf; -import org.apache.ibatis.annotations.Mapper; - -/** - * 生成记录 - * - * @author lengleng - * @date 2019-08-12 15:55:35 - */ -@Mapper -public interface GenFormConfMapper extends BaseMapper { - -} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenGroupMapper.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenGroupMapper.java new file mode 100644 index 00000000..146e2fa1 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenGroupMapper.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.codegen.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.pig4cloud.pig.codegen.entity.GenGroupEntity; +import com.pig4cloud.pig.codegen.util.vo.GroupVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 模板分组 + * + * @author PIG + * @date 2023-02-21 20:01:53 + */ +@Mapper +public interface GenGroupMapper extends BaseMapper { + + GroupVo getGroupVoById(@Param("id") Long id); + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenTableColumnMapper.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenTableColumnMapper.java new file mode 100644 index 00000000..3b2a66f7 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenTableColumnMapper.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.codegen.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.pig4cloud.pig.codegen.entity.GenTableColumnEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 列属性 + * + * @author pigx code generator + * @date 2023-02-06 20:16:01 + */ +@Mapper +public interface GenTableColumnMapper extends BaseMapper { + +} diff --git a/pig-visual/pig-codegen/src/main/resources/template/Mapper.java.vm b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenTableMapper.java old mode 100755 new mode 100644 similarity index 80% rename from pig-visual/pig-codegen/src/main/resources/template/Mapper.java.vm rename to pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenTableMapper.java index d5f3d393..27d2698b --- a/pig-visual/pig-codegen/src/main/resources/template/Mapper.java.vm +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenTableMapper.java @@ -15,19 +15,19 @@ * Author: lengleng (wangiegie@gmail.com) */ -package ${package}.${moduleName}.mapper; +package com.pig4cloud.pig.codegen.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import ${package}.${moduleName}.entity.${className}; +import com.pig4cloud.pig.codegen.entity.GenTable; import org.apache.ibatis.annotations.Mapper; /** - * ${comments} + * 列属性 * - * @author ${author} - * @date ${datetime} + * @author pigx code generator + * @date 2023-02-06 20:34:55 */ @Mapper -public interface ${className}Mapper extends BaseMapper<${className}> { +public interface GenTableMapper extends BaseMapper { } diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenTemplateGroupMapper.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenTemplateGroupMapper.java new file mode 100644 index 00000000..4be972a4 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenTemplateGroupMapper.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.codegen.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.pig4cloud.pig.codegen.entity.GenTemplateGroupEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 模板分组关联表 + * + * @author PIG + * @date 2023-02-22 09:25:15 + */ +@Mapper +public interface GenTemplateGroupMapper extends BaseMapper { + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenTemplateMapper.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenTemplateMapper.java new file mode 100644 index 00000000..be2dc684 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GenTemplateMapper.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.codegen.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.pig4cloud.pig.codegen.entity.GenTemplateEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 模板 + * + * @author PIG + * @date 2023-02-21 17:15:44 + */ +@Mapper +public interface GenTemplateMapper extends BaseMapper { + + /** + * 根据groupId查询 模板 + * @param groupId + * @return + */ + List listTemplateById(Long groupId); + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GeneratorMapper.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GeneratorMapper.java index da0c91eb..6952289a 100755 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GeneratorMapper.java +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GeneratorMapper.java @@ -1,25 +1,28 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) */ package com.pig4cloud.pig.codegen.mapper; import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.apache.ibatis.annotations.Mapper; +import com.pig4cloud.pig.codegen.entity.ColumnEntity; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -31,16 +34,23 @@ import java.util.Map; * @author lengleng * @date 2018-07-30 */ -@Mapper -public interface GeneratorMapper { +public interface GeneratorMapper extends BaseMapper { + + /** + * 查询全部的表 + * @return + */ + @InterceptorIgnore(tenantLine = "true") + List> queryTable(); /** * 分页查询表格 - * @param page - * @param tableName + * @param page 分页信息 + * @param tableName 表名称 * @return */ - IPage>> queryList(Page page, @Param("tableName") String tableName); + @InterceptorIgnore(tenantLine = "true") + IPage> queryTable(Page page, @Param("tableName") String tableName); /** * 查询表信息 @@ -49,15 +59,39 @@ public interface GeneratorMapper { * @return */ @DS("#last") + @InterceptorIgnore(tenantLine = "true") Map queryTable(@Param("tableName") String tableName, String dsName); /** - * 查询表列信息 + * 分页查询表分页信息 + * @param page + * @param tableName + * @param dsName + * @return + */ + @DS("#last") + @InterceptorIgnore(tenantLine = "true") + IPage selectTableColumn(Page page, @Param("tableName") String tableName, + @Param("dsName") String dsName); + + /** + * 查询表全部列信息 + * @param tableName + * @param dsName + * @return + */ + @DS("#last") + @InterceptorIgnore(tenantLine = "true") + List selectTableColumn(@Param("tableName") String tableName, @Param("dsName") String dsName); + + /** + * 查询表全部列信息 * @param tableName 表名称 * @param dsName 数据源名称 * @return */ @DS("#last") - List> queryColumns(@Param("tableName") String tableName, String dsName); + @InterceptorIgnore(tenantLine = "true") + List> selectMapTableColumn(@Param("tableName") String tableName, String dsName); } diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GeneratorMysqlMapper.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GeneratorMysqlMapper.java new file mode 100755 index 00000000..26a7cb63 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/mapper/GeneratorMysqlMapper.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.codegen.mapper; + +import org.apache.ibatis.annotations.Mapper; + +/** + * 支持 mysql 代码生成器 + * + * @author lengleng + * @date 2020-12-11 + */ +@Mapper +public interface GeneratorMysqlMapper extends GeneratorMapper { + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenCodeService.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenCodeService.java deleted file mode 100644 index 4e9f9cd5..00000000 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenCodeService.java +++ /dev/null @@ -1,329 +0,0 @@ -package com.pig4cloud.pig.codegen.service; - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.io.IoUtil; -import cn.hutool.core.util.CharsetUtil; -import cn.hutool.core.util.StrUtil; -import com.pig4cloud.pig.codegen.entity.ColumnEntity; -import com.pig4cloud.pig.codegen.entity.GenConfig; -import com.pig4cloud.pig.codegen.entity.GenFormConf; -import com.pig4cloud.pig.codegen.entity.TableEntity; -import com.pig4cloud.pig.common.core.constant.CommonConstants; -import com.pig4cloud.pig.common.core.exception.CheckedException; -import lombok.SneakyThrows; -import org.apache.commons.configuration.Configuration; -import org.apache.commons.configuration.ConfigurationException; -import org.apache.commons.configuration.PropertiesConfiguration; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.WordUtils; -import org.apache.velocity.Template; -import org.apache.velocity.VelocityContext; -import org.apache.velocity.app.Velocity; -import org.apache.velocity.tools.generic.DateTool; -import org.apache.velocity.tools.generic.MathTool; - -import java.io.File; -import java.io.StringWriter; -import java.nio.charset.StandardCharsets; -import java.util.*; -import java.util.zip.ZipEntry; -import java.util.zip.ZipException; -import java.util.zip.ZipOutputStream; - -/** - * 生成代码抽象 - * - * @author Fxz - * @date 2022/7/21 02:24 - */ -public interface GenCodeService { - - default Map gen(GenConfig genConfig, Map table, List> columns, - ZipOutputStream zip, GenFormConf formConf) { - // 构建表实体 - TableEntity tableEntity = buildTableEntity(genConfig, table); - - // 处理列相关 - buildColumnEntity(tableEntity, columns); - - // 模板入参 - Map tempModel = buildTempModel(tableEntity, genConfig); - - return renderData(genConfig, zip, tableEntity, tempModel, formConf); - } - - /** - * 渲染数据 - * @param genConfig 用户输入相关 - * @param zip 输出zip流 - * @param tableEntity 表格实体 - * @param map 参数集合 - * @param formConf 表单设计 - */ - @SneakyThrows - default Map renderData(GenConfig genConfig, ZipOutputStream zip, TableEntity tableEntity, - Map map, GenFormConf formConf) { - // 设置velocity资源加载器 - Properties prop = new Properties(); - prop.put("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); - Velocity.init(prop); - - VelocityContext context = new VelocityContext(map); - // 函数库 - context.put("math", new MathTool()); - context.put("dateTool", new DateTool()); - - // 获取模板列表 - List templates = getTemplates(genConfig); - Map resultMap = new LinkedHashMap<>(8); - - for (String template : templates) { - // 渲染模板 - StringWriter sw = new StringWriter(); - Template tpl = Velocity.getTemplate(template, CharsetUtil.UTF_8); - tpl.merge(context, sw); - - // 添加到zip - String fileName = getFileName(template, tableEntity.getCaseClassName(), map.get("package").toString(), - map.get("moduleName").toString()); - - if (zip != null) { - try { - zip.putNextEntry(new ZipEntry(Objects.requireNonNull(fileName))); - IoUtil.write(zip, StandardCharsets.UTF_8, false, sw.toString()); - IoUtil.close(sw); - } - catch (ZipException zipException) { - } - zip.closeEntry(); - } - resultMap.put(template, sw.toString()); - } - - return resultMap; - } - - /** - * 注入支持的模板列表 - * @param config 用户输入 - * @return ListString - */ - default List getTemplates(GenConfig config) { - List templates = new ArrayList<>(); - templates.add("template/Entity.java.vm"); - templates.add("template/Mapper.java.vm"); - templates.add("template/Mapper.xml.vm"); - templates.add("template/Service.java.vm"); - templates.add("template/ServiceImpl.java.vm"); - templates.add("template/Controller.java.vm"); - templates.add("template/menu.sql.vm"); - return templates; - } - - /** - * 获取文件名 - */ - default String getFileName(String template, String className, String packageName, String moduleName) { - String packagePath = CommonConstants.BACK_END_PROJECT + File.separator + "src" + File.separator + "main" - + File.separator + "java" + File.separator; - - if (StringUtils.isNotBlank(packageName)) { - packagePath += packageName.replace(".", File.separator) + File.separator + moduleName + File.separator; - } - - if (template.contains("Entity.java.vm")) { - return packagePath + "entity" + File.separator + className + ".java"; - } - - if (template.contains("Mapper.java.vm")) { - return packagePath + "mapper" + File.separator + className + "Mapper.java"; - } - - if (template.contains("Service.java.vm")) { - return packagePath + "service" + File.separator + className + "Service.java"; - } - - if (template.contains("ServiceImpl.java.vm")) { - return packagePath + "service" + File.separator + "impl" + File.separator + className + "ServiceImpl.java"; - } - - if (template.contains("Controller.java.vm")) { - return packagePath + "controller" + File.separator + className + "Controller.java"; - } - - if (template.contains("Mapper.xml.vm")) { - return CommonConstants.BACK_END_PROJECT + File.separator + "src" + File.separator + "main" + File.separator - + "resources" + File.separator + "mapper" + File.separator + className + "Mapper.xml"; - } - - if (template.contains("menu.sql.vm")) { - return className.toLowerCase() + "_menu.sql"; - } - - return null; - } - - default Map buildTempModel(TableEntity tableEntity, GenConfig genConfig) { - // 封装模板数据 - Map map = new HashMap<>(16); - map.put("tableName", tableEntity.getTableName()); - map.put("pk", tableEntity.getPk()); - map.put("className", tableEntity.getCaseClassName()); - map.put("classname", tableEntity.getLowerClassName()); - map.put("pathName", tableEntity.getLowerClassName().toLowerCase()); - map.put("columns", tableEntity.getColumns()); - map.put("datetime", DateUtil.now()); - - if (StrUtil.isNotBlank(genConfig.getComments())) { - map.put("comments", genConfig.getComments()); - } - else { - map.put("comments", tableEntity.getComments()); - } - - if (StrUtil.isNotBlank(genConfig.getAuthor())) { - map.put("author", genConfig.getAuthor()); - } - else { - map.put("author", getConfig().getString("author")); - } - - if (StrUtil.isNotBlank(genConfig.getModuleName())) { - map.put("moduleName", genConfig.getModuleName()); - } - else { - map.put("moduleName", getConfig().getString("moduleName")); - } - - if (StrUtil.isNotBlank(genConfig.getPackageName())) { - map.put("package", genConfig.getPackageName()); - map.put("mainPath", genConfig.getPackageName()); - } - else { - map.put("package", getConfig().getString("package")); - map.put("mainPath", getConfig().getString("mainPath")); - } - - return map; - } - - /** - * 构建 ColumnEntity - * @param columns 列元信息 - */ - default void buildColumnEntity(TableEntity tableEntity, List> columns) { - // 获取需要在swagger文档中隐藏的属性字段 - List hiddenColumns = getConfig().getList("hiddenColumn"); - // 列信息 - List columnList = new ArrayList<>(); - for (Map column : columns) { - ColumnEntity columnEntity = new ColumnEntity(); - columnEntity.setColumnName(column.get("columnName")); - columnEntity.setDataType(column.get("dataType")); - columnEntity.setExtra(column.get("extra")); - columnEntity.setNullable("NO".equals(column.get("isNullable"))); - columnEntity.setColumnType(column.get("columnType")); - // 隐藏不需要的在接口文档中展示的字段 - if (hiddenColumns.contains(column.get("columnName"))) { - columnEntity.setHidden(Boolean.TRUE); - } - else { - columnEntity.setHidden(Boolean.FALSE); - } - // 列名转换成Java属性名 - String attrName = columnToJava(columnEntity.getColumnName()); - columnEntity.setCaseAttrName(attrName); - columnEntity.setLowerAttrName(StringUtils.uncapitalize(attrName)); - - // 判断注释是否为空 - if (StrUtil.isNotBlank(column.get("columnComment"))) { - // 注意去除换行符号 - columnEntity.setComments(StrUtil.removeAllLineBreaks(column.get("columnComment"))); - } - else { - columnEntity.setComments(columnEntity.getLowerAttrName()); - } - - // 列的数据类型,转换成Java类型 - String dataType = StrUtil.subBefore(columnEntity.getDataType(), "(", false); - String attrType = getConfig().getString(dataType, "unknowType"); - columnEntity.setAttrType(attrType); - - // 是否主键 - if ("PRI".equalsIgnoreCase(column.get("columnKey")) && tableEntity.getPk() == null) { - tableEntity.setPk(columnEntity); - } - - columnList.add(columnEntity); - } - tableEntity.setColumns(columnList); - - // 没主键,则第一个字段为主键 - if (tableEntity.getPk() == null) { - tableEntity.setPk(tableEntity.getColumns().get(0)); - } - } - - /** - * 构建 TableEntity - * @param genConfig 用户输入相关 - * @param table 表元信息 - * @return TableEntity - */ - default TableEntity buildTableEntity(GenConfig genConfig, Map table) { - // 表信息 - TableEntity tableEntity = new TableEntity(); - tableEntity.setTableName(table.get("tableName")); - - if (StrUtil.isNotBlank(genConfig.getComments())) { - tableEntity.setComments(genConfig.getComments()); - } - else { - tableEntity.setComments(table.get("tableComment")); - } - - String tablePrefix; - if (StrUtil.isNotBlank(genConfig.getTablePrefix())) { - tablePrefix = genConfig.getTablePrefix(); - } - else { - tablePrefix = getConfig().getString("tablePrefix"); - } - // 表名转换成Java类名 - String className = tableToJava(tableEntity.getTableName(), tablePrefix); - tableEntity.setCaseClassName(className); - tableEntity.setLowerClassName(StringUtils.uncapitalize(className)); - - return tableEntity; - } - - /** - * 获取配置信息 - */ - default Configuration getConfig() { - try { - return new PropertiesConfiguration("generator.properties"); - } - catch (ConfigurationException e) { - throw new CheckedException("获取配置文件失败,", e); - } - } - - /** - * 表名转换成Java类名 - */ - default String tableToJava(String tableName, String tablePrefix) { - if (StringUtils.isNotBlank(tablePrefix)) { - tableName = tableName.replaceFirst(tablePrefix, ""); - } - return columnToJava(tableName); - } - - /** - * 列名转换成Java属性名 - */ - default String columnToJava(String columnName) { - return WordUtils.capitalizeFully(columnName, new char[] { '_' }).replace("_", ""); - } - -} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenDatasourceConfService.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenDatasourceConfService.java index 5965b5b0..01ec1ce4 100755 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenDatasourceConfService.java +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenDatasourceConfService.java @@ -1,17 +1,18 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) */ package com.pig4cloud.pig.codegen.service; @@ -56,9 +57,9 @@ public interface GenDatasourceConfService extends IService { /** * 通过数据源名称删除 - * @param dsId 数据源ID + * @param dsIds 数据源ID * @return */ - Boolean removeByDsId(Long dsId); + Boolean removeByDsId(Long[] dsIds); } diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenFieldTypeService.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenFieldTypeService.java new file mode 100644 index 00000000..9168cdde --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenFieldTypeService.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.codegen.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.pig4cloud.pig.codegen.entity.GenFieldType; + +import java.util.Set; + +/** + * 列属性 + * + * @author pigx code generator + * @date 2023-02-06 20:16:01 + */ +public interface GenFieldTypeService extends IService { + + /** + * 根据tableId,获取包列表 + * @param dsName 数据源名称 + * @param tableName 表名称 + * @return 返回包列表 + */ + Set getPackageByTableId(String dsName, String tableName); + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenFormConfService.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenFormConfService.java deleted file mode 100755 index 0b79b535..00000000 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenFormConfService.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.pig4cloud.pig.codegen.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.pig4cloud.pig.codegen.entity.GenFormConf; - -/** - * 表单管理 - * - * @author lengleng - * @date 2019-08-12 15:55:35 - */ -public interface GenFormConfService extends IService { - - /** - * 获取表单信息 - * @param dsName 数据源ID - * @param tableName 表名称 - * @return - */ - String getForm(String dsName, String tableName); - -} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenGroupService.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenGroupService.java new file mode 100644 index 00000000..555d1405 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenGroupService.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.codegen.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.pig4cloud.pig.codegen.entity.GenGroupEntity; +import com.pig4cloud.pig.codegen.util.vo.GroupVo; +import com.pig4cloud.pig.codegen.util.vo.TemplateGroupDTO; + +/** + * 模板分组 + * + * @author PIG + * @date 2023-02-21 20:01:53 + */ +public interface GenGroupService extends IService { + + void saveGenGroup(TemplateGroupDTO genTemplateGroup); + + /** + * 删除分组关系 + * @param ids + */ + void delGroupAndTemplate(Long[] ids); + + /** + * 查询group数据 + * @param id + */ + GroupVo getGroupVoById(Long id); + + /** + * 更新group数据 + * @param groupVo + */ + void updateGroupAndTemplateById(GroupVo groupVo); + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenTableColumnService.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenTableColumnService.java new file mode 100644 index 00000000..812ab1ba --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenTableColumnService.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.codegen.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.pig4cloud.pig.codegen.entity.GenTableColumnEntity; + +import java.util.List; + +/** + * 列属性 + * + * @author pigx code generator + * @date 2023-02-06 20:16:01 + */ +public interface GenTableColumnService extends IService { + + /** + * 初始化字段列表 + * @param tableFieldList 表字段列表 + */ + void initFieldList(List tableFieldList); + + /** + * 更新表字段 + * @param dsName 数据源名称 + * @param tableName 表名称 + * @param tableFieldList 表字段列表 + */ + void updateTableField(String dsName, String tableName, List tableFieldList); + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenTableService.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenTableService.java new file mode 100644 index 00000000..0b41754d --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenTableService.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.codegen.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.pig4cloud.pig.codegen.entity.GenTable; + +import java.util.List; +import java.util.Map; + +/** + * 列属性 + * + * @author pigx code generator + * @date 2023-02-06 20:34:55 + */ +public interface GenTableService extends IService { + + /** + * 获取默认配置信息 + * @return 默认配置信息 + */ + Map getGeneratorConfig(); + + /** + * 分页查询表格列表 + * @param page 分页对象 + * @param table 查询条件 + * @return 表格列表分页结果 + */ + IPage list(Page page, GenTable table); + + /** + * 根据数据源名称和表名查询或构建表格 + * @param dsName 数据源名称 + * @param tableName 表名 + * @return 查询到的表格信息 + */ + GenTable queryOrBuildTable(String dsName, String tableName); + + /** + * 查询指定数据源下的所有表格 + * @param dsName 数据源名称 + * @return 所有表格的列表 + */ + List> queryDsAllTable(String dsName); + + /** + * 查询指定数据源和表名的列信息 + * @param dsName 数据源名称 + * @param tableName 表名 + * @return 列信息列表 + */ + List> queryColumn(String dsName, String tableName); + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenTemplateGroupService.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenTemplateGroupService.java new file mode 100644 index 00000000..d5241de8 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenTemplateGroupService.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.codegen.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.pig4cloud.pig.codegen.entity.GenTemplateGroupEntity; + +/** + * 模板分组关联表 + * + * @author PIG + * @date 2023-02-22 09:25:15 + */ +public interface GenTemplateGroupService extends IService { + +} diff --git a/pig-visual/pig-codegen/src/main/resources/template/Service.java.vm b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenTemplateService.java old mode 100755 new mode 100644 similarity index 79% rename from pig-visual/pig-codegen/src/main/resources/template/Service.java.vm rename to pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenTemplateService.java index 5d808ef5..a465dc20 --- a/pig-visual/pig-codegen/src/main/resources/template/Service.java.vm +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GenTemplateService.java @@ -15,17 +15,17 @@ * Author: lengleng (wangiegie@gmail.com) */ -package ${package}.${moduleName}.service; +package com.pig4cloud.pig.codegen.service; import com.baomidou.mybatisplus.extension.service.IService; -import ${package}.${moduleName}.entity.${className}; +import com.pig4cloud.pig.codegen.entity.GenTemplateEntity; /** - * ${comments} + * 模板 * - * @author ${author} - * @date ${datetime} + * @author PIG + * @date 2023-02-21 17:15:44 */ -public interface ${className}Service extends IService<${className}> { +public interface GenTemplateService extends IService { } diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GeneratorService.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GeneratorService.java index 380db098..675dc0c9 100644 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GeneratorService.java +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/GeneratorService.java @@ -1,27 +1,25 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) */ package com.pig4cloud.pig.codegen.service; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.pig4cloud.pig.codegen.entity.GenConfig; - import java.util.List; import java.util.Map; +import java.util.zip.ZipOutputStream; /** * @author lengleng @@ -30,26 +28,23 @@ import java.util.Map; public interface GeneratorService { /** - * 生成代码 - * @param tableNames 表名称 - * @return + * 生成代码zip写出 + * @param tableId 表 + * @param zip 输出流 */ - byte[] generatorCode(GenConfig tableNames); - - /** - * 分页查询表 - * @param page 分页信息 - * @param tableName 表名 - * @param name 数据源ID - * @return - */ - IPage>> getPage(Page page, String tableName, String name); + void downloadCode(Long tableId, ZipOutputStream zip); /** * 预览代码 - * @param genConfig 查询条件 - * @return + * @param tableId 表 + * @return [{模板名称:渲染结果}] */ - Map previewCode(GenConfig genConfig); + List> preview(Long tableId); + + /** + * 目标目录写入渲染结果 + * @param tableId 表 + */ + void generatorCode(Long tableId); } diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenDatasourceConfServiceImpl.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenDatasourceConfServiceImpl.java index 8dc7da32..5b83efb2 100755 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenDatasourceConfServiceImpl.java +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenDatasourceConfServiceImpl.java @@ -1,35 +1,41 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) */ package com.pig4cloud.pig.codegen.service.impl; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.dynamic.datasource.DynamicRoutingDataSource; -import com.baomidou.dynamic.datasource.creator.DataSourceCreator; -import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty; +import com.baomidou.dynamic.datasource.creator.DataSourceProperty; +import com.baomidou.dynamic.datasource.creator.DefaultDataSourceCreator; +import com.baomidou.dynamic.datasource.creator.druid.DruidConfig; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.pig4cloud.pig.codegen.entity.GenDatasourceConf; import com.pig4cloud.pig.codegen.mapper.GenDatasourceConfMapper; import com.pig4cloud.pig.codegen.service.GenDatasourceConfService; import com.pig4cloud.pig.common.core.util.SpringContextHolder; +import com.pig4cloud.pig.common.datasource.enums.DsConfTypeEnum; +import com.pig4cloud.pig.common.datasource.enums.DsJdbcUrlEnum; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.jasypt.encryption.StringEncryptor; import org.springframework.stereotype.Service; import javax.sql.DataSource; +import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; @@ -47,7 +53,7 @@ public class GenDatasourceConfServiceImpl extends ServiceImpl dynamicRoutingDataSource.removeDataSource(ds.getName())); + this.baseMapper.deleteBatchIds(CollUtil.toList(dsIds)); return Boolean.TRUE; } @@ -119,10 +126,14 @@ public class GenDatasourceConfServiceImpl extends ServiceImpl + implements GenFieldTypeService { + + /** + * 根据tableId,获取包列表 + * @param dsName 数据源名称 + * @param tableName 表名称 + * @return 返回包列表 + */ + @Override + public Set getPackageByTableId(String dsName, String tableName) { + Set importList = baseMapper.getPackageByTableId(dsName, tableName); + return importList.stream().filter(StrUtil::isNotBlank).collect(Collectors.toSet()); + } + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenFormConfServiceImpl.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenFormConfServiceImpl.java deleted file mode 100755 index a7d150e5..00000000 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenFormConfServiceImpl.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.pig4cloud.pig.codegen.service.impl; - -import cn.hutool.core.util.CharsetUtil; -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.pig4cloud.pig.codegen.entity.ColumnEntity; -import com.pig4cloud.pig.codegen.entity.GenFormConf; -import com.pig4cloud.pig.codegen.mapper.GenFormConfMapper; -import com.pig4cloud.pig.codegen.mapper.GeneratorMapper; -import com.pig4cloud.pig.codegen.service.GenCodeService; -import com.pig4cloud.pig.codegen.service.GenFormConfService; -import lombok.RequiredArgsConstructor; -import lombok.SneakyThrows; -import org.apache.commons.lang.StringUtils; -import org.apache.velocity.Template; -import org.apache.velocity.VelocityContext; -import org.apache.velocity.app.Velocity; -import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader; -import org.springframework.stereotype.Service; - -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -/** - * 表单管理 - * - * @author lengleng - * @date 2019-08-12 15:55:35 - */ -@Service -@RequiredArgsConstructor -public class GenFormConfServiceImpl extends ServiceImpl implements GenFormConfService { - - private final GeneratorMapper generatorMapper; - - private final GenCodeService avue; - - /** - * 1. 根据数据源、表名称,查询已配置表单信息 2. 不存在调用模板生成 - * @param dsName 数据源ID - * @param tableName 表名称 - * @return - */ - @Override - @SneakyThrows - public String getForm(String dsName, String tableName) { - GenFormConf form = getOne(Wrappers.lambdaQuery() - .eq(GenFormConf::getTableName, tableName) - .orderByDesc(GenFormConf::getCreateTime), false); - - if (form != null) { - return form.getFormInfo(); - } - - List> columns = generatorMapper.queryColumns(tableName, dsName); - // 设置velocity资源加载器 - Properties prop = new Properties(); - prop.put("file.resource.loader.class", ClasspathResourceLoader.class.getName()); - Velocity.init(prop); - Template template = Velocity.getTemplate("template/avue/crud.js.vm", CharsetUtil.UTF_8); - VelocityContext context = new VelocityContext(); - - List columnList = new ArrayList<>(); - for (Map column : columns) { - ColumnEntity columnEntity = new ColumnEntity(); - columnEntity.setComments(column.get("columnComment")); - columnEntity.setLowerAttrName(StringUtils.uncapitalize(avue.columnToJava(column.get("columnName")))); - columnList.add(columnEntity); - } - context.put("columns", columnList); - StringWriter writer = new StringWriter(); - template.merge(context, writer); - return StrUtil.trim(StrUtil.removePrefix(writer.toString(), "export const tableOption =")); - } - -} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenGroupServiceImpl.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenGroupServiceImpl.java new file mode 100644 index 00000000..6e92bf76 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenGroupServiceImpl.java @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ +package com.pig4cloud.pig.codegen.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.pig4cloud.pig.codegen.entity.GenGroupEntity; +import com.pig4cloud.pig.codegen.entity.GenTemplateGroupEntity; +import com.pig4cloud.pig.codegen.mapper.GenGroupMapper; +import com.pig4cloud.pig.codegen.service.GenGroupService; +import com.pig4cloud.pig.codegen.service.GenTemplateGroupService; +import com.pig4cloud.pig.codegen.util.vo.GroupVo; +import com.pig4cloud.pig.codegen.util.vo.TemplateGroupDTO; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.util.LinkedList; +import java.util.List; + +/** + * 模板分组 + * + * @author PIG + * @date 2023-02-21 20:01:53 + */ +@Slf4j +@Service +@AllArgsConstructor +public class GenGroupServiceImpl extends ServiceImpl implements GenGroupService { + + private final GenTemplateGroupService genTemplateGroupService; + + /** + * 新增模板分组 + * @param genTemplateGroup + */ + @Override + public void saveGenGroup(TemplateGroupDTO genTemplateGroup) { + // 1.保存group + GenGroupEntity groupEntity = new GenGroupEntity(); + BeanUtil.copyProperties(genTemplateGroup, groupEntity); + baseMapper.insert(groupEntity); + // 2.保存关系 + List goals = new LinkedList<>(); + for (Long TemplateId : genTemplateGroup.getTemplateId()) { + GenTemplateGroupEntity templateGroup = new GenTemplateGroupEntity(); + templateGroup.setTemplateId(TemplateId).setGroupId(groupEntity.getId()); + goals.add(templateGroup); + } + genTemplateGroupService.saveBatch(goals); + + } + + /** + * 按照ids删除 + * @param ids groupIds + */ + @Override + public void delGroupAndTemplate(Long[] ids) { + // 删除分组 + this.removeBatchByIds(CollUtil.toList(ids)); + // 删除关系 + genTemplateGroupService + .remove(Wrappers.lambdaQuery().in(GenTemplateGroupEntity::getGroupId, ids)); + } + + /** + * 按照id查询 + * @param id + * @return + */ + @Override + public GroupVo getGroupVoById(Long id) { + return baseMapper.getGroupVoById(id); + } + + /** + * 根据id更新 + * @param groupVo + */ + @Override + public void updateGroupAndTemplateById(GroupVo groupVo) { + // 1.更新自身 + GenGroupEntity groupEntity = new GenGroupEntity(); + BeanUtil.copyProperties(groupVo, groupEntity); + this.updateById(groupEntity); + // 2.更新模板 + // 2.1根据id删除之前的模板 + genTemplateGroupService.remove( + Wrappers.lambdaQuery().eq(GenTemplateGroupEntity::getGroupId, groupVo.getId())); + // 2.2根据ids创建新的模板分组赋值 + List goals = new LinkedList<>(); + for (Long templateId : groupVo.getTemplateId()) { + goals.add(new GenTemplateGroupEntity().setGroupId(groupVo.getId()).setTemplateId(templateId)); + } + genTemplateGroupService.saveBatch(goals); + } + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenTableColumnServiceImpl.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenTableColumnServiceImpl.java new file mode 100644 index 00000000..57644d97 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenTableColumnServiceImpl.java @@ -0,0 +1,88 @@ +package com.pig4cloud.pig.codegen.service.impl; + +import cn.hutool.core.text.NamingCase; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.pig4cloud.pig.codegen.entity.GenFieldType; +import com.pig4cloud.pig.codegen.entity.GenTableColumnEntity; +import com.pig4cloud.pig.codegen.mapper.GenFieldTypeMapper; +import com.pig4cloud.pig.codegen.mapper.GenTableColumnMapper; +import com.pig4cloud.pig.codegen.service.GenTableColumnService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + +/** + * 表字段信息管理 + * + * @author lengleng + * @date 2020/5/18 + */ +@Service +@RequiredArgsConstructor +public class GenTableColumnServiceImpl extends ServiceImpl + implements GenTableColumnService { + + private final GenFieldTypeMapper fieldTypeMapper; + + /** + * 初始化表单字段列表,主要是将数据库表中的字段转化为表单需要的字段数据格式,并为审计字段排序 + * @param tableFieldList 表单字段列表 + */ + public void initFieldList(List tableFieldList) { + // 字段类型、属性类型映射 + List list = fieldTypeMapper.selectList(Wrappers.emptyWrapper()); + Map fieldTypeMap = new LinkedHashMap<>(list.size()); + list.forEach( + fieldTypeMapping -> fieldTypeMap.put(fieldTypeMapping.getColumnType().toLowerCase(), fieldTypeMapping)); + + // 索引计数器 + AtomicInteger index = new AtomicInteger(0); + tableFieldList.forEach(field -> { + // 将字段名转化为驼峰格式 + field.setAttrName(NamingCase.toCamelCase(field.getFieldName())); + + // 获取字段对应的类型 + GenFieldType fieldTypeMapping = fieldTypeMap.getOrDefault(field.getFieldType().toLowerCase(), null); + if (fieldTypeMapping == null) { + // 没找到对应的类型,则为Object类型 + field.setAttrType("Object"); + } + else { + field.setAttrType(fieldTypeMapping.getAttrType()); + field.setPackageName(fieldTypeMapping.getPackageName()); + } + + // 设置查询类型和表单查询类型都为“=” + field.setQueryType("="); + field.setQueryFormType("text"); + + // 设置表单类型为文本框类型 + field.setFormType("text"); + + // 保证审计字段最后显示 + field.setSort(Objects.isNull(field.getSort()) ? index.getAndIncrement() : field.getSort()); + }); + } + + /** + * 更新指定数据源和表名的表单字段信息 + * @param dsName 数据源名称 + * @param tableName 表名 + * @param tableFieldList 表单字段列表 + */ + @Override + public void updateTableField(String dsName, String tableName, List tableFieldList) { + AtomicInteger sort = new AtomicInteger(); + this.updateBatchById(tableFieldList.stream() + .peek(field -> field.setSort(sort.getAndIncrement())) + .collect(Collectors.toList())); + } + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenTableServiceImpl.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenTableServiceImpl.java new file mode 100644 index 00000000..59b72c5a --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenTableServiceImpl.java @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ +package com.pig4cloud.pig.codegen.service.impl; + +import cn.hutool.core.io.IoUtil; +import cn.hutool.core.io.resource.ClassPathResource; +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.text.NamingCase; +import cn.hutool.core.util.EnumUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.pig4cloud.pig.codegen.entity.GenGroupEntity; +import com.pig4cloud.pig.codegen.entity.GenTable; +import com.pig4cloud.pig.codegen.entity.GenTableColumnEntity; +import com.pig4cloud.pig.codegen.mapper.GenTableMapper; +import com.pig4cloud.pig.codegen.mapper.GeneratorMapper; +import com.pig4cloud.pig.codegen.service.GenGroupService; +import com.pig4cloud.pig.codegen.service.GenTableColumnService; +import com.pig4cloud.pig.codegen.service.GenTableService; +import com.pig4cloud.pig.codegen.util.CommonColumnFiledEnum; +import com.pig4cloud.pig.codegen.util.GenKit; +import com.pig4cloud.pig.codegen.util.GeneratorFileTypeEnum; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * 列属性 + * + * @author pigx code generator + * @date 2023-02-06 20:34:55 + */ +@Service +@RequiredArgsConstructor +public class GenTableServiceImpl extends ServiceImpl implements GenTableService { + + /** + * 默认配置信息 + */ + private static final String CONFIG_PATH = "template/config.json"; + + private final GenTableColumnService columnService; + + private final GenGroupService genGroupService; + + /** + * 获取配置信息 + * @return + */ + @Override + public Map getGeneratorConfig() { + ClassPathResource classPathResource = new ClassPathResource(CONFIG_PATH); + JSONObject jsonObject = JSONUtil.parseObj(IoUtil.readUtf8(classPathResource.getStream())); + return jsonObject.getRaw(); + } + + @Override + public List> queryDsAllTable(String dsName) { + GeneratorMapper mapper = GenKit.getMapper(dsName); + // 手动切换数据源 + DynamicDataSourceContextHolder.push(dsName); + return mapper.queryTable(); + } + + @Override + public List> queryColumn(String dsName, String tableName) { + GeneratorMapper mapper = GenKit.getMapper(dsName); + return mapper.selectMapTableColumn(tableName, dsName); + } + + @Override + public IPage list(Page page, GenTable table) { + GeneratorMapper mapper = GenKit.getMapper(table.getDsName()); + // 手动切换数据源 + DynamicDataSourceContextHolder.push(table.getDsName()); + return mapper.queryTable(page, table.getTableName()); + } + + /** + * 获取表信息 + * @param dsName + * @param tableName + * @return + */ + @Override + public GenTable queryOrBuildTable(String dsName, String tableName) { + GenTable genTable = baseMapper.selectOne( + Wrappers.lambdaQuery().eq(GenTable::getTableName, tableName).eq(GenTable::getDsName, dsName)); + // 如果 genTable 为空, 执行导入 + if (Objects.isNull(genTable)) { + genTable = this.tableImport(dsName, tableName); + } + + List fieldList = columnService.list(Wrappers.lambdaQuery() + .eq(GenTableColumnEntity::getDsName, dsName) + .eq(GenTableColumnEntity::getTableName, tableName) + .orderByAsc(GenTableColumnEntity::getSort)); + genTable.setFieldList(fieldList); + + // 查询模板分组信息 + List groupEntities = genGroupService.list(); + genTable.setGroupList(groupEntities); + return genTable; + } + + @Transactional(rollbackFor = Exception.class) + public GenTable tableImport(String dsName, String tableName) { + GeneratorMapper mapper = GenKit.getMapper(dsName); + // 手动切换数据源 + DynamicDataSourceContextHolder.push(dsName); + + // 查询表是否存在 + GenTable table = new GenTable(); + + // 从数据库获取表信息 + Map queryTable = mapper.queryTable(tableName, dsName); + + // 获取默认表配置信息 () + Map generatorConfig = getGeneratorConfig(); + JSONObject project = (JSONObject) generatorConfig.get("project"); + JSONObject developer = (JSONObject) generatorConfig.get("developer"); + + table.setPackageName(project.getStr("packageName")); + table.setVersion(project.getStr("version")); + table.setBackendPath(project.getStr("backendPath")); + table.setFrontendPath(project.getStr("frontendPath")); + table.setAuthor(developer.getStr("author")); + table.setEmail(developer.getStr("email")); + table.setTableName(tableName); + table.setDsName(dsName); + table.setTableComment(MapUtil.getStr(queryTable, "tableComment")); + table.setDbType(MapUtil.getStr(queryTable, "dbType")); + table.setFormLayout(2); + table.setGeneratorType(GeneratorFileTypeEnum.ZIP.ordinal()); + table.setClassName(NamingCase.toPascalCase(tableName)); + table.setModuleName(GenKit.getModuleName(table.getPackageName())); + table.setFunctionName(GenKit.getFunctionName(tableName)); + table.setCreateTime(LocalDateTime.now()); + this.save(table); + + // 获取原生字段数据 + List> queryColumnList = mapper.selectMapTableColumn(tableName, dsName); + List tableFieldList = new ArrayList<>(); + + for (Map columnMap : queryColumnList) { + String columnName = MapUtil.getStr(columnMap, "columnName"); + GenTableColumnEntity genTableColumnEntity = new GenTableColumnEntity(); + genTableColumnEntity.setTableName(tableName); + genTableColumnEntity.setDsName(dsName); + genTableColumnEntity.setFieldName(MapUtil.getStr(columnMap, "columnName")); + genTableColumnEntity.setFieldComment(MapUtil.getStr(columnMap, "comments")); + genTableColumnEntity.setFieldType(MapUtil.getStr(columnMap, "dataType")); + String columnKey = MapUtil.getStr(columnMap, "columnKey"); + genTableColumnEntity.setPrimaryPk(StringUtils.isNotBlank(columnKey) && "PRI".equalsIgnoreCase(columnKey)); + genTableColumnEntity.setAutoFill("DEFAULT"); + genTableColumnEntity.setFormItem(true); + genTableColumnEntity.setGridItem(true); + + // 审计字段处理 + if (EnumUtil.contains(CommonColumnFiledEnum.class, columnName)) { + CommonColumnFiledEnum commonColumnFiledEnum = CommonColumnFiledEnum.valueOf(columnName); + genTableColumnEntity.setFormItem(commonColumnFiledEnum.getFormItem()); + genTableColumnEntity.setGridItem(commonColumnFiledEnum.getGridItem()); + genTableColumnEntity.setAutoFill(commonColumnFiledEnum.getAutoFill()); + genTableColumnEntity.setSort(commonColumnFiledEnum.getSort()); + } + tableFieldList.add(genTableColumnEntity); + } + // 初始化字段数据 + columnService.initFieldList(tableFieldList); + // 保存列数据 + columnService.saveOrUpdateBatch(tableFieldList); + table.setFieldList(tableFieldList); + return table; + } + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenTemplateGroupServiceImpl.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenTemplateGroupServiceImpl.java new file mode 100644 index 00000000..e360d0d2 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenTemplateGroupServiceImpl.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ +package com.pig4cloud.pig.codegen.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.pig4cloud.pig.codegen.entity.GenTemplateGroupEntity; +import com.pig4cloud.pig.codegen.mapper.GenTemplateGroupMapper; +import com.pig4cloud.pig.codegen.service.GenTemplateGroupService; +import org.springframework.stereotype.Service; + +/** + * 模板分组关联表 + * + * @author PIG + * @date 2023-02-22 09:25:15 + */ +@Service +public class GenTemplateGroupServiceImpl extends ServiceImpl + implements GenTemplateGroupService { + +} diff --git a/pig-visual/pig-codegen/src/main/resources/template/ServiceImpl.java.vm b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenTemplateServiceImpl.java old mode 100755 new mode 100644 similarity index 69% rename from pig-visual/pig-codegen/src/main/resources/template/ServiceImpl.java.vm rename to pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenTemplateServiceImpl.java index bce38eee..45d4f4d6 --- a/pig-visual/pig-codegen/src/main/resources/template/ServiceImpl.java.vm +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GenTemplateServiceImpl.java @@ -14,21 +14,22 @@ * this software without specific prior written permission. * Author: lengleng (wangiegie@gmail.com) */ -package ${package}.${moduleName}.service.impl; +package com.pig4cloud.pig.codegen.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import ${package}.${moduleName}.entity.${className}; -import ${package}.${moduleName}.mapper.${className}Mapper; -import ${package}.${moduleName}.service.${className}Service; +import com.pig4cloud.pig.codegen.entity.GenTemplateEntity; +import com.pig4cloud.pig.codegen.mapper.GenTemplateMapper; +import com.pig4cloud.pig.codegen.service.GenTemplateService; import org.springframework.stereotype.Service; /** - * ${comments} + * 模板 * - * @author ${author} - * @date ${datetime} + * @author PIG + * @date 2023-02-21 11:08:43 */ @Service -public class ${className}ServiceImpl extends ServiceImpl<${className}Mapper, ${className}> implements ${className}Service { +public class GenTemplateServiceImpl extends ServiceImpl + implements GenTemplateService { } diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GeneratorServiceImpl.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GeneratorServiceImpl.java index 9d65392a..7876c094 100755 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GeneratorServiceImpl.java +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/GeneratorServiceImpl.java @@ -1,42 +1,46 @@ /* - * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) */ package com.pig4cloud.pig.codegen.service.impl; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.IoUtil; -import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.StrUtil; -import com.baomidou.dynamic.datasource.annotation.DS; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.pig4cloud.pig.codegen.entity.GenConfig; -import com.pig4cloud.pig.codegen.entity.GenFormConf; -import com.pig4cloud.pig.codegen.mapper.GenFormConfMapper; -import com.pig4cloud.pig.codegen.mapper.GeneratorMapper; -import com.pig4cloud.pig.codegen.service.GenCodeService; -import com.pig4cloud.pig.codegen.service.GeneratorService; -import com.pig4cloud.pig.codegen.support.StyleTypeEnum; +import cn.hutool.json.JSONObject; +import com.pig4cloud.pig.codegen.entity.GenTable; +import com.pig4cloud.pig.codegen.entity.GenTableColumnEntity; +import com.pig4cloud.pig.codegen.entity.GenTemplateEntity; +import com.pig4cloud.pig.codegen.service.*; +import com.pig4cloud.pig.codegen.util.VelocityKit; +import com.pig4cloud.pig.codegen.util.vo.GroupVo; import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; -import java.io.ByteArrayOutputStream; +import java.io.File; +import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; /** @@ -45,99 +49,206 @@ import java.util.zip.ZipOutputStream; *

* 代码生成器 */ +@Slf4j @Service @RequiredArgsConstructor public class GeneratorServiceImpl implements GeneratorService { - private final GeneratorMapper generatorMapper; + private final GenTableColumnService columnService; - private final GenFormConfMapper genFormConfMapper; + private final GenFieldTypeService fieldTypeService; - private final Map genCodeServiceMap; + private final GenTableService tableService; + + private final GenGroupService genGroupService; + + private final GenTemplateService genTemplateService; /** - * 分页查询表 - * @param tableName 查询条件 - * @param dsName - * @return + * 生成代码zip写出 + * @param tableId 表 + * @param zip 输出流 */ @Override - @DS("#last") - public IPage>> getPage(Page page, String tableName, String dsName) { - page.setOptimizeCountSql(false); - return generatorMapper.queryList(page, tableName); + @SneakyThrows + public void downloadCode(Long tableId, ZipOutputStream zip) { + // 数据模型 + Map dataModel = getDataModel(tableId); + + Long style = (Long) dataModel.get("style"); + + GroupVo groupVo = genGroupService.getGroupVoById(style); + List templateList = groupVo.getTemplateList(); + + Map generatorConfig = tableService.getGeneratorConfig(); + JSONObject project = (JSONObject) generatorConfig.get("project"); + String frontendPath = project.getStr("frontendPath"); + String backendPath = project.getStr("backendPath"); + + for (GenTemplateEntity template : templateList) { + String templateCode = template.getTemplateCode(); + String generatorPath = template.getGeneratorPath(); + + dataModel.put("frontendPath", frontendPath); + dataModel.put("backendPath", backendPath); + String content = VelocityKit.renderStr(templateCode, dataModel); + String path = VelocityKit.renderStr(generatorPath, dataModel); + + // 添加到zip + zip.putNextEntry(new ZipEntry(path)); + IoUtil.writeUtf8(zip, false, content); + zip.flush(); + zip.closeEntry(); + } + } /** - * 预览代码 - * @param genConfig 查询条件 - * @return + * 表达式优化的预览代码方法 + * @param tableId 表 + * @return [{模板名称:渲染结果}] */ @Override - public Map previewCode(GenConfig genConfig) { - // 根据tableName 查询最新的表单配置 - List formConfList = genFormConfMapper.selectList(Wrappers.lambdaQuery() - .eq(GenFormConf::getTableName, genConfig.getTableName()) - .orderByDesc(GenFormConf::getCreateTime)); + @SneakyThrows + public List> preview(Long tableId) { + // 数据模型 + Map dataModel = getDataModel(tableId); - String tableNames = genConfig.getTableName(); - String dsName = genConfig.getDsName(); + Long style = (Long) dataModel.get("style"); - // 获取实现 - GenCodeService genCodeService = genCodeServiceMap.get(StyleTypeEnum.getDecs(genConfig.getStyle())); + // 获取模板列表,Lambda 表达式简化代码 + List templateList = genGroupService.getGroupVoById(style).getTemplateList(); - for (String tableName : StrUtil.split(tableNames, StrUtil.DASHED)) { - // 查询表信息 - Map table = generatorMapper.queryTable(tableName, dsName); - // 查询列信息 - List> columns = generatorMapper.queryColumns(tableName, dsName); - // 生成代码 - if (CollUtil.isNotEmpty(formConfList)) { - return genCodeService.gen(genConfig, table, columns, null, formConfList.get(0)); - } - else { - return genCodeService.gen(genConfig, table, columns, null, null); - } - } + Map generatorConfig = tableService.getGeneratorConfig(); + JSONObject project = (JSONObject) generatorConfig.get("project"); + String frontendPath = project.getStr("frontendPath"); + String backendPath = project.getStr("backendPath"); - return MapUtil.empty(); + return templateList.stream().map(template -> { + String templateCode = template.getTemplateCode(); + String generatorPath = template.getGeneratorPath(); + + // 预览模式下, 使用相对路径展示 + dataModel.put("frontendPath", frontendPath); + dataModel.put("backendPath", backendPath); + String content = VelocityKit.renderStr(templateCode, dataModel); + String path = VelocityKit.renderStr(generatorPath, dataModel); + + // 使用 map 简化代码 + return new HashMap(4) { + { + put("code", content); + put("codePath", path); + } + }; + }).collect(Collectors.toList()); } /** - * 生成代码 - * @param genConfig 生成配置 - * @return + * 目标目录写入渲染结果方法 + * @param tableId 表 */ @Override - public byte[] generatorCode(GenConfig genConfig) { - // 根据tableName 查询最新的表单配置 - List formConfList = genFormConfMapper.selectList(Wrappers.lambdaQuery() - .eq(GenFormConf::getTableName, genConfig.getTableName()) - .orderByDesc(GenFormConf::getCreateTime)); + public void generatorCode(Long tableId) { + // 数据模型 + Map dataModel = getDataModel(tableId); + Long style = (Long) dataModel.get("style"); - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - ZipOutputStream zip = new ZipOutputStream(outputStream); + // 获取模板列表,Lambda 表达式简化代码 + List templateList = genGroupService.getGroupVoById(style).getTemplateList(); - String tableNames = genConfig.getTableName(); - String dsName = genConfig.getDsName(); + templateList.forEach(template -> { + String templateCode = template.getTemplateCode(); + String generatorPath = template.getGeneratorPath(); + String content = VelocityKit.renderStr(templateCode, dataModel); + String path = VelocityKit.renderStr(generatorPath, dataModel); + FileUtil.writeUtf8String(content, path); + }); + } - GenCodeService genCodeService = genCodeServiceMap.get(StyleTypeEnum.getDecs(genConfig.getStyle())); + /** + * 通过 Lambda 表达式优化的获取数据模型方法 + * @param tableId 表格 ID + * @return 数据模型 Map 对象 + */ + private Map getDataModel(Long tableId) { + // 获取表格信息 + GenTable table = tableService.getById(tableId); + // 获取字段列表 + List fieldList = columnService.lambdaQuery() + .eq(GenTableColumnEntity::getDsName, table.getDsName()) + .eq(GenTableColumnEntity::getTableName, table.getTableName()) + .orderByAsc(GenTableColumnEntity::getSort) + .list(); - for (String tableName : StrUtil.split(tableNames, StrUtil.DASHED)) { - // 查询表信息 - Map table = generatorMapper.queryTable(tableName, dsName); - // 查询列信息 - List> columns = generatorMapper.queryColumns(tableName, dsName); - // 生成代码 - if (CollUtil.isNotEmpty(formConfList)) { - genCodeService.gen(genConfig, table, columns, zip, formConfList.get(0)); - } - else { - genCodeService.gen(genConfig, table, columns, zip, null); - } + table.setFieldList(fieldList); + + // 创建数据模型对象 + Map dataModel = new HashMap<>(); + + // 填充数据模型 + dataModel.put("dbType", table.getDbType()); + dataModel.put("package", table.getPackageName()); + dataModel.put("packagePath", table.getPackageName().replace(".", File.separator)); + dataModel.put("version", table.getVersion()); + dataModel.put("moduleName", table.getModuleName()); + dataModel.put("ModuleName", StrUtil.upperFirst(table.getModuleName())); + dataModel.put("functionName", table.getFunctionName()); + dataModel.put("FunctionName", StrUtil.upperFirst(table.getFunctionName())); + dataModel.put("formLayout", table.getFormLayout()); + dataModel.put("style", table.getStyle()); + dataModel.put("author", table.getAuthor()); + dataModel.put("datetime", DateUtil.now()); + dataModel.put("date", DateUtil.today()); + setFieldTypeList(dataModel, table); + + // 获取导入的包列表 + Set importList = fieldTypeService.getPackageByTableId(table.getDsName(), table.getTableName()); + dataModel.put("importList", importList); + dataModel.put("tableName", table.getTableName()); + dataModel.put("tableComment", table.getTableComment()); + dataModel.put("className", StrUtil.lowerFirst(table.getClassName())); + dataModel.put("ClassName", table.getClassName()); + dataModel.put("fieldList", table.getFieldList()); + + dataModel.put("backendPath", table.getBackendPath()); + dataModel.put("frontendPath", table.getFrontendPath()); + return dataModel; + } + + /** + * 将表字段按照类型分组并存储到数据模型中 + * @param dataModel 存储数据的 Map 对象 + * @param table 表信息对象 + */ + private void setFieldTypeList(Map dataModel, GenTable table) { + // 按字段类型分组,使用 Map 存储不同类型的字段列表 + Map> typeMap = table.getFieldList() + .stream() + .collect(Collectors.partitioningBy(GenTableColumnEntity::isPrimaryPk)); + + // 从分组后的 Map 中获取不同类型的字段列表 + List primaryList = typeMap.get(true); + List formList = typeMap.get(false) + .stream() + .filter(GenTableColumnEntity::isFormItem) + .collect(Collectors.toList()); + List gridList = typeMap.get(false) + .stream() + .filter(GenTableColumnEntity::isGridItem) + .collect(Collectors.toList()); + List queryList = typeMap.get(false) + .stream() + .filter(GenTableColumnEntity::isQueryItem) + .collect(Collectors.toList()); + + if (CollUtil.isNotEmpty(primaryList)) { + dataModel.put("pk", primaryList.get(0)); } - IoUtil.close(zip); - return outputStream.toByteArray(); + dataModel.put("primaryList", primaryList); + dataModel.put("formList", formList); + dataModel.put("gridList", gridList); + dataModel.put("queryList", queryList); } } diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/temp/AvueGenCodeServiceImpl.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/temp/AvueGenCodeServiceImpl.java deleted file mode 100644 index d7865f71..00000000 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/temp/AvueGenCodeServiceImpl.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.pig4cloud.pig.codegen.service.impl.temp; - -import cn.hutool.core.io.IoUtil; -import com.pig4cloud.pig.codegen.entity.GenConfig; -import com.pig4cloud.pig.codegen.entity.GenFormConf; -import com.pig4cloud.pig.codegen.entity.TableEntity; -import com.pig4cloud.pig.codegen.service.GenCodeService; -import com.pig4cloud.pig.common.core.constant.CommonConstants; -import lombok.SneakyThrows; -import org.springframework.stereotype.Service; - -import java.io.File; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -/** - * @author Fxz - * @date 2022/7/21 02:45 - */ -@Service("avue") -public class AvueGenCodeServiceImpl implements GenCodeService { - - public final String CRUD_PREFIX = "export const tableOption ="; - - /** - * 注入支持的模板列表 - * @param config 用户输入 - * @return ListString - */ - @Override - public List getTemplates(GenConfig config) { - List templates = GenCodeService.super.getTemplates(config); - templates.add("template/avue/index.vue.vm"); - templates.add("template/avue/crud.js.vm"); - templates.add("template/avue/api.js.vm"); - return templates; - } - - /** - * 获取文件名 - * @param template - * @param className - * @param packageName - * @param moduleName - */ - @Override - public String getFileName(String template, String className, String packageName, String moduleName) { - if (template.contains("avue/index.vue.vm")) { - return CommonConstants.FRONT_END_PROJECT + File.separator + "src" + File.separator + "views" - + File.separator + moduleName + File.separator + className.toLowerCase() + File.separator - + "index.vue"; - } - - if (template.contains("avue/api.js.vm")) { - return CommonConstants.FRONT_END_PROJECT + File.separator + "src" + File.separator + "api" + File.separator - + className.toLowerCase() + ".js"; - } - - if (template.contains("avue/crud.js.vm")) { - return CommonConstants.FRONT_END_PROJECT + File.separator + "src" + File.separator + "const" - + File.separator + "crud" + File.separator + className.toLowerCase() + ".js"; - } - - return GenCodeService.super.getFileName(template, className, packageName, moduleName); - } - - /** - * 渲染数据 - * @param genConfig 用户输入相关 - * @param zip 输出zip流 - * @param tableEntity 表格实体 - * @param map 参数集合 - * @param formConf 表单设计 - * @return - */ - @SneakyThrows - public Map renderData(GenConfig genConfig, ZipOutputStream zip, TableEntity tableEntity, - Map map, GenFormConf formConf) { - - Map resultMap = new HashMap<>(); - - if (Objects.nonNull(formConf)) { - // 存在 curd 存在设计好的JSON 则使用Json 覆盖 - String crudTempName = "template/avue/crud.js.vm"; - String fileName = getFileName(crudTempName, tableEntity.getCaseClassName(), map.get("package").toString(), - map.get("moduleName").toString()); - String contents = CRUD_PREFIX + formConf.getFormInfo(); - - if (zip != null) { - zip.putNextEntry(new ZipEntry(Objects.requireNonNull(fileName))); - IoUtil.write(zip, StandardCharsets.UTF_8, false, contents); - zip.closeEntry(); - } - resultMap.putAll(GenCodeService.super.renderData(genConfig, zip, tableEntity, map, formConf)); - resultMap.put(crudTempName, contents); - return resultMap; - } - return GenCodeService.super.renderData(genConfig, zip, tableEntity, map, formConf); - } - -} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/temp/EleGenCodeServiceImpl.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/temp/EleGenCodeServiceImpl.java deleted file mode 100644 index 680f0406..00000000 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/service/impl/temp/EleGenCodeServiceImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.pig4cloud.pig.codegen.service.impl.temp; - -import com.pig4cloud.pig.codegen.entity.GenConfig; -import com.pig4cloud.pig.codegen.service.GenCodeService; -import com.pig4cloud.pig.common.core.constant.CommonConstants; -import org.springframework.stereotype.Service; - -import java.io.File; -import java.util.List; - -/** - * @author Fxz - * @date 2022/7/21 02:46 - */ -@Service("element") -public class EleGenCodeServiceImpl implements GenCodeService { - - /** - * 注入支持的模板列表 - * @param config 用户输入 - * @return ListString - */ - @Override - public List getTemplates(GenConfig config) { - List templates = GenCodeService.super.getTemplates(config); - templates.add("template/element/index.vue.vm"); - templates.add("template/element/form.vue.vm"); - templates.add("template/avue/api.js.vm"); - return templates; - } - - /** - * 获取文件名 - * @param template - * @param className - * @param packageName - * @param moduleName - */ - @Override - public String getFileName(String template, String className, String packageName, String moduleName) { - if (template.contains("element/index.vue.vm")) { - return CommonConstants.FRONT_END_PROJECT + File.separator + "src" + File.separator + "views" - + File.separator + moduleName + File.separator + className.toLowerCase() + File.separator - + "index.vue"; - } - - if (template.contains("element/form.vue.vm")) { - return CommonConstants.FRONT_END_PROJECT + File.separator + "src" + File.separator + "views" - + File.separator + moduleName + File.separator + className.toLowerCase() + File.separator - + className.toLowerCase() + "-form.vue"; - } - - if (template.contains("avue/api.js.vm")) { - return CommonConstants.FRONT_END_PROJECT + File.separator + "src" + File.separator + "api" + File.separator - + className.toLowerCase() + ".js"; - } - - return GenCodeService.super.getFileName(template, className, packageName, moduleName); - } - -} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/support/StyleTypeEnum.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/support/StyleTypeEnum.java deleted file mode 100644 index 3de92f7c..00000000 --- a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/support/StyleTypeEnum.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.pig4cloud.pig.codegen.support; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -import java.util.Arrays; - -/** - * @author lengleng - * @date 2021/7/31 - *

- * 代码生成风格 - */ -@Getter -@AllArgsConstructor -public enum StyleTypeEnum { - - /** - * 前端类型-avue 风格 - */ - AVUE("0", "avue"), - - /** - * 前端类型-element 风格 - */ - ELEMENT("1", "element"); - - /** - * 类型 - */ - private String style; - - /** - * 描述 - */ - private String description; - - public static String getDecs(String style) { - return Arrays.stream(StyleTypeEnum.values()) - .filter(styleTypeEnum -> styleTypeEnum.getStyle().equals(style)) - .findFirst() - .orElse(ELEMENT) - .getDescription(); - } - -} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/CommonColumnFiledEnum.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/CommonColumnFiledEnum.java new file mode 100644 index 00000000..47cdd843 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/CommonColumnFiledEnum.java @@ -0,0 +1,62 @@ +package com.pig4cloud.pig.codegen.util; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author lengleng + * @date 2023/3/12 + *

+ * 通用字段的填充策略和显示策略 + */ +@Getter +@AllArgsConstructor +public enum CommonColumnFiledEnum { + + /** + * create_by 字段 + */ + create_by(false, false, "INSERT", 100), + + /** + * create_time 字段 + */ + create_time(false, false, "INSERT", 101), + /** + * update_by 字段 + */ + update_by(false, false, "INSERT_UPDATE", 102), + /** + * update_time 字段 + */ + update_time(false, false, "INSERT_UPDATE", 103), + /** + * del_flag 字段 + */ + del_flag(false, false, "DEFAULT", 104), + /** + * tenant_id 字段 + */ + tenant_id(false, false, "DEFAULT", 105); + + /** + * 表单是否默认显示 + */ + private Boolean formItem; + + /** + * 表格是否默认显示 + */ + private Boolean gridItem; + + /** + * 自动填充策略 + */ + private String autoFill; + + /** + * 排序值 + */ + private Integer sort; + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/DictTool.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/DictTool.java new file mode 100644 index 00000000..50eaefb1 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/DictTool.java @@ -0,0 +1,32 @@ +package com.pig4cloud.pig.codegen.util; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; + +import java.util.HashSet; +import java.util.List; + +/** + * @author lengleng + * @date 2023/2/7 + */ +public class DictTool { + + /** + * 将字段列表转换为带有双引号的逗号分隔的字符串 + * @return 带有双引号的逗号分隔的字符串 + */ + public static String quotation(List fields) { + + return CollUtil.join(new HashSet<>(fields), StrUtil.COMMA, s -> String.format("'%s'", s)); + } + + /** + * 将字段列表转换为逗号分隔的字符串 + * @return 逗号分隔的字符串 + */ + public static String format(List fields) { + return CollUtil.join(new HashSet<>(fields), StrUtil.COMMA); + } + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/GenKit.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/GenKit.java new file mode 100644 index 00000000..057c4165 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/GenKit.java @@ -0,0 +1,75 @@ +package com.pig4cloud.pig.codegen.util; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.pig4cloud.pig.codegen.entity.GenDatasourceConf; +import com.pig4cloud.pig.codegen.mapper.GenDatasourceConfMapper; +import com.pig4cloud.pig.codegen.mapper.GeneratorMapper; +import com.pig4cloud.pig.common.core.util.SpringContextHolder; +import com.pig4cloud.pig.common.datasource.enums.DsJdbcUrlEnum; +import lombok.experimental.UtilityClass; +import org.springframework.context.ApplicationContext; + +import java.util.Map; + +/** + * 代码生成工具类 + * + * @author lengleng + * @date 2023/2/16 + */ +@UtilityClass +public class GenKit { + + /** + * 获取功能名 sys_a_b sysAb + * @param tableName 表名 + * @return 功能名 + */ + public String getFunctionName(String tableName) { + return StrUtil.toCamelCase(tableName); + } + + /** + * 获取模块名称 + * @param packageName 包名 + * @return 功能名 + */ + public String getModuleName(String packageName) { + return StrUtil.subAfter(packageName, ".", true); + } + + /** + * 获取数据源对应方言的mapper + * @param dsName 数据源名称 + * @return GeneratorMapper + */ + public GeneratorMapper getMapper(String dsName) { + // 获取目标数据源数据库类型 + GenDatasourceConfMapper datasourceConfMapper = SpringContextHolder.getBean(GenDatasourceConfMapper.class); + GenDatasourceConf datasourceConf = datasourceConfMapper + .selectOne(Wrappers.lambdaQuery().eq(GenDatasourceConf::getName, dsName)); + + String dbConfType; + // 默认MYSQL 数据源 + if (datasourceConf == null) { + dbConfType = DsJdbcUrlEnum.MYSQL.getDbName(); + } + else { + dbConfType = datasourceConf.getDsType(); + } + // 获取全部数据实现 + ApplicationContext context = SpringContextHolder.getApplicationContext(); + Map beansOfType = context.getBeansOfType(GeneratorMapper.class); + + // 根据数据类型选择mapper + for (String key : beansOfType.keySet()) { + if (StrUtil.containsIgnoreCase(key, dbConfType)) { + return beansOfType.get(key); + } + } + + throw new IllegalArgumentException("dsName 不合法: " + dsName); + } + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/GeneratorFileTypeEnum.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/GeneratorFileTypeEnum.java new file mode 100644 index 00000000..dc744e79 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/GeneratorFileTypeEnum.java @@ -0,0 +1,14 @@ +package com.pig4cloud.pig.codegen.util; + +public enum GeneratorFileTypeEnum { + + /** + * zip + */ + ZIP, + /** + * 目录直接写入 + */ + DIRECTORY; + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/NamingCaseTool.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/NamingCaseTool.java new file mode 100644 index 00000000..afdd446d --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/NamingCaseTool.java @@ -0,0 +1,35 @@ +package com.pig4cloud.pig.codegen.util; + +import cn.hutool.core.text.NamingCase; + +/** + * 命名规则处理,针对驼峰,下划线等处理 + * + * @author lengleng + * @date 2023/1/31 + */ +public class NamingCaseTool { + + /** + * 传入字段获取的get方法 + * @param in 字段名称 + * @return + */ + public static String getProperty(String in) { + return String.format("get%s", NamingCase.toPascalCase(in)); + } + + public static String setProperty(String in) { + return String.format("set%s", NamingCase.toPascalCase(in)); + } + + /** + * 首字母大写 + * @param in 字段 + * @return 首字母大写 + */ + public static String pascalCase(String in) { + return String.format(NamingCase.toPascalCase(in)); + } + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/VelocityKit.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/VelocityKit.java new file mode 100644 index 00000000..8f7f1301 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/VelocityKit.java @@ -0,0 +1,69 @@ +package com.pig4cloud.pig.codegen.util; + +import cn.hutool.core.util.CharsetUtil; +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.Velocity; +import org.apache.velocity.tools.generic.DateTool; +import org.apache.velocity.tools.generic.MathTool; +import org.springframework.stereotype.Service; + +import java.io.StringWriter; +import java.util.Map; +import java.util.Optional; +import java.util.Properties; + +/** + * 模板引擎工具类 + * + * @author lengleng + * @date 2023/2/7 + */ +@Service +public class VelocityKit { + + /** + * Velocity 模板渲染方法 + * @param template 模板 + * @param map 数据模型 + * @return 渲染结果 + */ + public static String render(String template, Map map) { + // 设置velocity资源加载器 + Properties prop = new Properties(); + prop.put("resource.loader.file.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); + Velocity.init(prop); + + VelocityContext context = new VelocityContext(map); + // 函数库,使用 Lambda 表达式简化代码 + Optional.of(new MathTool()).ifPresent(mt -> context.put("math", mt)); + Optional.of(new DateTool()).ifPresent(dt -> context.put("dateTool", dt)); + Optional.of(new DictTool()).ifPresent(dt -> context.put("dict", dt)); + Optional.of(new NamingCaseTool()).ifPresent(nct -> context.put("str", nct)); + + // 渲染模板,使用 Lambda 表达式简化代码 + StringWriter sw = new StringWriter(); + Optional.ofNullable(Velocity.getTemplate(template, CharsetUtil.UTF_8)).ifPresent(tpl -> tpl.merge(context, sw)); + return sw.toString(); + } + + /** + * 渲染文本 + * @param str + * @param dataModel 数据 + * @return + */ + public static String renderStr(String str, Map dataModel) { + // 设置velocity资源加载器 + Velocity.init(); + StringWriter stringWriter = new StringWriter(); + VelocityContext context = new VelocityContext(dataModel); + // 函数库 + context.put("math", new MathTool()); + context.put("dateTool", new DateTool()); + context.put("dict", new DictTool()); + context.put("str", new NamingCaseTool()); + Velocity.evaluate(context, stringWriter, "renderStr", str); + return stringWriter.toString(); + } + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/vo/GroupVo.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/vo/GroupVo.java new file mode 100644 index 00000000..23f6abb5 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/vo/GroupVo.java @@ -0,0 +1,45 @@ +package com.pig4cloud.pig.codegen.util.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.pig4cloud.pig.codegen.entity.GenTemplateEntity; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; + +@Data +public class GroupVo { + + /** + * id + */ + @TableId(type = IdType.ASSIGN_ID) + @Schema(description = "id") + private Long id; + + /** + * 分组名称 + */ + @Schema(description = "分组名称") + private String groupName; + + /** + * 分组描述 + */ + @Schema(description = "分组描述") + private String groupDesc; + + /** + * 模板ids + */ + @Schema(description = "拥有的模板列表") + private Long[] templateId; + + /** + * 模板列表 + */ + @Schema(description = "拥有的模板列表") + private List templateList; + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/vo/SqlDto.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/vo/SqlDto.java new file mode 100644 index 00000000..25393e64 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/vo/SqlDto.java @@ -0,0 +1,22 @@ +package com.pig4cloud.pig.codegen.util.vo; + +import lombok.Data; + +/** + * @author lengleng + * @date 2022/5/2 + */ +@Data +public class SqlDto { + + /** + * 数据源ID + */ + private String dsName; + + /** + * sql脚本 + */ + private String sql; + +} diff --git a/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/vo/TemplateGroupDTO.java b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/vo/TemplateGroupDTO.java new file mode 100644 index 00000000..8ff23058 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/java/com/pig4cloud/pig/codegen/util/vo/TemplateGroupDTO.java @@ -0,0 +1,21 @@ +package com.pig4cloud.pig.codegen.util.vo; + +import com.pig4cloud.pig.codegen.entity.GenGroupEntity; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +@Data +@Schema(description = "模板传输对象") +@EqualsAndHashCode(callSuper = true) +public class TemplateGroupDTO extends GenGroupEntity { + + /** + * 模板id集合 + */ + @Schema(description = "模板id集合") + private List templateId; + +} diff --git a/pig-visual/pig-codegen/src/main/resources/generator.properties b/pig-visual/pig-codegen/src/main/resources/generator.properties deleted file mode 100755 index 5031d40e..00000000 --- a/pig-visual/pig-codegen/src/main/resources/generator.properties +++ /dev/null @@ -1,51 +0,0 @@ -# -# Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -#\u4EE3\u7801\u751F\u6210\u5668\uFF0C\u914D\u7F6E\u4FE1\u606F - -mainPath=com.pig4cloud.pig -#\u5305\u540D -package=com.pig4cloud.pig -moduleName=demo -#\u4F5C\u8005 -author=pig code generator - -#\u8868\u524D\u7F00(\u7C7B\u540D\u4E0D\u4F1A\u5305\u542B\u8868\u524D\u7F00) -tablePrefix=table_ - -#\u7C7B\u578B\u8F6C\u6362\uFF0C\u914D\u7F6E\u4FE1\u606F -tinyint=Integer -smallint=Integer -mediumint=Integer -int=Integer -integer=Integer -bigint=Long -float=Float -double=Double -decimal=BigDecimal -bit=Boolean - -char=String -bpchar=String -varchar=String -tinytext=String -text=String -mediumtext=String -longtext=String - -date=LocalDateTime -datetime=LocalDateTime -timestamp=LocalDateTime diff --git a/pig-visual/pig-codegen/src/main/resources/logback-spring.xml b/pig-visual/pig-codegen/src/main/resources/logback-spring.xml old mode 100755 new mode 100644 index fa238198..a90ada52 --- a/pig-visual/pig-codegen/src/main/resources/logback-spring.xml +++ b/pig-visual/pig-codegen/src/main/resources/logback-spring.xml @@ -1,23 +1,31 @@ + - - + @@ -43,7 +51,7 @@ 30 - %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n + ${CONSOLE_LOG_PATTERN} @@ -56,20 +64,23 @@ 30 - %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n + ${CONSOLE_LOG_PATTERN} ERROR + + + + - - + diff --git a/pig-visual/pig-codegen/src/main/resources/template/Mapper.xml.vm b/pig-visual/pig-codegen/src/main/resources/mapper/GenFieldTypeMapper.xml old mode 100755 new mode 100644 similarity index 57% rename from pig-visual/pig-codegen/src/main/resources/template/Mapper.xml.vm rename to pig-visual/pig-codegen/src/main/resources/mapper/GenFieldTypeMapper.xml index 25c0fa0e..43b07282 --- a/pig-visual/pig-codegen/src/main/resources/template/Mapper.xml.vm +++ b/pig-visual/pig-codegen/src/main/resources/mapper/GenFieldTypeMapper.xml @@ -21,15 +21,21 @@ - + - -#foreach($column in $columns) -#if($column.lowerAttrName==$pk.lowerAttrName) - -#else - -#end -#end - + + + + + + + + + diff --git a/pig-visual/pig-codegen/src/main/resources/mapper/GenFormConfMapper.xml b/pig-visual/pig-codegen/src/main/resources/mapper/GenFormConfMapper.xml deleted file mode 100755 index 422acb7c..00000000 --- a/pig-visual/pig-codegen/src/main/resources/mapper/GenFormConfMapper.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/pig-visual/pig-codegen/src/main/resources/mapper/GenGroupMapper.xml b/pig-visual/pig-codegen/src/main/resources/mapper/GenGroupMapper.xml new file mode 100644 index 00000000..83d36147 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/resources/mapper/GenGroupMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + diff --git a/pig-visual/pig-codegen/src/main/resources/mapper/GenTableMapper.xml b/pig-visual/pig-codegen/src/main/resources/mapper/GenTableMapper.xml new file mode 100644 index 00000000..e9a64953 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/resources/mapper/GenTableMapper.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pig-visual/pig-codegen/src/main/resources/mapper/GenTemplateGroupMapper.xml b/pig-visual/pig-codegen/src/main/resources/mapper/GenTemplateGroupMapper.xml new file mode 100644 index 00000000..fff11ebc --- /dev/null +++ b/pig-visual/pig-codegen/src/main/resources/mapper/GenTemplateGroupMapper.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/pig-visual/pig-codegen/src/main/resources/mapper/GenTemplateMapper.xml b/pig-visual/pig-codegen/src/main/resources/mapper/GenTemplateMapper.xml new file mode 100644 index 00000000..02f10b21 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/resources/mapper/GenTemplateMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + diff --git a/pig-visual/pig-codegen/src/main/resources/mapper/GeneratorMapper.xml b/pig-visual/pig-codegen/src/main/resources/mapper/GeneratorMapper.xml deleted file mode 100755 index f226b6fb..00000000 --- a/pig-visual/pig-codegen/src/main/resources/mapper/GeneratorMapper.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - diff --git a/pig-visual/pig-codegen/src/main/resources/mapper/GeneratorMySqlMapper.xml b/pig-visual/pig-codegen/src/main/resources/mapper/GeneratorMySqlMapper.xml new file mode 100755 index 00000000..ca5b9eb9 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/resources/mapper/GeneratorMySqlMapper.xml @@ -0,0 +1,48 @@ + + + + + + + + + SELECT + column_name columnName, + data_type dataType, + column_comment comments, + column_key columnKey, + extra, + is_nullable AS isNullable, + column_type AS columnType + FROM + information_schema.COLUMNS + WHERE + table_name = #{tableName} and table_schema = (select database()) order by ordinal_position + + + + + + + diff --git a/pig-visual/pig-codegen/src/main/resources/template/Controller.java.vm b/pig-visual/pig-codegen/src/main/resources/template/Controller.java.vm deleted file mode 100755 index deae73b0..00000000 --- a/pig-visual/pig-codegen/src/main/resources/template/Controller.java.vm +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package ${package}.${moduleName}.controller; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.pig4cloud.pig.common.core.util.R; -import com.pig4cloud.pig.common.log.annotation.SysLog; -import ${package}.${moduleName}.entity.${className}; -import ${package}.${moduleName}.service.${className}Service; -import org.springframework.security.access.prepost.PreAuthorize; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.security.SecurityRequirement; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpHeaders; -import org.springframework.web.bind.annotation.*; - - -/** - * ${comments} - * - * @author ${author} - * @date ${datetime} - */ -@RestController -@RequiredArgsConstructor -@RequestMapping("/${pathName}" ) -@Tag(name = "${comments}管理") -@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) -public class ${className}Controller { - - private final ${className}Service ${classname}Service; - - /** - * 分页查询 - * @param page 分页对象 - * @param ${classname} ${comments} - * @return - */ - @Operation(summary = "分页查询", description = "分页查询") - @GetMapping("/page" ) - @PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_get')" ) - public R get${className}Page(Page page, ${className} ${classname}) { - return R.ok(${classname}Service.page(page, Wrappers.query(${classname}))); - } - - - /** - * 通过id查询${comments} - * @param ${pk.lowerAttrName} id - * @return R - */ - @Operation(summary = "通过id查询", description = "通过id查询") - @GetMapping("/{${pk.lowerAttrName}}" ) - @PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_get')" ) - public R getById(@PathVariable("${pk.lowerAttrName}" ) ${pk.attrType} ${pk.lowerAttrName}) { - return R.ok(${classname}Service.getById(${pk.lowerAttrName})); - } - - /** - * 新增${comments} - * @param ${classname} ${comments} - * @return R - */ - @Operation(summary = "新增${comments}", description = "新增${comments}") - @SysLog("新增${comments}" ) - @PostMapping - @PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_add')" ) - public R save(@RequestBody ${className} ${classname}) { - return R.ok(${classname}Service.save(${classname})); - } - - /** - * 修改${comments} - * @param ${classname} ${comments} - * @return R - */ - @Operation(summary = "修改${comments}", description = "修改${comments}") - @SysLog("修改${comments}" ) - @PutMapping - @PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_edit')" ) - public R updateById(@RequestBody ${className} ${classname}) { - return R.ok(${classname}Service.updateById(${classname})); - } - - /** - * 通过id删除${comments} - * @param ${pk.lowerAttrName} id - * @return R - */ - @Operation(summary = "通过id删除${comments}", description = "通过id删除${comments}") - @SysLog("通过id删除${comments}" ) - @DeleteMapping("/{${pk.lowerAttrName}}" ) - @PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_del')" ) - public R removeById(@PathVariable ${pk.attrType} ${pk.lowerAttrName}) { - return R.ok(${classname}Service.removeById(${pk.lowerAttrName})); - } - -} diff --git a/pig-visual/pig-codegen/src/main/resources/template/avue/api.js.vm b/pig-visual/pig-codegen/src/main/resources/template/avue/api.js.vm deleted file mode 100644 index e257ce76..00000000 --- a/pig-visual/pig-codegen/src/main/resources/template/avue/api.js.vm +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -import request from '@/router/axios' - -export function fetchList(query) { - return request({ - url: '/${moduleName}/${pathName}/page', - method: 'get', - params: query - }) -} - -export function addObj(obj) { - return request({ - url: '/${moduleName}/${pathName}', - method: 'post', - data: obj - }) -} - -export function getObj(id) { - return request({ - url: '/${moduleName}/${pathName}/' + id, - method: 'get' - }) -} - -export function delObj(id) { - return request({ - url: '/${moduleName}/${pathName}/' + id, - method: 'delete' - }) -} - -export function putObj(obj) { - return request({ - url: '/${moduleName}/${pathName}', - method: 'put', - data: obj - }) -} diff --git a/pig-visual/pig-codegen/src/main/resources/template/avue/crud.js.vm b/pig-visual/pig-codegen/src/main/resources/template/avue/crud.js.vm deleted file mode 100644 index 05e7fbd3..00000000 --- a/pig-visual/pig-codegen/src/main/resources/template/avue/crud.js.vm +++ /dev/null @@ -1,34 +0,0 @@ -export const tableOption = { - "border": true, - "index": true, - "indexLabel": "序号", - "stripe": true, - "menuAlign": "center", - "align": "center", - "searchMenuSpan": 6, - "column": [ -#set($excludeColumns = ["create_time","update_time","create_by","update_by"]) -#foreach ($column in $columns) -## 当列是主键 或者 列是审计字段时候, 新增不显示,编辑的时候显示单不能编辑 -#if($column.columnName == $pk.columnName || $excludeColumns.contains($column.columnName)) - { - "type": "input", - #if($column.comments) - "label": "$column.comments", - #else - "label": "$column.lowerAttrName", - #end - "prop": "$column.lowerAttrName", - "addDisplay": false, - "editDisabled": true - }#if($foreach.hasNext),#end -#else - { - "type": "input", - "label": "$column.comments", - "prop": "$column.lowerAttrName" - }#if($foreach.hasNext),#end -#end -#end - ] -} diff --git a/pig-visual/pig-codegen/src/main/resources/template/avue/index.vue.vm b/pig-visual/pig-codegen/src/main/resources/template/avue/index.vue.vm deleted file mode 100755 index 310aa698..00000000 --- a/pig-visual/pig-codegen/src/main/resources/template/avue/index.vue.vm +++ /dev/null @@ -1,130 +0,0 @@ - - - - diff --git a/pig-visual/pig-codegen/src/main/resources/template/config.json b/pig-visual/pig-codegen/src/main/resources/template/config.json new file mode 100644 index 00000000..4f33f5d0 --- /dev/null +++ b/pig-visual/pig-codegen/src/main/resources/template/config.json @@ -0,0 +1,12 @@ +{ + "project": { + "packageName": "com.pig4cloud.pig", + "version": "1.0.0", + "backendPath": "pig", + "frontendPath": "pig-ui" + }, + "developer": { + "author": "pig", + "email": "pig4cloud@qq.com" + } +} diff --git a/pig-visual/pig-codegen/src/main/resources/template/element/form.vue.vm b/pig-visual/pig-codegen/src/main/resources/template/element/form.vue.vm deleted file mode 100644 index f7fbf7f6..00000000 --- a/pig-visual/pig-codegen/src/main/resources/template/element/form.vue.vm +++ /dev/null @@ -1,102 +0,0 @@ -#set($excludeColumns = ["create_time","update_time","create_by","update_by"]) - - - diff --git a/pig-visual/pig-codegen/src/main/resources/template/element/index.vue.vm b/pig-visual/pig-codegen/src/main/resources/template/element/index.vue.vm deleted file mode 100644 index 5480a7aa..00000000 --- a/pig-visual/pig-codegen/src/main/resources/template/element/index.vue.vm +++ /dev/null @@ -1,130 +0,0 @@ - - - diff --git a/pig-visual/pig-codegen/src/main/resources/template/menu.sql.vm b/pig-visual/pig-codegen/src/main/resources/template/menu.sql.vm deleted file mode 100644 index 565c5d22..00000000 --- a/pig-visual/pig-codegen/src/main/resources/template/menu.sql.vm +++ /dev/null @@ -1,20 +0,0 @@ --- 该脚本不要直接执行, 注意维护菜单的父节点ID 默认 根节点 -#set($menuId=${dateTool.getSystemTime()}) - --- 菜单SQL -insert into `sys_menu` (`menu_id`, `parent_id`, `path`, `permission`, `type`, `icon`, `del_flag`, `create_time`, `sort_order`, `update_time`, `name`) - values (${menuId}, '-1', '/${moduleName}/${pathName}/index', '', '0', 'icon-bangzhushouji', '0', '2018-01-20 13:17:19', '8', '2018-07-29 13:38:19', '${comments}管理'); - --- 菜单对应按钮SQL -insert into `sys_menu` ( `parent_id`,`menu_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort_order`, `update_time`, `name`) -values(${menuId}, ${math.add($menuId,1)}, '${moduleName}_${pathName}_get', '1', null, '1', '0', '2018-05-15 21:35:18', '0', '2018-07-29 13:38:59', '${comments}查看'); - -insert into `sys_menu` (`parent_id`, `menu_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort_order`, `update_time`, `name`) -values(${menuId}, ${math.add($menuId,2)}, '${moduleName}_${pathName}_add', '1', null, '1', '0', '2018-05-15 21:35:18', '1', '2018-07-29 13:38:59', '${comments}新增'); - -insert into `sys_menu` (`parent_id`, `menu_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort_order`, `update_time`, `name`) -values(${menuId}, ${math.add($menuId,3)}, '${moduleName}_${pathName}_edit', '1', null, '1', '0', '2018-05-15 21:35:18', '2', '2018-07-29 13:38:59', '${comments}修改'); - -insert into `sys_menu` (`parent_id`, `menu_id`, `permission`, `type`, `path`, `icon`, `del_flag`, `create_time`, `sort_order`, `update_time`, `name`) -values(${menuId}, ${math.add($menuId,4)}, '${moduleName}_${pathName}_del', '1', null, '1', '0', '2018-05-15 21:35:18', '3', '2018-07-29 13:38:59', '${comments}删除'); - diff --git a/pig-visual/pig-monitor/pom.xml b/pig-visual/pig-monitor/pom.xml index 1be8a117..d714a164 100755 --- a/pig-visual/pig-monitor/pom.xml +++ b/pig-visual/pig-monitor/pom.xml @@ -21,7 +21,7 @@ com.pig4cloud pig-visual - 3.6.7 + 3.7.0-JDK8 pig-monitor diff --git a/pig-visual/pig-xxl-job-admin/Dockerfile b/pig-visual/pig-quartz/Dockerfile similarity index 62% rename from pig-visual/pig-xxl-job-admin/Dockerfile rename to pig-visual/pig-quartz/Dockerfile index dcde5139..270aff8a 100644 --- a/pig-visual/pig-xxl-job-admin/Dockerfile +++ b/pig-visual/pig-quartz/Dockerfile @@ -1,14 +1,14 @@ FROM moxm/java:1.8-full -RUN mkdir -p /pig-xxl-job-admin +RUN mkdir -p /pig-quartz -WORKDIR /pig-xxl-job-admin +WORKDIR /pig-quartz -ARG JAR_FILE=target/pig-xxl-job-admin.jar +ARG JAR_FILE=target/pig-quartz.jar COPY ${JAR_FILE} app.jar -EXPOSE 5004 +EXPOSE 5001 ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms128m -Xmx256m -Djava.security.egd=file:/dev/./urandom" diff --git a/pig-visual/pig-quartz/pom.xml b/pig-visual/pig-quartz/pom.xml new file mode 100644 index 00000000..a7476cd0 --- /dev/null +++ b/pig-visual/pig-quartz/pom.xml @@ -0,0 +1,91 @@ + + + + com.pig4cloud + pig-visual + 3.7.0-JDK8 + + 4.0.0 + + pig-quartz + jar + + 基于quartz后台定时任务模块 + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + com.pig4cloud + pig-common-log + + + + com.pig4cloud + pig-common-feign + + + + com.pig4cloud + pig-common-mybatis + + + com.baomidou + mybatis-plus-boot-starter + + + + com.mysql + mysql-connector-j + + + + com.pig4cloud + pig-common-swagger + + + + com.pig4cloud + pig-common-security + + + + org.springframework.boot + spring-boot-starter-quartz + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-undertow + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + io.fabric8 + docker-maven-plugin + + + + diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/PigQuartzApplication.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/PigQuartzApplication.java new file mode 100644 index 00000000..cdcea4f5 --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/PigQuartzApplication.java @@ -0,0 +1,23 @@ +package com.pig4cloud.pig.daemon.quartz; + +import com.pig4cloud.pig.common.feign.annotation.EnablePigFeignClients; +import com.pig4cloud.pig.common.security.annotation.EnablePigResourceServer; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; + +/** + * @author frwcloud + * @date 2023-07-05 + */ +@EnablePigFeignClients +@EnablePigResourceServer +@EnableDiscoveryClient +@SpringBootApplication +public class PigQuartzApplication { + + public static void main(String[] args) { + SpringApplication.run(PigQuartzApplication.class, args); + } + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/config/AutowireCapableBeanJobFactory.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/config/AutowireCapableBeanJobFactory.java new file mode 100644 index 00000000..679a3a48 --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/config/AutowireCapableBeanJobFactory.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.config; + +import org.quartz.JobKey; +import org.quartz.spi.TriggerFiredBundle; +import org.springframework.beans.factory.config.AutowireCapableBeanFactory; +import org.springframework.scheduling.quartz.SpringBeanJobFactory; +import org.springframework.util.Assert; + +/** + * @author 郑健楠 + */ +class AutowireCapableBeanJobFactory extends SpringBeanJobFactory { + + private final AutowireCapableBeanFactory beanFactory; + + AutowireCapableBeanJobFactory(AutowireCapableBeanFactory beanFactory) { + Assert.notNull(beanFactory, "Bean factory must not be null"); + this.beanFactory = beanFactory; + } + + @Override + protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception { + Object jobInstance = super.createJobInstance(bundle); + this.beanFactory.autowireBean(jobInstance); + + // 此处必须注入 beanName 不然sentinel 报错 + JobKey jobKey = bundle.getTrigger().getJobKey(); + String beanName = jobKey + jobKey.getName(); + this.beanFactory.initializeBean(jobInstance, beanName); + return jobInstance; + } + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/config/PigInitQuartzJob.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/config/PigInitQuartzJob.java new file mode 100644 index 00000000..feef77e7 --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/config/PigInitQuartzJob.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.config; + +import com.pig4cloud.pig.daemon.quartz.constants.PigQuartzEnum; +import com.pig4cloud.pig.daemon.quartz.service.SysJobService; +import com.pig4cloud.pig.daemon.quartz.util.TaskUtil; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.quartz.Scheduler; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @author 郑健楠 + *

+ * 初始化加载定时任务 + */ +@Slf4j +@Configuration +@AllArgsConstructor +public class PigInitQuartzJob { + + private final SysJobService sysJobService; + + private final TaskUtil taskUtil; + + private final Scheduler scheduler; + + @Bean + public void customize() { + sysJobService.list().forEach(sysjob -> { + if (PigQuartzEnum.JOB_STATUS_RELEASE.getType().equals(sysjob.getJobStatus())) { + taskUtil.removeJob(sysjob, scheduler); + } + else if (PigQuartzEnum.JOB_STATUS_RUNNING.getType().equals(sysjob.getJobStatus())) { + taskUtil.resumeJob(sysjob, scheduler); + } + else if (PigQuartzEnum.JOB_STATUS_NOT_RUNNING.getType().equals(sysjob.getJobStatus())) { + taskUtil.pauseJob(sysjob, scheduler); + } + else { + taskUtil.removeJob(sysjob, scheduler); + } + }); + } + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/config/PigQuartzConfig.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/config/PigQuartzConfig.java new file mode 100644 index 00000000..76dfe308 --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/config/PigQuartzConfig.java @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.config; + +import org.quartz.Calendar; +import org.quartz.JobDetail; +import org.quartz.Scheduler; +import org.quartz.Trigger; +import org.springframework.beans.factory.ObjectProvider; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.quartz.QuartzProperties; +import org.springframework.boot.autoconfigure.quartz.SchedulerFactoryBeanCustomizer; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.quartz.SchedulerFactoryBean; + +import java.util.List; +import java.util.Map; +import java.util.Properties; + +/** + * @author 郑健楠 + */ +@EnableAsync +@Configuration +@ConditionalOnClass({ Scheduler.class, SchedulerFactoryBean.class }) +@EnableConfigurationProperties({ QuartzProperties.class }) +public class PigQuartzConfig { + + private final QuartzProperties properties; + + private final List customizers; + + private final JobDetail[] jobDetails; + + private final Map calendars; + + private final Trigger[] triggers; + + private final ApplicationContext applicationContext; + + public PigQuartzConfig(QuartzProperties properties, + ObjectProvider> customizers, ObjectProvider jobDetails, + ObjectProvider> calendars, ObjectProvider triggers, + ApplicationContext applicationContext) { + this.properties = properties; + this.customizers = customizers.getIfAvailable(); + this.jobDetails = jobDetails.getIfAvailable(); + this.calendars = calendars.getIfAvailable(); + this.triggers = triggers.getIfAvailable(); + this.applicationContext = applicationContext; + } + + @Bean + @ConditionalOnMissingBean + public SchedulerFactoryBean quartzScheduler() { + SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean(); + schedulerFactoryBean + .setJobFactory(new AutowireCapableBeanJobFactory(this.applicationContext.getAutowireCapableBeanFactory())); + if (!this.properties.getProperties().isEmpty()) { + schedulerFactoryBean.setQuartzProperties(this.asProperties(this.properties.getProperties())); + } + + if (this.jobDetails != null && this.jobDetails.length > 0) { + schedulerFactoryBean.setJobDetails(this.jobDetails); + } + + if (this.calendars != null && !this.calendars.isEmpty()) { + schedulerFactoryBean.setCalendars(this.calendars); + } + + if (this.triggers != null && this.triggers.length > 0) { + schedulerFactoryBean.setTriggers(this.triggers); + } + + this.customize(schedulerFactoryBean); + return schedulerFactoryBean; + } + + private Properties asProperties(Map source) { + Properties properties = new Properties(); + properties.putAll(source); + return properties; + } + + private void customize(SchedulerFactoryBean schedulerFactoryBean) { + if (this.customizers != null) { + + for (SchedulerFactoryBeanCustomizer customizer : this.customizers) { + customizer.customize(schedulerFactoryBean); + } + } + + } + + /** + * 通过SchedulerFactoryBean获取Scheduler的实例 + * @return + */ + @Bean + public Scheduler scheduler() { + return quartzScheduler().getScheduler(); + } + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/config/PigQuartzCustomizerConfig.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/config/PigQuartzCustomizerConfig.java new file mode 100644 index 00000000..1ef6c1d7 --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/config/PigQuartzCustomizerConfig.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.config; + +import org.springframework.boot.autoconfigure.quartz.SchedulerFactoryBeanCustomizer; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.quartz.SchedulerFactoryBean; + +/** + * @author 郑健楠 + */ +@Configuration +public class PigQuartzCustomizerConfig implements SchedulerFactoryBeanCustomizer { + + @Override + public void customize(SchedulerFactoryBean schedulerFactoryBean) { + schedulerFactoryBean.setWaitForJobsToCompleteOnShutdown(true); + } + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/config/PigQuartzFactory.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/config/PigQuartzFactory.java new file mode 100644 index 00000000..6617695f --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/config/PigQuartzFactory.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.config; + +import com.pig4cloud.pig.daemon.quartz.constants.PigQuartzEnum; +import com.pig4cloud.pig.daemon.quartz.entity.SysJob; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; +import org.quartz.DisallowConcurrentExecution; +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * @author 郑健楠 + * + *

+ * 动态任务工厂 + */ +@Slf4j +@DisallowConcurrentExecution +public class PigQuartzFactory implements Job { + + @Autowired + private PigQuartzInvokeFactory pigxQuartzInvokeFactory; + + @Override + @SneakyThrows + public void execute(JobExecutionContext jobExecutionContext) { + SysJob sysJob = (SysJob) jobExecutionContext.getMergedJobDataMap() + .get(PigQuartzEnum.SCHEDULE_JOB_KEY.getType()); + pigxQuartzInvokeFactory.init(sysJob, jobExecutionContext.getTrigger()); + } + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/config/PigQuartzInvokeFactory.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/config/PigQuartzInvokeFactory.java new file mode 100644 index 00000000..75e4fa48 --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/config/PigQuartzInvokeFactory.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.config; + +import com.pig4cloud.pig.daemon.quartz.entity.SysJob; +import com.pig4cloud.pig.daemon.quartz.event.SysJobEvent; +import lombok.AllArgsConstructor; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.annotation.Aspect; +import org.quartz.Trigger; +import org.springframework.context.ApplicationEventPublisher; +import org.springframework.stereotype.Service; + +/** + * @author 郑健楠 + */ +@Slf4j +@Aspect +@Service +@AllArgsConstructor +public class PigQuartzInvokeFactory { + + private final ApplicationEventPublisher publisher; + + @SneakyThrows + void init(SysJob sysJob, Trigger trigger) { + publisher.publishEvent(new SysJobEvent(sysJob, trigger)); + } + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/constants/JobTypeQuartzEnum.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/constants/JobTypeQuartzEnum.java new file mode 100644 index 00000000..b4e597af --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/constants/JobTypeQuartzEnum.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.constants; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author lengleng + * @date 2019-03-14 + *

+ * 任务类型枚举 + */ +@Getter +@AllArgsConstructor +public enum JobTypeQuartzEnum { + + /** + * 反射java类 + */ + JAVA("1", "反射java类"), + + /** + * spring bean 的方式 + */ + SPRING_BEAN("2", "spring bean容器实例"), + + /** + * rest 调用 + */ + REST("3", "rest调用"), + + /** + * jar + */ + JAR("4", "jar调用"); + + /** + * 类型 + */ + private final String type; + + /** + * 描述 + */ + private final String description; + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/constants/PigQuartzEnum.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/constants/PigQuartzEnum.java new file mode 100644 index 00000000..0f12b08b --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/constants/PigQuartzEnum.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.constants; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author 郑健楠 + * + *

+ * 定时任务枚举 + */ +@Getter +@AllArgsConstructor +public enum PigQuartzEnum { + + /** + * 错失执行策略默认 + */ + MISFIRE_DEFAULT("0", "默认"), + + /** + * 错失执行策略-立即执行错失任务 + */ + MISFIRE_IGNORE_MISFIRES("1", "立即执行错失任务"), + + /** + * 错失执行策略-触发一次执行周期执行 + */ + MISFIRE_FIRE_AND_PROCEED("2", "触发一次执行周期执行"), + + /** + * 错失执行策略-不触发执行周期执行 + */ + MISFIRE_DO_NOTHING("3", "不触发周期执行"), + + /** + * 任务详细信息的key + */ + SCHEDULE_JOB_KEY("scheduleJob", "获取任务详细信息的key"), + + /** + * JOB执行状态:0执行成功 + */ + JOB_LOG_STATUS_SUCCESS("0", "执行成功"), + /** + * JOB执行状态:1执行失败 + */ + JOB_LOG_STATUS_FAIL("1", "执行失败"), + + /** + * JOB状态:1已发布 + */ + JOB_STATUS_RELEASE("1", "已发布"), + /** + * JOB状态:2运行中 + */ + JOB_STATUS_RUNNING("2", "运行中"), + /** + * JOB状态:3暂停 + */ + JOB_STATUS_NOT_RUNNING("3", "暂停"), + /** + * JOB状态:4删除 + */ + JOB_STATUS_DEL("4", "删除"); + + /** + * 类型 + */ + private final String type; + + /** + * 描述 + */ + private final String description; + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/controller/SysJobController.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/controller/SysJobController.java new file mode 100644 index 00000000..dd0dfb64 --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/controller/SysJobController.java @@ -0,0 +1,314 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.controller; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.pig4cloud.pig.common.core.util.R; +import com.pig4cloud.pig.common.log.annotation.SysLog; +import com.pig4cloud.pig.common.security.util.SecurityUtils; +import com.pig4cloud.pig.daemon.quartz.constants.PigQuartzEnum; +import com.pig4cloud.pig.daemon.quartz.entity.SysJob; +import com.pig4cloud.pig.daemon.quartz.entity.SysJobLog; +import com.pig4cloud.pig.daemon.quartz.service.SysJobLogService; +import com.pig4cloud.pig.daemon.quartz.service.SysJobService; +import com.pig4cloud.pig.daemon.quartz.util.TaskUtil; +import com.pig4cloud.plugin.excel.annotation.ResponseExcel; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; +import org.quartz.Scheduler; +import org.springframework.http.HttpHeaders; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * @author frwcloud + * @date 2019-01-27 10:04:42 + *

+ * 定时任务管理 + */ +@RestController +@AllArgsConstructor +@RequestMapping("/sys-job") +@Tag(description = "sys-job", name = "定时任务") +@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) +public class SysJobController { + + private final SysJobService sysJobService; + + private final SysJobLogService sysJobLogService; + + private final TaskUtil taskUtil; + + private final Scheduler scheduler; + + /** + * 定时任务分页查询 + * @param page 分页对象 + * @param sysJob 定时任务调度表 + * @return + */ + @GetMapping("/page") + @Operation(description = "分页定时业务查询") + public R getSysJobPage(Page page, SysJob sysJob) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() + .like(StrUtil.isNotBlank(sysJob.getJobName()), SysJob::getJobName, sysJob.getJobName()) + .like(StrUtil.isNotBlank(sysJob.getJobGroup()), SysJob::getJobGroup, sysJob.getJobGroup()) + .eq(StrUtil.isNotBlank(sysJob.getJobStatus()), SysJob::getJobStatus, sysJob.getJobGroup()) + .eq(StrUtil.isNotBlank(sysJob.getJobExecuteStatus()), SysJob::getJobExecuteStatus, + sysJob.getJobExecuteStatus()); + return R.ok(sysJobService.page(page, wrapper)); + } + + /** + * 通过id查询定时任务 + * @param id id + * @return R + */ + @GetMapping("/{id}") + @Operation(description = "唯一标识查询定时任务") + public R getById(@PathVariable("id") Long id) { + return R.ok(sysJobService.getById(id)); + } + + /** + * 新增定时任务 + * @param sysJob 定时任务调度表 + * @return R + */ + @SysLog("新增定时任务") + @PostMapping + @PreAuthorize("@pms.hasPermission('job_sys_job_add')") + @Operation(description = "新增定时任务") + public R save(@RequestBody SysJob sysJob) { + sysJob.setJobStatus(PigQuartzEnum.JOB_STATUS_RELEASE.getType()); + sysJob.setCreateBy(SecurityUtils.getUser().getUsername()); + sysJobService.save(sysJob); + // 初始化任务 + taskUtil.addOrUpateJob(sysJob, scheduler); + return R.ok(); + } + + /** + * 修改定时任务 + * @param sysJob 定时任务调度表 + * @return R + */ + @SysLog("修改定时任务") + @PutMapping + @PreAuthorize("@pms.hasPermission('job_sys_job_edit')") + @Operation(description = "修改定时任务") + public R updateById(@RequestBody SysJob sysJob) { + sysJob.setUpdateBy(SecurityUtils.getUser().getUsername()); + SysJob querySysJob = this.sysJobService.getById(sysJob.getJobId()); + if (PigQuartzEnum.JOB_STATUS_NOT_RUNNING.getType().equals(querySysJob.getJobStatus())) { + this.taskUtil.addOrUpateJob(sysJob, scheduler); + sysJobService.updateById(sysJob); + } + else if (PigQuartzEnum.JOB_STATUS_RELEASE.getType().equals(querySysJob.getJobStatus())) { + sysJobService.updateById(sysJob); + } + return R.ok(); + } + + /** + * 通过id删除定时任务 + * @param id id + * @return R + */ + @SysLog("删除定时任务") + @DeleteMapping("/{id}") + @PreAuthorize("@pms.hasPermission('job_sys_job_del')") + @Operation(description = "唯一标识查询定时任务,暂停任务才能删除") + public R removeById(@PathVariable Long id) { + SysJob querySysJob = this.sysJobService.getById(id); + if (PigQuartzEnum.JOB_STATUS_NOT_RUNNING.getType().equals(querySysJob.getJobStatus())) { + this.taskUtil.removeJob(querySysJob, scheduler); + this.sysJobService.removeById(id); + } + else if (PigQuartzEnum.JOB_STATUS_RELEASE.getType().equals(querySysJob.getJobStatus())) { + this.sysJobService.removeById(id); + } + return R.ok(); + } + + /** + * 暂停全部定时任务 + * @return + */ + @SysLog("暂停全部定时任务") + @PostMapping("/shutdown-jobs") + @PreAuthorize("@pms.hasPermission('job_sys_job_shutdown_job')") + @Operation(description = "暂停全部定时任务") + public R shutdownJobs() { + taskUtil.pauseJobs(scheduler); + long count = this.sysJobService.count( + new LambdaQueryWrapper().eq(SysJob::getJobStatus, PigQuartzEnum.JOB_STATUS_RUNNING.getType())); + if (count <= 0) { + return R.ok("无正在运行定时任务"); + } + else { + // 更新定时任务状态条件,运行状态2更新为暂停状态2 + this.sysJobService.update( + SysJob.builder().jobStatus(PigQuartzEnum.JOB_STATUS_NOT_RUNNING.getType()).build(), + new UpdateWrapper().lambda() + .eq(SysJob::getJobStatus, PigQuartzEnum.JOB_STATUS_RUNNING.getType())); + return R.ok("暂停成功"); + } + } + + /** + * 启动全部定时任务 + * @return + */ + @SysLog("启动全部定时任务") + @PostMapping("/start-jobs") + @PreAuthorize("@pms.hasPermission('job_sys_job_start_job')") + @Operation(description = "启动全部定时任务") + public R startJobs() { + // 更新定时任务状态条件,暂停状态3更新为运行状态2 + this.sysJobService.update(SysJob.builder().jobStatus(PigQuartzEnum.JOB_STATUS_RUNNING.getType()).build(), + new UpdateWrapper().lambda() + .eq(SysJob::getJobStatus, PigQuartzEnum.JOB_STATUS_NOT_RUNNING.getType())); + taskUtil.startJobs(scheduler); + return R.ok(); + } + + /** + * 刷新全部定时任务 + * @return + */ + @SysLog("刷新全部定时任务") + @PostMapping("/refresh-jobs") + @PreAuthorize("@pms.hasPermission('job_sys_job_refresh_job')") + @Operation(description = "刷新全部定时任务") + public R refreshJobs() { + sysJobService.list().forEach((sysjob) -> { + if (PigQuartzEnum.JOB_STATUS_RELEASE.getType().equals(sysjob.getJobStatus()) + || PigQuartzEnum.JOB_STATUS_DEL.getType().equals(sysjob.getJobStatus())) { + taskUtil.removeJob(sysjob, scheduler); + } + else if (PigQuartzEnum.JOB_STATUS_RUNNING.getType().equals(sysjob.getJobStatus()) + || PigQuartzEnum.JOB_STATUS_NOT_RUNNING.getType().equals(sysjob.getJobStatus())) { + taskUtil.addOrUpateJob(sysjob, scheduler); + } + else { + taskUtil.removeJob(sysjob, scheduler); + } + }); + return R.ok(); + } + + /** + * 启动定时任务 + * @param jobId + * @return + */ + @SysLog("启动定时任务") + @PostMapping("/start-job/{id}") + @PreAuthorize("@pms.hasPermission('job_sys_job_start_job')") + @Operation(description = "启动定时任务") + public R startJob(@PathVariable("id") Long jobId) { + SysJob querySysJob = this.sysJobService.getById(jobId); + if (querySysJob != null && PigQuartzEnum.JOB_LOG_STATUS_FAIL.getType().equals(querySysJob.getJobStatus())) { + taskUtil.addOrUpateJob(querySysJob, scheduler); + } + else { + taskUtil.resumeJob(querySysJob, scheduler); + } + // 更新定时任务状态条件,暂停状态3更新为运行状态2 + this.sysJobService + .updateById(SysJob.builder().jobId(jobId).jobStatus(PigQuartzEnum.JOB_STATUS_RUNNING.getType()).build()); + return R.ok(); + } + + /** + * 启动定时任务 + * @param jobId + * @return + */ + @SysLog("立刻执行定时任务") + @PostMapping("/run-job/{id}") + @PreAuthorize("@pms.hasPermission('job_sys_job_run_job')") + @Operation(description = "立刻执行定时任务") + public R runJob(@PathVariable("id") Long jobId) { + SysJob querySysJob = this.sysJobService.getById(jobId); + return TaskUtil.runOnce(scheduler, querySysJob) ? R.ok() : R.failed(); + } + + /** + * 暂停定时任务 + * @return + */ + @SysLog("暂停定时任务") + @PostMapping("/shutdown-job/{id}") + @PreAuthorize("@pms.hasPermission('job_sys_job_shutdown_job')") + @Operation(description = "暂停定时任务") + public R shutdownJob(@PathVariable("id") Long id) { + SysJob querySysJob = this.sysJobService.getById(id); + // 更新定时任务状态条件,运行状态2更新为暂停状态3 + this.sysJobService.updateById(SysJob.builder() + .jobId(querySysJob.getJobId()) + .jobStatus(PigQuartzEnum.JOB_STATUS_NOT_RUNNING.getType()) + .build()); + taskUtil.pauseJob(querySysJob, scheduler); + return R.ok(); + } + + /** + * 唯一标识查询定时执行日志 + * @return + */ + @GetMapping("/job-log") + @Operation(description = "唯一标识查询定时执行日志") + public R getJobLog(Page page, SysJobLog sysJobLog) { + return R.ok(sysJobLogService.page(page, Wrappers.query(sysJobLog))); + } + + /** + * 检验任务名称和任务组联合是否唯一 + * @return + */ + @GetMapping("/is-valid-task-name") + @Operation(description = "检验任务名称和任务组联合是否唯一") + public R isValidTaskName(@RequestParam String jobName, @RequestParam String jobGroup) { + return this.sysJobService + .count(Wrappers.query(SysJob.builder().jobName(jobName).jobGroup(jobGroup).build())) > 0 + ? R.failed("任务重复,请检查此组内是否已包含同名任务") : R.ok(); + } + + /** + * 导出任务 + * @param sysJob + * @return + */ + @ResponseExcel + @GetMapping("/export") + @Operation(description = "导出任务") + public List export(SysJob sysJob) { + return sysJobService.list(Wrappers.query(sysJob)); + } + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/controller/SysJobLogController.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/controller/SysJobLogController.java new file mode 100644 index 00000000..4392f037 --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/controller/SysJobLogController.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.controller; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.pig4cloud.pig.common.core.util.R; +import com.pig4cloud.pig.daemon.quartz.entity.SysJobLog; +import com.pig4cloud.pig.daemon.quartz.service.SysJobLogService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; +import org.springframework.http.HttpHeaders; +import org.springframework.web.bind.annotation.*; + +/** + * @author frwcloud + *

+ * 定时任务执行日志表 + */ +@RestController +@AllArgsConstructor +@RequestMapping("/sys-job-log") +@Tag(description = "sys-job-log", name = "定时任务日志") +@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) +public class SysJobLogController { + + private final SysJobLogService sysJobLogService; + + /** + * 分页查询 + * @param page 分页对象 + * @param sysJobLog 定时任务执行日志表 + * @return + */ + @GetMapping("/page") + @Operation(description = "分页定时任务日志查询") + public R getSysJobLogPage(Page page, SysJobLog sysJobLog) { + return R.ok(sysJobLogService.page(page, Wrappers.query(sysJobLog))); + } + + @DeleteMapping + @Operation(description = "批量删除日志") + public R deleteLogs(@RequestBody Long[] ids) { + return R.ok(sysJobLogService.removeBatchByIds(CollUtil.toList(ids))); + } + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/entity/SysJob.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/entity/SysJob.java new file mode 100644 index 00000000..3d3ca844 --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/entity/SysJob.java @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + * 定时任务调度表 + * + * @author frwcloud + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Schema(description = "定时任务") +public class SysJob extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 任务id + */ + @TableId(value = "job_id", type = IdType.ASSIGN_ID) + private Long jobId; + + /** + * 任务名称 + */ + private String jobName; + + /** + * 任务组名 + */ + private String jobGroup; + + /** + * 组内执行顺利,值越大执行优先级越高,最大值9,最小值1 + */ + private String jobOrder; + + /** + * 1、java类;2、spring bean名称;3、rest调用;4、jar调用;9其他 + */ + private String jobType; + + /** + * job_type=3时,rest调用地址,仅支持rest get协议,需要增加String返回值,0成功,1失败;job_type=4时,jar路径;其它值为空 + */ + private String executePath; + + /** + * job_type=1时,类完整路径;job_type=2时,spring bean名称;其它值为空 + */ + private String className; + + /** + * 任务方法 + */ + private String methodName; + + /** + * 参数值 + */ + private String methodParamsValue; + + /** + * cron执行表达式 + */ + private String cronExpression; + + /** + * 错失执行策略(1错失周期立即执行 2错失周期执行一次 3下周期执行) + */ + private String misfirePolicy; + + /** + * 1、多租户任务;2、非多租户任务 + */ + private String jobTenantType; + + /** + * 状态(0、未发布;1、已发布;2、运行中;3、暂停;4、删除;) + */ + private String jobStatus; + + /** + * 状态(0正常 1异常) + */ + private String jobExecuteStatus; + + /** + * 创建者 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 更新者 + */ + @TableField(fill = FieldFill.UPDATE) + private String updateBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.UPDATE) + private LocalDateTime updateTime; + + /** + * 首次执行时间 + */ + private LocalDateTime startTime; + + /** + * 上次执行时间 + */ + private LocalDateTime previousTime; + + /** + * 下次执行时间 + */ + private LocalDateTime nextTime; + + /** + * 备注信息 + */ + private String remark; + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/entity/SysJobLog.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/entity/SysJobLog.java new file mode 100644 index 00000000..9418e668 --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/entity/SysJobLog.java @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + * 定时任务执行日志表 + * + * @author frwcloud + * @date 2019-01-27 13:40:20 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Schema(description = "定时任务日志") +public class SysJobLog extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 任务日志ID + */ + @TableId(value = "job_log_id", type = IdType.ASSIGN_ID) + private Long jobLogId; + + /** + * 任务id + */ + private Long jobId; + + /** + * 任务名称 + */ + private String jobName; + + /** + * 任务组名 + */ + private String jobGroup; + + /** + * 组内执行顺利,值越大执行优先级越高,最大值9,最小值1 + */ + private String jobOrder; + + /** + * 1、java类;2、spring bean名称;3、rest调用;4、jar调用;9其他 + */ + private String jobType; + + /** + * job_type=3时,rest调用地址,仅支持post协议;job_type=4时,jar路径;其它值为空 + */ + private String executePath; + + /** + * job_type=1时,类完整路径;job_type=2时,spring bean名称;其它值为空 + */ + private String className; + + /** + * 任务方法 + */ + private String methodName; + + /** + * 参数值 + */ + private String methodParamsValue; + + /** + * cron执行表达式 + */ + private String cronExpression; + + /** + * 日志信息 + */ + private String jobMessage; + + /** + * 执行状态(0正常 1失败) + */ + private String jobLogStatus; + + /** + * 执行时间 + */ + private String executeTime; + + /** + * 异常信息 + */ + private String exceptionInfo; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/event/SysJobEvent.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/event/SysJobEvent.java new file mode 100644 index 00000000..981f91a9 --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/event/SysJobEvent.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.event; + +import com.pig4cloud.pig.daemon.quartz.entity.SysJob; +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.quartz.Trigger; + +/** + * @author frwcloud 定时任务多线程事件 + */ +@Getter +@AllArgsConstructor +public class SysJobEvent { + + private final SysJob sysJob; + + private final Trigger trigger; + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/event/SysJobListener.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/event/SysJobListener.java new file mode 100644 index 00000000..27e41402 --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/event/SysJobListener.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.event; + +import com.pig4cloud.pig.daemon.quartz.entity.SysJob; +import com.pig4cloud.pig.daemon.quartz.util.TaskInvokUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.quartz.Trigger; +import org.springframework.context.event.EventListener; +import org.springframework.core.annotation.Order; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; + +/** + * @author frwcloud 异步监听定时任务事件 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class SysJobListener { + + private final TaskInvokUtil taskInvokUtil; + + @Async + @Order + @EventListener(SysJobEvent.class) + public void comSysJob(SysJobEvent event) { + SysJob sysJob = event.getSysJob(); + Trigger trigger = event.getTrigger(); + taskInvokUtil.invokMethod(sysJob, trigger); + } + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/event/SysJobLogEvent.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/event/SysJobLogEvent.java new file mode 100644 index 00000000..0351d36b --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/event/SysJobLogEvent.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.event; + +import com.pig4cloud.pig.daemon.quartz.entity.SysJobLog; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author frwcloud 定时任务日志多线程事件 + */ +@Getter +@AllArgsConstructor +public class SysJobLogEvent { + + private final SysJobLog sysJobLog; + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/event/SysJobLogListener.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/event/SysJobLogListener.java new file mode 100644 index 00000000..e7f9c370 --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/event/SysJobLogListener.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.event; + +import com.pig4cloud.pig.daemon.quartz.entity.SysJobLog; +import com.pig4cloud.pig.daemon.quartz.service.SysJobLogService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.context.event.EventListener; +import org.springframework.core.annotation.Order; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; + +/** + * @author frwcloud 异步监听定时任务日志事件 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class SysJobLogListener { + + private final SysJobLogService sysJobLogService; + + @Async + @Order + @EventListener(SysJobLogEvent.class) + public void saveSysJobLog(SysJobLogEvent event) { + SysJobLog sysJobLog = event.getSysJobLog(); + sysJobLogService.save(sysJobLog); + log.info("执行定时任务日志"); + } + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/exception/TaskException.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/exception/TaskException.java new file mode 100644 index 00000000..9ed8730f --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/exception/TaskException.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.exception; + +/** + * 定时任务异常 + * + * @author 郑健楠 + */ +public class TaskException extends Exception { + + public TaskException() { + super(); + } + + public TaskException(String msg) { + super(msg); + } + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/mapper/SysJobLogMapper.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/mapper/SysJobLogMapper.java new file mode 100644 index 00000000..9a191498 --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/mapper/SysJobLogMapper.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.pig4cloud.pig.daemon.quartz.entity.SysJobLog; +import org.apache.ibatis.annotations.Mapper; + +/** + * 定时任务执行日志表 + * + * @author frwcloud + * @date 2019-01-27 13:40:20 + */ +@Mapper +public interface SysJobLogMapper extends BaseMapper { + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/mapper/SysJobMapper.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/mapper/SysJobMapper.java new file mode 100644 index 00000000..ebb092d5 --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/mapper/SysJobMapper.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.pig4cloud.pig.daemon.quartz.entity.SysJob; +import org.apache.ibatis.annotations.Mapper; + +/** + * 定时任务调度表 + * + * @author frwcloud + * @date 2019-01-27 10:04:42 + */ +@Mapper +public interface SysJobMapper extends BaseMapper { + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/service/SysJobLogService.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/service/SysJobLogService.java new file mode 100644 index 00000000..5539541b --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/service/SysJobLogService.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.pig4cloud.pig.daemon.quartz.entity.SysJobLog; + +/** + * 定时任务执行日志表 + * + * @author frwcloud + * @date 2019-01-27 13:40:20 + */ +public interface SysJobLogService extends IService { + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/service/SysJobService.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/service/SysJobService.java new file mode 100644 index 00000000..fd7e3ad2 --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/service/SysJobService.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.pig4cloud.pig.daemon.quartz.entity.SysJob; + +/** + * 定时任务调度表 + * + * @author frwcloud + * @date 2019-01-27 10:04:42 + */ +public interface SysJobService extends IService { + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/service/impl/SysJobLogServiceImpl.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/service/impl/SysJobLogServiceImpl.java new file mode 100644 index 00000000..23093c5f --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/service/impl/SysJobLogServiceImpl.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.pig4cloud.pig.daemon.quartz.entity.SysJobLog; +import com.pig4cloud.pig.daemon.quartz.mapper.SysJobLogMapper; +import com.pig4cloud.pig.daemon.quartz.service.SysJobLogService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * 定时任务执行日志表 + * + * @author frwcloud + * @date 2019-01-27 13:40:20 + */ +@Slf4j +@Service +@AllArgsConstructor +public class SysJobLogServiceImpl extends ServiceImpl implements SysJobLogService { + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/service/impl/SysJobServiceImpl.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/service/impl/SysJobServiceImpl.java new file mode 100644 index 00000000..3ccdc261 --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/service/impl/SysJobServiceImpl.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.pig4cloud.pig.daemon.quartz.entity.SysJob; +import com.pig4cloud.pig.daemon.quartz.mapper.SysJobMapper; +import com.pig4cloud.pig.daemon.quartz.service.SysJobService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * 定时任务调度表 + * + * @author frwcloud + * @date 2019-01-27 10:04:42 + */ +@Slf4j +@Service +@AllArgsConstructor +public class SysJobServiceImpl extends ServiceImpl implements SysJobService { + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/task/RestTaskDemo.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/task/RestTaskDemo.java new file mode 100644 index 00000000..188769da --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/task/RestTaskDemo.java @@ -0,0 +1,34 @@ +package com.pig4cloud.pig.daemon.quartz.task; + +import com.pig4cloud.pig.common.core.util.R; +import com.pig4cloud.pig.common.security.annotation.Inner; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.time.LocalDateTime; + +/** + * 用于测试REST风格调用的demo + * + * @author lishangbu + * @date 2019/3/25 + */ +@Slf4j +@RestController +@RequestMapping("/inner-job") +public class RestTaskDemo { + + /** + * 测试REST风格调用定时任务的演示方法 + */ + @Inner(value = false) + @GetMapping("/{param}") + public R demoMethod(@PathVariable("param") String param) { + log.info("测试于:{},传入参数{}", LocalDateTime.now(), param); + return R.ok(); + } + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/task/SpringBeanTaskDemo.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/task/SpringBeanTaskDemo.java new file mode 100644 index 00000000..7167cb45 --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/task/SpringBeanTaskDemo.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.task; + +import com.pig4cloud.pig.daemon.quartz.constants.PigQuartzEnum; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; + +/** + * @author 郑健楠 + */ +@Slf4j +@Component("demo") +public class SpringBeanTaskDemo { + + /** + * 测试Spring Bean的演示方法 + */ + @SneakyThrows + public String demoMethod(String para) { + log.info("测试于:{},输入参数{}", LocalDateTime.now(), para); + return PigQuartzEnum.JOB_LOG_STATUS_SUCCESS.getType(); + } + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/ITaskInvok.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/ITaskInvok.java new file mode 100644 index 00000000..8db5e563 --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/ITaskInvok.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.util; + +import com.pig4cloud.pig.daemon.quartz.entity.SysJob; +import com.pig4cloud.pig.daemon.quartz.exception.TaskException; + +/** + * 定时任务反射实现接口类 + * + * @author 郑健楠 + */ +public interface ITaskInvok { + + /** + * 执行反射方法 + * @param sysJob 配置类 + * @throws TaskException + */ + void invokMethod(SysJob sysJob) throws TaskException; + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/JarTaskInvok.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/JarTaskInvok.java new file mode 100644 index 00000000..87c49c3a --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/JarTaskInvok.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.util; + +import cn.hutool.core.util.StrUtil; +import com.pig4cloud.pig.daemon.quartz.entity.SysJob; +import com.pig4cloud.pig.daemon.quartz.exception.TaskException; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * 定时任务可执行jar反射实现 + * + * @author 郑健楠 + */ +@Slf4j +@Component("jarTaskInvok") +public class JarTaskInvok implements ITaskInvok { + + @Override + public void invokMethod(SysJob sysJob) throws TaskException { + ProcessBuilder processBuilder = new ProcessBuilder(); + File jar = new File(sysJob.getExecutePath()); + processBuilder.directory(jar.getParentFile()); + List commands = new ArrayList<>(); + commands.add("java"); + commands.add("-jar"); + commands.add(sysJob.getExecutePath()); + if (StrUtil.isNotEmpty(sysJob.getMethodParamsValue())) { + commands.add(sysJob.getMethodParamsValue()); + } + processBuilder.command(commands); + try { + processBuilder.start(); + } + catch (IOException e) { + log.error("定时任务jar反射执行异常,执行任务:{}", sysJob.getExecutePath()); + throw new TaskException("定时任务jar反射执行异常,执行任务:" + sysJob.getExecutePath()); + } + } + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/JavaClassTaskInvok.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/JavaClassTaskInvok.java new file mode 100644 index 00000000..d8206042 --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/JavaClassTaskInvok.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.util; + +import cn.hutool.core.util.StrUtil; +import com.pig4cloud.pig.daemon.quartz.constants.PigQuartzEnum; +import com.pig4cloud.pig.daemon.quartz.entity.SysJob; +import com.pig4cloud.pig.daemon.quartz.exception.TaskException; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +/** + * 定时任务java class反射实现 + * + * @author 郑健楠 + */ +@Component("javaClassTaskInvok") +@Slf4j +public class JavaClassTaskInvok implements ITaskInvok { + + @Override + public void invokMethod(SysJob sysJob) throws TaskException { + Object obj; + Class clazz; + Method method; + Object returnValue; + try { + if (StrUtil.isNotEmpty(sysJob.getMethodParamsValue())) { + clazz = Class.forName(sysJob.getClassName()); + obj = clazz.newInstance(); + method = clazz.getDeclaredMethod(sysJob.getMethodName(), String.class); + returnValue = method.invoke(obj, sysJob.getMethodParamsValue()); + } + else { + clazz = Class.forName(sysJob.getClassName()); + obj = clazz.newInstance(); + method = clazz.getDeclaredMethod(sysJob.getMethodName()); + returnValue = method.invoke(obj); + } + if (StrUtil.isEmpty(returnValue.toString()) + || PigQuartzEnum.JOB_LOG_STATUS_FAIL.getType().equals(returnValue.toString())) { + log.error("定时任务javaClassTaskInvok异常,执行任务:{}", sysJob.getClassName()); + throw new TaskException("定时任务javaClassTaskInvok业务执行失败,任务:" + sysJob.getClassName()); + } + } + catch (ClassNotFoundException e) { + log.error("定时任务java反射类没有找到,执行任务:{}", sysJob.getClassName()); + throw new TaskException("定时任务java反射类没有找到,执行任务:" + sysJob.getClassName()); + } + catch (IllegalAccessException e) { + log.error("定时任务java反射类异常,执行任务:{}", sysJob.getClassName()); + throw new TaskException("定时任务java反射类异常,执行任务:" + sysJob.getClassName()); + } + catch (InstantiationException e) { + log.error("定时任务java反射类异常,执行任务:{}", sysJob.getClassName()); + throw new TaskException("定时任务java反射类异常,执行任务:" + sysJob.getClassName()); + } + catch (NoSuchMethodException e) { + log.error("定时任务java反射执行方法名异常,执行任务:{}", sysJob.getClassName()); + throw new TaskException("定时任务java反射执行方法名异常,执行任务:" + sysJob.getClassName()); + } + catch (InvocationTargetException e) { + log.error("定时任务java反射执行异常,执行任务:{}", sysJob.getClassName()); + throw new TaskException("定时任务java反射执行异常,执行任务:" + sysJob.getClassName()); + } + + } + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/RestTaskInvok.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/RestTaskInvok.java new file mode 100644 index 00000000..e4536cfc --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/RestTaskInvok.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.util; + +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpUtil; +import com.pig4cloud.pig.daemon.quartz.entity.SysJob; +import com.pig4cloud.pig.daemon.quartz.exception.TaskException; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + * 定时任务rest反射实现 + * + * @author 郑健楠 + */ +@Slf4j +@AllArgsConstructor +@Component("restTaskInvok") +public class RestTaskInvok implements ITaskInvok { + + @Override + public void invokMethod(SysJob sysJob) throws TaskException { + try { + HttpRequest request = HttpUtil.createGet(sysJob.getExecutePath()); + request.execute(); + } + catch (Exception e) { + log.error("定时任务restTaskInvok异常,执行任务:{}", sysJob.getExecutePath()); + throw new TaskException("定时任务restTaskInvok业务执行失败,任务:" + sysJob.getExecutePath()); + } + } + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/SpringBeanTaskInvok.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/SpringBeanTaskInvok.java new file mode 100644 index 00000000..bb47d46a --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/SpringBeanTaskInvok.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.util; + +import cn.hutool.core.util.StrUtil; +import com.pig4cloud.pig.common.core.util.SpringContextHolder; +import com.pig4cloud.pig.daemon.quartz.constants.PigQuartzEnum; +import com.pig4cloud.pig.daemon.quartz.entity.SysJob; +import com.pig4cloud.pig.daemon.quartz.exception.TaskException; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import org.springframework.util.ReflectionUtils; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +/** + * 定时任务spring bean反射实现 + * + * @author 郑健楠 + */ +@Component("springBeanTaskInvok") +@Slf4j +public class SpringBeanTaskInvok implements ITaskInvok { + + @Override + public void invokMethod(SysJob sysJob) throws TaskException { + Object target; + Method method; + Object returnValue; + // 通过Spring上下文去找 也有可能找不到 + target = SpringContextHolder.getBean(sysJob.getClassName()); + try { + if (StrUtil.isNotEmpty(sysJob.getMethodParamsValue())) { + method = target.getClass().getDeclaredMethod(sysJob.getMethodName(), String.class); + ReflectionUtils.makeAccessible(method); + returnValue = method.invoke(target, sysJob.getMethodParamsValue()); + } + else { + method = target.getClass().getDeclaredMethod(sysJob.getMethodName()); + ReflectionUtils.makeAccessible(method); + returnValue = method.invoke(target); + } + if (StrUtil.isEmpty(returnValue.toString()) + || PigQuartzEnum.JOB_LOG_STATUS_FAIL.getType().equals(returnValue.toString())) { + log.error("定时任务springBeanTaskInvok异常,执行任务:{}", sysJob.getClassName()); + throw new TaskException("定时任务springBeanTaskInvok业务执行失败,任务:" + sysJob.getClassName()); + } + } + catch (NoSuchMethodException e) { + log.error("定时任务spring bean反射异常方法未找到,执行任务:{}", sysJob.getClassName()); + throw new TaskException("定时任务spring bean反射异常方法未找到,执行任务:" + sysJob.getClassName()); + } + catch (IllegalAccessException e) { + log.error("定时任务spring bean反射异常,执行任务:{}", sysJob.getClassName()); + throw new TaskException("定时任务spring bean反射异常,执行任务:" + sysJob.getClassName()); + } + catch (InvocationTargetException e) { + log.error("定时任务spring bean反射执行异常,执行任务:{}", sysJob.getClassName()); + throw new TaskException("定时任务spring bean反射执行异常,执行任务:" + sysJob.getClassName()); + } + } + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/TaskInvokFactory.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/TaskInvokFactory.java new file mode 100644 index 00000000..0d0ae0df --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/TaskInvokFactory.java @@ -0,0 +1,50 @@ +package com.pig4cloud.pig.daemon.quartz.util; + +import cn.hutool.core.util.StrUtil; +import com.pig4cloud.pig.common.core.util.SpringContextHolder; +import com.pig4cloud.pig.daemon.quartz.constants.JobTypeQuartzEnum; +import com.pig4cloud.pig.daemon.quartz.exception.TaskException; +import lombok.extern.slf4j.Slf4j; + +/** + * @author Hccake + * @version 1.0 + * @date 2019/8/8 15:40 TaskInvok工厂类 + */ +@Slf4j +public class TaskInvokFactory { + + /** + * 根据对应jobType获取对应 invoker + * @param jobType + * @return + * @throws TaskException + */ + public static ITaskInvok getInvoker(String jobType) throws TaskException { + if (StrUtil.isBlank(jobType)) { + log.info("获取TaskInvok传递参数有误,jobType:{}", jobType); + throw new TaskException(""); + } + + ITaskInvok iTaskInvok = null; + if (JobTypeQuartzEnum.JAVA.getType().equals(jobType)) { + iTaskInvok = SpringContextHolder.getBean("javaClassTaskInvok"); + } + else if (JobTypeQuartzEnum.SPRING_BEAN.getType().equals(jobType)) { + iTaskInvok = SpringContextHolder.getBean("springBeanTaskInvok"); + } + else if (JobTypeQuartzEnum.REST.getType().equals(jobType)) { + iTaskInvok = SpringContextHolder.getBean("restTaskInvok"); + } + else if (JobTypeQuartzEnum.JAR.getType().equals(jobType)) { + iTaskInvok = SpringContextHolder.getBean("jarTaskInvok"); + } + else if (StrUtil.isBlank(jobType)) { + log.info("定时任务类型无对应反射方式,反射类型:{}", jobType); + throw new TaskException(""); + } + + return iTaskInvok; + } + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/TaskInvokUtil.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/TaskInvokUtil.java new file mode 100644 index 00000000..2f5fc2f7 --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/TaskInvokUtil.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.util; + +import cn.hutool.core.util.StrUtil; +import com.pig4cloud.pig.daemon.quartz.constants.PigQuartzEnum; +import com.pig4cloud.pig.daemon.quartz.entity.SysJob; +import com.pig4cloud.pig.daemon.quartz.entity.SysJobLog; +import com.pig4cloud.pig.daemon.quartz.event.SysJobLogEvent; +import com.pig4cloud.pig.daemon.quartz.service.SysJobService; +import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; +import org.quartz.CronTrigger; +import org.quartz.Trigger; +import org.springframework.context.ApplicationEventPublisher; +import org.springframework.stereotype.Component; + +import java.time.ZoneId; +import java.util.Date; + +/** + * 定时任务反射工具类 + * + * @author 郑健楠 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class TaskInvokUtil { + + private final ApplicationEventPublisher publisher; + + private final SysJobService sysJobService; + + @SneakyThrows + public void invokMethod(SysJob sysJob, Trigger trigger) { + + // 执行开始时间 + long startTime; + // 执行结束时间 + long endTime; + // 获取执行开始时间 + startTime = System.currentTimeMillis(); + // 更新定时任务表内的状态、执行时间、上次执行时间、下次执行时间等信息 + SysJob updateSysjob = new SysJob(); + updateSysjob.setJobId(sysJob.getJobId()); + // 日志 + SysJobLog sysJobLog = new SysJobLog(); + sysJobLog.setJobId(sysJob.getJobId()); + sysJobLog.setJobName(sysJob.getJobName()); + sysJobLog.setJobGroup(sysJob.getJobGroup()); + sysJobLog.setJobOrder(sysJob.getJobOrder()); + sysJobLog.setJobType(sysJob.getJobType()); + sysJobLog.setExecutePath(sysJob.getExecutePath()); + sysJobLog.setClassName(sysJob.getClassName()); + sysJobLog.setMethodName(sysJob.getMethodName()); + sysJobLog.setMethodParamsValue(sysJob.getMethodParamsValue()); + sysJobLog.setCronExpression(sysJob.getCronExpression()); + try { + // 执行任务 + ITaskInvok iTaskInvok = TaskInvokFactory.getInvoker(sysJob.getJobType()); + // 确保租户上下文有值,使得当前线程中的多租户特性生效。 + iTaskInvok.invokMethod(sysJob); + // 记录成功状态 + sysJobLog.setJobMessage(PigQuartzEnum.JOB_LOG_STATUS_SUCCESS.getDescription()); + sysJobLog.setJobLogStatus(PigQuartzEnum.JOB_LOG_STATUS_SUCCESS.getType()); + // 任务表信息更新 + updateSysjob.setJobExecuteStatus(PigQuartzEnum.JOB_LOG_STATUS_SUCCESS.getType()); + } + catch (Throwable e) { + log.error("定时任务执行失败,任务名称:{};任务组名:{},cron执行表达式:{},执行时间:{}", sysJob.getJobName(), sysJob.getJobGroup(), + sysJob.getCronExpression(), new Date()); + // 记录失败状态 + sysJobLog.setJobMessage(PigQuartzEnum.JOB_LOG_STATUS_FAIL.getDescription()); + sysJobLog.setJobLogStatus(PigQuartzEnum.JOB_LOG_STATUS_FAIL.getType()); + sysJobLog.setExceptionInfo(StrUtil.sub(e.getMessage(), 0, 2000)); + // 任务表信息更新 + updateSysjob.setJobExecuteStatus(PigQuartzEnum.JOB_LOG_STATUS_FAIL.getType()); + } + finally { + // 记录执行时间 立刻执行使用的是simpleTeigger + if (trigger instanceof CronTrigger) { + updateSysjob + .setStartTime(trigger.getStartTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); + updateSysjob.setPreviousTime( + trigger.getPreviousFireTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); + updateSysjob.setNextTime( + trigger.getNextFireTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); + } + // 记录执行时长 + endTime = System.currentTimeMillis(); + sysJobLog.setExecuteTime(String.valueOf(endTime - startTime)); + + publisher.publishEvent(new SysJobLogEvent(sysJobLog)); + sysJobService.updateById(updateSysjob); + } + } + +} diff --git a/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/TaskUtil.java b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/TaskUtil.java new file mode 100644 index 00000000..5890de03 --- /dev/null +++ b/pig-visual/pig-quartz/src/main/java/com/pig4cloud/pig/daemon/quartz/util/TaskUtil.java @@ -0,0 +1,244 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pig.daemon.quartz.util; + +import com.pig4cloud.pig.daemon.quartz.config.PigQuartzFactory; +import com.pig4cloud.pig.daemon.quartz.constants.PigQuartzEnum; +import com.pig4cloud.pig.daemon.quartz.entity.SysJob; +import lombok.extern.slf4j.Slf4j; +import org.quartz.*; +import org.springframework.stereotype.Component; + +/** + * 定时任务的工具类 + * + * @author 郑健楠 + */ +@Slf4j +@Component +public class TaskUtil { + + /** + * 获取定时任务的唯一key + * @param sysjob + * @return + */ + public static JobKey getJobKey(SysJob sysjob) { + return JobKey.jobKey(sysjob.getJobName(), sysjob.getJobGroup()); + } + + /** + * 获取定时任务触发器cron的唯一key + * @param sysjob + * @return + */ + public static TriggerKey getTriggerKey(SysJob sysjob) { + return TriggerKey.triggerKey(sysjob.getJobName(), sysjob.getJobGroup()); + } + + /** + * 添加或更新定时任务 + * @param sysjob + * @param scheduler + */ + public void addOrUpateJob(SysJob sysjob, Scheduler scheduler) { + CronTrigger trigger = null; + try { + JobKey jobKey = getJobKey(sysjob); + // 获得触发器 + TriggerKey triggerKey = getTriggerKey(sysjob); + trigger = (CronTrigger) scheduler.getTrigger(triggerKey); + // 判断触发器是否存在(如果存在说明之前运行过但是在当前被禁用了,如果不存在说明一次都没运行过) + if (trigger == null) { + // 新建一个工作任务 指定任务类型为串接进行的 + JobDetail jobDetail = JobBuilder.newJob(PigQuartzFactory.class).withIdentity(jobKey).build(); + // 将任务信息添加到任务信息中 + jobDetail.getJobDataMap().put(PigQuartzEnum.SCHEDULE_JOB_KEY.getType(), sysjob); + // 将cron表达式进行转换 + CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(sysjob.getCronExpression()); + cronScheduleBuilder = this.handleCronScheduleMisfirePolicy(sysjob, cronScheduleBuilder); + // 创建触发器并将cron表达式对象给塞入 + trigger = TriggerBuilder.newTrigger() + .withIdentity(triggerKey) + .withSchedule(cronScheduleBuilder) + .build(); + // 在调度器中将触发器和任务进行组合 + scheduler.scheduleJob(jobDetail, trigger); + } + else { + CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(sysjob.getCronExpression()); + cronScheduleBuilder = this.handleCronScheduleMisfirePolicy(sysjob, cronScheduleBuilder); + // 按照新的规则进行 + trigger = trigger.getTriggerBuilder() + .withIdentity(triggerKey) + .withSchedule(cronScheduleBuilder) + .build(); + // 将任务信息更新到任务信息中 + trigger.getJobDataMap().put(PigQuartzEnum.SCHEDULE_JOB_KEY.getType(), sysjob); + // 重启 + scheduler.rescheduleJob(triggerKey, trigger); + } + // 如任务状态为暂停 + if (sysjob.getJobStatus().equals(PigQuartzEnum.JOB_STATUS_NOT_RUNNING.getType())) { + this.pauseJob(sysjob, scheduler); + } + } + catch (SchedulerException e) { + log.error("添加或更新定时任务,失败信息:{}", e.getMessage()); + } + } + + /** + * 立即执行一次任务 + */ + public static boolean runOnce(Scheduler scheduler, SysJob sysJob) { + try { + // 参数 + JobDataMap dataMap = new JobDataMap(); + dataMap.put(PigQuartzEnum.SCHEDULE_JOB_KEY.getType(), sysJob); + + scheduler.triggerJob(getJobKey(sysJob), dataMap); + } + catch (SchedulerException e) { + log.error("立刻执行定时任务,失败信息:{}", e.getMessage()); + return false; + } + + return true; + } + + /** + * 暂停定时任务 + * @param sysjob + * @param scheduler + */ + public void pauseJob(SysJob sysjob, Scheduler scheduler) { + try { + if (scheduler != null) { + scheduler.pauseJob(getJobKey(sysjob)); + } + } + catch (SchedulerException e) { + log.error("暂停任务失败,失败信息:{}", e.getMessage()); + } + + } + + /** + * 恢复定时任务 + * @param sysjob + * @param scheduler + */ + public void resumeJob(SysJob sysjob, Scheduler scheduler) { + try { + if (scheduler != null) { + scheduler.resumeJob(getJobKey(sysjob)); + } + } + catch (SchedulerException e) { + log.error("恢复任务失败,失败信息:{}", e.getMessage()); + } + + } + + /** + * 移除定时任务 + * @param sysjob + * @param scheduler + */ + public void removeJob(SysJob sysjob, Scheduler scheduler) { + try { + if (scheduler != null) { + // 停止触发器 + scheduler.pauseTrigger(getTriggerKey(sysjob)); + // 移除触发器 + scheduler.unscheduleJob(getTriggerKey(sysjob)); + // 删除任务 + scheduler.deleteJob(getJobKey(sysjob)); + } + } + catch (Exception e) { + log.error("移除定时任务失败,失败信息:{}", e.getMessage()); + } + } + + /** + * 启动所有运行定时任务 + * @param scheduler + */ + public void startJobs(Scheduler scheduler) { + try { + if (scheduler != null) { + scheduler.resumeAll(); + } + } + catch (SchedulerException e) { + log.error("启动所有运行定时任务失败,失败信息:{}", e.getMessage()); + } + } + + /** + * 停止所有运行定时任务 + * @param scheduler + */ + public void pauseJobs(Scheduler scheduler) { + try { + if (scheduler != null) { + scheduler.pauseAll(); + } + } + catch (Exception e) { + log.error("暂停所有运行定时任务失败,失败信息:{}", e.getMessage()); + } + } + + /** + * 获取错失执行策略方法 + * @param sysJob + * @param cronScheduleBuilder + * @return + */ + private CronScheduleBuilder handleCronScheduleMisfirePolicy(SysJob sysJob, + CronScheduleBuilder cronScheduleBuilder) { + if (PigQuartzEnum.MISFIRE_DEFAULT.getType().equals(sysJob.getMisfirePolicy())) { + return cronScheduleBuilder; + } + else if (PigQuartzEnum.MISFIRE_IGNORE_MISFIRES.getType().equals(sysJob.getMisfirePolicy())) { + return cronScheduleBuilder.withMisfireHandlingInstructionIgnoreMisfires(); + } + else if (PigQuartzEnum.MISFIRE_FIRE_AND_PROCEED.getType().equals(sysJob.getMisfirePolicy())) { + return cronScheduleBuilder.withMisfireHandlingInstructionFireAndProceed(); + } + else if (PigQuartzEnum.MISFIRE_DO_NOTHING.getType().equals(sysJob.getMisfirePolicy())) { + return cronScheduleBuilder.withMisfireHandlingInstructionDoNothing(); + } + else { + return cronScheduleBuilder; + } + } + + /** + * 判断cron表达式是否正确 + * @param cronExpression + * @return + */ + public boolean isValidCron(String cronExpression) { + return CronExpression.isValidExpression(cronExpression); + } + +} diff --git a/pig-visual/pig-xxl-job-admin/src/main/resources/application.yml b/pig-visual/pig-quartz/src/main/resources/application.yml similarity index 50% rename from pig-visual/pig-xxl-job-admin/src/main/resources/application.yml rename to pig-visual/pig-quartz/src/main/resources/application.yml index 1de05640..8fb381b3 100644 --- a/pig-visual/pig-xxl-job-admin/src/main/resources/application.yml +++ b/pig-visual/pig-quartz/src/main/resources/application.yml @@ -1,12 +1,6 @@ - -# 此配置只适合开发测试环境,详细配置参考: http://t.cn/A64RaHJm server: - port: 5004 - servlet: - context-path: /xxl-job-admin + port: 5007 - -# spring spring: application: name: @artifactId@ @@ -16,12 +10,15 @@ spring: password: @nacos.password@ discovery: server-addr: ${NACOS_HOST:pig-register}:${NACOS_PORT:8848} - metadata: - management.context-path: ${server.servlet.context-path}/actuator config: server-addr: ${spring.cloud.nacos.discovery.server-addr} config: import: - optional:nacos:application-@profiles.active@.yml - optional:nacos:${spring.application.name}-@profiles.active@.yml - + datasource: + type: com.zaxxer.hikari.HikariDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + username: root + password: root + url: jdbc:mysql://pig-mysql:3306/pig_job?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true diff --git a/pig-visual/pig-xxl-job-admin/src/main/resources/logback-spring.xml b/pig-visual/pig-quartz/src/main/resources/logback-spring.xml old mode 100755 new mode 100644 similarity index 69% rename from pig-visual/pig-xxl-job-admin/src/main/resources/logback-spring.xml rename to pig-visual/pig-quartz/src/main/resources/logback-spring.xml index fa238198..3ad26f7e --- a/pig-visual/pig-xxl-job-admin/src/main/resources/logback-spring.xml +++ b/pig-visual/pig-quartz/src/main/resources/logback-spring.xml @@ -1,23 +1,14 @@ - + 小技巧: 在根pom里面设置统一存放路径,统一管理方便维护 + + /Users/lengleng + + 1. 其他模块加日志输出,直接copy本文件放在resources 目录即可 + 2. 注意修改 的value模块 +--> - - + @@ -43,7 +34,7 @@ 30 - %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n + ${CONSOLE_LOG_PATTERN} @@ -56,20 +47,23 @@ 30 - %date [%thread] %-5level [%logger{50}] %file:%line - %msg%n + ${CONSOLE_LOG_PATTERN} ERROR + + + + - - + diff --git a/pig-visual/pig-sentinel-dashboard/Dockerfile b/pig-visual/pig-sentinel-dashboard/Dockerfile deleted file mode 100644 index 9b41f802..00000000 --- a/pig-visual/pig-sentinel-dashboard/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM moxm/java:1.8-full - -RUN mkdir -p /pig-sentinel-dashboard - -WORKDIR /pig-sentinel-dashboard - -ARG JAR_FILE=target/pig-sentinel-dashboard.jar - -COPY ${JAR_FILE} app.jar - -EXPOSE 5003 - -ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms128m -Xmx256m -Djava.security.egd=file:/dev/./urandom" - -CMD sleep 60; java $JAVA_OPTS -jar app.jar diff --git a/pig-visual/pig-sentinel-dashboard/pom.xml b/pig-visual/pig-sentinel-dashboard/pom.xml deleted file mode 100755 index 9a3fb87e..00000000 --- a/pig-visual/pig-sentinel-dashboard/pom.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - 4.0.0 - - - com.pig4cloud - pig-visual - 3.6.7 - - - pig-sentinel-dashboard - jar - - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-discovery - - - com.alibaba.csp - sentinel-core - - - com.alibaba.csp - sentinel-web-servlet - - - com.alibaba.csp - sentinel-transport-simple-http - - - com.alibaba.csp - sentinel-parameter-flow-control - - - com.alibaba.csp - sentinel-api-gateway-adapter-common - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-undertow - - - - commons-lang - commons-lang - 2.6 - - - - org.apache.httpcomponents - httpclient - 4.5.3 - - - org.apache.httpcomponents - httpcore - 4.4.5 - - - org.apache.httpcomponents - httpasyncclient - 4.1.3 - - - org.apache.httpcomponents - httpcore-nio - 4.4.6 - - - - - pig-sentinel-dashboard - - - src/main/resources - true - - - src/main/webapp/ - - resources/node_modules/** - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - io.fabric8 - docker-maven-plugin - - false - - - - - diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/PigSentinelApplication.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/PigSentinelApplication.java deleted file mode 100755 index 3fdcd68a..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/PigSentinelApplication.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard; - -import com.alibaba.csp.sentinel.init.InitExecutor; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -/** - * Sentinel dashboard application. - * - * @author Carpenter Lee - */ -@SpringBootApplication -public class PigSentinelApplication { - - public static void main(String[] args) { - triggerSentinelInit(); - SpringApplication.run(PigSentinelApplication.class, args); - } - - private static void triggerSentinelInit() { - new Thread(() -> InitExecutor.doInit()).start(); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/AuthAction.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/AuthAction.java deleted file mode 100644 index 484540b0..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/AuthAction.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.auth; - -import java.lang.annotation.*; - -/** - * @author lkxiaolou 无改动 - * @since 1.7.1 - */ -@Retention(RetentionPolicy.RUNTIME) -@Documented -@Target({ ElementType.METHOD }) -public @interface AuthAction { - - /** - * @return the privilege type - */ - AuthService.PrivilegeType value(); - - /** - * @return the target name to control - */ - String targetName() default "app"; - - /** - * @return the message when permission is denied - */ - String message() default "Permission denied"; - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/AuthService.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/AuthService.java deleted file mode 100644 index fe7ee7f8..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/AuthService.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.auth; - -/** - * Interface for authentication and authorization. 不需要改 - * - * @author Carpenter Lee - * @since 1.5.0 - */ -public interface AuthService { - - /** - * Get the authentication user. - * @param request the request contains the user information - * @return the auth user represent the current user, when the user is illegal, a null - * value will return. - */ - AuthUser getAuthUser(R request); - - /** - * Privilege type. - */ - enum PrivilegeType { - - /** - * Read rule - */ - READ_RULE, - /** - * Create or modify rule - */ - WRITE_RULE, - /** - * Delete rule - */ - DELETE_RULE, - /** - * Read metrics - */ - READ_METRIC, - /** - * Add machine - */ - ADD_MACHINE, - /** - * All privileges above are granted. - */ - ALL - - } - - /** - * Represents the current user. - */ - interface AuthUser { - - /** - * Query whether current user has the specific privilege to the target, the target - * may be an app name or an ip address, or other destination. - *

- * This method will use return value to represent whether user has the specific - * privileges to the target, but to throw a RuntimeException to represent no auth - * is also a good way. - *

- * @param target the target to check - * @param privilegeType the privilege type to check - * @return if current user has the specific privileges to the target, return true, - * otherwise return false. - */ - boolean authTarget(String target, PrivilegeType privilegeType); - - /** - * Check whether current user is a super-user. - * @return if current user is super user return true, else return false. - */ - boolean isSuperUser(); - - /** - * Get current user's nick name. - * @return current user's nick name. - */ - String getNickName(); - - /** - * Get current user's login name. - * @return current user's login name. - */ - String getLoginName(); - - /** - * Get current user's ID. - * @return ID of current user - */ - String getId(); - - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/AuthorizationInterceptor.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/AuthorizationInterceptor.java deleted file mode 100644 index b527ce7c..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/AuthorizationInterceptor.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.auth; - -import org.springframework.web.servlet.HandlerInterceptor; - -/** - * The web interceptor for privilege-based authorization. 不需要改 - * - * @author lkxiaolou - * @author wxq - * @since 1.7.1 - */ -public interface AuthorizationInterceptor extends HandlerInterceptor { - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/DefaultAuthorizationInterceptor.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/DefaultAuthorizationInterceptor.java deleted file mode 100644 index 56c537c0..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/DefaultAuthorizationInterceptor.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.auth; - -import com.alibaba.csp.sentinel.dashboard.domain.Result; -import com.alibaba.fastjson.JSON; -import org.springframework.web.method.HandlerMethod; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.lang.reflect.Method; - -/** - * The web interceptor for privilege-based authorization. 不需要 - *

- * move from old {@link AuthorizationInterceptor}. - * - * @author lkxiaolou - * @author wxq - * @since 1.7.1 - */ -public class DefaultAuthorizationInterceptor implements AuthorizationInterceptor { - - private final AuthService authService; - - public DefaultAuthorizationInterceptor(AuthService authService) { - this.authService = authService; - } - - @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) - throws Exception { - if (handler.getClass().isAssignableFrom(HandlerMethod.class)) { - Method method = ((HandlerMethod) handler).getMethod(); - - AuthAction authAction = method.getAnnotation(AuthAction.class); - if (authAction != null) { - AuthService.AuthUser authUser = authService.getAuthUser(request); - if (authUser == null) { - responseNoPrivilegeMsg(response, authAction.message()); - return false; - } - String target = request.getParameter(authAction.targetName()); - - if (!authUser.authTarget(target, authAction.value())) { - responseNoPrivilegeMsg(response, authAction.message()); - return false; - } - } - } - - return true; - } - - private void responseNoPrivilegeMsg(HttpServletResponse response, String message) throws IOException { - Result result = Result.ofFail(-1, message); - response.addHeader("Content-Type", "application/json;charset=UTF-8"); - response.getOutputStream().write(JSON.toJSONBytes(result)); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/DefaultLoginAuthenticationFilter.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/DefaultLoginAuthenticationFilter.java deleted file mode 100644 index af8c6a3d..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/DefaultLoginAuthenticationFilter.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.auth; - -import org.apache.commons.lang.StringUtils; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpStatus; -import org.springframework.util.AntPathMatcher; - -import javax.servlet.*; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.List; - -/** - *

- * The Servlet filter for authentication. - *

- * - *

- * Note: some urls are excluded as they needn't auth, such as: - *

- *
    - *
  • index url: {@code /}
  • - *
  • authentication request url: {@code /login}, {@code /logout}
  • - *
  • machine registry: {@code /registry/machine}
  • - *
  • static resources
  • - *
- *

- * The excluded urls and urlSuffixes could be configured in {@code application.properties} - * file. - * - * @author cdfive 不需要 - * @since 1.6.0 - */ -public class DefaultLoginAuthenticationFilter implements LoginAuthenticationFilter { - - private static final AntPathMatcher PATH_MATCHER = new AntPathMatcher(); - - private static final String URL_SUFFIX_DOT = "."; - - /** - * 忽略鉴权的url - */ - @Value("#{'${auth.filter.exclude-urls}'.split(',')}") - private List authFilterExcludeUrls; - - /** - * 根据后缀不需要鉴权的url - */ - @Value("#{'${auth.filter.exclude-url-suffixes}'.split(',')}") - private List authFilterExcludeUrlSuffixes; - - /** - * Authentication using AuthService interface. - */ - private final AuthService authService; - - public DefaultLoginAuthenticationFilter(AuthService authService) { - this.authService = authService; - } - - @Override - public void init(FilterConfig filterConfig) throws ServletException { - - } - - @Override - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) - throws IOException, ServletException { - HttpServletRequest httpRequest = (HttpServletRequest) request; - - String servletPath = httpRequest.getServletPath(); - - // Exclude the urls which needn't auth - boolean authFilterExcludeMatch = authFilterExcludeUrls.stream() - .anyMatch(authFilterExcludeUrl -> PATH_MATCHER.match(authFilterExcludeUrl, servletPath)); - if (authFilterExcludeMatch) { - chain.doFilter(request, response); - return; - } - - // Exclude the urls with suffixes which needn't auth - for (String authFilterExcludeUrlSuffix : authFilterExcludeUrlSuffixes) { - if (StringUtils.isBlank(authFilterExcludeUrlSuffix)) { - continue; - } - - // Add . for url suffix so that we needn't add . in property file - if (!authFilterExcludeUrlSuffix.startsWith(URL_SUFFIX_DOT)) { - authFilterExcludeUrlSuffix = URL_SUFFIX_DOT + authFilterExcludeUrlSuffix; - } - - if (servletPath.endsWith(authFilterExcludeUrlSuffix)) { - chain.doFilter(request, response); - return; - } - } - - AuthService.AuthUser authUser = authService.getAuthUser(httpRequest); - - HttpServletResponse httpResponse = (HttpServletResponse) response; - if (authUser == null) { - // If auth fail, set response status code to 401 - httpResponse.setStatus(HttpStatus.UNAUTHORIZED.value()); - } - else { - chain.doFilter(request, response); - } - } - - @Override - public void destroy() { - - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/FakeAuthServiceImpl.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/FakeAuthServiceImpl.java deleted file mode 100644 index 73c568e1..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/FakeAuthServiceImpl.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.auth; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.http.HttpServletRequest; - -/** - * A fake AuthService implementation, which will pass all user auth checking. - * - * @author Carpenter Lee - * @since 1.5.0 - */ -public class FakeAuthServiceImpl implements AuthService { - - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - public FakeAuthServiceImpl() { - this.logger.warn("there is no auth, use {} by implementation {}", AuthService.class, this.getClass()); - } - - @Override - public AuthUser getAuthUser(HttpServletRequest request) { - return new AuthUserImpl(); - } - - static final class AuthUserImpl implements AuthUser { - - @Override - public boolean authTarget(String target, PrivilegeType privilegeType) { - // fake implementation, always return true - return true; - } - - @Override - public boolean isSuperUser() { - // fake implementation, always return true - return true; - } - - @Override - public String getNickName() { - return "FAKE_NICK_NAME"; - } - - @Override - public String getLoginName() { - return "FAKE_LOGIN_NAME"; - } - - @Override - public String getId() { - return "FAKE_EMP_ID"; - } - - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/LoginAuthenticationFilter.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/LoginAuthenticationFilter.java deleted file mode 100644 index b44f1119..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/LoginAuthenticationFilter.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.auth; - -import javax.servlet.Filter; - -/** - *

- * The Servlet filter for authentication. - *

- * - *

- * Note: some urls are excluded as they needn't auth, such as: - *

- *
    - *
  • index url: {@code /}
  • - *
  • authentication request url: {@code /login}, {@code /logout}
  • - *
  • machine registry: {@code /registry/machine}
  • - *
  • static resources
  • - *
- *

- * The excluded urls and urlSuffixes could be configured in {@code application.properties} - * file. - * - * @author cdfive 不需要 - * @author wxq - * @since 1.6.0 - */ -public interface LoginAuthenticationFilter extends Filter { - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/SimpleWebAuthServiceImpl.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/SimpleWebAuthServiceImpl.java deleted file mode 100644 index 6bcfb354..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/auth/SimpleWebAuthServiceImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.auth; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; - -/** - * @author cdfive 不需要 - * @since 1.6.0 - */ -public class SimpleWebAuthServiceImpl implements AuthService { - - public static final String WEB_SESSION_KEY = "session_sentinel_admin"; - - @Override - public AuthUser getAuthUser(HttpServletRequest request) { - HttpSession session = request.getSession(); - Object sentinelUserObj = session.getAttribute(SimpleWebAuthServiceImpl.WEB_SESSION_KEY); - if (sentinelUserObj != null && sentinelUserObj instanceof AuthUser) { - return (AuthUser) sentinelUserObj; - } - - return null; - } - - public static final class SimpleWebAuthUserImpl implements AuthUser { - - private String username; - - public SimpleWebAuthUserImpl(String username) { - this.username = username; - } - - @Override - public boolean authTarget(String target, PrivilegeType privilegeType) { - return true; - } - - @Override - public boolean isSuperUser() { - return true; - } - - @Override - public String getNickName() { - return username; - } - - @Override - public String getLoginName() { - return username; - } - - @Override - public String getId() { - return username; - } - - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/client/CommandFailedException.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/client/CommandFailedException.java deleted file mode 100644 index 7408a6b2..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/client/CommandFailedException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.client; - -/** - * @author Eric Zhao - */ -public class CommandFailedException extends RuntimeException { - - public CommandFailedException() { - } - - public CommandFailedException(String message) { - super(message); - } - - @Override - public synchronized Throwable fillInStackTrace() { - return this; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/client/CommandNotFoundException.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/client/CommandNotFoundException.java deleted file mode 100644 index 375af110..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/client/CommandNotFoundException.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.client; - -/** - * @author Eric Zhao - * @since 0.2.1 - */ -public class CommandNotFoundException extends Exception { - - public CommandNotFoundException() { - } - - public CommandNotFoundException(String message) { - super(message); - } - - @Override - public synchronized Throwable fillInStackTrace() { - return this; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/client/SentinelApiClient.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/client/SentinelApiClient.java deleted file mode 100644 index 821727f5..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/client/SentinelApiClient.java +++ /dev/null @@ -1,888 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.client; - -import com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayFlowRule; -import com.alibaba.csp.sentinel.command.CommandConstants; -import com.alibaba.csp.sentinel.command.vo.NodeVo; -import com.alibaba.csp.sentinel.config.SentinelConfig; -import com.alibaba.csp.sentinel.dashboard.datasource.entity.SentinelVersion; -import com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway.ApiDefinitionEntity; -import com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway.GatewayFlowRuleEntity; -import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.*; -import com.alibaba.csp.sentinel.dashboard.discovery.AppManagement; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterClientInfoVO; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ClusterClientConfig; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerTransportConfig; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterServerStateVO; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterStateSimpleEntity; -import com.alibaba.csp.sentinel.dashboard.util.AsyncUtils; -import com.alibaba.csp.sentinel.dashboard.util.VersionUtils; -import com.alibaba.csp.sentinel.slots.block.Rule; -import com.alibaba.csp.sentinel.slots.block.authority.AuthorityRule; -import com.alibaba.csp.sentinel.slots.block.degrade.DegradeRule; -import com.alibaba.csp.sentinel.slots.block.flow.FlowRule; -import com.alibaba.csp.sentinel.slots.block.flow.param.ParamFlowRule; -import com.alibaba.csp.sentinel.slots.system.SystemRule; -import com.alibaba.csp.sentinel.util.AssertUtil; -import com.alibaba.csp.sentinel.util.StringUtil; -import com.alibaba.fastjson.JSON; -import org.apache.http.Consts; -import org.apache.http.HttpResponse; -import org.apache.http.NameValuePair; -import org.apache.http.client.entity.UrlEncodedFormEntity; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpUriRequest; -import org.apache.http.client.utils.URLEncodedUtils; -import org.apache.http.concurrent.FutureCallback; -import org.apache.http.entity.ContentType; -import org.apache.http.impl.client.DefaultRedirectStrategy; -import org.apache.http.impl.nio.client.CloseableHttpAsyncClient; -import org.apache.http.impl.nio.client.HttpAsyncClients; -import org.apache.http.impl.nio.reactor.IOReactorConfig; -import org.apache.http.message.BasicNameValuePair; -import org.apache.http.util.EntityUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.lang.Nullable; -import org.springframework.stereotype.Component; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.nio.charset.Charset; -import java.util.*; -import java.util.Map.Entry; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; -import java.util.stream.Collectors; - -/** - * Communicate with Sentinel client. - * - * @author leyou - */ -@Component -public class SentinelApiClient { - - private static Logger logger = LoggerFactory.getLogger(SentinelApiClient.class); - - private static final Charset DEFAULT_CHARSET = Charset.forName(SentinelConfig.charset()); - - private static final String HTTP_HEADER_CONTENT_TYPE = "Content-Type"; - - private static final String HTTP_HEADER_CONTENT_TYPE_URLENCODED = ContentType.create(URLEncodedUtils.CONTENT_TYPE) - .toString(); - - private static final String RESOURCE_URL_PATH = "jsonTree"; - - private static final String CLUSTER_NODE_PATH = "clusterNode"; - - private static final String GET_RULES_PATH = "getRules"; - - private static final String SET_RULES_PATH = "setRules"; - - private static final String GET_PARAM_RULE_PATH = "getParamFlowRules"; - - private static final String SET_PARAM_RULE_PATH = "setParamFlowRules"; - - private static final String FETCH_CLUSTER_MODE_PATH = "getClusterMode"; - - private static final String MODIFY_CLUSTER_MODE_PATH = "setClusterMode"; - - private static final String FETCH_CLUSTER_CLIENT_CONFIG_PATH = "cluster/client/fetchConfig"; - - private static final String MODIFY_CLUSTER_CLIENT_CONFIG_PATH = "cluster/client/modifyConfig"; - - private static final String FETCH_CLUSTER_SERVER_BASIC_INFO_PATH = "cluster/server/info"; - - private static final String MODIFY_CLUSTER_SERVER_TRANSPORT_CONFIG_PATH = "cluster/server/modifyTransportConfig"; - - private static final String MODIFY_CLUSTER_SERVER_FLOW_CONFIG_PATH = "cluster/server/modifyFlowConfig"; - - private static final String MODIFY_CLUSTER_SERVER_NAMESPACE_SET_PATH = "cluster/server/modifyNamespaceSet"; - - private static final String FETCH_GATEWAY_API_PATH = "gateway/getApiDefinitions"; - - private static final String MODIFY_GATEWAY_API_PATH = "gateway/updateApiDefinitions"; - - private static final String FETCH_GATEWAY_FLOW_RULE_PATH = "gateway/getRules"; - - private static final String MODIFY_GATEWAY_FLOW_RULE_PATH = "gateway/updateRules"; - - private static final String FLOW_RULE_TYPE = "flow"; - - private static final String DEGRADE_RULE_TYPE = "degrade"; - - private static final String SYSTEM_RULE_TYPE = "system"; - - private static final String AUTHORITY_TYPE = "authority"; - - private CloseableHttpAsyncClient httpClient; - - private static final SentinelVersion version160 = new SentinelVersion(1, 6, 0); - - private static final SentinelVersion version171 = new SentinelVersion(1, 7, 1); - - @Autowired - private AppManagement appManagement; - - public SentinelApiClient() { - IOReactorConfig ioConfig = IOReactorConfig.custom() - .setConnectTimeout(3000) - .setSoTimeout(10000) - .setIoThreadCount(Runtime.getRuntime().availableProcessors() * 2) - .build(); - httpClient = HttpAsyncClients.custom().setRedirectStrategy(new DefaultRedirectStrategy() { - @Override - protected boolean isRedirectable(final String method) { - return false; - } - }).setMaxConnTotal(4000).setMaxConnPerRoute(1000).setDefaultIOReactorConfig(ioConfig).build(); - httpClient.start(); - } - - private boolean isSuccess(int statusCode) { - return statusCode >= 200 && statusCode < 300; - } - - private boolean isCommandNotFound(int statusCode, String body) { - return statusCode == 400 && StringUtil.isNotEmpty(body) - && body.contains(CommandConstants.MSG_UNKNOWN_COMMAND_PREFIX); - } - - protected boolean isSupportPost(String app, String ip, int port) { - return StringUtil.isNotEmpty(app) && Optional.ofNullable(appManagement.getDetailApp(app)) - .flatMap(e -> e.getMachine(ip, port)) - .flatMap(m -> VersionUtils.parseVersion(m.getVersion()).map(v -> v.greaterOrEqual(version160))) - .orElse(false); - } - - /** - * Check whether target instance (identified by tuple of app-ip:port) supports the - * form of "xxxxx; xx=xx" in "Content-Type" header. - * @param app target app name - * @param ip target node's address - * @param port target node's port - */ - protected boolean isSupportEnhancedContentType(String app, String ip, int port) { - return StringUtil.isNotEmpty(app) && Optional.ofNullable(appManagement.getDetailApp(app)) - .flatMap(e -> e.getMachine(ip, port)) - .flatMap(m -> VersionUtils.parseVersion(m.getVersion()).map(v -> v.greaterOrEqual(version171))) - .orElse(false); - } - - private StringBuilder queryString(Map params) { - StringBuilder queryStringBuilder = new StringBuilder(); - for (Entry entry : params.entrySet()) { - if (StringUtil.isEmpty(entry.getValue())) { - continue; - } - String name = urlEncode(entry.getKey()); - String value = urlEncode(entry.getValue()); - if (name != null && value != null) { - if (queryStringBuilder.length() > 0) { - queryStringBuilder.append('&'); - } - queryStringBuilder.append(name).append('=').append(value); - } - } - return queryStringBuilder; - } - - /** - * Build an `HttpUriRequest` in POST way. - * @param url - * @param params - * @param supportEnhancedContentType see - * {@link #isSupportEnhancedContentType(String, String, int)} - * @return - */ - protected static HttpUriRequest postRequest(String url, Map params, - boolean supportEnhancedContentType) { - HttpPost httpPost = new HttpPost(url); - if (params != null && params.size() > 0) { - List list = new ArrayList<>(params.size()); - for (Entry entry : params.entrySet()) { - list.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); - } - httpPost.setEntity(new UrlEncodedFormEntity(list, Consts.UTF_8)); - if (!supportEnhancedContentType) { - httpPost.setHeader(HTTP_HEADER_CONTENT_TYPE, HTTP_HEADER_CONTENT_TYPE_URLENCODED); - } - } - return httpPost; - } - - private String urlEncode(String str) { - try { - return URLEncoder.encode(str, DEFAULT_CHARSET.name()); - } - catch (UnsupportedEncodingException e) { - logger.info("encode string error: {}", str, e); - return null; - } - } - - private String getBody(HttpResponse response) throws Exception { - Charset charset = null; - try { - String contentTypeStr = response.getFirstHeader(HTTP_HEADER_CONTENT_TYPE).getValue(); - if (StringUtil.isNotEmpty(contentTypeStr)) { - ContentType contentType = ContentType.parse(contentTypeStr); - charset = contentType.getCharset(); - } - } - catch (Exception ignore) { - } - return EntityUtils.toString(response.getEntity(), charset != null ? charset : DEFAULT_CHARSET); - } - - /** - * With no param - * @param ip - * @param port - * @param api - * @return - */ - private CompletableFuture executeCommand(String ip, int port, String api, boolean useHttpPost) { - return executeCommand(ip, port, api, null, useHttpPost); - } - - /** - * No app specified, force to GET - * @param ip - * @param port - * @param api - * @param params - * @return - */ - private CompletableFuture executeCommand(String ip, int port, String api, Map params, - boolean useHttpPost) { - return executeCommand(null, ip, port, api, params, useHttpPost); - } - - /** - * Prefer to execute request using POST - * @param app - * @param ip - * @param port - * @param api - * @param params - * @return - */ - private CompletableFuture executeCommand(String app, String ip, int port, String api, - Map params, boolean useHttpPost) { - CompletableFuture future = new CompletableFuture<>(); - if (StringUtil.isBlank(ip) || StringUtil.isBlank(api)) { - future.completeExceptionally(new IllegalArgumentException("Bad URL or command name")); - return future; - } - StringBuilder urlBuilder = new StringBuilder(); - urlBuilder.append("http://"); - urlBuilder.append(ip).append(':').append(port).append('/').append(api); - if (params == null) { - params = Collections.emptyMap(); - } - if (!useHttpPost || !isSupportPost(app, ip, port)) { - // Using GET in older versions, append parameters after url - if (!params.isEmpty()) { - if (urlBuilder.indexOf("?") == -1) { - urlBuilder.append('?'); - } - else { - urlBuilder.append('&'); - } - urlBuilder.append(queryString(params)); - } - return executeCommand(new HttpGet(urlBuilder.toString())); - } - else { - // Using POST - return executeCommand( - postRequest(urlBuilder.toString(), params, isSupportEnhancedContentType(app, ip, port))); - } - } - - private CompletableFuture executeCommand(HttpUriRequest request) { - CompletableFuture future = new CompletableFuture<>(); - httpClient.execute(request, new FutureCallback() { - @Override - public void completed(final HttpResponse response) { - int statusCode = response.getStatusLine().getStatusCode(); - try { - String value = getBody(response); - if (isSuccess(statusCode)) { - future.complete(value); - } - else { - if (isCommandNotFound(statusCode, value)) { - future.completeExceptionally(new CommandNotFoundException(request.getURI().getPath())); - } - else { - future.completeExceptionally(new CommandFailedException(value)); - } - } - - } - catch (Exception ex) { - future.completeExceptionally(ex); - logger.error("HTTP request failed: {}", request.getURI().toString(), ex); - } - } - - @Override - public void failed(final Exception ex) { - future.completeExceptionally(ex); - logger.error("HTTP request failed: {}", request.getURI().toString(), ex); - } - - @Override - public void cancelled() { - future.complete(null); - } - }); - return future; - } - - public void close() throws Exception { - httpClient.close(); - } - - @Nullable - private CompletableFuture> fetchItemsAsync(String ip, int port, String api, String type, - Class ruleType) { - AssertUtil.notEmpty(ip, "Bad machine IP"); - AssertUtil.isTrue(port > 0, "Bad machine port"); - Map params = null; - if (StringUtil.isNotEmpty(type)) { - params = new HashMap<>(2); - params.put("type", type); - } - return executeCommand(ip, port, api, params, false).thenApply(json -> JSON.parseArray(json, ruleType)); - } - - @Nullable - private List fetchItems(String ip, int port, String api, String type, Class ruleType) { - try { - AssertUtil.notEmpty(ip, "Bad machine IP"); - AssertUtil.isTrue(port > 0, "Bad machine port"); - return fetchItemsAsync(ip, port, api, type, ruleType).get(); - } - catch (InterruptedException | ExecutionException e) { - logger.error("Error when fetching items from api: {} -> {}", api, type, e); - return null; - } - catch (Exception e) { - logger.error("Error when fetching items: {} -> {}", api, type, e); - return null; - } - } - - private List fetchRules(String ip, int port, String type, Class ruleType) { - return fetchItems(ip, port, GET_RULES_PATH, type, ruleType); - } - - private boolean setRules(String app, String ip, int port, String type, List entities) { - if (entities == null) { - return true; - } - try { - AssertUtil.notEmpty(app, "Bad app name"); - AssertUtil.notEmpty(ip, "Bad machine IP"); - AssertUtil.isTrue(port > 0, "Bad machine port"); - String data = JSON.toJSONString(entities.stream().map(r -> r.toRule()).collect(Collectors.toList())); - Map params = new HashMap<>(4); - params.put("type", type); - params.put("data", data); - String result = executeCommand(app, ip, port, SET_RULES_PATH, params, true).get(); - logger.info("setRules result: {}, type={}", result, type); - return true; - } - catch (InterruptedException e) { - logger.warn("setRules API failed: {}", type, e); - return false; - } - catch (ExecutionException e) { - logger.warn("setRules API failed: {}", type, e.getCause()); - return false; - } - catch (Exception e) { - logger.error("setRules API failed, type={}", type, e); - return false; - } - } - - private CompletableFuture setRulesAsync(String app, String ip, int port, String type, - List entities) { - try { - AssertUtil.notNull(entities, "rules cannot be null"); - AssertUtil.notEmpty(app, "Bad app name"); - AssertUtil.notEmpty(ip, "Bad machine IP"); - AssertUtil.isTrue(port > 0, "Bad machine port"); - String data = JSON.toJSONString(entities.stream().map(r -> r.toRule()).collect(Collectors.toList())); - Map params = new HashMap<>(4); - params.put("type", type); - params.put("data", data); - return executeCommand(app, ip, port, SET_RULES_PATH, params, true).thenCompose(r -> { - if ("success".equalsIgnoreCase(r.trim())) { - return CompletableFuture.completedFuture(null); - } - return AsyncUtils.newFailedFuture(new CommandFailedException(r)); - }); - } - catch (Exception e) { - logger.error("setRulesAsync API failed, type={}", type, e); - return AsyncUtils.newFailedFuture(e); - } - } - - public List fetchResourceOfMachine(String ip, int port, String type) { - return fetchItems(ip, port, RESOURCE_URL_PATH, type, NodeVo.class); - } - - /** - * Fetch cluster node. - * @param ip ip to fetch - * @param port port of the ip - * @param includeZero whether zero value should in the result list. - * @return - */ - public List fetchClusterNodeOfMachine(String ip, int port, boolean includeZero) { - String type = "notZero"; - if (includeZero) { - type = "zero"; - } - return fetchItems(ip, port, CLUSTER_NODE_PATH, type, NodeVo.class); - } - - public List fetchFlowRuleOfMachine(String app, String ip, int port) { - List rules = fetchRules(ip, port, FLOW_RULE_TYPE, FlowRule.class); - if (rules != null) { - return rules.stream() - .map(rule -> FlowRuleEntity.fromFlowRule(app, ip, port, rule)) - .collect(Collectors.toList()); - } - else { - return null; - } - } - - public List fetchDegradeRuleOfMachine(String app, String ip, int port) { - List rules = fetchRules(ip, port, DEGRADE_RULE_TYPE, DegradeRule.class); - if (rules != null) { - return rules.stream() - .map(rule -> DegradeRuleEntity.fromDegradeRule(app, ip, port, rule)) - .collect(Collectors.toList()); - } - else { - return null; - } - } - - public List fetchSystemRuleOfMachine(String app, String ip, int port) { - List rules = fetchRules(ip, port, SYSTEM_RULE_TYPE, SystemRule.class); - if (rules != null) { - return rules.stream() - .map(rule -> SystemRuleEntity.fromSystemRule(app, ip, port, rule)) - .collect(Collectors.toList()); - } - else { - return null; - } - } - - /** - * Fetch all parameter flow rules from provided machine. - * @param app application name - * @param ip machine client IP - * @param port machine client port - * @return all retrieved parameter flow rules - * @since 0.2.1 - */ - public CompletableFuture> fetchParamFlowRulesOfMachine(String app, String ip, int port) { - try { - AssertUtil.notEmpty(app, "Bad app name"); - AssertUtil.notEmpty(ip, "Bad machine IP"); - AssertUtil.isTrue(port > 0, "Bad machine port"); - return fetchItemsAsync(ip, port, GET_PARAM_RULE_PATH, null, ParamFlowRule.class) - .thenApply(rules -> rules.stream() - .map(e -> ParamFlowRuleEntity.fromParamFlowRule(app, ip, port, e)) - .collect(Collectors.toList())); - } - catch (Exception e) { - logger.error("Error when fetching parameter flow rules", e); - return AsyncUtils.newFailedFuture(e); - } - } - - /** - * Fetch all authority rules from provided machine. - * @param app application name - * @param ip machine client IP - * @param port machine client port - * @return all retrieved authority rules - * @since 0.2.1 - */ - public List fetchAuthorityRulesOfMachine(String app, String ip, int port) { - AssertUtil.notEmpty(app, "Bad app name"); - AssertUtil.notEmpty(ip, "Bad machine IP"); - AssertUtil.isTrue(port > 0, "Bad machine port"); - Map params = new HashMap<>(2); - params.put("type", AUTHORITY_TYPE); - List rules = fetchRules(ip, port, AUTHORITY_TYPE, AuthorityRule.class); - return Optional.ofNullable(rules) - .map(r -> r.stream() - .map(e -> AuthorityRuleEntity.fromAuthorityRule(app, ip, port, e)) - .collect(Collectors.toList())) - .orElse(null); - } - - /** - * set rules of the machine. rules == null will return immediately; rules.isEmpty() - * means setting the rules to empty. - * @param app - * @param ip - * @param port - * @param rules - * @return whether successfully set the rules. - */ - public boolean setFlowRuleOfMachine(String app, String ip, int port, List rules) { - return setRules(app, ip, port, FLOW_RULE_TYPE, rules); - } - - public CompletableFuture setFlowRuleOfMachineAsync(String app, String ip, int port, - List rules) { - return setRulesAsync(app, ip, port, FLOW_RULE_TYPE, rules); - } - - /** - * set rules of the machine. rules == null will return immediately; rules.isEmpty() - * means setting the rules to empty. - * @param app - * @param ip - * @param port - * @param rules - * @return whether successfully set the rules. - */ - public boolean setDegradeRuleOfMachine(String app, String ip, int port, List rules) { - return setRules(app, ip, port, DEGRADE_RULE_TYPE, rules); - } - - /** - * set rules of the machine. rules == null will return immediately; rules.isEmpty() - * means setting the rules to empty. - * @param app - * @param ip - * @param port - * @param rules - * @return whether successfully set the rules. - */ - public boolean setSystemRuleOfMachine(String app, String ip, int port, List rules) { - return setRules(app, ip, port, SYSTEM_RULE_TYPE, rules); - } - - public boolean setAuthorityRuleOfMachine(String app, String ip, int port, List rules) { - return setRules(app, ip, port, AUTHORITY_TYPE, rules); - } - - public CompletableFuture setParamFlowRuleOfMachine(String app, String ip, int port, - List rules) { - if (rules == null) { - return CompletableFuture.completedFuture(null); - } - if (StringUtil.isBlank(ip) || port <= 0) { - return AsyncUtils.newFailedFuture(new IllegalArgumentException("Invalid parameter")); - } - try { - String data = JSON - .toJSONString(rules.stream().map(ParamFlowRuleEntity::getRule).collect(Collectors.toList())); - Map params = new HashMap<>(2); - params.put("data", data); - return executeCommand(app, ip, port, SET_PARAM_RULE_PATH, params, true).thenCompose(e -> { - if (CommandConstants.MSG_SUCCESS.equals(e)) { - return CompletableFuture.completedFuture(null); - } - else { - logger.warn("Push parameter flow rules to client failed: " + e); - return AsyncUtils.newFailedFuture(new RuntimeException(e)); - } - }); - } - catch (Exception ex) { - logger.warn("Error when setting parameter flow rule", ex); - return AsyncUtils.newFailedFuture(ex); - } - } - - // Cluster related - - public CompletableFuture fetchClusterMode(String ip, int port) { - if (StringUtil.isBlank(ip) || port <= 0) { - return AsyncUtils.newFailedFuture(new IllegalArgumentException("Invalid parameter")); - } - try { - return executeCommand(ip, port, FETCH_CLUSTER_MODE_PATH, false) - .thenApply(r -> JSON.parseObject(r, ClusterStateSimpleEntity.class)); - } - catch (Exception ex) { - logger.warn("Error when fetching cluster mode", ex); - return AsyncUtils.newFailedFuture(ex); - } - } - - public CompletableFuture modifyClusterMode(String ip, int port, int mode) { - if (StringUtil.isBlank(ip) || port <= 0) { - return AsyncUtils.newFailedFuture(new IllegalArgumentException("Invalid parameter")); - } - try { - Map params = new HashMap<>(2); - params.put("mode", String.valueOf(mode)); - return executeCommand(ip, port, MODIFY_CLUSTER_MODE_PATH, params, false).thenCompose(e -> { - if (CommandConstants.MSG_SUCCESS.equals(e)) { - return CompletableFuture.completedFuture(null); - } - else { - logger.warn("Error when modifying cluster mode: " + e); - return AsyncUtils.newFailedFuture(new RuntimeException(e)); - } - }); - } - catch (Exception ex) { - logger.warn("Error when modifying cluster mode", ex); - return AsyncUtils.newFailedFuture(ex); - } - } - - public CompletableFuture fetchClusterClientInfoAndConfig(String ip, int port) { - if (StringUtil.isBlank(ip) || port <= 0) { - return AsyncUtils.newFailedFuture(new IllegalArgumentException("Invalid parameter")); - } - try { - return executeCommand(ip, port, FETCH_CLUSTER_CLIENT_CONFIG_PATH, false) - .thenApply(r -> JSON.parseObject(r, ClusterClientInfoVO.class)); - } - catch (Exception ex) { - logger.warn("Error when fetching cluster client config", ex); - return AsyncUtils.newFailedFuture(ex); - } - } - - public CompletableFuture modifyClusterClientConfig(String app, String ip, int port, - ClusterClientConfig config) { - if (StringUtil.isBlank(ip) || port <= 0) { - return AsyncUtils.newFailedFuture(new IllegalArgumentException("Invalid parameter")); - } - try { - Map params = new HashMap<>(2); - params.put("data", JSON.toJSONString(config)); - return executeCommand(app, ip, port, MODIFY_CLUSTER_CLIENT_CONFIG_PATH, params, true).thenCompose(e -> { - if (CommandConstants.MSG_SUCCESS.equals(e)) { - return CompletableFuture.completedFuture(null); - } - else { - logger.warn("Error when modifying cluster client config: " + e); - return AsyncUtils.newFailedFuture(new RuntimeException(e)); - } - }); - } - catch (Exception ex) { - logger.warn("Error when modifying cluster client config", ex); - return AsyncUtils.newFailedFuture(ex); - } - } - - public CompletableFuture modifyClusterServerFlowConfig(String app, String ip, int port, - ServerFlowConfig config) { - if (StringUtil.isBlank(ip) || port <= 0) { - return AsyncUtils.newFailedFuture(new IllegalArgumentException("Invalid parameter")); - } - try { - Map params = new HashMap<>(2); - params.put("data", JSON.toJSONString(config)); - return executeCommand(app, ip, port, MODIFY_CLUSTER_SERVER_FLOW_CONFIG_PATH, params, true) - .thenCompose(e -> { - if (CommandConstants.MSG_SUCCESS.equals(e)) { - return CompletableFuture.completedFuture(null); - } - else { - logger.warn("Error when modifying cluster server flow config: " + e); - return AsyncUtils.newFailedFuture(new RuntimeException(e)); - } - }); - } - catch (Exception ex) { - logger.warn("Error when modifying cluster server flow config", ex); - return AsyncUtils.newFailedFuture(ex); - } - } - - public CompletableFuture modifyClusterServerTransportConfig(String app, String ip, int port, - ServerTransportConfig config) { - if (StringUtil.isBlank(ip) || port <= 0) { - return AsyncUtils.newFailedFuture(new IllegalArgumentException("Invalid parameter")); - } - try { - Map params = new HashMap<>(4); - params.put("port", config.getPort().toString()); - params.put("idleSeconds", config.getIdleSeconds().toString()); - return executeCommand(app, ip, port, MODIFY_CLUSTER_SERVER_TRANSPORT_CONFIG_PATH, params, false) - .thenCompose(e -> { - if (CommandConstants.MSG_SUCCESS.equals(e)) { - return CompletableFuture.completedFuture(null); - } - else { - logger.warn("Error when modifying cluster server transport config: " + e); - return AsyncUtils.newFailedFuture(new RuntimeException(e)); - } - }); - } - catch (Exception ex) { - logger.warn("Error when modifying cluster server transport config", ex); - return AsyncUtils.newFailedFuture(ex); - } - } - - public CompletableFuture modifyClusterServerNamespaceSet(String app, String ip, int port, Set set) { - if (StringUtil.isBlank(ip) || port <= 0) { - return AsyncUtils.newFailedFuture(new IllegalArgumentException("Invalid parameter")); - } - try { - Map params = new HashMap<>(2); - params.put("data", JSON.toJSONString(set)); - return executeCommand(app, ip, port, MODIFY_CLUSTER_SERVER_NAMESPACE_SET_PATH, params, true) - .thenCompose(e -> { - if (CommandConstants.MSG_SUCCESS.equals(e)) { - return CompletableFuture.completedFuture(null); - } - else { - logger.warn("Error when modifying cluster server NamespaceSet", e); - return AsyncUtils.newFailedFuture(new RuntimeException(e)); - } - }); - } - catch (Exception ex) { - logger.warn("Error when modifying cluster server NamespaceSet", ex); - return AsyncUtils.newFailedFuture(ex); - } - } - - public CompletableFuture fetchClusterServerBasicInfo(String ip, int port) { - if (StringUtil.isBlank(ip) || port <= 0) { - return AsyncUtils.newFailedFuture(new IllegalArgumentException("Invalid parameter")); - } - try { - return executeCommand(ip, port, FETCH_CLUSTER_SERVER_BASIC_INFO_PATH, false) - .thenApply(r -> JSON.parseObject(r, ClusterServerStateVO.class)); - } - catch (Exception ex) { - logger.warn("Error when fetching cluster sever all config and basic info", ex); - return AsyncUtils.newFailedFuture(ex); - } - } - - public CompletableFuture> fetchApis(String app, String ip, int port) { - if (StringUtil.isBlank(ip) || port <= 0) { - return AsyncUtils.newFailedFuture(new IllegalArgumentException("Invalid parameter")); - } - - try { - return executeCommand(ip, port, FETCH_GATEWAY_API_PATH, false).thenApply(r -> { - List entities = JSON.parseArray(r, ApiDefinitionEntity.class); - if (entities != null) { - for (ApiDefinitionEntity entity : entities) { - entity.setApp(app); - entity.setIp(ip); - entity.setPort(port); - } - } - return entities; - }); - } - catch (Exception ex) { - logger.warn("Error when fetching gateway apis", ex); - return AsyncUtils.newFailedFuture(ex); - } - } - - public boolean modifyApis(String app, String ip, int port, List apis) { - if (apis == null) { - return true; - } - - try { - AssertUtil.notEmpty(app, "Bad app name"); - AssertUtil.notEmpty(ip, "Bad machine IP"); - AssertUtil.isTrue(port > 0, "Bad machine port"); - String data = JSON.toJSONString(apis.stream().map(r -> r.toApiDefinition()).collect(Collectors.toList())); - Map params = new HashMap<>(2); - params.put("data", data); - String result = executeCommand(app, ip, port, MODIFY_GATEWAY_API_PATH, params, true).get(); - logger.info("Modify gateway apis: {}", result); - return true; - } - catch (Exception e) { - logger.warn("Error when modifying gateway apis", e); - return false; - } - } - - public CompletableFuture> fetchGatewayFlowRules(String app, String ip, int port) { - if (StringUtil.isBlank(ip) || port <= 0) { - return AsyncUtils.newFailedFuture(new IllegalArgumentException("Invalid parameter")); - } - - try { - return executeCommand(ip, port, FETCH_GATEWAY_FLOW_RULE_PATH, false).thenApply(r -> { - List gatewayFlowRules = JSON.parseArray(r, GatewayFlowRule.class); - List entities = gatewayFlowRules.stream() - .map(rule -> GatewayFlowRuleEntity.fromGatewayFlowRule(app, ip, port, rule)) - .collect(Collectors.toList()); - return entities; - }); - } - catch (Exception ex) { - logger.warn("Error when fetching gateway flow rules", ex); - return AsyncUtils.newFailedFuture(ex); - } - } - - public boolean modifyGatewayFlowRules(String app, String ip, int port, List rules) { - if (rules == null) { - return true; - } - - try { - AssertUtil.notEmpty(app, "Bad app name"); - AssertUtil.notEmpty(ip, "Bad machine IP"); - AssertUtil.isTrue(port > 0, "Bad machine port"); - String data = JSON - .toJSONString(rules.stream().map(r -> r.toGatewayFlowRule()).collect(Collectors.toList())); - Map params = new HashMap<>(2); - params.put("data", data); - String result = executeCommand(app, ip, port, MODIFY_GATEWAY_FLOW_RULE_PATH, params, true).get(); - logger.info("Modify gateway flow rules: {}", result); - return true; - } - catch (Exception e) { - logger.warn("Error when modifying gateway apis", e); - return false; - } - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/config/AuthConfiguration.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/config/AuthConfiguration.java deleted file mode 100644 index 63ad89a2..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/config/AuthConfiguration.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.config; - -import com.alibaba.csp.sentinel.dashboard.auth.*; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import javax.servlet.http.HttpServletRequest; - -@Configuration -@EnableConfigurationProperties(AuthProperties.class) -public class AuthConfiguration { - - private final AuthProperties authProperties; - - public AuthConfiguration(AuthProperties authProperties) { - this.authProperties = authProperties; - } - - @Bean - @ConditionalOnMissingBean - public AuthService httpServletRequestAuthService() { - if (this.authProperties.isEnabled()) { - return new SimpleWebAuthServiceImpl(); - } - return new FakeAuthServiceImpl(); - } - - @Bean - @ConditionalOnMissingBean - public LoginAuthenticationFilter loginAuthenticationFilter( - AuthService httpServletRequestAuthService) { - return new DefaultLoginAuthenticationFilter(httpServletRequestAuthService); - } - - @Bean - @ConditionalOnMissingBean - public AuthorizationInterceptor authorizationInterceptor( - AuthService httpServletRequestAuthService) { - return new DefaultAuthorizationInterceptor(httpServletRequestAuthService); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/config/AuthProperties.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/config/AuthProperties.java deleted file mode 100644 index 961a857c..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/config/AuthProperties.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.config; - -import org.springframework.boot.context.properties.ConfigurationProperties; - -@ConfigurationProperties(prefix = "auth") -public class AuthProperties { - - private boolean enabled = true; - - public boolean isEnabled() { - return enabled; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/config/DashboardConfig.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/config/DashboardConfig.java deleted file mode 100644 index 1684e5f2..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/config/DashboardConfig.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.config; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.math.NumberUtils; -import org.springframework.lang.NonNull; - -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -/** - *

- * Dashboard local config support. - *

- *

- * Dashboard supports configuration loading by several ways by order:
- * 1. System.properties
- * 2. Env - *

- * - * @author jason - * @since 1.5.0 - */ -public class DashboardConfig { - - public static final int DEFAULT_MACHINE_HEALTHY_TIMEOUT_MS = 60_000; - - /** - * Login username - */ - public static final String CONFIG_AUTH_USERNAME = "sentinel.dashboard.auth.username"; - - /** - * Login password - */ - public static final String CONFIG_AUTH_PASSWORD = "sentinel.dashboard.auth.password"; - - /** - * Hide application name in sidebar when it has no healthy machines after specific - * period in millisecond. - */ - public static final String CONFIG_HIDE_APP_NO_MACHINE_MILLIS = "sentinel.dashboard.app.hideAppNoMachineMillis"; - - /** - * Remove application when it has no healthy machines after specific period in - * millisecond. - */ - public static final String CONFIG_REMOVE_APP_NO_MACHINE_MILLIS = "sentinel.dashboard.removeAppNoMachineMillis"; - - /** - * Timeout - */ - public static final String CONFIG_UNHEALTHY_MACHINE_MILLIS = "sentinel.dashboard.unhealthyMachineMillis"; - - /** - * Auto remove unhealthy machine after specific period in millisecond. - */ - public static final String CONFIG_AUTO_REMOVE_MACHINE_MILLIS = "sentinel.dashboard.autoRemoveMachineMillis"; - - private static final ConcurrentMap cacheMap = new ConcurrentHashMap<>(); - - @NonNull - private static String getConfig(String name) { - // env - String val = System.getenv(name); - if (StringUtils.isNotEmpty(val)) { - return val; - } - // properties - val = System.getProperty(name); - if (StringUtils.isNotEmpty(val)) { - return val; - } - return ""; - } - - protected static String getConfigStr(String name) { - if (cacheMap.containsKey(name)) { - return (String) cacheMap.get(name); - } - - String val = getConfig(name); - - if (StringUtils.isBlank(val)) { - return null; - } - - cacheMap.put(name, val); - return val; - } - - protected static int getConfigInt(String name, int defaultVal, int minVal) { - if (cacheMap.containsKey(name)) { - return (int) cacheMap.get(name); - } - int val = NumberUtils.toInt(getConfig(name)); - if (val == 0) { - val = defaultVal; - } - else if (val < minVal) { - val = minVal; - } - cacheMap.put(name, val); - return val; - } - - public static String getAuthUsername() { - return getConfigStr(CONFIG_AUTH_USERNAME); - } - - public static String getAuthPassword() { - return getConfigStr(CONFIG_AUTH_PASSWORD); - } - - public static int getHideAppNoMachineMillis() { - return getConfigInt(CONFIG_HIDE_APP_NO_MACHINE_MILLIS, 0, 60000); - } - - public static int getRemoveAppNoMachineMillis() { - return getConfigInt(CONFIG_REMOVE_APP_NO_MACHINE_MILLIS, 0, 120000); - } - - public static int getAutoRemoveMachineMillis() { - return getConfigInt(CONFIG_AUTO_REMOVE_MACHINE_MILLIS, 0, 300000); - } - - public static int getUnhealthyMachineMillis() { - return getConfigInt(CONFIG_UNHEALTHY_MACHINE_MILLIS, DEFAULT_MACHINE_HEALTHY_TIMEOUT_MS, 30000); - } - - public static void clearCache() { - cacheMap.clear(); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/config/WebConfig.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/config/WebConfig.java deleted file mode 100644 index 1ec063f9..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/config/WebConfig.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.config; - -import com.alibaba.csp.sentinel.adapter.servlet.CommonFilter; -import com.alibaba.csp.sentinel.adapter.servlet.callback.WebCallbackManager; -import com.alibaba.csp.sentinel.dashboard.auth.AuthorizationInterceptor; -import com.alibaba.csp.sentinel.dashboard.auth.LoginAuthenticationFilter; -import com.alibaba.csp.sentinel.util.StringUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.web.servlet.FilterRegistrationBean; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -import javax.annotation.PostConstruct; -import javax.servlet.Filter; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -/** - * @author leyou - */ -@Configuration -public class WebConfig implements WebMvcConfigurer { - - private final Logger logger = LoggerFactory.getLogger(WebConfig.class); - - @Autowired - private LoginAuthenticationFilter loginAuthenticationFilter; - - @Autowired - private AuthorizationInterceptor authorizationInterceptor; - - @Override - public void addInterceptors(InterceptorRegistry registry) { - registry.addInterceptor(authorizationInterceptor).addPathPatterns("/**"); - } - - @Override - public void addResourceHandlers(ResourceHandlerRegistry registry) { - registry.addResourceHandler("/**").addResourceLocations("classpath:/resources/"); - } - - @Override - public void addViewControllers(ViewControllerRegistry registry) { - registry.addViewController("/").setViewName("forward:/index.htm"); - } - - /** - * Add {@link CommonFilter} to the server, this is the simplest way to use Sentinel - * for Web application. - */ - @Bean - public FilterRegistrationBean sentinelFilterRegistration() { - FilterRegistrationBean registration = new FilterRegistrationBean<>(); - registration.setFilter(new CommonFilter()); - registration.addUrlPatterns("/*"); - registration.setName("sentinelFilter"); - registration.setOrder(1); - // If this is enabled, the entrance of all Web URL resources will be unified as a - // single context name. - // In most scenarios that's enough, and it could reduce the memory footprint. - registration.addInitParameter(CommonFilter.WEB_CONTEXT_UNIFY, "true"); - - logger.info("Sentinel servlet CommonFilter registered"); - - return registration; - } - - @PostConstruct - public void doInit() { - Set suffixSet = new HashSet<>(Arrays.asList(".js", ".css", ".html", ".ico", ".txt", ".woff", ".woff2")); - // Example: register a UrlCleaner to exclude URLs of common static resources. - WebCallbackManager.setUrlCleaner(url -> { - if (StringUtil.isEmpty(url)) { - return url; - } - if (suffixSet.stream().anyMatch(url::endsWith)) { - return null; - } - return url; - }); - } - - @Bean - public FilterRegistrationBean authenticationFilterRegistration() { - FilterRegistrationBean registration = new FilterRegistrationBean<>(); - registration.setFilter(loginAuthenticationFilter); - registration.addUrlPatterns("/*"); - registration.setName("authenticationFilter"); - registration.setOrder(0); - return registration; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/AppController.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/AppController.java deleted file mode 100644 index 1efc019e..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/AppController.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.controller; - -import com.alibaba.csp.sentinel.dashboard.discovery.AppInfo; -import com.alibaba.csp.sentinel.dashboard.discovery.AppManagement; -import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo; -import com.alibaba.csp.sentinel.dashboard.domain.Result; -import com.alibaba.csp.sentinel.dashboard.domain.vo.MachineInfoVo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -/** - * @author Carpenter Lee - */ -@RestController -@RequestMapping(value = "/app") -public class AppController { - - @Autowired - private AppManagement appManagement; - - @GetMapping("/names.json") - public Result> queryApps(HttpServletRequest request) { - return Result.ofSuccess(appManagement.getAppNames()); - } - - @GetMapping("/briefinfos.json") - public Result> queryAppInfos(HttpServletRequest request) { - List list = new ArrayList<>(appManagement.getBriefApps()); - Collections.sort(list, Comparator.comparing(AppInfo::getApp)); - return Result.ofSuccess(list); - } - - @GetMapping(value = "/{app}/machines.json") - public Result> getMachinesByApp(@PathVariable("app") String app) { - AppInfo appInfo = appManagement.getDetailApp(app); - if (appInfo == null) { - return Result.ofSuccess(null); - } - List list = new ArrayList<>(appInfo.getMachines()); - Collections.sort(list, - Comparator.comparing(MachineInfo::getApp) - .thenComparing(MachineInfo::getIp) - .thenComparingInt(MachineInfo::getPort)); - return Result.ofSuccess(MachineInfoVo.fromMachineInfoList(list)); - } - - @RequestMapping(value = "/{app}/machine/remove.json") - public Result removeMachineById(@PathVariable("app") String app, @RequestParam(name = "ip") String ip, - @RequestParam(name = "port") int port) { - AppInfo appInfo = appManagement.getDetailApp(app); - if (appInfo == null) { - return Result.ofSuccess(null); - } - if (appManagement.removeMachine(app, ip, port)) { - return Result.ofSuccessMsg("success"); - } - else { - return Result.ofFail(1, "remove failed"); - } - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/AuthController.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/AuthController.java deleted file mode 100644 index 0954f38a..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/AuthController.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.controller; - -import com.alibaba.csp.sentinel.dashboard.auth.AuthService; -import com.alibaba.csp.sentinel.dashboard.auth.SimpleWebAuthServiceImpl; -import com.alibaba.csp.sentinel.dashboard.config.DashboardConfig; -import com.alibaba.csp.sentinel.dashboard.domain.Result; -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.servlet.http.HttpServletRequest; - -/** - * @author cdfive - * @since 1.6.0 - */ -@RestController -@RequestMapping("/auth") -public class AuthController { - - private static final Logger LOGGER = LoggerFactory.getLogger(AuthController.class); - - @Value("${auth.username:sentinel}") - private String authUsername; - - @Value("${auth.password:sentinel}") - private String authPassword; - - @Autowired - private AuthService authService; - - @PostMapping("/login") - public Result login(HttpServletRequest request, String username, String password) { - if (StringUtils.isNotBlank(DashboardConfig.getAuthUsername())) { - authUsername = DashboardConfig.getAuthUsername(); - } - - if (StringUtils.isNotBlank(DashboardConfig.getAuthPassword())) { - authPassword = DashboardConfig.getAuthPassword(); - } - - /* - * If auth.username or auth.password is blank(set in application.properties or VM - * arguments), auth will pass, as the front side validate the input which can't be - * blank, so user can input any username or password(both are not blank) to login - * in that case. - */ - if (StringUtils.isNotBlank(authUsername) && !authUsername.equals(username) - || StringUtils.isNotBlank(authPassword) && !authPassword.equals(password)) { - LOGGER.error("Login failed: Invalid username or password, username=" + username); - return Result.ofFail(-1, "Invalid username or password"); - } - - AuthService.AuthUser authUser = new SimpleWebAuthServiceImpl.SimpleWebAuthUserImpl(username); - request.getSession().setAttribute(SimpleWebAuthServiceImpl.WEB_SESSION_KEY, authUser); - return Result.ofSuccess(authUser); - } - - @PostMapping(value = "/logout") - public Result logout(HttpServletRequest request) { - request.getSession().invalidate(); - return Result.ofSuccess(null); - } - - @PostMapping(value = "/check") - public Result check(HttpServletRequest request) { - AuthService.AuthUser authUser = authService.getAuthUser(request); - if (authUser == null) { - return Result.ofFail(-1, "Not logged in"); - } - return Result.ofSuccess(authUser); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/AuthorityRuleController.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/AuthorityRuleController.java deleted file mode 100644 index 1d14a88d..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/AuthorityRuleController.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.controller; - -import com.alibaba.csp.sentinel.dashboard.auth.AuthAction; -import com.alibaba.csp.sentinel.dashboard.auth.AuthService.PrivilegeType; -import com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient; -import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.AuthorityRuleEntity; -import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo; -import com.alibaba.csp.sentinel.dashboard.domain.Result; -import com.alibaba.csp.sentinel.dashboard.repository.rule.RuleRepository; -import com.alibaba.csp.sentinel.slots.block.RuleConstant; -import com.alibaba.csp.sentinel.util.StringUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.Date; -import java.util.List; - -/** - * @author Eric Zhao - * @since 0.2.1 - */ -@RestController -@RequestMapping(value = "/authority") -public class AuthorityRuleController { - - private final Logger logger = LoggerFactory.getLogger(AuthorityRuleController.class); - - @Autowired - private SentinelApiClient sentinelApiClient; - - @Autowired - private RuleRepository repository; - - @GetMapping("/rules") - @AuthAction(PrivilegeType.READ_RULE) - public Result> apiQueryAllRulesForMachine(@RequestParam String app, - @RequestParam String ip, @RequestParam Integer port) { - if (StringUtil.isEmpty(app)) { - return Result.ofFail(-1, "app cannot be null or empty"); - } - if (StringUtil.isEmpty(ip)) { - return Result.ofFail(-1, "ip cannot be null or empty"); - } - if (port == null || port <= 0) { - return Result.ofFail(-1, "Invalid parameter: port"); - } - try { - List rules = sentinelApiClient.fetchAuthorityRulesOfMachine(app, ip, port); - rules = repository.saveAll(rules); - return Result.ofSuccess(rules); - } - catch (Throwable throwable) { - logger.error("Error when querying authority rules", throwable); - return Result.ofFail(-1, throwable.getMessage()); - } - } - - private Result checkEntityInternal(AuthorityRuleEntity entity) { - if (entity == null) { - return Result.ofFail(-1, "bad rule body"); - } - if (StringUtil.isBlank(entity.getApp())) { - return Result.ofFail(-1, "app can't be null or empty"); - } - if (StringUtil.isBlank(entity.getIp())) { - return Result.ofFail(-1, "ip can't be null or empty"); - } - if (entity.getPort() == null || entity.getPort() <= 0) { - return Result.ofFail(-1, "port can't be null"); - } - if (entity.getRule() == null) { - return Result.ofFail(-1, "rule can't be null"); - } - if (StringUtil.isBlank(entity.getResource())) { - return Result.ofFail(-1, "resource name cannot be null or empty"); - } - if (StringUtil.isBlank(entity.getLimitApp())) { - return Result.ofFail(-1, "limitApp should be valid"); - } - if (entity.getStrategy() != RuleConstant.AUTHORITY_WHITE - && entity.getStrategy() != RuleConstant.AUTHORITY_BLACK) { - return Result.ofFail(-1, "Unknown strategy (must be blacklist or whitelist)"); - } - return null; - } - - @PostMapping("/rule") - @AuthAction(PrivilegeType.WRITE_RULE) - public Result apiAddAuthorityRule(@RequestBody AuthorityRuleEntity entity) { - Result checkResult = checkEntityInternal(entity); - if (checkResult != null) { - return checkResult; - } - entity.setId(null); - Date date = new Date(); - entity.setGmtCreate(date); - entity.setGmtModified(date); - try { - entity = repository.save(entity); - } - catch (Throwable throwable) { - logger.error("Failed to add authority rule", throwable); - return Result.ofThrowable(-1, throwable); - } - if (!publishRules(entity.getApp(), entity.getIp(), entity.getPort())) { - logger.info("Publish authority rules failed after rule add"); - } - return Result.ofSuccess(entity); - } - - @PutMapping("/rule/{id}") - @AuthAction(PrivilegeType.WRITE_RULE) - public Result apiUpdateParamFlowRule(@PathVariable("id") Long id, - @RequestBody AuthorityRuleEntity entity) { - if (id == null || id <= 0) { - return Result.ofFail(-1, "Invalid id"); - } - Result checkResult = checkEntityInternal(entity); - if (checkResult != null) { - return checkResult; - } - entity.setId(id); - Date date = new Date(); - entity.setGmtCreate(null); - entity.setGmtModified(date); - try { - entity = repository.save(entity); - if (entity == null) { - return Result.ofFail(-1, "Failed to save authority rule"); - } - } - catch (Throwable throwable) { - logger.error("Failed to save authority rule", throwable); - return Result.ofThrowable(-1, throwable); - } - if (!publishRules(entity.getApp(), entity.getIp(), entity.getPort())) { - logger.info("Publish authority rules failed after rule update"); - } - return Result.ofSuccess(entity); - } - - @DeleteMapping("/rule/{id}") - @AuthAction(PrivilegeType.DELETE_RULE) - public Result apiDeleteRule(@PathVariable("id") Long id) { - if (id == null) { - return Result.ofFail(-1, "id cannot be null"); - } - AuthorityRuleEntity oldEntity = repository.findById(id); - if (oldEntity == null) { - return Result.ofSuccess(null); - } - try { - repository.delete(id); - } - catch (Exception e) { - return Result.ofFail(-1, e.getMessage()); - } - if (!publishRules(oldEntity.getApp(), oldEntity.getIp(), oldEntity.getPort())) { - logger.error("Publish authority rules failed after rule delete"); - } - return Result.ofSuccess(id); - } - - private boolean publishRules(String app, String ip, Integer port) { - List rules = repository.findAllByMachine(MachineInfo.of(app, ip, port)); - return sentinelApiClient.setAuthorityRuleOfMachine(app, ip, port, rules); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/DegradeController.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/DegradeController.java deleted file mode 100644 index 3c0cc843..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/DegradeController.java +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.controller; - -import com.alibaba.csp.sentinel.dashboard.auth.AuthAction; -import com.alibaba.csp.sentinel.dashboard.auth.AuthService.PrivilegeType; -import com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient; -import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.DegradeRuleEntity; -import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo; -import com.alibaba.csp.sentinel.dashboard.domain.Result; -import com.alibaba.csp.sentinel.dashboard.repository.rule.RuleRepository; -import com.alibaba.csp.sentinel.slots.block.RuleConstant; -import com.alibaba.csp.sentinel.slots.block.degrade.circuitbreaker.CircuitBreakerStrategy; -import com.alibaba.csp.sentinel.util.StringUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.Date; -import java.util.List; - -/** - * Controller regarding APIs of degrade rules. Refactored since 1.8.0. - * - * @author Carpenter Lee - * @author Eric Zhao - */ -@RestController -@RequestMapping("/degrade") -public class DegradeController { - - private final Logger logger = LoggerFactory.getLogger(DegradeController.class); - - @Autowired - private RuleRepository repository; - - @Autowired - private SentinelApiClient sentinelApiClient; - - @GetMapping("/rules.json") - @AuthAction(PrivilegeType.READ_RULE) - public Result> apiQueryMachineRules(String app, String ip, Integer port) { - if (StringUtil.isEmpty(app)) { - return Result.ofFail(-1, "app can't be null or empty"); - } - if (StringUtil.isEmpty(ip)) { - return Result.ofFail(-1, "ip can't be null or empty"); - } - if (port == null) { - return Result.ofFail(-1, "port can't be null"); - } - try { - List rules = sentinelApiClient.fetchDegradeRuleOfMachine(app, ip, port); - rules = repository.saveAll(rules); - return Result.ofSuccess(rules); - } - catch (Throwable throwable) { - logger.error("queryApps error:", throwable); - return Result.ofThrowable(-1, throwable); - } - } - - @PostMapping("/rule") - @AuthAction(PrivilegeType.WRITE_RULE) - public Result apiAddRule(@RequestBody DegradeRuleEntity entity) { - Result checkResult = checkEntityInternal(entity); - if (checkResult != null) { - return checkResult; - } - Date date = new Date(); - entity.setGmtCreate(date); - entity.setGmtModified(date); - try { - entity = repository.save(entity); - } - catch (Throwable t) { - logger.error("Failed to add new degrade rule, app={}, ip={}", entity.getApp(), entity.getIp(), t); - return Result.ofThrowable(-1, t); - } - if (!publishRules(entity.getApp(), entity.getIp(), entity.getPort())) { - logger.warn("Publish degrade rules failed, app={}", entity.getApp()); - } - return Result.ofSuccess(entity); - } - - @PutMapping("/rule/{id}") - @AuthAction(PrivilegeType.WRITE_RULE) - public Result apiUpdateRule(@PathVariable("id") Long id, @RequestBody DegradeRuleEntity entity) { - if (id == null || id <= 0) { - return Result.ofFail(-1, "id can't be null or negative"); - } - DegradeRuleEntity oldEntity = repository.findById(id); - if (oldEntity == null) { - return Result.ofFail(-1, "Degrade rule does not exist, id=" + id); - } - entity.setApp(oldEntity.getApp()); - entity.setIp(oldEntity.getIp()); - entity.setPort(oldEntity.getPort()); - entity.setId(oldEntity.getId()); - Result checkResult = checkEntityInternal(entity); - if (checkResult != null) { - return checkResult; - } - - entity.setGmtCreate(oldEntity.getGmtCreate()); - entity.setGmtModified(new Date()); - try { - entity = repository.save(entity); - } - catch (Throwable t) { - logger.error("Failed to save degrade rule, id={}, rule={}", id, entity, t); - return Result.ofThrowable(-1, t); - } - if (!publishRules(entity.getApp(), entity.getIp(), entity.getPort())) { - logger.warn("Publish degrade rules failed, app={}", entity.getApp()); - } - return Result.ofSuccess(entity); - } - - @DeleteMapping("/rule/{id}") - @AuthAction(PrivilegeType.DELETE_RULE) - public Result delete(@PathVariable("id") Long id) { - if (id == null) { - return Result.ofFail(-1, "id can't be null"); - } - - DegradeRuleEntity oldEntity = repository.findById(id); - if (oldEntity == null) { - return Result.ofSuccess(null); - } - - try { - repository.delete(id); - } - catch (Throwable throwable) { - logger.error("Failed to delete degrade rule, id={}", id, throwable); - return Result.ofThrowable(-1, throwable); - } - if (!publishRules(oldEntity.getApp(), oldEntity.getIp(), oldEntity.getPort())) { - logger.warn("Publish degrade rules failed, app={}", oldEntity.getApp()); - } - return Result.ofSuccess(id); - } - - private boolean publishRules(String app, String ip, Integer port) { - List rules = repository.findAllByMachine(MachineInfo.of(app, ip, port)); - return sentinelApiClient.setDegradeRuleOfMachine(app, ip, port, rules); - } - - private Result checkEntityInternal(DegradeRuleEntity entity) { - if (StringUtil.isBlank(entity.getApp())) { - return Result.ofFail(-1, "app can't be blank"); - } - if (StringUtil.isBlank(entity.getIp())) { - return Result.ofFail(-1, "ip can't be null or empty"); - } - if (entity.getPort() == null || entity.getPort() <= 0) { - return Result.ofFail(-1, "invalid port: " + entity.getPort()); - } - if (StringUtil.isBlank(entity.getLimitApp())) { - return Result.ofFail(-1, "limitApp can't be null or empty"); - } - if (StringUtil.isBlank(entity.getResource())) { - return Result.ofFail(-1, "resource can't be null or empty"); - } - Double threshold = entity.getCount(); - if (threshold == null || threshold < 0) { - return Result.ofFail(-1, "invalid threshold: " + threshold); - } - Integer recoveryTimeoutSec = entity.getTimeWindow(); - if (recoveryTimeoutSec == null || recoveryTimeoutSec <= 0) { - return Result.ofFail(-1, "recoveryTimeout should be positive"); - } - Integer strategy = entity.getGrade(); - if (strategy == null) { - return Result.ofFail(-1, "circuit breaker strategy cannot be null"); - } - if (strategy < CircuitBreakerStrategy.SLOW_REQUEST_RATIO.getType() - || strategy > RuleConstant.DEGRADE_GRADE_EXCEPTION_COUNT) { - return Result.ofFail(-1, "Invalid circuit breaker strategy: " + strategy); - } - if (entity.getMinRequestAmount() == null || entity.getMinRequestAmount() <= 0) { - return Result.ofFail(-1, "Invalid minRequestAmount"); - } - if (entity.getStatIntervalMs() == null || entity.getStatIntervalMs() <= 0) { - return Result.ofFail(-1, "Invalid statInterval"); - } - if (strategy == RuleConstant.DEGRADE_GRADE_RT) { - Double slowRatio = entity.getSlowRatioThreshold(); - if (slowRatio == null) { - return Result.ofFail(-1, "SlowRatioThreshold is required for slow request ratio strategy"); - } - else if (slowRatio < 0 || slowRatio > 1) { - return Result.ofFail(-1, "SlowRatioThreshold should be in range: [0.0, 1.0]"); - } - } - else if (strategy == RuleConstant.DEGRADE_GRADE_EXCEPTION_RATIO) { - if (threshold > 1) { - return Result.ofFail(-1, "Ratio threshold should be in range: [0.0, 1.0]"); - } - } - return null; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/DemoController.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/DemoController.java deleted file mode 100644 index 0a620738..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/DemoController.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.controller; - -import com.alibaba.csp.sentinel.Entry; -import com.alibaba.csp.sentinel.EntryType; -import com.alibaba.csp.sentinel.SphU; -import com.alibaba.csp.sentinel.context.ContextUtil; -import com.alibaba.csp.sentinel.slots.block.BlockException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.http.MediaType; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; - -import java.util.Random; -import java.util.concurrent.TimeUnit; - -@Controller -@RequestMapping(value = "/demo", produces = MediaType.APPLICATION_JSON_VALUE) -public class DemoController { - - Logger logger = LoggerFactory.getLogger(MachineRegistryController.class); - - @RequestMapping("/greeting") - public String greeting() { - return "index"; - } - - @RequestMapping("/link") - @ResponseBody - public String link() throws BlockException { - - Entry entry = SphU.entry("head1", EntryType.IN); - - Entry entry1 = SphU.entry("head2", EntryType.IN); - Entry entry2 = SphU.entry("head3", EntryType.IN); - Entry entry3 = SphU.entry("head4", EntryType.IN); - - entry3.exit(); - entry2.exit(); - entry1.exit(); - entry.exit(); - return "successfully create a call link"; - } - - @RequestMapping("/loop") - @ResponseBody - public String loop(String name, int time) throws BlockException { - for (int i = 0; i < 10; i++) { - Thread timer = new Thread(new RunTask(name, time, false)); - timer.setName("false"); - timer.start(); - } - return "successfully create a loop thread"; - } - - @RequestMapping("/slow") - @ResponseBody - public String slow(String name, int time) throws BlockException { - for (int i = 0; i < 10; i++) { - Thread timer = new Thread(new RunTask(name, time, true)); - timer.setName("false"); - timer.start(); - } - return "successfully create a loop thread"; - } - - static class RunTask implements Runnable { - - int time; - - boolean stop = false; - - String name; - - boolean slow = false; - - public RunTask(String name, int time, boolean slow) { - super(); - this.time = time; - this.name = name; - this.slow = slow; - } - - @Override - public void run() { - long startTime = System.currentTimeMillis(); - ContextUtil.enter(String.valueOf(startTime)); - while (!stop) { - - long now = System.currentTimeMillis(); - if (now - startTime > time * 1000) { - stop = true; - } - Entry e1 = null; - try { - e1 = SphU.entry(name); - - if (slow) { - TimeUnit.MILLISECONDS.sleep(3000); - } - - } - catch (Exception e) { - } - finally { - if (e1 != null) { - e1.exit(); - } - } - Random random2 = new Random(); - try { - TimeUnit.MILLISECONDS.sleep(random2.nextInt(200)); - } - catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - ContextUtil.exit(); - } - - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/FlowControllerV1.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/FlowControllerV1.java deleted file mode 100644 index 47d8d1c0..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/FlowControllerV1.java +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.controller; - -import com.alibaba.csp.sentinel.dashboard.auth.AuthAction; -import com.alibaba.csp.sentinel.dashboard.auth.AuthService.PrivilegeType; -import com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient; -import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.FlowRuleEntity; -import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo; -import com.alibaba.csp.sentinel.dashboard.domain.Result; -import com.alibaba.csp.sentinel.dashboard.repository.rule.InMemoryRuleRepositoryAdapter; -import com.alibaba.csp.sentinel.util.StringUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.Date; -import java.util.List; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; - -/** - * Flow rule controller. - * - * @author leyou - * @author Eric Zhao - */ -@RestController -@RequestMapping(value = "/v1/flow") -public class FlowControllerV1 { - - private final Logger logger = LoggerFactory.getLogger(FlowControllerV1.class); - - @Autowired - private InMemoryRuleRepositoryAdapter repository; - - @Autowired - private SentinelApiClient sentinelApiClient; - - @GetMapping("/rules") - @AuthAction(PrivilegeType.READ_RULE) - public Result> apiQueryMachineRules(@RequestParam String app, @RequestParam String ip, - @RequestParam Integer port) { - - if (StringUtil.isEmpty(app)) { - return Result.ofFail(-1, "app can't be null or empty"); - } - if (StringUtil.isEmpty(ip)) { - return Result.ofFail(-1, "ip can't be null or empty"); - } - if (port == null) { - return Result.ofFail(-1, "port can't be null"); - } - try { - List rules = sentinelApiClient.fetchFlowRuleOfMachine(app, ip, port); - rules = repository.saveAll(rules); - return Result.ofSuccess(rules); - } - catch (Throwable throwable) { - logger.error("Error when querying flow rules", throwable); - return Result.ofThrowable(-1, throwable); - } - } - - private Result checkEntityInternal(FlowRuleEntity entity) { - if (StringUtil.isBlank(entity.getApp())) { - return Result.ofFail(-1, "app can't be null or empty"); - } - if (StringUtil.isBlank(entity.getIp())) { - return Result.ofFail(-1, "ip can't be null or empty"); - } - if (entity.getPort() == null) { - return Result.ofFail(-1, "port can't be null"); - } - if (StringUtil.isBlank(entity.getLimitApp())) { - return Result.ofFail(-1, "limitApp can't be null or empty"); - } - if (StringUtil.isBlank(entity.getResource())) { - return Result.ofFail(-1, "resource can't be null or empty"); - } - if (entity.getGrade() == null) { - return Result.ofFail(-1, "grade can't be null"); - } - if (entity.getGrade() != 0 && entity.getGrade() != 1) { - return Result.ofFail(-1, "grade must be 0 or 1, but " + entity.getGrade() + " got"); - } - if (entity.getCount() == null || entity.getCount() < 0) { - return Result.ofFail(-1, "count should be at lease zero"); - } - if (entity.getStrategy() == null) { - return Result.ofFail(-1, "strategy can't be null"); - } - if (entity.getStrategy() != 0 && StringUtil.isBlank(entity.getRefResource())) { - return Result.ofFail(-1, "refResource can't be null or empty when strategy!=0"); - } - if (entity.getControlBehavior() == null) { - return Result.ofFail(-1, "controlBehavior can't be null"); - } - int controlBehavior = entity.getControlBehavior(); - if (controlBehavior == 1 && entity.getWarmUpPeriodSec() == null) { - return Result.ofFail(-1, "warmUpPeriodSec can't be null when controlBehavior==1"); - } - if (controlBehavior == 2 && entity.getMaxQueueingTimeMs() == null) { - return Result.ofFail(-1, "maxQueueingTimeMs can't be null when controlBehavior==2"); - } - if (entity.isClusterMode() && entity.getClusterConfig() == null) { - return Result.ofFail(-1, "cluster config should be valid"); - } - return null; - } - - @PostMapping("/rule") - @AuthAction(PrivilegeType.WRITE_RULE) - public Result apiAddFlowRule(@RequestBody FlowRuleEntity entity) { - Result checkResult = checkEntityInternal(entity); - if (checkResult != null) { - return checkResult; - } - entity.setId(null); - Date date = new Date(); - entity.setGmtCreate(date); - entity.setGmtModified(date); - entity.setLimitApp(entity.getLimitApp().trim()); - entity.setResource(entity.getResource().trim()); - try { - entity = repository.save(entity); - - publishRules(entity.getApp(), entity.getIp(), entity.getPort()).get(5000, TimeUnit.MILLISECONDS); - return Result.ofSuccess(entity); - } - catch (Throwable t) { - Throwable e = t instanceof ExecutionException ? t.getCause() : t; - logger.error("Failed to add new flow rule, app={}, ip={}", entity.getApp(), entity.getIp(), e); - return Result.ofFail(-1, e.getMessage()); - } - } - - @PutMapping("/save.json") - @AuthAction(PrivilegeType.WRITE_RULE) - public Result apiUpdateFlowRule(Long id, String app, String limitApp, String resource, - Integer grade, Double count, Integer strategy, String refResource, Integer controlBehavior, - Integer warmUpPeriodSec, Integer maxQueueingTimeMs) { - if (id == null) { - return Result.ofFail(-1, "id can't be null"); - } - FlowRuleEntity entity = repository.findById(id); - if (entity == null) { - return Result.ofFail(-1, "id " + id + " dose not exist"); - } - if (StringUtil.isNotBlank(app)) { - entity.setApp(app.trim()); - } - if (StringUtil.isNotBlank(limitApp)) { - entity.setLimitApp(limitApp.trim()); - } - if (StringUtil.isNotBlank(resource)) { - entity.setResource(resource.trim()); - } - if (grade != null) { - if (grade != 0 && grade != 1) { - return Result.ofFail(-1, "grade must be 0 or 1, but " + grade + " got"); - } - entity.setGrade(grade); - } - if (count != null) { - entity.setCount(count); - } - if (strategy != null) { - if (strategy != 0 && strategy != 1 && strategy != 2) { - return Result.ofFail(-1, "strategy must be in [0, 1, 2], but " + strategy + " got"); - } - entity.setStrategy(strategy); - if (strategy != 0) { - if (StringUtil.isBlank(refResource)) { - return Result.ofFail(-1, "refResource can't be null or empty when strategy!=0"); - } - entity.setRefResource(refResource.trim()); - } - } - if (controlBehavior != null) { - if (controlBehavior != 0 && controlBehavior != 1 && controlBehavior != 2) { - return Result.ofFail(-1, "controlBehavior must be in [0, 1, 2], but " + controlBehavior + " got"); - } - if (controlBehavior == 1 && warmUpPeriodSec == null) { - return Result.ofFail(-1, "warmUpPeriodSec can't be null when controlBehavior==1"); - } - if (controlBehavior == 2 && maxQueueingTimeMs == null) { - return Result.ofFail(-1, "maxQueueingTimeMs can't be null when controlBehavior==2"); - } - entity.setControlBehavior(controlBehavior); - if (warmUpPeriodSec != null) { - entity.setWarmUpPeriodSec(warmUpPeriodSec); - } - if (maxQueueingTimeMs != null) { - entity.setMaxQueueingTimeMs(maxQueueingTimeMs); - } - } - Date date = new Date(); - entity.setGmtModified(date); - try { - entity = repository.save(entity); - if (entity == null) { - return Result.ofFail(-1, "save entity fail: null"); - } - - publishRules(entity.getApp(), entity.getIp(), entity.getPort()).get(5000, TimeUnit.MILLISECONDS); - return Result.ofSuccess(entity); - } - catch (Throwable t) { - Throwable e = t instanceof ExecutionException ? t.getCause() : t; - logger.error("Error when updating flow rules, app={}, ip={}, ruleId={}", entity.getApp(), entity.getIp(), - id, e); - return Result.ofFail(-1, e.getMessage()); - } - } - - @DeleteMapping("/delete.json") - @AuthAction(PrivilegeType.WRITE_RULE) - public Result apiDeleteFlowRule(Long id) { - - if (id == null) { - return Result.ofFail(-1, "id can't be null"); - } - FlowRuleEntity oldEntity = repository.findById(id); - if (oldEntity == null) { - return Result.ofSuccess(null); - } - - try { - repository.delete(id); - } - catch (Exception e) { - return Result.ofFail(-1, e.getMessage()); - } - try { - publishRules(oldEntity.getApp(), oldEntity.getIp(), oldEntity.getPort()).get(5000, TimeUnit.MILLISECONDS); - return Result.ofSuccess(id); - } - catch (Throwable t) { - Throwable e = t instanceof ExecutionException ? t.getCause() : t; - logger.error("Error when deleting flow rules, app={}, ip={}, id={}", oldEntity.getApp(), oldEntity.getIp(), - id, e); - return Result.ofFail(-1, e.getMessage()); - } - } - - private CompletableFuture publishRules(String app, String ip, Integer port) { - List rules = repository.findAllByMachine(MachineInfo.of(app, ip, port)); - return sentinelApiClient.setFlowRuleOfMachineAsync(app, ip, port, rules); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/MachineRegistryController.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/MachineRegistryController.java deleted file mode 100644 index d6641c6a..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/MachineRegistryController.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.controller; - -import com.alibaba.csp.sentinel.dashboard.discovery.AppManagement; -import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo; -import com.alibaba.csp.sentinel.dashboard.domain.Result; -import com.alibaba.csp.sentinel.util.StringUtil; -import org.apache.http.conn.util.InetAddressUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.MediaType; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; - -@Controller -@RequestMapping(value = "/registry", produces = MediaType.APPLICATION_JSON_VALUE) -public class MachineRegistryController { - - private final Logger logger = LoggerFactory.getLogger(MachineRegistryController.class); - - @Autowired - private AppManagement appManagement; - - @ResponseBody - @RequestMapping("/machine") - public Result receiveHeartBeat(String app, - @RequestParam(value = "app_type", required = false, defaultValue = "0") Integer appType, Long version, - String v, String hostname, String ip, Integer port) { - if (StringUtil.isBlank(app) || app.length() > 256) { - return Result.ofFail(-1, "invalid appName"); - } - if (StringUtil.isBlank(ip) || ip.length() > 128) { - return Result.ofFail(-1, "invalid ip: " + ip); - } - if (!InetAddressUtils.isIPv4Address(ip) && !InetAddressUtils.isIPv6Address(ip)) { - return Result.ofFail(-1, "invalid ip: " + ip); - } - if (port == null || port < -1) { - return Result.ofFail(-1, "invalid port"); - } - if (hostname != null && hostname.length() > 256) { - return Result.ofFail(-1, "hostname too long"); - } - if (port == -1) { - logger.warn("Receive heartbeat from " + ip + " but port not set yet"); - return Result.ofFail(-1, "your port not set yet"); - } - String sentinelVersion = StringUtil.isBlank(v) ? "unknown" : v; - - version = version == null ? System.currentTimeMillis() : version; - try { - MachineInfo machineInfo = new MachineInfo(); - machineInfo.setApp(app); - machineInfo.setAppType(appType); - machineInfo.setHostname(hostname); - machineInfo.setIp(ip); - machineInfo.setPort(port); - machineInfo.setHeartbeatVersion(version); - machineInfo.setLastHeartbeat(System.currentTimeMillis()); - machineInfo.setVersion(sentinelVersion); - appManagement.addMachine(machineInfo); - return Result.ofSuccessMsg("success"); - } - catch (Exception e) { - logger.error("Receive heartbeat error", e); - return Result.ofFail(-1, e.getMessage()); - } - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/MetricController.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/MetricController.java deleted file mode 100644 index 18e6ecdb..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/MetricController.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.controller; - -import com.alibaba.csp.sentinel.dashboard.datasource.entity.MetricEntity; -import com.alibaba.csp.sentinel.dashboard.domain.Result; -import com.alibaba.csp.sentinel.dashboard.domain.vo.MetricVo; -import com.alibaba.csp.sentinel.dashboard.repository.metric.MetricsRepository; -import com.alibaba.csp.sentinel.util.StringUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.MediaType; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; - -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; - -/** - * @author leyou - */ -@Controller -@RequestMapping(value = "/metric", produces = MediaType.APPLICATION_JSON_VALUE) -public class MetricController { - - private static Logger logger = LoggerFactory.getLogger(MetricController.class); - - private static final long maxQueryIntervalMs = 1000 * 60 * 60; - - @Autowired - private MetricsRepository metricStore; - - @ResponseBody - @RequestMapping("/queryTopResourceMetric.json") - public Result queryTopResourceMetric(final String app, Integer pageIndex, Integer pageSize, Boolean desc, - Long startTime, Long endTime, String searchKey) { - if (StringUtil.isEmpty(app)) { - return Result.ofFail(-1, "app can't be null or empty"); - } - if (pageIndex == null || pageIndex <= 0) { - pageIndex = 1; - } - if (pageSize == null) { - pageSize = 6; - } - if (pageSize >= 20) { - pageSize = 20; - } - if (desc == null) { - desc = true; - } - if (endTime == null) { - endTime = System.currentTimeMillis(); - } - if (startTime == null) { - startTime = endTime - 1000 * 60 * 5; - } - if (endTime - startTime > maxQueryIntervalMs) { - return Result.ofFail(-1, "time intervalMs is too big, must <= 1h"); - } - List resources = metricStore.listResourcesOfApp(app); - logger.debug("queryTopResourceMetric(), resources.size()={}", resources.size()); - - if (resources == null || resources.isEmpty()) { - return Result.ofSuccess(null); - } - if (!desc) { - Collections.reverse(resources); - } - if (StringUtil.isNotEmpty(searchKey)) { - List searched = new ArrayList<>(); - for (String resource : resources) { - if (resource.contains(searchKey)) { - searched.add(resource); - } - } - resources = searched; - } - int totalPage = (resources.size() + pageSize - 1) / pageSize; - List topResource = new ArrayList<>(); - if (pageIndex <= totalPage) { - topResource = resources.subList((pageIndex - 1) * pageSize, - Math.min(pageIndex * pageSize, resources.size())); - } - final Map> map = new ConcurrentHashMap<>(); - logger.debug("topResource={}", topResource); - long time = System.currentTimeMillis(); - for (final String resource : topResource) { - List entities = metricStore.queryByAppAndResourceBetween(app, resource, startTime, endTime); - logger.debug("resource={}, entities.size()={}", resource, entities == null ? "null" : entities.size()); - List vos = MetricVo.fromMetricEntities(entities, resource); - Iterable vosSorted = sortMetricVoAndDistinct(vos); - map.put(resource, vosSorted); - } - logger.debug("queryTopResourceMetric() total query time={} ms", System.currentTimeMillis() - time); - Map resultMap = new HashMap<>(16); - resultMap.put("totalCount", resources.size()); - resultMap.put("totalPage", totalPage); - resultMap.put("pageIndex", pageIndex); - resultMap.put("pageSize", pageSize); - - Map> map2 = new LinkedHashMap<>(); - // order matters. - for (String identity : topResource) { - map2.put(identity, map.get(identity)); - } - resultMap.put("metric", map2); - return Result.ofSuccess(resultMap); - } - - @ResponseBody - @RequestMapping("/queryByAppAndResource.json") - public Result queryByAppAndResource(String app, String identity, Long startTime, Long endTime) { - if (StringUtil.isEmpty(app)) { - return Result.ofFail(-1, "app can't be null or empty"); - } - if (StringUtil.isEmpty(identity)) { - return Result.ofFail(-1, "identity can't be null or empty"); - } - if (endTime == null) { - endTime = System.currentTimeMillis(); - } - if (startTime == null) { - startTime = endTime - 1000 * 60; - } - if (endTime - startTime > maxQueryIntervalMs) { - return Result.ofFail(-1, "time intervalMs is too big, must <= 1h"); - } - List entities = metricStore.queryByAppAndResourceBetween(app, identity, startTime, endTime); - List vos = MetricVo.fromMetricEntities(entities, identity); - return Result.ofSuccess(sortMetricVoAndDistinct(vos)); - } - - private Iterable sortMetricVoAndDistinct(List vos) { - if (vos == null) { - return null; - } - Map map = new TreeMap<>(); - for (MetricVo vo : vos) { - MetricVo oldVo = map.get(vo.getTimestamp()); - if (oldVo == null || vo.getGmtCreate() > oldVo.getGmtCreate()) { - map.put(vo.getTimestamp(), vo); - } - } - return map.values(); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/ParamFlowRuleController.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/ParamFlowRuleController.java deleted file mode 100644 index 72ddaf3b..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/ParamFlowRuleController.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.controller; - -import com.alibaba.csp.sentinel.dashboard.auth.AuthAction; -import com.alibaba.csp.sentinel.dashboard.auth.AuthService.PrivilegeType; -import com.alibaba.csp.sentinel.dashboard.client.CommandNotFoundException; -import com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient; -import com.alibaba.csp.sentinel.dashboard.datasource.entity.SentinelVersion; -import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.ParamFlowRuleEntity; -import com.alibaba.csp.sentinel.dashboard.discovery.AppManagement; -import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo; -import com.alibaba.csp.sentinel.dashboard.domain.Result; -import com.alibaba.csp.sentinel.dashboard.repository.rule.RuleRepository; -import com.alibaba.csp.sentinel.dashboard.util.VersionUtils; -import com.alibaba.csp.sentinel.slots.block.RuleConstant; -import com.alibaba.csp.sentinel.util.StringUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.Date; -import java.util.List; -import java.util.Optional; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; - -/** - * @author Eric Zhao - * @since 0.2.1 - */ -@RestController -@RequestMapping(value = "/paramFlow") -public class ParamFlowRuleController { - - private final Logger logger = LoggerFactory.getLogger(ParamFlowRuleController.class); - - @Autowired - private SentinelApiClient sentinelApiClient; - - @Autowired - private AppManagement appManagement; - - @Autowired - private RuleRepository repository; - - private boolean checkIfSupported(String app, String ip, int port) { - try { - return Optional.ofNullable(appManagement.getDetailApp(app)) - .flatMap(e -> e.getMachine(ip, port)) - .flatMap(m -> VersionUtils.parseVersion(m.getVersion()).map(v -> v.greaterOrEqual(version020))) - .orElse(true); - // If error occurred or cannot retrieve machine info, return true. - } - catch (Exception ex) { - return true; - } - } - - @GetMapping("/rules") - @AuthAction(PrivilegeType.READ_RULE) - public Result> apiQueryAllRulesForMachine(@RequestParam String app, - @RequestParam String ip, @RequestParam Integer port) { - if (StringUtil.isEmpty(app)) { - return Result.ofFail(-1, "app cannot be null or empty"); - } - if (StringUtil.isEmpty(ip)) { - return Result.ofFail(-1, "ip cannot be null or empty"); - } - if (port == null || port <= 0) { - return Result.ofFail(-1, "Invalid parameter: port"); - } - if (!checkIfSupported(app, ip, port)) { - return unsupportedVersion(); - } - try { - return sentinelApiClient.fetchParamFlowRulesOfMachine(app, ip, port) - .thenApply(repository::saveAll) - .thenApply(Result::ofSuccess) - .get(); - } - catch (ExecutionException ex) { - logger.error("Error when querying parameter flow rules", ex.getCause()); - if (isNotSupported(ex.getCause())) { - return unsupportedVersion(); - } - else { - return Result.ofThrowable(-1, ex.getCause()); - } - } - catch (Throwable throwable) { - logger.error("Error when querying parameter flow rules", throwable); - return Result.ofFail(-1, throwable.getMessage()); - } - } - - private boolean isNotSupported(Throwable ex) { - return ex instanceof CommandNotFoundException; - } - - @PostMapping("/rule") - @AuthAction(PrivilegeType.WRITE_RULE) - public Result apiAddParamFlowRule(@RequestBody ParamFlowRuleEntity entity) { - Result checkResult = checkEntityInternal(entity); - if (checkResult != null) { - return checkResult; - } - if (!checkIfSupported(entity.getApp(), entity.getIp(), entity.getPort())) { - return unsupportedVersion(); - } - entity.setId(null); - entity.getRule().setResource(entity.getResource().trim()); - Date date = new Date(); - entity.setGmtCreate(date); - entity.setGmtModified(date); - try { - entity = repository.save(entity); - publishRules(entity.getApp(), entity.getIp(), entity.getPort()).get(); - return Result.ofSuccess(entity); - } - catch (ExecutionException ex) { - logger.error("Error when adding new parameter flow rules", ex.getCause()); - if (isNotSupported(ex.getCause())) { - return unsupportedVersion(); - } - else { - return Result.ofThrowable(-1, ex.getCause()); - } - } - catch (Throwable throwable) { - logger.error("Error when adding new parameter flow rules", throwable); - return Result.ofFail(-1, throwable.getMessage()); - } - } - - private Result checkEntityInternal(ParamFlowRuleEntity entity) { - if (entity == null) { - return Result.ofFail(-1, "bad rule body"); - } - if (StringUtil.isBlank(entity.getApp())) { - return Result.ofFail(-1, "app can't be null or empty"); - } - if (StringUtil.isBlank(entity.getIp())) { - return Result.ofFail(-1, "ip can't be null or empty"); - } - if (entity.getPort() == null || entity.getPort() <= 0) { - return Result.ofFail(-1, "port can't be null"); - } - if (entity.getRule() == null) { - return Result.ofFail(-1, "rule can't be null"); - } - if (StringUtil.isBlank(entity.getResource())) { - return Result.ofFail(-1, "resource name cannot be null or empty"); - } - if (entity.getCount() < 0) { - return Result.ofFail(-1, "count should be valid"); - } - if (entity.getGrade() != RuleConstant.FLOW_GRADE_QPS) { - return Result.ofFail(-1, "Unknown mode (blockGrade) for parameter flow control"); - } - if (entity.getParamIdx() == null || entity.getParamIdx() < 0) { - return Result.ofFail(-1, "paramIdx should be valid"); - } - if (entity.getDurationInSec() <= 0) { - return Result.ofFail(-1, "durationInSec should be valid"); - } - if (entity.getControlBehavior() < 0) { - return Result.ofFail(-1, "controlBehavior should be valid"); - } - return null; - } - - @PutMapping("/rule/{id}") - @AuthAction(PrivilegeType.WRITE_RULE) - public Result apiUpdateParamFlowRule(@PathVariable("id") Long id, - @RequestBody ParamFlowRuleEntity entity) { - if (id == null || id <= 0) { - return Result.ofFail(-1, "Invalid id"); - } - ParamFlowRuleEntity oldEntity = repository.findById(id); - if (oldEntity == null) { - return Result.ofFail(-1, "id " + id + " does not exist"); - } - - Result checkResult = checkEntityInternal(entity); - if (checkResult != null) { - return checkResult; - } - if (!checkIfSupported(entity.getApp(), entity.getIp(), entity.getPort())) { - return unsupportedVersion(); - } - entity.setId(id); - Date date = new Date(); - entity.setGmtCreate(oldEntity.getGmtCreate()); - entity.setGmtModified(date); - try { - entity = repository.save(entity); - publishRules(entity.getApp(), entity.getIp(), entity.getPort()).get(); - return Result.ofSuccess(entity); - } - catch (ExecutionException ex) { - logger.error("Error when updating parameter flow rules, id=" + id, ex.getCause()); - if (isNotSupported(ex.getCause())) { - return unsupportedVersion(); - } - else { - return Result.ofThrowable(-1, ex.getCause()); - } - } - catch (Throwable throwable) { - logger.error("Error when updating parameter flow rules, id=" + id, throwable); - return Result.ofFail(-1, throwable.getMessage()); - } - } - - @DeleteMapping("/rule/{id}") - @AuthAction(PrivilegeType.DELETE_RULE) - public Result apiDeleteRule(@PathVariable("id") Long id) { - if (id == null) { - return Result.ofFail(-1, "id cannot be null"); - } - ParamFlowRuleEntity oldEntity = repository.findById(id); - if (oldEntity == null) { - return Result.ofSuccess(null); - } - - try { - repository.delete(id); - publishRules(oldEntity.getApp(), oldEntity.getIp(), oldEntity.getPort()).get(); - return Result.ofSuccess(id); - } - catch (ExecutionException ex) { - logger.error("Error when deleting parameter flow rules", ex.getCause()); - if (isNotSupported(ex.getCause())) { - return unsupportedVersion(); - } - else { - return Result.ofThrowable(-1, ex.getCause()); - } - } - catch (Throwable throwable) { - logger.error("Error when deleting parameter flow rules", throwable); - return Result.ofFail(-1, throwable.getMessage()); - } - } - - private CompletableFuture publishRules(String app, String ip, Integer port) { - List rules = repository.findAllByMachine(MachineInfo.of(app, ip, port)); - return sentinelApiClient.setParamFlowRuleOfMachine(app, ip, port, rules); - } - - private Result unsupportedVersion() { - return Result.ofFail(4041, - "Sentinel client not supported for parameter flow control (unsupported version or dependency absent)"); - } - - private final SentinelVersion version020 = new SentinelVersion().setMinorVersion(2); - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/ResourceController.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/ResourceController.java deleted file mode 100644 index c342d546..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/ResourceController.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.controller; - -import com.alibaba.csp.sentinel.command.vo.NodeVo; -import com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient; -import com.alibaba.csp.sentinel.dashboard.domain.ResourceTreeNode; -import com.alibaba.csp.sentinel.dashboard.domain.Result; -import com.alibaba.csp.sentinel.dashboard.domain.vo.ResourceVo; -import com.alibaba.csp.sentinel.util.StringUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; -import java.util.stream.Collectors; - -/** - * @author Carpenter Lee - */ -@RestController -@RequestMapping(value = "/resource") -public class ResourceController { - - private static Logger logger = LoggerFactory.getLogger(ResourceController.class); - - @Autowired - private SentinelApiClient httpFetcher; - - /** - * Fetch real time statistics info of the machine. - * @param ip ip to fetch - * @param port port of the ip - * @param type one of [root, default, cluster], 'root' means fetching from tree root - * node, 'default' means fetching from tree default node, 'cluster' means fetching - * from cluster node. - * @param searchKey key to search - * @return node statistics info. - */ - @GetMapping("/machineResource.json") - public Result> fetchResourceChainListOfMachine(String ip, Integer port, String type, - String searchKey) { - if (StringUtil.isEmpty(ip) || port == null) { - return Result.ofFail(-1, "invalid param, give ip, port"); - } - final String ROOT = "root"; - final String DEFAULT = "default"; - if (StringUtil.isEmpty(type)) { - type = ROOT; - } - if (ROOT.equalsIgnoreCase(type) || DEFAULT.equalsIgnoreCase(type)) { - List nodeVos = httpFetcher.fetchResourceOfMachine(ip, port, type); - if (nodeVos == null) { - return Result.ofSuccess(null); - } - ResourceTreeNode treeNode = ResourceTreeNode.fromNodeVoList(nodeVos); - treeNode.searchIgnoreCase(searchKey); - return Result.ofSuccess(ResourceVo.fromResourceTreeNode(treeNode)); - } - else { - // Normal (cluster node). - List nodeVos = httpFetcher.fetchClusterNodeOfMachine(ip, port, true); - if (nodeVos == null) { - return Result.ofSuccess(null); - } - if (StringUtil.isNotEmpty(searchKey)) { - nodeVos = nodeVos.stream() - .filter(node -> node.getResource().toLowerCase().contains(searchKey.toLowerCase())) - .collect(Collectors.toList()); - } - return Result.ofSuccess(ResourceVo.fromNodeVoList(nodeVos)); - } - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/SystemController.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/SystemController.java deleted file mode 100644 index 58323f02..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/SystemController.java +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.controller; - -import com.alibaba.csp.sentinel.dashboard.auth.AuthAction; -import com.alibaba.csp.sentinel.dashboard.auth.AuthService.PrivilegeType; -import com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient; -import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.SystemRuleEntity; -import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo; -import com.alibaba.csp.sentinel.dashboard.domain.Result; -import com.alibaba.csp.sentinel.dashboard.repository.rule.RuleRepository; -import com.alibaba.csp.sentinel.util.StringUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.Date; -import java.util.List; - -/** - * @author leyou(lihao) - */ -@RestController -@RequestMapping("/system") -public class SystemController { - - private final Logger logger = LoggerFactory.getLogger(SystemController.class); - - @Autowired - private RuleRepository repository; - - @Autowired - private SentinelApiClient sentinelApiClient; - - private Result checkBasicParams(String app, String ip, Integer port) { - if (StringUtil.isEmpty(app)) { - return Result.ofFail(-1, "app can't be null or empty"); - } - if (StringUtil.isEmpty(ip)) { - return Result.ofFail(-1, "ip can't be null or empty"); - } - if (port == null) { - return Result.ofFail(-1, "port can't be null"); - } - if (port <= 0 || port > 65535) { - return Result.ofFail(-1, "port should be in (0, 65535)"); - } - return null; - } - - @GetMapping("/rules.json") - @AuthAction(PrivilegeType.READ_RULE) - public Result> apiQueryMachineRules(String app, String ip, Integer port) { - Result> checkResult = checkBasicParams(app, ip, port); - if (checkResult != null) { - return checkResult; - } - try { - List rules = sentinelApiClient.fetchSystemRuleOfMachine(app, ip, port); - rules = repository.saveAll(rules); - return Result.ofSuccess(rules); - } - catch (Throwable throwable) { - logger.error("Query machine system rules error", throwable); - return Result.ofThrowable(-1, throwable); - } - } - - private int countNotNullAndNotNegative(Number... values) { - int notNullCount = 0; - for (int i = 0; i < values.length; i++) { - if (values[i] != null && values[i].doubleValue() >= 0) { - notNullCount++; - } - } - return notNullCount; - } - - @RequestMapping("/new.json") - @AuthAction(PrivilegeType.WRITE_RULE) - public Result apiAdd(String app, String ip, Integer port, Double highestSystemLoad, - Double highestCpuUsage, Long avgRt, Long maxThread, Double qps) { - - Result checkResult = checkBasicParams(app, ip, port); - if (checkResult != null) { - return checkResult; - } - - int notNullCount = countNotNullAndNotNegative(highestSystemLoad, avgRt, maxThread, qps, highestCpuUsage); - if (notNullCount != 1) { - return Result.ofFail(-1, "only one of [highestSystemLoad, avgRt, maxThread, qps,highestCpuUsage] " - + "value must be set > 0, but " + notNullCount + " values get"); - } - if (null != highestCpuUsage && highestCpuUsage > 1) { - return Result.ofFail(-1, "highestCpuUsage must between [0.0, 1.0]"); - } - SystemRuleEntity entity = new SystemRuleEntity(); - entity.setApp(app.trim()); - entity.setIp(ip.trim()); - entity.setPort(port); - // -1 is a fake value - if (null != highestSystemLoad) { - entity.setHighestSystemLoad(highestSystemLoad); - } - else { - entity.setHighestSystemLoad(-1D); - } - - if (null != highestCpuUsage) { - entity.setHighestCpuUsage(highestCpuUsage); - } - else { - entity.setHighestCpuUsage(-1D); - } - - if (avgRt != null) { - entity.setAvgRt(avgRt); - } - else { - entity.setAvgRt(-1L); - } - if (maxThread != null) { - entity.setMaxThread(maxThread); - } - else { - entity.setMaxThread(-1L); - } - if (qps != null) { - entity.setQps(qps); - } - else { - entity.setQps(-1D); - } - Date date = new Date(); - entity.setGmtCreate(date); - entity.setGmtModified(date); - try { - entity = repository.save(entity); - } - catch (Throwable throwable) { - logger.error("Add SystemRule error", throwable); - return Result.ofThrowable(-1, throwable); - } - if (!publishRules(app, ip, port)) { - logger.warn("Publish system rules fail after rule add"); - } - return Result.ofSuccess(entity); - } - - @GetMapping("/save.json") - @AuthAction(PrivilegeType.WRITE_RULE) - public Result apiUpdateIfNotNull(Long id, String app, Double highestSystemLoad, - Double highestCpuUsage, Long avgRt, Long maxThread, Double qps) { - if (id == null) { - return Result.ofFail(-1, "id can't be null"); - } - SystemRuleEntity entity = repository.findById(id); - if (entity == null) { - return Result.ofFail(-1, "id " + id + " dose not exist"); - } - - if (StringUtil.isNotBlank(app)) { - entity.setApp(app.trim()); - } - if (highestSystemLoad != null) { - if (highestSystemLoad < 0) { - return Result.ofFail(-1, "highestSystemLoad must >= 0"); - } - entity.setHighestSystemLoad(highestSystemLoad); - } - if (highestCpuUsage != null) { - if (highestCpuUsage < 0) { - return Result.ofFail(-1, "highestCpuUsage must >= 0"); - } - if (highestCpuUsage > 1) { - return Result.ofFail(-1, "highestCpuUsage must <= 1"); - } - entity.setHighestCpuUsage(highestCpuUsage); - } - if (avgRt != null) { - if (avgRt < 0) { - return Result.ofFail(-1, "avgRt must >= 0"); - } - entity.setAvgRt(avgRt); - } - if (maxThread != null) { - if (maxThread < 0) { - return Result.ofFail(-1, "maxThread must >= 0"); - } - entity.setMaxThread(maxThread); - } - if (qps != null) { - if (qps < 0) { - return Result.ofFail(-1, "qps must >= 0"); - } - entity.setQps(qps); - } - Date date = new Date(); - entity.setGmtModified(date); - try { - entity = repository.save(entity); - } - catch (Throwable throwable) { - logger.error("save error:", throwable); - return Result.ofThrowable(-1, throwable); - } - if (!publishRules(entity.getApp(), entity.getIp(), entity.getPort())) { - logger.info("publish system rules fail after rule update"); - } - return Result.ofSuccess(entity); - } - - @RequestMapping("/delete.json") - @AuthAction(PrivilegeType.DELETE_RULE) - public Result delete(Long id) { - if (id == null) { - return Result.ofFail(-1, "id can't be null"); - } - SystemRuleEntity oldEntity = repository.findById(id); - if (oldEntity == null) { - return Result.ofSuccess(null); - } - try { - repository.delete(id); - } - catch (Throwable throwable) { - logger.error("delete error:", throwable); - return Result.ofThrowable(-1, throwable); - } - if (!publishRules(oldEntity.getApp(), oldEntity.getIp(), oldEntity.getPort())) { - logger.info("publish system rules fail after rule delete"); - } - return Result.ofSuccess(id); - } - - private boolean publishRules(String app, String ip, Integer port) { - List rules = repository.findAllByMachine(MachineInfo.of(app, ip, port)); - return sentinelApiClient.setSystemRuleOfMachine(app, ip, port, rules); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/VersionController.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/VersionController.java deleted file mode 100644 index ada7f51d..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/VersionController.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.controller; - -import com.alibaba.csp.sentinel.dashboard.domain.Result; -import com.alibaba.csp.sentinel.util.StringUtil; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; - -/** - * @author hisenyuan - * @since 1.7.0 - */ -@RestController -public class VersionController { - - private static final String VERSION_PATTERN = "-"; - - @Value("${sentinel.dashboard.version:}") - private String sentinelDashboardVersion; - - @GetMapping("/version") - public Result apiGetVersion() { - if (StringUtil.isNotBlank(sentinelDashboardVersion)) { - String res = sentinelDashboardVersion; - if (sentinelDashboardVersion.contains(VERSION_PATTERN)) { - res = sentinelDashboardVersion.substring(0, sentinelDashboardVersion.indexOf(VERSION_PATTERN)); - } - return Result.ofSuccess(res); - } - else { - return Result.ofFail(1, "getVersion failed: empty version"); - } - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/cluster/ClusterAssignController.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/cluster/ClusterAssignController.java deleted file mode 100644 index 42c306f8..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/cluster/ClusterAssignController.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.controller.cluster; - -import com.alibaba.csp.sentinel.dashboard.domain.Result; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterAppAssignResultVO; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterAppFullAssignRequest; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterAppSingleServerAssignRequest; -import com.alibaba.csp.sentinel.dashboard.service.ClusterAssignService; -import com.alibaba.csp.sentinel.util.StringUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.Collections; -import java.util.Set; - -/** - * @author Eric Zhao - * @since 1.4.1 - */ -@RestController -@RequestMapping("/cluster/assign") -public class ClusterAssignController { - - private final Logger logger = LoggerFactory.getLogger(ClusterAssignController.class); - - @Autowired - private ClusterAssignService clusterAssignService; - - @PostMapping("/all_server/{app}") - public Result apiAssignAllClusterServersOfApp(@PathVariable String app, - @RequestBody ClusterAppFullAssignRequest assignRequest) { - if (StringUtil.isEmpty(app)) { - return Result.ofFail(-1, "app cannot be null or empty"); - } - if (assignRequest == null || assignRequest.getClusterMap() == null - || assignRequest.getRemainingList() == null) { - return Result.ofFail(-1, "bad request body"); - } - try { - return Result.ofSuccess(clusterAssignService.applyAssignToApp(app, assignRequest.getClusterMap(), - assignRequest.getRemainingList())); - } - catch (Throwable throwable) { - logger.error("Error when assigning full cluster servers for app: " + app, throwable); - return Result.ofFail(-1, throwable.getMessage()); - } - } - - @PostMapping("/single_server/{app}") - public Result apiAssignSingleClusterServersOfApp(@PathVariable String app, - @RequestBody ClusterAppSingleServerAssignRequest assignRequest) { - if (StringUtil.isEmpty(app)) { - return Result.ofFail(-1, "app cannot be null or empty"); - } - if (assignRequest == null || assignRequest.getClusterMap() == null) { - return Result.ofFail(-1, "bad request body"); - } - try { - return Result.ofSuccess(clusterAssignService.applyAssignToApp(app, - Collections.singletonList(assignRequest.getClusterMap()), assignRequest.getRemainingList())); - } - catch (Throwable throwable) { - logger.error("Error when assigning single cluster servers for app: " + app, throwable); - return Result.ofFail(-1, throwable.getMessage()); - } - } - - @PostMapping("/unbind_server/{app}") - public Result apiUnbindClusterServersOfApp(@PathVariable String app, - @RequestBody Set machineIds) { - if (StringUtil.isEmpty(app)) { - return Result.ofFail(-1, "app cannot be null or empty"); - } - if (machineIds == null || machineIds.isEmpty()) { - return Result.ofFail(-1, "bad request body"); - } - try { - return Result.ofSuccess(clusterAssignService.unbindClusterServers(app, machineIds)); - } - catch (Throwable throwable) { - logger.error("Error when unbinding cluster server {} for app <{}>", machineIds, app, throwable); - return Result.ofFail(-1, throwable.getMessage()); - } - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/cluster/ClusterConfigController.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/cluster/ClusterConfigController.java deleted file mode 100644 index d15dee28..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/cluster/ClusterConfigController.java +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.controller.cluster; - -import com.alibaba.csp.sentinel.cluster.ClusterStateManager; -import com.alibaba.csp.sentinel.dashboard.client.CommandNotFoundException; -import com.alibaba.csp.sentinel.dashboard.datasource.entity.SentinelVersion; -import com.alibaba.csp.sentinel.dashboard.discovery.AppManagement; -import com.alibaba.csp.sentinel.dashboard.domain.Result; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterClientModifyRequest; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterModifyRequest; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterServerModifyRequest; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.AppClusterClientStateWrapVO; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.AppClusterServerStateWrapVO; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStatePairVO; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStateVO; -import com.alibaba.csp.sentinel.dashboard.service.ClusterConfigService; -import com.alibaba.csp.sentinel.dashboard.util.ClusterEntityUtils; -import com.alibaba.csp.sentinel.dashboard.util.VersionUtils; -import com.alibaba.csp.sentinel.util.StringUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.List; -import java.util.Optional; -import java.util.concurrent.ExecutionException; - -/** - * @author Eric Zhao - * @since 1.4.0 - */ -@RestController -@RequestMapping(value = "/cluster") -public class ClusterConfigController { - - private final Logger logger = LoggerFactory.getLogger(ClusterConfigController.class); - - private final SentinelVersion version140 = new SentinelVersion().setMajorVersion(1).setMinorVersion(4); - - @Autowired - private AppManagement appManagement; - - @Autowired - private ClusterConfigService clusterConfigService; - - @PostMapping("/config/modify_single") - public Result apiModifyClusterConfig(@RequestBody String payload) { - if (StringUtil.isBlank(payload)) { - return Result.ofFail(-1, "empty request body"); - } - try { - JSONObject body = JSON.parseObject(payload); - if (body.containsKey(KEY_MODE)) { - int mode = body.getInteger(KEY_MODE); - switch (mode) { - case ClusterStateManager.CLUSTER_CLIENT: - ClusterClientModifyRequest data = JSON.parseObject(payload, ClusterClientModifyRequest.class); - Result res = checkValidRequest(data); - if (res != null) { - return res; - } - clusterConfigService.modifyClusterClientConfig(data).get(); - return Result.ofSuccess(true); - case ClusterStateManager.CLUSTER_SERVER: - ClusterServerModifyRequest d = JSON.parseObject(payload, ClusterServerModifyRequest.class); - Result r = checkValidRequest(d); - if (r != null) { - return r; - } - // TODO: bad design here, should refactor! - clusterConfigService.modifyClusterServerConfig(d).get(); - return Result.ofSuccess(true); - default: - return Result.ofFail(-1, "invalid mode"); - } - } - return Result.ofFail(-1, "invalid parameter"); - } - catch (ExecutionException ex) { - logger.error("Error when modifying cluster config", ex.getCause()); - return errorResponse(ex); - } - catch (Throwable ex) { - logger.error("Error when modifying cluster config", ex); - return Result.ofFail(-1, ex.getMessage()); - } - } - - private Result errorResponse(ExecutionException ex) { - if (isNotSupported(ex.getCause())) { - return unsupportedVersion(); - } - else { - return Result.ofThrowable(-1, ex.getCause()); - } - } - - @GetMapping("/state_single") - public Result apiGetClusterState(@RequestParam String app, @RequestParam String ip, - @RequestParam Integer port) { - if (StringUtil.isEmpty(app)) { - return Result.ofFail(-1, "app cannot be null or empty"); - } - if (StringUtil.isEmpty(ip)) { - return Result.ofFail(-1, "ip cannot be null or empty"); - } - if (port == null || port <= 0) { - return Result.ofFail(-1, "Invalid parameter: port"); - } - if (!checkIfSupported(app, ip, port)) { - return unsupportedVersion(); - } - try { - return clusterConfigService.getClusterUniversalState(app, ip, port).thenApply(Result::ofSuccess).get(); - } - catch (ExecutionException ex) { - logger.error("Error when fetching cluster state", ex.getCause()); - return errorResponse(ex); - } - catch (Throwable throwable) { - logger.error("Error when fetching cluster state", throwable); - return Result.ofFail(-1, throwable.getMessage()); - } - } - - @GetMapping("/server_state/{app}") - public Result> apiGetClusterServerStateOfApp(@PathVariable String app) { - if (StringUtil.isEmpty(app)) { - return Result.ofFail(-1, "app cannot be null or empty"); - } - try { - return clusterConfigService.getClusterUniversalState(app) - .thenApply(ClusterEntityUtils::wrapToAppClusterServerState) - .thenApply(Result::ofSuccess) - .get(); - } - catch (ExecutionException ex) { - logger.error("Error when fetching cluster server state of app: " + app, ex.getCause()); - return errorResponse(ex); - } - catch (Throwable throwable) { - logger.error("Error when fetching cluster server state of app: " + app, throwable); - return Result.ofFail(-1, throwable.getMessage()); - } - } - - @GetMapping("/client_state/{app}") - public Result> apiGetClusterClientStateOfApp(@PathVariable String app) { - if (StringUtil.isEmpty(app)) { - return Result.ofFail(-1, "app cannot be null or empty"); - } - try { - return clusterConfigService.getClusterUniversalState(app) - .thenApply(ClusterEntityUtils::wrapToAppClusterClientState) - .thenApply(Result::ofSuccess) - .get(); - } - catch (ExecutionException ex) { - logger.error("Error when fetching cluster token client state of app: " + app, ex.getCause()); - return errorResponse(ex); - } - catch (Throwable throwable) { - logger.error("Error when fetching cluster token client state of app: " + app, throwable); - return Result.ofFail(-1, throwable.getMessage()); - } - } - - @GetMapping("/state/{app}") - public Result> apiGetClusterStateOfApp(@PathVariable String app) { - if (StringUtil.isEmpty(app)) { - return Result.ofFail(-1, "app cannot be null or empty"); - } - try { - return clusterConfigService.getClusterUniversalState(app).thenApply(Result::ofSuccess).get(); - } - catch (ExecutionException ex) { - logger.error("Error when fetching cluster state of app: " + app, ex.getCause()); - return errorResponse(ex); - } - catch (Throwable throwable) { - logger.error("Error when fetching cluster state of app: " + app, throwable); - return Result.ofFail(-1, throwable.getMessage()); - } - } - - private boolean isNotSupported(Throwable ex) { - return ex instanceof CommandNotFoundException; - } - - private boolean checkIfSupported(String app, String ip, int port) { - try { - return Optional.ofNullable(appManagement.getDetailApp(app)) - .flatMap(e -> e.getMachine(ip, port)) - .flatMap(m -> VersionUtils.parseVersion(m.getVersion()).map(v -> v.greaterOrEqual(version140))) - .orElse(true); - // If error occurred or cannot retrieve machine info, return true. - } - catch (Exception ex) { - return true; - } - } - - private Result checkValidRequest(ClusterModifyRequest request) { - if (StringUtil.isEmpty(request.getApp())) { - return Result.ofFail(-1, "app cannot be empty"); - } - if (StringUtil.isEmpty(request.getIp())) { - return Result.ofFail(-1, "ip cannot be empty"); - } - if (request.getPort() == null || request.getPort() < 0) { - return Result.ofFail(-1, "invalid port"); - } - if (request.getMode() == null || request.getMode() < 0) { - return Result.ofFail(-1, "invalid mode"); - } - if (!checkIfSupported(request.getApp(), request.getIp(), request.getPort())) { - return unsupportedVersion(); - } - return null; - } - - private Result unsupportedVersion() { - return Result.ofFail(4041, - "Sentinel client not supported for cluster flow control (unsupported version or dependency absent)"); - } - - private static final String KEY_MODE = "mode"; - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/gateway/GatewayApiController.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/gateway/GatewayApiController.java deleted file mode 100644 index 9415b577..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/gateway/GatewayApiController.java +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.controller.gateway; - -import com.alibaba.csp.sentinel.dashboard.auth.AuthAction; -import com.alibaba.csp.sentinel.dashboard.auth.AuthService; -import com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient; -import com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway.ApiDefinitionEntity; -import com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway.ApiPredicateItemEntity; -import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo; -import com.alibaba.csp.sentinel.dashboard.domain.Result; -import com.alibaba.csp.sentinel.dashboard.domain.vo.gateway.api.AddApiReqVo; -import com.alibaba.csp.sentinel.dashboard.domain.vo.gateway.api.ApiPredicateItemVo; -import com.alibaba.csp.sentinel.dashboard.domain.vo.gateway.api.UpdateApiReqVo; -import com.alibaba.csp.sentinel.dashboard.repository.gateway.InMemApiDefinitionStore; -import com.alibaba.csp.sentinel.util.StringUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.*; - -import static com.alibaba.csp.sentinel.adapter.gateway.common.SentinelGatewayConstants.*; - -/** - * Gateway api Controller for manage gateway api definitions. - * - * @author cdfive - * @since 1.7.0 - */ -@RestController -@RequestMapping(value = "/gateway/api") -public class GatewayApiController { - - private final Logger logger = LoggerFactory.getLogger(GatewayApiController.class); - - @Autowired - private InMemApiDefinitionStore repository; - - @Autowired - private SentinelApiClient sentinelApiClient; - - @GetMapping("/list.json") - @AuthAction(AuthService.PrivilegeType.READ_RULE) - public Result> queryApis(String app, String ip, Integer port) { - - if (StringUtil.isEmpty(app)) { - return Result.ofFail(-1, "app can't be null or empty"); - } - if (StringUtil.isEmpty(ip)) { - return Result.ofFail(-1, "ip can't be null or empty"); - } - if (port == null) { - return Result.ofFail(-1, "port can't be null"); - } - - try { - List apis = sentinelApiClient.fetchApis(app, ip, port).get(); - repository.saveAll(apis); - return Result.ofSuccess(apis); - } - catch (Throwable throwable) { - logger.error("queryApis error:", throwable); - return Result.ofThrowable(-1, throwable); - } - } - - @PostMapping("/new.json") - @AuthAction(AuthService.PrivilegeType.WRITE_RULE) - public Result addApi(HttpServletRequest request, @RequestBody AddApiReqVo reqVo) { - - String app = reqVo.getApp(); - if (StringUtil.isBlank(app)) { - return Result.ofFail(-1, "app can't be null or empty"); - } - - ApiDefinitionEntity entity = new ApiDefinitionEntity(); - entity.setApp(app.trim()); - - String ip = reqVo.getIp(); - if (StringUtil.isBlank(ip)) { - return Result.ofFail(-1, "ip can't be null or empty"); - } - entity.setIp(ip.trim()); - - Integer port = reqVo.getPort(); - if (port == null) { - return Result.ofFail(-1, "port can't be null"); - } - entity.setPort(port); - - // API名称 - String apiName = reqVo.getApiName(); - if (StringUtil.isBlank(apiName)) { - return Result.ofFail(-1, "apiName can't be null or empty"); - } - entity.setApiName(apiName.trim()); - - // 匹配规则列表 - List predicateItems = reqVo.getPredicateItems(); - if (CollectionUtils.isEmpty(predicateItems)) { - return Result.ofFail(-1, "predicateItems can't empty"); - } - - List predicateItemEntities = new ArrayList<>(); - for (ApiPredicateItemVo predicateItem : predicateItems) { - ApiPredicateItemEntity predicateItemEntity = new ApiPredicateItemEntity(); - - // 匹配模式 - Integer matchStrategy = predicateItem.getMatchStrategy(); - if (!Arrays.asList(URL_MATCH_STRATEGY_EXACT, URL_MATCH_STRATEGY_PREFIX, URL_MATCH_STRATEGY_REGEX) - .contains(matchStrategy)) { - return Result.ofFail(-1, "invalid matchStrategy: " + matchStrategy); - } - predicateItemEntity.setMatchStrategy(matchStrategy); - - // 匹配串 - String pattern = predicateItem.getPattern(); - if (StringUtil.isBlank(pattern)) { - return Result.ofFail(-1, "pattern can't be null or empty"); - } - predicateItemEntity.setPattern(pattern); - - predicateItemEntities.add(predicateItemEntity); - } - entity.setPredicateItems(new LinkedHashSet<>(predicateItemEntities)); - - // 检查API名称不能重复 - List allApis = repository.findAllByMachine(MachineInfo.of(app.trim(), ip.trim(), port)); - if (allApis.stream().map(o -> o.getApiName()).anyMatch(o -> o.equals(apiName.trim()))) { - return Result.ofFail(-1, "apiName exists: " + apiName); - } - - Date date = new Date(); - entity.setGmtCreate(date); - entity.setGmtModified(date); - - try { - entity = repository.save(entity); - } - catch (Throwable throwable) { - logger.error("add gateway api error:", throwable); - return Result.ofThrowable(-1, throwable); - } - - if (!publishApis(app, ip, port)) { - logger.warn("publish gateway apis fail after add"); - } - - return Result.ofSuccess(entity); - } - - @PostMapping("/save.json") - @AuthAction(AuthService.PrivilegeType.WRITE_RULE) - public Result updateApi(@RequestBody UpdateApiReqVo reqVo) { - String app = reqVo.getApp(); - if (StringUtil.isBlank(app)) { - return Result.ofFail(-1, "app can't be null or empty"); - } - - Long id = reqVo.getId(); - if (id == null) { - return Result.ofFail(-1, "id can't be null"); - } - - ApiDefinitionEntity entity = repository.findById(id); - if (entity == null) { - return Result.ofFail(-1, "api does not exist, id=" + id); - } - - // 匹配规则列表 - List predicateItems = reqVo.getPredicateItems(); - if (CollectionUtils.isEmpty(predicateItems)) { - return Result.ofFail(-1, "predicateItems can't empty"); - } - - List predicateItemEntities = new ArrayList<>(); - for (ApiPredicateItemVo predicateItem : predicateItems) { - ApiPredicateItemEntity predicateItemEntity = new ApiPredicateItemEntity(); - - // 匹配模式 - int matchStrategy = predicateItem.getMatchStrategy(); - if (!Arrays.asList(URL_MATCH_STRATEGY_EXACT, URL_MATCH_STRATEGY_PREFIX, URL_MATCH_STRATEGY_REGEX) - .contains(matchStrategy)) { - return Result.ofFail(-1, "Invalid matchStrategy: " + matchStrategy); - } - predicateItemEntity.setMatchStrategy(matchStrategy); - - // 匹配串 - String pattern = predicateItem.getPattern(); - if (StringUtil.isBlank(pattern)) { - return Result.ofFail(-1, "pattern can't be null or empty"); - } - predicateItemEntity.setPattern(pattern); - - predicateItemEntities.add(predicateItemEntity); - } - entity.setPredicateItems(new LinkedHashSet<>(predicateItemEntities)); - - Date date = new Date(); - entity.setGmtModified(date); - - try { - entity = repository.save(entity); - } - catch (Throwable throwable) { - logger.error("update gateway api error:", throwable); - return Result.ofThrowable(-1, throwable); - } - - if (!publishApis(app, entity.getIp(), entity.getPort())) { - logger.warn("publish gateway apis fail after update"); - } - - return Result.ofSuccess(entity); - } - - @PostMapping("/delete.json") - @AuthAction(AuthService.PrivilegeType.DELETE_RULE) - - public Result deleteApi(Long id) { - if (id == null) { - return Result.ofFail(-1, "id can't be null"); - } - - ApiDefinitionEntity oldEntity = repository.findById(id); - if (oldEntity == null) { - return Result.ofSuccess(null); - } - - try { - repository.delete(id); - } - catch (Throwable throwable) { - logger.error("delete gateway api error:", throwable); - return Result.ofThrowable(-1, throwable); - } - - if (!publishApis(oldEntity.getApp(), oldEntity.getIp(), oldEntity.getPort())) { - logger.warn("publish gateway apis fail after delete"); - } - - return Result.ofSuccess(id); - } - - private boolean publishApis(String app, String ip, Integer port) { - List apis = repository.findAllByMachine(MachineInfo.of(app, ip, port)); - return sentinelApiClient.modifyApis(app, ip, port, apis); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/gateway/GatewayFlowRuleController.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/gateway/GatewayFlowRuleController.java deleted file mode 100644 index 5a9907c4..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/gateway/GatewayFlowRuleController.java +++ /dev/null @@ -1,449 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.controller.gateway; - -import com.alibaba.csp.sentinel.dashboard.auth.AuthAction; -import com.alibaba.csp.sentinel.dashboard.auth.AuthService; -import com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient; -import com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway.GatewayFlowRuleEntity; -import com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway.GatewayParamFlowItemEntity; -import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo; -import com.alibaba.csp.sentinel.dashboard.domain.Result; -import com.alibaba.csp.sentinel.dashboard.domain.vo.gateway.rule.AddFlowRuleReqVo; -import com.alibaba.csp.sentinel.dashboard.domain.vo.gateway.rule.GatewayParamFlowItemVo; -import com.alibaba.csp.sentinel.dashboard.domain.vo.gateway.rule.UpdateFlowRuleReqVo; -import com.alibaba.csp.sentinel.dashboard.repository.gateway.InMemGatewayFlowRuleStore; -import com.alibaba.csp.sentinel.util.StringUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.Arrays; -import java.util.Date; -import java.util.List; - -import static com.alibaba.csp.sentinel.adapter.gateway.common.SentinelGatewayConstants.*; -import static com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway.GatewayFlowRuleEntity.*; -import static com.alibaba.csp.sentinel.slots.block.RuleConstant.*; - -/** - * Gateway flow rule Controller for manage gateway flow rules. - * - * @author cdfive - * @since 1.7.0 - */ -@RestController -@RequestMapping(value = "/gateway/flow") -public class GatewayFlowRuleController { - - private final Logger logger = LoggerFactory.getLogger(GatewayFlowRuleController.class); - - @Autowired - private InMemGatewayFlowRuleStore repository; - - @Autowired - private SentinelApiClient sentinelApiClient; - - @GetMapping("/list.json") - @AuthAction(AuthService.PrivilegeType.READ_RULE) - public Result> queryFlowRules(String app, String ip, Integer port) { - - if (StringUtil.isEmpty(app)) { - return Result.ofFail(-1, "app can't be null or empty"); - } - if (StringUtil.isEmpty(ip)) { - return Result.ofFail(-1, "ip can't be null or empty"); - } - if (port == null) { - return Result.ofFail(-1, "port can't be null"); - } - - try { - List rules = sentinelApiClient.fetchGatewayFlowRules(app, ip, port).get(); - repository.saveAll(rules); - return Result.ofSuccess(rules); - } - catch (Throwable throwable) { - logger.error("query gateway flow rules error:", throwable); - return Result.ofThrowable(-1, throwable); - } - } - - @PostMapping("/new.json") - @AuthAction(AuthService.PrivilegeType.WRITE_RULE) - public Result addFlowRule(@RequestBody AddFlowRuleReqVo reqVo) { - - String app = reqVo.getApp(); - if (StringUtil.isBlank(app)) { - return Result.ofFail(-1, "app can't be null or empty"); - } - - GatewayFlowRuleEntity entity = new GatewayFlowRuleEntity(); - entity.setApp(app.trim()); - - String ip = reqVo.getIp(); - if (StringUtil.isBlank(ip)) { - return Result.ofFail(-1, "ip can't be null or empty"); - } - entity.setIp(ip.trim()); - - Integer port = reqVo.getPort(); - if (port == null) { - return Result.ofFail(-1, "port can't be null"); - } - entity.setPort(port); - - // API类型, Route ID或API分组 - Integer resourceMode = reqVo.getResourceMode(); - if (resourceMode == null) { - return Result.ofFail(-1, "resourceMode can't be null"); - } - if (!Arrays.asList(RESOURCE_MODE_ROUTE_ID, RESOURCE_MODE_CUSTOM_API_NAME).contains(resourceMode)) { - return Result.ofFail(-1, "invalid resourceMode: " + resourceMode); - } - entity.setResourceMode(resourceMode); - - // API名称 - String resource = reqVo.getResource(); - if (StringUtil.isBlank(resource)) { - return Result.ofFail(-1, "resource can't be null or empty"); - } - entity.setResource(resource.trim()); - - // 针对请求属性 - GatewayParamFlowItemVo paramItem = reqVo.getParamItem(); - if (paramItem != null) { - GatewayParamFlowItemEntity itemEntity = new GatewayParamFlowItemEntity(); - entity.setParamItem(itemEntity); - - // 参数属性 0-ClientIP 1-Remote Host 2-Header 3-URL参数 4-Cookie - Integer parseStrategy = paramItem.getParseStrategy(); - if (!Arrays - .asList(PARAM_PARSE_STRATEGY_CLIENT_IP, PARAM_PARSE_STRATEGY_HOST, PARAM_PARSE_STRATEGY_HEADER, - PARAM_PARSE_STRATEGY_URL_PARAM, PARAM_PARSE_STRATEGY_COOKIE) - .contains(parseStrategy)) { - return Result.ofFail(-1, "invalid parseStrategy: " + parseStrategy); - } - itemEntity.setParseStrategy(paramItem.getParseStrategy()); - - // 当参数属性为2-Header 3-URL参数 4-Cookie时,参数名称必填 - if (Arrays.asList(PARAM_PARSE_STRATEGY_HEADER, PARAM_PARSE_STRATEGY_URL_PARAM, PARAM_PARSE_STRATEGY_COOKIE) - .contains(parseStrategy)) { - // 参数名称 - String fieldName = paramItem.getFieldName(); - if (StringUtil.isBlank(fieldName)) { - return Result.ofFail(-1, "fieldName can't be null or empty"); - } - itemEntity.setFieldName(paramItem.getFieldName()); - } - - String pattern = paramItem.getPattern(); - // 如果匹配串不为空,验证匹配模式 - if (StringUtil.isNotEmpty(pattern)) { - itemEntity.setPattern(pattern); - Integer matchStrategy = paramItem.getMatchStrategy(); - if (!Arrays - .asList(PARAM_MATCH_STRATEGY_EXACT, PARAM_MATCH_STRATEGY_CONTAINS, PARAM_MATCH_STRATEGY_REGEX) - .contains(matchStrategy)) { - return Result.ofFail(-1, "invalid matchStrategy: " + matchStrategy); - } - itemEntity.setMatchStrategy(matchStrategy); - } - } - - // 阈值类型 0-线程数 1-QPS - Integer grade = reqVo.getGrade(); - if (grade == null) { - return Result.ofFail(-1, "grade can't be null"); - } - if (!Arrays.asList(FLOW_GRADE_THREAD, FLOW_GRADE_QPS).contains(grade)) { - return Result.ofFail(-1, "invalid grade: " + grade); - } - entity.setGrade(grade); - - // QPS阈值 - Double count = reqVo.getCount(); - if (count == null) { - return Result.ofFail(-1, "count can't be null"); - } - if (count < 0) { - return Result.ofFail(-1, "count should be at lease zero"); - } - entity.setCount(count); - - // 间隔 - Long interval = reqVo.getInterval(); - if (interval == null) { - return Result.ofFail(-1, "interval can't be null"); - } - if (interval <= 0) { - return Result.ofFail(-1, "interval should be greater than zero"); - } - entity.setInterval(interval); - - // 间隔单位 - Integer intervalUnit = reqVo.getIntervalUnit(); - if (intervalUnit == null) { - return Result.ofFail(-1, "intervalUnit can't be null"); - } - if (!Arrays.asList(INTERVAL_UNIT_SECOND, INTERVAL_UNIT_MINUTE, INTERVAL_UNIT_HOUR, INTERVAL_UNIT_DAY) - .contains(intervalUnit)) { - return Result.ofFail(-1, "Invalid intervalUnit: " + intervalUnit); - } - entity.setIntervalUnit(intervalUnit); - - // 流控方式 0-快速失败 2-匀速排队 - Integer controlBehavior = reqVo.getControlBehavior(); - if (controlBehavior == null) { - return Result.ofFail(-1, "controlBehavior can't be null"); - } - if (!Arrays.asList(CONTROL_BEHAVIOR_DEFAULT, CONTROL_BEHAVIOR_RATE_LIMITER).contains(controlBehavior)) { - return Result.ofFail(-1, "invalid controlBehavior: " + controlBehavior); - } - entity.setControlBehavior(controlBehavior); - - if (CONTROL_BEHAVIOR_DEFAULT == controlBehavior) { - // 0-快速失败, 则Burst size必填 - Integer burst = reqVo.getBurst(); - if (burst == null) { - return Result.ofFail(-1, "burst can't be null"); - } - if (burst < 0) { - return Result.ofFail(-1, "invalid burst: " + burst); - } - entity.setBurst(burst); - } - else if (CONTROL_BEHAVIOR_RATE_LIMITER == controlBehavior) { - // 1-匀速排队, 则超时时间必填 - Integer maxQueueingTimeoutMs = reqVo.getMaxQueueingTimeoutMs(); - if (maxQueueingTimeoutMs == null) { - return Result.ofFail(-1, "maxQueueingTimeoutMs can't be null"); - } - if (maxQueueingTimeoutMs < 0) { - return Result.ofFail(-1, "invalid maxQueueingTimeoutMs: " + maxQueueingTimeoutMs); - } - entity.setMaxQueueingTimeoutMs(maxQueueingTimeoutMs); - } - - Date date = new Date(); - entity.setGmtCreate(date); - entity.setGmtModified(date); - - try { - entity = repository.save(entity); - } - catch (Throwable throwable) { - logger.error("add gateway flow rule error:", throwable); - return Result.ofThrowable(-1, throwable); - } - - if (!publishRules(app, ip, port)) { - logger.warn("publish gateway flow rules fail after add"); - } - - return Result.ofSuccess(entity); - } - - @PostMapping("/save.json") - @AuthAction(AuthService.PrivilegeType.WRITE_RULE) - public Result updateFlowRule(@RequestBody UpdateFlowRuleReqVo reqVo) { - - String app = reqVo.getApp(); - if (StringUtil.isBlank(app)) { - return Result.ofFail(-1, "app can't be null or empty"); - } - - Long id = reqVo.getId(); - if (id == null) { - return Result.ofFail(-1, "id can't be null"); - } - - GatewayFlowRuleEntity entity = repository.findById(id); - if (entity == null) { - return Result.ofFail(-1, "gateway flow rule does not exist, id=" + id); - } - - // 针对请求属性 - GatewayParamFlowItemVo paramItem = reqVo.getParamItem(); - if (paramItem != null) { - GatewayParamFlowItemEntity itemEntity = new GatewayParamFlowItemEntity(); - entity.setParamItem(itemEntity); - - // 参数属性 0-ClientIP 1-Remote Host 2-Header 3-URL参数 4-Cookie - Integer parseStrategy = paramItem.getParseStrategy(); - if (!Arrays - .asList(PARAM_PARSE_STRATEGY_CLIENT_IP, PARAM_PARSE_STRATEGY_HOST, PARAM_PARSE_STRATEGY_HEADER, - PARAM_PARSE_STRATEGY_URL_PARAM, PARAM_PARSE_STRATEGY_COOKIE) - .contains(parseStrategy)) { - return Result.ofFail(-1, "invalid parseStrategy: " + parseStrategy); - } - itemEntity.setParseStrategy(paramItem.getParseStrategy()); - - // 当参数属性为2-Header 3-URL参数 4-Cookie时,参数名称必填 - if (Arrays.asList(PARAM_PARSE_STRATEGY_HEADER, PARAM_PARSE_STRATEGY_URL_PARAM, PARAM_PARSE_STRATEGY_COOKIE) - .contains(parseStrategy)) { - // 参数名称 - String fieldName = paramItem.getFieldName(); - if (StringUtil.isBlank(fieldName)) { - return Result.ofFail(-1, "fieldName can't be null or empty"); - } - itemEntity.setFieldName(paramItem.getFieldName()); - } - - String pattern = paramItem.getPattern(); - // 如果匹配串不为空,验证匹配模式 - if (StringUtil.isNotEmpty(pattern)) { - itemEntity.setPattern(pattern); - Integer matchStrategy = paramItem.getMatchStrategy(); - if (!Arrays - .asList(PARAM_MATCH_STRATEGY_EXACT, PARAM_MATCH_STRATEGY_CONTAINS, PARAM_MATCH_STRATEGY_REGEX) - .contains(matchStrategy)) { - return Result.ofFail(-1, "invalid matchStrategy: " + matchStrategy); - } - itemEntity.setMatchStrategy(matchStrategy); - } - } - else { - entity.setParamItem(null); - } - - // 阈值类型 0-线程数 1-QPS - Integer grade = reqVo.getGrade(); - if (grade == null) { - return Result.ofFail(-1, "grade can't be null"); - } - if (!Arrays.asList(FLOW_GRADE_THREAD, FLOW_GRADE_QPS).contains(grade)) { - return Result.ofFail(-1, "invalid grade: " + grade); - } - entity.setGrade(grade); - - // QPS阈值 - Double count = reqVo.getCount(); - if (count == null) { - return Result.ofFail(-1, "count can't be null"); - } - if (count < 0) { - return Result.ofFail(-1, "count should be at lease zero"); - } - entity.setCount(count); - - // 间隔 - Long interval = reqVo.getInterval(); - if (interval == null) { - return Result.ofFail(-1, "interval can't be null"); - } - if (interval <= 0) { - return Result.ofFail(-1, "interval should be greater than zero"); - } - entity.setInterval(interval); - - // 间隔单位 - Integer intervalUnit = reqVo.getIntervalUnit(); - if (intervalUnit == null) { - return Result.ofFail(-1, "intervalUnit can't be null"); - } - if (!Arrays.asList(INTERVAL_UNIT_SECOND, INTERVAL_UNIT_MINUTE, INTERVAL_UNIT_HOUR, INTERVAL_UNIT_DAY) - .contains(intervalUnit)) { - return Result.ofFail(-1, "Invalid intervalUnit: " + intervalUnit); - } - entity.setIntervalUnit(intervalUnit); - - // 流控方式 0-快速失败 2-匀速排队 - Integer controlBehavior = reqVo.getControlBehavior(); - if (controlBehavior == null) { - return Result.ofFail(-1, "controlBehavior can't be null"); - } - if (!Arrays.asList(CONTROL_BEHAVIOR_DEFAULT, CONTROL_BEHAVIOR_RATE_LIMITER).contains(controlBehavior)) { - return Result.ofFail(-1, "invalid controlBehavior: " + controlBehavior); - } - entity.setControlBehavior(controlBehavior); - - if (CONTROL_BEHAVIOR_DEFAULT == controlBehavior) { - // 0-快速失败, 则Burst size必填 - Integer burst = reqVo.getBurst(); - if (burst == null) { - return Result.ofFail(-1, "burst can't be null"); - } - if (burst < 0) { - return Result.ofFail(-1, "invalid burst: " + burst); - } - entity.setBurst(burst); - } - else if (CONTROL_BEHAVIOR_RATE_LIMITER == controlBehavior) { - // 2-匀速排队, 则超时时间必填 - Integer maxQueueingTimeoutMs = reqVo.getMaxQueueingTimeoutMs(); - if (maxQueueingTimeoutMs == null) { - return Result.ofFail(-1, "maxQueueingTimeoutMs can't be null"); - } - if (maxQueueingTimeoutMs < 0) { - return Result.ofFail(-1, "invalid maxQueueingTimeoutMs: " + maxQueueingTimeoutMs); - } - entity.setMaxQueueingTimeoutMs(maxQueueingTimeoutMs); - } - - Date date = new Date(); - entity.setGmtModified(date); - - try { - entity = repository.save(entity); - } - catch (Throwable throwable) { - logger.error("update gateway flow rule error:", throwable); - return Result.ofThrowable(-1, throwable); - } - - if (!publishRules(app, entity.getIp(), entity.getPort())) { - logger.warn("publish gateway flow rules fail after update"); - } - - return Result.ofSuccess(entity); - } - - @PostMapping("/delete.json") - @AuthAction(AuthService.PrivilegeType.DELETE_RULE) - public Result deleteFlowRule(Long id) { - - if (id == null) { - return Result.ofFail(-1, "id can't be null"); - } - - GatewayFlowRuleEntity oldEntity = repository.findById(id); - if (oldEntity == null) { - return Result.ofSuccess(null); - } - - try { - repository.delete(id); - } - catch (Throwable throwable) { - logger.error("delete gateway flow rule error:", throwable); - return Result.ofThrowable(-1, throwable); - } - - if (!publishRules(oldEntity.getApp(), oldEntity.getIp(), oldEntity.getPort())) { - logger.warn("publish gateway flow rules fail after delete"); - } - - return Result.ofSuccess(id); - } - - private boolean publishRules(String app, String ip, Integer port) { - List rules = repository.findAllByMachine(MachineInfo.of(app, ip, port)); - return sentinelApiClient.modifyGatewayFlowRules(app, ip, port, rules); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/v2/FlowControllerV2.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/v2/FlowControllerV2.java deleted file mode 100644 index 99b595bb..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/v2/FlowControllerV2.java +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.controller.v2; - -import com.alibaba.csp.sentinel.dashboard.auth.AuthAction; -import com.alibaba.csp.sentinel.dashboard.auth.AuthService.PrivilegeType; -import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.FlowRuleEntity; -import com.alibaba.csp.sentinel.dashboard.domain.Result; -import com.alibaba.csp.sentinel.dashboard.repository.rule.InMemoryRuleRepositoryAdapter; -import com.alibaba.csp.sentinel.dashboard.rule.DynamicRuleProvider; -import com.alibaba.csp.sentinel.dashboard.rule.DynamicRulePublisher; -import com.alibaba.csp.sentinel.util.StringUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.web.bind.annotation.*; - -import java.util.Date; -import java.util.List; - -/** - * Flow rule controller (v2). - * - * @author Eric Zhao - * @since 1.4.0 - */ -@RestController -@RequestMapping(value = "/v2/flow") -public class FlowControllerV2 { - - private final Logger logger = LoggerFactory.getLogger(FlowControllerV2.class); - - @Autowired - private InMemoryRuleRepositoryAdapter repository; - - @Autowired - @Qualifier("flowRuleDefaultProvider") - private DynamicRuleProvider> ruleProvider; - - @Autowired - @Qualifier("flowRuleDefaultPublisher") - private DynamicRulePublisher> rulePublisher; - - @GetMapping("/rules") - @AuthAction(PrivilegeType.READ_RULE) - public Result> apiQueryMachineRules(@RequestParam String app) { - - if (StringUtil.isEmpty(app)) { - return Result.ofFail(-1, "app can't be null or empty"); - } - try { - List rules = ruleProvider.getRules(app); - if (rules != null && !rules.isEmpty()) { - for (FlowRuleEntity entity : rules) { - entity.setApp(app); - if (entity.getClusterConfig() != null && entity.getClusterConfig().getFlowId() != null) { - entity.setId(entity.getClusterConfig().getFlowId()); - } - } - } - rules = repository.saveAll(rules); - return Result.ofSuccess(rules); - } - catch (Throwable throwable) { - logger.error("Error when querying flow rules", throwable); - return Result.ofThrowable(-1, throwable); - } - } - - private Result checkEntityInternal(FlowRuleEntity entity) { - if (entity == null) { - return Result.ofFail(-1, "invalid body"); - } - if (StringUtil.isBlank(entity.getApp())) { - return Result.ofFail(-1, "app can't be null or empty"); - } - if (StringUtil.isBlank(entity.getLimitApp())) { - return Result.ofFail(-1, "limitApp can't be null or empty"); - } - if (StringUtil.isBlank(entity.getResource())) { - return Result.ofFail(-1, "resource can't be null or empty"); - } - if (entity.getGrade() == null) { - return Result.ofFail(-1, "grade can't be null"); - } - if (entity.getGrade() != 0 && entity.getGrade() != 1) { - return Result.ofFail(-1, "grade must be 0 or 1, but " + entity.getGrade() + " got"); - } - if (entity.getCount() == null || entity.getCount() < 0) { - return Result.ofFail(-1, "count should be at lease zero"); - } - if (entity.getStrategy() == null) { - return Result.ofFail(-1, "strategy can't be null"); - } - if (entity.getStrategy() != 0 && StringUtil.isBlank(entity.getRefResource())) { - return Result.ofFail(-1, "refResource can't be null or empty when strategy!=0"); - } - if (entity.getControlBehavior() == null) { - return Result.ofFail(-1, "controlBehavior can't be null"); - } - int controlBehavior = entity.getControlBehavior(); - if (controlBehavior == 1 && entity.getWarmUpPeriodSec() == null) { - return Result.ofFail(-1, "warmUpPeriodSec can't be null when controlBehavior==1"); - } - if (controlBehavior == 2 && entity.getMaxQueueingTimeMs() == null) { - return Result.ofFail(-1, "maxQueueingTimeMs can't be null when controlBehavior==2"); - } - if (entity.isClusterMode() && entity.getClusterConfig() == null) { - return Result.ofFail(-1, "cluster config should be valid"); - } - return null; - } - - @PostMapping("/rule") - @AuthAction(value = PrivilegeType.WRITE_RULE) - public Result apiAddFlowRule(@RequestBody FlowRuleEntity entity) { - - Result checkResult = checkEntityInternal(entity); - if (checkResult != null) { - return checkResult; - } - entity.setId(null); - Date date = new Date(); - entity.setGmtCreate(date); - entity.setGmtModified(date); - entity.setLimitApp(entity.getLimitApp().trim()); - entity.setResource(entity.getResource().trim()); - try { - entity = repository.save(entity); - publishRules(entity.getApp()); - } - catch (Throwable throwable) { - logger.error("Failed to add flow rule", throwable); - return Result.ofThrowable(-1, throwable); - } - return Result.ofSuccess(entity); - } - - @PutMapping("/rule/{id}") - @AuthAction(PrivilegeType.WRITE_RULE) - - public Result apiUpdateFlowRule(@PathVariable("id") Long id, @RequestBody FlowRuleEntity entity) { - if (id == null || id <= 0) { - return Result.ofFail(-1, "Invalid id"); - } - FlowRuleEntity oldEntity = repository.findById(id); - if (oldEntity == null) { - return Result.ofFail(-1, "id " + id + " does not exist"); - } - if (entity == null) { - return Result.ofFail(-1, "invalid body"); - } - - entity.setApp(oldEntity.getApp()); - entity.setIp(oldEntity.getIp()); - entity.setPort(oldEntity.getPort()); - Result checkResult = checkEntityInternal(entity); - if (checkResult != null) { - return checkResult; - } - - entity.setId(id); - Date date = new Date(); - entity.setGmtCreate(oldEntity.getGmtCreate()); - entity.setGmtModified(date); - try { - entity = repository.save(entity); - if (entity == null) { - return Result.ofFail(-1, "save entity fail"); - } - publishRules(oldEntity.getApp()); - } - catch (Throwable throwable) { - logger.error("Failed to update flow rule", throwable); - return Result.ofThrowable(-1, throwable); - } - return Result.ofSuccess(entity); - } - - @DeleteMapping("/rule/{id}") - @AuthAction(PrivilegeType.DELETE_RULE) - public Result apiDeleteRule(@PathVariable("id") Long id) { - if (id == null || id <= 0) { - return Result.ofFail(-1, "Invalid id"); - } - FlowRuleEntity oldEntity = repository.findById(id); - if (oldEntity == null) { - return Result.ofSuccess(null); - } - - try { - repository.delete(id); - publishRules(oldEntity.getApp()); - } - catch (Exception e) { - return Result.ofFail(-1, e.getMessage()); - } - return Result.ofSuccess(id); - } - - private void publishRules(/* @NonNull */ String app) throws Exception { - List rules = repository.findAllByApp(app); - rulePublisher.publish(app, rules); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/ApplicationEntity.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/ApplicationEntity.java deleted file mode 100644 index 953c7849..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/ApplicationEntity.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.datasource.entity; - -import com.alibaba.csp.sentinel.dashboard.discovery.AppInfo; - -import java.util.Date; - -/** - * @author leyou - */ -public class ApplicationEntity { - - private Long id; - - private Date gmtCreate; - - private Date gmtModified; - - private String app; - - private Integer appType; - - private String activeConsole; - - private Date lastFetch; - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public Date getGmtCreate() { - return gmtCreate; - } - - public void setGmtCreate(Date gmtCreate) { - this.gmtCreate = gmtCreate; - } - - public Date getGmtModified() { - return gmtModified; - } - - public void setGmtModified(Date gmtModified) { - this.gmtModified = gmtModified; - } - - public String getApp() { - return app; - } - - public void setApp(String app) { - this.app = app; - } - - public Integer getAppType() { - return appType; - } - - public void setAppType(Integer appType) { - this.appType = appType; - } - - public String getActiveConsole() { - return activeConsole; - } - - public Date getLastFetch() { - return lastFetch; - } - - public void setLastFetch(Date lastFetch) { - this.lastFetch = lastFetch; - } - - public void setActiveConsole(String activeConsole) { - this.activeConsole = activeConsole; - } - - public AppInfo toAppInfo() { - return new AppInfo(app, appType); - } - - @Override - public String toString() { - return "ApplicationEntity{" + "id=" + id + ", gmtCreate=" + gmtCreate + ", gmtModified=" + gmtModified - + ", app='" + app + '\'' + ", activeConsole='" + activeConsole + '\'' + ", lastFetch=" + lastFetch - + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/MachineEntity.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/MachineEntity.java deleted file mode 100644 index 79d8a7ff..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/MachineEntity.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.datasource.entity; - -import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo; - -import java.util.Date; - -/** - * @author leyou - */ -public class MachineEntity { - - private Long id; - - private Date gmtCreate; - - private Date gmtModified; - - private String app; - - private String ip; - - private String hostname; - - private Date timestamp; - - private Integer port; - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public Date getGmtCreate() { - return gmtCreate; - } - - public void setGmtCreate(Date gmtCreate) { - this.gmtCreate = gmtCreate; - } - - public Date getGmtModified() { - return gmtModified; - } - - public void setGmtModified(Date gmtModified) { - this.gmtModified = gmtModified; - } - - public String getApp() { - return app; - } - - public void setApp(String app) { - this.app = app; - } - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public String getHostname() { - return hostname; - } - - public void setHostname(String hostname) { - this.hostname = hostname; - } - - public Date getTimestamp() { - return timestamp; - } - - public void setTimestamp(Date timestamp) { - this.timestamp = timestamp; - } - - public Integer getPort() { - return port; - } - - public void setPort(Integer port) { - this.port = port; - } - - public MachineInfo toMachineInfo() { - MachineInfo machineInfo = new MachineInfo(); - - machineInfo.setApp(app); - machineInfo.setHostname(hostname); - machineInfo.setIp(ip); - machineInfo.setPort(port); - machineInfo.setLastHeartbeat(timestamp.getTime()); - machineInfo.setHeartbeatVersion(timestamp.getTime()); - - return machineInfo; - } - - @Override - public String toString() { - return "MachineEntity{" + "id=" + id + ", gmtCreate=" + gmtCreate + ", gmtModified=" + gmtModified + ", app='" - + app + '\'' + ", ip='" + ip + '\'' + ", hostname='" + hostname + '\'' + ", timestamp=" + timestamp - + ", port=" + port + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/MetricEntity.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/MetricEntity.java deleted file mode 100644 index 0f90f945..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/MetricEntity.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.datasource.entity; - -import java.util.Date; - -/** - * @author leyou - */ -public class MetricEntity { - - private Long id; - - private Date gmtCreate; - - private Date gmtModified; - - private String app; - - /** - * 监控信息的时间戳 - */ - private Date timestamp; - - private String resource; - - private Long passQps; - - private Long successQps; - - private Long blockQps; - - private Long exceptionQps; - - /** - * summary rt of all success exit qps. - */ - private double rt; - - /** - * 本次聚合的总条数 - */ - private int count; - - private int resourceCode; - - public static MetricEntity copyOf(MetricEntity oldEntity) { - MetricEntity entity = new MetricEntity(); - entity.setId(oldEntity.getId()); - entity.setGmtCreate(oldEntity.getGmtCreate()); - entity.setGmtModified(oldEntity.getGmtModified()); - entity.setApp(oldEntity.getApp()); - entity.setTimestamp(oldEntity.getTimestamp()); - entity.setResource(oldEntity.getResource()); - entity.setPassQps(oldEntity.getPassQps()); - entity.setBlockQps(oldEntity.getBlockQps()); - entity.setSuccessQps(oldEntity.getSuccessQps()); - entity.setExceptionQps(oldEntity.getExceptionQps()); - entity.setRt(oldEntity.getRt()); - entity.setCount(oldEntity.getCount()); - return entity; - } - - public synchronized void addPassQps(Long passQps) { - this.passQps += passQps; - } - - public synchronized void addBlockQps(Long blockQps) { - this.blockQps += blockQps; - } - - public synchronized void addExceptionQps(Long exceptionQps) { - this.exceptionQps += exceptionQps; - } - - public synchronized void addCount(int count) { - this.count += count; - } - - public synchronized void addRtAndSuccessQps(double avgRt, Long successQps) { - this.rt += avgRt * successQps; - this.successQps += successQps; - } - - /** - * {@link #rt} = {@code avgRt * successQps} - * @param avgRt average rt of {@code successQps} - * @param successQps - */ - public synchronized void setRtAndSuccessQps(double avgRt, Long successQps) { - this.rt = avgRt * successQps; - this.successQps = successQps; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Date getGmtCreate() { - return gmtCreate; - } - - public void setGmtCreate(Date gmtCreate) { - this.gmtCreate = gmtCreate; - } - - public Date getGmtModified() { - return gmtModified; - } - - public void setGmtModified(Date gmtModified) { - this.gmtModified = gmtModified; - } - - public String getApp() { - return app; - } - - public void setApp(String app) { - this.app = app; - } - - public Date getTimestamp() { - return timestamp; - } - - public void setTimestamp(Date timestamp) { - this.timestamp = timestamp; - } - - public String getResource() { - return resource; - } - - public void setResource(String resource) { - this.resource = resource; - this.resourceCode = resource.hashCode(); - } - - public Long getPassQps() { - return passQps; - } - - public void setPassQps(Long passQps) { - this.passQps = passQps; - } - - public Long getBlockQps() { - return blockQps; - } - - public void setBlockQps(Long blockQps) { - this.blockQps = blockQps; - } - - public Long getExceptionQps() { - return exceptionQps; - } - - public void setExceptionQps(Long exceptionQps) { - this.exceptionQps = exceptionQps; - } - - public double getRt() { - return rt; - } - - public void setRt(double rt) { - this.rt = rt; - } - - public int getCount() { - return count; - } - - public void setCount(int count) { - this.count = count; - } - - public int getResourceCode() { - return resourceCode; - } - - public Long getSuccessQps() { - return successQps; - } - - public void setSuccessQps(Long successQps) { - this.successQps = successQps; - } - - @Override - public String toString() { - return "MetricEntity{" + "id=" + id + ", gmtCreate=" + gmtCreate + ", gmtModified=" + gmtModified + ", app='" - + app + '\'' + ", timestamp=" + timestamp + ", resource='" + resource + '\'' + ", passQps=" + passQps - + ", blockQps=" + blockQps + ", successQps=" + successQps + ", exceptionQps=" + exceptionQps + ", rt=" - + rt + ", count=" + count + ", resourceCode=" + resourceCode + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/MetricPositionEntity.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/MetricPositionEntity.java deleted file mode 100644 index b01b68a6..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/MetricPositionEntity.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.datasource.entity; - -import java.util.Date; - -/** - * @author leyou - */ -public class MetricPositionEntity { - - private long id; - - private Date gmtCreate; - - private Date gmtModified; - - private String app; - - private String ip; - - /** - * Sentinel在该应用上使用的端口 - */ - private int port; - - /** - * 机器名,冗余字段 - */ - private String hostname; - - /** - * 上一次拉取的最晚时间戳 - */ - private Date lastFetch; - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public Date getGmtCreate() { - return gmtCreate; - } - - public void setGmtCreate(Date gmtCreate) { - this.gmtCreate = gmtCreate; - } - - public Date getGmtModified() { - return gmtModified; - } - - public void setGmtModified(Date gmtModified) { - this.gmtModified = gmtModified; - } - - public String getApp() { - return app; - } - - public void setApp(String app) { - this.app = app; - } - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public int getPort() { - return port; - } - - public void setPort(int port) { - this.port = port; - } - - public String getHostname() { - return hostname; - } - - public void setHostname(String hostname) { - this.hostname = hostname; - } - - public Date getLastFetch() { - return lastFetch; - } - - public void setLastFetch(Date lastFetch) { - this.lastFetch = lastFetch; - } - - @Override - public String toString() { - return "MetricPositionEntity{" + "id=" + id + ", gmtCreate=" + gmtCreate + ", gmtModified=" + gmtModified - + ", app='" + app + '\'' + ", ip='" + ip + '\'' + ", port=" + port + ", hostname='" + hostname + '\'' - + ", lastFetch=" + lastFetch + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/SentinelVersion.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/SentinelVersion.java deleted file mode 100644 index 7dddb8f3..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/SentinelVersion.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.datasource.entity; - -/** - * @author Eric Zhao - * @since 0.2.1 - */ -public class SentinelVersion { - - private int majorVersion; - - private int minorVersion; - - private int fixVersion; - - private String postfix; - - public SentinelVersion() { - this(0, 0, 0); - } - - public SentinelVersion(int major, int minor, int fix) { - this(major, minor, fix, null); - } - - public SentinelVersion(int major, int minor, int fix, String postfix) { - this.majorVersion = major; - this.minorVersion = minor; - this.fixVersion = fix; - this.postfix = postfix; - } - - /** - * 000, 000, 000 - */ - public int getFullVersion() { - return majorVersion * 1000000 + minorVersion * 1000 + fixVersion; - } - - public int getMajorVersion() { - return majorVersion; - } - - public SentinelVersion setMajorVersion(int majorVersion) { - this.majorVersion = majorVersion; - return this; - } - - public int getMinorVersion() { - return minorVersion; - } - - public SentinelVersion setMinorVersion(int minorVersion) { - this.minorVersion = minorVersion; - return this; - } - - public int getFixVersion() { - return fixVersion; - } - - public SentinelVersion setFixVersion(int fixVersion) { - this.fixVersion = fixVersion; - return this; - } - - public String getPostfix() { - return postfix; - } - - public SentinelVersion setPostfix(String postfix) { - this.postfix = postfix; - return this; - } - - public boolean greaterThan(SentinelVersion version) { - if (version == null) { - return true; - } - return getFullVersion() > version.getFullVersion(); - } - - public boolean greaterOrEqual(SentinelVersion version) { - if (version == null) { - return true; - } - return getFullVersion() >= version.getFullVersion(); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - SentinelVersion that = (SentinelVersion) o; - - if (getFullVersion() != that.getFullVersion()) { - return false; - } - return postfix != null ? postfix.equals(that.postfix) : that.postfix == null; - } - - @Override - public int hashCode() { - int result = majorVersion; - result = 31 * result + minorVersion; - result = 31 * result + fixVersion; - result = 31 * result + (postfix != null ? postfix.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "SentinelVersion{" + "majorVersion=" + majorVersion + ", minorVersion=" + minorVersion + ", fixVersion=" - + fixVersion + ", postfix='" + postfix + '\'' + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/gateway/ApiDefinitionEntity.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/gateway/ApiDefinitionEntity.java deleted file mode 100644 index dde2b193..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/gateway/ApiDefinitionEntity.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway; - -import com.alibaba.csp.sentinel.adapter.gateway.common.api.ApiDefinition; -import com.alibaba.csp.sentinel.adapter.gateway.common.api.ApiPathPredicateItem; -import com.alibaba.csp.sentinel.adapter.gateway.common.api.ApiPredicateItem; -import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.RuleEntity; -import com.alibaba.csp.sentinel.slots.block.Rule; - -import java.util.Date; -import java.util.LinkedHashSet; -import java.util.Objects; -import java.util.Set; - -/** - * Entity for {@link ApiDefinition}. - * - * @author cdfive - * @since 1.7.0 - */ -public class ApiDefinitionEntity implements RuleEntity { - - private Long id; - - private String app; - - private String ip; - - private Integer port; - - private Date gmtCreate; - - private Date gmtModified; - - private String apiName; - - private Set predicateItems; - - public static ApiDefinitionEntity fromApiDefinition(String app, String ip, Integer port, - ApiDefinition apiDefinition) { - ApiDefinitionEntity entity = new ApiDefinitionEntity(); - entity.setApp(app); - entity.setIp(ip); - entity.setPort(port); - entity.setApiName(apiDefinition.getApiName()); - - Set predicateItems = new LinkedHashSet<>(); - entity.setPredicateItems(predicateItems); - - Set apiPredicateItems = apiDefinition.getPredicateItems(); - if (apiPredicateItems != null) { - for (ApiPredicateItem apiPredicateItem : apiPredicateItems) { - ApiPredicateItemEntity itemEntity = new ApiPredicateItemEntity(); - predicateItems.add(itemEntity); - ApiPathPredicateItem pathPredicateItem = (ApiPathPredicateItem) apiPredicateItem; - itemEntity.setPattern(pathPredicateItem.getPattern()); - itemEntity.setMatchStrategy(pathPredicateItem.getMatchStrategy()); - } - } - - return entity; - } - - public ApiDefinition toApiDefinition() { - ApiDefinition apiDefinition = new ApiDefinition(); - apiDefinition.setApiName(apiName); - - Set apiPredicateItems = new LinkedHashSet<>(); - apiDefinition.setPredicateItems(apiPredicateItems); - - if (predicateItems != null) { - for (ApiPredicateItemEntity predicateItem : predicateItems) { - ApiPathPredicateItem apiPredicateItem = new ApiPathPredicateItem(); - apiPredicateItems.add(apiPredicateItem); - apiPredicateItem.setMatchStrategy(predicateItem.getMatchStrategy()); - apiPredicateItem.setPattern(predicateItem.getPattern()); - } - } - - return apiDefinition; - } - - public ApiDefinitionEntity() { - - } - - public ApiDefinitionEntity(String apiName, Set predicateItems) { - this.apiName = apiName; - this.predicateItems = predicateItems; - } - - public String getApiName() { - return apiName; - } - - public void setApiName(String apiName) { - this.apiName = apiName; - } - - public Set getPredicateItems() { - return predicateItems; - } - - public void setPredicateItems(Set predicateItems) { - this.predicateItems = predicateItems; - } - - @Override - public Long getId() { - return id; - } - - @Override - public void setId(Long id) { - this.id = id; - } - - @Override - public String getApp() { - return app; - } - - public void setApp(String app) { - this.app = app; - } - - @Override - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - @Override - public Integer getPort() { - return port; - } - - public void setPort(Integer port) { - this.port = port; - } - - @Override - public Date getGmtCreate() { - return gmtCreate; - } - - public void setGmtCreate(Date gmtCreate) { - this.gmtCreate = gmtCreate; - } - - public Date getGmtModified() { - return gmtModified; - } - - public void setGmtModified(Date gmtModified) { - this.gmtModified = gmtModified; - } - - @Override - public Rule toRule() { - return null; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ApiDefinitionEntity entity = (ApiDefinitionEntity) o; - return Objects.equals(id, entity.id) && Objects.equals(app, entity.app) && Objects.equals(ip, entity.ip) - && Objects.equals(port, entity.port) && Objects.equals(gmtCreate, entity.gmtCreate) - && Objects.equals(gmtModified, entity.gmtModified) && Objects.equals(apiName, entity.apiName) - && Objects.equals(predicateItems, entity.predicateItems); - } - - @Override - public int hashCode() { - return Objects.hash(id, app, ip, port, gmtCreate, gmtModified, apiName, predicateItems); - } - - @Override - public String toString() { - return "ApiDefinitionEntity{" + "id=" + id + ", app='" + app + '\'' + ", ip='" + ip + '\'' + ", port=" + port - + ", gmtCreate=" + gmtCreate + ", gmtModified=" + gmtModified + ", apiName='" + apiName + '\'' - + ", predicateItems=" + predicateItems + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/gateway/ApiPredicateItemEntity.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/gateway/ApiPredicateItemEntity.java deleted file mode 100644 index 62a93c34..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/gateway/ApiPredicateItemEntity.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway; - -import com.alibaba.csp.sentinel.adapter.gateway.common.api.ApiPredicateItem; - -import java.util.Objects; - -/** - * Entity for {@link ApiPredicateItem}. - * - * @author cdfive - * @since 1.7.0 - */ -public class ApiPredicateItemEntity { - - private String pattern; - - private Integer matchStrategy; - - public ApiPredicateItemEntity() { - } - - public ApiPredicateItemEntity(String pattern, int matchStrategy) { - this.pattern = pattern; - this.matchStrategy = matchStrategy; - } - - public String getPattern() { - return pattern; - } - - public void setPattern(String pattern) { - this.pattern = pattern; - } - - public Integer getMatchStrategy() { - return matchStrategy; - } - - public void setMatchStrategy(Integer matchStrategy) { - this.matchStrategy = matchStrategy; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ApiPredicateItemEntity that = (ApiPredicateItemEntity) o; - return Objects.equals(pattern, that.pattern) && Objects.equals(matchStrategy, that.matchStrategy); - } - - @Override - public int hashCode() { - return Objects.hash(pattern, matchStrategy); - } - - @Override - public String toString() { - return "ApiPredicateItemEntity{" + "pattern='" + pattern + '\'' + ", matchStrategy=" + matchStrategy + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/gateway/GatewayFlowRuleEntity.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/gateway/GatewayFlowRuleEntity.java deleted file mode 100644 index eed4463f..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/gateway/GatewayFlowRuleEntity.java +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway; - -import com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayFlowRule; -import com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayParamFlowItem; -import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.RuleEntity; -import com.alibaba.csp.sentinel.slots.block.Rule; - -import java.util.Date; -import java.util.Objects; - -/** - * Entity for {@link GatewayFlowRule}. - * - * @author cdfive - * @since 1.7.0 - */ -public class GatewayFlowRuleEntity implements RuleEntity { - - /** 间隔单位 */ - /** 0-秒 */ - public static final int INTERVAL_UNIT_SECOND = 0; - - /** 1-分 */ - public static final int INTERVAL_UNIT_MINUTE = 1; - - /** 2-时 */ - public static final int INTERVAL_UNIT_HOUR = 2; - - /** 3-天 */ - public static final int INTERVAL_UNIT_DAY = 3; - - private Long id; - - private String app; - - private String ip; - - private Integer port; - - private Date gmtCreate; - - private Date gmtModified; - - private String resource; - - private Integer resourceMode; - - private Integer grade; - - private Double count; - - private Long interval; - - private Integer intervalUnit; - - private Integer controlBehavior; - - private Integer burst; - - private Integer maxQueueingTimeoutMs; - - private GatewayParamFlowItemEntity paramItem; - - public static Long calIntervalSec(Long interval, Integer intervalUnit) { - switch (intervalUnit) { - case INTERVAL_UNIT_SECOND: - return interval; - case INTERVAL_UNIT_MINUTE: - return interval * 60; - case INTERVAL_UNIT_HOUR: - return interval * 60 * 60; - case INTERVAL_UNIT_DAY: - return interval * 60 * 60 * 24; - default: - break; - } - - throw new IllegalArgumentException("Invalid intervalUnit: " + intervalUnit); - } - - public static Object[] parseIntervalSec(Long intervalSec) { - if (intervalSec % (60 * 60 * 24) == 0) { - return new Object[] { intervalSec / (60 * 60 * 24), INTERVAL_UNIT_DAY }; - } - - if (intervalSec % (60 * 60) == 0) { - return new Object[] { intervalSec / (60 * 60), INTERVAL_UNIT_HOUR }; - } - - if (intervalSec % 60 == 0) { - return new Object[] { intervalSec / 60, INTERVAL_UNIT_MINUTE }; - } - - return new Object[] { intervalSec, INTERVAL_UNIT_SECOND }; - } - - public GatewayFlowRule toGatewayFlowRule() { - GatewayFlowRule rule = new GatewayFlowRule(); - rule.setResource(resource); - rule.setResourceMode(resourceMode); - - rule.setGrade(grade); - rule.setCount(count); - rule.setIntervalSec(calIntervalSec(interval, intervalUnit)); - - rule.setControlBehavior(controlBehavior); - - if (burst != null) { - rule.setBurst(burst); - } - - if (maxQueueingTimeoutMs != null) { - rule.setMaxQueueingTimeoutMs(maxQueueingTimeoutMs); - } - - if (paramItem != null) { - GatewayParamFlowItem ruleItem = new GatewayParamFlowItem(); - rule.setParamItem(ruleItem); - ruleItem.setParseStrategy(paramItem.getParseStrategy()); - ruleItem.setFieldName(paramItem.getFieldName()); - ruleItem.setPattern(paramItem.getPattern()); - - if (paramItem.getMatchStrategy() != null) { - ruleItem.setMatchStrategy(paramItem.getMatchStrategy()); - } - } - - return rule; - } - - public static GatewayFlowRuleEntity fromGatewayFlowRule(String app, String ip, Integer port, GatewayFlowRule rule) { - GatewayFlowRuleEntity entity = new GatewayFlowRuleEntity(); - entity.setApp(app); - entity.setIp(ip); - entity.setPort(port); - - entity.setResource(rule.getResource()); - entity.setResourceMode(rule.getResourceMode()); - - entity.setGrade(rule.getGrade()); - entity.setCount(rule.getCount()); - Object[] intervalSecResult = parseIntervalSec(rule.getIntervalSec()); - entity.setInterval((Long) intervalSecResult[0]); - entity.setIntervalUnit((Integer) intervalSecResult[1]); - - entity.setControlBehavior(rule.getControlBehavior()); - entity.setBurst(rule.getBurst()); - entity.setMaxQueueingTimeoutMs(rule.getMaxQueueingTimeoutMs()); - - GatewayParamFlowItem paramItem = rule.getParamItem(); - if (paramItem != null) { - GatewayParamFlowItemEntity itemEntity = new GatewayParamFlowItemEntity(); - entity.setParamItem(itemEntity); - itemEntity.setParseStrategy(paramItem.getParseStrategy()); - itemEntity.setFieldName(paramItem.getFieldName()); - itemEntity.setPattern(paramItem.getPattern()); - itemEntity.setMatchStrategy(paramItem.getMatchStrategy()); - } - - return entity; - } - - @Override - public Long getId() { - return id; - } - - @Override - public void setId(Long id) { - this.id = id; - } - - @Override - public String getApp() { - return app; - } - - public void setApp(String app) { - this.app = app; - } - - @Override - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - @Override - public Integer getPort() { - return port; - } - - public void setPort(Integer port) { - this.port = port; - } - - @Override - public Date getGmtCreate() { - return gmtCreate; - } - - public void setGmtCreate(Date gmtCreate) { - this.gmtCreate = gmtCreate; - } - - @Override - public Rule toRule() { - return null; - } - - public Date getGmtModified() { - return gmtModified; - } - - public void setGmtModified(Date gmtModified) { - this.gmtModified = gmtModified; - } - - public GatewayParamFlowItemEntity getParamItem() { - return paramItem; - } - - public void setParamItem(GatewayParamFlowItemEntity paramItem) { - this.paramItem = paramItem; - } - - public String getResource() { - return resource; - } - - public void setResource(String resource) { - this.resource = resource; - } - - public Integer getResourceMode() { - return resourceMode; - } - - public void setResourceMode(Integer resourceMode) { - this.resourceMode = resourceMode; - } - - public Integer getGrade() { - return grade; - } - - public void setGrade(Integer grade) { - this.grade = grade; - } - - public Double getCount() { - return count; - } - - public void setCount(Double count) { - this.count = count; - } - - public Long getInterval() { - return interval; - } - - public void setInterval(Long interval) { - this.interval = interval; - } - - public Integer getIntervalUnit() { - return intervalUnit; - } - - public void setIntervalUnit(Integer intervalUnit) { - this.intervalUnit = intervalUnit; - } - - public Integer getControlBehavior() { - return controlBehavior; - } - - public void setControlBehavior(Integer controlBehavior) { - this.controlBehavior = controlBehavior; - } - - public Integer getBurst() { - return burst; - } - - public void setBurst(Integer burst) { - this.burst = burst; - } - - public Integer getMaxQueueingTimeoutMs() { - return maxQueueingTimeoutMs; - } - - public void setMaxQueueingTimeoutMs(Integer maxQueueingTimeoutMs) { - this.maxQueueingTimeoutMs = maxQueueingTimeoutMs; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GatewayFlowRuleEntity that = (GatewayFlowRuleEntity) o; - return Objects.equals(id, that.id) && Objects.equals(app, that.app) && Objects.equals(ip, that.ip) - && Objects.equals(port, that.port) && Objects.equals(gmtCreate, that.gmtCreate) - && Objects.equals(gmtModified, that.gmtModified) && Objects.equals(resource, that.resource) - && Objects.equals(resourceMode, that.resourceMode) && Objects.equals(grade, that.grade) - && Objects.equals(count, that.count) && Objects.equals(interval, that.interval) - && Objects.equals(intervalUnit, that.intervalUnit) - && Objects.equals(controlBehavior, that.controlBehavior) && Objects.equals(burst, that.burst) - && Objects.equals(maxQueueingTimeoutMs, that.maxQueueingTimeoutMs) - && Objects.equals(paramItem, that.paramItem); - } - - @Override - public int hashCode() { - return Objects.hash(id, app, ip, port, gmtCreate, gmtModified, resource, resourceMode, grade, count, interval, - intervalUnit, controlBehavior, burst, maxQueueingTimeoutMs, paramItem); - } - - @Override - public String toString() { - return "GatewayFlowRuleEntity{" + "id=" + id + ", app='" + app + '\'' + ", ip='" + ip + '\'' + ", port=" + port - + ", gmtCreate=" + gmtCreate + ", gmtModified=" + gmtModified + ", resource='" + resource + '\'' - + ", resourceMode=" + resourceMode + ", grade=" + grade + ", count=" + count + ", interval=" + interval - + ", intervalUnit=" + intervalUnit + ", controlBehavior=" + controlBehavior + ", burst=" + burst - + ", maxQueueingTimeoutMs=" + maxQueueingTimeoutMs + ", paramItem=" + paramItem + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/gateway/GatewayParamFlowItemEntity.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/gateway/GatewayParamFlowItemEntity.java deleted file mode 100644 index 2f36601e..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/gateway/GatewayParamFlowItemEntity.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway; - -import com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayParamFlowItem; - -import java.util.Objects; - -/** - * Entity for {@link GatewayParamFlowItem}. - * - * @author cdfive - * @since 1.7.0 - */ -public class GatewayParamFlowItemEntity { - - private Integer parseStrategy; - - private String fieldName; - - private String pattern; - - private Integer matchStrategy; - - public Integer getParseStrategy() { - return parseStrategy; - } - - public void setParseStrategy(Integer parseStrategy) { - this.parseStrategy = parseStrategy; - } - - public String getFieldName() { - return fieldName; - } - - public void setFieldName(String fieldName) { - this.fieldName = fieldName; - } - - public String getPattern() { - return pattern; - } - - public void setPattern(String pattern) { - this.pattern = pattern; - } - - public Integer getMatchStrategy() { - return matchStrategy; - } - - public void setMatchStrategy(Integer matchStrategy) { - this.matchStrategy = matchStrategy; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GatewayParamFlowItemEntity that = (GatewayParamFlowItemEntity) o; - return Objects.equals(parseStrategy, that.parseStrategy) && Objects.equals(fieldName, that.fieldName) - && Objects.equals(pattern, that.pattern) && Objects.equals(matchStrategy, that.matchStrategy); - } - - @Override - public int hashCode() { - return Objects.hash(parseStrategy, fieldName, pattern, matchStrategy); - } - - @Override - public String toString() { - return "GatewayParamFlowItemEntity{" + "parseStrategy=" + parseStrategy + ", fieldName='" + fieldName + '\'' - + ", pattern='" + pattern + '\'' + ", matchStrategy=" + matchStrategy + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/rule/AbstractRuleEntity.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/rule/AbstractRuleEntity.java deleted file mode 100644 index 43fb72f7..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/rule/AbstractRuleEntity.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.datasource.entity.rule; - -import com.alibaba.csp.sentinel.slots.block.AbstractRule; - -import java.util.Date; - -/** - * @author Eric Zhao - * @since 0.2.1 - */ -public abstract class AbstractRuleEntity implements RuleEntity { - - protected Long id; - - protected String app; - - protected String ip; - - protected Integer port; - - protected T rule; - - private Date gmtCreate; - - private Date gmtModified; - - @Override - public Long getId() { - return id; - } - - @Override - public void setId(Long id) { - this.id = id; - } - - @Override - public String getApp() { - return app; - } - - public AbstractRuleEntity setApp(String app) { - this.app = app; - return this; - } - - @Override - public String getIp() { - return ip; - } - - public AbstractRuleEntity setIp(String ip) { - this.ip = ip; - return this; - } - - @Override - public Integer getPort() { - return port; - } - - public AbstractRuleEntity setPort(Integer port) { - this.port = port; - return this; - } - - public T getRule() { - return rule; - } - - public AbstractRuleEntity setRule(T rule) { - this.rule = rule; - return this; - } - - @Override - public Date getGmtCreate() { - return gmtCreate; - } - - public AbstractRuleEntity setGmtCreate(Date gmtCreate) { - this.gmtCreate = gmtCreate; - return this; - } - - public Date getGmtModified() { - return gmtModified; - } - - public AbstractRuleEntity setGmtModified(Date gmtModified) { - this.gmtModified = gmtModified; - return this; - } - - @Override - public T toRule() { - return rule; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/rule/AuthorityRuleEntity.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/rule/AuthorityRuleEntity.java deleted file mode 100644 index a66cb9ad..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/rule/AuthorityRuleEntity.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.datasource.entity.rule; - -import com.alibaba.csp.sentinel.slots.block.authority.AuthorityRule; -import com.alibaba.csp.sentinel.util.AssertUtil; -import com.alibaba.fastjson.annotation.JSONField; -import com.fasterxml.jackson.annotation.JsonIgnore; - -/** - * @author Eric Zhao - * @since 0.2.1 - */ -public class AuthorityRuleEntity extends AbstractRuleEntity { - - public AuthorityRuleEntity() { - } - - public AuthorityRuleEntity(AuthorityRule authorityRule) { - AssertUtil.notNull(authorityRule, "Authority rule should not be null"); - this.rule = authorityRule; - } - - public static AuthorityRuleEntity fromAuthorityRule(String app, String ip, Integer port, AuthorityRule rule) { - AuthorityRuleEntity entity = new AuthorityRuleEntity(rule); - entity.setApp(app); - entity.setIp(ip); - entity.setPort(port); - return entity; - } - - @JsonIgnore - @JSONField(serialize = false) - public String getLimitApp() { - return rule.getLimitApp(); - } - - @JsonIgnore - @JSONField(serialize = false) - public String getResource() { - return rule.getResource(); - } - - @JsonIgnore - @JSONField(serialize = false) - public int getStrategy() { - return rule.getStrategy(); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/rule/DegradeRuleEntity.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/rule/DegradeRuleEntity.java deleted file mode 100644 index 4804f0e2..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/rule/DegradeRuleEntity.java +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.datasource.entity.rule; - -import com.alibaba.csp.sentinel.slots.block.degrade.DegradeRule; - -import java.util.Date; - -/** - * @author leyou - */ -public class DegradeRuleEntity implements RuleEntity { - - private Long id; - - private String app; - - private String ip; - - private Integer port; - - private String resource; - - private String limitApp; - - private Double count; - - private Integer timeWindow; - - private Integer grade; - - private Integer minRequestAmount; - - private Double slowRatioThreshold; - - private Integer statIntervalMs; - - private Date gmtCreate; - - private Date gmtModified; - - public static DegradeRuleEntity fromDegradeRule(String app, String ip, Integer port, DegradeRule rule) { - DegradeRuleEntity entity = new DegradeRuleEntity(); - entity.setApp(app); - entity.setIp(ip); - entity.setPort(port); - entity.setResource(rule.getResource()); - entity.setLimitApp(rule.getLimitApp()); - entity.setCount(rule.getCount()); - entity.setTimeWindow(rule.getTimeWindow()); - entity.setGrade(rule.getGrade()); - entity.setMinRequestAmount(rule.getMinRequestAmount()); - entity.setSlowRatioThreshold(rule.getSlowRatioThreshold()); - entity.setStatIntervalMs(rule.getStatIntervalMs()); - return entity; - } - - @Override - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - @Override - public Integer getPort() { - return port; - } - - public void setPort(Integer port) { - this.port = port; - } - - @Override - public Long getId() { - return id; - } - - @Override - public void setId(Long id) { - this.id = id; - } - - @Override - public String getApp() { - return app; - } - - public void setApp(String app) { - this.app = app; - } - - public String getResource() { - return resource; - } - - public void setResource(String resource) { - this.resource = resource; - } - - public String getLimitApp() { - return limitApp; - } - - public void setLimitApp(String limitApp) { - this.limitApp = limitApp; - } - - public Double getCount() { - return count; - } - - public void setCount(Double count) { - this.count = count; - } - - public Integer getTimeWindow() { - return timeWindow; - } - - public void setTimeWindow(Integer timeWindow) { - this.timeWindow = timeWindow; - } - - public Integer getGrade() { - return grade; - } - - public void setGrade(Integer grade) { - this.grade = grade; - } - - public Integer getMinRequestAmount() { - return minRequestAmount; - } - - public DegradeRuleEntity setMinRequestAmount(Integer minRequestAmount) { - this.minRequestAmount = minRequestAmount; - return this; - } - - public Double getSlowRatioThreshold() { - return slowRatioThreshold; - } - - public DegradeRuleEntity setSlowRatioThreshold(Double slowRatioThreshold) { - this.slowRatioThreshold = slowRatioThreshold; - return this; - } - - public Integer getStatIntervalMs() { - return statIntervalMs; - } - - public DegradeRuleEntity setStatIntervalMs(Integer statIntervalMs) { - this.statIntervalMs = statIntervalMs; - return this; - } - - @Override - public Date getGmtCreate() { - return gmtCreate; - } - - public void setGmtCreate(Date gmtCreate) { - this.gmtCreate = gmtCreate; - } - - public Date getGmtModified() { - return gmtModified; - } - - public void setGmtModified(Date gmtModified) { - this.gmtModified = gmtModified; - } - - @Override - public DegradeRule toRule() { - DegradeRule rule = new DegradeRule(); - rule.setResource(resource); - rule.setLimitApp(limitApp); - rule.setCount(count); - rule.setTimeWindow(timeWindow); - rule.setGrade(grade); - if (minRequestAmount != null) { - rule.setMinRequestAmount(minRequestAmount); - } - if (slowRatioThreshold != null) { - rule.setSlowRatioThreshold(slowRatioThreshold); - } - if (statIntervalMs != null) { - rule.setStatIntervalMs(statIntervalMs); - } - - return rule; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/rule/FlowRuleEntity.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/rule/FlowRuleEntity.java deleted file mode 100644 index c83cb8ce..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/rule/FlowRuleEntity.java +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.datasource.entity.rule; - -import com.alibaba.csp.sentinel.slots.block.flow.ClusterFlowConfig; -import com.alibaba.csp.sentinel.slots.block.flow.FlowRule; - -import java.util.Date; - -/** - * @author leyou - */ -public class FlowRuleEntity implements RuleEntity { - - private Long id; - - private String app; - - private String ip; - - private Integer port; - - private String limitApp; - - private String resource; - - /** - * 0为线程数;1为qps - */ - private Integer grade; - - private Double count; - - /** - * 0为直接限流;1为关联限流;2为链路限流 - ***/ - private Integer strategy; - - private String refResource; - - /** - * 0. default, 1. warm up, 2. rate limiter - */ - private Integer controlBehavior; - - private Integer warmUpPeriodSec; - - /** - * max queueing time in rate limiter behavior - */ - private Integer maxQueueingTimeMs; - - private boolean clusterMode; - - /** - * Flow rule config for cluster mode. - */ - private ClusterFlowConfig clusterConfig; - - private Date gmtCreate; - - private Date gmtModified; - - public static FlowRuleEntity fromFlowRule(String app, String ip, Integer port, FlowRule rule) { - FlowRuleEntity entity = new FlowRuleEntity(); - entity.setApp(app); - entity.setIp(ip); - entity.setPort(port); - entity.setLimitApp(rule.getLimitApp()); - entity.setResource(rule.getResource()); - entity.setGrade(rule.getGrade()); - entity.setCount(rule.getCount()); - entity.setStrategy(rule.getStrategy()); - entity.setRefResource(rule.getRefResource()); - entity.setControlBehavior(rule.getControlBehavior()); - entity.setWarmUpPeriodSec(rule.getWarmUpPeriodSec()); - entity.setMaxQueueingTimeMs(rule.getMaxQueueingTimeMs()); - entity.setClusterMode(rule.isClusterMode()); - entity.setClusterConfig(rule.getClusterConfig()); - return entity; - } - - @Override - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - @Override - public Integer getPort() { - return port; - } - - public void setPort(Integer port) { - this.port = port; - } - - @Override - public String getApp() { - return app; - } - - public void setApp(String app) { - this.app = app; - } - - @Override - public Long getId() { - return id; - } - - @Override - public void setId(Long id) { - this.id = id; - } - - public String getLimitApp() { - return limitApp; - } - - public void setLimitApp(String limitApp) { - this.limitApp = limitApp; - } - - public String getResource() { - return resource; - } - - public void setResource(String resource) { - this.resource = resource; - } - - public Integer getGrade() { - return grade; - } - - public void setGrade(Integer grade) { - this.grade = grade; - } - - public Double getCount() { - return count; - } - - public void setCount(Double count) { - this.count = count; - } - - public Integer getStrategy() { - return strategy; - } - - public void setStrategy(Integer strategy) { - this.strategy = strategy; - } - - public String getRefResource() { - return refResource; - } - - public void setRefResource(String refResource) { - this.refResource = refResource; - } - - public Integer getControlBehavior() { - return controlBehavior; - } - - public void setControlBehavior(Integer controlBehavior) { - this.controlBehavior = controlBehavior; - } - - public Integer getWarmUpPeriodSec() { - return warmUpPeriodSec; - } - - public void setWarmUpPeriodSec(Integer warmUpPeriodSec) { - this.warmUpPeriodSec = warmUpPeriodSec; - } - - public Integer getMaxQueueingTimeMs() { - return maxQueueingTimeMs; - } - - public void setMaxQueueingTimeMs(Integer maxQueueingTimeMs) { - this.maxQueueingTimeMs = maxQueueingTimeMs; - } - - public boolean isClusterMode() { - return clusterMode; - } - - public FlowRuleEntity setClusterMode(boolean clusterMode) { - this.clusterMode = clusterMode; - return this; - } - - public ClusterFlowConfig getClusterConfig() { - return clusterConfig; - } - - public FlowRuleEntity setClusterConfig(ClusterFlowConfig clusterConfig) { - this.clusterConfig = clusterConfig; - return this; - } - - @Override - public Date getGmtCreate() { - return gmtCreate; - } - - public void setGmtCreate(Date gmtCreate) { - this.gmtCreate = gmtCreate; - } - - public Date getGmtModified() { - return gmtModified; - } - - public void setGmtModified(Date gmtModified) { - this.gmtModified = gmtModified; - } - - @Override - public FlowRule toRule() { - FlowRule flowRule = new FlowRule(); - flowRule.setCount(this.count); - flowRule.setGrade(this.grade); - flowRule.setResource(this.resource); - flowRule.setLimitApp(this.limitApp); - flowRule.setRefResource(this.refResource); - flowRule.setStrategy(this.strategy); - if (this.controlBehavior != null) { - flowRule.setControlBehavior(controlBehavior); - } - if (this.warmUpPeriodSec != null) { - flowRule.setWarmUpPeriodSec(warmUpPeriodSec); - } - if (this.maxQueueingTimeMs != null) { - flowRule.setMaxQueueingTimeMs(maxQueueingTimeMs); - } - flowRule.setClusterMode(clusterMode); - flowRule.setClusterConfig(clusterConfig); - return flowRule; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/rule/ParamFlowRuleEntity.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/rule/ParamFlowRuleEntity.java deleted file mode 100644 index c90ef913..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/rule/ParamFlowRuleEntity.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.datasource.entity.rule; - -import com.alibaba.csp.sentinel.slots.block.flow.param.ParamFlowClusterConfig; -import com.alibaba.csp.sentinel.slots.block.flow.param.ParamFlowItem; -import com.alibaba.csp.sentinel.slots.block.flow.param.ParamFlowRule; -import com.alibaba.csp.sentinel.util.AssertUtil; -import com.alibaba.fastjson.annotation.JSONField; -import com.fasterxml.jackson.annotation.JsonIgnore; - -import java.util.List; - -/** - * @author Eric Zhao - * @since 0.2.1 - */ -public class ParamFlowRuleEntity extends AbstractRuleEntity { - - public ParamFlowRuleEntity() { - } - - public ParamFlowRuleEntity(ParamFlowRule rule) { - AssertUtil.notNull(rule, "Authority rule should not be null"); - this.rule = rule; - } - - public static ParamFlowRuleEntity fromParamFlowRule(String app, String ip, Integer port, ParamFlowRule rule) { - ParamFlowRuleEntity entity = new ParamFlowRuleEntity(rule); - entity.setApp(app); - entity.setIp(ip); - entity.setPort(port); - return entity; - } - - @JsonIgnore - @JSONField(serialize = false) - public String getLimitApp() { - return rule.getLimitApp(); - } - - @JsonIgnore - @JSONField(serialize = false) - public String getResource() { - return rule.getResource(); - } - - @JsonIgnore - @JSONField(serialize = false) - public int getGrade() { - return rule.getGrade(); - } - - @JsonIgnore - @JSONField(serialize = false) - public Integer getParamIdx() { - return rule.getParamIdx(); - } - - @JsonIgnore - @JSONField(serialize = false) - public double getCount() { - return rule.getCount(); - } - - @JsonIgnore - @JSONField(serialize = false) - public List getParamFlowItemList() { - return rule.getParamFlowItemList(); - } - - @JsonIgnore - @JSONField(serialize = false) - public int getControlBehavior() { - return rule.getControlBehavior(); - } - - @JsonIgnore - @JSONField(serialize = false) - public int getMaxQueueingTimeMs() { - return rule.getMaxQueueingTimeMs(); - } - - @JsonIgnore - @JSONField(serialize = false) - public int getBurstCount() { - return rule.getBurstCount(); - } - - @JsonIgnore - @JSONField(serialize = false) - public long getDurationInSec() { - return rule.getDurationInSec(); - } - - @JsonIgnore - @JSONField(serialize = false) - public boolean isClusterMode() { - return rule.isClusterMode(); - } - - @JsonIgnore - @JSONField(serialize = false) - public ParamFlowClusterConfig getClusterConfig() { - return rule.getClusterConfig(); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/rule/RuleEntity.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/rule/RuleEntity.java deleted file mode 100644 index 52d7e0f6..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/rule/RuleEntity.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.datasource.entity.rule; - -import com.alibaba.csp.sentinel.slots.block.Rule; - -import java.util.Date; - -/** - * @author leyou - */ -public interface RuleEntity { - - Long getId(); - - void setId(Long id); - - String getApp(); - - String getIp(); - - Integer getPort(); - - Date getGmtCreate(); - - Rule toRule(); - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/rule/SystemRuleEntity.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/rule/SystemRuleEntity.java deleted file mode 100644 index a147d3fa..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/datasource/entity/rule/SystemRuleEntity.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.datasource.entity.rule; - -import com.alibaba.csp.sentinel.slots.system.SystemRule; - -import java.util.Date; - -/** - * @author leyou - */ -public class SystemRuleEntity implements RuleEntity { - - private Long id; - - private String app; - - private String ip; - - private Integer port; - - private Double highestSystemLoad; - - private Long avgRt; - - private Long maxThread; - - private Double qps; - - private Double highestCpuUsage; - - private Date gmtCreate; - - private Date gmtModified; - - public static SystemRuleEntity fromSystemRule(String app, String ip, Integer port, SystemRule rule) { - SystemRuleEntity entity = new SystemRuleEntity(); - entity.setApp(app); - entity.setIp(ip); - entity.setPort(port); - entity.setHighestSystemLoad(rule.getHighestSystemLoad()); - entity.setHighestCpuUsage(rule.getHighestCpuUsage()); - entity.setAvgRt(rule.getAvgRt()); - entity.setMaxThread(rule.getMaxThread()); - entity.setQps(rule.getQps()); - return entity; - } - - @Override - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - @Override - public Integer getPort() { - return port; - } - - public void setPort(Integer port) { - this.port = port; - } - - @Override - public Long getId() { - return id; - } - - @Override - public void setId(Long id) { - this.id = id; - } - - @Override - public String getApp() { - return app; - } - - public void setApp(String app) { - this.app = app; - } - - public Double getHighestSystemLoad() { - return highestSystemLoad; - } - - public void setHighestSystemLoad(Double highestSystemLoad) { - this.highestSystemLoad = highestSystemLoad; - } - - public Long getAvgRt() { - return avgRt; - } - - public void setAvgRt(Long avgRt) { - this.avgRt = avgRt; - } - - public Long getMaxThread() { - return maxThread; - } - - public void setMaxThread(Long maxThread) { - this.maxThread = maxThread; - } - - public Double getQps() { - return qps; - } - - public void setQps(Double qps) { - this.qps = qps; - } - - public Double getHighestCpuUsage() { - return highestCpuUsage; - } - - public void setHighestCpuUsage(Double highestCpuUsage) { - this.highestCpuUsage = highestCpuUsage; - } - - @Override - public Date getGmtCreate() { - return gmtCreate; - } - - public void setGmtCreate(Date gmtCreate) { - this.gmtCreate = gmtCreate; - } - - public Date getGmtModified() { - return gmtModified; - } - - public void setGmtModified(Date gmtModified) { - this.gmtModified = gmtModified; - } - - @Override - public SystemRule toRule() { - SystemRule rule = new SystemRule(); - rule.setHighestSystemLoad(highestSystemLoad); - rule.setAvgRt(avgRt); - rule.setMaxThread(maxThread); - rule.setQps(qps); - rule.setHighestCpuUsage(highestCpuUsage); - return rule; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/discovery/AppInfo.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/discovery/AppInfo.java deleted file mode 100644 index 33bfc2bb..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/discovery/AppInfo.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.discovery; - -import com.alibaba.csp.sentinel.dashboard.config.DashboardConfig; - -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; - -public class AppInfo { - - private String app = ""; - - private Integer appType = 0; - - private Set machines = ConcurrentHashMap.newKeySet(); - - public AppInfo() { - } - - public AppInfo(String app) { - this.app = app; - } - - public AppInfo(String app, Integer appType) { - this.app = app; - this.appType = appType; - } - - public String getApp() { - return app; - } - - public void setApp(String app) { - this.app = app; - } - - public Integer getAppType() { - return appType; - } - - public void setAppType(Integer appType) { - this.appType = appType; - } - - /** - * Get the current machines. - * @return a new copy of the current machines. - */ - public Set getMachines() { - return new HashSet<>(machines); - } - - @Override - public String toString() { - return "AppInfo{" + "app='" + app + ", machines=" + machines + '}'; - } - - public boolean addMachine(MachineInfo machineInfo) { - machines.remove(machineInfo); - return machines.add(machineInfo); - } - - public synchronized boolean removeMachine(String ip, int port) { - Iterator it = machines.iterator(); - while (it.hasNext()) { - MachineInfo machine = it.next(); - if (machine.getIp().equals(ip) && machine.getPort() == port) { - it.remove(); - return true; - } - } - return false; - } - - public Optional getMachine(String ip, int port) { - return machines.stream().filter(e -> e.getIp().equals(ip) && e.getPort().equals(port)).findFirst(); - } - - private boolean heartbeatJudge(final int threshold) { - if (machines.size() == 0) { - return false; - } - if (threshold > 0) { - long healthyCount = machines.stream().filter(MachineInfo::isHealthy).count(); - if (healthyCount == 0) { - // No healthy machines. - return machines.stream() - .max(Comparator.comparingLong(MachineInfo::getLastHeartbeat)) - .map(e -> System.currentTimeMillis() - e.getLastHeartbeat() < threshold) - .orElse(false); - } - } - return true; - } - - /** - * Check whether current application has no healthy machines and should not be - * displayed. - * @return true if the application should be displayed in the sidebar, otherwise false - */ - public boolean isShown() { - return heartbeatJudge(DashboardConfig.getHideAppNoMachineMillis()); - } - - /** - * Check whether current application has no healthy machines and should be removed. - * @return true if the application is dead and should be removed, otherwise false - */ - public boolean isDead() { - return !heartbeatJudge(DashboardConfig.getRemoveAppNoMachineMillis()); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/discovery/AppManagement.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/discovery/AppManagement.java deleted file mode 100644 index 7733a516..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/discovery/AppManagement.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.discovery; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; -import java.util.List; -import java.util.Set; - -@Component -public class AppManagement implements MachineDiscovery { - - @Autowired - private ApplicationContext context; - - private MachineDiscovery machineDiscovery; - - @PostConstruct - public void init() { - machineDiscovery = context.getBean(SimpleMachineDiscovery.class); - } - - @Override - public Set getBriefApps() { - return machineDiscovery.getBriefApps(); - } - - @Override - public long addMachine(MachineInfo machineInfo) { - return machineDiscovery.addMachine(machineInfo); - } - - @Override - public boolean removeMachine(String app, String ip, int port) { - return machineDiscovery.removeMachine(app, ip, port); - } - - @Override - public List getAppNames() { - return machineDiscovery.getAppNames(); - } - - @Override - public AppInfo getDetailApp(String app) { - return machineDiscovery.getDetailApp(app); - } - - @Override - public void removeApp(String app) { - machineDiscovery.removeApp(app); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/discovery/MachineDiscovery.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/discovery/MachineDiscovery.java deleted file mode 100644 index 454e55a2..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/discovery/MachineDiscovery.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.discovery; - -import java.util.List; -import java.util.Set; - -public interface MachineDiscovery { - - String UNKNOWN_APP_NAME = "CLUSTER_NOT_STARTED"; - - List getAppNames(); - - Set getBriefApps(); - - AppInfo getDetailApp(String app); - - /** - * Remove the given app from the application registry. - * @param app application name - * @since 1.5.0 - */ - void removeApp(String app); - - long addMachine(MachineInfo machineInfo); - - /** - * Remove the given machine instance from the application registry. - * @param app the application name of the machine - * @param ip machine IP - * @param port machine port - * @return true if removed, otherwise false - * @since 1.5.0 - */ - boolean removeMachine(String app, String ip, int port); - -} \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/discovery/MachineInfo.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/discovery/MachineInfo.java deleted file mode 100644 index 357ed599..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/discovery/MachineInfo.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.discovery; - -import com.alibaba.csp.sentinel.dashboard.config.DashboardConfig; -import com.alibaba.csp.sentinel.util.StringUtil; - -import java.util.Objects; - -public class MachineInfo implements Comparable { - - private String app = ""; - - private Integer appType = 0; - - private String hostname = ""; - - private String ip = ""; - - private Integer port = -1; - - private long lastHeartbeat; - - private long heartbeatVersion; - - /** - * Indicates the version of Sentinel client (since 0.2.0). - */ - private String version; - - public static MachineInfo of(String app, String ip, Integer port) { - MachineInfo machineInfo = new MachineInfo(); - machineInfo.setApp(app); - machineInfo.setIp(ip); - machineInfo.setPort(port); - return machineInfo; - } - - public String toHostPort() { - return ip + ":" + port; - } - - public Integer getPort() { - return port; - } - - public void setPort(Integer port) { - this.port = port; - } - - public String getApp() { - return app; - } - - public void setApp(String app) { - this.app = app; - } - - public Integer getAppType() { - return appType; - } - - public void setAppType(Integer appType) { - this.appType = appType; - } - - public String getHostname() { - return hostname; - } - - public void setHostname(String hostname) { - this.hostname = hostname; - } - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public long getHeartbeatVersion() { - return heartbeatVersion; - } - - public void setHeartbeatVersion(long heartbeatVersion) { - this.heartbeatVersion = heartbeatVersion; - } - - public String getVersion() { - return version; - } - - public MachineInfo setVersion(String version) { - this.version = version; - return this; - } - - public boolean isHealthy() { - long delta = System.currentTimeMillis() - lastHeartbeat; - return delta < DashboardConfig.getUnhealthyMachineMillis(); - } - - /** - * whether dead should be removed - * @return - */ - public boolean isDead() { - if (DashboardConfig.getAutoRemoveMachineMillis() > 0) { - long delta = System.currentTimeMillis() - lastHeartbeat; - return delta > DashboardConfig.getAutoRemoveMachineMillis(); - } - return false; - } - - public long getLastHeartbeat() { - return lastHeartbeat; - } - - public void setLastHeartbeat(long lastHeartbeat) { - this.lastHeartbeat = lastHeartbeat; - } - - @Override - public int compareTo(MachineInfo o) { - if (this == o) { - return 0; - } - if (!port.equals(o.getPort())) { - return port.compareTo(o.getPort()); - } - if (!StringUtil.equals(app, o.getApp())) { - return app.compareToIgnoreCase(o.getApp()); - } - return ip.compareToIgnoreCase(o.getIp()); - } - - @Override - public String toString() { - return new StringBuilder("MachineInfo {").append("app='") - .append(app) - .append('\'') - .append(",appType='") - .append(appType) - .append('\'') - .append(", hostname='") - .append(hostname) - .append('\'') - .append(", ip='") - .append(ip) - .append('\'') - .append(", port=") - .append(port) - .append(", heartbeatVersion=") - .append(heartbeatVersion) - .append(", lastHeartbeat=") - .append(lastHeartbeat) - .append(", version='") - .append(version) - .append('\'') - .append(", healthy=") - .append(isHealthy()) - .append('}') - .toString(); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof MachineInfo)) { - return false; - } - MachineInfo that = (MachineInfo) o; - return Objects.equals(app, that.app) && Objects.equals(ip, that.ip) && Objects.equals(port, that.port); - } - - @Override - public int hashCode() { - return Objects.hash(app, ip, port); - } - - /** - * Information for log - * @return - */ - public String toLogString() { - return app + "|" + ip + "|" + port + "|" + version; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/discovery/SimpleMachineDiscovery.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/discovery/SimpleMachineDiscovery.java deleted file mode 100644 index 5d06c5f9..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/discovery/SimpleMachineDiscovery.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.discovery; - -import com.alibaba.csp.sentinel.util.AssertUtil; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -/** - * @author leyou - */ -@Component -public class SimpleMachineDiscovery implements MachineDiscovery { - - private final ConcurrentMap apps = new ConcurrentHashMap<>(); - - @Override - public long addMachine(MachineInfo machineInfo) { - AssertUtil.notNull(machineInfo, "machineInfo cannot be null"); - AppInfo appInfo = apps.computeIfAbsent(machineInfo.getApp(), - o -> new AppInfo(machineInfo.getApp(), machineInfo.getAppType())); - appInfo.addMachine(machineInfo); - return 1; - } - - @Override - public boolean removeMachine(String app, String ip, int port) { - AssertUtil.assertNotBlank(app, "app name cannot be blank"); - AppInfo appInfo = apps.get(app); - if (appInfo != null) { - return appInfo.removeMachine(ip, port); - } - return false; - } - - @Override - public List getAppNames() { - return new ArrayList<>(apps.keySet()); - } - - @Override - public AppInfo getDetailApp(String app) { - AssertUtil.assertNotBlank(app, "app name cannot be blank"); - return apps.get(app); - } - - @Override - public Set getBriefApps() { - return new HashSet<>(apps.values()); - } - - @Override - public void removeApp(String app) { - AssertUtil.assertNotBlank(app, "app name cannot be blank"); - apps.remove(app); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/ResourceTreeNode.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/ResourceTreeNode.java deleted file mode 100644 index bb6dead7..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/ResourceTreeNode.java +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain; - -import com.alibaba.csp.sentinel.command.vo.NodeVo; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * @author leyou - */ -public class ResourceTreeNode { - - private String id; - - private String parentId; - - private String resource; - - private Integer threadNum; - - private Long passQps; - - private Long blockQps; - - private Long totalQps; - - private Long averageRt; - - private Long successQps; - - private Long exceptionQps; - - private Long oneMinutePass; - - private Long oneMinuteBlock; - - private Long oneMinuteException; - - private Long oneMinuteTotal; - - private boolean visible = true; - - private List children = new ArrayList<>(); - - public static ResourceTreeNode fromNodeVoList(List nodeVos) { - if (nodeVos == null || nodeVos.isEmpty()) { - return null; - } - ResourceTreeNode root = null; - Map map = new HashMap<>(); - for (NodeVo vo : nodeVos) { - ResourceTreeNode node = fromNodeVo(vo); - map.put(node.id, node); - // real root - if (node.parentId == null || node.parentId.isEmpty()) { - root = node; - } - else if (map.containsKey(node.parentId)) { - map.get(node.parentId).children.add(node); - } - else { - // impossible - } - } - return root; - } - - public static ResourceTreeNode fromNodeVo(NodeVo vo) { - ResourceTreeNode node = new ResourceTreeNode(); - node.id = vo.getId(); - node.parentId = vo.getParentId(); - node.resource = vo.getResource(); - node.threadNum = vo.getThreadNum(); - node.passQps = vo.getPassQps(); - node.blockQps = vo.getBlockQps(); - node.totalQps = vo.getTotalQps(); - node.averageRt = vo.getAverageRt(); - node.successQps = vo.getSuccessQps(); - node.exceptionQps = vo.getExceptionQps(); - node.oneMinutePass = vo.getOneMinutePass(); - node.oneMinuteBlock = vo.getOneMinuteBlock(); - node.oneMinuteException = vo.getOneMinuteException(); - node.oneMinuteTotal = vo.getOneMinuteTotal(); - return node; - } - - public void searchIgnoreCase(String searchKey) { - search(this, searchKey); - } - - /** - * This node is visible only when searchKey matches this.resource or at least one of - * this's children is visible - */ - private boolean search(ResourceTreeNode node, String searchKey) { - // empty matches all - if (searchKey == null || searchKey.isEmpty() || node.resource.toLowerCase().contains(searchKey.toLowerCase())) { - node.visible = true; - } - else { - node.visible = false; - } - - boolean found = false; - for (ResourceTreeNode c : node.children) { - found |= search(c, searchKey); - } - node.visible |= found; - return node.visible; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getParentId() { - return parentId; - } - - public void setParentId(String parentId) { - this.parentId = parentId; - } - - public String getResource() { - return resource; - } - - public void setResource(String resource) { - this.resource = resource; - } - - public Integer getThreadNum() { - return threadNum; - } - - public void setThreadNum(Integer threadNum) { - this.threadNum = threadNum; - } - - public Long getPassQps() { - return passQps; - } - - public void setPassQps(Long passQps) { - this.passQps = passQps; - } - - public Long getBlockQps() { - return blockQps; - } - - public void setBlockQps(Long blockQps) { - this.blockQps = blockQps; - } - - public Long getTotalQps() { - return totalQps; - } - - public void setTotalQps(Long totalQps) { - this.totalQps = totalQps; - } - - public Long getAverageRt() { - return averageRt; - } - - public void setAverageRt(Long averageRt) { - this.averageRt = averageRt; - } - - public Long getSuccessQps() { - return successQps; - } - - public void setSuccessQps(Long successQps) { - this.successQps = successQps; - } - - public Long getExceptionQps() { - return exceptionQps; - } - - public void setExceptionQps(Long exceptionQps) { - this.exceptionQps = exceptionQps; - } - - public Long getOneMinutePass() { - return oneMinutePass; - } - - public void setOneMinutePass(Long oneMinutePass) { - this.oneMinutePass = oneMinutePass; - } - - public Long getOneMinuteBlock() { - return oneMinuteBlock; - } - - public void setOneMinuteBlock(Long oneMinuteBlock) { - this.oneMinuteBlock = oneMinuteBlock; - } - - public Long getOneMinuteException() { - return oneMinuteException; - } - - public void setOneMinuteException(Long oneMinuteException) { - this.oneMinuteException = oneMinuteException; - } - - public Long getOneMinuteTotal() { - return oneMinuteTotal; - } - - public void setOneMinuteTotal(Long oneMinuteTotal) { - this.oneMinuteTotal = oneMinuteTotal; - } - - public boolean isVisible() { - return visible; - } - - public void setVisible(boolean visible) { - this.visible = visible; - } - - public List getChildren() { - return children; - } - - public void setChildren(List children) { - this.children = children; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/Result.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/Result.java deleted file mode 100644 index ca8246d4..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/Result.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain; - -/** - * @author leyou - * @author Eric Zhao - */ -public class Result { - - private boolean success; - - private int code; - - private String msg; - - private R data; - - public static Result ofSuccess(R data) { - return new Result().setSuccess(true).setMsg("success").setData(data); - } - - public static Result ofSuccessMsg(String msg) { - return new Result().setSuccess(true).setMsg(msg); - } - - public static Result ofFail(int code, String msg) { - Result result = new Result<>(); - result.setSuccess(false); - result.setCode(code); - result.setMsg(msg); - return result; - } - - public static Result ofThrowable(int code, Throwable throwable) { - Result result = new Result<>(); - result.setSuccess(false); - result.setCode(code); - result.setMsg(throwable.getClass().getName() + ", " + throwable.getMessage()); - return result; - } - - public boolean isSuccess() { - return success; - } - - public Result setSuccess(boolean success) { - this.success = success; - return this; - } - - public int getCode() { - return code; - } - - public Result setCode(int code) { - this.code = code; - return this; - } - - public String getMsg() { - return msg; - } - - public Result setMsg(String msg) { - this.msg = msg; - return this; - } - - public R getData() { - return data; - } - - public Result setData(R data) { - this.data = data; - return this; - } - - @Override - public String toString() { - return "Result{" + "success=" + success + ", code=" + code + ", msg='" + msg + '\'' + ", data=" + data + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ClusterAppAssignResultVO.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ClusterAppAssignResultVO.java deleted file mode 100644 index 74467f7e..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ClusterAppAssignResultVO.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.cluster; - -import java.util.Set; - -/** - * @author Eric Zhao - * @since 1.4.1 - */ -public class ClusterAppAssignResultVO { - - private Set failedServerSet; - - private Set failedClientSet; - - private Integer totalCount; - - public Set getFailedServerSet() { - return failedServerSet; - } - - public ClusterAppAssignResultVO setFailedServerSet(Set failedServerSet) { - this.failedServerSet = failedServerSet; - return this; - } - - public Set getFailedClientSet() { - return failedClientSet; - } - - public ClusterAppAssignResultVO setFailedClientSet(Set failedClientSet) { - this.failedClientSet = failedClientSet; - return this; - } - - public Integer getTotalCount() { - return totalCount; - } - - public ClusterAppAssignResultVO setTotalCount(Integer totalCount) { - this.totalCount = totalCount; - return this; - } - - @Override - public String toString() { - return "ClusterAppAssignResultVO{" + "failedServerSet=" + failedServerSet + ", failedClientSet=" - + failedClientSet + ", totalCount=" + totalCount + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ClusterAppFullAssignRequest.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ClusterAppFullAssignRequest.java deleted file mode 100644 index 2e096080..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ClusterAppFullAssignRequest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.cluster; - -import com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterAppAssignMap; - -import java.util.List; -import java.util.Set; - -/** - * @author Eric Zhao - * @since 1.4.1 - */ -public class ClusterAppFullAssignRequest { - - private List clusterMap; - - private Set remainingList; - - public List getClusterMap() { - return clusterMap; - } - - public ClusterAppFullAssignRequest setClusterMap(List clusterMap) { - this.clusterMap = clusterMap; - return this; - } - - public Set getRemainingList() { - return remainingList; - } - - public ClusterAppFullAssignRequest setRemainingList(Set remainingList) { - this.remainingList = remainingList; - return this; - } - - @Override - public String toString() { - return "ClusterAppFullAssignRequest{" + "clusterMap=" + clusterMap + ", remainingList=" + remainingList + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ClusterAppSingleServerAssignRequest.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ClusterAppSingleServerAssignRequest.java deleted file mode 100644 index 3b5b2ac9..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ClusterAppSingleServerAssignRequest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.cluster; - -import com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterAppAssignMap; - -import java.util.Set; - -/** - * @author Eric Zhao - * @since 1.4.1 - */ -public class ClusterAppSingleServerAssignRequest { - - private ClusterAppAssignMap clusterMap; - - private Set remainingList; - - public ClusterAppAssignMap getClusterMap() { - return clusterMap; - } - - public ClusterAppSingleServerAssignRequest setClusterMap(ClusterAppAssignMap clusterMap) { - this.clusterMap = clusterMap; - return this; - } - - public Set getRemainingList() { - return remainingList; - } - - public ClusterAppSingleServerAssignRequest setRemainingList(Set remainingList) { - this.remainingList = remainingList; - return this; - } - - @Override - public String toString() { - return "ClusterAppSingleServerAssignRequest{" + "clusterMap=" + clusterMap + ", remainingList=" + remainingList - + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ClusterClientInfoVO.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ClusterClientInfoVO.java deleted file mode 100644 index b2c6299b..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ClusterClientInfoVO.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.cluster; - -/** - * @author Eric Zhao - * @since 1.4.1 - */ -public class ClusterClientInfoVO { - - private String serverHost; - - private Integer serverPort; - - private Integer clientState; - - private Integer requestTimeout; - - public String getServerHost() { - return serverHost; - } - - public ClusterClientInfoVO setServerHost(String serverHost) { - this.serverHost = serverHost; - return this; - } - - public Integer getServerPort() { - return serverPort; - } - - public ClusterClientInfoVO setServerPort(Integer serverPort) { - this.serverPort = serverPort; - return this; - } - - public Integer getClientState() { - return clientState; - } - - public ClusterClientInfoVO setClientState(Integer clientState) { - this.clientState = clientState; - return this; - } - - public Integer getRequestTimeout() { - return requestTimeout; - } - - public ClusterClientInfoVO setRequestTimeout(Integer requestTimeout) { - this.requestTimeout = requestTimeout; - return this; - } - - @Override - public String toString() { - return "ClusterClientInfoVO{" + "serverHost='" + serverHost + '\'' + ", serverPort=" + serverPort - + ", clientState=" + clientState + ", requestTimeout=" + requestTimeout + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ClusterGroupEntity.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ClusterGroupEntity.java deleted file mode 100644 index 99150f56..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ClusterGroupEntity.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.cluster; - -import java.util.HashSet; -import java.util.Set; - -/** - * @author Eric Zhao - * @since 1.4.1 - */ -public class ClusterGroupEntity { - - private String machineId; - - private String ip; - - private Integer port; - - private Set clientSet = new HashSet<>(); - - private Boolean belongToApp; - - public String getMachineId() { - return machineId; - } - - public ClusterGroupEntity setMachineId(String machineId) { - this.machineId = machineId; - return this; - } - - public String getIp() { - return ip; - } - - public ClusterGroupEntity setIp(String ip) { - this.ip = ip; - return this; - } - - public Integer getPort() { - return port; - } - - public ClusterGroupEntity setPort(Integer port) { - this.port = port; - return this; - } - - public Set getClientSet() { - return clientSet; - } - - public ClusterGroupEntity setClientSet(Set clientSet) { - this.clientSet = clientSet; - return this; - } - - public Boolean getBelongToApp() { - return belongToApp; - } - - public ClusterGroupEntity setBelongToApp(Boolean belongToApp) { - this.belongToApp = belongToApp; - return this; - } - - @Override - public String toString() { - return "ClusterGroupEntity{" + "machineId='" + machineId + '\'' + ", ip='" + ip + '\'' + ", port=" + port - + ", clientSet=" + clientSet + ", belongToApp=" + belongToApp + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ClusterStateSingleVO.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ClusterStateSingleVO.java deleted file mode 100644 index 032efa0a..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ClusterStateSingleVO.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.cluster; - -/** - * @author Eric Zhao - * @since 1.4.1 - */ -public class ClusterStateSingleVO { - - private String address; - - private Integer mode; - - private String target; - - public String getAddress() { - return address; - } - - public ClusterStateSingleVO setAddress(String address) { - this.address = address; - return this; - } - - public Integer getMode() { - return mode; - } - - public ClusterStateSingleVO setMode(Integer mode) { - this.mode = mode; - return this; - } - - public String getTarget() { - return target; - } - - public ClusterStateSingleVO setTarget(String target) { - this.target = target; - return this; - } - - @Override - public String toString() { - return "ClusterStateSingleVO{" + "address='" + address + '\'' + ", mode=" + mode + ", target='" + target + '\'' - + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ConnectionDescriptorVO.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ConnectionDescriptorVO.java deleted file mode 100644 index 3ac35a70..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ConnectionDescriptorVO.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.cluster; - -/** - * @author Eric Zhao - * @since 1.4.0 - */ -public class ConnectionDescriptorVO { - - private String address; - - private String host; - - public String getAddress() { - return address; - } - - public ConnectionDescriptorVO setAddress(String address) { - this.address = address; - return this; - } - - public String getHost() { - return host; - } - - public ConnectionDescriptorVO setHost(String host) { - this.host = host; - return this; - } - - @Override - public String toString() { - return "ConnectionDescriptorVO{" + "address='" + address + '\'' + ", host='" + host + '\'' + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ConnectionGroupVO.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ConnectionGroupVO.java deleted file mode 100644 index d75a07c4..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/ConnectionGroupVO.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.cluster; - -import java.util.List; - -/** - * @author Eric Zhao - * @since 1.4.0 - */ -public class ConnectionGroupVO { - - private String namespace; - - private List connectionSet; - - private Integer connectedCount; - - public String getNamespace() { - return namespace; - } - - public ConnectionGroupVO setNamespace(String namespace) { - this.namespace = namespace; - return this; - } - - public List getConnectionSet() { - return connectionSet; - } - - public ConnectionGroupVO setConnectionSet(List connectionSet) { - this.connectionSet = connectionSet; - return this; - } - - public Integer getConnectedCount() { - return connectedCount; - } - - public ConnectionGroupVO setConnectedCount(Integer connectedCount) { - this.connectedCount = connectedCount; - return this; - } - - @Override - public String toString() { - return "ConnectionGroupVO{" + "namespace='" + namespace + '\'' + ", connectionSet=" + connectionSet - + ", connectedCount=" + connectedCount + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/config/ClusterClientConfig.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/config/ClusterClientConfig.java deleted file mode 100644 index e626bac4..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/config/ClusterClientConfig.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.cluster.config; - -/** - * @author Eric Zhao - * @since 1.4.0 - */ -public class ClusterClientConfig { - - private String serverHost; - - private Integer serverPort; - - private Integer requestTimeout; - - private Integer connectTimeout; - - public String getServerHost() { - return serverHost; - } - - public ClusterClientConfig setServerHost(String serverHost) { - this.serverHost = serverHost; - return this; - } - - public Integer getServerPort() { - return serverPort; - } - - public ClusterClientConfig setServerPort(Integer serverPort) { - this.serverPort = serverPort; - return this; - } - - public Integer getRequestTimeout() { - return requestTimeout; - } - - public ClusterClientConfig setRequestTimeout(Integer requestTimeout) { - this.requestTimeout = requestTimeout; - return this; - } - - public Integer getConnectTimeout() { - return connectTimeout; - } - - public ClusterClientConfig setConnectTimeout(Integer connectTimeout) { - this.connectTimeout = connectTimeout; - return this; - } - - @Override - public String toString() { - return "ClusterClientConfig{" + "serverHost='" + serverHost + '\'' + ", serverPort=" + serverPort - + ", requestTimeout=" + requestTimeout + ", connectTimeout=" + connectTimeout + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/config/ServerFlowConfig.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/config/ServerFlowConfig.java deleted file mode 100644 index 578266d2..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/config/ServerFlowConfig.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.cluster.config; - -/** - * @author Eric Zhao - * @since 1.4.0 - */ -public class ServerFlowConfig { - - public static final double DEFAULT_EXCEED_COUNT = 1.0d; - - public static final double DEFAULT_MAX_OCCUPY_RATIO = 1.0d; - - public static final int DEFAULT_INTERVAL_MS = 1000; - - public static final int DEFAULT_SAMPLE_COUNT = 10; - - public static final double DEFAULT_MAX_ALLOWED_QPS = 30000; - - private final String namespace; - - private Double exceedCount = DEFAULT_EXCEED_COUNT; - - private Double maxOccupyRatio = DEFAULT_MAX_OCCUPY_RATIO; - - private Integer intervalMs = DEFAULT_INTERVAL_MS; - - private Integer sampleCount = DEFAULT_SAMPLE_COUNT; - - private Double maxAllowedQps = DEFAULT_MAX_ALLOWED_QPS; - - public ServerFlowConfig() { - this("default"); - } - - public ServerFlowConfig(String namespace) { - this.namespace = namespace; - } - - public String getNamespace() { - return namespace; - } - - public Double getExceedCount() { - return exceedCount; - } - - public ServerFlowConfig setExceedCount(Double exceedCount) { - this.exceedCount = exceedCount; - return this; - } - - public Double getMaxOccupyRatio() { - return maxOccupyRatio; - } - - public ServerFlowConfig setMaxOccupyRatio(Double maxOccupyRatio) { - this.maxOccupyRatio = maxOccupyRatio; - return this; - } - - public Integer getIntervalMs() { - return intervalMs; - } - - public ServerFlowConfig setIntervalMs(Integer intervalMs) { - this.intervalMs = intervalMs; - return this; - } - - public Integer getSampleCount() { - return sampleCount; - } - - public ServerFlowConfig setSampleCount(Integer sampleCount) { - this.sampleCount = sampleCount; - return this; - } - - public Double getMaxAllowedQps() { - return maxAllowedQps; - } - - public ServerFlowConfig setMaxAllowedQps(Double maxAllowedQps) { - this.maxAllowedQps = maxAllowedQps; - return this; - } - - @Override - public String toString() { - return "ServerFlowConfig{" + "namespace='" + namespace + '\'' + ", exceedCount=" + exceedCount - + ", maxOccupyRatio=" + maxOccupyRatio + ", intervalMs=" + intervalMs + ", sampleCount=" + sampleCount - + ", maxAllowedQps=" + maxAllowedQps + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/config/ServerTransportConfig.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/config/ServerTransportConfig.java deleted file mode 100644 index 76891ab7..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/config/ServerTransportConfig.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.cluster.config; - -/** - * @author Eric Zhao - * @since 1.4.0 - */ -public class ServerTransportConfig { - - public static final int DEFAULT_PORT = 18730; - - public static final int DEFAULT_IDLE_SECONDS = 600; - - private Integer port; - - private Integer idleSeconds; - - public ServerTransportConfig() { - this(DEFAULT_PORT, DEFAULT_IDLE_SECONDS); - } - - public ServerTransportConfig(Integer port, Integer idleSeconds) { - this.port = port; - this.idleSeconds = idleSeconds; - } - - public Integer getPort() { - return port; - } - - public ServerTransportConfig setPort(Integer port) { - this.port = port; - return this; - } - - public Integer getIdleSeconds() { - return idleSeconds; - } - - public ServerTransportConfig setIdleSeconds(Integer idleSeconds) { - this.idleSeconds = idleSeconds; - return this; - } - - @Override - public String toString() { - return "ServerTransportConfig{" + "port=" + port + ", idleSeconds=" + idleSeconds + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/request/ClusterAppAssignMap.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/request/ClusterAppAssignMap.java deleted file mode 100644 index 23c78c97..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/request/ClusterAppAssignMap.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.cluster.request; - -import java.util.Set; - -/** - * @author Eric Zhao - * @since 1.4.1 - */ -public class ClusterAppAssignMap { - - private String machineId; - - private String ip; - - private Integer port; - - private Boolean belongToApp; - - private Set clientSet; - - private Set namespaceSet; - - private Double maxAllowedQps; - - public String getMachineId() { - return machineId; - } - - public ClusterAppAssignMap setMachineId(String machineId) { - this.machineId = machineId; - return this; - } - - public String getIp() { - return ip; - } - - public ClusterAppAssignMap setIp(String ip) { - this.ip = ip; - return this; - } - - public Integer getPort() { - return port; - } - - public ClusterAppAssignMap setPort(Integer port) { - this.port = port; - return this; - } - - public Set getClientSet() { - return clientSet; - } - - public ClusterAppAssignMap setClientSet(Set clientSet) { - this.clientSet = clientSet; - return this; - } - - public Set getNamespaceSet() { - return namespaceSet; - } - - public ClusterAppAssignMap setNamespaceSet(Set namespaceSet) { - this.namespaceSet = namespaceSet; - return this; - } - - public Boolean getBelongToApp() { - return belongToApp; - } - - public ClusterAppAssignMap setBelongToApp(Boolean belongToApp) { - this.belongToApp = belongToApp; - return this; - } - - public Double getMaxAllowedQps() { - return maxAllowedQps; - } - - public ClusterAppAssignMap setMaxAllowedQps(Double maxAllowedQps) { - this.maxAllowedQps = maxAllowedQps; - return this; - } - - @Override - public String toString() { - return "ClusterAppAssignMap{" + "machineId='" + machineId + '\'' + ", ip='" + ip + '\'' + ", port=" + port - + ", belongToApp=" + belongToApp + ", clientSet=" + clientSet + ", namespaceSet=" + namespaceSet - + ", maxAllowedQps=" + maxAllowedQps + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/request/ClusterClientModifyRequest.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/request/ClusterClientModifyRequest.java deleted file mode 100644 index 9a7608ae..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/request/ClusterClientModifyRequest.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.cluster.request; - -import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ClusterClientConfig; - -/** - * @author Eric Zhao - * @since 1.4.0 - */ -public class ClusterClientModifyRequest implements ClusterModifyRequest { - - private String app; - - private String ip; - - private Integer port; - - private Integer mode; - - private ClusterClientConfig clientConfig; - - @Override - public String getApp() { - return app; - } - - public ClusterClientModifyRequest setApp(String app) { - this.app = app; - return this; - } - - @Override - public String getIp() { - return ip; - } - - public ClusterClientModifyRequest setIp(String ip) { - this.ip = ip; - return this; - } - - @Override - public Integer getPort() { - return port; - } - - public ClusterClientModifyRequest setPort(Integer port) { - this.port = port; - return this; - } - - @Override - public Integer getMode() { - return mode; - } - - public ClusterClientModifyRequest setMode(Integer mode) { - this.mode = mode; - return this; - } - - public ClusterClientConfig getClientConfig() { - return clientConfig; - } - - public ClusterClientModifyRequest setClientConfig(ClusterClientConfig clientConfig) { - this.clientConfig = clientConfig; - return this; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/request/ClusterModifyRequest.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/request/ClusterModifyRequest.java deleted file mode 100644 index e0d48e6b..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/request/ClusterModifyRequest.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.cluster.request; - -/** - * @author Eric Zhao - * @since 1.4.0 - */ -public interface ClusterModifyRequest { - - String getApp(); - - String getIp(); - - Integer getPort(); - - Integer getMode(); - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/request/ClusterServerModifyRequest.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/request/ClusterServerModifyRequest.java deleted file mode 100644 index 02c96c27..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/request/ClusterServerModifyRequest.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.cluster.request; - -import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerTransportConfig; - -import java.util.Set; - -/** - * @author Eric Zhao - * @since 1.4.0 - */ -public class ClusterServerModifyRequest implements ClusterModifyRequest { - - private String app; - - private String ip; - - private Integer port; - - private Integer mode; - - private ServerFlowConfig flowConfig; - - private ServerTransportConfig transportConfig; - - private Set namespaceSet; - - @Override - public String getApp() { - return app; - } - - public ClusterServerModifyRequest setApp(String app) { - this.app = app; - return this; - } - - @Override - public String getIp() { - return ip; - } - - public ClusterServerModifyRequest setIp(String ip) { - this.ip = ip; - return this; - } - - @Override - public Integer getPort() { - return port; - } - - public ClusterServerModifyRequest setPort(Integer port) { - this.port = port; - return this; - } - - @Override - public Integer getMode() { - return mode; - } - - public ClusterServerModifyRequest setMode(Integer mode) { - this.mode = mode; - return this; - } - - public ServerFlowConfig getFlowConfig() { - return flowConfig; - } - - public ClusterServerModifyRequest setFlowConfig(ServerFlowConfig flowConfig) { - this.flowConfig = flowConfig; - return this; - } - - public ServerTransportConfig getTransportConfig() { - return transportConfig; - } - - public ClusterServerModifyRequest setTransportConfig(ServerTransportConfig transportConfig) { - this.transportConfig = transportConfig; - return this; - } - - public Set getNamespaceSet() { - return namespaceSet; - } - - public ClusterServerModifyRequest setNamespaceSet(Set namespaceSet) { - this.namespaceSet = namespaceSet; - return this; - } - - @Override - public String toString() { - return "ClusterServerModifyRequest{" + "app='" + app + '\'' + ", ip='" + ip + '\'' + ", port=" + port - + ", mode=" + mode + ", flowConfig=" + flowConfig + ", transportConfig=" + transportConfig - + ", namespaceSet=" + namespaceSet + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/AppClusterClientStateWrapVO.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/AppClusterClientStateWrapVO.java deleted file mode 100644 index 19daa986..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/AppClusterClientStateWrapVO.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.cluster.state; - -/** - * @author Eric Zhao - * @since 1.4.1 - */ -public class AppClusterClientStateWrapVO { - - /** - * {ip}@{transport_command_port}. - */ - private String id; - - private Integer commandPort; - - private String ip; - - private ClusterClientStateVO state; - - public String getId() { - return id; - } - - public AppClusterClientStateWrapVO setId(String id) { - this.id = id; - return this; - } - - public String getIp() { - return ip; - } - - public AppClusterClientStateWrapVO setIp(String ip) { - this.ip = ip; - return this; - } - - public ClusterClientStateVO getState() { - return state; - } - - public AppClusterClientStateWrapVO setState(ClusterClientStateVO state) { - this.state = state; - return this; - } - - public Integer getCommandPort() { - return commandPort; - } - - public AppClusterClientStateWrapVO setCommandPort(Integer commandPort) { - this.commandPort = commandPort; - return this; - } - - @Override - public String toString() { - return "AppClusterClientStateWrapVO{" + "id='" + id + '\'' + ", commandPort=" + commandPort + ", ip='" + ip - + '\'' + ", state=" + state + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/AppClusterServerStateWrapVO.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/AppClusterServerStateWrapVO.java deleted file mode 100644 index 4f3bbb41..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/AppClusterServerStateWrapVO.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.cluster.state; - -/** - * @author Eric Zhao - * @since 1.4.1 - */ -public class AppClusterServerStateWrapVO { - - /** - * {ip}@{transport_command_port}. - */ - private String id; - - private String ip; - - private Integer port; - - private Integer connectedCount; - - private Boolean belongToApp; - - private ClusterServerStateVO state; - - public String getId() { - return id; - } - - public AppClusterServerStateWrapVO setId(String id) { - this.id = id; - return this; - } - - public String getIp() { - return ip; - } - - public AppClusterServerStateWrapVO setIp(String ip) { - this.ip = ip; - return this; - } - - public Integer getPort() { - return port; - } - - public AppClusterServerStateWrapVO setPort(Integer port) { - this.port = port; - return this; - } - - public Boolean getBelongToApp() { - return belongToApp; - } - - public AppClusterServerStateWrapVO setBelongToApp(Boolean belongToApp) { - this.belongToApp = belongToApp; - return this; - } - - public Integer getConnectedCount() { - return connectedCount; - } - - public AppClusterServerStateWrapVO setConnectedCount(Integer connectedCount) { - this.connectedCount = connectedCount; - return this; - } - - public ClusterServerStateVO getState() { - return state; - } - - public AppClusterServerStateWrapVO setState(ClusterServerStateVO state) { - this.state = state; - return this; - } - - @Override - public String toString() { - return "AppClusterServerStateWrapVO{" + "id='" + id + '\'' + ", ip='" + ip + '\'' + ", port='" + port + '\'' - + ", belongToApp=" + belongToApp + ", state=" + state + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/ClusterClientStateVO.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/ClusterClientStateVO.java deleted file mode 100644 index fd2df5f4..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/ClusterClientStateVO.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.cluster.state; - -import com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterClientInfoVO; - -/** - * @author Eric Zhao - * @since 1.4.0 - */ -public class ClusterClientStateVO { - - /** - * Cluster token client state. - */ - private ClusterClientInfoVO clientConfig; - - public ClusterClientInfoVO getClientConfig() { - return clientConfig; - } - - public ClusterClientStateVO setClientConfig(ClusterClientInfoVO clientConfig) { - this.clientConfig = clientConfig; - return this; - } - - @Override - public String toString() { - return "ClusterClientStateVO{" + "clientConfig=" + clientConfig + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/ClusterRequestLimitVO.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/ClusterRequestLimitVO.java deleted file mode 100644 index aaf10dc5..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/ClusterRequestLimitVO.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.cluster.state; - -/** - * @author Eric Zhao - * @since 1.4.1 - */ -public class ClusterRequestLimitVO { - - private String namespace; - - private Double currentQps; - - private Double maxAllowedQps; - - public String getNamespace() { - return namespace; - } - - public ClusterRequestLimitVO setNamespace(String namespace) { - this.namespace = namespace; - return this; - } - - public Double getCurrentQps() { - return currentQps; - } - - public ClusterRequestLimitVO setCurrentQps(Double currentQps) { - this.currentQps = currentQps; - return this; - } - - public Double getMaxAllowedQps() { - return maxAllowedQps; - } - - public ClusterRequestLimitVO setMaxAllowedQps(Double maxAllowedQps) { - this.maxAllowedQps = maxAllowedQps; - return this; - } - - @Override - public String toString() { - return "ClusterRequestLimitVO{" + "namespace='" + namespace + '\'' + ", currentQps=" + currentQps - + ", maxAllowedQps=" + maxAllowedQps + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/ClusterServerStateVO.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/ClusterServerStateVO.java deleted file mode 100644 index dbd61607..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/ClusterServerStateVO.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.cluster.state; - -import com.alibaba.csp.sentinel.dashboard.domain.cluster.ConnectionGroupVO; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerTransportConfig; - -import java.util.List; -import java.util.Set; - -/** - * @author Eric Zhao - * @since 1.4.0 - */ -public class ClusterServerStateVO { - - private String appName; - - private ServerTransportConfig transport; - - private ServerFlowConfig flow; - - private Set namespaceSet; - - private Integer port; - - private List connection; - - private List requestLimitData; - - private Boolean embedded; - - public String getAppName() { - return appName; - } - - public ClusterServerStateVO setAppName(String appName) { - this.appName = appName; - return this; - } - - public ServerTransportConfig getTransport() { - return transport; - } - - public ClusterServerStateVO setTransport(ServerTransportConfig transport) { - this.transport = transport; - return this; - } - - public ServerFlowConfig getFlow() { - return flow; - } - - public ClusterServerStateVO setFlow(ServerFlowConfig flow) { - this.flow = flow; - return this; - } - - public Set getNamespaceSet() { - return namespaceSet; - } - - public ClusterServerStateVO setNamespaceSet(Set namespaceSet) { - this.namespaceSet = namespaceSet; - return this; - } - - public Integer getPort() { - return port; - } - - public ClusterServerStateVO setPort(Integer port) { - this.port = port; - return this; - } - - public List getConnection() { - return connection; - } - - public ClusterServerStateVO setConnection(List connection) { - this.connection = connection; - return this; - } - - public List getRequestLimitData() { - return requestLimitData; - } - - public ClusterServerStateVO setRequestLimitData(List requestLimitData) { - this.requestLimitData = requestLimitData; - return this; - } - - public Boolean getEmbedded() { - return embedded; - } - - public ClusterServerStateVO setEmbedded(Boolean embedded) { - this.embedded = embedded; - return this; - } - - @Override - public String toString() { - return "ClusterServerStateVO{" + "appName='" + appName + '\'' + ", transport=" + transport + ", flow=" + flow - + ", namespaceSet=" + namespaceSet + ", port=" + port + ", connection=" + connection - + ", requestLimitData=" + requestLimitData + ", embedded=" + embedded + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/ClusterStateSimpleEntity.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/ClusterStateSimpleEntity.java deleted file mode 100644 index d0b28523..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/ClusterStateSimpleEntity.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.cluster.state; - -/** - * @author Eric Zhao - * @since 1.4.0 - */ -public class ClusterStateSimpleEntity { - - private Integer mode; - - private Long lastModified; - - private Boolean clientAvailable; - - private Boolean serverAvailable; - - public Integer getMode() { - return mode; - } - - public ClusterStateSimpleEntity setMode(Integer mode) { - this.mode = mode; - return this; - } - - public Long getLastModified() { - return lastModified; - } - - public ClusterStateSimpleEntity setLastModified(Long lastModified) { - this.lastModified = lastModified; - return this; - } - - public Boolean getClientAvailable() { - return clientAvailable; - } - - public ClusterStateSimpleEntity setClientAvailable(Boolean clientAvailable) { - this.clientAvailable = clientAvailable; - return this; - } - - public Boolean getServerAvailable() { - return serverAvailable; - } - - public ClusterStateSimpleEntity setServerAvailable(Boolean serverAvailable) { - this.serverAvailable = serverAvailable; - return this; - } - - @Override - public String toString() { - return "ClusterStateSimpleEntity{" + "mode=" + mode + ", lastModified=" + lastModified + ", clientAvailable=" - + clientAvailable + ", serverAvailable=" + serverAvailable + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/ClusterUniversalStatePairVO.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/ClusterUniversalStatePairVO.java deleted file mode 100644 index 73af2841..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/ClusterUniversalStatePairVO.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.cluster.state; - -/** - * @author Eric Zhao - * @since 1.4.1 - */ -public class ClusterUniversalStatePairVO { - - private String ip; - - private Integer commandPort; - - private ClusterUniversalStateVO state; - - public ClusterUniversalStatePairVO() { - } - - public ClusterUniversalStatePairVO(String ip, Integer commandPort, ClusterUniversalStateVO state) { - this.ip = ip; - this.commandPort = commandPort; - this.state = state; - } - - public String getIp() { - return ip; - } - - public ClusterUniversalStatePairVO setIp(String ip) { - this.ip = ip; - return this; - } - - public Integer getCommandPort() { - return commandPort; - } - - public ClusterUniversalStatePairVO setCommandPort(Integer commandPort) { - this.commandPort = commandPort; - return this; - } - - public ClusterUniversalStateVO getState() { - return state; - } - - public ClusterUniversalStatePairVO setState(ClusterUniversalStateVO state) { - this.state = state; - return this; - } - - @Override - public String toString() { - return "ClusterUniversalStatePairVO{" + "ip='" + ip + '\'' + ", commandPort=" + commandPort + ", state=" + state - + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/ClusterUniversalStateVO.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/ClusterUniversalStateVO.java deleted file mode 100644 index 75ef4e3c..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/cluster/state/ClusterUniversalStateVO.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.cluster.state; - -/** - * @author Eric Zhao - * @since 1.4.0 - */ -public class ClusterUniversalStateVO { - - private ClusterStateSimpleEntity stateInfo; - - private ClusterClientStateVO client; - - private ClusterServerStateVO server; - - public ClusterClientStateVO getClient() { - return client; - } - - public ClusterUniversalStateVO setClient(ClusterClientStateVO client) { - this.client = client; - return this; - } - - public ClusterServerStateVO getServer() { - return server; - } - - public ClusterUniversalStateVO setServer(ClusterServerStateVO server) { - this.server = server; - return this; - } - - public ClusterStateSimpleEntity getStateInfo() { - return stateInfo; - } - - public ClusterUniversalStateVO setStateInfo(ClusterStateSimpleEntity stateInfo) { - this.stateInfo = stateInfo; - return this; - } - - @Override - public String toString() { - return "ClusterUniversalStateVO{" + "stateInfo=" + stateInfo + ", client=" + client + ", server=" + server - + '}'; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/MachineInfoVo.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/MachineInfoVo.java deleted file mode 100644 index 65a7fd95..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/MachineInfoVo.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.vo; - -import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author leyou - */ -public class MachineInfoVo { - - private String app; - - private String hostname; - - private String ip; - - private int port; - - private long heartbeatVersion; - - private long lastHeartbeat; - - private boolean healthy; - - private String version; - - public static List fromMachineInfoList(List machines) { - List list = new ArrayList<>(); - for (MachineInfo machine : machines) { - list.add(fromMachineInfo(machine)); - } - return list; - } - - public static MachineInfoVo fromMachineInfo(MachineInfo machine) { - MachineInfoVo vo = new MachineInfoVo(); - vo.setApp(machine.getApp()); - vo.setHostname(machine.getHostname()); - vo.setIp(machine.getIp()); - vo.setPort(machine.getPort()); - vo.setLastHeartbeat(machine.getLastHeartbeat()); - vo.setHeartbeatVersion(machine.getHeartbeatVersion()); - vo.setVersion(machine.getVersion()); - vo.setHealthy(machine.isHealthy()); - return vo; - } - - public String getApp() { - return app; - } - - public void setApp(String app) { - this.app = app; - } - - public String getHostname() { - return hostname; - } - - public void setHostname(String hostname) { - this.hostname = hostname; - } - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public int getPort() { - return port; - } - - public void setPort(int port) { - this.port = port; - } - - public long getLastHeartbeat() { - return lastHeartbeat; - } - - public void setLastHeartbeat(long lastHeartbeat) { - this.lastHeartbeat = lastHeartbeat; - } - - public void setHeartbeatVersion(long heartbeatVersion) { - this.heartbeatVersion = heartbeatVersion; - } - - public long getHeartbeatVersion() { - return heartbeatVersion; - } - - public String getVersion() { - return version; - } - - public MachineInfoVo setVersion(String version) { - this.version = version; - return this; - } - - public boolean isHealthy() { - return healthy; - } - - public void setHealthy(boolean healthy) { - this.healthy = healthy; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/MetricVo.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/MetricVo.java deleted file mode 100644 index cdd5040e..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/MetricVo.java +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.vo; - -import com.alibaba.csp.sentinel.dashboard.datasource.entity.MetricEntity; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** - * @author leyou - */ -public class MetricVo implements Comparable { - - private Long id; - - private String app; - - private Long timestamp; - - private Long gmtCreate = System.currentTimeMillis(); - - private String resource; - - private Long passQps; - - private Long blockQps; - - private Long successQps; - - private Long exceptionQps; - - /** - * average rt - */ - private Double rt; - - private Integer count; - - public MetricVo() { - } - - public static List fromMetricEntities(Collection entities) { - List list = new ArrayList<>(); - if (entities != null) { - for (MetricEntity entity : entities) { - list.add(fromMetricEntity(entity)); - } - } - return list; - } - - /** - * 保留资源名为identity的结果。 - * @param entities 通过hashCode查找到的MetricEntities - * @param identity 真正需要查找的资源名 - * @return - */ - public static List fromMetricEntities(Collection entities, String identity) { - List list = new ArrayList<>(); - if (entities != null) { - for (MetricEntity entity : entities) { - if (entity.getResource().equals(identity)) { - list.add(fromMetricEntity(entity)); - } - } - } - return list; - } - - public static MetricVo fromMetricEntity(MetricEntity entity) { - MetricVo vo = new MetricVo(); - vo.id = entity.getId(); - vo.app = entity.getApp(); - vo.timestamp = entity.getTimestamp().getTime(); - vo.gmtCreate = entity.getGmtCreate().getTime(); - vo.resource = entity.getResource(); - vo.passQps = entity.getPassQps(); - vo.blockQps = entity.getBlockQps(); - vo.successQps = entity.getSuccessQps(); - vo.exceptionQps = entity.getExceptionQps(); - if (entity.getSuccessQps() != 0) { - vo.rt = entity.getRt() / entity.getSuccessQps(); - } - else { - vo.rt = 0D; - } - vo.count = entity.getCount(); - return vo; - } - - public static MetricVo parse(String line) { - String[] strs = line.split("\\|"); - long timestamp = Long.parseLong(strs[0]); - String identity = strs[1]; - long passQps = Long.parseLong(strs[2]); - long blockQps = Long.parseLong(strs[3]); - long exception = Long.parseLong(strs[4]); - double rt = Double.parseDouble(strs[5]); - long successQps = Long.parseLong(strs[6]); - MetricVo vo = new MetricVo(); - vo.timestamp = timestamp; - vo.resource = identity; - vo.passQps = passQps; - vo.blockQps = blockQps; - vo.successQps = successQps; - vo.exceptionQps = exception; - vo.rt = rt; - vo.count = 1; - return vo; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getApp() { - return app; - } - - public void setApp(String app) { - this.app = app; - } - - public Long getTimestamp() { - return timestamp; - } - - public void setTimestamp(Long timestamp) { - this.timestamp = timestamp; - } - - public Long getGmtCreate() { - return gmtCreate; - } - - public void setGmtCreate(Long gmtCreate) { - this.gmtCreate = gmtCreate; - } - - public String getResource() { - return resource; - } - - public void setResource(String resource) { - this.resource = resource; - } - - public Long getPassQps() { - return passQps; - } - - public void setPassQps(Long passQps) { - this.passQps = passQps; - } - - public Long getBlockQps() { - return blockQps; - } - - public void setBlockQps(Long blockQps) { - this.blockQps = blockQps; - } - - public Long getSuccessQps() { - return successQps; - } - - public void setSuccessQps(Long successQps) { - this.successQps = successQps; - } - - public Long getExceptionQps() { - return exceptionQps; - } - - public void setExceptionQps(Long exceptionQps) { - this.exceptionQps = exceptionQps; - } - - public Double getRt() { - return rt; - } - - public void setRt(Double rt) { - this.rt = rt; - } - - public Integer getCount() { - return count; - } - - public void setCount(Integer count) { - this.count = count; - } - - @Override - public int compareTo(MetricVo o) { - return Long.compare(this.timestamp, o.timestamp); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/ResourceVo.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/ResourceVo.java deleted file mode 100644 index 4fd4c2c0..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/ResourceVo.java +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.vo; - -import com.alibaba.csp.sentinel.command.vo.NodeVo; -import com.alibaba.csp.sentinel.dashboard.domain.ResourceTreeNode; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author leyou - */ -public class ResourceVo { - - private String parentTtId; - - private String ttId; - - private String resource; - - private Integer threadNum; - - private Long passQps; - - private Long blockQps; - - private Long totalQps; - - private Long averageRt; - - private Long passRequestQps; - - private Long exceptionQps; - - private Long oneMinutePass; - - private Long oneMinuteBlock; - - private Long oneMinuteException; - - private Long oneMinuteTotal; - - private boolean visible = true; - - public ResourceVo() { - } - - public static List fromNodeVoList(List nodeVos) { - if (nodeVos == null) { - return null; - } - List list = new ArrayList<>(); - for (NodeVo nodeVo : nodeVos) { - ResourceVo vo = new ResourceVo(); - vo.parentTtId = nodeVo.getParentId(); - vo.ttId = nodeVo.getId(); - vo.resource = nodeVo.getResource(); - vo.threadNum = nodeVo.getThreadNum(); - vo.passQps = nodeVo.getPassQps(); - vo.blockQps = nodeVo.getBlockQps(); - vo.totalQps = nodeVo.getTotalQps(); - vo.averageRt = nodeVo.getAverageRt(); - vo.exceptionQps = nodeVo.getExceptionQps(); - vo.oneMinutePass = nodeVo.getOneMinutePass(); - vo.oneMinuteBlock = nodeVo.getOneMinuteBlock(); - vo.oneMinuteException = nodeVo.getOneMinuteException(); - vo.oneMinuteTotal = nodeVo.getOneMinuteTotal(); - list.add(vo); - } - return list; - } - - public static List fromResourceTreeNode(ResourceTreeNode root) { - if (root == null) { - return null; - } - List list = new ArrayList<>(); - visit(root, list, false, true); - // if(!list.isEmpty()){ - // list.remove(0); - // } - return list; - } - - /** - * This node is visible when this.visible==true or one of this's parents is visible, - * root node is always invisible. - */ - private static void visit(ResourceTreeNode node, List list, boolean parentVisible, boolean isRoot) { - boolean visible = !isRoot && (node.isVisible() || parentVisible); - // boolean visible = node.isVisible(); - if (visible) { - ResourceVo vo = new ResourceVo(); - vo.parentTtId = node.getParentId(); - vo.ttId = node.getId(); - vo.resource = node.getResource(); - vo.threadNum = node.getThreadNum(); - vo.passQps = node.getPassQps(); - vo.blockQps = node.getBlockQps(); - vo.totalQps = node.getTotalQps(); - vo.averageRt = node.getAverageRt(); - vo.exceptionQps = node.getExceptionQps(); - vo.oneMinutePass = node.getOneMinutePass(); - vo.oneMinuteBlock = node.getOneMinuteBlock(); - vo.oneMinuteException = node.getOneMinuteException(); - vo.oneMinuteTotal = node.getOneMinuteTotal(); - vo.visible = node.isVisible(); - list.add(vo); - } - for (ResourceTreeNode c : node.getChildren()) { - visit(c, list, visible, false); - } - } - - public String getParentTtId() { - return parentTtId; - } - - public void setParentTtId(String parentTtId) { - this.parentTtId = parentTtId; - } - - public String getTtId() { - return ttId; - } - - public void setTtId(String ttId) { - this.ttId = ttId; - } - - public String getResource() { - return resource; - } - - public void setResource(String resource) { - this.resource = resource; - } - - public Integer getThreadNum() { - return threadNum; - } - - public void setThreadNum(Integer threadNum) { - this.threadNum = threadNum; - } - - public Long getPassQps() { - return passQps; - } - - public void setPassQps(Long passQps) { - this.passQps = passQps; - } - - public Long getBlockQps() { - return blockQps; - } - - public void setBlockQps(Long blockQps) { - this.blockQps = blockQps; - } - - public Long getTotalQps() { - return totalQps; - } - - public void setTotalQps(Long totalQps) { - this.totalQps = totalQps; - } - - public Long getAverageRt() { - return averageRt; - } - - public void setAverageRt(Long averageRt) { - this.averageRt = averageRt; - } - - public Long getPassRequestQps() { - return passRequestQps; - } - - public void setPassRequestQps(Long passRequestQps) { - this.passRequestQps = passRequestQps; - } - - public Long getExceptionQps() { - return exceptionQps; - } - - public void setExceptionQps(Long exceptionQps) { - this.exceptionQps = exceptionQps; - } - - public Long getOneMinuteException() { - return oneMinuteException; - } - - public void setOneMinuteException(Long oneMinuteException) { - this.oneMinuteException = oneMinuteException; - } - - public Long getOneMinutePass() { - return oneMinutePass; - } - - public void setOneMinutePass(Long oneMinutePass) { - this.oneMinutePass = oneMinutePass; - } - - public Long getOneMinuteBlock() { - return oneMinuteBlock; - } - - public void setOneMinuteBlock(Long oneMinuteBlock) { - this.oneMinuteBlock = oneMinuteBlock; - } - - public Long getOneMinuteTotal() { - return oneMinuteTotal; - } - - public void setOneMinuteTotal(Long oneMinuteTotal) { - this.oneMinuteTotal = oneMinuteTotal; - } - - public boolean isVisible() { - return visible; - } - - public void setVisible(boolean visible) { - this.visible = visible; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/gateway/api/AddApiReqVo.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/gateway/api/AddApiReqVo.java deleted file mode 100644 index 22888f73..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/gateway/api/AddApiReqVo.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.vo.gateway.api; - -import java.util.List; - -/** - * Value Object for add gateway api. - * - * @author cdfive - * @since 1.7.0 - */ -public class AddApiReqVo { - - private String app; - - private String ip; - - private Integer port; - - private String apiName; - - private List predicateItems; - - public String getApp() { - return app; - } - - public void setApp(String app) { - this.app = app; - } - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public Integer getPort() { - return port; - } - - public void setPort(Integer port) { - this.port = port; - } - - public String getApiName() { - return apiName; - } - - public void setApiName(String apiName) { - this.apiName = apiName; - } - - public List getPredicateItems() { - return predicateItems; - } - - public void setPredicateItems(List predicateItems) { - this.predicateItems = predicateItems; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/gateway/api/ApiPredicateItemVo.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/gateway/api/ApiPredicateItemVo.java deleted file mode 100644 index 52300d95..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/gateway/api/ApiPredicateItemVo.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.vo.gateway.api; - -/** - * Value Object for add or update gateway api. - * - * @author cdfive - * @since 1.7.0 - */ -public class ApiPredicateItemVo { - - /** - * The pattern for matching url. - */ - private String pattern; - - /** - * The matching Strategy in url. Constants are defined in class - * SentinelGatewayConstants.\ - * - *
    - *
  • 0(URL_MATCH_STRATEGY_EXACT): exact match mode
  • - *
  • 1(URL_MATCH_STRATEGY_PREFIX): prefix match mode
  • - *
  • 2(URL_MATCH_STRATEGY_REGEX): regex match mode
  • - *
- */ - private Integer matchStrategy; - - public String getPattern() { - return pattern; - } - - public void setPattern(String pattern) { - this.pattern = pattern; - } - - public Integer getMatchStrategy() { - return matchStrategy; - } - - public void setMatchStrategy(Integer matchStrategy) { - this.matchStrategy = matchStrategy; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/gateway/api/UpdateApiReqVo.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/gateway/api/UpdateApiReqVo.java deleted file mode 100644 index f41e329c..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/gateway/api/UpdateApiReqVo.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.vo.gateway.api; - -import java.util.List; - -/** - * Value Object for update gateway api. - * - * @author cdfive - * @since 1.7.0 - */ -public class UpdateApiReqVo { - - private Long id; - - private String app; - - private List predicateItems; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getApp() { - return app; - } - - public void setApp(String app) { - this.app = app; - } - - public List getPredicateItems() { - return predicateItems; - } - - public void setPredicateItems(List predicateItems) { - this.predicateItems = predicateItems; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/gateway/rule/AddFlowRuleReqVo.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/gateway/rule/AddFlowRuleReqVo.java deleted file mode 100644 index 08ac0c65..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/gateway/rule/AddFlowRuleReqVo.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.vo.gateway.rule; - -/** - * Value Object for add gateway flow rule. - * - * @author cdfive - * @since 1.7.0 - */ -public class AddFlowRuleReqVo { - - private String app; - - private String ip; - - private Integer port; - - private String resource; - - private Integer resourceMode; - - private Integer grade; - - private Double count; - - private Long interval; - - private Integer intervalUnit; - - private Integer controlBehavior; - - private Integer burst; - - private Integer maxQueueingTimeoutMs; - - private GatewayParamFlowItemVo paramItem; - - public String getApp() { - return app; - } - - public void setApp(String app) { - this.app = app; - } - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public Integer getPort() { - return port; - } - - public void setPort(Integer port) { - this.port = port; - } - - public String getResource() { - return resource; - } - - public void setResource(String resource) { - this.resource = resource; - } - - public Integer getResourceMode() { - return resourceMode; - } - - public void setResourceMode(Integer resourceMode) { - this.resourceMode = resourceMode; - } - - public Integer getGrade() { - return grade; - } - - public void setGrade(Integer grade) { - this.grade = grade; - } - - public Double getCount() { - return count; - } - - public void setCount(Double count) { - this.count = count; - } - - public Long getInterval() { - return interval; - } - - public void setInterval(Long interval) { - this.interval = interval; - } - - public Integer getIntervalUnit() { - return intervalUnit; - } - - public void setIntervalUnit(Integer intervalUnit) { - this.intervalUnit = intervalUnit; - } - - public Integer getControlBehavior() { - return controlBehavior; - } - - public void setControlBehavior(Integer controlBehavior) { - this.controlBehavior = controlBehavior; - } - - public Integer getBurst() { - return burst; - } - - public void setBurst(Integer burst) { - this.burst = burst; - } - - public Integer getMaxQueueingTimeoutMs() { - return maxQueueingTimeoutMs; - } - - public void setMaxQueueingTimeoutMs(Integer maxQueueingTimeoutMs) { - this.maxQueueingTimeoutMs = maxQueueingTimeoutMs; - } - - public GatewayParamFlowItemVo getParamItem() { - return paramItem; - } - - public void setParamItem(GatewayParamFlowItemVo paramItem) { - this.paramItem = paramItem; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/gateway/rule/GatewayParamFlowItemVo.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/gateway/rule/GatewayParamFlowItemVo.java deleted file mode 100644 index 07c5a91a..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/gateway/rule/GatewayParamFlowItemVo.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.vo.gateway.rule; - -/** - * Value Object for add or update gateway flow rule. - * - * @author cdfive - * @since 1.7.0 - */ -public class GatewayParamFlowItemVo { - - private Integer parseStrategy; - - private String fieldName; - - private String pattern; - - private Integer matchStrategy; - - public Integer getParseStrategy() { - return parseStrategy; - } - - public void setParseStrategy(Integer parseStrategy) { - this.parseStrategy = parseStrategy; - } - - public String getFieldName() { - return fieldName; - } - - public void setFieldName(String fieldName) { - this.fieldName = fieldName; - } - - public String getPattern() { - return pattern; - } - - public void setPattern(String pattern) { - this.pattern = pattern; - } - - public Integer getMatchStrategy() { - return matchStrategy; - } - - public void setMatchStrategy(Integer matchStrategy) { - this.matchStrategy = matchStrategy; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/gateway/rule/UpdateFlowRuleReqVo.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/gateway/rule/UpdateFlowRuleReqVo.java deleted file mode 100644 index ebc7b10a..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/domain/vo/gateway/rule/UpdateFlowRuleReqVo.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.domain.vo.gateway.rule; - -/** - * Value Object for update gateway flow rule. - * - * @author cdfive - * @since 1.7.0 - */ -public class UpdateFlowRuleReqVo { - - private Long id; - - private String app; - - private Integer grade; - - private Double count; - - private Long interval; - - private Integer intervalUnit; - - private Integer controlBehavior; - - private Integer burst; - - private Integer maxQueueingTimeoutMs; - - private GatewayParamFlowItemVo paramItem; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getApp() { - return app; - } - - public void setApp(String app) { - this.app = app; - } - - public Integer getGrade() { - return grade; - } - - public void setGrade(Integer grade) { - this.grade = grade; - } - - public Double getCount() { - return count; - } - - public void setCount(Double count) { - this.count = count; - } - - public Long getInterval() { - return interval; - } - - public void setInterval(Long interval) { - this.interval = interval; - } - - public Integer getIntervalUnit() { - return intervalUnit; - } - - public void setIntervalUnit(Integer intervalUnit) { - this.intervalUnit = intervalUnit; - } - - public Integer getControlBehavior() { - return controlBehavior; - } - - public void setControlBehavior(Integer controlBehavior) { - this.controlBehavior = controlBehavior; - } - - public Integer getBurst() { - return burst; - } - - public void setBurst(Integer burst) { - this.burst = burst; - } - - public Integer getMaxQueueingTimeoutMs() { - return maxQueueingTimeoutMs; - } - - public void setMaxQueueingTimeoutMs(Integer maxQueueingTimeoutMs) { - this.maxQueueingTimeoutMs = maxQueueingTimeoutMs; - } - - public GatewayParamFlowItemVo getParamItem() { - return paramItem; - } - - public void setParamItem(GatewayParamFlowItemVo paramItem) { - this.paramItem = paramItem; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/metric/MetricFetcher.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/metric/MetricFetcher.java deleted file mode 100644 index 2b4cc788..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/metric/MetricFetcher.java +++ /dev/null @@ -1,383 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.metric; - -import com.alibaba.csp.sentinel.Constants; -import com.alibaba.csp.sentinel.concurrent.NamedThreadFactory; -import com.alibaba.csp.sentinel.config.SentinelConfig; -import com.alibaba.csp.sentinel.dashboard.datasource.entity.MetricEntity; -import com.alibaba.csp.sentinel.dashboard.discovery.AppInfo; -import com.alibaba.csp.sentinel.dashboard.discovery.AppManagement; -import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo; -import com.alibaba.csp.sentinel.dashboard.repository.metric.MetricsRepository; -import com.alibaba.csp.sentinel.node.metric.MetricNode; -import com.alibaba.csp.sentinel.util.StringUtil; -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.concurrent.FutureCallback; -import org.apache.http.entity.ContentType; -import org.apache.http.impl.client.DefaultRedirectStrategy; -import org.apache.http.impl.nio.client.CloseableHttpAsyncClient; -import org.apache.http.impl.nio.client.HttpAsyncClients; -import org.apache.http.impl.nio.reactor.IOReactorConfig; -import org.apache.http.protocol.HTTP; -import org.apache.http.util.EntityUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.net.ConnectException; -import java.net.SocketTimeoutException; -import java.nio.charset.Charset; -import java.util.*; -import java.util.concurrent.*; -import java.util.concurrent.ThreadPoolExecutor.DiscardPolicy; -import java.util.concurrent.atomic.AtomicLong; - -/** - * Fetch metric of machines. - * - * @author leyou - */ -@Component -public class MetricFetcher { - - public static final String NO_METRICS = "No metrics"; - - private static final int HTTP_OK = 200; - - private static final long MAX_LAST_FETCH_INTERVAL_MS = 1000 * 15; - - private static final long FETCH_INTERVAL_SECOND = 6; - - private static final Charset DEFAULT_CHARSET = Charset.forName(SentinelConfig.charset()); - - private final static String METRIC_URL_PATH = "metric"; - - private static Logger logger = LoggerFactory.getLogger(MetricFetcher.class); - - private final long intervalSecond = 1; - - private Map appLastFetchTime = new ConcurrentHashMap<>(); - - @Autowired - private MetricsRepository metricStore; - - @Autowired - private AppManagement appManagement; - - private CloseableHttpAsyncClient httpclient; - - @SuppressWarnings("PMD.ThreadPoolCreationRule") - private ScheduledExecutorService fetchScheduleService = Executors.newScheduledThreadPool(1, - new NamedThreadFactory("sentinel-dashboard-metrics-fetch-task", true)); - - private ExecutorService fetchService; - - private ExecutorService fetchWorker; - - public MetricFetcher() { - int cores = Runtime.getRuntime().availableProcessors() * 2; - long keepAliveTime = 0; - int queueSize = 2048; - RejectedExecutionHandler handler = new DiscardPolicy(); - fetchService = new ThreadPoolExecutor(cores, cores, keepAliveTime, TimeUnit.MILLISECONDS, - new ArrayBlockingQueue<>(queueSize), - new NamedThreadFactory("sentinel-dashboard-metrics-fetchService", true), handler); - fetchWorker = new ThreadPoolExecutor(cores, cores, keepAliveTime, TimeUnit.MILLISECONDS, - new ArrayBlockingQueue<>(queueSize), - new NamedThreadFactory("sentinel-dashboard-metrics-fetchWorker", true), handler); - IOReactorConfig ioConfig = IOReactorConfig.custom() - .setConnectTimeout(3000) - .setSoTimeout(3000) - .setIoThreadCount(Runtime.getRuntime().availableProcessors() * 2) - .build(); - - httpclient = HttpAsyncClients.custom().setRedirectStrategy(new DefaultRedirectStrategy() { - @Override - protected boolean isRedirectable(final String method) { - return false; - } - }).setMaxConnTotal(4000).setMaxConnPerRoute(1000).setDefaultIOReactorConfig(ioConfig).build(); - httpclient.start(); - start(); - } - - private void start() { - fetchScheduleService.scheduleAtFixedRate(() -> { - try { - fetchAllApp(); - } - catch (Exception e) { - logger.info("fetchAllApp error:", e); - } - }, 10, intervalSecond, TimeUnit.SECONDS); - } - - private void writeMetric(Map map) { - if (map.isEmpty()) { - return; - } - Date date = new Date(); - for (MetricEntity entity : map.values()) { - entity.setGmtCreate(date); - entity.setGmtModified(date); - } - metricStore.saveAll(map.values()); - } - - /** - * Traverse each APP, and then pull the metric of all machines for that APP. - */ - private void fetchAllApp() { - List apps = appManagement.getAppNames(); - if (apps == null) { - return; - } - for (final String app : apps) { - fetchService.submit(() -> { - try { - doFetchAppMetric(app); - } - catch (Exception e) { - logger.error("fetchAppMetric error", e); - } - }); - } - } - - /** - * fetch metric between [startTime, endTime], both side inclusive - */ - private void fetchOnce(String app, long startTime, long endTime, int maxWaitSeconds) { - if (maxWaitSeconds <= 0) { - throw new IllegalArgumentException("maxWaitSeconds must > 0, but " + maxWaitSeconds); - } - AppInfo appInfo = appManagement.getDetailApp(app); - // auto remove for app - if (appInfo.isDead()) { - logger.info("Dead app removed: {}", app); - appManagement.removeApp(app); - return; - } - Set machines = appInfo.getMachines(); - logger.debug("enter fetchOnce(" + app + "), machines.size()=" + machines.size() + ", time intervalMs [" - + startTime + ", " + endTime + "]"); - if (machines.isEmpty()) { - return; - } - final String msg = "fetch"; - AtomicLong unhealthy = new AtomicLong(); - final AtomicLong success = new AtomicLong(); - final AtomicLong fail = new AtomicLong(); - - long start = System.currentTimeMillis(); - /** app_resource_timeSecond -> metric */ - final Map metricMap = new ConcurrentHashMap<>(16); - final CountDownLatch latch = new CountDownLatch(machines.size()); - for (final MachineInfo machine : machines) { - // auto remove - if (machine.isDead()) { - latch.countDown(); - appManagement.getDetailApp(app).removeMachine(machine.getIp(), machine.getPort()); - logger.info("Dead machine removed: {}:{} of {}", machine.getIp(), machine.getPort(), app); - continue; - } - if (!machine.isHealthy()) { - latch.countDown(); - unhealthy.incrementAndGet(); - continue; - } - final String url = "http://" + machine.getIp() + ":" + machine.getPort() + "/" + METRIC_URL_PATH - + "?startTime=" + startTime + "&endTime=" + endTime + "&refetch=" + false; - final HttpGet httpGet = new HttpGet(url); - httpGet.setHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE); - httpclient.execute(httpGet, new FutureCallback() { - @Override - public void completed(final HttpResponse response) { - try { - handleResponse(response, machine, metricMap); - success.incrementAndGet(); - } - catch (Exception e) { - logger.error(msg + " metric " + url + " error:", e); - } - finally { - latch.countDown(); - } - } - - @Override - public void failed(final Exception ex) { - latch.countDown(); - fail.incrementAndGet(); - httpGet.abort(); - if (ex instanceof SocketTimeoutException) { - logger.error("Failed to fetch metric from <{}>: socket timeout", url); - } - else if (ex instanceof ConnectException) { - logger.error("Failed to fetch metric from <{}> (ConnectionException: {})", url, - ex.getMessage()); - } - else { - logger.error(msg + " metric " + url + " error", ex); - } - } - - @Override - public void cancelled() { - latch.countDown(); - fail.incrementAndGet(); - httpGet.abort(); - } - }); - } - try { - latch.await(maxWaitSeconds, TimeUnit.SECONDS); - } - catch (Exception e) { - logger.info(msg + " metric, wait http client error:", e); - } - // long cost = System.currentTimeMillis() - start; - // logger.info("finished " + msg + " metric for " + app + ", time intervalMs [" + - // startTime + ", " + endTime - // + "], total machines=" + machines.size() + ", dead=" + dead + ", fetch - // success=" - // + success + ", fetch fail=" + fail + ", time cost=" + cost + " ms"); - writeMetric(metricMap); - } - - private void doFetchAppMetric(final String app) { - long now = System.currentTimeMillis(); - long lastFetchMs = now - MAX_LAST_FETCH_INTERVAL_MS; - if (appLastFetchTime.containsKey(app)) { - lastFetchMs = Math.max(lastFetchMs, appLastFetchTime.get(app).get() + 1000); - } - // trim milliseconds - lastFetchMs = lastFetchMs / 1000 * 1000; - long endTime = lastFetchMs + FETCH_INTERVAL_SECOND * 1000; - if (endTime > now - 1000 * 2) { - // too near - return; - } - // update last_fetch in advance. - appLastFetchTime.computeIfAbsent(app, a -> new AtomicLong()).set(endTime); - final long finalLastFetchMs = lastFetchMs; - final long finalEndTime = endTime; - try { - // do real fetch async - fetchWorker.submit(() -> { - try { - fetchOnce(app, finalLastFetchMs, finalEndTime, 5); - } - catch (Exception e) { - logger.info("fetchOnce(" + app + ") error", e); - } - }); - } - catch (Exception e) { - logger.info("submit fetchOnce(" + app + ") fail, intervalMs [" + lastFetchMs + ", " + endTime + "]", e); - } - } - - private void handleResponse(final HttpResponse response, MachineInfo machine, Map metricMap) - throws Exception { - int code = response.getStatusLine().getStatusCode(); - if (code != HTTP_OK) { - return; - } - Charset charset = null; - try { - String contentTypeStr = response.getFirstHeader("Content-type").getValue(); - if (StringUtil.isNotEmpty(contentTypeStr)) { - ContentType contentType = ContentType.parse(contentTypeStr); - charset = contentType.getCharset(); - } - } - catch (Exception ignore) { - } - String body = EntityUtils.toString(response.getEntity(), charset != null ? charset : DEFAULT_CHARSET); - if (StringUtil.isEmpty(body) || body.startsWith(NO_METRICS)) { - // logger.info(machine.getApp() + ":" + machine.getIp() + ":" + - // machine.getPort() + ", bodyStr is empty"); - return; - } - String[] lines = body.split("\n"); - // logger.info(machine.getApp() + ":" + machine.getIp() + ":" + machine.getPort() - // + - // ", bodyStr.length()=" + body.length() + ", lines=" + lines.length); - handleBody(lines, machine, metricMap); - } - - private void handleBody(String[] lines, MachineInfo machine, Map map) { - // logger.info("handleBody() lines=" + lines.length + ", machine=" + machine); - if (lines.length < 1) { - return; - } - - for (String line : lines) { - try { - MetricNode node = MetricNode.fromThinString(line); - if (shouldFilterOut(node.getResource())) { - continue; - } - /* - * aggregation metrics by app_resource_timeSecond, ignore ip and port. - */ - String key = buildMetricKey(machine.getApp(), node.getResource(), node.getTimestamp()); - - MetricEntity metricEntity = map.computeIfAbsent(key, s -> { - MetricEntity initMetricEntity = new MetricEntity(); - initMetricEntity.setApp(machine.getApp()); - initMetricEntity.setTimestamp(new Date(node.getTimestamp())); - initMetricEntity.setPassQps(0L); - initMetricEntity.setBlockQps(0L); - initMetricEntity.setRtAndSuccessQps(0, 0L); - initMetricEntity.setExceptionQps(0L); - initMetricEntity.setCount(0); - initMetricEntity.setResource(node.getResource()); - return initMetricEntity; - }); - metricEntity.addPassQps(node.getPassQps()); - metricEntity.addBlockQps(node.getBlockQps()); - metricEntity.addRtAndSuccessQps(node.getRt(), node.getSuccessQps()); - metricEntity.addExceptionQps(node.getExceptionQps()); - metricEntity.addCount(1); - } - catch (Exception e) { - logger.warn("handleBody line exception, machine: {}, line: {}", machine.toLogString(), line); - } - } - } - - private String buildMetricKey(String app, String resource, long timestamp) { - return app + "__" + resource + "__" + (timestamp / 1000); - } - - private boolean shouldFilterOut(String resource) { - return RES_EXCLUSION_SET.contains(resource); - } - - private static final Set RES_EXCLUSION_SET = new HashSet() { - { - add(Constants.TOTAL_IN_RESOURCE_NAME); - add(Constants.SYSTEM_LOAD_RESOURCE_NAME); - add(Constants.CPU_USAGE_RESOURCE_NAME); - } - }; - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/gateway/InMemApiDefinitionStore.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/gateway/InMemApiDefinitionStore.java deleted file mode 100644 index 2e516d85..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/gateway/InMemApiDefinitionStore.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.repository.gateway; - -import com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway.ApiDefinitionEntity; -import com.alibaba.csp.sentinel.dashboard.repository.rule.InMemoryRuleRepositoryAdapter; -import org.springframework.stereotype.Component; - -import java.util.concurrent.atomic.AtomicLong; - -/** - * Store {@link ApiDefinitionEntity} in memory. - * - * @author cdfive - * @since 1.7.0 - */ -@Component -public class InMemApiDefinitionStore extends InMemoryRuleRepositoryAdapter { - - private static AtomicLong ids = new AtomicLong(0); - - @Override - protected long nextId() { - return ids.incrementAndGet(); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/gateway/InMemGatewayFlowRuleStore.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/gateway/InMemGatewayFlowRuleStore.java deleted file mode 100644 index a793ef63..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/gateway/InMemGatewayFlowRuleStore.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.repository.gateway; - -import com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway.GatewayFlowRuleEntity; -import com.alibaba.csp.sentinel.dashboard.repository.rule.InMemoryRuleRepositoryAdapter; -import org.springframework.stereotype.Component; - -import java.util.concurrent.atomic.AtomicLong; - -/** - * Store {@link GatewayFlowRuleEntity} in memory. - * - * @author cdfive - * @since 1.7.0 - */ -@Component -public class InMemGatewayFlowRuleStore extends InMemoryRuleRepositoryAdapter { - - private static AtomicLong ids = new AtomicLong(0); - - @Override - protected long nextId() { - return ids.incrementAndGet(); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/metric/InMemoryMetricsRepository.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/metric/InMemoryMetricsRepository.java deleted file mode 100644 index 7968851a..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/metric/InMemoryMetricsRepository.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.repository.metric; - -import com.alibaba.csp.sentinel.dashboard.datasource.entity.MetricEntity; -import com.alibaba.csp.sentinel.util.StringUtil; -import com.alibaba.csp.sentinel.util.TimeUtil; -import org.springframework.stereotype.Component; - -import java.util.*; -import java.util.Map.Entry; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.util.stream.Collectors; - -/** - * Caches metrics data in a period of time in memory. - * - * @author Carpenter Lee - * @author Eric Zhao - */ -@Component -public class InMemoryMetricsRepository implements MetricsRepository { - - private static final long MAX_METRIC_LIVE_TIME_MS = 1000 * 60 * 5; - - /** - * {@code app -> resource -> timestamp -> metric} - */ - private Map>> allMetrics = new ConcurrentHashMap<>(); - - private final ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock(); - - @Override - public void save(MetricEntity entity) { - if (entity == null || StringUtil.isBlank(entity.getApp())) { - return; - } - readWriteLock.writeLock().lock(); - try { - allMetrics.computeIfAbsent(entity.getApp(), e -> new HashMap<>(16)) - .computeIfAbsent(entity.getResource(), e -> new LinkedHashMap() { - @Override - protected boolean removeEldestEntry(Entry eldest) { - // Metric older than {@link #MAX_METRIC_LIVE_TIME_MS} will be - // removed. - return eldest.getKey() < TimeUtil.currentTimeMillis() - MAX_METRIC_LIVE_TIME_MS; - } - }) - .put(entity.getTimestamp().getTime(), entity); - } - finally { - readWriteLock.writeLock().unlock(); - } - - } - - @Override - public void saveAll(Iterable metrics) { - if (metrics == null) { - return; - } - readWriteLock.writeLock().lock(); - try { - metrics.forEach(this::save); - } - finally { - readWriteLock.writeLock().unlock(); - } - } - - @Override - public List queryByAppAndResourceBetween(String app, String resource, long startTime, long endTime) { - List results = new ArrayList<>(); - if (StringUtil.isBlank(app)) { - return results; - } - Map> resourceMap = allMetrics.get(app); - if (resourceMap == null) { - return results; - } - LinkedHashMap metricsMap = resourceMap.get(resource); - if (metricsMap == null) { - return results; - } - readWriteLock.readLock().lock(); - try { - for (Entry entry : metricsMap.entrySet()) { - if (entry.getKey() >= startTime && entry.getKey() <= endTime) { - results.add(entry.getValue()); - } - } - return results; - } - finally { - readWriteLock.readLock().unlock(); - } - } - - @Override - public List listResourcesOfApp(String app) { - List results = new ArrayList<>(); - if (StringUtil.isBlank(app)) { - return results; - } - // resource -> timestamp -> metric - Map> resourceMap = allMetrics.get(app); - if (resourceMap == null) { - return results; - } - final long minTimeMs = System.currentTimeMillis() - 1000 * 60; - Map resourceCount = new ConcurrentHashMap<>(32); - - readWriteLock.readLock().lock(); - try { - for (Entry> resourceMetrics : resourceMap.entrySet()) { - for (Entry metrics : resourceMetrics.getValue().entrySet()) { - if (metrics.getKey() < minTimeMs) { - continue; - } - MetricEntity newEntity = metrics.getValue(); - if (resourceCount.containsKey(resourceMetrics.getKey())) { - MetricEntity oldEntity = resourceCount.get(resourceMetrics.getKey()); - oldEntity.addPassQps(newEntity.getPassQps()); - oldEntity.addRtAndSuccessQps(newEntity.getRt(), newEntity.getSuccessQps()); - oldEntity.addBlockQps(newEntity.getBlockQps()); - oldEntity.addExceptionQps(newEntity.getExceptionQps()); - oldEntity.addCount(1); - } - else { - resourceCount.put(resourceMetrics.getKey(), MetricEntity.copyOf(newEntity)); - } - } - } - // Order by last minute b_qps DESC. - return resourceCount.entrySet().stream().sorted((o1, o2) -> { - MetricEntity e1 = o1.getValue(); - MetricEntity e2 = o2.getValue(); - int t = e2.getBlockQps().compareTo(e1.getBlockQps()); - if (t != 0) { - return t; - } - return e2.getPassQps().compareTo(e1.getPassQps()); - }).map(Entry::getKey).collect(Collectors.toList()); - } - finally { - readWriteLock.readLock().unlock(); - } - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/metric/MetricsRepository.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/metric/MetricsRepository.java deleted file mode 100644 index 6676145b..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/metric/MetricsRepository.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.repository.metric; - -import java.util.List; - -/** - * Repository interface for aggregated metrics data. - * - * @param type of metrics - * @author Eric Zhao - */ -public interface MetricsRepository { - - /** - * Save the metric to the storage repository. - * @param metric metric data to save - */ - void save(T metric); - - /** - * Save all metrics to the storage repository. - * @param metrics metrics to save - */ - void saveAll(Iterable metrics); - - /** - * Get all metrics by {@code appName} and {@code resourceName} between a period of - * time. - * @param app application name for Sentinel - * @param resource resource name - * @param startTime start timestamp - * @param endTime end timestamp - * @return all metrics in query conditions - */ - List queryByAppAndResourceBetween(String app, String resource, long startTime, long endTime); - - /** - * List resource name of provided application name. - * @param app application name - * @return list of resources - */ - List listResourcesOfApp(String app); - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/rule/InMemAuthorityRuleStore.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/rule/InMemAuthorityRuleStore.java deleted file mode 100644 index 422e0e61..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/rule/InMemAuthorityRuleStore.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.repository.rule; - -import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.AuthorityRuleEntity; -import org.springframework.stereotype.Component; - -import java.util.concurrent.atomic.AtomicLong; - -/** - * In-memory storage for authority rules. - * - * @author Eric Zhao - * @since 0.2.1 - */ -@Component -public class InMemAuthorityRuleStore extends InMemoryRuleRepositoryAdapter { - - private static AtomicLong ids = new AtomicLong(0); - - @Override - protected long nextId() { - return ids.incrementAndGet(); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/rule/InMemDegradeRuleStore.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/rule/InMemDegradeRuleStore.java deleted file mode 100644 index 7891924d..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/rule/InMemDegradeRuleStore.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.repository.rule; - -import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.DegradeRuleEntity; -import org.springframework.stereotype.Component; - -import java.util.concurrent.atomic.AtomicLong; - -/** - * @author leyou - */ -@Component -public class InMemDegradeRuleStore extends InMemoryRuleRepositoryAdapter { - - private static AtomicLong ids = new AtomicLong(0); - - @Override - protected long nextId() { - return ids.incrementAndGet(); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/rule/InMemFlowRuleStore.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/rule/InMemFlowRuleStore.java deleted file mode 100644 index c54fdb2d..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/rule/InMemFlowRuleStore.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.repository.rule; - -import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.FlowRuleEntity; -import com.alibaba.csp.sentinel.slots.block.flow.ClusterFlowConfig; -import org.springframework.stereotype.Component; - -import java.util.concurrent.atomic.AtomicLong; - -/** - * Store {@link FlowRuleEntity} in memory. - * - * @author leyou - */ -@Component -public class InMemFlowRuleStore extends InMemoryRuleRepositoryAdapter { - - private static AtomicLong ids = new AtomicLong(0); - - @Override - protected long nextId() { - return ids.incrementAndGet(); - } - - @Override - protected FlowRuleEntity preProcess(FlowRuleEntity entity) { - if (entity != null && entity.isClusterMode()) { - ClusterFlowConfig config = entity.getClusterConfig(); - if (config == null) { - config = new ClusterFlowConfig(); - entity.setClusterConfig(config); - } - // Set cluster rule id. - config.setFlowId(entity.getId()); - } - return entity; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/rule/InMemParamFlowRuleStore.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/rule/InMemParamFlowRuleStore.java deleted file mode 100644 index 6ca20401..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/rule/InMemParamFlowRuleStore.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.repository.rule; - -import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.ParamFlowRuleEntity; -import com.alibaba.csp.sentinel.slots.block.flow.param.ParamFlowClusterConfig; -import org.springframework.stereotype.Component; - -import java.util.concurrent.atomic.AtomicLong; - -/** - * @author Eric Zhao - * @since 0.2.1 - */ -@Component -public class InMemParamFlowRuleStore extends InMemoryRuleRepositoryAdapter { - - private static AtomicLong ids = new AtomicLong(0); - - @Override - protected long nextId() { - return ids.incrementAndGet(); - } - - @Override - protected ParamFlowRuleEntity preProcess(ParamFlowRuleEntity entity) { - if (entity != null && entity.isClusterMode()) { - ParamFlowClusterConfig config = entity.getClusterConfig(); - if (config == null) { - config = new ParamFlowClusterConfig(); - } - // Set cluster rule id. - config.setFlowId(entity.getId()); - } - return entity; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/rule/InMemSystemRuleStore.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/rule/InMemSystemRuleStore.java deleted file mode 100644 index 7a4e9433..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/rule/InMemSystemRuleStore.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.repository.rule; - -import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.SystemRuleEntity; -import org.springframework.stereotype.Component; - -import java.util.concurrent.atomic.AtomicLong; - -/** - * @author leyou - */ -@Component -public class InMemSystemRuleStore extends InMemoryRuleRepositoryAdapter { - - private static AtomicLong ids = new AtomicLong(0); - - @Override - protected long nextId() { - return ids.incrementAndGet(); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/rule/InMemoryRuleRepositoryAdapter.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/rule/InMemoryRuleRepositoryAdapter.java deleted file mode 100644 index d3be5f88..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/rule/InMemoryRuleRepositoryAdapter.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.repository.rule; - -import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.RuleEntity; -import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo; -import com.alibaba.csp.sentinel.util.AssertUtil; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -/** - * @author leyou - */ -public abstract class InMemoryRuleRepositoryAdapter implements RuleRepository { - - /** - * {@code >} - */ - private Map> machineRules = new ConcurrentHashMap<>(16); - - private Map allRules = new ConcurrentHashMap<>(16); - - private Map> appRules = new ConcurrentHashMap<>(16); - - private static final int MAX_RULES_SIZE = 10000; - - @Override - public T save(T entity) { - if (entity.getId() == null) { - entity.setId(nextId()); - } - T processedEntity = preProcess(entity); - if (processedEntity != null) { - allRules.put(processedEntity.getId(), processedEntity); - machineRules - .computeIfAbsent( - MachineInfo.of(processedEntity.getApp(), processedEntity.getIp(), processedEntity.getPort()), - e -> new ConcurrentHashMap<>(32)) - .put(processedEntity.getId(), processedEntity); - appRules.computeIfAbsent(processedEntity.getApp(), v -> new ConcurrentHashMap<>(32)) - .put(processedEntity.getId(), processedEntity); - } - - return processedEntity; - } - - @Override - public List saveAll(List rules) { - // TODO: check here. - allRules.clear(); - machineRules.clear(); - appRules.clear(); - - if (rules == null) { - return null; - } - List savedRules = new ArrayList<>(rules.size()); - for (T rule : rules) { - savedRules.add(save(rule)); - } - return savedRules; - } - - @Override - public T delete(Long id) { - T entity = allRules.remove(id); - if (entity != null) { - if (appRules.get(entity.getApp()) != null) { - appRules.get(entity.getApp()).remove(id); - } - machineRules.get(MachineInfo.of(entity.getApp(), entity.getIp(), entity.getPort())).remove(id); - } - return entity; - } - - @Override - public T findById(Long id) { - return allRules.get(id); - } - - @Override - public List findAllByMachine(MachineInfo machineInfo) { - Map entities = machineRules.get(machineInfo); - if (entities == null) { - return new ArrayList<>(); - } - return new ArrayList<>(entities.values()); - } - - @Override - public List findAllByApp(String appName) { - AssertUtil.notEmpty(appName, "appName cannot be empty"); - Map entities = appRules.get(appName); - if (entities == null) { - return new ArrayList<>(); - } - return new ArrayList<>(entities.values()); - } - - public void clearAll() { - allRules.clear(); - machineRules.clear(); - appRules.clear(); - } - - protected T preProcess(T entity) { - return entity; - } - - /** - * Get next unused id. - * @return next unused id - */ - abstract protected long nextId(); - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/rule/RuleRepository.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/rule/RuleRepository.java deleted file mode 100644 index 26f19d42..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/repository/rule/RuleRepository.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.repository.rule; - -import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo; - -import java.util.List; - -/** - * Interface to store and find rules. - * - * @author leyou - */ -public interface RuleRepository { - - /** - * Save one. - * @param entity - * @return - */ - T save(T entity); - - /** - * Save all. - * @param rules - * @return rules saved. - */ - List saveAll(List rules); - - /** - * Delete by id - * @param id - * @return entity deleted - */ - T delete(ID id); - - /** - * Find by id. - * @param id - * @return - */ - T findById(ID id); - - /** - * Find all by machine. - * @param machineInfo - * @return - */ - List findAllByMachine(MachineInfo machineInfo); - - /** - * Find all by application. - * @param appName valid app name - * @return all rules of the application - * @since 1.4.0 - */ - List findAllByApp(String appName); - - /// ** - // * Find all by app and enable switch. - // * @param app - // * @param enable - // * @return - // */ - // List findAllByAppAndEnable(String app, boolean enable); - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/DynamicRuleProvider.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/DynamicRuleProvider.java deleted file mode 100644 index 11544951..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/DynamicRuleProvider.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.rule; - -/** - * @author Eric Zhao - * @since 1.4.0 - */ -public interface DynamicRuleProvider { - - T getRules(String appName) throws Exception; - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/DynamicRulePublisher.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/DynamicRulePublisher.java deleted file mode 100644 index b49e0dff..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/DynamicRulePublisher.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.rule; - -/** - * @author Eric Zhao - * @since 1.4.0 - */ -public interface DynamicRulePublisher { - - /** - * Publish rules to remote rule configuration center for given application name. - * @param app app name - * @param rules list of rules to push - * @throws Exception if some error occurs - */ - void publish(String app, T rules) throws Exception; - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/FlowRuleApiProvider.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/FlowRuleApiProvider.java deleted file mode 100644 index eabafdd2..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/FlowRuleApiProvider.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.rule; - -import com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient; -import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.FlowRuleEntity; -import com.alibaba.csp.sentinel.dashboard.discovery.AppManagement; -import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo; -import com.alibaba.csp.sentinel.util.StringUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -/** - * @author Eric Zhao - */ -@Component("flowRuleDefaultProvider") -public class FlowRuleApiProvider implements DynamicRuleProvider> { - - @Autowired - private SentinelApiClient sentinelApiClient; - - @Autowired - private AppManagement appManagement; - - @Override - public List getRules(String appName) throws Exception { - if (StringUtil.isBlank(appName)) { - return new ArrayList<>(); - } - List list = appManagement.getDetailApp(appName) - .getMachines() - .stream() - .filter(MachineInfo::isHealthy) - .sorted((e1, e2) -> Long.compare(e2.getLastHeartbeat(), e1.getLastHeartbeat())) - .collect(Collectors.toList()); - if (list.isEmpty()) { - return new ArrayList<>(); - } - else { - MachineInfo machine = list.get(0); - return sentinelApiClient.fetchFlowRuleOfMachine(machine.getApp(), machine.getIp(), machine.getPort()); - } - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/FlowRuleApiPublisher.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/FlowRuleApiPublisher.java deleted file mode 100644 index a5d8ac83..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/FlowRuleApiPublisher.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.rule; - -import com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient; -import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.FlowRuleEntity; -import com.alibaba.csp.sentinel.dashboard.discovery.AppManagement; -import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo; -import com.alibaba.csp.sentinel.util.StringUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.Set; - -/** - * @author Eric Zhao - * @since 1.4.0 - */ -@Component("flowRuleDefaultPublisher") -public class FlowRuleApiPublisher implements DynamicRulePublisher> { - - @Autowired - private SentinelApiClient sentinelApiClient; - - @Autowired - private AppManagement appManagement; - - @Override - public void publish(String app, List rules) throws Exception { - if (StringUtil.isBlank(app)) { - return; - } - if (rules == null) { - return; - } - Set set = appManagement.getDetailApp(app).getMachines(); - - for (MachineInfo machine : set) { - if (!machine.isHealthy()) { - continue; - } - // TODO: parse the results - sentinelApiClient.setFlowRuleOfMachine(app, machine.getIp(), machine.getPort(), rules); - } - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/service/ClusterAssignService.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/service/ClusterAssignService.java deleted file mode 100644 index 26be98d7..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/service/ClusterAssignService.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.service; - -import com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterAppAssignResultVO; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterAppAssignMap; - -import java.util.List; -import java.util.Set; - -/** - * @author Eric Zhao - * @since 1.4.1 - */ -public interface ClusterAssignService { - - /** - * Unbind a specific cluster server and its clients. - * @param app app name - * @param machineId valid machine ID ({@code host@commandPort}) - * @return assign result - */ - ClusterAppAssignResultVO unbindClusterServer(String app, String machineId); - - /** - * Unbind a set of cluster servers and its clients. - * @param app app name - * @param machineIdSet set of valid machine ID ({@code host@commandPort}) - * @return assign result - */ - ClusterAppAssignResultVO unbindClusterServers(String app, Set machineIdSet); - - /** - * Apply cluster server and client assignment for provided app. - * @param app app name - * @param clusterMap cluster assign map (server -> clients) - * @param remainingSet unassigned set of machine ID - * @return assign result - */ - ClusterAppAssignResultVO applyAssignToApp(String app, List clusterMap, - Set remainingSet); - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/service/ClusterAssignServiceImpl.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/service/ClusterAssignServiceImpl.java deleted file mode 100644 index 53a046af..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/service/ClusterAssignServiceImpl.java +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.service; - -import com.alibaba.csp.sentinel.cluster.ClusterStateManager; -import com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterAppAssignResultVO; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterGroupEntity; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ClusterClientConfig; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerTransportConfig; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterAppAssignMap; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStatePairVO; -import com.alibaba.csp.sentinel.dashboard.util.MachineUtils; -import com.alibaba.csp.sentinel.util.AssertUtil; -import com.alibaba.csp.sentinel.util.function.Tuple2; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.*; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - -/** - * @author Eric Zhao - * @since 1.4.1 - */ -@Service -public class ClusterAssignServiceImpl implements ClusterAssignService { - - private final Logger LOGGER = LoggerFactory.getLogger(ClusterAssignServiceImpl.class); - - @Autowired - private SentinelApiClient sentinelApiClient; - - @Autowired - private ClusterConfigService clusterConfigService; - - private boolean isMachineInApp(/* @NonEmpty */ String machineId) { - return machineId.contains(":"); - } - - private ClusterAppAssignResultVO handleUnbindClusterServerNotInApp(String app, String machineId) { - Set failedSet = new HashSet<>(); - try { - List list = clusterConfigService.getClusterUniversalState(app) - .get(10, TimeUnit.SECONDS); - Set toModifySet = list.stream() - .filter(e -> e.getState().getStateInfo().getMode() == ClusterStateManager.CLUSTER_CLIENT) - .filter(e -> machineId.equals(e.getState().getClient().getClientConfig().getServerHost() + ':' - + e.getState().getClient().getClientConfig().getServerPort())) - .map(e -> e.getIp() + '@' + e.getCommandPort()) - .collect(Collectors.toSet()); - // Modify mode to NOT-STARTED for all associated token clients. - modifyToNonStarted(toModifySet, failedSet); - } - catch (Exception ex) { - Throwable e = ex instanceof ExecutionException ? ex.getCause() : ex; - LOGGER.error("Failed to unbind machine <{}>", machineId, e); - failedSet.add(machineId); - } - return new ClusterAppAssignResultVO().setFailedClientSet(failedSet).setFailedServerSet(new HashSet<>()); - } - - private void modifyToNonStarted(Set toModifySet, Set failedSet) { - toModifySet.parallelStream() - .map(MachineUtils::parseCommandIpAndPort) - .filter(Optional::isPresent) - .map(Optional::get) - .map(e -> { - CompletableFuture f = modifyMode(e.r1, e.r2, ClusterStateManager.CLUSTER_NOT_STARTED); - return Tuple2.of(e.r1 + '@' + e.r2, f); - }) - .forEach(f -> handleFutureSync(f, failedSet)); - } - - @Override - public ClusterAppAssignResultVO unbindClusterServer(String app, String machineId) { - AssertUtil.assertNotBlank(app, "app cannot be blank"); - AssertUtil.assertNotBlank(machineId, "machineId cannot be blank"); - - if (isMachineInApp(machineId)) { - return handleUnbindClusterServerNotInApp(app, machineId); - } - Set failedSet = new HashSet<>(); - try { - ClusterGroupEntity entity = clusterConfigService.getClusterUniversalStateForAppMachine(app, machineId) - .get(10, TimeUnit.SECONDS); - Set toModifySet = new HashSet<>(); - toModifySet.add(machineId); - if (entity.getClientSet() != null) { - toModifySet.addAll(entity.getClientSet()); - } - // Modify mode to NOT-STARTED for all chosen token servers and associated - // token clients. - modifyToNonStarted(toModifySet, failedSet); - } - catch (Exception ex) { - Throwable e = ex instanceof ExecutionException ? ex.getCause() : ex; - LOGGER.error("Failed to unbind machine <{}>", machineId, e); - failedSet.add(machineId); - } - return new ClusterAppAssignResultVO().setFailedClientSet(failedSet).setFailedServerSet(new HashSet<>()); - } - - @Override - public ClusterAppAssignResultVO unbindClusterServers(String app, Set machineIdSet) { - AssertUtil.assertNotBlank(app, "app cannot be blank"); - AssertUtil.isTrue(machineIdSet != null && !machineIdSet.isEmpty(), "machineIdSet cannot be empty"); - ClusterAppAssignResultVO result = new ClusterAppAssignResultVO().setFailedClientSet(new HashSet<>()) - .setFailedServerSet(new HashSet<>()); - for (String machineId : machineIdSet) { - ClusterAppAssignResultVO resultVO = unbindClusterServer(app, machineId); - result.getFailedClientSet().addAll(resultVO.getFailedClientSet()); - result.getFailedServerSet().addAll(resultVO.getFailedServerSet()); - } - return result; - } - - @Override - public ClusterAppAssignResultVO applyAssignToApp(String app, List clusterMap, - Set remainingSet) { - AssertUtil.assertNotBlank(app, "app cannot be blank"); - AssertUtil.notNull(clusterMap, "clusterMap cannot be null"); - Set failedServerSet = new HashSet<>(); - Set failedClientSet = new HashSet<>(); - - // Assign server and apply config. - clusterMap.stream().filter(Objects::nonNull).filter(ClusterAppAssignMap::getBelongToApp).map(e -> { - String ip = e.getIp(); - int commandPort = parsePort(e); - CompletableFuture f = modifyMode(ip, commandPort, ClusterStateManager.CLUSTER_SERVER) - .thenCompose(v -> applyServerConfigChange(app, ip, commandPort, e)); - return Tuple2.of(e.getMachineId(), f); - }).forEach(t -> handleFutureSync(t, failedServerSet)); - - // Assign client of servers and apply config. - clusterMap.parallelStream() - .filter(Objects::nonNull) - .forEach(e -> applyAllClientConfigChange(app, e, failedClientSet)); - - // Unbind remaining (unassigned) machines. - applyAllRemainingMachineSet(app, remainingSet, failedClientSet); - - return new ClusterAppAssignResultVO().setFailedClientSet(failedClientSet).setFailedServerSet(failedServerSet); - } - - private void applyAllRemainingMachineSet(String app, Set remainingSet, Set failedSet) { - if (remainingSet == null || remainingSet.isEmpty()) { - return; - } - remainingSet.parallelStream() - .filter(Objects::nonNull) - .map(MachineUtils::parseCommandIpAndPort) - .filter(Optional::isPresent) - .map(Optional::get) - .map(ipPort -> { - String ip = ipPort.r1; - int commandPort = ipPort.r2; - CompletableFuture f = modifyMode(ip, commandPort, ClusterStateManager.CLUSTER_NOT_STARTED); - return Tuple2.of(ip + '@' + commandPort, f); - }) - .forEach(t -> handleFutureSync(t, failedSet)); - } - - private void applyAllClientConfigChange(String app, ClusterAppAssignMap assignMap, Set failedSet) { - Set clientSet = assignMap.getClientSet(); - if (clientSet == null || clientSet.isEmpty()) { - return; - } - final String serverIp = assignMap.getIp(); - final int serverPort = assignMap.getPort(); - clientSet.stream() - .map(MachineUtils::parseCommandIpAndPort) - .filter(Optional::isPresent) - .map(Optional::get) - .map(ipPort -> { - CompletableFuture f = sentinelApiClient - .modifyClusterMode(ipPort.r1, ipPort.r2, ClusterStateManager.CLUSTER_CLIENT) - .thenCompose(v -> sentinelApiClient.modifyClusterClientConfig(app, ipPort.r1, ipPort.r2, - new ClusterClientConfig().setRequestTimeout(20) - .setServerHost(serverIp) - .setServerPort(serverPort))); - return Tuple2.of(ipPort.r1 + '@' + ipPort.r2, f); - }) - .forEach(t -> handleFutureSync(t, failedSet)); - } - - private void handleFutureSync(Tuple2> t, Set failedSet) { - try { - t.r2.get(10, TimeUnit.SECONDS); - } - catch (Exception ex) { - if (ex instanceof ExecutionException) { - LOGGER.error("Request for <{}> failed", t.r1, ex.getCause()); - } - else { - LOGGER.error("Request for <{}> failed", t.r1, ex); - } - failedSet.add(t.r1); - } - } - - private CompletableFuture applyServerConfigChange(String app, String ip, int commandPort, - ClusterAppAssignMap assignMap) { - ServerTransportConfig transportConfig = new ServerTransportConfig().setPort(assignMap.getPort()) - .setIdleSeconds(600); - return sentinelApiClient.modifyClusterServerTransportConfig(app, ip, commandPort, transportConfig) - .thenCompose(v -> applyServerFlowConfigChange(app, ip, commandPort, assignMap)) - .thenCompose(v -> applyServerNamespaceSetConfig(app, ip, commandPort, assignMap)); - } - - private CompletableFuture applyServerFlowConfigChange(String app, String ip, int commandPort, - ClusterAppAssignMap assignMap) { - Double maxAllowedQps = assignMap.getMaxAllowedQps(); - if (maxAllowedQps == null || maxAllowedQps <= 0 || maxAllowedQps > 20_0000) { - return CompletableFuture.completedFuture(null); - } - return sentinelApiClient.modifyClusterServerFlowConfig(app, ip, commandPort, - new ServerFlowConfig().setMaxAllowedQps(maxAllowedQps)); - } - - private CompletableFuture applyServerNamespaceSetConfig(String app, String ip, int commandPort, - ClusterAppAssignMap assignMap) { - Set namespaceSet = assignMap.getNamespaceSet(); - if (namespaceSet == null || namespaceSet.isEmpty()) { - return CompletableFuture.completedFuture(null); - } - return sentinelApiClient.modifyClusterServerNamespaceSet(app, ip, commandPort, namespaceSet); - } - - private CompletableFuture modifyMode(String ip, int port, int mode) { - return sentinelApiClient.modifyClusterMode(ip, port, mode); - } - - private int parsePort(ClusterAppAssignMap assignMap) { - return MachineUtils.parseCommandPort(assignMap.getMachineId()).orElse(ServerTransportConfig.DEFAULT_PORT); - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/service/ClusterConfigService.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/service/ClusterConfigService.java deleted file mode 100644 index d8850631..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/service/ClusterConfigService.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.service; - -import com.alibaba.csp.sentinel.cluster.ClusterStateManager; -import com.alibaba.csp.sentinel.dashboard.client.SentinelApiClient; -import com.alibaba.csp.sentinel.dashboard.discovery.AppInfo; -import com.alibaba.csp.sentinel.dashboard.discovery.AppManagement; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterGroupEntity; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ClusterClientConfig; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerFlowConfig; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.config.ServerTransportConfig; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterClientModifyRequest; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.request.ClusterServerModifyRequest; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterClientStateVO; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStatePairVO; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.ClusterUniversalStateVO; -import com.alibaba.csp.sentinel.dashboard.util.AsyncUtils; -import com.alibaba.csp.sentinel.dashboard.util.ClusterEntityUtils; -import com.alibaba.csp.sentinel.util.StringUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.concurrent.CompletableFuture; -import java.util.stream.Collectors; - -/** - * @author Eric Zhao - * @since 1.4.0 - */ -@Service -public class ClusterConfigService { - - @Autowired - private SentinelApiClient sentinelApiClient; - - @Autowired - private AppManagement appManagement; - - public CompletableFuture modifyClusterClientConfig(ClusterClientModifyRequest request) { - if (notClientRequestValid(request)) { - throw new IllegalArgumentException("Invalid request"); - } - String app = request.getApp(); - String ip = request.getIp(); - int port = request.getPort(); - return sentinelApiClient.modifyClusterClientConfig(app, ip, port, request.getClientConfig()) - .thenCompose(v -> sentinelApiClient.modifyClusterMode(ip, port, ClusterStateManager.CLUSTER_CLIENT)); - } - - private boolean notClientRequestValid(/* @NonNull */ ClusterClientModifyRequest request) { - ClusterClientConfig config = request.getClientConfig(); - return config == null || StringUtil.isEmpty(config.getServerHost()) || config.getServerPort() == null - || config.getServerPort() <= 0 || config.getRequestTimeout() == null || config.getRequestTimeout() <= 0; - } - - public CompletableFuture modifyClusterServerConfig(ClusterServerModifyRequest request) { - ServerTransportConfig transportConfig = request.getTransportConfig(); - ServerFlowConfig flowConfig = request.getFlowConfig(); - Set namespaceSet = request.getNamespaceSet(); - if (invalidTransportConfig(transportConfig)) { - throw new IllegalArgumentException("Invalid transport config in request"); - } - if (invalidFlowConfig(flowConfig)) { - throw new IllegalArgumentException("Invalid flow config in request"); - } - if (namespaceSet == null) { - throw new IllegalArgumentException("namespace set cannot be null"); - } - String app = request.getApp(); - String ip = request.getIp(); - int port = request.getPort(); - return sentinelApiClient.modifyClusterServerNamespaceSet(app, ip, port, namespaceSet) - .thenCompose(v -> sentinelApiClient.modifyClusterServerTransportConfig(app, ip, port, transportConfig)) - .thenCompose(v -> sentinelApiClient.modifyClusterServerFlowConfig(app, ip, port, flowConfig)) - .thenCompose(v -> sentinelApiClient.modifyClusterMode(ip, port, ClusterStateManager.CLUSTER_SERVER)); - } - - /** - * Get cluster state list of all available machines of provided application. - * @param app application name - * @return cluster state list of all available machines of the application - * @since 1.4.1 - */ - public CompletableFuture> getClusterUniversalState(String app) { - if (StringUtil.isBlank(app)) { - return AsyncUtils.newFailedFuture(new IllegalArgumentException("app cannot be empty")); - } - AppInfo appInfo = appManagement.getDetailApp(app); - if (appInfo == null || appInfo.getMachines() == null) { - return CompletableFuture.completedFuture(new ArrayList<>()); - } - - List> futures = appInfo.getMachines() - .stream() - .filter(e -> e.isHealthy()) - .map(machine -> getClusterUniversalState(app, machine.getIp(), machine.getPort()) - .thenApply(e -> new ClusterUniversalStatePairVO(machine.getIp(), machine.getPort(), e))) - .collect(Collectors.toList()); - - return AsyncUtils.sequenceSuccessFuture(futures); - } - - public CompletableFuture getClusterUniversalStateForAppMachine(String app, String machineId) { - if (StringUtil.isBlank(app)) { - return AsyncUtils.newFailedFuture(new IllegalArgumentException("app cannot be empty")); - } - AppInfo appInfo = appManagement.getDetailApp(app); - if (appInfo == null || appInfo.getMachines() == null) { - return AsyncUtils.newFailedFuture(new IllegalArgumentException("app does not have machines")); - } - - boolean machineOk = appInfo.getMachines() - .stream() - .filter(e -> e.isHealthy()) - .map(e -> e.getIp() + '@' + e.getPort()) - .anyMatch(e -> e.equals(machineId)); - if (!machineOk) { - return AsyncUtils.newFailedFuture(new IllegalStateException("machine does not exist or disconnected")); - } - - return getClusterUniversalState(app).thenApply(ClusterEntityUtils::wrapToClusterGroup) - .thenCompose(e -> e.stream() - .filter(e1 -> e1.getMachineId().equals(machineId)) - .findAny() - .map(CompletableFuture::completedFuture) - .orElse(AsyncUtils.newFailedFuture(new IllegalStateException("not a server: " + machineId)))); - } - - public CompletableFuture getClusterUniversalState(String app, String ip, int port) { - return sentinelApiClient.fetchClusterMode(ip, port) - .thenApply(e -> new ClusterUniversalStateVO().setStateInfo(e)) - .thenCompose(vo -> { - if (vo.getStateInfo().getClientAvailable()) { - return sentinelApiClient.fetchClusterClientInfoAndConfig(ip, port) - .thenApply(cc -> vo.setClient(new ClusterClientStateVO().setClientConfig(cc))); - } - else { - return CompletableFuture.completedFuture(vo); - } - }) - .thenCompose(vo -> { - if (vo.getStateInfo().getServerAvailable()) { - return sentinelApiClient.fetchClusterServerBasicInfo(ip, port).thenApply(vo::setServer); - } - else { - return CompletableFuture.completedFuture(vo); - } - }); - } - - private boolean invalidTransportConfig(ServerTransportConfig transportConfig) { - return transportConfig == null || transportConfig.getPort() == null || transportConfig.getPort() <= 0 - || transportConfig.getIdleSeconds() == null || transportConfig.getIdleSeconds() <= 0; - } - - private boolean invalidFlowConfig(ServerFlowConfig flowConfig) { - return flowConfig == null || flowConfig.getSampleCount() == null || flowConfig.getSampleCount() <= 0 - || flowConfig.getIntervalMs() == null || flowConfig.getIntervalMs() <= 0 - || flowConfig.getIntervalMs() % flowConfig.getSampleCount() != 0 - || flowConfig.getMaxAllowedQps() == null || flowConfig.getMaxAllowedQps() < 0; - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/util/AsyncUtils.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/util/AsyncUtils.java deleted file mode 100644 index 2cf15bbc..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/util/AsyncUtils.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.util; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.List; -import java.util.Objects; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - -/** - * @author Eric Zhao - * @since 1.4.1 - */ -public final class AsyncUtils { - - private static final Logger LOG = LoggerFactory.getLogger(AsyncUtils.class); - - public static CompletableFuture newFailedFuture(Throwable ex) { - CompletableFuture future = new CompletableFuture<>(); - future.completeExceptionally(ex); - return future; - } - - public static CompletableFuture> sequenceFuture(List> futures) { - return CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])) - .thenApply(v -> futures.stream() - .map(AsyncUtils::getValue) - .filter(Objects::nonNull) - .collect(Collectors.toList())); - } - - public static CompletableFuture> sequenceSuccessFuture(List> futures) { - return CompletableFuture.supplyAsync(() -> futures.parallelStream() - .map(AsyncUtils::getValue) - .filter(Objects::nonNull) - .collect(Collectors.toList())); - } - - public static T getValue(CompletableFuture future) { - try { - return future.get(10, TimeUnit.SECONDS); - } - catch (Exception ex) { - LOG.error("getValue for async result failed", ex); - } - return null; - } - - public static boolean isSuccessFuture(CompletableFuture future) { - return future.isDone() && !future.isCompletedExceptionally() && !future.isCancelled(); - } - - private AsyncUtils() { - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/util/ClusterEntityUtils.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/util/ClusterEntityUtils.java deleted file mode 100644 index de2ed0c5..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/util/ClusterEntityUtils.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.util; - -import com.alibaba.csp.sentinel.cluster.ClusterStateManager; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.ClusterGroupEntity; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.ConnectionGroupVO; -import com.alibaba.csp.sentinel.dashboard.domain.cluster.state.*; -import com.alibaba.csp.sentinel.util.StringUtil; - -import java.util.*; - -/** - * @author Eric Zhao - * @since 1.4.1 - */ -public final class ClusterEntityUtils { - - public static List wrapToAppClusterServerState( - List list) { - if (list == null || list.isEmpty()) { - return new ArrayList<>(); - } - Map map = new HashMap<>(); - Set tokenServerSet = new HashSet<>(); - // Handle token servers that belong to current app. - for (ClusterUniversalStatePairVO stateVO : list) { - int mode = stateVO.getState().getStateInfo().getMode(); - - if (mode == ClusterStateManager.CLUSTER_SERVER) { - String ip = stateVO.getIp(); - String serverId = ip + '@' + stateVO.getCommandPort(); - ClusterServerStateVO serverStateVO = stateVO.getState().getServer(); - map.computeIfAbsent(serverId, - v -> new AppClusterServerStateWrapVO().setId(serverId) - .setIp(ip) - .setPort(serverStateVO.getPort()) - .setState(serverStateVO) - .setBelongToApp(true) - .setConnectedCount(serverStateVO.getConnection() - .stream() - .mapToInt(ConnectionGroupVO::getConnectedCount) - .sum())); - tokenServerSet.add(ip + ":" + serverStateVO.getPort()); - } - } - // Handle token servers from other app. - for (ClusterUniversalStatePairVO stateVO : list) { - int mode = stateVO.getState().getStateInfo().getMode(); - - if (mode == ClusterStateManager.CLUSTER_CLIENT) { - ClusterClientStateVO clientState = stateVO.getState().getClient(); - if (clientState == null) { - continue; - } - String serverIp = clientState.getClientConfig().getServerHost(); - int serverPort = clientState.getClientConfig().getServerPort(); - if (tokenServerSet.contains(serverIp + ":" + serverPort)) { - continue; - } - // We are not able to get the commandPort of foreign token server - // directly. - String serverId = String.format("%s:%d", serverIp, serverPort); - map.computeIfAbsent(serverId, - v -> new AppClusterServerStateWrapVO().setId(serverId) - .setIp(serverIp) - .setPort(serverPort) - .setBelongToApp(false)); - } - } - return new ArrayList<>(map.values()); - } - - public static List wrapToAppClusterClientState( - List list) { - if (list == null || list.isEmpty()) { - return new ArrayList<>(); - } - Map map = new HashMap<>(); - for (ClusterUniversalStatePairVO stateVO : list) { - int mode = stateVO.getState().getStateInfo().getMode(); - - if (mode == ClusterStateManager.CLUSTER_CLIENT) { - String ip = stateVO.getIp(); - String clientId = ip + '@' + stateVO.getCommandPort(); - ClusterClientStateVO clientStateVO = stateVO.getState().getClient(); - map.computeIfAbsent(clientId, - v -> new AppClusterClientStateWrapVO().setId(clientId) - .setIp(ip) - .setState(clientStateVO) - .setCommandPort(stateVO.getCommandPort())); - } - } - return new ArrayList<>(map.values()); - } - - public static List wrapToClusterGroup(List list) { - if (list == null || list.isEmpty()) { - return new ArrayList<>(); - } - Map map = new HashMap<>(); - for (ClusterUniversalStatePairVO stateVO : list) { - int mode = stateVO.getState().getStateInfo().getMode(); - String ip = stateVO.getIp(); - if (mode == ClusterStateManager.CLUSTER_SERVER) { - String serverAddress = getIp(ip); - int port = stateVO.getState().getServer().getPort(); - String targetAddress = serverAddress + ":" + port; - map.computeIfAbsent(targetAddress, - v -> new ClusterGroupEntity().setBelongToApp(true) - .setMachineId(ip + '@' + stateVO.getCommandPort()) - .setIp(ip) - .setPort(port)); - } - } - for (ClusterUniversalStatePairVO stateVO : list) { - int mode = stateVO.getState().getStateInfo().getMode(); - String ip = stateVO.getIp(); - if (mode == ClusterStateManager.CLUSTER_CLIENT) { - String targetServer = stateVO.getState().getClient().getClientConfig().getServerHost(); - Integer targetPort = stateVO.getState().getClient().getClientConfig().getServerPort(); - if (StringUtil.isBlank(targetServer) || targetPort == null || targetPort <= 0) { - continue; - } - String targetAddress = targetServer + ":" + targetPort; - ClusterGroupEntity group = map.computeIfAbsent(targetAddress, - v -> new ClusterGroupEntity().setBelongToApp(true) - .setMachineId(targetServer) - .setIp(targetServer) - .setPort(targetPort)); - group.getClientSet().add(ip + '@' + stateVO.getCommandPort()); - } - } - return new ArrayList<>(map.values()); - } - - private static String getIp(String str) { - if (str.contains(":")) { - return str.split(":")[0]; - } - return str; - } - - private ClusterEntityUtils() { - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/util/MachineUtils.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/util/MachineUtils.java deleted file mode 100644 index c124aee0..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/util/MachineUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.util; - -import com.alibaba.csp.sentinel.util.StringUtil; -import com.alibaba.csp.sentinel.util.function.Tuple2; - -import java.util.Optional; - -/** - * @author Eric Zhao - */ -public final class MachineUtils { - - public static Optional parseCommandPort(String machineIp) { - try { - if (!machineIp.contains("@")) { - return Optional.empty(); - } - String[] str = machineIp.split("@"); - if (str.length <= 1) { - return Optional.empty(); - } - return Optional.of(Integer.parseInt(str[1])); - } - catch (Exception ex) { - return Optional.empty(); - } - } - - public static Optional> parseCommandIpAndPort(String machineIp) { - try { - if (StringUtil.isEmpty(machineIp) || !machineIp.contains("@")) { - return Optional.empty(); - } - String[] str = machineIp.split("@"); - if (str.length <= 1) { - return Optional.empty(); - } - return Optional.of(Tuple2.of(str[0], Integer.parseInt(str[1]))); - } - catch (Exception ex) { - return Optional.empty(); - } - } - - private MachineUtils() { - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/util/VersionUtils.java b/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/util/VersionUtils.java deleted file mode 100644 index c7daea6a..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/util/VersionUtils.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.csp.sentinel.dashboard.util; - -import com.alibaba.csp.sentinel.dashboard.datasource.entity.SentinelVersion; -import com.alibaba.csp.sentinel.util.StringUtil; - -import java.util.Optional; - -/** - * Util class for parsing version. - * - * @author Eric Zhao - * @since 0.2.1 - */ -public final class VersionUtils { - - /** - * Parse version of Sentinel from raw string. - * @param verStr version string - * @return parsed {@link SentinelVersion} if the version is valid; empty if there is - * something wrong with the format - */ - public static Optional parseVersion(String verStr) { - if (StringUtil.isBlank(verStr)) { - return Optional.empty(); - } - try { - String versionFull = verStr; - SentinelVersion version = new SentinelVersion(); - - // postfix - int index = versionFull.indexOf("-"); - if (index == 0) { - // Start with "-" - return Optional.empty(); - } - if (index == versionFull.length() - 1) { - // End with "-" - } - else if (index > 0) { - version.setPostfix(versionFull.substring(index + 1)); - } - - if (index >= 0) { - versionFull = versionFull.substring(0, index); - } - - // x.x.x - int segment = 0; - int[] ver = new int[3]; - while (segment < ver.length) { - index = versionFull.indexOf('.'); - if (index < 0) { - if (versionFull.length() > 0) { - ver[segment] = Integer.valueOf(versionFull); - } - break; - } - ver[segment] = Integer.valueOf(versionFull.substring(0, index)); - versionFull = versionFull.substring(index + 1); - segment++; - } - - if (ver[0] < 1) { - // Wrong format, return empty. - return Optional.empty(); - } - else { - return Optional.of(version.setMajorVersion(ver[0]).setMinorVersion(ver[1]).setFixVersion(ver[2])); - } - } - catch (Exception ex) { - // Parse fail, return empty. - return Optional.empty(); - } - } - - private VersionUtils() { - } - -} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/resources/application.yml b/pig-visual/pig-sentinel-dashboard/src/main/resources/application.yml deleted file mode 100755 index d88c2d1b..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/resources/application.yml +++ /dev/null @@ -1,44 +0,0 @@ -server: - port: 5003 - servlet: - encoding: - force: true - -spring: - application: - name: @artifactId@ - cloud: - nacos: - username: @nacos.username@ - password: @nacos.password@ - discovery: - server-addr: ${NACOS_HOST:pig-register}:${NACOS_PORT:8848} - -management: - endpoints: - web: - exposure: - include: '*' - endpoint: - health: - show-details: ALWAYS -logging: - level: - org: - springframework: - web: info - file: - name: ${user.home}/logs/csp/sentinel-dashboard.log - pattern: - file: '%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n' - -auth: - username: sentinel - password: sentinel - filter: - exclude-urls: /,/auth/login,/auth/logout,/registry/machine,/version,/actuator/**,/details - exclude-url-suffixes: htm,html,js,css,map,ico,ttf,woff,png - -sentinel: - dashboard: - version: @project.version@ diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/.gitignore b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/.gitignore deleted file mode 100644 index 104d9996..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -tmp/ \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/.jshintrc b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/.jshintrc deleted file mode 100644 index 6c66001a..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/.jshintrc +++ /dev/null @@ -1,67 +0,0 @@ -{ - /* - * ENVIRONMENTS - * ================= - */ - - // Define globals exposed by modern browsers. - "browser": true, - - // Define globals exposed by jQuery. - "jquery": true, - - // Define globals exposed by Node.js. - "node": true, - - // Allow ES6. - "esversion": 6, - - /* - * ENFORCING OPTIONS - * ================= - */ - - // Force all variable names to use either camelCase style or UPPER_CASE - // with underscores. - "camelcase": true, - - // Prohibit use of == and != in favor of === and !==. - "eqeqeq": true, - - // Enforce tab width of 2 spaces. - "indent": 2, - - // Prohibit use of a variable before it is defined. - "latedef": true, - - // Enforce line length to 100 characters - "maxlen": 100, - - // Require capitalized names for constructor functions. - "newcap": true, - - // Enforce use of single quotation marks for strings. - "quotmark": "single", - - // Enforce placing 'use strict' at the top function scope - // 前端项目中外层使用 strict 即可,覆盖此条规则 - "strict": false, - - // Prohibit use of explicitly undeclared variables. - "undef": true, - - // Warn when variables are defined but never used. - "unused": true, - - /* - * RELAXING OPTIONS - * ================= - */ - - // Suppress warnings about == null comparisons. - "eqnull": true, - "globals": { - "$": false, - "angular": false - } -} \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/README.md b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/README.md deleted file mode 100644 index c88ea68c..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# Sentinel Dashboard Frontend - -## Env Requirement - -- Node.js > 6.x - -## Code Guide - -- [Code Style Guide for HTML/CSS](https://codeguide.bootcss.com/) -- [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript/tree/es5-deprecated/es5) - -## Install Packages - -``` -npm install -``` - -## Start Development - -``` -npm start -``` - -## Build for production - -``` -npm run build -``` - -## Credit - -- [sb-admin-angular](https://github.com/start-angular/sb-admin-angular) \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/README_zh.md b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/README_zh.md deleted file mode 100644 index 5daf33ef..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/README_zh.md +++ /dev/null @@ -1,32 +0,0 @@ -# Sentinel Dashboard Frontend - -## 环境要求 - -- Node.js > 6.x - -## 编码规范 - -- HTML/CSS 遵循 [Bootstrap 编码规范](https://codeguide.bootcss.com/) -- JavaScript 遵循 [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript/tree/es5-deprecated/es5) 以及最新的 ES 6 标准 - -## 安装依赖 - -``` -npm i -``` - -## 开始本地开发 - -``` -npm start -``` - -## 构建前端资源 - -``` -npm run build -``` - -## Credit - -- [sb-admin-angular](https://github.com/start-angular/sb-admin-angular) \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/app.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/app.js deleted file mode 100644 index bc3747af..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/app.js +++ /dev/null @@ -1,365 +0,0 @@ -'use strict'; - -/** - * @ngdoc overview - * @name sentinelDashboardApp - * @description - * # sentinelDashboardApp - * - * Main module of the application. - */ - -angular - .module('sentinelDashboardApp', [ - 'oc.lazyLoad', - 'ui.router', - 'ui.bootstrap', - 'angular-loading-bar', - 'ngDialog', - 'ui.bootstrap.datetimepicker', - 'ui-notification', - 'rzTable', - 'angular-clipboard', - 'selectize', - 'angularUtils.directives.dirPagination' - ]) - .factory('AuthInterceptor', ['$window', '$state', function ($window, $state) { - var authInterceptor = { - 'responseError' : function(response) { - if (response.status === 401) { - // If not auth, clear session in localStorage and jump to the login page - $window.localStorage.removeItem('session_sentinel_admin'); - $state.go('login'); - } - - return response; - }, - 'response' : function(response) { - return response; - }, - 'request' : function(config) { - return config; - }, - 'requestError' : function(config){ - return config; - } - }; - return authInterceptor; - }]) - .config(['$stateProvider', '$urlRouterProvider', '$ocLazyLoadProvider', '$httpProvider', - function ($stateProvider, $urlRouterProvider, $ocLazyLoadProvider, $httpProvider) { - $httpProvider.interceptors.push('AuthInterceptor'); - - $ocLazyLoadProvider.config({ - debug: false, - events: true, - }); - - $urlRouterProvider.otherwise('/dashboard/home'); - - $stateProvider - .state('login', { - url: '/login', - templateUrl: 'app/views/login.html', - controller: 'LoginCtl', - resolve: { - loadMyFiles: ['$ocLazyLoad', function ($ocLazyLoad) { - return $ocLazyLoad.load({ - name: 'sentinelDashboardApp', - files: [ - 'app/scripts/controllers/login.js', - ] - }); - }] - } - }) - - .state('dashboard', { - url: '/dashboard', - templateUrl: 'app/views/dashboard/main.html', - resolve: { - loadMyDirectives: ['$ocLazyLoad', function ($ocLazyLoad) { - return $ocLazyLoad.load( - { - name: 'sentinelDashboardApp', - files: [ - 'app/scripts/directives/header/header.js', - 'app/scripts/directives/sidebar/sidebar.js', - 'app/scripts/directives/sidebar/sidebar-search/sidebar-search.js', - ] - }); - }] - } - }) - - .state('dashboard.home', { - url: '/home', - templateUrl: 'app/views/dashboard/home.html', - resolve: { - loadMyFiles: ['$ocLazyLoad', function ($ocLazyLoad) { - return $ocLazyLoad.load({ - name: 'sentinelDashboardApp', - files: [ - 'app/scripts/controllers/main.js', - ] - }); - }] - } - }) - - .state('dashboard.flowV1', { - templateUrl: 'app/views/flow_v1.html', - url: '/flow/:app', - controller: 'FlowControllerV1', - resolve: { - loadMyFiles: ['$ocLazyLoad', function ($ocLazyLoad) { - return $ocLazyLoad.load({ - name: 'sentinelDashboardApp', - files: [ - 'app/scripts/controllers/flow_v1.js', - ] - }); - }] - } - }) - - .state('dashboard.flow', { - templateUrl: 'app/views/flow_v2.html', - url: '/v2/flow/:app', - controller: 'FlowControllerV2', - resolve: { - loadMyFiles: ['$ocLazyLoad', function ($ocLazyLoad) { - return $ocLazyLoad.load({ - name: 'sentinelDashboardApp', - files: [ - 'app/scripts/controllers/flow_v2.js', - ] - }); - }] - } - }) - - .state('dashboard.paramFlow', { - templateUrl: 'app/views/param_flow.html', - url: '/paramFlow/:app', - controller: 'ParamFlowController', - resolve: { - loadMyFiles: ['$ocLazyLoad', function ($ocLazyLoad) { - return $ocLazyLoad.load({ - name: 'sentinelDashboardApp', - files: [ - 'app/scripts/controllers/param_flow.js', - ] - }); - }] - } - }) - - .state('dashboard.clusterAppAssignManage', { - templateUrl: 'app/views/cluster_app_assign_manage.html', - url: '/cluster/assign_manage/:app', - controller: 'SentinelClusterAppAssignManageController', - resolve: { - loadMyFiles: ['$ocLazyLoad', function ($ocLazyLoad) { - return $ocLazyLoad.load({ - name: 'sentinelDashboardApp', - files: [ - 'app/scripts/controllers/cluster_app_assign_manage.js', - ] - }); - }] - } - }) - - .state('dashboard.clusterAppServerList', { - templateUrl: 'app/views/cluster_app_server_list.html', - url: '/cluster/server/:app', - controller: 'SentinelClusterAppServerListController', - resolve: { - loadMyFiles: ['$ocLazyLoad', function ($ocLazyLoad) { - return $ocLazyLoad.load({ - name: 'sentinelDashboardApp', - files: [ - 'app/scripts/controllers/cluster_app_server_list.js', - ] - }); - }] - } - }) - - .state('dashboard.clusterAppClientList', { - templateUrl: 'app/views/cluster_app_client_list.html', - url: '/cluster/client/:app', - controller: 'SentinelClusterAppTokenClientListController', - resolve: { - loadMyFiles: ['$ocLazyLoad', function ($ocLazyLoad) { - return $ocLazyLoad.load({ - name: 'sentinelDashboardApp', - files: [ - 'app/scripts/controllers/cluster_app_token_client_list.js', - ] - }); - }] - } - }) - - .state('dashboard.clusterSingle', { - templateUrl: 'app/views/cluster_single_config.html', - url: '/cluster/single/:app', - controller: 'SentinelClusterSingleController', - resolve: { - loadMyFiles: ['$ocLazyLoad', function ($ocLazyLoad) { - return $ocLazyLoad.load({ - name: 'sentinelDashboardApp', - files: [ - 'app/scripts/controllers/cluster_single.js', - ] - }); - }] - } - }) - - .state('dashboard.authority', { - templateUrl: 'app/views/authority.html', - url: '/authority/:app', - controller: 'AuthorityRuleController', - resolve: { - loadMyFiles: ['$ocLazyLoad', function ($ocLazyLoad) { - return $ocLazyLoad.load({ - name: 'sentinelDashboardApp', - files: [ - 'app/scripts/controllers/authority.js', - ] - }); - }] - } - }) - - .state('dashboard.degrade', { - templateUrl: 'app/views/degrade.html', - url: '/degrade/:app', - controller: 'DegradeCtl', - resolve: { - loadMyFiles: ['$ocLazyLoad', function ($ocLazyLoad) { - return $ocLazyLoad.load({ - name: 'sentinelDashboardApp', - files: [ - 'app/scripts/controllers/degrade.js', - ] - }); - }] - } - }) - - .state('dashboard.system', { - templateUrl: 'app/views/system.html', - url: '/system/:app', - controller: 'SystemCtl', - resolve: { - loadMyFiles: ['$ocLazyLoad', function ($ocLazyLoad) { - return $ocLazyLoad.load({ - name: 'sentinelDashboardApp', - files: [ - 'app/scripts/controllers/system.js', - ] - }); - }] - } - }) - - .state('dashboard.machine', { - templateUrl: 'app/views/machine.html', - url: '/app/:app', - controller: 'MachineCtl', - resolve: { - loadMyFiles: ['$ocLazyLoad', function ($ocLazyLoad) { - return $ocLazyLoad.load({ - name: 'sentinelDashboardApp', - files: [ - 'app/scripts/controllers/machine.js', - ] - }); - }] - } - }) - - .state('dashboard.identity', { - templateUrl: 'app/views/identity.html', - url: '/identity/:app', - controller: 'IdentityCtl', - resolve: { - loadMyFiles: ['$ocLazyLoad', function ($ocLazyLoad) { - return $ocLazyLoad.load({ - name: 'sentinelDashboardApp', - files: [ - 'app/scripts/controllers/identity.js', - ] - }); - }] - } - }) - - .state('dashboard.gatewayIdentity', { - templateUrl: 'app/views/gateway/identity.html', - url: '/gateway/identity/:app', - controller: 'GatewayIdentityCtl', - resolve: { - loadMyFiles: ['$ocLazyLoad', function ($ocLazyLoad) { - return $ocLazyLoad.load({ - name: 'sentinelDashboardApp', - files: [ - 'app/scripts/controllers/gateway/identity.js', - ] - }); - }] - } - }) - - .state('dashboard.metric', { - templateUrl: 'app/views/metric.html', - url: '/metric/:app', - controller: 'MetricCtl', - resolve: { - loadMyFiles: ['$ocLazyLoad', function ($ocLazyLoad) { - return $ocLazyLoad.load({ - name: 'sentinelDashboardApp', - files: [ - 'app/scripts/controllers/metric.js', - ] - }); - }] - } - }) - - .state('dashboard.gatewayApi', { - templateUrl: 'app/views/gateway/api.html', - url: '/gateway/api/:app', - controller: 'GatewayApiCtl', - resolve: { - loadMyFiles: ['$ocLazyLoad', function ($ocLazyLoad) { - return $ocLazyLoad.load({ - name: 'sentinelDashboardApp', - files: [ - 'app/scripts/controllers/gateway/api.js', - ] - }); - }] - } - }) - - .state('dashboard.gatewayFlow', { - templateUrl: 'app/views/gateway/flow.html', - url: '/gateway/flow/:app', - controller: 'GatewayFlowCtl', - resolve: { - loadMyFiles: ['$ocLazyLoad', function ($ocLazyLoad) { - return $ocLazyLoad.load({ - name: 'sentinelDashboardApp', - files: [ - 'app/scripts/controllers/gateway/flow.js', - ] - }); - }] - } - }); - }]); \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/authority.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/authority.js deleted file mode 100644 index 3d86302f..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/authority.js +++ /dev/null @@ -1,227 +0,0 @@ -/** - * Authority rule controller. - */ -angular.module('sentinelDashboardApp').controller('AuthorityRuleController', ['$scope', '$stateParams', 'AuthorityRuleService', 'ngDialog', - 'MachineService', - function ($scope, $stateParams, AuthorityRuleService, ngDialog, - MachineService) { - $scope.app = $stateParams.app; - - $scope.rulesPageConfig = { - pageSize: 10, - currentPageIndex: 1, - totalPage: 1, - totalCount: 0, - }; - $scope.macsInputConfig = { - searchField: ['text', 'value'], - persist: true, - create: false, - maxItems: 1, - render: { - item: function (data, escape) { - return '
' + escape(data.text) + '
'; - } - }, - onChange: function (value, oldValue) { - $scope.macInputModel = value; - } - }; - - function getMachineRules() { - if (!$scope.macInputModel) { - return; - } - let mac = $scope.macInputModel.split(':'); - AuthorityRuleService.queryMachineRules($scope.app, mac[0], mac[1]) - .success(function (data) { - if (data.code === 0 && data.data) { - $scope.loadError = undefined; - $scope.rules = data.data; - $scope.rulesPageConfig.totalCount = $scope.rules.length; - } else { - $scope.rules = []; - $scope.rulesPageConfig.totalCount = 0; - $scope.loadError = {message: data.msg}; - } - }) - .error((data, header, config, status) => { - $scope.loadError = {message: "未知错误"}; - }); - }; - $scope.getMachineRules = getMachineRules; - getMachineRules(); - - var authorityRuleDialog; - - $scope.editRule = function (rule) { - $scope.currentRule = angular.copy(rule); - $scope.authorityRuleDialog = { - title: '编辑授权规则', - type: 'edit', - confirmBtnText: '保存', - }; - authorityRuleDialog = ngDialog.open({ - template: '/app/views/dialog/authority-rule-dialog.html', - width: 680, - overlay: true, - scope: $scope - }); - }; - - $scope.addNewRule = function () { - var mac = $scope.macInputModel.split(':'); - $scope.currentRule = { - app: $scope.app, - ip: mac[0], - port: mac[1], - rule: { - strategy: 0, - limitApp: '', - } - }; - $scope.authorityRuleDialog = { - title: '新增授权规则', - type: 'add', - confirmBtnText: '新增', - showAdvanceButton: true, - }; - authorityRuleDialog = ngDialog.open({ - template: '/app/views/dialog/authority-rule-dialog.html', - width: 680, - overlay: true, - scope: $scope - }); - }; - - $scope.saveRule = function () { - if (!AuthorityRuleService.checkRuleValid($scope.currentRule.rule)) { - return; - } - if ($scope.authorityRuleDialog.type === 'add') { - addNewRuleAndPush($scope.currentRule); - } else if ($scope.authorityRuleDialog.type === 'edit') { - saveRuleAndPush($scope.currentRule, true); - } - }; - - function addNewRuleAndPush(rule) { - AuthorityRuleService.addNewRule(rule).success((data) => { - if (data.success) { - getMachineRules(); - authorityRuleDialog.close(); - } else { - alert('添加规则失败:' + data.msg); - } - }).error((data) => { - if (data) { - alert('添加规则失败:' + data.msg); - } else { - alert("添加规则失败:未知错误"); - } - }); - } - - function saveRuleAndPush(rule, edit) { - AuthorityRuleService.saveRule(rule).success(function (data) { - if (data.success) { - alert("修改规则成功"); - getMachineRules(); - if (edit) { - authorityRuleDialog.close(); - } else { - confirmDialog.close(); - } - } else { - alert('修改规则失败:' + data.msg); - } - }).error((data) => { - if (data) { - alert('修改规则失败:' + data.msg); - } else { - alert("修改规则失败:未知错误"); - } - }); - } - - function deleteRuleAndPush(entity) { - if (entity.id === undefined || isNaN(entity.id)) { - alert('规则 ID 不合法!'); - return; - } - AuthorityRuleService.deleteRule(entity).success((data) => { - if (data.code == 0) { - getMachineRules(); - confirmDialog.close(); - } else { - alert('删除规则失败:' + data.msg); - } - }).error((data) => { - if (data) { - alert('删除规则失败:' + data.msg); - } else { - alert("删除规则失败:未知错误"); - } - }); - }; - - var confirmDialog; - $scope.deleteRule = function (ruleEntity) { - $scope.currentRule = ruleEntity; - $scope.confirmDialog = { - title: '删除授权规则', - type: 'delete_rule', - attentionTitle: '请确认是否删除如下授权限流规则', - attention: '资源名: ' + ruleEntity.rule.resource + ', 流控应用: ' + ruleEntity.rule.limitApp + - ', 类型: ' + (ruleEntity.rule.strategy === 0 ? '白名单' : '黑名单'), - confirmBtnText: '删除', - }; - confirmDialog = ngDialog.open({ - template: '/app/views/dialog/confirm-dialog.html', - scope: $scope, - overlay: true - }); - }; - - $scope.confirm = function () { - if ($scope.confirmDialog.type === 'delete_rule') { - deleteRuleAndPush($scope.currentRule); - } else { - console.error('error'); - } - }; - - queryAppMachines(); - - function queryAppMachines() { - MachineService.getAppMachines($scope.app).success( - function (data) { - if (data.code == 0) { - // $scope.machines = data.data; - if (data.data) { - $scope.machines = []; - $scope.macsInputOptions = []; - data.data.forEach(function (item) { - if (item.healthy) { - $scope.macsInputOptions.push({ - text: item.ip + ':' + item.port, - value: item.ip + ':' + item.port - }); - } - }); - } - if ($scope.macsInputOptions.length > 0) { - $scope.macInputModel = $scope.macsInputOptions[0].value; - } - } else { - $scope.macsInputOptions = []; - } - } - ); - }; - $scope.$watch('macInputModel', function () { - if ($scope.macInputModel) { - getMachineRules(); - } - }); - }]); \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/cluster_app_assign_manage.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/cluster_app_assign_manage.js deleted file mode 100644 index 6f9367d6..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/cluster_app_assign_manage.js +++ /dev/null @@ -1,283 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.controller('SentinelClusterAppAssignManageController', ['$scope', '$stateParams', 'ngDialog', - 'MachineService', 'ClusterStateService', - function ($scope, $stateParams, ngDialog, MachineService, ClusterStateService) { - $scope.app = $stateParams.app; - const UNSUPPORTED_CODE = 4041; - - const CLUSTER_MODE_CLIENT = 0; - const CLUSTER_MODE_SERVER = 1; - const DEFAULT_CLUSTER_SERVER_PORT = 18730; - - $scope.tmp = { - curClientChosen: [], - curRemainingClientChosen: [], - curChosenServer: {}, - }; - - function convertSetToString(set) { - if (set === undefined) { - return ''; - } - let s = ''; - for (let i = 0; i < set.length; i++) { - s = s + set[i]; - if (i < set.length - 1) { - s = s + ','; - } - } - return s; - } - - function convertStrToNamespaceSet(str) { - if (str === undefined || str === '') { - return []; - } - let arr = []; - let spliced = str.split(','); - spliced.forEach((v) => { - arr.push(v.trim()); - }); - return arr; - } - - function processAppSingleData(data) { - if (data.state.server && data.state.server.namespaceSet) { - data.state.server.namespaceSetStr = convertSetToString(data.state.server.namespaceSet); - data.mode = data.state.stateInfo.mode; - } - } - - function removeFromArr(arr, v) { - for (let i = 0; i < arr.length; i++) { - if (arr[i] === v) { - arr.splice(i, 1); - break; - } - } - } - - function resetChosen() { - $scope.tmp.curClientChosen = []; - $scope.tmp.curRemainingClientChosen = []; - } - - function generateMachineId(e) { - return e.ip + '@' + e.commandPort; - } - - function applyClusterMap(appClusterMachineList) { - if (!appClusterMachineList) { - return; - } - let tmpMap = new Map(); - $scope.clusterMap = []; - $scope.remainingClientAddressList = []; - let tmpServerList = []; - let tmpClientList = []; - appClusterMachineList.forEach((e) => { - if (e.mode === CLUSTER_MODE_CLIENT) { - tmpClientList.push(e); - } else if (e.mode === CLUSTER_MODE_SERVER) { - tmpServerList.push(e); - } else { - $scope.remainingClientAddressList.push(generateMachineId(e)); - } - }); - tmpServerList.forEach((e) => { - let ip = e.ip; - let machineId = ip + '@' + e.commandPort; - let group = { - ip: ip, - machineId: machineId, - port: e.state.server.port, - clientSet: [], - namespaceSetStr: e.state.server.namespaceSetStr, - belongToApp: true, - }; - if (!tmpMap.has(ip)) { - tmpMap.set(ip, group); - } - }); - tmpClientList.forEach((e) => { - let ip = e.ip; - let machineId = ip + '@' + e.commandPort; - - let targetServer = e.state.client.clientConfig.serverHost; - let targetPort = e.state.client.clientConfig.serverPort; - if (targetServer === undefined || targetServer === '' || - targetPort === undefined || targetPort <= 0) { - $scope.remainingClientAddressList.push(generateMachineId(e)); - return; - } - - if (!tmpMap.has(targetServer)) { - let group = { - ip: targetServer, - machineId: targetServer, - port: targetPort, - clientSet: [machineId], - belongToApp: false, - }; - tmpMap.set(targetServer, group); - } else { - let g = tmpMap.get(targetServer); - g.clientSet.push(machineId); - } - }); - tmpMap.forEach((v) => { - if (v !== undefined) { - $scope.clusterMap.push(v); - } - }); - } - - $scope.onCurrentServerChange = () => { - resetChosen(); - }; - - $scope.remainingClientAddressList = []; - - $scope.moveToServerGroup = () => { - let chosenServer = $scope.tmp.curChosenServer; - if (!chosenServer || !chosenServer.machineId) { - return; - } - $scope.tmp.curRemainingClientChosen.forEach(e => { - chosenServer.clientSet.push(e); - removeFromArr($scope.remainingClientAddressList, e); - }); - resetChosen(); - }; - - $scope.moveToRemainingSharePool = () => { - $scope.tmp.curClientChosen.forEach(e => { - $scope.remainingClientAddressList.push(e); - removeFromArr($scope.tmp.curChosenServer.clientSet, e); - }); - resetChosen(); - }; - - function parseIpFromMachineId(machineId) { - if (machineId.indexOf('@') === -1) { - return machineId; - } - let arr = machineId.split('@'); - return arr[0]; - } - - $scope.addToServerList = () => { - let group; - $scope.tmp.curRemainingClientChosen.forEach(e => { - group = { - machineId: e, - ip: parseIpFromMachineId(e), - port: DEFAULT_CLUSTER_SERVER_PORT, - clientSet: [], - namespaceSetStr: 'default,' + $scope.app, - belongToApp: true, - }; - $scope.clusterMap.push(group); - removeFromArr($scope.remainingClientAddressList, e); - $scope.tmp.curChosenServer = group; - }); - resetChosen(); - }; - - $scope.removeFromServerList = () => { - let chosenServer = $scope.tmp.curChosenServer; - if (!chosenServer || !chosenServer.machineId) { - return; - } - chosenServer.clientSet.forEach((e) => { - if (e !== undefined) { - $scope.remainingClientAddressList.push(e); - } - }); - - if (chosenServer.belongToApp || chosenServer.machineId.indexOf('@') !== -1) { - $scope.remainingClientAddressList.push(chosenServer.machineId); - } else { - alert('提示:非本应用内机器将不会置回空闲列表中'); - } - - removeFromArr($scope.clusterMap, chosenServer); - - resetChosen(); - - if ($scope.clusterMap.length > 0) { - $scope.tmp.curChosenServer = $scope.clusterMap[0]; - $scope.onCurrentServerChange(); - } else { - $scope.tmp.curChosenServer = {}; - } - }; - - function retrieveClusterAppInfo() { - ClusterStateService.fetchClusterUniversalStateOfApp($scope.app).success(function (data) { - if (data.code === 0 && data.data) { - $scope.loadError = undefined; - $scope.appClusterMachineList = data.data; - $scope.appClusterMachineList.forEach(processAppSingleData); - applyClusterMap($scope.appClusterMachineList); - if ($scope.clusterMap.length > 0) { - $scope.tmp.curChosenServer = $scope.clusterMap[0]; - $scope.onCurrentServerChange(); - } - } else { - $scope.appClusterMachineList = {}; - if (data.code === UNSUPPORTED_CODE) { - $scope.loadError = {message: '该应用的 Sentinel 客户端不支持集群限流,请升级至 1.4.0 以上版本并引入相关依赖。'} - } else { - $scope.loadError = {message: data.msg}; - } - } - }).error(() => { - $scope.loadError = {message: '未知错误'}; - }); - } - - retrieveClusterAppInfo(); - - $scope.saveAndApplyAssign = () => { - let ok = confirm('是否确认执行变更?'); - if (!ok) { - return; - } - let cm = $scope.clusterMap; - if (!cm) { - cm = []; - } - cm.forEach((e) => { - e.namespaceSet = convertStrToNamespaceSet(e.namespaceSetStr); - }); - cm.namespaceSet = convertStrToNamespaceSet(cm.namespaceSetStr); - let request = { - clusterMap: cm, - remainingList: $scope.remainingClientAddressList, - }; - ClusterStateService.applyClusterFullAssignOfApp($scope.app, request).success((data) => { - if (data.code === 0 && data.data) { - let failedServerSet = data.data.failedServerSet; - let failedClientSet = data.data.failedClientSet; - if (failedClientSet.length === 0 && failedServerSet.length === 0) { - alert('全部推送成功'); - } else { - alert('推送完毕。token server 失败列表:' + JSON.stringify(failedServerSet) + - '; token client 失败列表:' + JSON.stringify(failedClientSet)); - } - - retrieveClusterAppInfo(); - } else { - if (data.code === UNSUPPORTED_CODE) { - alert('该应用的 Sentinel 客户端不支持集群限流,请升级至 1.4.0 以上版本并引入相关依赖。'); - } else { - alert('推送失败:' + data.msg); - } - } - }).error(() => { - alert('未知错误'); - }); - }; - }]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/cluster_app_server_list.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/cluster_app_server_list.js deleted file mode 100644 index 7e1708c0..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/cluster_app_server_list.js +++ /dev/null @@ -1,570 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.controller('SentinelClusterAppServerListController', ['$scope', '$stateParams', 'ngDialog', - 'MachineService', 'ClusterStateService', - function ($scope, $stateParams, ngDialog, MachineService, ClusterStateService) { - $scope.app = $stateParams.app; - const UNSUPPORTED_CODE = 4041; - - const CLUSTER_MODE_CLIENT = 0; - const CLUSTER_MODE_SERVER = 1; - const DEFAULT_CLUSTER_SERVER_PORT = 18730; - const DEFAULT_NAMESPACE = 'default'; - const DEFAULT_MAX_ALLOWED_QPS = 20000; - - // tmp for dialog temporary data. - $scope.tmp = { - curClientChosen: [], - curRemainingClientChosen: [], - curChosenServer: {}, - }; - - $scope.remainingMachineList = []; - - function convertSetToString(set) { - if (set === undefined) { - return ''; - } - if (set.length === 1 && set[0] === DEFAULT_NAMESPACE) { - return DEFAULT_NAMESPACE; - } - let s = ''; - for (let i = 0; i < set.length; i++) { - let ns = set[i]; - if (ns !== DEFAULT_NAMESPACE) { - s = s + ns; - if (i < set.length - 1) { - s = s + ','; - } - } - } - return s; - } - - function convertStrToNamespaceSet(str) { - if (str === undefined || str === '') { - return []; - } - let arr = []; - let spliced = str.split(','); - spliced.forEach((v) => { - arr.push(v.trim()); - }); - return arr; - } - - function processAppSingleData(data) { - if (data.state.server && data.state.server.namespaceSet) { - data.state.server.namespaceSetStr = convertSetToString(data.state.server.namespaceSet); - data.mode = data.state.stateInfo.mode; - } - } - - function removeFromArr(arr, v) { - for (let i = 0; i < arr.length; i++) { - if (arr[i] === v) { - arr.splice(i, 1); - break; - } - } - } - - function removeFromArrIf(arr, f) { - for (let i = 0; i < arr.length; i++) { - if (f(arr[i]) === true) { - arr.splice(i, 1); - break; - } - } - } - - function resetAssignDialogChosen() { - $scope.tmp.curClientChosen = []; - $scope.tmp.curRemainingClientChosen = []; - } - - function generateMachineId(e) { - return e.ip + '@' + e.commandPort; - } - - function applyClusterMap(appClusterMachineList) { - if (!appClusterMachineList) { - return; - } - let tmpMap = new Map(); - let serverCommandPortMap = new Map(); - $scope.clusterMap = []; - $scope.remainingMachineList = []; - let tmpServerList = []; - let tmpClientList = []; - appClusterMachineList.forEach((e) => { - if (e.mode === CLUSTER_MODE_CLIENT) { - tmpClientList.push(e); - } else if (e.mode === CLUSTER_MODE_SERVER) { - tmpServerList.push(e); - } else { - $scope.remainingMachineList.push(generateMachineId(e)); - } - }); - tmpServerList.forEach((e) => { - let ip = e.ip; - let machineId = ip + '@' + e.commandPort; - let group = { - ip: ip, - machineId: machineId, - port: e.state.server.port, - clientSet: [], - namespaceSetStr: e.state.server.namespaceSetStr, - maxAllowedQps: e.state.server.flow.maxAllowedQps, - belongToApp: true, - }; - if (!tmpMap.has(machineId)) { - tmpMap.set(machineId, group); - } - serverCommandPortMap.set(ip + ':' + e.state.server.port, e.commandPort); - }); - tmpClientList.forEach((e) => { - let ip = e.ip; - let machineId = ip + '@' + e.commandPort; - - let targetServer = e.state.client.clientConfig.serverHost; - let targetPort = e.state.client.clientConfig.serverPort; - if (targetServer === undefined || targetServer === '' || - targetPort === undefined || targetPort <= 0) { - $scope.remainingMachineList.push(generateMachineId(e)); - return; - } - - let serverHostPort = targetServer + ':' + targetPort; - - if (serverCommandPortMap.has(serverHostPort)) { - let serverCommandPort = serverCommandPortMap.get(serverHostPort); - let g; - if (serverCommandPort < 0) { - // Not belong to this app. - g = tmpMap.get(serverHostPort); - } else { - // Belong to this app. - g = tmpMap.get(targetServer + '@' + serverCommandPort); - } - g.clientSet.push(machineId); - } else { - let group = { - ip: targetServer, - machineId: serverHostPort, - port: targetPort, - clientSet: [machineId], - belongToApp: false, - }; - tmpMap.set(serverHostPort, group); - // Indicates that it's not belonging to current app. - serverCommandPortMap.set(serverHostPort, -1); - } - - // if (!tmpMap.has(serverHostPort)) { - // let group = { - // ip: targetServer, - // machineId: targetServer, - // port: targetPort, - // clientSet: [machineId], - // belongToApp: false, - // }; - // tmpMap.set(targetServer, group); - // } else { - // let g = tmpMap.get(targetServer); - // g.clientSet.push(machineId); - // } - }); - tmpMap.forEach((v) => { - if (v !== undefined) { - $scope.clusterMap.push(v); - } - }); - } - - $scope.notChosenServer = (id) => { - return id !== $scope.serverAssignDialogData.serverData.currentServer; - }; - - $scope.onCurrentServerChange = () => { - resetAssignDialogChosen(); - }; - - $scope.moveToServerGroup = () => { - $scope.tmp.curRemainingClientChosen.forEach(e => { - $scope.serverAssignDialogData.serverData.clientSet.push(e); - removeFromArr($scope.remainingMachineList, e); - }); - resetAssignDialogChosen(); - }; - - $scope.moveToRemainingSharePool = () => { - $scope.tmp.curClientChosen.forEach(e => { - $scope.remainingMachineList.push(e); - removeFromArr($scope.serverAssignDialogData.serverData.clientSet, e); - }); - resetAssignDialogChosen(); - }; - - function parseIpFromMachineId(machineId) { - if (machineId.indexOf(':') !== -1) { - return machineId.split(':')[0]; - } - if (machineId.indexOf('@') === -1) { - return machineId; - } - let arr = machineId.split('@'); - return arr[0]; - } - - function retrieveClusterAssignInfoOfApp() { - ClusterStateService.fetchClusterUniversalStateOfApp($scope.app).success(function (data) { - if (data.code === 0 && data.data) { - $scope.loadError = undefined; - $scope.appClusterMachineList = data.data; - $scope.appClusterMachineList.forEach(processAppSingleData); - applyClusterMap($scope.appClusterMachineList); - } else { - $scope.appClusterMachineList = {}; - if (data.code === UNSUPPORTED_CODE) { - $scope.loadError = {message: '该应用的 Sentinel 客户端不支持集群限流,请升级至 1.4.0 以上版本并引入相关依赖。'} - } else { - $scope.loadError = {message: data.msg}; - } - } - }).error(() => { - $scope.loadError = {message: '未知错误'}; - }); - } - - - $scope.newServerDialog = () => { - retrieveClusterAssignInfoOfApp(); - $scope.serverAssignDialogData = { - title: '新增 Token Server', - type: 'add', - confirmBtnText: '保存', - serverData: { - serverType: 0, - clientSet: [], - serverPort: DEFAULT_CLUSTER_SERVER_PORT, - maxAllowedQps: DEFAULT_MAX_ALLOWED_QPS, - } - }; - $scope.serverAssignDialog = ngDialog.open({ - template: '/app/views/dialog/cluster/cluster-server-assign-dialog.html', - width: 1000, - overlay: true, - scope: $scope - }); - }; - - $scope.modifyServerAssignConfig = (serverVO) => { - let id = serverVO.id; - ClusterStateService.fetchClusterUniversalStateOfApp($scope.app).success(function (data) { - if (data.code === 0 && data.data) { - $scope.loadError = undefined; - $scope.appClusterMachineList = data.data; - $scope.appClusterMachineList.forEach(processAppSingleData); - applyClusterMap($scope.appClusterMachineList); - let clusterMap = $scope.clusterMap; - let d; - for (let i = 0; i < clusterMap.length; i++) { - if (clusterMap[i].machineId === id) { - d = clusterMap[i]; - } - } - if (!d) { - alert('状态错误'); - return; - } - $scope.serverAssignDialogData = { - title: 'Token Server 分配编辑', - type: 'edit', - confirmBtnText: '保存', - serverData: { - currentServer: d.machineId, - belongToApp: serverVO.belongToApp, - serverPort: d.port, - clientSet: d.clientSet, - } - }; - if (d.maxAllowedQps !== undefined) { - $scope.serverAssignDialogData.serverData.maxAllowedQps = d.maxAllowedQps; - } - $scope.serverAssignDialog = ngDialog.open({ - template: '/app/views/dialog/cluster/cluster-server-assign-dialog.html', - width: 1000, - overlay: true, - scope: $scope - }); - } else { - if (data.code === UNSUPPORTED_CODE) { - $scope.loadError = {message: '该应用的 Sentinel 客户端不支持集群限流,请升级至 1.4.0 以上版本并引入相关依赖。'} - } else { - $scope.loadError = {message: data.msg}; - } - } - }).error(() => { - $scope.loadError = {message: '未知错误'}; - }); - }; - - function getRemainingMachineList() { - return $scope.remainingMachineList.filter((e) => $scope.notChosenServer(e)); - } - - function doApplyNewSingleServerAssign() { - let ok = confirm('是否确认执行变更?'); - if (!ok) { - return; - } - let serverData = $scope.serverAssignDialogData.serverData; - let belongToApp = serverData.serverType == 0; // don't modify here! - let machineId = serverData.currentServer; - let request = { - clusterMap: { - machineId: machineId, - ip: parseIpFromMachineId(machineId), - port: serverData.serverPort, - clientSet: serverData.clientSet, - belongToApp: belongToApp, - maxAllowedQps: serverData.maxAllowedQps, - }, - remainingList: getRemainingMachineList(), - }; - ClusterStateService.applyClusterSingleServerAssignOfApp($scope.app, request).success((data) => { - if (data.code === 0 && data.data) { - let failedServerSet = data.data.failedServerSet; - let failedClientSet = data.data.failedClientSet; - if (failedClientSet.length === 0 && failedServerSet.length === 0) { - alert('全部推送成功'); - } else { - let failedSet = []; - if (failedServerSet) { - failedServerSet.forEach((e) => { - failedSet.push(e); - }); - } - if (failedClientSet) { - failedClientSet.forEach((e) => { - failedSet.push(e); - }); - } - - alert('推送完毕。失败机器列表:' + JSON.stringify(failedSet)); - } - - location.reload(); - } else { - if (data.code === UNSUPPORTED_CODE) { - alert('该应用的 Sentinel 客户端不支持集群限流,请升级至 1.4.0 以上版本并引入相关依赖。'); - } else { - alert('推送失败:' + data.msg); - } - } - }).error(() => { - alert('未知错误'); - }); - } - - function doApplySingleServerAssignEdit() { - let ok = confirm('是否确认执行变更?'); - if (!ok) { - return; - } - let serverData = $scope.serverAssignDialogData.serverData; - let machineId = serverData.currentServer; - let request = { - clusterMap: { - machineId: machineId, - ip: parseIpFromMachineId(machineId), - port: serverData.serverPort, - clientSet: serverData.clientSet, - belongToApp: serverData.belongToApp, - }, - remainingList: $scope.remainingMachineList, - }; - if (serverData.maxAllowedQps !== undefined) { - request.clusterMap.maxAllowedQps = serverData.maxAllowedQps; - } - ClusterStateService.applyClusterSingleServerAssignOfApp($scope.app, request).success((data) => { - if (data.code === 0 && data.data) { - let failedServerSet = data.data.failedServerSet; - let failedClientSet = data.data.failedClientSet; - if (failedClientSet.length === 0 && failedServerSet.length === 0) { - alert('全部推送成功'); - } else { - let failedSet = []; - failedServerSet.forEach(failedSet.push); - failedClientSet.forEach(failedSet.push); - alert('推送完毕。失败机器列表:' + JSON.stringify(failedSet)); - } - - location.reload(); - } else { - if (data.code === UNSUPPORTED_CODE) { - alert('该应用的 Sentinel 客户端不支持集群限流,请升级至 1.4.0 以上版本并引入相关依赖。'); - } else { - alert('推送失败:' + data.msg); - } - } - }).error(() => { - alert('未知错误'); - }); - } - - $scope.saveAssignForDialog = () => { - if (!checkAssignDialogValid()) { - return; - } - if ($scope.serverAssignDialogData.type === 'add') { - doApplyNewSingleServerAssign(); - } else if ($scope.serverAssignDialogData.type === 'edit') { - doApplySingleServerAssignEdit(); - } else { - alert('未知的操作'); - } - }; - - function checkAssignDialogValid() { - let serverData = $scope.serverAssignDialogData.serverData; - if (serverData.currentServer === undefined || serverData.currentServer === '') { - alert('请指定有效的 Token Server'); - return false; - } - if (serverData.serverPort === undefined || serverData.serverPort <= 0 || serverData.serverPort > 65535) { - alert('请输入合法的端口值'); - return false; - } - if (serverData.maxAllowedQps !== undefined && serverData.maxAllowedQps < 0) { - alert('请输入合法的最大允许 QPS'); - return false; - } - return true; - } - - $scope.viewConnectionDetail = (serverVO) => { - $scope.connectionDetailDialogData = { - serverData: serverVO - }; - $scope.connectionDetailDialog = ngDialog.open({ - template: '/app/views/dialog/cluster/cluster-server-connection-detail-dialog.html', - width: 700, - overlay: true, - scope: $scope - }); - }; - - function generateRequestLimitDataStr(limitData) { - if (limitData.length === 1 && limitData[0].namespace === DEFAULT_NAMESPACE) { - return 'default: ' + limitData[0].currentQps + ' / ' + limitData[0].maxAllowedQps; - } - for (let i = 0; i < limitData.length; i++) { - let crl = limitData[i]; - if (crl.namespace === $scope.app) { - return '' + crl.currentQps + ' / ' + crl.maxAllowedQps; - } - } - return '0'; - } - - function processServerListData(serverVO) { - if (serverVO.state && serverVO.state.namespaceSet) { - serverVO.state.namespaceSetStr = convertSetToString(serverVO.state.namespaceSet); - } - if (serverVO.state && serverVO.state.requestLimitData) { - serverVO.state.requestLimitDataStr = generateRequestLimitDataStr(serverVO.state.requestLimitData); - } - } - - $scope.generateConnectionSet = (data) => { - let connectionSet = data; - let s = ''; - if (connectionSet) { - s = s + '['; - for (let i = 0; i < connectionSet.length; i++) { - s = s + connectionSet[i].address; - if (i < connectionSet.length - 1) { - s = s + ', '; - } - } - s = s + ']'; - } else { - s = '[]'; - } - return s; - }; - - function retrieveClusterServerInfo() { - ClusterStateService.fetchClusterServerStateOfApp($scope.app).success(function (data) { - if (data.code === 0 && data.data) { - $scope.loadError = undefined; - $scope.serverVOList = data.data; - $scope.serverVOList.forEach(processServerListData); - } else { - $scope.serverVOList = {}; - if (data.code === UNSUPPORTED_CODE) { - $scope.loadError = {message: '该应用的 Sentinel 客户端不支持集群限流,请升级至 1.4.0 以上版本并引入相关依赖。'} - } else { - $scope.loadError = {message: data.msg}; - } - } - }).error(() => { - $scope.loadError = {message: '未知错误'}; - }); - } - - retrieveClusterServerInfo(); - - let confirmUnbindServerDialog; - $scope.unbindServer = (id) => { - $scope.pendingUnbindIds = [id]; - $scope.confirmDialog = { - title: '移除 Token Server', - type: 'unbind_token_server', - attentionTitle: '请确认是否移除以下 Token Server(该 server 下的 client 也会解除分配)', - attention: id + '', - confirmBtnText: '移除', - }; - confirmUnbindServerDialog = ngDialog.open({ - template: '/app/views/dialog/confirm-dialog.html', - scope: $scope, - overlay: true - }); - }; - - function apiUnbindServerAssign(ids) { - ClusterStateService.applyClusterServerBatchUnbind($scope.app, ids).success((data) => { - if (data.code === 0 && data.data) { - let failedServerSet = data.data.failedServerSet; - let failedClientSet = data.data.failedClientSet; - if (failedClientSet.length === 0 && failedServerSet.length === 0) { - alert('成功'); - } else { - alert('操作推送完毕,部分失败机器列表:' + JSON.stringify(failedClientSet)); - } - - location.reload(); - } else { - if (data.code === UNSUPPORTED_CODE) { - alert('该应用的 Sentinel 客户端不支持集群限流,请升级至 1.4.0 以上版本并引入相关依赖。'); - } else { - alert('推送失败:' + data.msg); - } - } - }).error(() => { - alert('未知错误'); - }); - // confirmUnbindServerDialog.close(); - } - - // Confirm function for confirm dialog. - $scope.confirm = () => { - if ($scope.confirmDialog.type === 'unbind_token_server') { - apiUnbindServerAssign($scope.pendingUnbindIds); - } else { - console.error('Error dialog when unbinding token server'); - } - }; - }]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/cluster_app_server_manage.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/cluster_app_server_manage.js deleted file mode 100644 index 6f9367d6..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/cluster_app_server_manage.js +++ /dev/null @@ -1,283 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.controller('SentinelClusterAppAssignManageController', ['$scope', '$stateParams', 'ngDialog', - 'MachineService', 'ClusterStateService', - function ($scope, $stateParams, ngDialog, MachineService, ClusterStateService) { - $scope.app = $stateParams.app; - const UNSUPPORTED_CODE = 4041; - - const CLUSTER_MODE_CLIENT = 0; - const CLUSTER_MODE_SERVER = 1; - const DEFAULT_CLUSTER_SERVER_PORT = 18730; - - $scope.tmp = { - curClientChosen: [], - curRemainingClientChosen: [], - curChosenServer: {}, - }; - - function convertSetToString(set) { - if (set === undefined) { - return ''; - } - let s = ''; - for (let i = 0; i < set.length; i++) { - s = s + set[i]; - if (i < set.length - 1) { - s = s + ','; - } - } - return s; - } - - function convertStrToNamespaceSet(str) { - if (str === undefined || str === '') { - return []; - } - let arr = []; - let spliced = str.split(','); - spliced.forEach((v) => { - arr.push(v.trim()); - }); - return arr; - } - - function processAppSingleData(data) { - if (data.state.server && data.state.server.namespaceSet) { - data.state.server.namespaceSetStr = convertSetToString(data.state.server.namespaceSet); - data.mode = data.state.stateInfo.mode; - } - } - - function removeFromArr(arr, v) { - for (let i = 0; i < arr.length; i++) { - if (arr[i] === v) { - arr.splice(i, 1); - break; - } - } - } - - function resetChosen() { - $scope.tmp.curClientChosen = []; - $scope.tmp.curRemainingClientChosen = []; - } - - function generateMachineId(e) { - return e.ip + '@' + e.commandPort; - } - - function applyClusterMap(appClusterMachineList) { - if (!appClusterMachineList) { - return; - } - let tmpMap = new Map(); - $scope.clusterMap = []; - $scope.remainingClientAddressList = []; - let tmpServerList = []; - let tmpClientList = []; - appClusterMachineList.forEach((e) => { - if (e.mode === CLUSTER_MODE_CLIENT) { - tmpClientList.push(e); - } else if (e.mode === CLUSTER_MODE_SERVER) { - tmpServerList.push(e); - } else { - $scope.remainingClientAddressList.push(generateMachineId(e)); - } - }); - tmpServerList.forEach((e) => { - let ip = e.ip; - let machineId = ip + '@' + e.commandPort; - let group = { - ip: ip, - machineId: machineId, - port: e.state.server.port, - clientSet: [], - namespaceSetStr: e.state.server.namespaceSetStr, - belongToApp: true, - }; - if (!tmpMap.has(ip)) { - tmpMap.set(ip, group); - } - }); - tmpClientList.forEach((e) => { - let ip = e.ip; - let machineId = ip + '@' + e.commandPort; - - let targetServer = e.state.client.clientConfig.serverHost; - let targetPort = e.state.client.clientConfig.serverPort; - if (targetServer === undefined || targetServer === '' || - targetPort === undefined || targetPort <= 0) { - $scope.remainingClientAddressList.push(generateMachineId(e)); - return; - } - - if (!tmpMap.has(targetServer)) { - let group = { - ip: targetServer, - machineId: targetServer, - port: targetPort, - clientSet: [machineId], - belongToApp: false, - }; - tmpMap.set(targetServer, group); - } else { - let g = tmpMap.get(targetServer); - g.clientSet.push(machineId); - } - }); - tmpMap.forEach((v) => { - if (v !== undefined) { - $scope.clusterMap.push(v); - } - }); - } - - $scope.onCurrentServerChange = () => { - resetChosen(); - }; - - $scope.remainingClientAddressList = []; - - $scope.moveToServerGroup = () => { - let chosenServer = $scope.tmp.curChosenServer; - if (!chosenServer || !chosenServer.machineId) { - return; - } - $scope.tmp.curRemainingClientChosen.forEach(e => { - chosenServer.clientSet.push(e); - removeFromArr($scope.remainingClientAddressList, e); - }); - resetChosen(); - }; - - $scope.moveToRemainingSharePool = () => { - $scope.tmp.curClientChosen.forEach(e => { - $scope.remainingClientAddressList.push(e); - removeFromArr($scope.tmp.curChosenServer.clientSet, e); - }); - resetChosen(); - }; - - function parseIpFromMachineId(machineId) { - if (machineId.indexOf('@') === -1) { - return machineId; - } - let arr = machineId.split('@'); - return arr[0]; - } - - $scope.addToServerList = () => { - let group; - $scope.tmp.curRemainingClientChosen.forEach(e => { - group = { - machineId: e, - ip: parseIpFromMachineId(e), - port: DEFAULT_CLUSTER_SERVER_PORT, - clientSet: [], - namespaceSetStr: 'default,' + $scope.app, - belongToApp: true, - }; - $scope.clusterMap.push(group); - removeFromArr($scope.remainingClientAddressList, e); - $scope.tmp.curChosenServer = group; - }); - resetChosen(); - }; - - $scope.removeFromServerList = () => { - let chosenServer = $scope.tmp.curChosenServer; - if (!chosenServer || !chosenServer.machineId) { - return; - } - chosenServer.clientSet.forEach((e) => { - if (e !== undefined) { - $scope.remainingClientAddressList.push(e); - } - }); - - if (chosenServer.belongToApp || chosenServer.machineId.indexOf('@') !== -1) { - $scope.remainingClientAddressList.push(chosenServer.machineId); - } else { - alert('提示:非本应用内机器将不会置回空闲列表中'); - } - - removeFromArr($scope.clusterMap, chosenServer); - - resetChosen(); - - if ($scope.clusterMap.length > 0) { - $scope.tmp.curChosenServer = $scope.clusterMap[0]; - $scope.onCurrentServerChange(); - } else { - $scope.tmp.curChosenServer = {}; - } - }; - - function retrieveClusterAppInfo() { - ClusterStateService.fetchClusterUniversalStateOfApp($scope.app).success(function (data) { - if (data.code === 0 && data.data) { - $scope.loadError = undefined; - $scope.appClusterMachineList = data.data; - $scope.appClusterMachineList.forEach(processAppSingleData); - applyClusterMap($scope.appClusterMachineList); - if ($scope.clusterMap.length > 0) { - $scope.tmp.curChosenServer = $scope.clusterMap[0]; - $scope.onCurrentServerChange(); - } - } else { - $scope.appClusterMachineList = {}; - if (data.code === UNSUPPORTED_CODE) { - $scope.loadError = {message: '该应用的 Sentinel 客户端不支持集群限流,请升级至 1.4.0 以上版本并引入相关依赖。'} - } else { - $scope.loadError = {message: data.msg}; - } - } - }).error(() => { - $scope.loadError = {message: '未知错误'}; - }); - } - - retrieveClusterAppInfo(); - - $scope.saveAndApplyAssign = () => { - let ok = confirm('是否确认执行变更?'); - if (!ok) { - return; - } - let cm = $scope.clusterMap; - if (!cm) { - cm = []; - } - cm.forEach((e) => { - e.namespaceSet = convertStrToNamespaceSet(e.namespaceSetStr); - }); - cm.namespaceSet = convertStrToNamespaceSet(cm.namespaceSetStr); - let request = { - clusterMap: cm, - remainingList: $scope.remainingClientAddressList, - }; - ClusterStateService.applyClusterFullAssignOfApp($scope.app, request).success((data) => { - if (data.code === 0 && data.data) { - let failedServerSet = data.data.failedServerSet; - let failedClientSet = data.data.failedClientSet; - if (failedClientSet.length === 0 && failedServerSet.length === 0) { - alert('全部推送成功'); - } else { - alert('推送完毕。token server 失败列表:' + JSON.stringify(failedServerSet) + - '; token client 失败列表:' + JSON.stringify(failedClientSet)); - } - - retrieveClusterAppInfo(); - } else { - if (data.code === UNSUPPORTED_CODE) { - alert('该应用的 Sentinel 客户端不支持集群限流,请升级至 1.4.0 以上版本并引入相关依赖。'); - } else { - alert('推送失败:' + data.msg); - } - } - }).error(() => { - alert('未知错误'); - }); - }; - }]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/cluster_app_server_monitor.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/cluster_app_server_monitor.js deleted file mode 100644 index 202fca1b..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/cluster_app_server_monitor.js +++ /dev/null @@ -1,97 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.controller('SentinelClusterAppServerMonitorController', ['$scope', '$stateParams', 'ngDialog', - 'MachineService', 'ClusterStateService', - function ($scope, $stateParams, ngDialog, MachineService, ClusterStateService) { - $scope.app = $stateParams.app; - const UNSUPPORTED_CODE = 4041; - - const CLUSTER_MODE_SERVER = 1; - - $scope.tmp = { - curChosenServer: {}, - }; - - function convertSetToString(set) { - if (set === undefined) { - return ''; - } - let s = ''; - for (let i = 0; i < set.length; i++) { - s = s + set[i]; - if (i < set.length - 1) { - s = s + ','; - } - } - return s; - } - - function processServerData(serverVO) { - if (serverVO.state && serverVO.state.namespaceSet) { - serverVO.state.namespaceSetStr = convertSetToString(serverVO.state.namespaceSet); - } - } - - $scope.generateConnectionSet = (data) => { - let connectionSet = data; - let s = ''; - if (connectionSet) { - s = s + '['; - for (let i = 0; i < connectionSet.length; i++) { - s = s + connectionSet[i].address; - if (i < connectionSet.length - 1) { - s = s + ', '; - } - } - s = s + ']'; - } else { - s = '[]'; - } - return s; - }; - - $scope.onChosenServerChange = () => { - - }; - - function retrieveClusterServerInfo() { - ClusterStateService.fetchClusterServerStateOfApp($scope.app).success(function (data) { - if (data.code === 0 && data.data) { - $scope.loadError = undefined; - $scope.serverVOList = data.data; - $scope.serverVOList.forEach(processServerData); - - if ($scope.serverVOList.length > 0) { - $scope.tmp.curChosenServer = $scope.serverVOList[0]; - $scope.onChosenServerChange(); - } - } else { - $scope.serverVOList = {}; - if (data.code === UNSUPPORTED_CODE) { - $scope.loadError = {message: '该应用的 Sentinel 客户端不支持集群限流,请升级至 1.4.0 以上版本并引入相关依赖。'} - } else { - $scope.loadError = {message: data.msg}; - } - } - }).error(() => { - $scope.loadError = {message: '未知错误'}; - }); - } - - retrieveClusterServerInfo(); - - $scope.macsInputConfig = { - searchField: ['text', 'value'], - persist: true, - create: false, - maxItems: 1, - render: { - item: function (data, escape) { - return '
' + escape(data.text) + '
'; - } - }, - onChange: function (value, oldValue) { - $scope.macInputModel = value; - } - }; - }]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/cluster_app_token_client_list.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/cluster_app_token_client_list.js deleted file mode 100644 index 177161b8..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/cluster_app_token_client_list.js +++ /dev/null @@ -1,121 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.controller('SentinelClusterAppTokenClientListController', ['$scope', '$stateParams', 'ngDialog', - 'MachineService', 'ClusterStateService', - function ($scope, $stateParams, ngDialog, MachineService, ClusterStateService) { - $scope.app = $stateParams.app; - - const UNSUPPORTED_CODE = 4041; - const CLUSTER_MODE_CLIENT = 0; - const CLUSTER_MODE_SERVER = 1; - - function processClientData(clientVO) { - - } - - $scope.modifyClientConfigDialog = (clientVO) => { - if (!clientVO) { - return; - } - $scope.ccDialogData = { - ip: clientVO.ip, - commandPort: clientVO.commandPort, - clientId: clientVO.id, - serverHost: clientVO.state.clientConfig.serverHost, - serverPort: clientVO.state.clientConfig.serverPort, - requestTimeout: clientVO.state.clientConfig.requestTimeout, - }; - $scope.ccDialog = ngDialog.open({ - template: '/app/views/dialog/cluster/cluster-client-config-dialog.html', - width: 700, - overlay: true, - scope: $scope - }); - }; - - function checkValidClientConfig(config) { - if (!config.serverHost || config.serverHost.trim() == '') { - alert('请输入有效的 Token Server IP'); - return false; - } - if (config.serverPort === undefined || config.serverPort <= 0 || config.serverPort > 65535) { - alert('请输入有效的 Token Server 端口'); - return false; - } - if (config.requestTimeout === undefined || config.requestTimeout <= 0) { - alert('请输入有效的请求超时时长'); - return false; - } - return true; - } - - $scope.doModifyClientConfig = () => { - if (!checkValidClientConfig($scope.ccDialogData)) { - return; - } - let id = $scope.ccDialogData.id; - let request = { - app: $scope.app, - ip: $scope.ccDialogData.ip, - port: $scope.ccDialogData.commandPort, - mode: CLUSTER_MODE_CLIENT, - clientConfig: { - serverHost: $scope.ccDialogData.serverHost, - serverPort: $scope.ccDialogData.serverPort, - requestTimeout: $scope.ccDialogData.requestTimeout, - } - }; - ClusterStateService.modifyClusterConfig(request).success((data) => { - if (data.code === 0 && data.data) { - alert('修改 Token Client 配置成功'); - window.location.reload(); - } else { - if (data.code === UNSUPPORTED_CODE) { - alert('机器 ' + id + ' 的 Sentinel 没有引入集群限流客户端,请升级至 1.4.0 以上版本并引入相关依赖。'); - } else { - alert('修改失败:' + data.msg); - } - } - }).error((data, header, config, status) => { - alert('未知错误'); - }); - }; - - function retrieveClusterTokenClientInfo() { - ClusterStateService.fetchClusterClientStateOfApp($scope.app) - .success((data) => { - if (data.code === 0 && data.data) { - $scope.loadError = undefined; - $scope.clientVOList = data.data; - $scope.clientVOList.forEach(processClientData); - } else { - $scope.clientVOList = []; - if (data.code === UNSUPPORTED_CODE) { - $scope.loadError = {message: '该应用的 Sentinel 客户端不支持集群限流,请升级至 1.4.0 以上版本并引入相关依赖。'} - } else { - $scope.loadError = {message: data.msg}; - } - } - }) - .error(() => { - $scope.loadError = {message: '未知错误'}; - }); - } - - retrieveClusterTokenClientInfo(); - - $scope.macsInputConfig = { - searchField: ['text', 'value'], - persist: true, - create: false, - maxItems: 1, - render: { - item: function (data, escape) { - return '
' + escape(data.text) + '
'; - } - }, - onChange: function (value, oldValue) { - $scope.macInputModel = value; - } - }; - }]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/cluster_single.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/cluster_single.js deleted file mode 100644 index 7392229d..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/cluster_single.js +++ /dev/null @@ -1,262 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.controller('SentinelClusterSingleController', ['$scope', '$stateParams', 'ngDialog', - 'MachineService', 'ClusterStateService', - function ($scope, $stateParams, ngDialog, MachineService, ClusterStateService) { - $scope.app = $stateParams.app; - const UNSUPPORTED_CODE = 4041; - - const CLUSTER_MODE_CLIENT = 0; - const CLUSTER_MODE_SERVER = 1; - - $scope.macsInputConfig = { - searchField: ['text', 'value'], - persist: true, - create: false, - maxItems: 1, - render: { - item: function (data, escape) { - return '
' + escape(data.text) + '
'; - } - }, - onChange: function (value, oldValue) { - $scope.macInputModel = value; - } - }; - - function convertSetToString(set) { - if (set === undefined) { - return ''; - } - let s = ''; - for (let i = 0; i < set.length; i++) { - s = s + set[i]; - if (i < set.length - 1) { - s = s + ','; - } - } - return s; - } - - function convertStrToNamespaceSet(str) { - if (str === undefined || str === '') { - return []; - } - let arr = []; - let spliced = str.split(','); - spliced.forEach((v) => { - arr.push(v.trim()); - }); - return arr; - } - - function fetchMachineClusterState() { - if (!$scope.macInputModel || $scope.macInputModel === '') { - return; - } - let mac = $scope.macInputModel.split(':'); - ClusterStateService.fetchClusterUniversalStateSingle($scope.app, mac[0], mac[1]).success(function (data) { - if (data.code == 0 && data.data) { - $scope.loadError = undefined; - $scope.stateVO = data.data; - $scope.stateVO.currentMode = $scope.stateVO.stateInfo.mode; - if ($scope.stateVO.server && $scope.stateVO.server.namespaceSet) { - $scope.stateVO.server.namespaceSetStr = convertSetToString($scope.stateVO.server.namespaceSet); - } - } else { - $scope.stateVO = {}; - if (data.code === UNSUPPORTED_CODE) { - $scope.loadError = {message: '机器 ' + mac[0] + ':' + mac[1] + ' 的 Sentinel 客户端版本不支持集群限流,请升级至 1.4.0 以上版本并引入相关依赖。'} - } else { - $scope.loadError = {message: data.msg}; - } - } - }).error((data, header, config, status) => { - $scope.loadError = {message: '未知错误'}; - }); - } - - fetchMachineClusterState(); - - function checkValidClientConfig(stateVO) { - if (!stateVO.client || !stateVO.client.clientConfig) { - alert('不合法的配置'); - return false; - } - let config = stateVO.client.clientConfig; - if (!config.serverHost || config.serverHost.trim() == '') { - alert('请输入有效的 Token Server IP'); - return false; - } - if (config.serverPort === undefined || config.serverPort <= 0 || config.serverPort > 65535) { - alert('请输入有效的 Token Server 端口'); - return false; - } - if (config.requestTimeout === undefined || config.requestTimeout <= 0) { - alert('请输入有效的请求超时时长'); - return false; - } - return true; - } - - function sendClusterClientRequest(stateVO) { - if (!checkValidClientConfig(stateVO)) { - return; - } - if (!$scope.macInputModel) { - return; - } - let mac = $scope.macInputModel.split(':'); - let request = { - app: $scope.app, - ip: mac[0], - port: mac[1], - }; - request.mode = CLUSTER_MODE_CLIENT; - request.clientConfig = stateVO.client.clientConfig; - ClusterStateService.modifyClusterConfig(request).success(function (data) { - if (data.code == 0 && data.data) { - alert('修改集群限流客户端配置成功'); - window.location.reload(); - } else { - if (data.code === UNSUPPORTED_CODE) { - alert('机器 ' + mac[0] + ':' + mac[1] + ' 的 Sentinel 客户端版本不支持集群限流客户端,请升级至 1.4.0 以上版本并引入相关依赖。'); - } else { - alert('修改失败:' + data.msg); - } - } - }).error((data, header, config, status) => { - alert('未知错误'); - }); - } - - function checkValidServerConfig(stateVO) { - if (!stateVO.server || !stateVO.server.transport) { - alert('不合法的配置'); - return false; - } - if (stateVO.server.namespaceSetStr === undefined || stateVO.server.namespaceSetStr == '') { - alert('请输入有效的命名空间集合(多个 namespace 以 , 分隔)'); - return false; - } - let transportConfig = stateVO.server.transport; - if (transportConfig.port === undefined || transportConfig.port <= 0 || transportConfig.port > 65535) { - alert('请输入有效的 Token Server 端口'); - return false; - } - let flowConfig = stateVO.server.flow; - if (flowConfig.maxAllowedQps === undefined || flowConfig.maxAllowedQps < 0) { - alert('请输入有效的最大允许 QPS'); - return false; - } - // if (transportConfig.idleSeconds === undefined || transportConfig.idleSeconds <= 0) { - // alert('请输入有效的连接清理时长 (idleSeconds)'); - // return false; - // } - return true; - } - - function sendClusterServerRequest(stateVO) { - if (!checkValidServerConfig(stateVO)) { - return; - } - if (!$scope.macInputModel) { - return; - } - let mac = $scope.macInputModel.split(':'); - let request = { - app: $scope.app, - ip: mac[0], - port: mac[1], - }; - request.mode = CLUSTER_MODE_SERVER; - request.flowConfig = stateVO.server.flow; - request.transportConfig = stateVO.server.transport; - request.namespaceSet = convertStrToNamespaceSet(stateVO.server.namespaceSetStr); - ClusterStateService.modifyClusterConfig(request).success(function (data) { - if (data.code == 0 && data.data) { - alert('修改集群限流服务端配置成功'); - window.location.reload(); - } else { - if (data.code === UNSUPPORTED_CODE) { - alert('机器 ' + mac[0] + ':' + mac[1] + ' 的 Sentinel 客户端版本不支持集群限流服务端,请升级至 1.4.0 以上版本并引入相关依赖。'); - } else { - alert('修改失败:' + data.msg); - } - } - }).error((data, header, config, status) => { - alert('未知错误'); - }); - } - - - $scope.saveConfig = () => { - let ok = confirm('是否确定修改集群限流配置?'); - if (!ok) { - return; - } - let mode = $scope.stateVO.stateInfo.mode; - if (mode != 1 && mode != 0) { - alert('未知的集群限流模式'); - return; - } - if (mode == 0) { - sendClusterClientRequest($scope.stateVO); - } else { - sendClusterServerRequest($scope.stateVO); - } - }; - - function queryAppMachines() { - MachineService.getAppMachines($scope.app).success( - function (data) { - if (data.code === 0) { - // $scope.machines = data.data; - if (data.data) { - $scope.machines = []; - $scope.macsInputOptionsOrigin = []; - $scope.macsInputOptions = []; - data.data.forEach(function (item) { - if (item.healthy) { - $scope.macsInputOptionsOrigin.push({ - text: item.ip + ':' + item.port, - value: item.ip + ':' + item.port - }); - } - }); - $scope.macsInputOptions = $scope.macsInputOptionsOrigin; - } - if ($scope.macsInputOptions.length > 0) { - $scope.macInputModel = $scope.macsInputOptions[0].value; - } - } else { - $scope.macsInputOptions = []; - } - } - ); - } - queryAppMachines(); - - $scope.$watch('searchKey', function () { - if (!$scope.macsInputOptions) { - return; - } - if ($scope.searchKey) { - $scope.macsInputOptions = $scope.macsInputOptionsOrigin - .filter((e) => e.value.indexOf($scope.searchKey) !== -1); - } else { - $scope.macsInputOptions = $scope.macsInputOptionsOrigin; - } - if ($scope.macsInputOptions.length > 0) { - $scope.macInputModel = $scope.macsInputOptions[0].value; - } else { - $scope.macInputModel = ''; - } - }); - - $scope.$watch('macInputModel', function () { - if ($scope.macInputModel) { - fetchMachineClusterState(); - } - }); - }]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/degrade.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/degrade.js deleted file mode 100644 index d2eac6da..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/degrade.js +++ /dev/null @@ -1,204 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.controller('DegradeCtl', ['$scope', '$stateParams', 'DegradeService', 'ngDialog', 'MachineService', - function ($scope, $stateParams, DegradeService, ngDialog, MachineService) { - //初始化 - $scope.app = $stateParams.app; - $scope.rulesPageConfig = { - pageSize: 10, - currentPageIndex: 1, - totalPage: 1, - totalCount: 0, - }; - $scope.macsInputConfig = { - searchField: ['text', 'value'], - persist: true, - create: false, - maxItems: 1, - render: { - item: function (data, escape) { - return '
' + escape(data.text) + '
'; - } - }, - onChange: function (value, oldValue) { - $scope.macInputModel = value; - } - }; - getMachineRules(); - function getMachineRules() { - if (!$scope.macInputModel) { - return; - } - var mac = $scope.macInputModel.split(':'); - DegradeService.queryMachineRules($scope.app, mac[0], mac[1]).success( - function (data) { - if (data.code == 0 && data.data) { - $scope.rules = data.data; - $scope.rulesPageConfig.totalCount = $scope.rules.length; - } else { - $scope.rules = []; - $scope.rulesPageConfig.totalCount = 0; - } - }); - }; - $scope.getMachineRules = getMachineRules; - - var degradeRuleDialog; - $scope.editRule = function (rule) { - $scope.currentRule = angular.copy(rule); - $scope.degradeRuleDialog = { - title: '编辑降级规则', - type: 'edit', - confirmBtnText: '保存' - }; - degradeRuleDialog = ngDialog.open({ - template: '/app/views/dialog/degrade-rule-dialog.html', - width: 680, - overlay: true, - scope: $scope - }); - }; - - $scope.addNewRule = function () { - var mac = $scope.macInputModel.split(':'); - $scope.currentRule = { - grade: 0, - app: $scope.app, - ip: mac[0], - port: mac[1], - limitApp: 'default', - minRequestAmount: 5, - statIntervalMs: 1000, - }; - $scope.degradeRuleDialog = { - title: '新增降级规则', - type: 'add', - confirmBtnText: '新增' - }; - degradeRuleDialog = ngDialog.open({ - template: '/app/views/dialog/degrade-rule-dialog.html', - width: 680, - overlay: true, - scope: $scope - }); - }; - - $scope.saveRule = function () { - if (!DegradeService.checkRuleValid($scope.currentRule)) { - return; - } - if ($scope.degradeRuleDialog.type === 'add') { - addNewRule($scope.currentRule); - } else if ($scope.degradeRuleDialog.type === 'edit') { - saveRule($scope.currentRule, true); - } - }; - - function parseDegradeMode(grade) { - switch (grade) { - case 0: - return '慢调用比例'; - case 1: - return '异常比例'; - case 2: - return '异常数'; - default: - return '未知'; - } - } - - var confirmDialog; - $scope.deleteRule = function (rule) { - $scope.currentRule = rule; - $scope.confirmDialog = { - title: '删除降级规则', - type: 'delete_rule', - attentionTitle: '请确认是否删除如下降级规则', - attention: '资源名: ' + rule.resource + - ', 降级模式: ' + parseDegradeMode(rule.grade) + ', 阈值: ' + rule.count, - confirmBtnText: '删除', - }; - confirmDialog = ngDialog.open({ - template: '/app/views/dialog/confirm-dialog.html', - scope: $scope, - overlay: true - }); - }; - - $scope.confirm = function () { - if ($scope.confirmDialog.type == 'delete_rule') { - deleteRule($scope.currentRule); - } else { - console.error('error'); - } - }; - - function deleteRule(rule) { - DegradeService.deleteRule(rule).success(function (data) { - if (data.code == 0) { - getMachineRules(); - confirmDialog.close(); - } else { - alert('失败:' + data.msg); - } - }); - }; - - function addNewRule(rule) { - DegradeService.newRule(rule).success(function (data) { - if (data.code == 0) { - getMachineRules(); - degradeRuleDialog.close(); - } else { - alert('失败:' + data.msg); - } - }); - }; - - function saveRule(rule, edit) { - DegradeService.saveRule(rule).success(function (data) { - if (data.code == 0) { - getMachineRules(); - if (edit) { - degradeRuleDialog.close(); - } else { - confirmDialog.close(); - } - } else { - alert('失败:' + data.msg); - } - }); - } - queryAppMachines(); - function queryAppMachines() { - MachineService.getAppMachines($scope.app).success( - function (data) { - if (data.code == 0) { - // $scope.machines = data.data; - if (data.data) { - $scope.machines = []; - $scope.macsInputOptions = []; - data.data.forEach(function (item) { - if (item.healthy) { - $scope.macsInputOptions.push({ - text: item.ip + ':' + item.port, - value: item.ip + ':' + item.port - }); - } - }); - } - if ($scope.macsInputOptions.length > 0) { - $scope.macInputModel = $scope.macsInputOptions[0].value; - } - } else { - $scope.macsInputOptions = []; - } - } - ); - }; - $scope.$watch('macInputModel', function () { - if ($scope.macInputModel) { - getMachineRules(); - } - }); - }]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/flow_v1.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/flow_v1.js deleted file mode 100644 index 3c644937..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/flow_v1.js +++ /dev/null @@ -1,220 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.controller('FlowControllerV1', ['$scope', '$stateParams', 'FlowServiceV1', 'ngDialog', - 'MachineService', - function ($scope, $stateParams, FlowService, ngDialog, - MachineService) { - $scope.app = $stateParams.app; - - $scope.rulesPageConfig = { - pageSize: 10, - currentPageIndex: 1, - totalPage: 1, - totalCount: 0, - }; - $scope.macsInputConfig = { - searchField: ['text', 'value'], - persist: true, - create: false, - maxItems: 1, - render: { - item: function (data, escape) { - return '
' + escape(data.text) + '
'; - } - }, - onChange: function (value, oldValue) { - $scope.macInputModel = value; - } - }; - - $scope.generateThresholdTypeShow = (rule) => { - if (!rule.clusterMode) { - return '单机'; - } - if (rule.clusterConfig.thresholdType === 0) { - return '集群均摊'; - } else if (rule.clusterConfig.thresholdType === 1) { - return '集群总体'; - } else { - return '集群'; - } - }; - - getMachineRules(); - function getMachineRules() { - if (!$scope.macInputModel) { - return; - } - var mac = $scope.macInputModel.split(':'); - FlowService.queryMachineRules($scope.app, mac[0], mac[1]).success( - function (data) { - if (data.code == 0 && data.data) { - $scope.rules = data.data; - $scope.rulesPageConfig.totalCount = $scope.rules.length; - } else { - $scope.rules = []; - $scope.rulesPageConfig.totalCount = 0; - } - }); - }; - $scope.getMachineRules = getMachineRules; - - var flowRuleDialog; - $scope.editRule = function (rule) { - $scope.currentRule = angular.copy(rule); - $scope.flowRuleDialog = { - title: '编辑流控规则', - type: 'edit', - confirmBtnText: '保存', - showAdvanceButton: rule.controlBehavior == 0 && rule.strategy == 0 - }; - flowRuleDialog = ngDialog.open({ - template: '/app/views/dialog/flow-rule-dialog.html', - width: 680, - overlay: true, - scope: $scope - }); - }; - - $scope.addNewRule = function () { - var mac = $scope.macInputModel.split(':'); - $scope.currentRule = { - grade: 1, - strategy: 0, - controlBehavior: 0, - app: $scope.app, - ip: mac[0], - port: mac[1], - limitApp: 'default', - clusterMode: false, - clusterConfig: { - thresholdType: 0 - } - }; - $scope.flowRuleDialog = { - title: '新增流控规则', - type: 'add', - confirmBtnText: '新增', - showAdvanceButton: true, - }; - flowRuleDialog = ngDialog.open({ - template: '/app/views/dialog/flow-rule-dialog.html', - width: 680, - overlay: true, - scope: $scope - }); - }; - - $scope.saveRule = function () { - if (!FlowService.checkRuleValid($scope.currentRule)) { - return; - } - if ($scope.flowRuleDialog.type === 'add') { - addNewRule($scope.currentRule); - } else if ($scope.flowRuleDialog.type === 'edit') { - saveRule($scope.currentRule, true); - } - }; - - var confirmDialog; - $scope.deleteRule = function (rule) { - $scope.currentRule = rule; - $scope.confirmDialog = { - title: '删除流控规则', - type: 'delete_rule', - attentionTitle: '请确认是否删除如下流控规则', - attention: '资源名: ' + rule.resource + ', 流控应用: ' + rule.limitApp - + ', 阈值类型: ' + (rule.grade == 0 ? '线程数' : 'QPS') + ', 阈值: ' + rule.count, - confirmBtnText: '删除', - }; - confirmDialog = ngDialog.open({ - template: '/app/views/dialog/confirm-dialog.html', - scope: $scope, - overlay: true - }); - }; - - $scope.confirm = function () { - if ($scope.confirmDialog.type === 'delete_rule') { - deleteRule($scope.currentRule); - } else { - console.error('error'); - } - }; - - function deleteRule(rule) { - FlowService.deleteRule(rule).success(function (data) { - if (data.code == 0) { - getMachineRules(); - confirmDialog.close(); - } else { - alert('失败:' + data.msg); - } - }); - }; - - function addNewRule(rule) { - FlowService.newRule(rule).success(function (data) { - if (data.code === 0) { - getMachineRules(); - flowRuleDialog.close(); - } else { - alert('失败:' + data.msg); - } - }); - }; - - $scope.onOpenAdvanceClick = function () { - $scope.flowRuleDialog.showAdvanceButton = false; - }; - $scope.onCloseAdvanceClick = function () { - $scope.flowRuleDialog.showAdvanceButton = true; - }; - - function saveRule(rule, edit) { - FlowService.saveRule(rule).success(function (data) { - if (data.code === 0) { - getMachineRules(); - if (edit) { - flowRuleDialog.close(); - } else { - confirmDialog.close(); - } - } else { - alert('失败:' + data.msg); - } - }); - } - queryAppMachines(); - function queryAppMachines() { - MachineService.getAppMachines($scope.app).success( - function (data) { - if (data.code == 0) { - // $scope.machines = data.data; - if (data.data) { - $scope.machines = []; - $scope.macsInputOptions = []; - data.data.forEach(function (item) { - if (item.healthy) { - $scope.macsInputOptions.push({ - text: item.ip + ':' + item.port, - value: item.ip + ':' + item.port - }); - } - }); - } - if ($scope.macsInputOptions.length > 0) { - $scope.macInputModel = $scope.macsInputOptions[0].value; - } - } else { - $scope.macsInputOptions = []; - } - } - ); - }; - $scope.$watch('macInputModel', function () { - if ($scope.macInputModel) { - getMachineRules(); - } - }); - }]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/flow_v2.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/flow_v2.js deleted file mode 100644 index 3280675b..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/flow_v2.js +++ /dev/null @@ -1,221 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.controller('FlowControllerV2', ['$scope', '$stateParams', 'FlowServiceV2', 'ngDialog', - 'MachineService', - function ($scope, $stateParams, FlowService, ngDialog, - MachineService) { - $scope.app = $stateParams.app; - - $scope.rulesPageConfig = { - pageSize: 10, - currentPageIndex: 1, - totalPage: 1, - totalCount: 0, - }; - $scope.macsInputConfig = { - searchField: ['text', 'value'], - persist: true, - create: false, - maxItems: 1, - render: { - item: function (data, escape) { - return '
' + escape(data.text) + '
'; - } - }, - onChange: function (value, oldValue) { - $scope.macInputModel = value; - } - }; - - $scope.generateThresholdTypeShow = (rule) => { - if (!rule.clusterMode) { - return '单机'; - } - if (rule.clusterConfig.thresholdType === 0) { - return '集群均摊'; - } else if (rule.clusterConfig.thresholdType === 1) { - return '集群总体'; - } else { - return '集群'; - } - }; - - getMachineRules(); - function getMachineRules() { - if (!$scope.macInputModel) { - return; - } - var mac = $scope.macInputModel.split(':'); - FlowService.queryMachineRules($scope.app, mac[0], mac[1]).success( - function (data) { - if (data.code == 0 && data.data) { - $scope.rules = data.data; - $scope.rulesPageConfig.totalCount = $scope.rules.length; - } else { - $scope.rules = []; - $scope.rulesPageConfig.totalCount = 0; - } - }); - }; - $scope.getMachineRules = getMachineRules; - - var flowRuleDialog; - $scope.editRule = function (rule) { - $scope.currentRule = angular.copy(rule); - $scope.flowRuleDialog = { - title: '编辑流控规则', - type: 'edit', - confirmBtnText: '保存', - showAdvanceButton: rule.controlBehavior == 0 && rule.strategy == 0 - }; - flowRuleDialog = ngDialog.open({ - template: '/app/views/dialog/flow-rule-dialog.html', - width: 680, - overlay: true, - scope: $scope - }); - }; - - $scope.addNewRule = function () { - var mac = $scope.macInputModel.split(':'); - $scope.currentRule = { - grade: 1, - strategy: 0, - controlBehavior: 0, - app: $scope.app, - ip: mac[0], - port: mac[1], - limitApp: 'default', - clusterMode: false, - clusterConfig: { - thresholdType: 0, - fallbackToLocalWhenFail: true - } - }; - $scope.flowRuleDialog = { - title: '新增流控规则', - type: 'add', - confirmBtnText: '新增', - showAdvanceButton: true, - }; - flowRuleDialog = ngDialog.open({ - template: '/app/views/dialog/flow-rule-dialog.html', - width: 680, - overlay: true, - scope: $scope - }); - }; - - $scope.saveRule = function () { - if (!FlowService.checkRuleValid($scope.currentRule)) { - return; - } - if ($scope.flowRuleDialog.type === 'add') { - addNewRule($scope.currentRule); - } else if ($scope.flowRuleDialog.type === 'edit') { - saveRule($scope.currentRule, true); - } - }; - - var confirmDialog; - $scope.deleteRule = function (rule) { - $scope.currentRule = rule; - $scope.confirmDialog = { - title: '删除流控规则', - type: 'delete_rule', - attentionTitle: '请确认是否删除如下流控规则', - attention: '资源名: ' + rule.resource + ', 流控应用: ' + rule.limitApp - + ', 阈值类型: ' + (rule.grade == 0 ? '线程数' : 'QPS') + ', 阈值: ' + rule.count, - confirmBtnText: '删除', - }; - confirmDialog = ngDialog.open({ - template: '/app/views/dialog/confirm-dialog.html', - scope: $scope, - overlay: true - }); - }; - - $scope.confirm = function () { - if ($scope.confirmDialog.type === 'delete_rule') { - deleteRule($scope.currentRule); - } else { - console.error('error'); - } - }; - - function deleteRule(rule) { - FlowService.deleteRule(rule).success(function (data) { - if (data.code == 0) { - getMachineRules(); - confirmDialog.close(); - } else { - alert('失败!'); - } - }); - }; - - function addNewRule(rule) { - FlowService.newRule(rule).success(function (data) { - if (data.code == 0) { - getMachineRules(); - flowRuleDialog.close(); - } else { - alert('失败!'); - } - }); - }; - - $scope.onOpenAdvanceClick = function () { - $scope.flowRuleDialog.showAdvanceButton = false; - }; - $scope.onCloseAdvanceClick = function () { - $scope.flowRuleDialog.showAdvanceButton = true; - }; - - function saveRule(rule, edit) { - FlowService.saveRule(rule).success(function (data) { - if (data.code == 0) { - getMachineRules(); - if (edit) { - flowRuleDialog.close(); - } else { - confirmDialog.close(); - } - } else { - alert('失败!'); - } - }); - } - queryAppMachines(); - function queryAppMachines() { - MachineService.getAppMachines($scope.app).success( - function (data) { - if (data.code == 0) { - // $scope.machines = data.data; - if (data.data) { - $scope.machines = []; - $scope.macsInputOptions = []; - data.data.forEach(function (item) { - if (item.healthy) { - $scope.macsInputOptions.push({ - text: item.ip + ':' + item.port, - value: item.ip + ':' + item.port - }); - } - }); - } - if ($scope.macsInputOptions.length > 0) { - $scope.macInputModel = $scope.macsInputOptions[0].value; - } - } else { - $scope.macsInputOptions = []; - } - } - ); - }; - $scope.$watch('macInputModel', function () { - if ($scope.macInputModel) { - getMachineRules(); - } - }); - }]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/gateway/api.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/gateway/api.js deleted file mode 100644 index ccf2497c..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/gateway/api.js +++ /dev/null @@ -1,245 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.controller('GatewayApiCtl', ['$scope', '$stateParams', 'GatewayApiService', 'ngDialog', 'MachineService', - function ($scope, $stateParams, GatewayApiService, ngDialog, MachineService) { - $scope.app = $stateParams.app; - - $scope.apisPageConfig = { - pageSize: 10, - currentPageIndex: 1, - totalPage: 1, - totalCount: 0, - }; - - $scope.macsInputConfig = { - searchField: ['text', 'value'], - persist: true, - create: false, - maxItems: 1, - render: { - item: function (data, escape) { - return '
' + escape(data.text) + '
'; - } - }, - onChange: function (value, oldValue) { - $scope.macInputModel = value; - } - }; - - getApis(); - function getApis() { - if (!$scope.macInputModel) { - return; - } - - var mac = $scope.macInputModel.split(':'); - GatewayApiService.queryApis($scope.app, mac[0], mac[1]).success( - function (data) { - if (data.code == 0 && data.data) { - // To merge rows for api who has more than one predicateItems, here we build data manually - $scope.apis = []; - - data.data.forEach(function(api) { - api["predicateItems"].forEach(function (item, index) { - var newItem = {}; - newItem["id"] = api["id"]; - newItem["app"] = api["app"]; - newItem["ip"] = api["ip"]; - newItem["port"] = api["port"]; - newItem["apiName"] = api["apiName"]; - newItem["pattern"] = item["pattern"]; - newItem["matchStrategy"] = item["matchStrategy"]; - // The itemSize indicates how many rows to merge, by using rowspan="{{api.itemSize}}" in tag - newItem["itemSize"] = api["predicateItems"].length; - // Mark the flag of first item to zero, indicates the start row to merge - newItem["firstFlag"] = index == 0 ? 0 : 1; - // Still hold the data of predicateItems, in order to bind data in edit dialog html - newItem["predicateItems"] = api["predicateItems"]; - $scope.apis.push(newItem); - }); - }); - - $scope.apisPageConfig.totalCount = data.data.length; - } else { - $scope.apis = []; - $scope.apisPageConfig.totalCount = 0; - } - }); - }; - $scope.getApis = getApis; - - var gatewayApiDialog; - $scope.editApi = function (api) { - $scope.currentApi = angular.copy(api); - $scope.gatewayApiDialog = { - title: '编辑自定义 API', - type: 'edit', - confirmBtnText: '保存' - }; - gatewayApiDialog = ngDialog.open({ - template: '/app/views/dialog/gateway/api-dialog.html', - width: 900, - overlay: true, - scope: $scope - }); - }; - - $scope.addNewApi = function () { - var mac = $scope.macInputModel.split(':'); - $scope.currentApi = { - grade: 0, - app: $scope.app, - ip: mac[0], - port: mac[1], - predicateItems: [{matchStrategy: 0, pattern: ''}] - }; - $scope.gatewayApiDialog = { - title: '新增自定义 API', - type: 'add', - confirmBtnText: '新增' - }; - gatewayApiDialog = ngDialog.open({ - template: '/app/views/dialog/gateway/api-dialog.html', - width: 900, - overlay: true, - scope: $scope - }); - }; - - $scope.saveApi = function () { - var apiNames = []; - if ($scope.gatewayApiDialog.type === 'add') { - apiNames = $scope.apis.map(function (item, index, array) { - return item["apiName"]; - }).filter(function (item, index, array) { - return array.indexOf(item) === index; - }); - } - - if (!GatewayApiService.checkApiValid($scope.currentApi, apiNames)) { - return; - } - - if ($scope.gatewayApiDialog.type === 'add') { - addNewApi($scope.currentApi); - } else if ($scope.gatewayApiDialog.type === 'edit') { - saveApi($scope.currentApi, true); - } - }; - - function addNewApi(api) { - GatewayApiService.newApi(api).success(function (data) { - if (data.code == 0) { - getApis(); - gatewayApiDialog.close(); - } else { - alert('新增自定义API失败!' + data.msg); - } - }); - }; - - function saveApi(api, edit) { - GatewayApiService.saveApi(api).success(function (data) { - if (data.code == 0) { - getApis(); - if (edit) { - gatewayApiDialog.close(); - } else { - confirmDialog.close(); - } - } else { - alert('修改自定义API失败!' + data.msg); - } - }); - }; - - var confirmDialog; - $scope.deleteApi = function (api) { - $scope.currentApi = api; - $scope.confirmDialog = { - title: '删除自定义API', - type: 'delete_api', - attentionTitle: '请确认是否删除如下自定义API', - attention: 'API名称: ' + api.apiName, - confirmBtnText: '删除', - }; - confirmDialog = ngDialog.open({ - template: '/app/views/dialog/confirm-dialog.html', - scope: $scope, - overlay: true - }); - }; - - $scope.confirm = function () { - if ($scope.confirmDialog.type == 'delete_api') { - deleteApi($scope.currentApi); - } else { - console.error('error'); - } - }; - - function deleteApi(api) { - GatewayApiService.deleteApi(api).success(function (data) { - if (data.code == 0) { - getApis(); - confirmDialog.close(); - } else { - alert('删除自定义API失败!' + data.msg); - } - }); - }; - - $scope.addNewMatchPattern = function() { - var total; - if ($scope.currentApi.predicateItems == null) { - $scope.currentApi.predicateItems = []; - total = 0; - } else { - total = $scope.currentApi.predicateItems.length; - } - $scope.currentApi.predicateItems.splice(total + 1, 0, {matchStrategy: 0, pattern: ''}); - }; - - $scope.removeMatchPattern = function($index) { - if ($scope.currentApi.predicateItems.length <= 1) { - // Should never happen since no remove button will display when only one predicateItem. - alert('至少有一个匹配规则'); - return; - } - $scope.currentApi.predicateItems.splice($index, 1); - }; - - queryAppMachines(); - function queryAppMachines() { - MachineService.getAppMachines($scope.app).success( - function (data) { - if (data.code == 0) { - // $scope.machines = data.data; - if (data.data) { - $scope.machines = []; - $scope.macsInputOptions = []; - data.data.forEach(function (item) { - if (item.healthy) { - $scope.macsInputOptions.push({ - text: item.ip + ':' + item.port, - value: item.ip + ':' + item.port - }); - } - }); - } - if ($scope.macsInputOptions.length > 0) { - $scope.macInputModel = $scope.macsInputOptions[0].value; - } - } else { - $scope.macsInputOptions = []; - } - } - ); - }; - $scope.$watch('macInputModel', function () { - if ($scope.macInputModel) { - getApis(); - } - }); - }] -); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/gateway/flow.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/gateway/flow.js deleted file mode 100644 index c492cf9c..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/gateway/flow.js +++ /dev/null @@ -1,251 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.controller('GatewayFlowCtl', ['$scope', '$stateParams', 'GatewayFlowService', 'GatewayApiService', 'ngDialog', 'MachineService', - function ($scope, $stateParams, GatewayFlowService, GatewayApiService, ngDialog, MachineService) { - $scope.app = $stateParams.app; - - $scope.rulesPageConfig = { - pageSize: 10, - currentPageIndex: 1, - totalPage: 1, - totalCount: 0, - }; - - $scope.macsInputConfig = { - searchField: ['text', 'value'], - persist: true, - create: false, - maxItems: 1, - render: { - item: function (data, escape) { - return '
' + escape(data.text) + '
'; - } - }, - onChange: function (value, oldValue) { - $scope.macInputModel = value; - } - }; - - getMachineRules(); - function getMachineRules() { - if (!$scope.macInputModel) { - return; - } - - var mac = $scope.macInputModel.split(':'); - GatewayFlowService.queryRules($scope.app, mac[0], mac[1]).success( - function (data) { - if (data.code == 0 && data.data) { - $scope.rules = data.data; - $scope.rulesPageConfig.totalCount = $scope.rules.length; - } else { - $scope.rules = []; - $scope.rulesPageConfig.totalCount = 0; - } - }); - }; - $scope.getMachineRules = getMachineRules; - - getApiNames(); - function getApiNames() { - if (!$scope.macInputModel) { - return; - } - - var mac = $scope.macInputModel.split(':'); - GatewayApiService.queryApis($scope.app, mac[0], mac[1]).success( - function (data) { - if (data.code == 0 && data.data) { - $scope.apiNames = []; - - data.data.forEach(function (api) { - $scope.apiNames.push(api["apiName"]); - }); - } - }); - } - - $scope.intervalUnits = [{val: 0, desc: '秒'}, {val: 1, desc: '分'}, {val: 2, desc: '时'}, {val: 3, desc: '天'}]; - - var gatewayFlowRuleDialog; - $scope.editRule = function (rule) { - $scope.currentRule = angular.copy(rule); - $scope.gatewayFlowRuleDialog = { - title: '编辑网关流控规则', - type: 'edit', - confirmBtnText: '保存' - }; - gatewayFlowRuleDialog = ngDialog.open({ - template: '/app/views/dialog/gateway/flow-rule-dialog.html', - width: 780, - overlay: true, - scope: $scope - }); - }; - - $scope.addNewRule = function () { - var mac = $scope.macInputModel.split(':'); - $scope.currentRule = { - grade: 1, - app: $scope.app, - ip: mac[0], - port: mac[1], - resourceMode: 0, - interval: 1, - intervalUnit: 0, - controlBehavior: 0, - burst: 0, - maxQueueingTimeoutMs: 0 - }; - - $scope.gatewayFlowRuleDialog = { - title: '新增网关流控规则', - type: 'add', - confirmBtnText: '新增' - }; - - gatewayFlowRuleDialog = ngDialog.open({ - template: '/app/views/dialog/gateway/flow-rule-dialog.html', - width: 780, - overlay: true, - scope: $scope - }); - }; - - $scope.saveRule = function () { - if (!GatewayFlowService.checkRuleValid($scope.currentRule)) { - return; - } - if ($scope.gatewayFlowRuleDialog.type === 'add') { - addNewRule($scope.currentRule); - } else if ($scope.gatewayFlowRuleDialog.type === 'edit') { - saveRule($scope.currentRule, true); - } - }; - - $scope.useRouteID = function() { - $scope.currentRule.resource = ''; - }; - - $scope.useCustormAPI = function() { - $scope.currentRule.resource = ''; - }; - - $scope.useParamItem = function () { - $scope.currentRule.paramItem = { - parseStrategy: 0, - matchStrategy: 0 - }; - }; - - $scope.notUseParamItem = function () { - $scope.currentRule.paramItem = null; - }; - - $scope.useParamItemVal = function() { - $scope.currentRule.paramItem.pattern = ""; - $scope.currentRule.paramItem.matchStrategy = 0; - }; - - $scope.notUseParamItemVal = function() { - $scope.currentRule.paramItem.pattern = null; - $scope.currentRule.paramItem.matchStrategy = null; - }; - - function addNewRule(rule) { - GatewayFlowService.newRule(rule).success(function (data) { - if (data.code == 0) { - getMachineRules(); - gatewayFlowRuleDialog.close(); - } else { - alert('新增网关流控规则失败!' + data.msg); - } - }); - }; - - function saveRule(rule, edit) { - GatewayFlowService.saveRule(rule).success(function (data) { - if (data.code == 0) { - getMachineRules(); - if (edit) { - gatewayFlowRuleDialog.close(); - } else { - confirmDialog.close(); - } - } else { - alert('修改网关流控规则失败!' + data.msg); - } - }); - }; - - var confirmDialog; - $scope.deleteRule = function (rule) { - $scope.currentRule = rule; - $scope.confirmDialog = { - title: '删除网关流控规则', - type: 'delete_rule', - attentionTitle: '请确认是否删除如下规则', - attention: 'API名称: ' + rule.resource + ', ' + (rule.grade == 1 ? 'QPS阈值' : '线程数') + ': ' + rule.count, - confirmBtnText: '删除', - }; - confirmDialog = ngDialog.open({ - template: '/app/views/dialog/confirm-dialog.html', - scope: $scope, - overlay: true - }); - }; - - $scope.confirm = function () { - if ($scope.confirmDialog.type == 'delete_rule') { - deleteRule($scope.currentRule); - } else { - console.error('error'); - } - }; - - function deleteRule(rule) { - GatewayFlowService.deleteRule(rule).success(function (data) { - if (data.code == 0) { - getMachineRules(); - confirmDialog.close(); - } else { - alert('删除网关流控规则失败!' + data.msg); - } - }); - }; - - queryAppMachines(); - - function queryAppMachines() { - MachineService.getAppMachines($scope.app).success( - function (data) { - if (data.code == 0) { - if (data.data) { - $scope.machines = []; - $scope.macsInputOptions = []; - data.data.forEach(function (item) { - if (item.healthy) { - $scope.macsInputOptions.push({ - text: item.ip + ':' + item.port, - value: item.ip + ':' + item.port - }); - } - }); - } - if ($scope.macsInputOptions.length > 0) { - $scope.macInputModel = $scope.macsInputOptions[0].value; - } - } else { - $scope.macsInputOptions = []; - } - } - ); - }; - $scope.$watch('macInputModel', function () { - if ($scope.macInputModel) { - getMachineRules(); - getApiNames(); - } - }); - }] -); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/gateway/identity.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/gateway/identity.js deleted file mode 100644 index 52871b4a..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/gateway/identity.js +++ /dev/null @@ -1,299 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.controller('GatewayIdentityCtl', ['$scope', '$stateParams', 'IdentityService', - 'ngDialog', 'GatewayFlowService', 'GatewayApiService', 'DegradeService', 'MachineService', - '$interval', '$location', '$timeout', - function ($scope, $stateParams, IdentityService, ngDialog, - GatewayFlowService, GatewayApiService, DegradeService, MachineService, $interval, $location, $timeout) { - - $scope.app = $stateParams.app; - - $scope.currentPage = 1; - $scope.pageSize = 16; - $scope.totalPage = 1; - $scope.totalCount = 0; - $scope.identities = []; - - $scope.searchKey = ''; - - $scope.macsInputConfig = { - searchField: ['text', 'value'], - persist: true, - create: false, - maxItems: 1, - render: { - item: function (data, escape) { - return '
' + escape(data.text) + '
'; - } - }, - onChange: function (value, oldValue) { - $scope.macInputModel = value; - } - }; - $scope.table = null; - - getApiNames(); - function getApiNames() { - if (!$scope.macInputModel) { - return; - } - - var mac = $scope.macInputModel.split(':'); - GatewayApiService.queryApis($scope.app, mac[0], mac[1]).success( - function (data) { - if (data.code == 0 && data.data) { - $scope.apiNames = []; - - data.data.forEach(function (api) { - $scope.apiNames.push(api["apiName"]); - }); - } - }); - } - - var gatewayFlowRuleDialog; - var gatewayFlowRuleDialogScope; - $scope.addNewGatewayFlowRule = function (resource) { - if (!$scope.macInputModel) { - return; - } - var mac = $scope.macInputModel.split(':'); - gatewayFlowRuleDialogScope = $scope.$new(true); - - gatewayFlowRuleDialogScope.apiNames = $scope.apiNames; - - gatewayFlowRuleDialogScope.intervalUnits = [{val: 0, desc: '秒'}, {val: 1, desc: '分'}, {val: 2, desc: '时'}, {val: 3, desc: '天'}]; - - gatewayFlowRuleDialogScope.currentRule = { - grade: 1, - app: $scope.app, - ip: mac[0], - port: mac[1], - resourceMode: gatewayFlowRuleDialogScope.apiNames.indexOf(resource) == -1 ? 0 : 1, - resource: resource, - interval: 1, - intervalUnit: 0, - controlBehavior: 0, - burst: 0, - maxQueueingTimeoutMs: 0 - }; - - gatewayFlowRuleDialogScope.gatewayFlowRuleDialog = { - title: '新增网关流控规则', - type: 'add', - confirmBtnText: '新增', - saveAndContinueBtnText: '新增并继续添加', - showAdvanceButton: true - }; - - gatewayFlowRuleDialogScope.useRouteID = function() { - gatewayFlowRuleDialogScope.currentRule.resource = ''; - }; - - gatewayFlowRuleDialogScope.useCustormAPI = function() { - gatewayFlowRuleDialogScope.currentRule.resource = ''; - }; - - gatewayFlowRuleDialogScope.useParamItem = function () { - gatewayFlowRuleDialogScope.currentRule.paramItem = { - parseStrategy: 0, - matchStrategy: 0 - }; - }; - - gatewayFlowRuleDialogScope.notUseParamItem = function () { - gatewayFlowRuleDialogScope.currentRule.paramItem = null; - }; - - gatewayFlowRuleDialogScope.useParamItemVal = function() { - gatewayFlowRuleDialogScope.currentRule.paramItem.pattern = ""; - }; - - gatewayFlowRuleDialogScope.notUseParamItemVal = function() { - gatewayFlowRuleDialogScope.currentRule.paramItem.pattern = null; - }; - - gatewayFlowRuleDialogScope.saveRule = saveGatewayFlowRule; - gatewayFlowRuleDialogScope.saveRuleAndContinue = saveGatewayFlowRuleAndContinue; - gatewayFlowRuleDialogScope.onOpenAdvanceClick = function () { - gatewayFlowRuleDialogScope.gatewayFlowRuleDialog.showAdvanceButton = false; - }; - gatewayFlowRuleDialogScope.onCloseAdvanceClick = function () { - gatewayFlowRuleDialogScope.gatewayFlowRuleDialog.showAdvanceButton = true; - }; - - gatewayFlowRuleDialog = ngDialog.open({ - template: '/app/views/dialog/gateway/flow-rule-dialog.html', - width: 780, - overlay: true, - scope: gatewayFlowRuleDialogScope - }); - }; - - function saveGatewayFlowRule() { - if (!GatewayFlowService.checkRuleValid(gatewayFlowRuleDialogScope.currentRule)) { - return; - } - GatewayFlowService.newRule(gatewayFlowRuleDialogScope.currentRule).success(function (data) { - if (data.code === 0) { - gatewayFlowRuleDialog.close(); - let url = '/dashboard/gateway/flow/' + $scope.app; - $location.path(url); - } else { - alert('失败!'); - } - }).error((data, header, config, status) => { - alert('未知错误'); - }); - } - - function saveGatewayFlowRuleAndContinue() { - if (!GatewayFlowService.checkRuleValid(gatewayFlowRuleDialogScope.currentRule)) { - return; - } - GatewayFlowService.newRule(gatewayFlowRuleDialogScope.currentRule).success(function (data) { - if (data.code == 0) { - gatewayFlowRuleDialog.close(); - } else { - alert('失败!'); - } - }); - } - - var degradeRuleDialog; - $scope.addNewDegradeRule = function (resource) { - if (!$scope.macInputModel) { - return; - } - var mac = $scope.macInputModel.split(':'); - degradeRuleDialogScope = $scope.$new(true); - degradeRuleDialogScope.currentRule = { - enable: false, - grade: 0, - strategy: 0, - resource: resource, - limitApp: 'default', - app: $scope.app, - ip: mac[0], - port: mac[1] - }; - - degradeRuleDialogScope.degradeRuleDialog = { - title: '新增降级规则', - type: 'add', - confirmBtnText: '新增', - saveAndContinueBtnText: '新增并继续添加' - }; - degradeRuleDialogScope.saveRule = saveDegradeRule; - degradeRuleDialogScope.saveRuleAndContinue = saveDegradeRuleAndContinue; - - degradeRuleDialog = ngDialog.open({ - template: '/app/views/dialog/degrade-rule-dialog.html', - width: 680, - overlay: true, - scope: degradeRuleDialogScope - }); - }; - - function saveDegradeRule() { - if (!DegradeService.checkRuleValid(degradeRuleDialogScope.currentRule)) { - return; - } - DegradeService.newRule(degradeRuleDialogScope.currentRule).success(function (data) { - if (data.code == 0) { - degradeRuleDialog.close(); - var url = '/dashboard/degrade/' + $scope.app; - $location.path(url); - } else { - alert('失败!'); - } - }); - } - - function saveDegradeRuleAndContinue() { - if (!DegradeService.checkRuleValid(degradeRuleDialogScope.currentRule)) { - return; - } - DegradeService.newRule(degradeRuleDialogScope.currentRule).success(function (data) { - if (data.code == 0) { - degradeRuleDialog.close(); - } else { - alert('失败!'); - } - }); - } - - var searchHandler; - $scope.searchChange = function (searchKey) { - $timeout.cancel(searchHandler); - searchHandler = $timeout(function () { - $scope.searchKey = searchKey; - reInitIdentityDatas(); - }, 600); - }; - - function queryAppMachines() { - MachineService.getAppMachines($scope.app).success( - function (data) { - if (data.code === 0) { - if (data.data) { - $scope.machines = []; - $scope.macsInputOptions = []; - data.data.forEach(function (item) { - if (item.healthy) { - $scope.macsInputOptions.push({ - text: item.ip + ':' + item.port, - value: item.ip + ':' + item.port - }); - } - }); - } - if ($scope.macsInputOptions.length > 0) { - $scope.macInputModel = $scope.macsInputOptions[0].value; - } - } else { - $scope.macsInputOptions = []; - } - } - ); - } - - // Fetch all machines by current app name. - queryAppMachines(); - - $scope.$watch('macInputModel', function () { - if ($scope.macInputModel) { - reInitIdentityDatas(); - } - }); - - $scope.$on('$destroy', function () { - $interval.cancel(intervalId); - }); - - var intervalId; - function reInitIdentityDatas() { - getApiNames(); - queryIdentities(); - }; - - function queryIdentities() { - var mac = $scope.macInputModel.split(':'); - if (mac == null || mac.length < 2) { - return; - } - - IdentityService.fetchClusterNodeOfMachine(mac[0], mac[1], $scope.searchKey).success( - function (data) { - if (data.code == 0 && data.data) { - $scope.identities = data.data; - $scope.totalCount = $scope.identities.length; - } else { - $scope.identities = []; - $scope.totalCount = 0; - } - } - ); - }; - $scope.queryIdentities = queryIdentities; - }]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/home.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/home.js deleted file mode 100644 index 1df5862c..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/home.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @ngdoc function - * @name sentinelDashboardApp.controller:MainCtrl - * @description - * # MainCtrl - * Controller of the sentinelDashboardApp - */ -angular.module('sentinelDashboardApp') - .controller('HomeCtrl', ['$scope', '$position', function ($scope, $position) { - // do noting - }]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/identity.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/identity.js deleted file mode 100644 index 2a14eb1e..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/identity.js +++ /dev/null @@ -1,478 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.controller('IdentityCtl', ['$scope', '$stateParams', 'IdentityService', - 'ngDialog', 'FlowServiceV1', 'DegradeService', 'AuthorityRuleService', 'ParamFlowService', 'MachineService', - '$interval', '$location', '$timeout', - function ($scope, $stateParams, IdentityService, ngDialog, - FlowService, DegradeService, AuthorityRuleService, ParamFlowService, MachineService, $interval, $location, $timeout) { - - $scope.app = $stateParams.app; - - $scope.currentPage = 1; - $scope.pageSize = 16; - $scope.totalPage = 1; - $scope.totalCount = 0; - $scope.identities = []; - // 数据自动刷新频率, 默认10s - var DATA_REFRESH_INTERVAL = 30; - - $scope.isExpand = true; - $scope.searchKey = ''; - $scope.firstExpandAll = false; - $scope.isTreeView = true; - - $scope.macsInputConfig = { - searchField: ['text', 'value'], - persist: true, - create: false, - maxItems: 1, - render: { - item: function (data, escape) { - return '
' + escape(data.text) + '
'; - } - }, - onChange: function (value, oldValue) { - $scope.macInputModel = value; - } - }; - $scope.table = null; - - var flowRuleDialog; - var flowRuleDialogScope; - $scope.addNewFlowRule = function (resource) { - if (!$scope.macInputModel) { - return; - } - var mac = $scope.macInputModel.split(':'); - flowRuleDialogScope = $scope.$new(true); - flowRuleDialogScope.currentRule = { - enable: false, - strategy: 0, - grade: 1, - controlBehavior: 0, - resource: resource, - limitApp: 'default', - clusterMode: false, - clusterConfig: { - thresholdType: 0 - }, - app: $scope.app, - ip: mac[0], - port: mac[1] - }; - - flowRuleDialogScope.flowRuleDialog = { - title: '新增流控规则', - type: 'add', - confirmBtnText: '新增', - saveAndContinueBtnText: '新增并继续添加', - showAdvanceButton: true - }; - // $scope.flowRuleDialog = { - // showAdvanceButton : true - // }; - flowRuleDialogScope.saveRule = saveFlowRule; - flowRuleDialogScope.saveRuleAndContinue = saveFlowRuleAndContinue; - flowRuleDialogScope.onOpenAdvanceClick = function () { - flowRuleDialogScope.flowRuleDialog.showAdvanceButton = false; - }; - flowRuleDialogScope.onCloseAdvanceClick = function () { - flowRuleDialogScope.flowRuleDialog.showAdvanceButton = true; - }; - - flowRuleDialog = ngDialog.open({ - template: '/app/views/dialog/flow-rule-dialog.html', - width: 680, - overlay: true, - scope: flowRuleDialogScope - }); - }; - - function saveFlowRule() { - if (!FlowService.checkRuleValid(flowRuleDialogScope.currentRule)) { - return; - } - FlowService.newRule(flowRuleDialogScope.currentRule).success(function (data) { - if (data.code === 0) { - flowRuleDialog.close(); - let url = '/dashboard/flow/' + $scope.app; - $location.path(url); - } else { - alert('失败:' + data.msg); - } - }).error((data, header, config, status) => { - alert('未知错误'); - }); - } - - function saveFlowRuleAndContinue() { - if (!FlowService.checkRuleValid(flowRuleDialogScope.currentRule)) { - return; - } - FlowService.newRule(flowRuleDialogScope.currentRule).success(function (data) { - if (data.code === 0) { - flowRuleDialog.close(); - } else { - alert('失败:' + data.msg); - } - }); - } - - var degradeRuleDialog; - var degradeRuleDialogScope; - $scope.addNewDegradeRule = function (resource) { - if (!$scope.macInputModel) { - return; - } - var mac = $scope.macInputModel.split(':'); - degradeRuleDialogScope = $scope.$new(true); - degradeRuleDialogScope.currentRule = { - enable: false, - grade: 0, - strategy: 0, - resource: resource, - limitApp: 'default', - minRequestAmount: 5, - statIntervalMs: 1000, - app: $scope.app, - ip: mac[0], - port: mac[1] - }; - - degradeRuleDialogScope.degradeRuleDialog = { - title: '新增降级规则', - type: 'add', - confirmBtnText: '新增', - saveAndContinueBtnText: '新增并继续添加' - }; - degradeRuleDialogScope.saveRule = saveDegradeRule; - degradeRuleDialogScope.saveRuleAndContinue = saveDegradeRuleAndContinue; - - degradeRuleDialog = ngDialog.open({ - template: '/app/views/dialog/degrade-rule-dialog.html', - width: 680, - overlay: true, - scope: degradeRuleDialogScope - }); - }; - - function saveDegradeRule() { - if (!DegradeService.checkRuleValid(degradeRuleDialogScope.currentRule)) { - return; - } - DegradeService.newRule(degradeRuleDialogScope.currentRule).success(function (data) { - if (data.code === 0) { - degradeRuleDialog.close(); - var url = '/dashboard/degrade/' + $scope.app; - $location.path(url); - } else { - alert('失败:' + data.msg); - } - }); - } - - function saveDegradeRuleAndContinue() { - if (!DegradeService.checkRuleValid(degradeRuleDialogScope.currentRule)) { - return; - } - DegradeService.newRule(degradeRuleDialogScope.currentRule).success(function (data) { - if (data.code === 0) { - degradeRuleDialog.close(); - } else { - alert('失败:' + data.msg); - } - }); - } - - let authorityRuleDialog; - let authorityRuleDialogScope; - - function saveAuthorityRule() { - let ruleEntity = authorityRuleDialogScope.currentRule; - if (!AuthorityRuleService.checkRuleValid(ruleEntity.rule)) { - return; - } - AuthorityRuleService.addNewRule(ruleEntity).success((data) => { - if (data.success) { - authorityRuleDialog.close(); - let url = '/dashboard/authority/' + $scope.app; - $location.path(url); - } else { - alert('添加规则失败:' + data.msg); - } - }).error((data) => { - if (data) { - alert('添加规则失败:' + data.msg); - } else { - alert("添加规则失败:未知错误"); - } - }); - } - - function saveAuthorityRuleAndContinue() { - let ruleEntity = authorityRuleDialogScope.currentRule; - if (!AuthorityRuleService.checkRuleValid(ruleEntity.rule)) { - return; - } - AuthorityRuleService.addNewRule(ruleEntity).success((data) => { - if (data.success) { - authorityRuleDialog.close(); - } else { - alert('添加规则失败:' + data.msg); - } - }).error((data) => { - if (data) { - alert('添加规则失败:' + data.msg); - } else { - alert("添加规则失败:未知错误"); - } - }); - } - - $scope.addNewAuthorityRule = function (resource) { - if (!$scope.macInputModel) { - return; - } - let mac = $scope.macInputModel.split(':'); - authorityRuleDialogScope = $scope.$new(true); - authorityRuleDialogScope.currentRule = { - app: $scope.app, - ip: mac[0], - port: mac[1], - rule: { - resource: resource, - strategy: 0, - limitApp: '', - } - }; - - authorityRuleDialogScope.authorityRuleDialog = { - title: '新增授权规则', - type: 'add', - confirmBtnText: '新增', - saveAndContinueBtnText: '新增并继续添加' - }; - authorityRuleDialogScope.saveRule = saveAuthorityRule; - authorityRuleDialogScope.saveRuleAndContinue = saveAuthorityRuleAndContinue; - - authorityRuleDialog = ngDialog.open({ - template: '/app/views/dialog/authority-rule-dialog.html', - width: 680, - overlay: true, - scope: authorityRuleDialogScope - }); - }; - - let paramFlowRuleDialog; - let paramFlowRuleDialogScope; - - function saveParamFlowRule() { - let ruleEntity = paramFlowRuleDialogScope.currentRule; - if (!ParamFlowService.checkRuleValid(ruleEntity.rule)) { - return; - } - ParamFlowService.addNewRule(ruleEntity).success((data) => { - if (data.success) { - paramFlowRuleDialog.close(); - let url = '/dashboard/paramFlow/' + $scope.app; - $location.path(url); - } else { - alert('添加热点规则失败:' + data.msg); - } - }).error((data) => { - if (data) { - alert('添加热点规则失败:' + data.msg); - } else { - alert("添加热点规则失败:未知错误"); - } - }); - } - - function saveParamFlowRuleAndContinue() { - let ruleEntity = paramFlowRuleDialogScope.currentRule; - if (!ParamFlowService.checkRuleValid(ruleEntity.rule)) { - return; - } - ParamFlowService.addNewRule(ruleEntity).success((data) => { - if (data.success) { - paramFlowRuleDialog.close(); - } else { - alert('添加热点规则失败:' + data.msg); - } - }).error((data) => { - if (data) { - alert('添加热点规则失败:' + data.msg); - } else { - alert("添加热点规则失败:未知错误"); - } - }); - } - - $scope.addNewParamFlowRule = function (resource) { - if (!$scope.macInputModel) { - return; - } - let mac = $scope.macInputModel.split(':'); - paramFlowRuleDialogScope = $scope.$new(true); - paramFlowRuleDialogScope.currentRule = { - app: $scope.app, - ip: mac[0], - port: mac[1], - rule: { - resource: resource, - grade: 1, - paramFlowItemList: [], - count: 0, - limitApp: 'default', - controlBehavior: 0, - durationInSec: 1, - burstCount: 0, - maxQueueingTimeMs: 0, - clusterMode: false, - clusterConfig: { - thresholdType: 0, - fallbackToLocalWhenFail: true, - } - } - }; - - paramFlowRuleDialogScope.paramFlowRuleDialog = { - title: '新增热点规则', - type: 'add', - confirmBtnText: '新增', - saveAndContinueBtnText: '新增并继续添加', - supportAdvanced: false, - showAdvanceButton: true - }; - paramFlowRuleDialogScope.saveRule = saveParamFlowRule; - paramFlowRuleDialogScope.saveRuleAndContinue = saveParamFlowRuleAndContinue; - // paramFlowRuleDialogScope.onOpenAdvanceClick = function () { - // paramFlowRuleDialogScope.paramFlowRuleDialog.showAdvanceButton = false; - // }; - // paramFlowRuleDialogScope.onCloseAdvanceClick = function () { - // paramFlowRuleDialogScope.paramFlowRuleDialog.showAdvanceButton = true; - // }; - - paramFlowRuleDialog = ngDialog.open({ - template: '/app/views/dialog/param-flow-rule-dialog.html', - width: 680, - overlay: true, - scope: paramFlowRuleDialogScope - }); - }; - - var searchHandler; - $scope.searchChange = function (searchKey) { - $timeout.cancel(searchHandler); - searchHandler = $timeout(function () { - $scope.searchKey = searchKey; - $scope.isExpand = true; - $scope.firstExpandAll = true; - reInitIdentityDatas(); - $scope.firstExpandAll = false; - }, 600); - }; - - $scope.initTreeTable = function () { - // if (!$scope.table) { - com_github_culmat_jsTreeTable.register(window); - $scope.table = window.treeTable($('#identities')); - // } - }; - - $scope.expandAll = function () { - $scope.isExpand = true; - }; - $scope.collapseAll = function () { - $scope.isExpand = false; - }; - $scope.treeView = function () { - $scope.isTreeView = true; - queryIdentities(); - }; - $scope.listView = function () { - $scope.isTreeView = false; - queryIdentities(); - }; - - function queryAppMachines() { - MachineService.getAppMachines($scope.app).success( - function (data) { - if (data.code === 0) { - if (data.data) { - $scope.machines = []; - $scope.macsInputOptions = []; - data.data.forEach(function (item) { - if (item.healthy) { - $scope.macsInputOptions.push({ - text: item.ip + ':' + item.port, - value: item.ip + ':' + item.port - }); - } - }); - } - if ($scope.macsInputOptions.length > 0) { - $scope.macInputModel = $scope.macsInputOptions[0].value; - } - } else { - $scope.macsInputOptions = []; - } - } - ); - } - - // Fetch all machines by current app name. - queryAppMachines(); - - $scope.$watch('macInputModel', function () { - if ($scope.macInputModel) { - reInitIdentityDatas(); - } - }); - - $scope.$on('$destroy', function () { - $interval.cancel(intervalId); - }); - - var intervalId; - function reInitIdentityDatas() { - // $interval.cancel(intervalId); - queryIdentities(); - // intervalId = $interval(function () { - // queryIdentities(); - // }, DATA_REFRESH_INTERVAL * 1000); - }; - - function queryIdentities() { - var mac = $scope.macInputModel.split(':'); - if (mac == null || mac.length < 2) { - return; - } - if ($scope.isTreeView) { - IdentityService.fetchIdentityOfMachine(mac[0], mac[1], $scope.searchKey).success( - function (data) { - if (data.code == 0 && data.data) { - $scope.identities = data.data; - $scope.totalCount = $scope.identities.length; - } else { - $scope.identities = []; - $scope.totalCount = 0; - } - } - ); - } else { - IdentityService.fetchClusterNodeOfMachine(mac[0], mac[1], $scope.searchKey).success( - function (data) { - if (data.code == 0 && data.data) { - $scope.identities = data.data; - $scope.totalCount = $scope.identities.length; - } else { - $scope.identities = []; - $scope.totalCount = 0; - } - } - ); - } - }; - $scope.queryIdentities = queryIdentities; - }]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/login.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/login.js deleted file mode 100644 index 3d49d3c1..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/login.js +++ /dev/null @@ -1,33 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.controller('LoginCtl', ['$scope', '$state', '$window', 'AuthService', - function ($scope, $state, $window, AuthService) { - // If auth passed, jump to the index page directly - if ($window.localStorage.getItem('session_sentinel_admin')) { - $state.go('dashboard'); - } - - $scope.login = function () { - if (!$scope.username) { - alert('请输入用户名'); - return; - } - - if (!$scope.password) { - alert('请输入密码'); - return; - } - - var param = {"username": $scope.username, "password": $scope.password}; - - AuthService.login(param).success(function (data) { - if (data.code == 0) { - $window.localStorage.setItem('session_sentinel_admin', JSON.stringify(data.data)); - $state.go('dashboard'); - } else { - alert(data.msg); - } - }); - }; - }] -); \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/machine.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/machine.js deleted file mode 100644 index 16180470..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/machine.js +++ /dev/null @@ -1,65 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.controller('MachineCtl', ['$scope', '$stateParams', 'MachineService', - function ($scope, $stateParams, MachineService) { - $scope.app = $stateParams.app; - $scope.propertyName = ''; - $scope.reverse = false; - $scope.currentPage = 1; - $scope.machines = []; - $scope.machinesPageConfig = { - pageSize: 10, - currentPageIndex: 1, - totalPage: 1, - totalCount: 0, - }; - - $scope.sortBy = function (propertyName) { - // console.log('machine sortBy ' + propertyName); - $scope.reverse = ($scope.propertyName === propertyName) ? !$scope.reverse : false; - $scope.propertyName = propertyName; - }; - - $scope.reloadMachines = function() { - MachineService.getAppMachines($scope.app).success( - function (data) { - // console.log('get machines: ' + data.data[0].hostname) - if (data.code == 0 && data.data) { - $scope.machines = data.data; - var healthy = 0; - $scope.machines.forEach(function (item) { - if (item.healthy) { - healthy++; - } - if (!item.hostname) { - item.hostname = '未知' - } - }) - $scope.healthyCount = healthy; - $scope.machinesPageConfig.totalCount = $scope.machines.length; - } else { - $scope.machines = []; - $scope.healthyCount = 0; - } - } - ); - }; - - $scope.removeMachine = function(ip, port) { - if (!confirm("confirm to remove machine [" + ip + ":" + port + "]?")) { - return; - } - MachineService.removeAppMachine($scope.app, ip, port).success( - function(data) { - if (data.code == 0) { - $scope.reloadMachines(); - } else { - alert("remove failed"); - } - } - ); - }; - - $scope.reloadMachines(); - - }]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/main.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/main.js deleted file mode 100644 index 37500f7e..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/main.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * @ngdoc function - * @name sentinelDashboardApp.controller:MainCtrl - * @description - * # MainCtrl - * Controller of the sentinelDashboardApp - */ -angular.module('sentinelDashboardApp') - .controller('DashboardCtrl', ['$scope', '$position', function ($scope, $position) { - }]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/metric.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/metric.js deleted file mode 100644 index b7e2539d..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/metric.js +++ /dev/null @@ -1,263 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.controller('MetricCtl', ['$scope', '$stateParams', 'MetricService', '$interval', '$timeout', - function ($scope, $stateParams, MetricService, $interval, $timeout) { - - $scope.endTime = new Date(); - $scope.startTime = new Date(); - $scope.startTime.setMinutes($scope.endTime.getMinutes() - 30); - $scope.startTimeFmt = formatDate($scope.startTime); - $scope.endTimeFmt = formatDate($scope.endTime); - function formatDate(date) { - return moment(date).format('YYYY/MM/DD HH:mm:ss'); - } - $scope.changeStartTime = function (startTime) { - $scope.startTime = new Date(startTime); - $scope.startTimeFmt = formatDate(startTime); - }; - $scope.changeEndTime = function (endTime) { - $scope.endTime = new Date(endTime); - $scope.endTimeFmt = formatDate(endTime); - }; - - $scope.app = $stateParams.app; - // 数据自动刷新频率 - var DATA_REFRESH_INTERVAL = 1000 * 10; - - $scope.servicePageConfig = { - pageSize: 6, - currentPageIndex: 1, - totalPage: 1, - totalCount: 0, - }; - $scope.servicesChartConfigs = []; - - $scope.pageChanged = function (newPageNumber) { - $scope.servicePageConfig.currentPageIndex = newPageNumber; - reInitIdentityDatas(); - }; - - var searchT; - $scope.searchService = function () { - $timeout.cancel(searchT); - searchT = $timeout(function () { - reInitIdentityDatas(); - }, 600); - } - - var intervalId; - reInitIdentityDatas(); - function reInitIdentityDatas() { - $interval.cancel(intervalId); - queryIdentityDatas(); - intervalId = $interval(function () { - queryIdentityDatas(); - }, DATA_REFRESH_INTERVAL); - }; - - $scope.$on('$destroy', function () { - $interval.cancel(intervalId); - }); - $scope.initAllChart = function () { - $.each($scope.metrics, function (idx, metric) { - if (idx == $scope.metrics.length - 1) { - return; - } - const chart = new G2.Chart({ - container: 'chart' + idx, - forceFit: true, - width: 100, - height: 250, - padding: [10, 30, 70, 50] - }); - var maxQps = 0; - for (var i in metric.data) { - var item = metric.data[i]; - if (item.passQps > maxQps) { - maxQps = item.passQps; - } - if (item.blockQps > maxQps) { - maxQps = item.blockQps; - } - } - chart.source(metric.data); - chart.scale('timestamp', { - type: 'time', - mask: 'YYYY-MM-DD HH:mm:ss' - }); - chart.scale('passQps', { - min: 0, - max: maxQps, - fine: true, - alias: '通过 QPS' - // max: 10 - }); - chart.scale('blockQps', { - min: 0, - max: maxQps, - fine: true, - alias: '拒绝 QPS', - }); - chart.scale('rt', { - min: 0, - fine: true, - }); - chart.axis('rt', { - grid: null, - label: null - }); - chart.axis('blockQps', { - grid: null, - label: null - }); - - chart.axis('timestamp', { - label: { - textStyle: { - textAlign: 'center', // 文本对齐方向,可取值为: start center end - fill: '#404040', // 文本的颜色 - fontSize: '11', // 文本大小 - //textBaseline: 'top', // 文本基准线,可取 top middle bottom,默认为middle - }, - autoRotate: false, - formatter: function (text, item, index) { - return text.substring(11, 11 + 5); - } - } - }); - chart.legend({ - custom: true, - position: 'bottom', - allowAllCanceled: true, - itemFormatter: function (val) { - if ('passQps' === val) { - return '通过 QPS'; - } - if ('blockQps' === val) { - return '拒绝 QPS'; - } - return val; - }, - items: [ - { value: 'passQps', marker: { symbol: 'hyphen', stroke: 'green', radius: 5, lineWidth: 2 } }, - { value: 'blockQps', marker: { symbol: 'hyphen', stroke: 'blue', radius: 5, lineWidth: 2 } }, - //{ value: 'rt', marker: {symbol: 'hyphen', stroke: 'gray', radius: 5, lineWidth: 2} }, - ], - onClick: function (ev) { - const item = ev.item; - const value = item.value; - const checked = ev.checked; - const geoms = chart.getAllGeoms(); - for (var i = 0; i < geoms.length; i++) { - const geom = geoms[i]; - if (geom.getYScale().field === value) { - if (checked) { - geom.show(); - } else { - geom.hide(); - } - } - } - } - }); - chart.line().position('timestamp*passQps').size(1).color('green').shape('smooth'); - chart.line().position('timestamp*blockQps').size(1).color('blue').shape('smooth'); - //chart.line().position('timestamp*rt').size(1).color('gray').shape('smooth'); - G2.track(false); - chart.render(); - }); - }; - - $scope.metrics = []; - $scope.emptyObjs = []; - function queryIdentityDatas() { - var params = { - app: $scope.app, - pageIndex: $scope.servicePageConfig.currentPageIndex, - pageSize: $scope.servicePageConfig.pageSize, - desc: $scope.isDescOrder, - searchKey: $scope.serviceQuery - }; - MetricService.queryAppSortedIdentities(params).success(function (data) { - $scope.metrics = []; - $scope.emptyObjs = []; - if (data.code === 0 && data.data) { - var metricsObj = data.data.metric; - var identityNames = Object.keys(metricsObj); - if (identityNames.length < 1) { - $scope.emptyServices = true; - } else { - $scope.emptyServices = false; - } - $scope.servicePageConfig.totalPage = data.data.totalPage; - $scope.servicePageConfig.pageSize = data.data.pageSize; - var totalCount = data.data.totalCount; - $scope.servicePageConfig.totalCount = totalCount; - for (i = 0; i < totalCount; i++) { - $scope.emptyObjs.push({}); - } - $.each(identityNames, function (idx, identityName) { - var identityDatas = metricsObj[identityName]; - var metrics = {}; - metrics.resource = identityName; - // metrics.data = identityDatas; - metrics.data = fillZeros(identityDatas); - metrics.shortData = lastOfArray(identityDatas, 6); - $scope.metrics.push(metrics); - }); - // push an empty element in the last, for ng-init reasons. - $scope.metrics.push([]); - } else { - $scope.emptyServices = true; - console.log(data.msg); - } - }); - }; - function fillZeros(metricData) { - if (!metricData || metricData.length == 0) { - return []; - } - var filledData = []; - filledData.push(metricData[0]); - var lastTime = metricData[0].timestamp / 1000; - for (var i = 1; i < metricData.length; i++) { - var curTime = metricData[i].timestamp / 1000; - if (curTime > lastTime + 1) { - for (var j = lastTime + 1; j < curTime; j++) { - filledData.push({ - "timestamp": j * 1000, - "passQps": 0, - "blockQps": 0, - "successQps": 0, - "exception": 0, - "rt": 0, - "count": 0 - }) - } - } - filledData.push(metricData[i]); - lastTime = curTime; - } - return filledData; - } - function lastOfArray(arr, n) { - if (!arr.length) { - return []; - } - var rs = []; - for (i = 0; i < n && i < arr.length; i++) { - rs.push(arr[arr.length - 1 - i]); - } - return rs; - } - - $scope.isDescOrder = true; - $scope.setDescOrder = function () { - $scope.isDescOrder = true; - reInitIdentityDatas(); - } - $scope.setAscOrder = function () { - $scope.isDescOrder = false; - reInitIdentityDatas(); - } - }]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/param_flow.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/param_flow.js deleted file mode 100644 index 65d868a8..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/param_flow.js +++ /dev/null @@ -1,328 +0,0 @@ -/** - * Parameter flow control controller. - * - * @author Eric Zhao - */ -angular.module('sentinelDashboardApp').controller('ParamFlowController', ['$scope', '$stateParams', 'ParamFlowService', 'ngDialog', - 'MachineService', - function ($scope, $stateParams, ParamFlowService, ngDialog, - MachineService) { - const UNSUPPORTED_CODE = 4041; - $scope.app = $stateParams.app; - $scope.curExItem = {}; - - $scope.paramItemClassTypeList = [ - 'int', 'double', 'java.lang.String', 'long', 'float', 'char', 'byte' - ]; - - $scope.rulesPageConfig = { - pageSize: 10, - currentPageIndex: 1, - totalPage: 1, - totalCount: 0, - }; - $scope.macsInputConfig = { - searchField: ['text', 'value'], - persist: true, - create: false, - maxItems: 1, - render: { - item: function (data, escape) { - return '
' + escape(data.text) + '
'; - } - }, - onChange: function (value, oldValue) { - $scope.macInputModel = value; - } - }; - - function updateSingleParamItem(arr, v, t, c) { - for (let i = 0; i < arr.length; i++) { - if (arr[i].object === v && arr[i].classType === t) { - arr[i].count = c; - return; - } - } - arr.push({object: v, classType: t, count: c}); - } - - function removeSingleParamItem(arr, v, t) { - for (let i = 0; i < arr.length; i++) { - if (arr[i].object === v && arr[i].classType === t) { - arr.splice(i, 1); - break; - } - } - } - - function isNumberClass(classType) { - return classType === 'int' || classType === 'double' || - classType === 'float' || classType === 'long' || classType === 'short'; - } - - function isByteClass(classType) { - return classType === 'byte'; - } - - function notNumberAtLeastZero(num) { - return num === undefined || num === '' || isNaN(num) || num < 0; - } - - function notGoodNumber(num) { - return num === undefined || num === '' || isNaN(num); - } - - function notGoodNumberBetweenExclusive(num, l ,r) { - return num === undefined || num === '' || isNaN(num) || num < l || num > r; - } - - $scope.notValidParamItem = (curExItem) => { - if (isNumberClass(curExItem.classType) && notGoodNumber(curExItem.object)) { - return true; - } - if (isByteClass(curExItem.classType) && notGoodNumberBetweenExclusive(curExItem.object, -128, 127)) { - return true; - } - return curExItem.object === undefined || curExItem.classType === undefined || - notNumberAtLeastZero(curExItem.count); - }; - - $scope.addParamItem = () => { - updateSingleParamItem($scope.currentRule.rule.paramFlowItemList, - $scope.curExItem.object, $scope.curExItem.classType, $scope.curExItem.count); - let oldItem = $scope.curExItem; - $scope.curExItem = {classType: oldItem.classType}; - }; - - $scope.removeParamItem = (v, t) => { - removeSingleParamItem($scope.currentRule.rule.paramFlowItemList, v, t); - }; - - function getMachineRules() { - if (!$scope.macInputModel) { - return; - } - let mac = $scope.macInputModel.split(':'); - ParamFlowService.queryMachineRules($scope.app, mac[0], mac[1]) - .success(function (data) { - if (data.code === 0 && data.data) { - $scope.loadError = undefined; - $scope.rules = data.data; - $scope.rulesPageConfig.totalCount = $scope.rules.length; - } else { - $scope.rules = []; - $scope.rulesPageConfig.totalCount = 0; - if (data.code === UNSUPPORTED_CODE) { - $scope.loadError = {message: "机器 " + mac[0] + ":" + mac[1] + " 的 Sentinel 客户端版本不支持热点参数限流功能,请升级至 0.2.0 以上版本并引入 sentinel-parameter-flow-control 依赖。"} - } else { - $scope.loadError = {message: data.msg} - } - } - }) - .error((data, header, config, status) => { - $scope.loadError = {message: "未知错误"} - }); - } - $scope.getMachineRules = getMachineRules; - getMachineRules(); - - var paramFlowRuleDialog; - - $scope.editRule = function (rule) { - $scope.currentRule = angular.copy(rule); - if ($scope.currentRule.rule && $scope.currentRule.rule.durationInSec === undefined) { - $scope.currentRule.rule.durationInSec = 1; - } - $scope.paramFlowRuleDialog = { - title: '编辑热点规则', - type: 'edit', - confirmBtnText: '保存', - supportAdvanced: true, - showAdvanceButton: rule.rule.paramFlowItemList === undefined || rule.rule.paramFlowItemList.length <= 0 - }; - paramFlowRuleDialog = ngDialog.open({ - template: '/app/views/dialog/param-flow-rule-dialog.html', - width: 680, - overlay: true, - scope: $scope - }); - $scope.curExItem = {}; - }; - - $scope.addNewRule = function () { - var mac = $scope.macInputModel.split(':'); - $scope.currentRule = { - app: $scope.app, - ip: mac[0], - port: mac[1], - rule: { - grade: 1, - paramFlowItemList: [], - count: 0, - limitApp: 'default', - controlBehavior: 0, - durationInSec: 1, - burstCount: 0, - maxQueueingTimeMs: 0, - clusterMode: false, - clusterConfig: { - thresholdType: 0, - fallbackToLocalWhenFail: true, - } - } - }; - $scope.paramFlowRuleDialog = { - title: '新增热点规则', - type: 'add', - confirmBtnText: '新增', - supportAdvanced: true, - showAdvanceButton: true, - }; - paramFlowRuleDialog = ngDialog.open({ - template: '/app/views/dialog/param-flow-rule-dialog.html', - width: 680, - overlay: true, - scope: $scope - }); - $scope.curExItem = {}; - }; - - $scope.onOpenAdvanceClick = function () { - $scope.paramFlowRuleDialog.showAdvanceButton = false; - }; - $scope.onCloseAdvanceClick = function () { - $scope.paramFlowRuleDialog.showAdvanceButton = true; - }; - - $scope.saveRule = function () { - if (!ParamFlowService.checkRuleValid($scope.currentRule.rule)) { - return; - } - if ($scope.paramFlowRuleDialog.type === 'add') { - addNewRuleAndPush($scope.currentRule); - } else if ($scope.paramFlowRuleDialog.type === 'edit') { - saveRuleAndPush($scope.currentRule, true); - } - }; - - function addNewRuleAndPush(rule) { - ParamFlowService.addNewRule(rule).success((data) => { - if (data.success) { - getMachineRules(); - paramFlowRuleDialog.close(); - } else { - alert('添加规则失败:' + data.msg); - } - }).error((data) => { - if (data) { - alert('添加规则失败:' + data.msg); - } else { - alert("添加规则失败:未知错误"); - } - }); - } - - function saveRuleAndPush(rule, edit) { - ParamFlowService.saveRule(rule).success(function (data) { - if (data.success) { - alert("修改规则成功"); - getMachineRules(); - if (edit) { - paramFlowRuleDialog.close(); - } else { - confirmDialog.close(); - } - } else { - alert('修改规则失败:' + data.msg); - } - }).error((data) => { - if (data) { - alert('修改规则失败:' + data.msg); - } else { - alert("修改规则失败:未知错误"); - } - }); - } - - function deleteRuleAndPush(entity) { - if (entity.id === undefined || isNaN(entity.id)) { - alert('规则 ID 不合法!'); - return; - } - ParamFlowService.deleteRule(entity).success((data) => { - if (data.code == 0) { - getMachineRules(); - confirmDialog.close(); - } else { - alert('删除规则失败:' + data.msg); - } - }).error((data) => { - if (data) { - alert('删除规则失败:' + data.msg); - } else { - alert("删除规则失败:未知错误"); - } - }); - }; - - var confirmDialog; - $scope.deleteRule = function (ruleEntity) { - $scope.currentRule = ruleEntity; - console.log('deleting: ' + ruleEntity); - $scope.confirmDialog = { - title: '删除热点规则', - type: 'delete_rule', - attentionTitle: '请确认是否删除如下热点参数限流规则', - attention: '资源名: ' + ruleEntity.rule.resource + ', 热点参数索引: ' + ruleEntity.rule.paramIdx + - ', 限流模式: ' + (ruleEntity.rule.grade === 1 ? 'QPS' : '未知') + ', 限流阈值: ' + ruleEntity.rule.count, - confirmBtnText: '删除', - }; - confirmDialog = ngDialog.open({ - template: '/app/views/dialog/confirm-dialog.html', - scope: $scope, - overlay: true - }); - }; - - $scope.confirm = function () { - if ($scope.confirmDialog.type === 'delete_rule') { - deleteRuleAndPush($scope.currentRule); - } else { - console.error('error'); - } - }; - - queryAppMachines(); - - function queryAppMachines() { - MachineService.getAppMachines($scope.app).success( - function (data) { - if (data.code == 0) { - // $scope.machines = data.data; - if (data.data) { - $scope.machines = []; - $scope.macsInputOptions = []; - data.data.forEach(function (item) { - if (item.healthy) { - $scope.macsInputOptions.push({ - text: item.ip + ':' + item.port, - value: item.ip + ':' + item.port - }); - } - }); - } - if ($scope.macsInputOptions.length > 0) { - $scope.macInputModel = $scope.macsInputOptions[0].value; - } - } else { - $scope.macsInputOptions = []; - } - } - ); - }; - $scope.$watch('macInputModel', function () { - if ($scope.macInputModel) { - getMachineRules(); - } - }); - }]); \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/system.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/system.js deleted file mode 100644 index 5b3107ff..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/controllers/system.js +++ /dev/null @@ -1,239 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.controller('SystemCtl', ['$scope', '$stateParams', 'SystemService', 'ngDialog', 'MachineService', - function ($scope, $stateParams, SystemService, - ngDialog, MachineService) { - //初始化 - $scope.app = $stateParams.app; - $scope.rulesPageConfig = { - pageSize: 10, - currentPageIndex: 1, - totalPage: 1, - totalCount: 0, - }; - $scope.macsInputConfig = { - searchField: ['text', 'value'], - persist: true, - create: false, - maxItems: 1, - render: { - item: function (data, escape) { - return '
' + escape(data.text) + '
'; - } - }, - onChange: function (value, oldValue) { - $scope.macInputModel = value; - } - }; - - getMachineRules(); - function getMachineRules() { - if (!$scope.macInputModel) { - return; - } - let mac = $scope.macInputModel.split(':'); - SystemService.queryMachineRules($scope.app, mac[0], mac[1]).success( - function (data) { - if (data.code === 0 && data.data) { - $scope.rules = data.data; - $.each($scope.rules, function (idx, rule) { - if (rule.highestSystemLoad >= 0) { - rule.grade = 0; - } else if (rule.avgRt >= 0) { - rule.grade = 1; - } else if (rule.maxThread >= 0) { - rule.grade = 2; - } else if (rule.qps >= 0) { - rule.grade = 3; - } else if (rule.highestCpuUsage >= 0) { - rule.grade = 4; - } - }); - $scope.rulesPageConfig.totalCount = $scope.rules.length; - } else { - $scope.rules = []; - $scope.rulesPageConfig.totalCount = 0; - } - }); - } - - $scope.getMachineRules = getMachineRules; - var systemRuleDialog; - $scope.editRule = function (rule) { - $scope.currentRule = angular.copy(rule); - $scope.systemRuleDialog = { - title: '编辑系统保护规则', - type: 'edit', - confirmBtnText: '保存' - }; - systemRuleDialog = ngDialog.open({ - template: '/app/views/dialog/system-rule-dialog.html', - width: 680, - overlay: true, - scope: $scope - }); - }; - - $scope.addNewRule = function () { - var mac = $scope.macInputModel.split(':'); - $scope.currentRule = { - grade: 0, - app: $scope.app, - ip: mac[0], - port: mac[1], - }; - $scope.systemRuleDialog = { - title: '新增系统保护规则', - type: 'add', - confirmBtnText: '新增' - }; - systemRuleDialog = ngDialog.open({ - template: '/app/views/dialog/system-rule-dialog.html', - width: 680, - overlay: true, - scope: $scope - }); - }; - - $scope.saveRule = function () { - if ($scope.systemRuleDialog.type === 'add') { - addNewRule($scope.currentRule); - } else if ($scope.systemRuleDialog.type === 'edit') { - saveRule($scope.currentRule, true); - } - }; - - var confirmDialog; - $scope.deleteRule = function (rule) { - $scope.currentRule = rule; - var ruleTypeDesc = ''; - var ruleTypeCount = null; - if (rule.highestSystemLoad != -1) { - ruleTypeDesc = 'LOAD'; - ruleTypeCount = rule.highestSystemLoad; - } else if (rule.avgRt != -1) { - ruleTypeDesc = 'RT'; - ruleTypeCount = rule.avgRt; - } else if (rule.maxThread != -1) { - ruleTypeDesc = '线程数'; - ruleTypeCount = rule.maxThread; - } else if (rule.qps != -1) { - ruleTypeDesc = 'QPS'; - ruleTypeCount = rule.qps; - }else if (rule.highestCpuUsage != -1) { - ruleTypeDesc = 'CPU 使用率'; - ruleTypeCount = rule.highestCpuUsage; - } - - $scope.confirmDialog = { - title: '删除系统保护规则', - type: 'delete_rule', - attentionTitle: '请确认是否删除如下系统保护规则', - attention: '阈值类型: ' + ruleTypeDesc + ', 阈值: ' + ruleTypeCount, - confirmBtnText: '删除', - }; - confirmDialog = ngDialog.open({ - template: '/app/views/dialog/confirm-dialog.html', - scope: $scope, - overlay: true - }); - }; - - - $scope.confirm = function () { - if ($scope.confirmDialog.type === 'delete_rule') { - deleteRule($scope.currentRule); - // } else if ($scope.confirmDialog.type == 'enable_rule') { - // $scope.currentRule.enable = true; - // saveRule($scope.currentRule); - // } else if ($scope.confirmDialog.type == 'disable_rule') { - // $scope.currentRule.enable = false; - // saveRule($scope.currentRule); - // } else if ($scope.confirmDialog.type == 'enable_all') { - // enableAll($scope.app); - // } else if ($scope.confirmDialog.type == 'disable_all') { - // disableAll($scope.app); - } else { - console.error('error'); - } - }; - - function deleteRule(rule) { - SystemService.deleteRule(rule).success(function (data) { - if (data.code === 0) { - getMachineRules(); - confirmDialog.close(); - } else if (data.msg != null) { - alert('失败:' + data.msg); - } else { - alert('失败:未知错误'); - } - }); - } - - function addNewRule(rule) { - if (rule.grade == 4 && (rule.highestCpuUsage < 0 || rule.highestCpuUsage > 1)) { - alert('CPU 使用率模式的取值范围应为 [0.0, 1.0],对应 0% - 100%'); - return; - } - SystemService.newRule(rule).success(function (data) { - if (data.code === 0) { - getMachineRules(); - systemRuleDialog.close(); - } else if (data.msg != null) { - alert('失败:' + data.msg); - } else { - alert('失败:未知错误'); - } - }); - } - - function saveRule(rule, edit) { - SystemService.saveRule(rule).success(function (data) { - if (data.code === 0) { - getMachineRules(); - if (edit) { - systemRuleDialog.close(); - } else { - confirmDialog.close(); - } - } else if (data.msg != null) { - alert('失败:' + data.msg); - } else { - alert('失败:未知错误'); - } - }); - } - queryAppMachines(); - function queryAppMachines() { - MachineService.getAppMachines($scope.app).success( - function (data) { - if (data.code === 0) { - // $scope.machines = data.data; - if (data.data) { - $scope.machines = []; - $scope.macsInputOptions = []; - data.data.forEach(function (item) { - if (item.healthy) { - $scope.macsInputOptions.push({ - text: item.ip + ':' + item.port, - value: item.ip + ':' + item.port - }); - } - }); - } - if ($scope.macsInputOptions.length > 0) { - $scope.macInputModel = $scope.macsInputOptions[0].value; - } - } else { - $scope.macsInputOptions = []; - } - } - ); - }; - $scope.$watch('macInputModel', function () { - if ($scope.macInputModel) { - getMachineRules(); - } - }); - }]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/header/header.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/header/header.html deleted file mode 100644 index 4584e89b..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/header/header.html +++ /dev/null @@ -1,15 +0,0 @@ -
- - - -
\ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/header/header.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/header/header.js deleted file mode 100644 index 4e6c8f2c..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/header/header.js +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @ngdoc directive - * @name izzyposWebApp.directive:adminPosHeader - * @description - * # adminPosHeader - */ -angular.module('sentinelDashboardApp') - .directive('header', ['VersionService', 'AuthService', function () { - return { - templateUrl: 'app/scripts/directives/header/header.html', - restrict: 'E', - replace: true, - controller: function ($scope, $state, $window, VersionService, AuthService) { - VersionService.version().success(function (data) { - if (data.code == 0) { - $scope.dashboardVersion = data.data; - } - }); - - if (!$window.localStorage.getItem("session_sentinel_admin")) { - AuthService.check().success(function (data) { - if (data.code == 0) { - $window.localStorage.setItem('session_sentinel_admin', JSON.stringify(data.data)); - handleLogout($scope, data.data.id) - } else { - $state.go('login'); - } - }); - } else { - try { - var id = JSON.parse($window.localStorage.getItem("session_sentinel_admin")).id; - handleLogout($scope, id); - } catch (e) { - // Historical version compatibility processing, fixes issue-1449 - // If error happens while parsing, remove item in localStorage and redirect to login page. - $window.localStorage.removeItem("session_sentinel_admin"); - $state.go('login'); - } - } - - function handleLogout($scope, id) { - if (id == 'FAKE_EMP_ID') { - $scope.showLogout = false; - } else { - $scope.showLogout = true; - } - } - - $scope.logout = function () { - AuthService.logout().success(function (data) { - if (data.code == 0) { - $window.localStorage.removeItem("session_sentinel_admin"); - $state.go('login'); - } else { - alert('logout error'); - } - }); - } - } - } - }]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar-search/sidebar-search.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar-search/sidebar-search.html deleted file mode 100644 index 18b2b3a9..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar-search/sidebar-search.html +++ /dev/null @@ -1,10 +0,0 @@ - \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar-search/sidebar-search.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar-search/sidebar-search.js deleted file mode 100644 index 31acca6e..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar-search/sidebar-search.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * @ngdoc directive - * @name izzyposWebApp.directive:adminPosHeader - * @description - * # adminPosHeader - */ - -angular.module('sentinelDashboardApp') - .directive('sidebarSearch', function () { - return { - templateUrl: 'app/scripts/directives/sidebar/sidebar-search/sidebar-search.html', - restrict: 'E', - replace: true, - scope: { - }, - controller: function ($scope) { - $scope.selectedMenu = 'home'; - } - } - }); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.html deleted file mode 100644 index a7212629..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.html +++ /dev/null @@ -1,91 +0,0 @@ - \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.js deleted file mode 100644 index 7ef57401..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.js +++ /dev/null @@ -1,71 +0,0 @@ -angular.module('sentinelDashboardApp') - .directive('sidebar', ['$location', '$stateParams', 'AppService', function () { - return { - templateUrl: 'app/scripts/directives/sidebar/sidebar.html', - restrict: 'E', - replace: true, - scope: { - }, - controller: function ($scope, $stateParams, $location, AppService) { - $scope.app = $stateParams.app; - $scope.collapseVar = 0; - - // app - AppService.getApps().success( - function (data) { - if (data.code === 0) { - let path = $location.path().split('/'); - let initHashApp = path[path.length - 1]; - $scope.apps = data.data; - $scope.apps = $scope.apps.map(function (item) { - if (item.app === initHashApp) { - item.active = true; - } - let healthyCount = 0; - for (let i in item.machines) { - if (item.machines[i].healthy) { - healthyCount++; - } - } - item.healthyCount = healthyCount; - // Handle appType - item.isGateway = item.appType === 1 || item.appType === 11 || item.appType === 12; - - if (item.shown) { - return item; - } - }); - } - } - ); - - // toggle side bar - $scope.click = function ($event) { - let entry = angular.element($event.target).scope().entry; - entry.active = !entry.active;// toggle this clicked app bar - - $scope.apps.forEach(function (item) { // collapse other app bars - if (item !== entry) { - item.active = false; - } - }); - }; - - /** - * @deprecated - */ - $scope.addSearchApp = function () { - let findApp = false; - for (let i = 0; i < $scope.apps.length; i++) { - if ($scope.apps[i].app === $scope.searchApp) { - findApp = true; - break; - } - } - if (!findApp) { - $scope.apps.push({ app: $scope.searchApp }); - } - }; - } - }; - }]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/filters/filters.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/filters/filters.js deleted file mode 100644 index f39b08f7..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/filters/filters.js +++ /dev/null @@ -1,17 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.filter('range', [function () { - return function (input, length) { - if (isNaN(length) || length <= 0) { - return []; - } - - input = []; - for (var index = 1; index <= length; index++) { - input.push(index); - } - - return input; - }; - -}]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/libs/treeTable.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/libs/treeTable.js deleted file mode 100644 index 1eff197d..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/libs/treeTable.js +++ /dev/null @@ -1,292 +0,0 @@ -var com_github_culmat_jsTreeTable = (function(){ - - function depthFirst(tree, func, childrenAttr) { - childrenAttr = childrenAttr || 'children' - function i_depthFirst(node) { - if (node[childrenAttr]) { - $.each(node[childrenAttr], function(i, child) { - i_depthFirst(child) - }) - } - func(node) - } - $.each(tree, function(i, root) { - i_depthFirst(root) - }) - return tree - } - - /* - * make a deep copy of the object - */ - function copy(data){ - return JSON.parse(JSON.stringify(data)) - } - - function makeTree (data, idAttr, refAttr, childrenAttr) { - var data_tmp = data - idAttr = idAttr || 'id' - refAttr = refAttr || 'parent' - childrenAttr = childrenAttr || 'children' - - var byName = [] - $.each(data_tmp, function(i, entry) { - byName[entry[idAttr]] = entry - }) - var tree = [] - $.each(data_tmp, function(i, entry) { - var parents = entry[refAttr] - if(!$.isArray(parents)){ - parents = [parents] - } - if(parents.length == 0){ - tree.push(entry) - } else { - var inTree = false; - $.each(parents, function(i,parentID){ - var parent = byName[parentID] - if (parent) { - if (!parent[childrenAttr]) { - parent[childrenAttr] = [] - } - if($.inArray(entry, parent[childrenAttr])< 0) - parent[childrenAttr].push(entry) - inTree = true - } - }) - if(!inTree){ - tree.push(entry) - } - } - }) - return tree - } - - function renderTree(tree, childrenAttr, idAttr, attrs, renderer, tableAttributes) { - childrenAttr = childrenAttr || 'children' - idAttr = idAttr || 'id' - tableAttributes = tableAttributes || {} - var maxLevel = 0; - var ret = [] - - var table = $("") - $.each(tableAttributes, function(key, value){ - if(key == 'class' && value != 'jsTT') { - table.addClass(value) - } else { - table.attr(key, value) - } - }) - var thead = $("") - var tr = $("") - var tbody = $("") - - table.append(thead) - thead.append(tr) - table.append(tbody) - if (attrs) { - $.each(attrs, function(attr, desc) { - $(tr).append($('')) - }) - } else { - $(tr).append($('')) - $.each(tree[0], function(key, value) { - if (key != childrenAttr && key != idAttr) - $(tr).append($('')) - }) - } - - function render(node, parent) { - var tr = $("") - $(tr).attr('data-tt-id', node[idAttr]) - $(tr).attr('data-tt-level', node['data-tt-level']) - if(!node[childrenAttr] || node[childrenAttr].length == 0) - $(tr).attr('data-tt-isleaf', true) - else - $(tr).attr('data-tt-isnode', true) - if (parent) { - $(tr).attr('data-tt-parent-id', parent[idAttr]) - } - if (renderer) { - renderer($(tr), node) - }else if (attrs) { - $.each(attrs, function(attr, desc) { - $(tr).append($('')) - }) - } else { - $(tr).append($('')) - $.each(node, function(key, value) { - if (key != childrenAttr && key != idAttr && key != 'data-tt-level') - $(tr).append($('')) - }) - } - tbody.append(tr) - } - - function i_renderTree(subTree, childrenAttr, level, parent) { - maxLevel = Math.max(maxLevel, level) - $.each(subTree, function(i, node) { - node['data-tt-level'] = level - render(node, parent) - if (node[childrenAttr]) { - $.each(node[childrenAttr], function(i, child) { - i_renderTree([ child ], childrenAttr, level + 1, node) - }) - } - }) - } - i_renderTree(tree, childrenAttr, 1) - if (tree[0]) - tree[0].maxLevel = maxLevel - return table - } - - function attr2attr(nodes, attrs){ - $.each(nodes, function(i, node) { - $.each(attrs, function(j, at) { - node[at] = $(node).attr(at) - }) - }) - return nodes - } - - function treeTable(table){ - table.addClass('jsTT') - table.expandLevel = function (n) { - $("tr[data-tt-level]", table).each(function(index) { - var level = parseInt($(this).attr('data-tt-level')) - if (level > n-1) { - this.trCollapse(true) - } else if (level == n-1){ - this.trExpand(true) - } - }) - } - function getLevel(node){ - var level = node.attr('data-tt-level') - if(level != undefined ) return parseInt(level) - var parentID = node.attr('data-tt-parent-id') - if( parentID == undefined){ - return 0 - } else { - return getLevel($('tr[data-tt-id="'+parentID+'"]', table).first()) + 1 - } - } - $("tr[data-tt-id]", table).each(function(i,node){ - node = $(node) - node.attr('data-tt-level', getLevel(node)) - }) - var dat = $("tr[data-tt-level]", table).get() - $.each(dat, function(j, d) { - d.trChildrenVisible = true - d.trChildren = [] - }) - dat = attr2attr(dat, ['data-tt-id', 'data-tt-parent-id']) - dat = makeTree(dat, 'data-tt-id', 'data-tt-parent-id', 'trChildren') - - var imgExpand = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAHlJREFUeNrcU1sNgDAQ6wgmcAM2MICGGlg1gJnNzWQcvwQGy1j4oUl/7tH0mpwzM7SgQyO+EZAUWh2MkkzSWhJwuRAlHYsJwEwyvs1gABDuzqoJcTw5qxaIJN0bgQRgIjnlmn1heSO5PE6Y2YXe+5Cr5+h++gs12AcAS6FS+7YOsj4AAAAASUVORK5CYII=" - var imgCollapse = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAHFJREFUeNpi/P//PwMlgImBQsA44C6gvhfa29v3MzAwOODRc6CystIRbxi0t7fjDJjKykpGYrwwi1hxnLHQ3t7+jIGBQRJJ6HllZaUUKYEYRYBPOB0gBShKwKGA////48VtbW3/8clTnBIH3gCKkzJgAGvBX0dDm0sCAAAAAElFTkSuQmCC" - $("tr[data-tt-level]", table).each(function(index, tr) { - var level = $(tr).attr('data-tt-level') - var td = $("td",tr).first() - if(tr.trChildren.length>0){ - td.prepend($('')) - } else { - td.prepend($('')) - } - td.prepend($('')) - // td.css('white-space','nowrap') - tr.trExpand = function(changeState){ - if(this.trChildren.length < 1) return - if(changeState) { - this.trChildrenVisible = true - $('#state', this).get(0).src= imgCollapse - } - var doit = changeState || this.trChildrenVisible - $.each(this.trChildren, function(i, ctr) { - if(doit) $(ctr).css('display', 'table-row') - ctr.trExpand() - }) - } - tr.trCollapse = function(changeState){ - if(this.trChildren.length < 1) return - if(changeState) { - this.trChildrenVisible = false - $('#state', this).get(0).src= imgExpand - } - $.each(this.trChildren, function(i, ctr) { - $(ctr).css('display', 'none') - ctr.trCollapse() - }) - } - $(tr).click(function() { - this.trChildrenVisible ? this.trCollapse(true) : this.trExpand(true) - }) - }) - return table - } - - function appendTreetable(tree, options) { - function inALine(nodes) { - var tr = $('') - $.each(nodes, function(i, node){ - tr.append($('
' + desc + '' + idAttr + '' + key + '
' + node[attr] + '' + node[idAttr] + '' + value + '
').append(node)) - }) - return $('').append(tr) - - } - options = options || {} - options.idAttr = (options.idAttr || 'id') - options.childrenAttr = (options.childrenAttr || 'children') - var controls = (options.controls || []) - - if (!options.mountPoint) - options.mountPoint = $('body') - - if (options.depthFirst) - depthFirst(tree, options.depthFirst, options.childrenAttr) - var rendered = renderTree(tree, options.childrenAttr, options.idAttr, - options.renderedAttr, options.renderer, options.tableAttributes) - - treeTable(rendered) - if (options.replaceContent) { - options.mountPoint.html('') - } - var initialExpandLevel = options.initialExpandLevel ? parseInt(options.initialExpandLevel) : -1 - initialExpandLevel = Math.min(initialExpandLevel, tree[0].maxLevel) - rendered.expandLevel(initialExpandLevel) - if(options.slider){ - var slider = $('
') - slider.width('200px') - slider.slider({ - min : 1, - max : tree[0].maxLevel, - range : "min", - value : initialExpandLevel, - slide : function(event, ui) { - rendered.expandLevel(ui.value) - } - }) - controls = [slider].concat(options.controls) - } - - if(controls.length >0){ - options.mountPoint.append(inALine(controls)) - } - options.mountPoint.append(rendered) - return rendered - } - - return { - depthFirst : depthFirst, - makeTree : makeTree, - renderTree : renderTree, - attr2attr : attr2attr, - treeTable : treeTable, - appendTreetable : appendTreetable, - jsTreeTable : '1.0', - register : function(target){ - $.each(this, function(key, value){ if(key != 'register') target[key] = value}) - } - } -})(); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/appservice.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/appservice.js deleted file mode 100644 index 47705836..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/appservice.js +++ /dev/null @@ -1,12 +0,0 @@ - -var app = angular.module('sentinelDashboardApp'); - -app.service('AppService', ['$http', function ($http) { - this.getApps = function () { - return $http({ - // url: 'app/mock_infos', - url: 'app/briefinfos.json', - method: 'GET' - }); - }; -}]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/auth_service.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/auth_service.js deleted file mode 100644 index fec1cf4a..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/auth_service.js +++ /dev/null @@ -1,25 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.service('AuthService', ['$http', function ($http) { - this.check = function () { - return $http({ - url: '/auth/check', - method: 'POST' - }); - }; - - this.login = function (param) { - return $http({ - url: '/auth/login', - params: param, - method: 'POST' - }); - }; - - this.logout = function () { - return $http({ - url: '/auth/logout', - method: 'POST' - }); - }; -}]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/authority_service.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/authority_service.js deleted file mode 100644 index 42a61012..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/authority_service.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Authority rule service. - */ -angular.module('sentinelDashboardApp').service('AuthorityRuleService', ['$http', function ($http) { - this.queryMachineRules = function(app, ip, port) { - var param = { - app: app, - ip: ip, - port: port - }; - return $http({ - url: '/authority/rules', - params: param, - method: 'GET' - }); - }; - - this.addNewRule = function(rule) { - return $http({ - url: '/authority/rule', - data: rule, - method: 'POST' - }); - }; - - this.saveRule = function (entity) { - return $http({ - url: '/authority/rule/' + entity.id, - data: entity, - method: 'PUT' - }); - }; - - this.deleteRule = function (entity) { - return $http({ - url: '/authority/rule/' + entity.id, - method: 'DELETE' - }); - }; - - this.checkRuleValid = function checkRuleValid(rule) { - if (rule.resource === undefined || rule.resource === '') { - alert('资源名称不能为空'); - return false; - } - if (rule.limitApp === undefined || rule.limitApp === '') { - alert('流控针对应用不能为空'); - return false; - } - if (rule.strategy === undefined) { - alert('必须选择黑白名单模式'); - return false; - } - return true; - }; -}]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/cluster_state_service.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/cluster_state_service.js deleted file mode 100644 index 7bca8161..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/cluster_state_service.js +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Cluster state control service. - * - * @author Eric Zhao - */ -angular.module('sentinelDashboardApp').service('ClusterStateService', ['$http', function ($http) { - - this.fetchClusterUniversalStateSingle = function(app, ip, port) { - var param = { - app: app, - ip: ip, - port: port - }; - return $http({ - url: '/cluster/state_single', - params: param, - method: 'GET' - }); - }; - - this.fetchClusterUniversalStateOfApp = function(app) { - return $http({ - url: '/cluster/state/' + app, - method: 'GET' - }); - }; - - this.fetchClusterServerStateOfApp = function(app) { - return $http({ - url: '/cluster/server_state/' + app, - method: 'GET' - }); - }; - - this.fetchClusterClientStateOfApp = function(app) { - return $http({ - url: '/cluster/client_state/' + app, - method: 'GET' - }); - }; - - this.modifyClusterConfig = function(config) { - return $http({ - url: '/cluster/config/modify_single', - data: config, - method: 'POST' - }); - }; - - this.applyClusterFullAssignOfApp = function(app, clusterMap) { - return $http({ - url: '/cluster/assign/all_server/' + app, - data: clusterMap, - method: 'POST' - }); - }; - - this.applyClusterSingleServerAssignOfApp = function(app, request) { - return $http({ - url: '/cluster/assign/single_server/' + app, - data: request, - method: 'POST' - }); - }; - - this.applyClusterServerBatchUnbind = function(app, machineSet) { - return $http({ - url: '/cluster/assign/unbind_server/' + app, - data: machineSet, - method: 'POST' - }); - }; -}]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/degrade_service.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/degrade_service.js deleted file mode 100644 index a242b22a..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/degrade_service.js +++ /dev/null @@ -1,97 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.service('DegradeService', ['$http', function ($http) { - this.queryMachineRules = function (app, ip, port) { - var param = { - app: app, - ip: ip, - port: port - }; - return $http({ - url: 'degrade/rules.json', - params: param, - method: 'GET' - }); - }; - - this.newRule = function (rule) { - return $http({ - url: '/degrade/rule', - data: rule, - method: 'POST' - }); - }; - - this.saveRule = function (rule) { - var param = { - id: rule.id, - resource: rule.resource, - limitApp: rule.limitApp, - grade: rule.grade, - count: rule.count, - timeWindow: rule.timeWindow, - statIntervalMs: rule.statIntervalMs, - minRequestAmount: rule.minRequestAmount, - slowRatioThreshold: rule.slowRatioThreshold, - }; - return $http({ - url: '/degrade/rule/' + rule.id, - data: param, - method: 'PUT' - }); - }; - - this.deleteRule = function (rule) { - return $http({ - url: '/degrade/rule/' + rule.id, - method: 'DELETE' - }); - }; - - this.checkRuleValid = function (rule) { - if (rule.resource === undefined || rule.resource === '') { - alert('资源名称不能为空'); - return false; - } - if (rule.grade === undefined || rule.grade < 0) { - alert('未知的降级策略'); - return false; - } - if (rule.count === undefined || rule.count === '' || rule.count < 0) { - alert('降级阈值不能为空或小于 0'); - return false; - } - if (rule.timeWindow == undefined || rule.timeWindow === '' || rule.timeWindow <= 0) { - alert('熔断时长必须大于 0s'); - return false; - } - if (rule.minRequestAmount == undefined || rule.minRequestAmount <= 0) { - alert('最小请求数目需大于 0'); - return false; - } - if (rule.statIntervalMs == undefined || rule.statIntervalMs <= 0) { - alert('统计窗口时长需大于 0s'); - return false; - } - if (rule.statIntervalMs !== undefined && rule.statIntervalMs > 60 * 1000 * 2) { - alert('统计窗口时长不能超过 120 分钟'); - return false; - } - // 异常比率类型. - if (rule.grade == 1 && rule.count > 1) { - alert('异常比率超出范围:[0.0 - 1.0]'); - return false; - } - if (rule.grade == 0) { - if (rule.slowRatioThreshold == undefined) { - alert('慢调用比率不能为空'); - return false; - } - if (rule.slowRatioThreshold < 0 || rule.slowRatioThreshold > 1) { - alert('慢调用比率超出范围:[0.0 - 1.0]'); - return false; - } - } - return true; - }; -}]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/flow_service_v1.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/flow_service_v1.js deleted file mode 100644 index 051a3c71..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/flow_service_v1.js +++ /dev/null @@ -1,119 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.service('FlowServiceV1', ['$http', function ($http) { - this.queryMachineRules = function (app, ip, port) { - var param = { - app: app, - ip: ip, - port: port - }; - return $http({ - url: '/v1/flow/rules', - params: param, - method: 'GET' - }); - }; - - this.newRule = function (rule) { - var param = { - resource: rule.resource, - limitApp: rule.limitApp, - grade: rule.grade, - count: rule.count, - strategy: rule.strategy, - refResource: rule.refResource, - controlBehavior: rule.controlBehavior, - warmUpPeriodSec: rule.warmUpPeriodSec, - maxQueueingTimeMs: rule.maxQueueingTimeMs, - app: rule.app, - ip: rule.ip, - port: rule.port - }; - - return $http({ - url: '/v1/flow/rule', - data: rule, - method: 'POST' - }); - }; - - this.saveRule = function (rule) { - var param = { - id: rule.id, - resource: rule.resource, - limitApp: rule.limitApp, - grade: rule.grade, - count: rule.count, - strategy: rule.strategy, - refResource: rule.refResource, - controlBehavior: rule.controlBehavior, - warmUpPeriodSec: rule.warmUpPeriodSec, - maxQueueingTimeMs: rule.maxQueueingTimeMs, - }; - - return $http({ - url: '/v1/flow/save.json', - params: param, - method: 'PUT' - }); - }; - - this.deleteRule = function (rule) { - var param = { - id: rule.id, - app: rule.app - }; - - return $http({ - url: '/v1/flow/delete.json', - params: param, - method: 'DELETE' - }); - }; - - function notNumberAtLeastZero(num) { - return num === undefined || num === '' || isNaN(num) || num < 0; - } - - function notNumberGreaterThanZero(num) { - return num === undefined || num === '' || isNaN(num) || num <= 0; - } - - this.checkRuleValid = function (rule) { - if (rule.resource === undefined || rule.resource === '') { - alert('资源名称不能为空'); - return false; - } - if (rule.count === undefined || rule.count < 0) { - alert('限流阈值必须大于等于 0'); - return false; - } - if (rule.strategy === undefined || rule.strategy < 0) { - alert('无效的流控模式'); - return false; - } - if (rule.strategy == 1 || rule.strategy == 2) { - if (rule.refResource === undefined || rule.refResource == '') { - alert('请填写关联资源或入口'); - return false; - } - } - if (rule.controlBehavior === undefined || rule.controlBehavior < 0) { - alert('无效的流控整形方式'); - return false; - } - if (rule.controlBehavior == 1 && notNumberGreaterThanZero(rule.warmUpPeriodSec)) { - alert('预热时长必须大于 0'); - return false; - } - if (rule.controlBehavior == 2 && notNumberGreaterThanZero(rule.maxQueueingTimeMs)) { - alert('排队超时时间必须大于 0'); - return false; - } - if (rule.clusterMode && (rule.clusterConfig === undefined || rule.clusterConfig.thresholdType === undefined)) { - alert('集群限流配置不正确'); - return false; - } - return true; - }; -}]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/flow_service_v2.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/flow_service_v2.js deleted file mode 100644 index 716d66d2..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/flow_service_v2.js +++ /dev/null @@ -1,85 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.service('FlowServiceV2', ['$http', function ($http) { - this.queryMachineRules = function (app, ip, port) { - var param = { - app: app, - ip: ip, - port: port - }; - return $http({ - url: '/v2/flow/rules', - params: param, - method: 'GET' - }); - }; - - this.newRule = function (rule) { - return $http({ - url: '/v2/flow/rule', - data: rule, - method: 'POST' - }); - }; - - this.saveRule = function (rule) { - return $http({ - url: '/v2/flow/rule/' + rule.id, - data: rule, - method: 'PUT' - }); - }; - - this.deleteRule = function (rule) { - return $http({ - url: '/v2/flow/rule/' + rule.id, - method: 'DELETE' - }); - }; - - function notNumberAtLeastZero(num) { - return num === undefined || num === '' || isNaN(num) || num < 0; - } - - function notNumberGreaterThanZero(num) { - return num === undefined || num === '' || isNaN(num) || num <= 0; - } - - this.checkRuleValid = function (rule) { - if (rule.resource === undefined || rule.resource === '') { - alert('资源名称不能为空'); - return false; - } - if (rule.count === undefined || rule.count < 0) { - alert('限流阈值必须大于等于 0'); - return false; - } - if (rule.strategy === undefined || rule.strategy < 0) { - alert('无效的流控模式'); - return false; - } - if (rule.strategy == 1 || rule.strategy == 2) { - if (rule.refResource === undefined || rule.refResource == '') { - alert('请填写关联资源或入口'); - return false; - } - } - if (rule.controlBehavior === undefined || rule.controlBehavior < 0) { - alert('无效的流控整形方式'); - return false; - } - if (rule.controlBehavior == 1 && notNumberGreaterThanZero(rule.warmUpPeriodSec)) { - alert('预热时长必须大于 0'); - return false; - } - if (rule.controlBehavior == 2 && notNumberGreaterThanZero(rule.maxQueueingTimeMs)) { - alert('排队超时时间必须大于 0'); - return false; - } - if (rule.clusterMode && (rule.clusterConfig === undefined || rule.clusterConfig.thresholdType === undefined)) { - alert('集群限流配置不正确'); - return false; - } - return true; - }; -}]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/gateway/api_service.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/gateway/api_service.js deleted file mode 100644 index 373f71db..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/gateway/api_service.js +++ /dev/null @@ -1,73 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.service('GatewayApiService', ['$http', function ($http) { - this.queryApis = function (app, ip, port) { - var param = { - app: app, - ip: ip, - port: port - }; - return $http({ - url: '/gateway/api/list.json', - params: param, - method: 'GET' - }); - }; - - this.newApi = function (api) { - return $http({ - url: '/gateway/api/new.json', - data: api, - method: 'POST' - }); - }; - - this.saveApi = function (api) { - return $http({ - url: '/gateway/api/save.json', - data: api, - method: 'POST' - }); - }; - - this.deleteApi = function (api) { - var param = { - id: api.id, - app: api.app - }; - return $http({ - url: '/gateway/api/delete.json', - params: param, - method: 'POST' - }); - }; - - this.checkApiValid = function (api, apiNames) { - if (api.apiName === undefined || api.apiName === '') { - alert('API名称不能为空'); - return false; - } - - if (api.predicateItems == null || api.predicateItems.length === 0) { - // Should never happen since no remove button will display when only one predicateItem. - alert('至少有一个匹配规则'); - return false; - } - - for (var i = 0; i < api.predicateItems.length; i++) { - var predicateItem = api.predicateItems[i]; - var pattern = predicateItem.pattern; - if (pattern === undefined || pattern === '') { - alert('匹配串不能为空,请检查'); - return false; - } - } - - if (apiNames.indexOf(api.apiName) !== -1) { - alert('API名称(' + api.apiName + ')已存在'); - return false; - } - - return true; - }; -}]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/gateway/flow_service.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/gateway/flow_service.js deleted file mode 100644 index b026b32f..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/gateway/flow_service.js +++ /dev/null @@ -1,76 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.service('GatewayFlowService', ['$http', function ($http) { - this.queryRules = function (app, ip, port) { - var param = { - app: app, - ip: ip, - port: port - }; - - return $http({ - url: '/gateway/flow/list.json', - params: param, - method: 'GET' - }); - }; - - this.newRule = function (rule) { - return $http({ - url: '/gateway/flow/new.json', - data: rule, - method: 'POST' - }); - }; - - this.saveRule = function (rule) { - return $http({ - url: '/gateway/flow/save.json', - data: rule, - method: 'POST' - }); - }; - - this.deleteRule = function (rule) { - var param = { - id: rule.id, - app: rule.app - }; - - return $http({ - url: '/gateway/flow/delete.json', - params: param, - method: 'POST' - }); - }; - - this.checkRuleValid = function (rule) { - if (rule.resource === undefined || rule.resource === '') { - alert('API名称不能为空'); - return false; - } - - if (rule.paramItem != null) { - if (rule.paramItem.parseStrategy == 2 || - rule.paramItem.parseStrategy == 3 || - rule.paramItem.parseStrategy == 4) { - if (rule.paramItem.fieldName === undefined || rule.paramItem.fieldName === '') { - alert('当参数属性为Header、URL参数、Cookie时,参数名称不能为空'); - return false; - } - - if (rule.paramItem.pattern === '') { - alert('匹配串不能为空'); - return false; - } - } - } - - if (rule.count === undefined || rule.count < 0) { - alert((rule.grade === 1 ? 'QPS阈值' : '线程数') + '必须大于等于 0'); - return false; - } - - return true; - }; -}]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/identityservice.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/identityservice.js deleted file mode 100644 index 926c0021..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/identityservice.js +++ /dev/null @@ -1,30 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.service('IdentityService', ['$http', function ($http) { - - this.fetchIdentityOfMachine = function (ip, port, searchKey) { - var param = { - ip: ip, - port: port, - searchKey: searchKey - }; - return $http({ - url: 'resource/machineResource.json', - params: param, - method: 'GET' - }); - }; - this.fetchClusterNodeOfMachine = function (ip, port, searchKey) { - var param = { - ip: ip, - port: port, - type: 'cluster', - searchKey: searchKey - }; - return $http({ - url: 'resource/machineResource.json', - params: param, - method: 'GET' - }); - }; -}]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/machineservice.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/machineservice.js deleted file mode 100644 index 2d3b5e8b..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/machineservice.js +++ /dev/null @@ -1,25 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.service('MachineService', ['$http', '$httpParamSerializerJQLike', - function ($http, $httpParamSerializerJQLike) { - this.getAppMachines = function (app) { - return $http({ - url: 'app/' + app + '/machines.json', - method: 'GET' - }); - }; - this.removeAppMachine = function (app, ip, port) { - return $http({ - url: 'app/' + app + '/machine/remove.json', - method: 'POST', - headers: { - 'Content-type': 'application/x-www-form-urlencoded; charset=UTF-8' - }, - data: $httpParamSerializerJQLike({ - ip: ip, - port: port - }) - }); - }; - }] -); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/metricservice.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/metricservice.js deleted file mode 100644 index 8d8a38e0..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/metricservice.js +++ /dev/null @@ -1,36 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.service('MetricService', ['$http', function ($http) { - - this.queryAppSortedIdentities = function (params) { - return $http({ - url: '/metric/queryTopResourceMetric.json', - params: params, - method: 'GET' - }); - }; - - this.queryByAppAndIdentity = function (params) { - return $http({ - url: '/metric/queryByAppAndResource.json', - params: params, - method: 'GET' - }); - }; - - this.queryByMachineAndIdentity = function (ip, port, identity, startTime, endTime) { - var param = { - ip: ip, - port: port, - identity: identity, - startTime: startTime.getTime(), - endTime: endTime.getTime() - }; - - return $http({ - url: '/metric/queryByAppAndResource.json', - params: param, - method: 'GET' - }); - }; -}]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/param_flow_service.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/param_flow_service.js deleted file mode 100644 index 2e235554..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/param_flow_service.js +++ /dev/null @@ -1,104 +0,0 @@ -/** - * Parameter flow control service. - * - * @author Eric Zhao - */ -angular.module('sentinelDashboardApp').service('ParamFlowService', ['$http', function ($http) { - this.queryMachineRules = function(app, ip, port) { - var param = { - app: app, - ip: ip, - port: port - }; - return $http({ - url: '/paramFlow/rules', - params: param, - method: 'GET' - }); - }; - - this.addNewRule = function(rule) { - return $http({ - url: '/paramFlow/rule', - data: rule, - method: 'POST' - }); - }; - - this.saveRule = function (entity) { - return $http({ - url: '/paramFlow/rule/' + entity.id, - data: entity, - method: 'PUT' - }); - }; - - this.deleteRule = function (entity) { - return $http({ - url: '/paramFlow/rule/' + entity.id, - method: 'DELETE' - }); - }; - - function isNumberClass(classType) { - return classType === 'int' || classType === 'double' || - classType === 'float' || classType === 'long' || classType === 'short'; - } - - function isByteClass(classType) { - return classType === 'byte'; - } - - function notNumberAtLeastZero(num) { - return num === undefined || num === '' || isNaN(num) || num < 0; - } - - function notGoodNumber(num) { - return num === undefined || num === '' || isNaN(num); - } - - function notGoodNumberBetweenExclusive(num, l ,r) { - return num === undefined || num === '' || isNaN(num) || num < l || num > r; - } - - function notValidParamItem(curExItem) { - if (isNumberClass(curExItem.classType) && notGoodNumber(curExItem.object)) { - return true; - } - if (isByteClass(curExItem.classType) && notGoodNumberBetweenExclusive(curExItem.object, -128, 127)) { - return true; - } - return curExItem.object === undefined || curExItem.classType === undefined || - notNumberAtLeastZero(curExItem.count); - } - - this.checkRuleValid = function (rule) { - if (!rule.resource || rule.resource === '') { - alert('资源名称不能为空'); - return false; - } - if (rule.grade != 1) { - alert('未知的限流模式'); - return false; - } - if (rule.count < 0) { - alert('限流阈值必须大于等于 0'); - return false; - } - if (rule.paramIdx === undefined || rule.paramIdx === '' || isNaN(rule.paramIdx) || rule.paramIdx < 0) { - alert('热点参数索引必须大于等于 0'); - return false; - } - if (rule.paramFlowItemList !== undefined) { - for (var i = 0; i < rule.paramFlowItemList.length; i++) { - var item = rule.paramFlowItemList[i]; - if (notValidParamItem(item)) { - alert('热点参数例外项不合法,请检查值和类型是否正确:参数为 ' + item.object + ', 类型为 ' + - item.classType + ', 限流阈值为 ' + item.count); - return false; - } - } - } - return true; - }; -}]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/systemservice.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/systemservice.js deleted file mode 100644 index 8b476793..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/systemservice.js +++ /dev/null @@ -1,77 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.service('SystemService', ['$http', function ($http) { - this.queryMachineRules = function (app, ip, port) { - var param = { - app: app, - ip: ip, - port: port - }; - return $http({ - url: 'system/rules.json', - params: param, - method: 'GET' - }); - }; - - this.newRule = function (rule) { - var param = { - app: rule.app, - ip: rule.ip, - port: rule.port - }; - if (rule.grade == 0) {// avgLoad - param.highestSystemLoad = rule.highestSystemLoad; - } else if (rule.grade == 1) {// avgRt - param.avgRt = rule.avgRt; - } else if (rule.grade == 2) {// maxThread - param.maxThread = rule.maxThread; - } else if (rule.grade == 3) {// qps - param.qps = rule.qps; - } else if (rule.grade == 4) {// cpu - param.highestCpuUsage = rule.highestCpuUsage; - } - - return $http({ - url: '/system/new.json', - params: param, - method: 'GET' - }); - }; - - this.saveRule = function (rule) { - var param = { - id: rule.id, - }; - if (rule.grade == 0) {// avgLoad - param.highestSystemLoad = rule.highestSystemLoad; - } else if (rule.grade == 1) {// avgRt - param.avgRt = rule.avgRt; - } else if (rule.grade == 2) {// maxThread - param.maxThread = rule.maxThread; - } else if (rule.grade == 3) {// qps - param.qps = rule.qps; - } else if (rule.grade == 4) {// cpu - param.highestCpuUsage = rule.highestCpuUsage; - } - - return $http({ - url: '/system/save.json', - params: param, - method: 'GET' - }); - }; - - this.deleteRule = function (rule) { - var param = { - id: rule.id, - app: rule.app - }; - - return $http({ - url: '/system/delete.json', - params: param, - method: 'GET' - }); - }; -}]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/version_service.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/version_service.js deleted file mode 100644 index 1322f563..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/scripts/services/version_service.js +++ /dev/null @@ -1,10 +0,0 @@ -var app = angular.module('sentinelDashboardApp'); - -app.service('VersionService', ['$http', function ($http) { - this.version = function () { - return $http({ - url: '/version', - method: 'GET' - }); - }; -}]); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/styles/main.css b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/styles/main.css deleted file mode 100644 index bb1db2bf..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/styles/main.css +++ /dev/null @@ -1,1756 +0,0 @@ -.browsehappy { - margin: 0.2em 0; - background: #ccc; - color: #000; - padding: 0.2em 0; -} - -body { - padding: 0; -} - -/* Everything but the jumbotron gets side spacing for mobile first views */ - -.header, -.marketing, -.footer { - padding-left: 15px; - padding-right: 15px; -} - - -/* Custom page header */ - -.header { - border-bottom: 1px solid #e5e5e5; - margin-bottom: 10px; -} - - -/* Make the masthead heading the same height as the navigation */ - -.header h3 { - margin-top: 0; - margin-bottom: 0; - line-height: 40px; - padding-bottom: 19px; -} - - -/* Custom page footer */ - -.footer { - padding-top: 19px; - color: #777; - border-top: 1px solid #e5e5e5; -} - -.container-narrow > hr { - margin: 30px 0; -} - - -/* Main marketing message and sign up button */ - -.jumbotron { - text-align: center; - border-bottom: 1px solid #e5e5e5; -} - -.jumbotron .btn { - font-size: 21px; - padding: 14px 24px; -} - - -/* Supporting marketing content */ - -.marketing { - margin: 40px 0; -} - -.marketing p + h4 { - margin-top: 28px; -} - - -/* Responsive: Portrait tablets and up */ - -@media screen and (min-width: 768px) { - .container { - width: inherit; - margin-left: 60px; - margin-right: 5px; - } - /* Remove the padding we set earlier */ - .header, - .marketing, - .footer { - padding-left: 0; - padding-right: 0; - } - /* Space out the masthead */ - .header { - margin-bottom: 30px; - } - /* Remove the bottom border on the jumbotron for visual effect */ - .jumbotron { - border-bottom: 0; - } -} - -.navbar-inverse { - background-color: #1d9d74; - border-color: #1b926c; -} - -.navbar-inverse .navbar-nav > li > a { - color: #b0ddce; - font-size: 15px; -} - -.navbar-inverse .navbar-nav>.open>a, -.navbar-inverse .navbar-nav>.open>a:focus, -.navbar-inverse .navbar-nav>.open>a:hover { - background-color: #1b926c; -} - -@media (min-width: 900px) { - .navbar-left { - float: left !important; - } - .navbar-right { - float: right !important; - margin-right: 0%; - } - .navbar-right ~ .navbar-right { - margin-right: 0; - } -} - -.dropdown-menu { - min-width: 100px !important; -} - -.nav-sidebar li.active a { - background: #DDD; -} - -.dropdown-menu>li>a:hover, .dropdown-menu>li>a:focus { - background: #1d9d74; - /*background: #d9d9d9;*/ - color: white; -} - -.broadcast-message, -.broadcast-message-preview { - padding: 10px; - text-align: center; - background: #555; - color: #BBB; - margin-top: 50px; -} - -.card { - position: relative; - border: 1px solid #d9d9d9; - border-radius: 3px; - color: #666; - background-color: #fff; - width: 100%; - border-radius: 5px; -} - -.card .card-header { - padding: 9px 0; - height: 40px; - background: #555; - color: #fff; - text-align: center; - border-top-left-radius: 4px; - border-top-right-radius: 4px; -} - -.card .card-body { - padding: 12px 10px; -} - -.card .card-footer { - height: 20px; - font-size: 10px; - color: #777; - margin-top: -15px; - margin-bottom: 5px; - margin-left: 20px; - margin-right: 20px; -} - -.card .detail-brand { - float: left; - width: 30%; - line-height: 98px; - font-size: 30px; - text-align: center; - color: white; -} - -.card .default { - background: #1d9d74; -} - -.card .info { - background: #6EBEE7; -} - -.card .warn { - background: #ED7F54; -} - -.card .danger { - background: #6583BE; -} - -.card .detail .text-default { - color: #1d9d74; -} - -.card .detail .text-info { - color: #6EBEE7; -} - -.card .detail .text-warn { - color: #ED7F54; -} - -.card .detail .text-danger { - color: #6583BE; -} - -.card .detail { - float: right; - width: 70%; - line-height: 98px; - text-align: center; -} - -.card .detail .text { - font-size: 12px; -} - -.card .detail .number { - font-size: 30px; - font-weight: 500; -} - -.h100 { - height: 100px; -} - -.inline { - display: inline; -} - -.separator { - height: 1px; - background-color: #e5e5e5; - margin-top: 10px; -} - -.card > .card-body > table > thead > tr > td, -.card > .card-body > table > tbody > tr > td { - word-wrap: break-word; - word-break: break-all; -} - -.card > .card-body > table > thead > tr > td { - font-weight: 500; - font-size: 13px; - text-align: center; -} - -.card > .card-body > table > thead > tr > td > span { - font-weight: 500; - font-size: 10px; -} - -.card > .card-body > table > tbody > tr > td { - font-size: 12px; - text-align: center; -} - -.card > .card-body > table > tbody > tr > td > a { - color: #666; -} - -.thumbnails > .card > .card-body > table > thead > tr > td, -.thumbnails > .card > .card-body > table > tbody > tr > td { - font-size: 12px; - color: #777; - word-wrap: break-word; - word-break: break-all; -} - -.thumbnails > .card > .card-body > table > thead > tr > td:nth-child(n+2) { - text-align: center; -} - -.thumbnails > .card > .card-body > table > tbody > tr > td:nth-child(n+2) { - font-weight: 700; - text-align: center; -} - -.thumbnails > .card > .card-body > table > thead > tr > td:nth-child(1), -.thumbnails > .card > .card-body > table > tbody > tr > td:nth-child(1) { - text-align: left; -} - -.tools-header { - background: whitesmoke; - padding: 9px 0; - height: 40px; - border-top-left-radius: 4px; - border-top-right-radius: 4px; -} - -.tools-header .brand { - font-size: 13px; - margin: 2px 10px; - font-weight: 700; - float: left; -} - -.tools-header .brand > a { - color: #666; -} - -.tools-header > button, -.tools-header > select, -.tools-header > a { - float: right; - max-width: 80px; - margin: 1px 10px; - height: 25px; - padding: 0 10px; - line-height: 25px; - color: #666; -} - -.tools-header .paged { - margin-right: 0px; -} - -.btn { - height: 32px; -} - -.btn.btn-main { - color: #ffffff; - background-color: #337ab7; - border-color: #337ab7; -} - -.btn:focus, -.btn:active { - outline: none !important; -} - -.btn-default:hover, -.btn-default:focus, -.btn-default:active { - color: #1d9d74; - border-color: #1d9d74; - background: white; -} - - -.btn.btn-danger-tag { - color: #ffffff; - background-color: #d9534f; - border-color: #d43f3a; - line-height: 1px; - font-size: 11px; - padding: 4px 4px; -} - -.btn.btn-danger { - color: #333; - background-color: #fff; - border-color: #ccc; -} - -.btn.btn-danger:hover, -.btn.btn-danger:focus, -.btn.btn-danger:active { - color: #d9534f; - border-color: #d9534f; - background: white; -} - -.form-control { - height : 32px; -} - -.form-control:focus { - border-color: #337ab7; - box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.075) inset, 0px 0px 0px rgba(29, 157, 116, 1); -} - -.form-control { - border-radius: 8px; -} - -.input-label:before { - display: inline-block; - content: "*"; - color: #f44336; - font-family: SimSun; - font-size: 12px; - -webkit-transform: TranslateX(-10px); - -ms-transform: TranslateX(-10px); - transform: TranslateX(-10px); -} - -.label.label-main { - color: #ffffff; - background-color: #1d9d74; - border-color: #1d9d74; -} - -.badge-main { - color: #ffffff; - background-color: #1d9d74; - border-color: #1d9d74; -} - -.bootstrap-tagsinput { - background-color: #fff; - border: 1px solid #ccc; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - display: inline-block; - padding: 4px 6px; - color: #555; - vertical-align: middle; - border-radius: 4px; - /* max-width: 100%; */ - width: 85%; - height: 100px; - line-height: 20px; - cursor: text; -} - -.bootstrap-tagsinput > .dropdown-menu { - min-width: 40px; - font-size: 12px; -} - -.bootstrap-tagsinput > .dropdown-menu>.active>a, -.bootstrap-tagsinput > .dropdown-menu>.active>a:focus, -.bootstrap-tagsinput > .dropdown-menu>.active>a:hover { - background-color: #1d9d74; - background-image: -webkit-linear-gradient(top, #1d9d74 0, #1d9d74 100%); - background-image: -o-linear-gradient(top, #1d9d74 0, #1d9d74 100%); - background-image: -webkit-gradient(linear, left top, left bottom, from(#1d9d74), to(#1d9d74)); - background-image: linear-gradient(to bottom, #1d9d74 0, #1d9d74 100%); - filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#1d9d74', endColorstr='#1d9d74', GradientType=0); - background-repeat: repeat-x; -} - -.bootstrap-tagsinput > .dropdown-menu>.active>a, -.bootstrap-tagsinput > .dropdown-menu>.active>a:focus, -.bootstrap-tagsinput > .dropdown-menu>.active>a:hover { - color: #fff; - text-decoration: none; - background-color: #1d9d74; - outline: 0; -} - -.bootstrap-tagsinput > .dropdown-menu>.active>a, -.bootstrap-tagsinput > .dropdown-menu>.active>a:hover, -.bootstrap-tagsinput > .dropdown-menu>.active>a:focus { - color: white; - text-decoration: none; - outline: 0; - background-color: #1d9d74; -} - -.inputs-header { - padding: 9px 0; - height: 50px; - border-top-left-radius: 4px; - border-top-right-radius: 4px; -} - -.inputs-header .brand { - font-size: 13px; - margin: 2px 10px; - font-weight: 700; - float: left; -} - -.inputs-header .brand > a { - color: #666; -} - -.inputs-header > input { - float: right; - margin: 1px 10px; - height: 30px; - padding: 0 10px; - color: #666; -} - -.inputs-header > a { - float: right; - margin: 1px 10px; - height: 30px; - padding: 5 5px; -} - -.inputs-header > select { - float: right; - max-width: 80px; - margin: 1px 10px; - height: 30px; - padding: 0 10px; - color: #666; - height: 25px; - font-size: 12px; -} - -.witdh-150 { - max-width: 150px; -} - -.witdh-200 { - max-width: 200px; -} - -.width-200 { - max-width: 200px; -} - -.witdh-300 { - max-width: 300px; -} - -.width-300 { - max-width: 300px; -} - -.card.highlight { - border-color: #d9534f; -} - -.card .pagination-footer { - height: 40px; - font-size: 10px; - color: #777; - margin-top: -15px; - margin-bottom: 5px; - margin-left: 20px; - margin-right: 20px; -} - -.card .pagination-footer .tools { - font-size: 12px; - margin: 11px 0; - float: right; - display: inline; - margin-right: 20px; -} - -.card > .pagination-footer > .tools > span > input { - height: 25px; - max-width: 50px; - display: inline; -} - -.pagination { - display: inline-block; - padding-left: 0; - margin: 8px 0; - float: right; - border-radius: 4px; -} - - -.pagination > a { - margin-right: 5px; - height: 28px; - width: 28px; - padding: 5px 0px; -} - -.pagination > .btn.active { - color: #ffffff; - background-color: #1d9d74; - border-color: #1d9d74; -} - - - - -.datepicker > .table > thead > tr > td, .datepicker > .table > tbody > tr > td, -.timepicker > .table > thead > tr > td, .timepicker > .table > tbody > tr > td { - padding: 5px 3px; -} - -.datepicker > .table > thead > tr > td > .btn, .datepicker > .table > tbody > tr > td > .btn, -.timepicker > .table > thead > tr > td > .btn, .timepicker > .table > tbody > tr > td > .btn { - border: 1px solid #FFFDFD; -} - -.datepicker > .table > thead > tr > td > .btn-default:hover, -.datepicker > .table > thead > tr > td > .btn-default:focus, -.datepicker > .table > thead > tr > td > .btn-default:active, -.datepicker > .table > tbody > tr > td > .btn-default:hover, -.datepicker > .table > tbody > tr > td > .btn-default:focus, -.datepicker > .table > tbody > tr > td > .btn-default:active, -.timepicker > .table > thead > tr > td > .btn-default:hover, -.timepicker > .table > thead > tr > td > .btn-default:focus, -.timepicker > .table > thead > tr > td > .btn-default:active, -.timepicker > .table > tbody > tr > td > .btn-default:hover, -.timepicker > .table > tbody > tr > td > .btn-default:focus, -.timepicker > .table > tbody > tr > td > .btn-default:active { - color: #1d9d74; - border-color: #1d9d74; - background: white; -} - -.datepicker > .table > thead > tr > td > a, .datepicker > .table > tbody > tr > td > a, -.timepicker > .table > thead > tr > td > a, .timepicker > .table > tbody > tr > td > a { - height: 25px; - width: 25px; - padding: 3px 0px; -} - -.datepicker > .table > tbody > tr:first-child > td > a { - padding: 4px 0px; -} - -.datepicker > .table > thead > tr > td > a.btn.active, -.datepicker > .table > tbody > tr > td > a.btn.active, -.timepicker > .table > thead > tr > td > a.btn.active, -.timepicker > .table > tbody > tr > td > a.btn.active { -/* color: #ffffff; - background-color: #1d9d74; - border-color: #1d9d74;*/ - color: #1d9d74; - border-color: #1d9d74; - background: white; - box-shadow: inset 0 0px 0px rgba(0,0,0,0.125); -} - -.datepicker > .table > thead > tr > td:not(:first-child):last-child > a, -.timepicker > .table > thead > tr > td:not(:first-child):last-child > a { - height: 25px; - width: 50px; - padding: 5px 0px; -} - -.datepicker > .table > tbody > tr > td > a, -.timepicker > .table > tbody > tr > td > a { - margin-left: 8px; -} - - -.selectize-input-200 > .selectize-input { - min-width: 250px; -} - -.highlight-border { - border-color: #337ab7; - box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.075) inset, 0px 0px 0px rgba(29, 157, 116, 1); -}.browsehappy { - margin: 0.2em 0; - background: #ccc; - color: #000; - padding: 0.2em 0; -} - -body { - padding: 0; -} - - -/* Everything but the jumbotron gets side spacing for mobile first views */ - -.header, -.marketing, -.footer { - padding-left: 15px; - padding-right: 15px; -} - - -/* Custom page header */ - -.header { - border-bottom: 1px solid #e5e5e5; - margin-bottom: 10px; -} - - -/* Make the masthead heading the same height as the navigation */ - -.header h3 { - margin-top: 0; - margin-bottom: 0; - line-height: 40px; - padding-bottom: 19px; -} - - -/* Custom page footer */ - -.footer { - padding-top: 19px; - color: #777; - border-top: 1px solid #e5e5e5; -} - -.container-narrow > hr { - margin: 30px 0; -} - - -/* Main marketing message and sign up button */ - -.jumbotron { - text-align: center; - border-bottom: 1px solid #e5e5e5; -} - -.jumbotron .btn { - font-size: 21px; - padding: 14px 24px; -} - - -/* Supporting marketing content */ - -.marketing { - margin: 40px 0; -} - -.marketing p + h4 { - margin-top: 28px; -} - - -/* Responsive: Portrait tablets and up */ - -@media screen and (min-width: 768px) { - .container { - width: inherit; - margin-left: 60px; - margin-right: 5px; - } - /* Remove the padding we set earlier */ - .header, - .marketing, - .footer { - padding-left: 0; - padding-right: 0; - } - /* Space out the masthead */ - .header { - margin-bottom: 30px; - } - /* Remove the bottom border on the jumbotron for visual effect */ - .jumbotron { - border-bottom: 0; - } -} - -.navbar-inverse { - background-color: #1d9d74; - border-color: #1b926c; -} - -.navbar-inverse .navbar-nav > li > a { - color: #b0ddce; - font-size: 15px; -} - -.navbar-inverse .navbar-nav>.open>a, -.navbar-inverse .navbar-nav>.open>a:focus, -.navbar-inverse .navbar-nav>.open>a:hover { - background-color: #1b926c; -} - -@media (min-width: 900px) { - .navbar-left { - float: left !important; - } - .navbar-right { - float: right !important; - margin-right: 0%; - } - .navbar-right ~ .navbar-right { - margin-right: 0; - } -} - -.dropdown-menu { - min-width: 100px !important; -} - -.nav-sidebar li.active a { - background: #DDD; -} - -.dropdown-menu>li>a:hover, .dropdown-menu>li>a:focus { - background: #1d9d74; - /*background: #d9d9d9;*/ - color: white; -} - -.broadcast-message, -.broadcast-message-preview { - padding: 10px; - text-align: center; - background: #555; - color: #BBB; - margin-top: 50px; -} - -.card { - position: relative; - border: 1px solid #d9d9d9; - border-radius: 3px; - color: #666; - background-color: #fff; - width: 100%; - border-radius: 5px; -} - -.card .card-header { - padding: 9px 0; - height: 40px; - background: #555; - color: #fff; - text-align: center; - border-top-left-radius: 4px; - border-top-right-radius: 4px; -} - -.card .card-body { - padding: 12px 10px; -} - -.card .card-footer { - height: 20px; - font-size: 10px; - color: #777; - margin-top: -15px; - margin-bottom: 5px; - margin-left: 20px; - margin-right: 20px; -} - -.card .detail-brand { - float: left; - width: 30%; - line-height: 98px; - font-size: 30px; - text-align: center; - color: white; -} - -.card .default { - background: #1d9d74; -} - -.card .info { - background: #6EBEE7; -} - -.card .warn { - background: #ED7F54; -} - -.card .danger { - background: #6583BE; -} - -.card .detail .text-default { - color: #1d9d74; -} - -.card .detail .text-info { - color: #6EBEE7; -} - -.card .detail .text-warn { - color: #ED7F54; -} - -.card .detail .text-danger { - color: #6583BE; -} - -.card .detail { - float: right; - width: 70%; - line-height: 98px; - text-align: center; -} - -.card .detail .text { - font-size: 12px; -} - -.card .detail .number { - font-size: 30px; - font-weight: 500; -} - -.h100 { - height: 100px; -} - -.inline { - display: inline; -} - -.separator { - height: 1px; - background-color: #e5e5e5; - margin-top: 10px; -} - -.card > .card-body > table > thead > tr > td, -.card > .card-body > table > tbody > tr > td { - word-wrap: break-word; - word-break: break-all; -} - -.card > .card-body > table > thead > tr > td { - font-weight: 500; - font-size: 13px; - text-align: center; -} - -.card > .card-body > table > thead > tr > td > span { - font-weight: 500; - font-size: 10px; -} - -.card > .card-body > table > tbody > tr > td { - font-size: 12px; - text-align: center; -} - -.card > .card-body > table > tbody > tr > td > a { - color: #666; -} - -.thumbnails > .card > .card-body > table > thead > tr > td, -.thumbnails > .card > .card-body > table > tbody > tr > td { - font-size: 12px; - color: #777; - word-wrap: break-word; - word-break: break-all; -} - -.thumbnails > .card > .card-body > table > thead > tr > td:nth-child(n+2) { - text-align: center; -} - -.thumbnails > .card > .card-body > table > tbody > tr > td:nth-child(n+2) { - font-weight: 700; - text-align: center; -} - -.thumbnails > .card > .card-body > table > thead > tr > td:nth-child(1), -.thumbnails > .card > .card-body > table > tbody > tr > td:nth-child(1) { - text-align: left; -} - -.tools-header { - background: whitesmoke; - padding: 9px 0; - height: 40px; - border-top-left-radius: 4px; - border-top-right-radius: 4px; -} - -.tools-header .brand { - font-size: 13px; - margin: 2px 10px; - font-weight: 700; - float: left; -} - -.tools-header .brand > a { - color: #666; -} - -.tools-header > button, -.tools-header > select, -.tools-header > a { - float: right; - max-width: 80px; - margin: 1px 10px; - height: 25px; - padding: 0 10px; - line-height: 25px; - color: #666; -} - -.tools-header .paged { - margin-right: 0px; -} - -.btn.btn-main { - color: #ffffff; - background-color: #1d9d74; - border-color: #1d9d74; -} - -.btn:focus, -.btn:active { - outline: none !important; -} - -.btn-default:hover, -.btn-default:focus, -.btn-default:active { - color: #1d9d74; - border-color: #1d9d74; - background: white; -} - -.btn-default-inverse { - color: #1d9d74; - border-color: #1d9d74; - background: white; -} - -.btn-default-inverse:hover, -.btn-default-inverse:focus, -.btn-default:active { - color: #1d9d74; - border-color: #1d9d74; - background: white; -} - -.btn.btn-danger-tag { - color: #ffffff; - background-color: #d9534f; - border-color: #d43f3a; - line-height: 1px; - font-size: 11px; - padding: 4px 4px; -} - -.btn.btn-danger { - color: #333; - background-color: #fff; - border-color: #ccc; -} - -.btn.btn-danger:hover, -.btn.btn-danger:focus, -.btn.btn-danger:active { - color: #d9534f; - border-color: #d9534f; - background: white; -} - -.form-control { - height : 32px; -} - -.form-control:focus { - border-color: #1d9d74; - box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.075) inset, 0px 0px 0px rgba(29, 157, 116, 1); -} - -.form-control { - border-radius: 8px; -} - -.input-label:before { - display: inline-block; - content: "*"; - color: #f44336; - font-family: SimSun; - font-size: 12px; - -webkit-transform: TranslateX(-10px); - -ms-transform: TranslateX(-10px); - transform: TranslateX(-10px); -} - -.label.label-main { - color: #ffffff; - background-color: #1d9d74; - border-color: #1d9d74; -} - -.badge-main { - color: #ffffff; - background-color: #1d9d74; - border-color: #1d9d74; -} - -.bootstrap-tagsinput { - background-color: #fff; - border: 1px solid #ccc; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - display: inline-block; - padding: 4px 6px; - color: #555; - vertical-align: middle; - border-radius: 4px; - /* max-width: 100%; */ - width: 85%; - height: 100px; - line-height: 20px; - cursor: text; -} - -.bootstrap-tagsinput > .dropdown-menu { - min-width: 40px; - font-size: 12px; -} - -.bootstrap-tagsinput > .dropdown-menu>.active>a, -.bootstrap-tagsinput > .dropdown-menu>.active>a:focus, -.bootstrap-tagsinput > .dropdown-menu>.active>a:hover { - background-color: #1d9d74; - background-image: -webkit-linear-gradient(top, #1d9d74 0, #1d9d74 100%); - background-image: -o-linear-gradient(top, #1d9d74 0, #1d9d74 100%); - background-image: -webkit-gradient(linear, left top, left bottom, from(#1d9d74), to(#1d9d74)); - background-image: linear-gradient(to bottom, #1d9d74 0, #1d9d74 100%); - filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#1d9d74', endColorstr='#1d9d74', GradientType=0); - background-repeat: repeat-x; -} - -.bootstrap-tagsinput > .dropdown-menu>.active>a, -.bootstrap-tagsinput > .dropdown-menu>.active>a:focus, -.bootstrap-tagsinput > .dropdown-menu>.active>a:hover { - color: #fff; - text-decoration: none; - background-color: #1d9d74; - outline: 0; -} - -.bootstrap-tagsinput > .dropdown-menu>.active>a, -.bootstrap-tagsinput > .dropdown-menu>.active>a:hover, -.bootstrap-tagsinput > .dropdown-menu>.active>a:focus { - color: white; - text-decoration: none; - outline: 0; - background-color: #1d9d74; -} - -.inputs-header { - padding: 9px 0; - height: 50px; - border-top-left-radius: 4px; - border-top-right-radius: 4px; -} - -.inputs-header .brand { - font-size: 13px; - margin: 2px 10px; - font-weight: 700; - float: left; -} - -.inputs-header .brand > a { - color: #666; -} - -.inputs-header > input { - float: right; - margin: 1px 10px; - height: 30px; - padding: 0 10px; - color: #666; -} - -.inputs-header > a { - float: right; - margin: 1px 10px; - height: 30px; - padding: 5 5px; -} - -.inputs-header > select { - float: right; - max-width: 80px; - margin: 1px 10px; - height: 30px; - padding: 0 10px; - color: #666; - height: 25px; - font-size: 12px; -} - -.witdh-150 { - max-width: 150px; -} - -.witdh-200 { - max-width: 200px; -} - -.card.highlight { - border-color: #d9534f; -} - -.card .pagination-footer { - height: 40px; - font-size: 10px; - color: #777; - margin-top: -15px; - margin-bottom: 5px; - margin-left: 20px; - margin-right: 20px; -} - -.card .pagination-footer .tools { - font-size: 12px; - margin: 11px 0; - float: right; - display: inline; - margin-right: 20px; -} - -.card > .pagination-footer > .tools > span > input { - height: 25px; - max-width: 50px; - display: inline; -} - -.pagination { - display: inline-block; - padding-left: 0; - margin: 8px 0; - float: right; - border-radius: 4px; -} - - -.pagination > a { - margin-right: 5px; - height: 28px; - width: 28px; - padding: 5px 0px; -} - -.pagination > .btn.active { - color: #ffffff; - background-color: #449d44; - border-color: #449d44; -} - - - - -.datepicker > .table > thead > tr > td, .datepicker > .table > tbody > tr > td, -.timepicker > .table > thead > tr > td, .timepicker > .table > tbody > tr > td { - padding: 5px 3px; -} - -.datepicker > .table > thead > tr > td > .btn, .datepicker > .table > tbody > tr > td > .btn, -.timepicker > .table > thead > tr > td > .btn, .timepicker > .table > tbody > tr > td > .btn { - border: 1px solid #FFFDFD; -} - -.datepicker > .table > thead > tr > td > .btn-default:hover, -.datepicker > .table > thead > tr > td > .btn-default:focus, -.datepicker > .table > thead > tr > td > .btn-default:active, -.datepicker > .table > tbody > tr > td > .btn-default:hover, -.datepicker > .table > tbody > tr > td > .btn-default:focus, -.datepicker > .table > tbody > tr > td > .btn-default:active, -.timepicker > .table > thead > tr > td > .btn-default:hover, -.timepicker > .table > thead > tr > td > .btn-default:focus, -.timepicker > .table > thead > tr > td > .btn-default:active, -.timepicker > .table > tbody > tr > td > .btn-default:hover, -.timepicker > .table > tbody > tr > td > .btn-default:focus, -.timepicker > .table > tbody > tr > td > .btn-default:active { - color: #1d9d74; - border-color: #1d9d74; - background: white; -} - -.datepicker > .table > thead > tr > td > a, .datepicker > .table > tbody > tr > td > a, -.timepicker > .table > thead > tr > td > a, .timepicker > .table > tbody > tr > td > a { - height: 25px; - width: 25px; - padding: 3px 0px; -} - -.datepicker > .table > tbody > tr:first-child > td > a { - padding: 4px 0px; -} - -.datepicker > .table > thead > tr > td > a.btn.active, -.datepicker > .table > tbody > tr > td > a.btn.active, -.timepicker > .table > thead > tr > td > a.btn.active, -.timepicker > .table > tbody > tr > td > a.btn.active { -/* color: #ffffff; - background-color: #1d9d74; - border-color: #1d9d74;*/ - color: #1d9d74; - border-color: #1d9d74; - background: white; - box-shadow: inset 0 0px 0px rgba(0,0,0,0.125); -} - -.datepicker > .table > thead > tr > td:not(:first-child):last-child > a, -.timepicker > .table > thead > tr > td:not(:first-child):last-child > a { - height: 25px; - width: 50px; - padding: 5px 0px; -} - -.datepicker > .table > tbody > tr > td > a, -.timepicker > .table > tbody > tr > td > a { - margin-left: 8px; -} - - -.selectize-input-200 > .selectize-input { - min-width: 250px; -} - -.highlight-border { - border-color: #1d9d74; - box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.075) inset, 0px 0px 0px rgba(29, 157, 116, 1); -} - - -.sortorder:after { - content: '\25b2'; -} -.sortorder.reverse:after { - content: '\25bc'; -} - - - -.input-control select { - -moz-appearance: none; - -webkit-appearance: none; - appearance: none; - position: relative; - border: 1px #d9d9d9 solid; - width: 100%; - height: 100%; - padding: .3125rem; - z-index: 0; -} - -.navbar-inverse { - background-color: #337ab7; - border-color: #337ab7; -} - -.sidebar { - z-index: 1; - width: 220px; - /*position: fixed;*/ - top: 0; - left: 0; - height: 100%; -} - -#page-wrapper { - position: inherit; - margin: 70px 0 0 220px; - padding: 12px 30px; - border-left: 0px solid #e7e7e7; -} - -.sidebar .sidebar-nav.navbar-collapse { - padding-right: 0; - padding-left: 0; - background-color: #F5F5F5; - position: relative; - color: black; - width: 100%; - padding: 0; - margin: 0; - list-style: none inside none; -} - -.sidebar a { - color: #555; -} - -.sidebar ul li:hover { - color:red; -} - -.form-control { - border-radius: 8px; -} - -.form-control:focus { - border-color: #337ab7; - box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.075) inset, 0px 0px 0px rgba(29, 157, 116, 1); -} - -.highlight-border { - border-color: #337ab7; - box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.075) inset, 0px 0px 0px rgba(29, 157, 116, 1); -}.browsehappy { - margin: 0.2em 0; - background: #ccc; - color: #000; - padding: 0.2em 0; -} - -.btn.btn-main { - color: #ffffff; - background-color: #337ab7; - border-color: #337ab7; -} - -.btn-default-inverse { - color: #337ab7; - border-color: #337ab7; - background: white; -} - -.btn-default-inverse:hover, -.btn-default-inverse:focus, -.btn-default:active { - color: #337ab7; - border-color: #337ab7; - background: white; -} - -.btn-danger-inverse { - color: #d9534f; - border-color: #d9534f; - background: white; -} - -.btn-danger-inverse:hover, -.btn-danger-inverse:focus, -.btn-danger:active { - color: #d9534f; - border-color: #d9534f; - background: white; -} - -.btn-tab-active, -.btn-tab-active:hover, -.btn-tab-active:focus, -.btn-tab-default:hover, -.btn-tab-default:focus, -.btn-tab-default:active { - color: #337ab7; - border-color: #337ab7; - background: white; - font-weight: 600; -} -.btn-tab-default { - color: #777; - background: white; - font-weight: 600; -} - -.pagination > .btn.active { - color: #ffffff; - background-color: #337ab7; - border-color: #337ab7; -} - -.btn-default:hover, .btn-default:focus, .btn-default:active { - color: #337ab7; - border-color: #337ab7; - background: white; -} - -.bootstrap-switch.bootstrap-switch-on { - border-color: #337ab7; -} - -.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success, .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success { - color: #fff; - background: #337ab7; -} - -.selectize-input-200 > .selectize-input { - min-width: 200px; - border-color: #337ab7; -} - -.btn-outline-primary { - color: #007bff; - background-color: transparent; - background-image: none; - border-color: #007bff; -} - -.btn-outline-primary:hover { - color: #fff; - background-color: #007bff; - border-color: #007bff; -} - -.btn-outline-primary:focus, .btn-outline-primary.focus { - box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.5); -} - -.btn-outline-primary.disabled, .btn-outline-primary:disabled { - color: #007bff; - background-color: transparent; -} - -.btn-outline-primary:not(:disabled):not(.disabled):active, .btn-outline-primary:not(:disabled):not(.disabled).active, -.show > .btn-outline-primary.dropdown-toggle { - color: #fff; - background-color: #007bff; - border-color: #007bff; -} - -.btn-outline-primary:not(:disabled):not(.disabled):active:focus, .btn-outline-primary:not(:disabled):not(.disabled).active:focus, -.show > .btn-outline-primary.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.5); -} - -.btn-outline-secondary { - color: #6c757d; - background-color: transparent; - background-image: none; - border-color: #6c757d; -} - -.btn-outline-secondary:hover { - color: #fff; - background-color: #6c757d; - border-color: #6c757d; -} - -.btn-outline-secondary:focus, .btn-outline-secondary.focus { - box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.5); -} - -.btn-outline-secondary.disabled, .btn-outline-secondary:disabled { - color: #6c757d; - background-color: transparent; -} - -.btn-outline-secondary:not(:disabled):not(.disabled):active, .btn-outline-secondary:not(:disabled):not(.disabled).active, -.show > .btn-outline-secondary.dropdown-toggle { - color: #fff; - background-color: #6c757d; - border-color: #6c757d; -} - -.btn-outline-secondary:not(:disabled):not(.disabled):active:focus, .btn-outline-secondary:not(:disabled):not(.disabled).active:focus, -.show > .btn-outline-secondary.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.5); -} - -.btn-outline-success { - color: #28a745; - background-color: transparent; - background-image: none; - border-color: #28a745; -} - -.btn-outline-success:hover { - color: #fff; - background-color: #28a745; - border-color: #28a745; -} - -.btn-outline-success:focus, .btn-outline-success.focus { - box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.5); -} - -.btn-outline-success.disabled, .btn-outline-success:disabled { - color: #28a745; - background-color: transparent; -} - -.btn-outline-success:not(:disabled):not(.disabled):active, .btn-outline-success:not(:disabled):not(.disabled).active, -.show > .btn-outline-success.dropdown-toggle { - color: #fff; - background-color: #28a745; - border-color: #28a745; -} - -.btn-outline-success:not(:disabled):not(.disabled):active:focus, .btn-outline-success:not(:disabled):not(.disabled).active:focus, -.show > .btn-outline-success.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.5); -} - -.btn-outline-info { - color: #17a2b8; - background-color: transparent; - background-image: none; - border-color: #17a2b8; -} - -.btn-outline-info:hover { - color: #fff; - background-color: #17a2b8; - border-color: #17a2b8; -} - -.btn-outline-info:focus, .btn-outline-info.focus { - box-shadow: 0 0 0 0.2rem rgba(23, 162, 184, 0.5); -} - -.btn-outline-info.disabled, .btn-outline-info:disabled { - color: #17a2b8; - background-color: transparent; -} - -.btn-outline-info:not(:disabled):not(.disabled):active, .btn-outline-info:not(:disabled):not(.disabled).active, -.show > .btn-outline-info.dropdown-toggle { - color: #fff; - background-color: #17a2b8; - border-color: #17a2b8; -} - -.btn-outline-info:not(:disabled):not(.disabled):active:focus, .btn-outline-info:not(:disabled):not(.disabled).active:focus, -.show > .btn-outline-info.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(23, 162, 184, 0.5); -} - -.btn-outline-warning { - color: #ffc107; - background-color: transparent; - background-image: none; - border-color: #ffc107; -} - -.btn-outline-warning:hover { - color: #212529; - background-color: #ffc107; - border-color: #ffc107; -} - -.btn-outline-warning:focus, .btn-outline-warning.focus { - box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.5); -} - -.btn-outline-warning.disabled, .btn-outline-warning:disabled { - color: #ffc107; - background-color: transparent; -} - -.btn-outline-warning:not(:disabled):not(.disabled):active, .btn-outline-warning:not(:disabled):not(.disabled).active, -.show > .btn-outline-warning.dropdown-toggle { - color: #212529; - background-color: #ffc107; - border-color: #ffc107; -} - -.btn-outline-warning:not(:disabled):not(.disabled):active:focus, .btn-outline-warning:not(:disabled):not(.disabled).active:focus, -.show > .btn-outline-warning.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.5); -} - -.btn-outline-danger { - color: #dc3545; - background-color: transparent; - background-image: none; - border-color: #dc3545; -} - -.btn-outline-danger:hover { - color: #fff; - background-color: #dc3545; - border-color: #dc3545; -} - -.btn-outline-danger:focus, .btn-outline-danger.focus { - box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.5); -} - -.btn-outline-danger.disabled, .btn-outline-danger:disabled { - color: #dc3545; - background-color: transparent; -} - -.btn-outline-danger:not(:disabled):not(.disabled):active, .btn-outline-danger:not(:disabled):not(.disabled).active, -.show > .btn-outline-danger.dropdown-toggle { - color: #fff; - background-color: #dc3545; - border-color: #dc3545; -} - -.btn-outline-danger:not(:disabled):not(.disabled):active:focus, .btn-outline-danger:not(:disabled):not(.disabled).active:focus, -.show > .btn-outline-danger.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.5); -} - -.btn-outline-light { - color: #f8f9fa; - background-color: transparent; - background-image: none; - border-color: #f8f9fa; -} - -.btn-outline-light:hover { - color: #212529; - background-color: #f8f9fa; - border-color: #f8f9fa; -} - -.btn-outline-light:focus, .btn-outline-light.focus { - box-shadow: 0 0 0 0.2rem rgba(248, 249, 250, 0.5); -} - -.btn-outline-light.disabled, .btn-outline-light:disabled { - color: #f8f9fa; - background-color: transparent; -} - -.btn-outline-light:not(:disabled):not(.disabled):active, .btn-outline-light:not(:disabled):not(.disabled).active, -.show > .btn-outline-light.dropdown-toggle { - color: #212529; - background-color: #f8f9fa; - border-color: #f8f9fa; -} - -.btn-outline-light:not(:disabled):not(.disabled):active:focus, .btn-outline-light:not(:disabled):not(.disabled).active:focus, -.show > .btn-outline-light.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(248, 249, 250, 0.5); -} - -.btn-outline-dark { - color: #343a40; - background-color: transparent; - background-image: none; - border-color: #343a40; -} - -.btn-outline-dark:hover { - color: #fff; - background-color: #343a40; - border-color: #343a40; -} - -.btn-outline-dark:focus, .btn-outline-dark.focus { - box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.5); -} - -.btn-outline-dark.disabled, .btn-outline-dark:disabled { - color: #343a40; - background-color: transparent; -} - -.btn-outline-dark:not(:disabled):not(.disabled):active, .btn-outline-dark:not(:disabled):not(.disabled).active, -.show > .btn-outline-dark.dropdown-toggle { - color: #fff; - background-color: #343a40; - border-color: #343a40; -} - -.btn-outline-dark:not(:disabled):not(.disabled):active:focus, .btn-outline-dark:not(:disabled):not(.disabled).active:focus, -.show > .btn-outline-dark.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.5); -} \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/styles/page.css b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/styles/page.css deleted file mode 100644 index af3ba447..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/styles/page.css +++ /dev/null @@ -1,399 +0,0 @@ -/*! - * Start Bootstrap - SB Admin 2 Bootstrap Admin Theme (http://startbootstrap.com) - * Code licensed under the Apache License v2.0. - * For details, see http://www.apache.org/licenses/LICENSE-2.0. - */ - -body { - background-color: #f8f8f8; -} - -.example { - padding: .625rem 1.825rem .625rem 2.5rem; - border: 1px #ccc dashed; - position: relative; - margin: 0 0 .625rem 0; - background-color: #ffffff; -} - -dl dt, -dl dd { - line-height: 1.25rem; -} -dl dt { - font-style: normal; - font-weight: 700; -} -dl dd { - margin-left: .9375rem; -} -dl.horizontal dt { - float: left; - width: 10rem; - overflow: hidden; - clear: left; - text-align: right; - text-overflow: ellipsis; - white-space: nowrap; -} -dl.horizontal dd { - margin-left: 11.25rem; -} - -#wrapper { - width: 100%; -} - -#page-wrapper { - padding: 0 15px; - min-height: 568px; - background-color: #fff; -} - -@media(min-width:768px) { - #page-wrapper { - position: inherit; - margin: 0 0 0 250px; - padding: 0 30px; - border-left: 1px solid #e7e7e7; - } -} - -.navbar-top-links { - margin-right: 0; -} - -.navbar-top-links li { - display: inline-block; -} - -.navbar-top-links li:last-child { - margin-right: 15px; -} - -.navbar-top-links li a { - padding: 15px; - min-height: 50px; -} - -.navbar-top-links .dropdown-menu li { - display: block; -} - -.navbar-top-links .dropdown-menu li:last-child { - margin-right: 0; -} - -.navbar-top-links .dropdown-menu li a { - padding: 3px 20px; - min-height: 0; -} - -.navbar-top-links .dropdown-menu li a div { - white-space: normal; -} - -.navbar-top-links .dropdown-messages, -.navbar-top-links .dropdown-tasks, -.navbar-top-links .dropdown-alerts { - width: 310px; - min-width: 0; -} - -.navbar-top-links .dropdown-messages { - margin-left: 5px; -} - -.navbar-top-links .dropdown-tasks { - margin-left: -59px; -} - -.navbar-top-links .dropdown-alerts { - margin-left: -123px; -} - -.navbar-top-links .dropdown-user { - right: 0; - left: auto; -} - -.sidebar .sidebar-nav.navbar-collapse { - padding-right: 0; - padding-left: 0; - background-color: #71b1d1; - color: #ffffff; - position: relative; - width: 100%; - padding: 0; - margin: 0; - list-style: none inside none; -} - -.sidebar .sidebar-search { - padding: 15px; -} - -.sidebar ul li { - border-bottom: 1px solid #e7e7e7; -} - -.sidebar ul li a.active { - background-color: #ffffff; - color: #ffffff; -} - -.sidebar a{ - color: #fff; -} - -.sidebar .arrow { - float: right; -} - -.sidebar .fa.arrow:before { - content: "\f104"; -} - -.sidebar .active>a>.fa.arrow:before { - content: "\f107"; -} - -.sidebar .nav-second-level li, -.sidebar .nav-third-level li { - border-bottom: 0!important; -} - -.sidebar .nav-second-level li a { - padding-left: 37px; -} - -.sidebar .nav-third-level li a { - padding-left: 52px; -} - -@media(min-width:768px) { - .sidebar { - z-index: 1; - position: absolute; - width: 250px; - margin-top: 51px; - } - - .navbar-top-links .dropdown-messages, - .navbar-top-links .dropdown-tasks, - .navbar-top-links .dropdown-alerts { - margin-left: auto; - } -} - - -.btn-outline { - color: inherit; - background-color: transparent; - transition: all .5s; -} - -.btn-primary.btn-outline { - color: #428bca; -} - -.btn-success.btn-outline { - color: #5cb85c; -} - -.btn-info.btn-outline { - color: #5bc0de; -} - -.btn-warning.btn-outline { - color: #f0ad4e; -} - -.btn-danger.btn-outline { - color: #d9534f; -} - -.btn-primary.btn-outline:hover, -.btn-success.btn-outline:hover, -.btn-info.btn-outline:hover, -.btn-warning.btn-outline:hover, -.btn-danger.btn-outline:hover { - color: #fff; -} - -.chat { - margin: 0; - padding: 0; - list-style: none; -} - -.chat li { - margin-bottom: 10px; - padding-bottom: 5px; - border-bottom: 1px dotted #999; -} - -.chat li.left .chat-body { - margin-left: 60px; -} - -.chat li.right .chat-body { - margin-right: 60px; -} - -.chat li .chat-body p { - margin: 0; -} - -.panel .slidedown .glyphicon, -.chat .glyphicon { - margin-right: 5px; -} - -.chat-panel .panel-body { - height: 350px; - overflow-y: scroll; -} - -.login-panel { - margin-top: 25%; -} - -.flot-chart { - display: block; - height: 400px; -} - -.flot-chart-content { - width: 100%; - height: 100%; -} - -.dataTables_wrapper { - position: relative; - clear: both; -} - -table.dataTable thead .sorting, -table.dataTable thead .sorting_asc, -table.dataTable thead .sorting_desc, -table.dataTable thead .sorting_asc_disabled, -table.dataTable thead .sorting_desc_disabled { - background: 0 0; -} - -table.dataTable thead .sorting_asc:after { - content: "\f0de"; - float: right; - font-family: fontawesome; -} - -table.dataTable thead .sorting_desc:after { - content: "\f0dd"; - float: right; - font-family: fontawesome; -} - -table.dataTable thead .sorting:after { - content: "\f0dc"; - float: right; - font-family: fontawesome; - color: rgba(50,50,50,.5); -} - -.btn-circle { - width: 30px; - height: 30px; - padding: 6px 0; - border-radius: 15px; - text-align: center; - font-size: 12px; - line-height: 1.428571429; -} - -.btn-circle.btn-lg { - width: 50px; - height: 50px; - padding: 10px 16px; - border-radius: 25px; - font-size: 18px; - line-height: 1.33; -} - -.btn-circle.btn-xl { - width: 70px; - height: 70px; - padding: 10px 16px; - border-radius: 35px; - font-size: 24px; - line-height: 1.33; -} - -.show-grid [class^=col-] { - padding-top: 10px; - padding-bottom: 10px; - border: 1px solid #ddd; - background-color: #eee!important; -} - -.show-grid { - margin: 15px 0; -} - -.huge { - font-size: 40px; -} - -.panel-green { - border-color: #5cb85c; -} - -.panel-green .panel-heading { - border-color: #5cb85c; - color: #fff; - background-color: #5cb85c; -} - -.panel-green a { - color: #5cb85c; -} - -.panel-green a:hover { - color: #3d8b3d; -} - -.panel-red { - border-color: #d9534f; -} - -.panel-red .panel-heading { - border-color: #d9534f; - color: #fff; - background-color: #d9534f; -} - -.panel-red a { - color: #d9534f; -} - -.panel-red a:hover { - color: #b52b27; -} - -.panel-yellow { - border-color: #f0ad4e; -} - -.panel-yellow .panel-heading { - border-color: #f0ad4e; - color: #fff; - background-color: #f0ad4e; -} - -.panel-yellow a { - color: #f0ad4e; -} - -.panel-yellow a:hover { - color: #df8a13; -} \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/styles/timeline.css b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/styles/timeline.css deleted file mode 100644 index 92161ebe..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/styles/timeline.css +++ /dev/null @@ -1,180 +0,0 @@ -.timeline { - position: relative; - padding: 20px 0 20px; - list-style: none; -} - -.timeline:before { - content: " "; - position: absolute; - top: 0; - bottom: 0; - left: 50%; - width: 3px; - margin-left: -1.5px; - background-color: #eeeeee; -} - -.timeline > li { - position: relative; - margin-bottom: 20px; -} - -.timeline > li:before, -.timeline > li:after { - content: " "; - display: table; -} - -.timeline > li:after { - clear: both; -} - -.timeline > li:before, -.timeline > li:after { - content: " "; - display: table; -} - -.timeline > li:after { - clear: both; -} - -.timeline > li > .timeline-panel { - float: left; - position: relative; - width: 46%; - padding: 20px; - border: 1px solid #d4d4d4; - border-radius: 2px; - -webkit-box-shadow: 0 1px 6px rgba(0,0,0,0.175); - box-shadow: 0 1px 6px rgba(0,0,0,0.175); -} - -.timeline > li > .timeline-panel:before { - content: " "; - display: inline-block; - position: absolute; - top: 26px; - right: -15px; - border-top: 15px solid transparent; - border-right: 0 solid #ccc; - border-bottom: 15px solid transparent; - border-left: 15px solid #ccc; -} - -.timeline > li > .timeline-panel:after { - content: " "; - display: inline-block; - position: absolute; - top: 27px; - right: -14px; - border-top: 14px solid transparent; - border-right: 0 solid #fff; - border-bottom: 14px solid transparent; - border-left: 14px solid #fff; -} - -.timeline > li > .timeline-badge { - z-index: 100; - position: absolute; - top: 16px; - left: 50%; - width: 50px; - height: 50px; - margin-left: -25px; - border-radius: 50% 50% 50% 50%; - text-align: center; - font-size: 1.4em; - line-height: 50px; - color: #fff; - background-color: #999999; -} - -.timeline > li.timeline-inverted > .timeline-panel { - float: right; -} - -.timeline > li.timeline-inverted > .timeline-panel:before { - right: auto; - left: -15px; - border-right-width: 15px; - border-left-width: 0; -} - -.timeline > li.timeline-inverted > .timeline-panel:after { - right: auto; - left: -14px; - border-right-width: 14px; - border-left-width: 0; -} - -.timeline-badge.primary { - background-color: #2e6da4 !important; -} - -.timeline-badge.success { - background-color: #3f903f !important; -} - -.timeline-badge.warning { - background-color: #f0ad4e !important; -} - -.timeline-badge.danger { - background-color: #d9534f !important; -} - -.timeline-badge.info { - background-color: #5bc0de !important; -} - -.timeline-title { - margin-top: 0; - color: inherit; -} - -.timeline-body > p, -.timeline-body > ul { - margin-bottom: 0; -} - -.timeline-body > p + p { - margin-top: 5px; -} - -@media(max-width:767px) { - ul.timeline:before { - left: 40px; - } - - ul.timeline > li > .timeline-panel { - width: calc(100% - 90px); - width: -moz-calc(100% - 90px); - width: -webkit-calc(100% - 90px); - } - - ul.timeline > li > .timeline-badge { - top: 16px; - left: 15px; - margin-left: 0; - } - - ul.timeline > li > .timeline-panel { - float: right; - } - - ul.timeline > li > .timeline-panel:before { - right: auto; - left: -15px; - border-right-width: 15px; - border-left-width: 0; - } - - ul.timeline > li > .timeline-panel:after { - right: auto; - left: -14px; - border-right-width: 14px; - border-left-width: 0; - } -} \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/authority.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/authority.html deleted file mode 100644 index 5dbddedd..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/authority.html +++ /dev/null @@ -1,85 +0,0 @@ -
-
- {{app}} -
-
- -
-
- -
- -
-
-
-
-
- 授权规则 - - -
- -
-
- - -
-
- - - - - - - - - - - - - - - - -
- 资源名 - - 流控应用 - - 授权类型 - - 操作 -
{{ruleEntity.rule.resource}}{{ruleEntity.rule.limitApp }} - 白名单 - 黑名单 - - - -
- - - - - - - - - - - - diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/cluster/client.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/cluster/client.html deleted file mode 100644 index 7fc751da..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/cluster/client.html +++ /dev/null @@ -1,30 +0,0 @@ -
-
-
- -
-

未连接

-

连接中

-

已连接

-
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
-
\ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/cluster/server.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/cluster/server.html deleted file mode 100644 index 8c045876..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/cluster/server.html +++ /dev/null @@ -1,29 +0,0 @@ -
-
-
- -
-

独立模式 (Alone)

-

嵌入模式 (Embedded)

-
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
-
\ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/cluster_app_assign_manage.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/cluster_app_assign_manage.html deleted file mode 100644 index 550ff230..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/cluster_app_assign_manage.html +++ /dev/null @@ -1,118 +0,0 @@ -
-
- {{app}} -
-
- -
-
-
-
-
-
- 集群限流 - 机器分配/管控 -
- - -
-
-
-
-
-

{{loadError.message}}

-
-
-
-
-
- - -
-
-
- -
- -
- -
-
- -
- -
-
-
- -
- -
-
-
-
-
-
-
- - -
- -
-
-
- - -
-
- -
-
- -
- -
-
-
-
-
- -
-
-
-
-
-
- -
-
- -
- -
- -
- -
- diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/cluster_app_client_list.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/cluster_app_client_list.html deleted file mode 100644 index b779e30e..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/cluster_app_client_list.html +++ /dev/null @@ -1,73 +0,0 @@ -
-
- {{app}} -
- -
- -
-
-
-
-
-
- 集群限流 - Token Client 列表 -
- - -
-
-
-
-
-

{{loadError.message}}

-
-
-
-
-
- - -
- - - - - - - - - - - - - - - - - - - - -
Client IDServer IPServer 端口连接状态操作
{{clientVO.id}}{{clientVO.state.clientConfig.serverHost}}{{clientVO.state.clientConfig.serverPort}} - 未连接 - 连接中 - 已连接 - - -
-
- -
- -
- -
- -
- diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/cluster_app_server_list.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/cluster_app_server_list.html deleted file mode 100644 index d47b31f7..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/cluster_app_server_list.html +++ /dev/null @@ -1,96 +0,0 @@ -
-
- {{app}} -
-
- - - Token Client 列表 - -
-
- -
-
-
-
-
-
- 集群限流 - Token Server 列表 - -
- - -
-
-
-
-
-

{{loadError.message}}

-
-
-
-
-
- - -
- - - - - - - - - - - - - - - - - - - - - - - - -
Server IDPort命名空间集合运行模式总连接数QPS 总览操作
- {{serverVO.id}} - {{serverVO.id}}(自主指定) - {{serverVO.port}} - {{serverVO.state.namespaceSetStr}} - 未知 - - 未知 - 嵌入模式 - 独立模式 - - {{serverVO.connectedCount}} - 未知 - - {{serverVO.state.requestLimitDataStr}} - 未知 - - - - -
-
- -
- -
- -
- -
- diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/cluster_app_server_overview.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/cluster_app_server_overview.html deleted file mode 100644 index 4e411a2b..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/cluster_app_server_overview.html +++ /dev/null @@ -1,88 +0,0 @@ -
-
- {{app}} -
-
- -
-
-
-
-
-
- 集群限流 - Token Server 总览 -
- - -
-
-
-
-
-

{{loadError.message}}

-
-
-
-
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Server IDPort命名空间集合总连接数连接情况QPS 总览
{{serverVO.id}}{{serverVO.port}} - {{serverVO.state.namespaceSetStr}} - - {{serverVO.connectedCount}} - -

- namespace: {{cg.namespace}}, 连接数: {{cg.connectedCount}}, clients: - {{generateConnectionSet(cg.connectionSet)}} -

-
-

- namespace: {{crl.namespace}}, 当前 QPS: {{crl.currentQps}}, 最大允许 QPS: - {{crl.maxAllowedQps}} -

-
-
- -
- -
- -
- -
- diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/cluster_single_config.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/cluster_single_config.html deleted file mode 100644 index a82f1ab3..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/cluster_single_config.html +++ /dev/null @@ -1,95 +0,0 @@ - -
-
- {{app}} -
-
- -
-
-
-
-
-
- 集群限流 - -
- -
-
- - -
-
-
-
-
-

{{loadError.message}}

-
-
-
-
-
- - -
-
-
- -

Client

-

Server

-

未开启

-
-
- -
-
-  Client   -  Server -
-
-
-
- -
- -
-
-
-
-
-

该机器未引入 Sentinel 集群限流客户端或服务端的相关依赖,请引入相关依赖。

-
-
-
-
-
-
- - -
-
-
-
-
-
-
- -
-
- -
-
- -
- -
- -
- -
- -
- diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dashboard/home.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dashboard/home.html deleted file mode 100644 index 9a81bf5b..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dashboard/home.html +++ /dev/null @@ -1,13 +0,0 @@ -
-
-
-

欢迎使用 Sentinel 控制台

-
- -
- - -
-
- -
diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dashboard/main.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dashboard/main.html deleted file mode 100644 index c5abed5d..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dashboard/main.html +++ /dev/null @@ -1,10 +0,0 @@ -
- -
- - -
-
-
- -
diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/degrade.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/degrade.html deleted file mode 100644 index c2b67528..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/degrade.html +++ /dev/null @@ -1,98 +0,0 @@ -
-
- {{app}} -
-
- -
-
- -
- -
-
-
-
-
- 降级规则 - - - -
- -
-
- - -
- - - - - - - - - - - - - - - - - - - - - -
- 资源名 - - 降级策略 - - 阈值 - - 熔断时长(s) - - 操作 -
{{rule.resource}} - 慢调用比例 - 异常比例 - 异常数 - - {{rule.count}} - - {{rule.timeWindow}}s - - - -
-
- - - -
- -
- -
- -
- diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/authority-rule-dialog.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/authority-rule-dialog.html deleted file mode 100644 index bd69085f..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/authority-rule-dialog.html +++ /dev/null @@ -1,46 +0,0 @@ -
- {{authorityRuleDialog.title}} -
-
-
-
-
- -
- - -
-
- -
- -
- -
-
- -
- -
-
-  白名单   -  黑名单 -
-
-
- -
-
-
-
- - - -
-
-
-
diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/cluster/cluster-client-config-dialog.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/cluster/cluster-client-config-dialog.html deleted file mode 100644 index 128ab785..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/cluster/cluster-client-config-dialog.html +++ /dev/null @@ -1,40 +0,0 @@ -
- 修改 Token Client 配置 -
-
-
-
-
- -
-

{{ccDialogData.clientId}}

-
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
-
-
-
- - -
-
-
-
diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/cluster/cluster-server-assign-dialog.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/cluster/cluster-server-assign-dialog.html deleted file mode 100644 index 350c2e41..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/cluster/cluster-server-assign-dialog.html +++ /dev/null @@ -1,139 +0,0 @@ -
- {{serverAssignDialogData.title}} -
-
-
-
-
-
- -
-

{{serverAssignDialogData.serverData.currentServer}}

-
- - -
- -
-
-
- -
- -
-
-
- -
-
- -
-
-  应用内机器   -  外部指定机器 -
-
- -
-
-

若指定外部 server,请先在相应页面对外部 server 进行配置,然后在此页面指定。

-
-
-
- -
-
- -
- -
- - -
- -
-
-
- -
- -
-
-
- -
-
- -
- -
- - -
- -
-
-
-
-
- - -
-
-
-
- -
- -
-
-
- -
-
- - - -
-
- -
-
- -
- -
-
-
-
-
-
-
-
- - -
-
-
-
diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/cluster/cluster-server-connection-detail-dialog.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/cluster/cluster-server-connection-detail-dialog.html deleted file mode 100644 index afbf29ad..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/cluster/cluster-server-connection-detail-dialog.html +++ /dev/null @@ -1,37 +0,0 @@ -
- 连接详情 -
-
-
-
-
- -
-

{{connectionDetailDialogData.serverData.id}}

-
-
-
- -
- - - - - - - - - - - - - - - - -
命名空间连接数连接详情
{{cg.namespace}}{{cg.connectedCount}}{{generateConnectionSet(cg.connectionSet)}}
-
-
-
-
-
diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/confirm-dialog.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/confirm-dialog.html deleted file mode 100644 index b7bf3d67..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/confirm-dialog.html +++ /dev/null @@ -1,20 +0,0 @@ -
- {{confirmDialog.title}} -
-
-
-

- {{confirmDialog.attentionTitle}}: -
-
- {{confirmDialog.attention}} -

-
-
-
- - -
-
-
-
diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/degrade-rule-dialog.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/degrade-rule-dialog.html deleted file mode 100644 index df241ec1..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/degrade-rule-dialog.html +++ /dev/null @@ -1,83 +0,0 @@ -
- {{degradeRuleDialog.title}} -
-
-
-
-
- -
- - -
-
- - - - - - - - -
- -
-
-  慢调用比例   -  异常比例   -  异常数 -
-
-
- -
- - - -
- - - -
-
- -
- -
-
-
- -
- -
-
- - s -
-
- - -
- -
-
- - -
-
-
-
- - - -
-
-
-
diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/flow-rule-dialog.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/flow-rule-dialog.html deleted file mode 100644 index e68fb6b4..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/flow-rule-dialog.html +++ /dev/null @@ -1,148 +0,0 @@ -
- {{flowRuleDialog.title}} -
-
-
-
-
- -
- - -
-
- -
- -
- -
-
- -
- -
-
-  QPS   -  线程数 -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
- -
-
- -
-
-  单机均摊   -  总体阈值 -
-
-
-
- -
- -
- -
-
- -
-
- -
-
-  直接   -  关联   -  链路   -
-
-
- -
- -
- -
-
-
- -
- -
-
-
-
-
- -
-
-  快速失败   -  Warm Up   -  排队等待 -
-
- -
-
-
- -
- -
-
-
- -
- -
-
-
-
- -
-
-
-
- - - -
-
-
-
\ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/gateway/api-dialog.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/gateway/api-dialog.html deleted file mode 100644 index 8c8d4615..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/gateway/api-dialog.html +++ /dev/null @@ -1,49 +0,0 @@ -
- {{gatewayApiDialog.title}} -
-
-
-
- -
- - -
-
- -
- -
-
-  精确   -  前缀   -  正则   -
-
- -
- -
-
- -
-
- -
- -
-
-
-
- - - -
-
-
-
diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/gateway/flow-rule-dialog.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/gateway/flow-rule-dialog.html deleted file mode 100644 index ea744a71..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/gateway/flow-rule-dialog.html +++ /dev/null @@ -1,172 +0,0 @@ -
- {{gatewayFlowRuleDialog.title}} -
-
-
-
-
- -
-
-  Route ID   -  Route ID   -  API 分组   -  API 分组   -
-
-
- -
- -
- - - - - -
-
- -
- -
- -
-
- -
- -
-
-  Client IP   -  Remote Host   -  Header   -  URL 参数   -  Cookie   -
-
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
-
-  精确   -  子串   -  正则   -
-
- -
- -
-
- -
- -
-
-  QPS   -  线程数   -
-
-
- -
-
- -
- -
-
-
- -
-
- -
- -
-
- -
-
-
- -
- -
-
-  快速失败   -  匀速排队   -
-
-
- -
-
- -
- -
-
-
- -
-
- -
- -
-
-
-
-
-
-
- - - -
-
-
-
diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/param-flow-rule-dialog.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/param-flow-rule-dialog.html deleted file mode 100644 index 02f00b08..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/param-flow-rule-dialog.html +++ /dev/null @@ -1,166 +0,0 @@ -
- {{paramFlowRuleDialog.title}} -
-
-
-
-
- -
- - -
-
- -
- -

QPS 模式

-
- -
- -
- -
-
- -
-
- -
- -
- -
- - -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
- -
-
- -
-
-  单机均摊   -  总体阈值 -
-
-
-
- -
- -
-
- -  若选择,则 Token Server 不可用时将退化到单机限流 -
-
-
- - -
-
-
-
- -
- -
- -
- -
-
- -
- -
- -
- - -
- -
- -
- -
-
- -
-
- - - - - - - - - - - - - - - -
参数值参数类型限流阈值操作
-

{{paramItem.classType}}

-
- - - -
-
-
- -
-
- - - -
-
-
-
- - - -
-
-
-
diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/system-rule-dialog.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/system-rule-dialog.html deleted file mode 100644 index 3dd9cd97..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/dialog/system-rule-dialog.html +++ /dev/null @@ -1,58 +0,0 @@ -
- {{systemRuleDialog.title}} -
-
-
-
- -
- -
-
- -  LOAD   - -  RT   - -  线程数   - -  入口 QPS   - -  CPU 使用率   - -
-
- -  LOAD   - -  RT   - -  线程数   - -  入口 QPS   - -  CPU 使用率   - -
-
-
-
- -
- - - - - -
-
-
-
-
-
- - -
-
-
-
diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/flow_v1.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/flow_v1.html deleted file mode 100644 index 22b79c6f..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/flow_v1.html +++ /dev/null @@ -1,117 +0,0 @@ -
-
- {{app}} -
-
- - - -
-
- -
- -
-
-
-
-
- 流控规则 - - - -
- -
-
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- 资源名 - - 来源应用 - - 流控模式 - - 阈值类型 - - 阈值 - - 阈值模式 - - 流控效果 - - 操作 -
{{rule.resource}}{{rule.limitApp }} - 直接 - 关联 - 链路 - - {{rule.grade==0 ? '线程数' : 'QPS'}} - - {{rule.count}} - - {{generateThresholdTypeShow(rule)}} - - 快速失败 - Warm Up - 排队等待 - 预热排队 - - - -
-
- - - -
- -
- -
- -
- diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/flow_v2.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/flow_v2.html deleted file mode 100644 index 7e0dcc81..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/flow_v2.html +++ /dev/null @@ -1,113 +0,0 @@ -
-
- {{app}} -
-
- - - 回到单机页面 - -
-
- -
- -
-
-
-
-
- 流控规则 - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- 资源名 - - 来源应用 - - 流控模式 - - 阈值类型 - - 阈值 - - 阈值模式 - - 流控效果 - - 操作 -
{{rule.resource}}{{rule.limitApp }} - 直接 - 关联 - 链路 - - {{rule.grade == 0 ? '线程数' : 'QPS'}} - - {{rule.count}} - - {{generateThresholdTypeShow(rule)}} - - 快速失败 - Warm Up - 排队等待 - 预热排队 - - - -
-
- - - -
- -
- -
- -
- diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/gateway/api.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/gateway/api.html deleted file mode 100644 index b4e101c9..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/gateway/api.html +++ /dev/null @@ -1,87 +0,0 @@ -
-
- {{app}} -
-
- -
-
- -
- -
-
-
-
-
- API 分组管理 - - -
- -
-
- - -
- - - - - - - - - - - - - - - - - -
- API 名称 - - 匹配模式 - - 匹配串 - - 操作 -
{{api.apiName}} - 精确 - 前缀 - 正则 - {{api.pattern}} - - -
-
- - - -
- -
- -
- -
- diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/gateway/flow.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/gateway/flow.html deleted file mode 100644 index 62708c41..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/gateway/flow.html +++ /dev/null @@ -1,94 +0,0 @@ -
-
- {{app}} -
-
- -
-
- -
- -
-
-
-
-
- 网关流控规则 - - -
- -
-
- - -
- - - - - - - - - - - - - - - - - - - - -
- API 名称 - - API 类型 - - 阈值类型 - - 单机阈值 - - 操作 -
{{rule.resource}} - Route ID - API 分组 - - QPS - 线程数 - {{rule.count}} - - -
-
- - - -
- -
- -
- -
- diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/gateway/identity.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/gateway/identity.html deleted file mode 100644 index 0736adc2..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/gateway/identity.html +++ /dev/null @@ -1,98 +0,0 @@ -
-
- {{app}} -
-
- -
- -
-
-
-
-
- 请求链路 - - -
- -
-
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- API 名称 - - API 类型 - 通过 QPS拒绝 QPS线程数平均 RT分钟通过分钟拒绝操作
- {{resource.resource}} - - Route ID - 自定义 API - {{resource.passQps}}{{resource.blockQps}}{{resource.threadNum}}{{resource.averageRt}}{{resource.oneMinutePass}} - {{resource.oneMinuteBlock}} {{resource.oneMinuteBlock}} -
- - -
-
-
- - - -
- -
- -
- -
- \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/identity.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/identity.html deleted file mode 100644 index 1dcf6e92..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/identity.html +++ /dev/null @@ -1,110 +0,0 @@ -
-
- {{app}} -
-
- - -
-
- - -
-
- -
- -
-
-
-
-
- 簇点链路 - - - -
- -
-
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- 资源名 - 通过QPS拒绝QPS线程数平均RT分钟通过分钟拒绝操作
- - - {{resource.resource}} - - {{resource.passQps}}{{resource.blockQps}}{{resource.threadNum}}{{resource.averageRt}}{{resource.oneMinutePass}} - {{resource.oneMinuteBlock}} {{resource.oneMinuteBlock}} -
- - - - -
-
-
- - - -
- -
- -
- -
- \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/login.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/login.html deleted file mode 100644 index b5079789..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/login.html +++ /dev/null @@ -1,34 +0,0 @@ -
-
- Sentinel Logo - -
-
-
-
-
-
-
- -
- -
-
- -
- -
- -
-
-
- - -
-
-
-
-
\ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/machine.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/machine.html deleted file mode 100644 index 6cfcff9c..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/machine.html +++ /dev/null @@ -1,76 +0,0 @@ -
-
- {{app}} -
-
- - - - - -
-
-
-
-
-
- 机器列表 - 实例总数 {{machines.length}}, 健康 {{healthyCount}}, 失联 {{machines.length - healthyCount}}. - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - -
机器名IP 地址端口号Sentinel 客户端版本健康状态心跳时间操作
{{entry.hostname}}{{entry.ip}} {{entry.port}} {{entry.version}} 健康失联{{entry.lastHeartbeat | date: 'yyyy/MM/dd HH:mm:ss'}} - -
-
- - - -
- -
- -
- -
- diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/metric.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/metric.html deleted file mode 100644 index 4f0fc7f5..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/metric.html +++ /dev/null @@ -1,117 +0,0 @@ -
-
- {{app}} -
-
- -
-
-
-
-
-
- - - - {{metricTypeDesc}} 实时监控 - - - - - -
- - -
-
-
-
- - -
-
-  {{metric.resource}} - - - -
- - -
-
-
- - -
-
-
- - - - - - - - - - - - - - - - - - - - - - -
时间通过 QPS拒绝QPS响应时间(ms)
{{tableObj.timestamp | date: 'HH:mm:ss'}}{{tableObj.passQps | number : 1}}{{tableObj.blockQps | number : 1}}{{tableObj.rt | number : 1}}
-
-
-
-
- -
- -
- - -
- -
- -
- -
-
  • -
    - - - -
    -
    - -
    - -
    - -
    diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/pagination.tpl.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/pagination.tpl.html deleted file mode 100644 index 6ebbee2f..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/pagination.tpl.html +++ /dev/null @@ -1,18 +0,0 @@ - diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/param_flow.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/param_flow.html deleted file mode 100644 index c94219b6..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/param_flow.html +++ /dev/null @@ -1,118 +0,0 @@ -
    -
    - {{app}} -
    -
    - -
    -
    - -
    - -
    -
    -
    -
    -
    - 热点参数限流规则 - - -
    - -
    -
    - - -
    -
    -
    -
    -
    -

    {{loadError.message}}

    -
    -
    -
    -
    -
    - - - -
    - - - - - - - - - - - - - - - - - - - - - - - -
    - 资源名 - - 参数索引 - - 流控模式 - - 阈值 - - 是否集群 - - 例外项数目 - - 操作 -
    {{ruleEntity.rule.resource}}{{ruleEntity.rule.paramIdx}} - {{ruleEntity.rule.grade == 1 ? 'QPS' : '未知'}} - - {{ruleEntity.rule.count}} - - - - - {{ruleEntity.rule.paramFlowItemList == undefined ? 0 : ruleEntity.rule.paramFlowItemList.length}} - - - -
    -
    - - - - - -
    - -
    - -
    - -
    - - \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/system.html b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/system.html deleted file mode 100644 index 6f4e4b84..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/app/views/system.html +++ /dev/null @@ -1,92 +0,0 @@ -
    -
    - {{app}} -
    -
    - -
    -
    - -
    - -
    -
    -
    -
    -
    - 系统规则 - - - -
    - -
    -
    - - -
    - - - - - - - - - - - - - - - -
    - 阈值类型 - - 单机阈值 - - 操作 -
    - 系统 load - 平均 RT - 并发数 - 入口 QPS - CPU 使用率 - - {{rule.highestSystemLoad}} - {{rule.avgRt}} - {{rule.maxThread}} - {{rule.qps}} - {{rule.highestCpuUsage}} - - - -
    -
    - - - -
    - -
    - -
    - -
    - diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/assets/img/sentinel-logo.png b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/assets/img/sentinel-logo.png deleted file mode 100644 index 60e8826c..00000000 Binary files a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/assets/img/sentinel-logo.png and /dev/null differ diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/dist/css/app.css b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/dist/css/app.css deleted file mode 100644 index a9e9075f..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/dist/css/app.css +++ /dev/null @@ -1,5 +0,0 @@ -.chat,.timeline{list-style:none}#loading-bar,#loading-bar-spinner{pointer-events:none;-webkit-pointer-events:none;-webkit-transition:350ms linear all;-moz-transition:350ms linear all;-o-transition:350ms linear all;transition:350ms linear all}#loading-bar-spinner.ng-enter,#loading-bar-spinner.ng-leave.ng-leave-active,#loading-bar.ng-enter,#loading-bar.ng-leave.ng-leave-active{opacity:0}#loading-bar-spinner.ng-enter.ng-enter-active,#loading-bar-spinner.ng-leave,#loading-bar.ng-enter.ng-enter-active,#loading-bar.ng-leave{opacity:1}#loading-bar .bar{-webkit-transition:width 350ms;-moz-transition:width 350ms;-o-transition:width 350ms;transition:width 350ms;background:#29d;position:fixed;z-index:10002;top:0;left:0;width:100%;height:2px;border-bottom-right-radius:1px;border-top-right-radius:1px}#loading-bar .peg{position:absolute;width:70px;right:0;top:0;height:2px;opacity:.45;-moz-box-shadow:#29d 1px 0 6px 1px;-ms-box-shadow:#29d 1px 0 6px 1px;-webkit-box-shadow:#29d 1px 0 6px 1px;box-shadow:#29d 1px 0 6px 1px;-moz-border-radius:100%;-webkit-border-radius:100%;border-radius:100%}#loading-bar-spinner{display:block;position:fixed;z-index:10002;top:10px;left:10px}#loading-bar-spinner .spinner-icon{width:14px;height:14px;border:2px solid transparent;border-top-color:#29d;border-left-color:#29d;border-radius:50%;-webkit-animation:loading-bar-spinner .4s linear infinite;-moz-animation:loading-bar-spinner .4s linear infinite;-ms-animation:loading-bar-spinner .4s linear infinite;-o-animation:loading-bar-spinner .4s linear infinite;animation:loading-bar-spinner .4s linear infinite}@-webkit-keyframes loading-bar-spinner{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes loading-bar-spinner{0%{-moz-transform:rotate(0);transform:rotate(0)}100%{-moz-transform:rotate(360deg);transform:rotate(360deg)}}@-o-keyframes loading-bar-spinner{0%{-o-transform:rotate(0);transform:rotate(0)}100%{-o-transform:rotate(360deg);transform:rotate(360deg)}}@-ms-keyframes loading-bar-spinner{0%{-ms-transform:rotate(0);transform:rotate(0)}100%{-ms-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes loading-bar-spinner{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.bootstrap-switch{display:inline-block;direction:ltr;cursor:pointer;border-radius:4px;border:1px solid #ccc;position:relative;text-align:left;overflow:hidden;line-height:8px;z-index:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;-webkit-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.bootstrap-switch .bootstrap-switch-container{display:inline-block;top:0;border-radius:4px;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.bootstrap-switch .bootstrap-switch-handle-off,.bootstrap-switch .bootstrap-switch-handle-on,.bootstrap-switch .bootstrap-switch-label{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;cursor:pointer;display:table-cell;vertical-align:middle;padding:6px 12px;font-size:14px;line-height:20px}.bootstrap-switch .bootstrap-switch-handle-off,.bootstrap-switch .bootstrap-switch-handle-on{text-align:center;z-index:1}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary{color:#fff;background:#337ab7}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info{color:#fff;background:#5bc0de}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning{background:#f0ad4e;color:#fff}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger{color:#fff;background:#d9534f}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default{color:#000;background:#eee}.bootstrap-switch .bootstrap-switch-label{text-align:center;margin-top:-1px;margin-bottom:-1px;z-index:100;color:#333;background:#fff}.bootstrap-switch span::before{content:"\200b"}.bootstrap-switch .bootstrap-switch-handle-on{border-bottom-left-radius:3px;border-top-left-radius:3px}.bootstrap-switch .bootstrap-switch-handle-off{border-bottom-right-radius:3px;border-top-right-radius:3px}.bootstrap-switch input[type=radio],.bootstrap-switch input[type=checkbox]{position:absolute!important;top:0;left:0;margin:0;z-index:-1;opacity:0;filter:alpha(opacity=0);visibility:hidden}.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-label{padding:1px 5px;font-size:12px;line-height:1.5}.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-label{padding:5px 10px;font-size:12px;line-height:1.5}.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-label{padding:6px 16px;font-size:18px;line-height:1.3333333}.bootstrap-switch.bootstrap-switch-disabled,.bootstrap-switch.bootstrap-switch-indeterminate,.bootstrap-switch.bootstrap-switch-readonly{cursor:default!important}.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-label{opacity:.5;filter:alpha(opacity=50);cursor:default!important}.bootstrap-switch.bootstrap-switch-animate .bootstrap-switch-container{-webkit-transition:margin-left .5s;-o-transition:margin-left .5s;transition:margin-left .5s}.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-on{border-radius:0 3px 3px 0}.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-off{border-radius:3px 0 0 3px}.bootstrap-switch.bootstrap-switch-focused{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-off .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-on .bootstrap-switch-label{border-bottom-right-radius:3px;border-top-right-radius:3px}.bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-on .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-off .bootstrap-switch-label{border-bottom-left-radius:3px;border-top-left-radius:3px}.ngdialog,.ngdialog-overlay{position:fixed;top:0;right:0;bottom:0;left:0}@-webkit-keyframes ngdialog-fadeout{0%{opacity:1}100%{opacity:0}}@keyframes ngdialog-fadeout{0%{opacity:1}100%{opacity:0}}@-webkit-keyframes ngdialog-fadein{0%{opacity:0}100%{opacity:1}}@keyframes ngdialog-fadein{0%{opacity:0}100%{opacity:1}}.ngdialog{box-sizing:border-box;overflow:auto;-webkit-overflow-scrolling:touch;z-index:10000}.ngdialog *,.ngdialog :after,.ngdialog :before{box-sizing:inherit}.ngdialog.ngdialog-disabled-animation,.ngdialog.ngdialog-disabled-animation .ngdialog-content,.ngdialog.ngdialog-disabled-animation .ngdialog-overlay{-webkit-animation:none!important;animation:none!important}.ngdialog-overlay{background:rgba(0,0,0,.4);-webkit-backface-visibility:hidden;-webkit-animation:ngdialog-fadein .5s;animation:ngdialog-fadein .5s}.ngdialog-no-overlay{pointer-events:none}.ngdialog.ngdialog-closing .ngdialog-overlay{-webkit-backface-visibility:hidden;-webkit-animation:ngdialog-fadeout .5s;animation:ngdialog-fadeout .5s}.ngdialog-content{background:#fff;-webkit-backface-visibility:hidden;-webkit-animation:ngdialog-fadein .5s;animation:ngdialog-fadein .5s;pointer-events:all}.ngdialog.ngdialog-closing .ngdialog-content{-webkit-backface-visibility:hidden;-webkit-animation:ngdialog-fadeout .5s;animation:ngdialog-fadeout .5s}.ngdialog-close:before{font-family:Helvetica,Arial,sans-serif;content:'\00D7';cursor:pointer}body.ngdialog-open,html.ngdialog-open{overflow:hidden}@-webkit-keyframes ngdialog-flyin{0%{opacity:0;-webkit-transform:translateY(-40px);transform:translateY(-40px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes ngdialog-flyin{0%{opacity:0;-webkit-transform:translateY(-40px);transform:translateY(-40px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes ngdialog-flyout{0%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}100%{opacity:0;-webkit-transform:translateY(-40px);transform:translateY(-40px)}}@keyframes ngdialog-flyout{0%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}100%{opacity:0;-webkit-transform:translateY(-40px);transform:translateY(-40px)}}.ngdialog.ngdialog-theme-default{padding-bottom:160px;padding-top:160px}.ngdialog.ngdialog-theme-default.ngdialog-closing .ngdialog-content{-webkit-animation:ngdialog-flyout .5s;animation:ngdialog-flyout .5s}.ngdialog.ngdialog-theme-default .ngdialog-content{-webkit-animation:ngdialog-flyin .5s;animation:ngdialog-flyin .5s;background:#f0f0f0;border-radius:5px;color:#444;font-family:Helvetica,sans-serif;font-size:1.1em;line-height:1.5em;margin:0 auto;max-width:100%;padding:1em;position:relative;width:450px}.ngdialog.ngdialog-theme-default .ngdialog-close{border-radius:5px;cursor:pointer;position:absolute;right:0;top:0}.ngdialog.ngdialog-theme-default .ngdialog-close:before{background:0 0;border-radius:3px;color:#bbb;content:'\00D7';font-size:26px;font-weight:400;height:30px;line-height:26px;position:absolute;right:3px;text-align:center;top:3px;width:30px}.ngdialog.ngdialog-theme-default .ngdialog-close:active:before,.ngdialog.ngdialog-theme-default .ngdialog-close:hover:before{color:#777}.ngdialog.ngdialog-theme-default .ngdialog-message{margin-bottom:.5em}.ngdialog.ngdialog-theme-default .ngdialog-input{margin-bottom:1em}.ngdialog.ngdialog-theme-default .ngdialog-input input[type=text],.ngdialog.ngdialog-theme-default .ngdialog-input input[type=password],.ngdialog.ngdialog-theme-default .ngdialog-input input[type=email],.ngdialog.ngdialog-theme-default .ngdialog-input input[type=url],.ngdialog.ngdialog-theme-default .ngdialog-input textarea{background:#fff;border:0;border-radius:3px;font-family:inherit;font-size:inherit;font-weight:inherit;margin:0 0 .25em;min-height:2.5em;padding:.25em .67em;width:100%}.ngdialog.ngdialog-theme-default .ngdialog-input input[type=text]:focus,.ngdialog.ngdialog-theme-default .ngdialog-input input[type=password]:focus,.ngdialog.ngdialog-theme-default .ngdialog-input input[type=email]:focus,.ngdialog.ngdialog-theme-default .ngdialog-input input[type=url]:focus,.ngdialog.ngdialog-theme-default .ngdialog-input textarea:focus{box-shadow:inset 0 0 0 2px #8dbdf1;outline:0}.ngdialog.ngdialog-theme-default .ngdialog-buttons:after{content:'';display:table;clear:both}.ngdialog.ngdialog-theme-default .ngdialog-button{border:0;border-radius:3px;cursor:pointer;float:right;font-family:inherit;font-size:.8em;letter-spacing:.1em;line-height:1em;margin:0 0 0 .5em;padding:.75em 2em;text-transform:uppercase}.ngdialog.ngdialog-theme-default .ngdialog-button:focus{-webkit-animation:ngdialog-pulse 1.1s infinite;animation:ngdialog-pulse 1.1s infinite;outline:0}.btn:active,.btn:focus,.selectize-input>input:focus{outline:0!important}@media (max-width:568px){.ngdialog.ngdialog-theme-default .ngdialog-button:focus{-webkit-animation:none;animation:none}}.ngdialog.ngdialog-theme-default .ngdialog-button.ngdialog-button-primary{background:#3288e6;color:#fff}.ngdialog.ngdialog-theme-default .ngdialog-button.ngdialog-button-secondary{background:#e0e0e0;color:#777}.datetimepicker{border-radius:4px;direction:ltr;display:block;margin-top:1px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:320px}.datetimepicker>div{display:none}.datetimepicker .hour,.datetimepicker .minute{height:34px;line-height:34px;margin:0;width:25%}.datetimepicker .table{margin:0}.datetimepicker .table td,.datetimepicker .table th{border:0;border-radius:4px;height:20px;text-align:center}.datetimepicker .day:hover,.datetimepicker .hour:hover,.datetimepicker .left:hover,.datetimepicker .minute:hover,.datetimepicker .right:hover,.datetimepicker .switch:hover{background:#eee;cursor:pointer}.datetimepicker .disabled,.datetimepicker .disabled:hover{background:0 0;color:#ebebeb;cursor:default}.datetimepicker .active,.datetimepicker .active.disabled,.datetimepicker .active.disabled:hover,.datetimepicker .active:hover{background-color:#04c;background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;color:#fff;filter:progid:dximagetransform.microsoft.gradient(startColorstr='#08c', endColorstr='#04c', GradientType=0);text-shadow:0 -1px 0 rgba(0,0,0,.25)}.datetimepicker .current,.datetimepicker .current.disabled,.datetimepicker .current.disabled:hover,.datetimepicker .current:hover{background-color:#e5e5e5}.datetimepicker .active.active,.datetimepicker .active.disabled,.datetimepicker .active.disabled.active,.datetimepicker .active.disabled.disabled,.datetimepicker .active.disabled:active,.datetimepicker .active.disabled:hover,.datetimepicker .active.disabled:hover.active,.datetimepicker .active.disabled:hover.disabled,.datetimepicker .active.disabled:hover:active,.datetimepicker .active.disabled:hover:hover,.datetimepicker .active:active,.datetimepicker .active:hover,.datetimepicker .active:hover.active,.datetimepicker .active:hover.disabled,.datetimepicker .active:hover:active,.datetimepicker .active:hover:hover,.datetimepicker span.active.disabled:hover[disabled],.datetimepicker span.active.disabled[disabled],.datetimepicker span.active:hover[disabled],.datetimepicker span.active[disabled],.datetimepicker td.active.disabled:hover[disabled],.datetimepicker td.active.disabled[disabled],.datetimepicker td.active:hover[disabled],.datetimepicker td.active[disabled]{background-color:#04c}.datetimepicker span{border-radius:4px;cursor:pointer;display:block;float:left;height:54px;line-height:54px;margin:1%;width:23%}.datetimepicker span:hover{background:#eee}.datetimepicker .future,.datetimepicker .past{color:#999}.ui-notification{position:fixed;z-index:9999;width:300px;-webkit-transition:all ease .5s;-o-transition:all ease .5s;transition:all ease .5s;color:#fff;border-radius:0;background:#337ab7;box-shadow:5px 5px 10px rgba(0,0,0,.3)}.ui-notification.clickable{cursor:pointer}.ui-notification.clickable:hover{opacity:.7}.ui-notification.killed{-webkit-transition:opacity ease 1s;-o-transition:opacity ease 1s;transition:opacity ease 1s;opacity:0}.ui-notification>h3{font-size:14px;font-weight:700;display:block;margin:10px 10px 0;padding:0 0 5px;text-align:left;border-bottom:1px solid rgba(255,255,255,.3)}.ui-notification a{color:#fff}.ui-notification a:hover{text-decoration:underline}.ui-notification>.message{margin:10px}.ui-notification.warning{color:#fff;background:#f0ad4e}.ui-notification.error{color:#fff;background:#d9534f}.ui-notification.success{color:#fff;background:#5cb85c}.ui-notification.info{color:#fff;background:#5bc0de}table.rz-table{table-layout:fixed;border-collapse:collapse}table.rz-table th{position:relative;min-width:25px}table.rz-table th .rz-handle{width:10px;height:100%;position:absolute;top:0;right:0;cursor:ew-resize!important}table.rz-table th .rz-handle.rz-handle-active{border-right:1px dotted #000}.selectize-control.plugin-drag_drop.multi>.selectize-input>div.ui-sortable-placeholder{visibility:visible!important;background:#f2f2f2!important;background:rgba(0,0,0,.06)!important;border:0!important;-webkit-box-shadow:inset 0 0 12px 4px #fff;box-shadow:inset 0 0 12px 4px #fff}.selectize-control.plugin-drag_drop .ui-sortable-placeholder::after{content:'!';visibility:hidden}.selectize-control.plugin-drag_drop .ui-sortable-helper{-webkit-box-shadow:0 2px 5px rgba(0,0,0,.2);box-shadow:0 2px 5px rgba(0,0,0,.2)}.selectize-dropdown-header{position:relative;padding:5px 8px;border-bottom:1px solid #d0d0d0;background:#f8f8f8;-webkit-border-radius:3px 3px 0 0;-moz-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0}.selectize-dropdown-header-close{position:absolute;right:8px;top:50%;color:#303030;opacity:.4;margin-top:-12px;line-height:20px;font-size:20px!important}.selectize-dropdown-header-close:hover{color:#000}.selectize-dropdown.plugin-optgroup_columns .optgroup{border-right:1px solid #f2f2f2;border-top:0 none;float:left;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.selectize-control.plugin-remove_button [data-value] .remove,.selectize-input{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;display:inline-block}.selectize-dropdown.plugin-optgroup_columns .optgroup:last-child{border-right:0 none}.selectize-dropdown.plugin-optgroup_columns .optgroup:before{display:none}.selectize-dropdown.plugin-optgroup_columns .optgroup-header{border-top:0 none}.selectize-control.plugin-remove_button [data-value]{position:relative;padding-right:24px!important}.selectize-control.plugin-remove_button [data-value] .remove{z-index:1;position:absolute;top:0;right:0;bottom:0;width:17px;text-align:center;font-weight:700;font-size:12px;color:inherit;text-decoration:none;vertical-align:middle;padding:2px 0 0;border-left:1px solid #d0d0d0;-webkit-border-radius:0 2px 2px 0;-moz-border-radius:0 2px 2px 0;border-radius:0 2px 2px 0;box-sizing:border-box}.selectize-control.plugin-remove_button [data-value] .remove:hover{background:rgba(0,0,0,.05)}.selectize-control.plugin-remove_button [data-value].active .remove{border-left-color:#cacaca}.selectize-control.plugin-remove_button .disabled [data-value] .remove:hover{background:0 0}.selectize-control.plugin-remove_button .disabled [data-value] .remove{border-left-color:#fff}.selectize-control.plugin-remove_button .remove-single{position:absolute;right:0;top:0;font-size:23px}.selectize-control,.selectize-input{position:relative}.selectize-dropdown,.selectize-input,.selectize-input input{color:#303030;font-family:inherit;font-size:13px;line-height:18px;-webkit-font-smoothing:inherit}.selectize-control.single .selectize-input.input-active,.selectize-input{background:#fff;cursor:text;display:inline-block}.selectize-input{border:1px solid #d0d0d0;padding:8px;width:100%;overflow:hidden;z-index:1;box-sizing:border-box;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.1);box-shadow:inset 0 1px 1px rgba(0,0,0,.1);-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.selectize-control.multi .selectize-input.has-items{padding:6px 8px 3px}.selectize-input.full{background-color:#fff}.selectize-input.disabled,.selectize-input.disabled *{cursor:default!important}.selectize-input.focus{-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.15);box-shadow:inset 0 1px 2px rgba(0,0,0,.15)}.selectize-input.dropdown-active{-webkit-border-radius:3px 3px 0 0;-moz-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0}.selectize-input>*{vertical-align:baseline;display:-moz-inline-stack;display:inline-block;zoom:1}.selectize-control.multi .selectize-input>div{cursor:pointer;margin:0 3px 3px 0;padding:2px 6px;background:#f2f2f2;color:#303030;border:0 solid #d0d0d0}.selectize-control.multi .selectize-input>div.active{background:#e8e8e8;color:#303030;border:0 solid #cacaca}.selectize-control.multi .selectize-input.disabled>div,.selectize-control.multi .selectize-input.disabled>div.active{color:#7d7d7d;background:#fff;border:0 solid #fff}.selectize-input>input{display:inline-block!important;padding:0!important;min-height:0!important;max-height:none!important;max-width:100%!important;margin:0 2px 0 0!important;text-indent:0!important;border:0!important;background:0 0!important;line-height:inherit!important;-webkit-user-select:auto!important;-webkit-box-shadow:none!important;box-shadow:none!important}.selectize-input>input::-ms-clear{display:none}.selectize-input::after{content:' ';display:block;clear:left}.selectize-input.dropdown-active::before{content:' ';display:block;position:absolute;background:#f0f0f0;height:1px;bottom:0;left:0;right:0}.selectize-dropdown{position:absolute;z-index:10;border:1px solid #d0d0d0;background:#fff;margin:-1px 0 0;border-top:0 none;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-box-shadow:0 1px 3px rgba(0,0,0,.1);box-shadow:0 1px 3px rgba(0,0,0,.1);-webkit-border-radius:0 0 3px 3px;-moz-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px}.selectize-dropdown [data-selectable]{cursor:pointer;overflow:hidden}.selectize-dropdown [data-selectable] .highlight{background:rgba(125,168,208,.2);-webkit-border-radius:1px;-moz-border-radius:1px;border-radius:1px}.selectize-dropdown .optgroup-header,.selectize-dropdown .option{padding:5px 8px}.selectize-dropdown .option,.selectize-dropdown [data-disabled],.selectize-dropdown [data-disabled] [data-selectable].option{cursor:inherit;opacity:.5}.selectize-dropdown [data-selectable].option{opacity:1}.selectize-dropdown .optgroup:first-child .optgroup-header{border-top:0 none}.selectize-dropdown .optgroup-header{color:#303030;background:#fff;cursor:default}.selectize-dropdown .active{background-color:#f5fafd;color:#495c68}.selectize-dropdown .active.create{color:#495c68}.selectize-dropdown .create{color:rgba(48,48,48,.5)}.selectize-dropdown-content{overflow-y:auto;overflow-x:hidden;max-height:200px;-webkit-overflow-scrolling:touch}.selectize-control.single .selectize-input,.selectize-control.single .selectize-input input{cursor:pointer}.selectize-control.single .selectize-input.input-active,.selectize-control.single .selectize-input.input-active input{cursor:text}.selectize-control.single .selectize-input:after{content:' ';display:block;position:absolute;top:50%;right:15px;margin-top:-3px;width:0;height:0;border-style:solid;border-width:5px 5px 0;border-color:grey transparent transparent}.selectize-control.single .selectize-input.dropdown-active:after{margin-top:-4px;border-width:0 5px 5px;border-color:transparent transparent grey}.selectize-control.rtl.single .selectize-input:after{left:15px;right:auto}.selectize-control.rtl .selectize-input>input{margin:0 4px 0 -2px!important}.selectize-control .selectize-input.disabled{opacity:.5;background-color:#fafafa}/*! - * Start Bootstrap - SB Admin 2 Bootstrap Admin Theme (http://startbootstrap.com) - * Code licensed under the Apache License v2.0. - * For details, see http://www.apache.org/licenses/LICENSE-2.0. - */body{background-color:#f8f8f8}.example{padding:.625rem 1.825rem .625rem 2.5rem;border:1px dashed #ccc;position:relative;margin:0 0 .625rem;background-color:#fff}dl dd,dl dt{line-height:1.25rem}dl dt{font-style:normal;font-weight:700}dl dd{margin-left:.9375rem}dl.horizontal dt{float:left;width:10rem;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}dl.horizontal dd{margin-left:11.25rem}#wrapper{width:100%}#page-wrapper{min-height:568px;background-color:#fff}@media(min-width:768px){#page-wrapper{position:inherit;margin:0 0 0 250px;padding:0 30px;border-left:1px solid #e7e7e7}}.navbar-top-links{margin-right:0}.navbar-top-links li{display:inline-block}.flot-chart,.navbar-top-links .dropdown-menu li{display:block}.navbar-top-links li:last-child{margin-right:15px}.navbar-top-links li a{padding:15px;min-height:50px}.navbar-top-links .dropdown-menu li:last-child{margin-right:0}.navbar-top-links .dropdown-menu li a{padding:3px 20px;min-height:0}.navbar-top-links .dropdown-menu li a div{white-space:normal}.navbar-top-links .dropdown-alerts,.navbar-top-links .dropdown-messages,.navbar-top-links .dropdown-tasks{width:310px;min-width:0}.navbar-top-links .dropdown-messages{margin-left:5px}.navbar-top-links .dropdown-tasks{margin-left:-59px}.navbar-top-links .dropdown-alerts{margin-left:-123px}.navbar-top-links .dropdown-user{right:0;left:auto}.sidebar .sidebar-search{padding:15px}.sidebar ul li{border-bottom:1px solid #e7e7e7}.sidebar ul li a.active{background-color:#fff;color:#fff}.sidebar .arrow{float:right}.sidebar .fa.arrow:before{content:"\f104"}.sidebar .active>a>.fa.arrow:before{content:"\f107"}.sidebar .nav-second-level li,.sidebar .nav-third-level li{border-bottom:0!important}.sidebar .nav-second-level li a{padding-left:37px}.sidebar .nav-third-level li a{padding-left:52px}@media(min-width:768px){.sidebar{z-index:1;position:absolute;width:250px;margin-top:51px}.navbar-top-links .dropdown-alerts,.navbar-top-links .dropdown-messages,.navbar-top-links .dropdown-tasks{margin-left:auto}}.btn-outline{color:inherit;background-color:transparent;transition:all .5s}.btn-primary.btn-outline{color:#428bca}.btn-success.btn-outline{color:#5cb85c}.btn-info.btn-outline{color:#5bc0de}.btn-warning.btn-outline{color:#f0ad4e}.btn-danger.btn-outline{color:#d9534f}.btn-danger.btn-outline:hover,.btn-info.btn-outline:hover,.btn-primary.btn-outline:hover,.btn-success.btn-outline:hover,.btn-warning.btn-outline:hover{color:#fff}.chat{margin:0;padding:0}.chat li{margin-bottom:10px;padding-bottom:5px;border-bottom:1px dotted #999}.chat li.left .chat-body{margin-left:60px}.chat li.right .chat-body{margin-right:60px}.chat li .chat-body p{margin:0}.chat .glyphicon,.panel .slidedown .glyphicon{margin-right:5px}.chat-panel .panel-body{height:350px;overflow-y:scroll}.login-panel{margin-top:25%}.flot-chart{height:400px}.flot-chart-content{width:100%;height:100%}.dataTables_wrapper{position:relative;clear:both}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_asc_disabled,table.dataTable thead .sorting_desc,table.dataTable thead .sorting_desc_disabled{background:0 0}table.dataTable thead .sorting_asc:after{content:"\f0de";float:right;font-family:fontawesome}table.dataTable thead .sorting_desc:after{content:"\f0dd";float:right;font-family:fontawesome}table.dataTable thead .sorting:after{content:"\f0dc";float:right;font-family:fontawesome;color:rgba(50,50,50,.5)}.btn-circle{width:30px;height:30px;padding:6px 0;border-radius:15px;text-align:center;font-size:12px;line-height:1.428571429}.btn-circle.btn-lg{width:50px;height:50px;padding:10px 16px;border-radius:25px;font-size:18px;line-height:1.33}.btn-circle.btn-xl{width:70px;height:70px;padding:10px 16px;border-radius:35px;font-size:24px;line-height:1.33}.show-grid [class^=col-]{padding-top:10px;padding-bottom:10px;border:1px solid #ddd;background-color:#eee!important}.show-grid{margin:15px 0}.huge{font-size:40px}.panel-green{border-color:#5cb85c}.panel-green .panel-heading{border-color:#5cb85c;color:#fff;background-color:#5cb85c}.panel-green a{color:#5cb85c}.panel-green a:hover{color:#3d8b3d}.panel-red{border-color:#d9534f}.panel-red .panel-heading{border-color:#d9534f;color:#fff;background-color:#d9534f}.panel-red a{color:#d9534f}.panel-red a:hover{color:#b52b27}.panel-yellow{border-color:#f0ad4e}.panel-yellow .panel-heading{border-color:#f0ad4e;color:#fff;background-color:#f0ad4e}.panel-yellow a{color:#f0ad4e}.panel-yellow a:hover{color:#df8a13}.timeline{position:relative;padding:20px 0}.timeline:before{content:" ";position:absolute;top:0;bottom:0;left:50%;width:3px;margin-left:-1.5px;background-color:#eee}.timeline>li{position:relative;margin-bottom:20px}.timeline>li:after,.timeline>li:before{content:" ";display:table}.timeline>li:after{clear:both}.timeline>li>.timeline-panel{float:left;position:relative;width:46%;padding:20px;border:1px solid #d4d4d4;border-radius:2px;-webkit-box-shadow:0 1px 6px rgba(0,0,0,.175);box-shadow:0 1px 6px rgba(0,0,0,.175)}.timeline>li>.timeline-panel:before{content:" ";display:inline-block;position:absolute;top:26px;right:-15px;border-top:15px solid transparent;border-right:0 solid #ccc;border-bottom:15px solid transparent;border-left:15px solid #ccc}.timeline>li>.timeline-panel:after{content:" ";display:inline-block;position:absolute;top:27px;right:-14px;border-top:14px solid transparent;border-right:0 solid #fff;border-bottom:14px solid transparent;border-left:14px solid #fff}.timeline>li>.timeline-badge{z-index:100;position:absolute;top:16px;left:50%;width:50px;height:50px;margin-left:-25px;border-radius:50%;text-align:center;font-size:1.4em;line-height:50px;color:#fff;background-color:#999}.timeline>li.timeline-inverted>.timeline-panel{float:right}.timeline>li.timeline-inverted>.timeline-panel:before{right:auto;left:-15px;border-right-width:15px;border-left-width:0}.timeline>li.timeline-inverted>.timeline-panel:after{right:auto;left:-14px;border-right-width:14px;border-left-width:0}.timeline-badge.primary{background-color:#2e6da4!important}.timeline-badge.success{background-color:#3f903f!important}.timeline-badge.warning{background-color:#f0ad4e!important}.timeline-badge.danger{background-color:#d9534f!important}.timeline-badge.info{background-color:#5bc0de!important}.timeline-title{margin-top:0;color:inherit}.timeline-body>p,.timeline-body>ul{margin-bottom:0}.timeline-body>p+p{margin-top:5px}@media(max-width:767px){ul.timeline:before{left:40px}ul.timeline>li>.timeline-panel{width:calc(100% - 90px);width:-moz-calc(100% - 90px);width:-webkit-calc(100% - 90px);float:right}ul.timeline>li>.timeline-badge{top:16px;left:15px;margin-left:0}ul.timeline>li>.timeline-panel:before{right:auto;left:-15px;border-right-width:15px;border-left-width:0}ul.timeline>li>.timeline-panel:after{right:auto;left:-14px;border-right-width:14px;border-left-width:0}}.header,.jumbotron{border-bottom:1px solid #e5e5e5}.btn{height:32px}.width-200{max-width:200px}.width-300,.witdh-300{max-width:300px}body{padding:0}.footer,.header,.marketing{padding-left:15px;padding-right:15px}.header{margin-bottom:10px}.header h3{margin-top:0;margin-bottom:0;line-height:40px;padding-bottom:19px}.card .detail,.card .detail-brand{line-height:98px;text-align:center}.footer{padding-top:19px;color:#777;border-top:1px solid #e5e5e5}.container-narrow>hr{margin:30px 0}.jumbotron{text-align:center}.jumbotron .btn{font-size:21px;padding:14px 24px}.marketing{margin:40px 0}.marketing p+h4{margin-top:28px}@media screen and (min-width:768px){.container{width:inherit;margin-left:60px;margin-right:5px}.footer,.header,.marketing{padding-left:0;padding-right:0}.header{margin-bottom:30px}.jumbotron{border-bottom:0}}.navbar-inverse .navbar-nav>li>a{color:#b0ddce;font-size:15px}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:focus,.navbar-inverse .navbar-nav>.open>a:hover{background-color:#1b926c}@media (min-width:900px){.navbar-right,.navbar-right~.navbar-right{margin-right:0}.navbar-left{float:left!important}.navbar-right{float:right!important}}.dropdown-menu{min-width:100px!important}.nav-sidebar li.active a{background:#DDD}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{background:#1d9d74;color:#fff}.broadcast-message,.broadcast-message-preview{padding:10px;text-align:center;background:#555;color:#BBB;margin-top:50px}.card{position:relative;border:1px solid #d9d9d9;color:#666;background-color:#fff;width:100%;border-radius:5px}.card .card-header,.tools-header{border-top-left-radius:4px;border-top-right-radius:4px}.card .card-header{padding:9px 0;height:40px;background:#555;color:#fff;text-align:center}.card .card-body{padding:12px 10px}.card .card-footer{height:20px;font-size:10px;color:#777;margin:-15px 20px 5px}.card .detail-brand{float:left;width:30%;font-size:30px;color:#fff}.card .default{background:#1d9d74}.card .info{background:#6EBEE7}.card .warn{background:#ED7F54}.card .danger{background:#6583BE}.card .detail .text-default{color:#1d9d74}.card .detail .text-info{color:#6EBEE7}.card .detail .text-warn{color:#ED7F54}.card .detail .text-danger{color:#6583BE}.card .detail{float:right;width:70%}.card .detail .text{font-size:12px}.card .detail .number{font-size:30px;font-weight:500}.h100{height:100px}.inline{display:inline}.separator{height:1px;background-color:#e5e5e5;margin-top:10px}.card>.card-body>table>tbody>tr>td,.card>.card-body>table>thead>tr>td{word-wrap:break-word;word-break:break-all}.card>.card-body>table>thead>tr>td{font-weight:500;font-size:13px;text-align:center}.card>.card-body>table>thead>tr>td>span{font-weight:500;font-size:10px}.card>.card-body>table>tbody>tr>td{font-size:12px;text-align:center}.card>.card-body>table>tbody>tr>td>a{color:#666}.thumbnails>.card>.card-body>table>tbody>tr>td,.thumbnails>.card>.card-body>table>thead>tr>td{font-size:12px;color:#777;word-wrap:break-word;word-break:break-all}.thumbnails>.card>.card-body>table>thead>tr>td:nth-child(n+2){text-align:center}.thumbnails>.card>.card-body>table>tbody>tr>td:nth-child(n+2){font-weight:700;text-align:center}.thumbnails>.card>.card-body>table>tbody>tr>td:nth-child(1),.thumbnails>.card>.card-body>table>thead>tr>td:nth-child(1){text-align:left}.tools-header{background:#f5f5f5;padding:9px 0;height:40px}.tools-header .brand{font-size:13px;margin:2px 10px;font-weight:700;float:left}.tools-header .brand>a{color:#666}.tools-header>a,.tools-header>button,.tools-header>select{float:right;max-width:80px;margin:1px 10px;height:25px;padding:0 10px;line-height:25px;color:#666}.tools-header .paged{margin-right:0}.btn.btn-danger-tag{color:#fff;background-color:#d9534f;border-color:#d43f3a;line-height:1px;font-size:11px;padding:4px}.btn.btn-danger{color:#333;background-color:#fff;border-color:#ccc}.btn.btn-danger:active,.btn.btn-danger:focus,.btn.btn-danger:hover{color:#d9534f;border-color:#d9534f;background:#fff}.form-control{height:32px}.input-label:before{display:inline-block;content:"*";color:#f44336;font-family:SimSun;font-size:12px;-webkit-transform:TranslateX(-10px);-ms-transform:TranslateX(-10px);transform:TranslateX(-10px)}.badge-main,.label.label-main{color:#fff;background-color:#1d9d74;border-color:#1d9d74}.bootstrap-tagsinput{background-color:#fff;border:1px solid #ccc;box-shadow:inset 0 1px 1px rgba(0,0,0,.075);display:inline-block;padding:4px 6px;color:#555;vertical-align:middle;border-radius:4px;width:85%;height:100px;line-height:20px;cursor:text}.bootstrap-tagsinput>.dropdown-menu{min-width:40px;font-size:12px}.bootstrap-tagsinput>.dropdown-menu>.active>a,.bootstrap-tagsinput>.dropdown-menu>.active>a:focus,.bootstrap-tagsinput>.dropdown-menu>.active>a:hover{background-image:-webkit-linear-gradient(top,#1d9d74 0,#1d9d74 100%);background-image:-o-linear-gradient(top,#1d9d74 0,#1d9d74 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#1d9d74),to(#1d9d74));background-image:linear-gradient(to bottom,#1d9d74 0,#1d9d74 100%);filter:progid: DXImageTransform.Microsoft.gradient(startColorstr='#1d9d74', endColorstr='#1d9d74', GradientType=0);background-repeat:repeat-x;color:#fff;text-decoration:none;outline:0;background-color:#1d9d74}.inputs-header{padding:9px 0;height:50px;border-top-left-radius:4px;border-top-right-radius:4px}.inputs-header .brand{font-size:13px;margin:2px 10px;font-weight:700;float:left}.inputs-header .brand>a{color:#666}.inputs-header>input{float:right;margin:1px 10px;height:30px;padding:0 10px;color:#666}.inputs-header>a{float:right;margin:1px 10px;height:30px;padding:5 5px}.inputs-header>select{float:right;max-width:80px;margin:1px 10px;padding:0 10px;color:#666;height:25px;font-size:12px}.witdh-150{max-width:150px}.witdh-200{max-width:200px}.card.highlight{border-color:#d9534f}.card .pagination-footer{height:40px;font-size:10px;color:#777;margin:-15px 20px 5px}.card .pagination-footer .tools{font-size:12px;margin:11px 20px 11px 0;float:right;display:inline}.card>.pagination-footer>.tools>span>input{height:25px;max-width:50px;display:inline}.pagination{display:inline-block;padding-left:0;margin:8px 0;float:right;border-radius:4px}.pagination>a{margin-right:5px;height:28px;width:28px;padding:5px 0}.datepicker>.table>tbody>tr>td,.datepicker>.table>thead>tr>td,.timepicker>.table>tbody>tr>td,.timepicker>.table>thead>tr>td{padding:5px 3px}.datepicker>.table>tbody>tr>td>.btn,.datepicker>.table>thead>tr>td>.btn,.timepicker>.table>tbody>tr>td>.btn,.timepicker>.table>thead>tr>td>.btn{border:1px solid #FFFDFD}.datepicker>.table>tbody>tr>td>.btn-default:active,.datepicker>.table>tbody>tr>td>.btn-default:focus,.datepicker>.table>tbody>tr>td>.btn-default:hover,.datepicker>.table>thead>tr>td>.btn-default:active,.datepicker>.table>thead>tr>td>.btn-default:focus,.datepicker>.table>thead>tr>td>.btn-default:hover,.timepicker>.table>tbody>tr>td>.btn-default:active,.timepicker>.table>tbody>tr>td>.btn-default:focus,.timepicker>.table>tbody>tr>td>.btn-default:hover,.timepicker>.table>thead>tr>td>.btn-default:active,.timepicker>.table>thead>tr>td>.btn-default:focus,.timepicker>.table>thead>tr>td>.btn-default:hover{color:#1d9d74;border-color:#1d9d74;background:#fff}.datepicker>.table>tbody>tr>td>a,.datepicker>.table>thead>tr>td>a,.timepicker>.table>tbody>tr>td>a,.timepicker>.table>thead>tr>td>a{height:25px;width:25px;padding:3px 0}.datepicker>.table>tbody>tr:first-child>td>a{padding:4px 0}.datepicker>.table>tbody>tr>td>a.btn.active,.datepicker>.table>thead>tr>td>a.btn.active,.timepicker>.table>tbody>tr>td>a.btn.active,.timepicker>.table>thead>tr>td>a.btn.active{color:#1d9d74;border-color:#1d9d74;background:#fff;box-shadow:inset 0 0 0 rgba(0,0,0,.125)}.datepicker>.table>thead>tr>td:not(:first-child):last-child>a,.timepicker>.table>thead>tr>td:not(:first-child):last-child>a{height:25px;width:50px;padding:5px 0}.datepicker>.table>tbody>tr>td>a,.timepicker>.table>tbody>tr>td>a{margin-left:8px}.sortorder:after{content:'\25b2'}.sortorder.reverse:after{content:'\25bc'}.input-control select{-moz-appearance:none;-webkit-appearance:none;appearance:none;position:relative;border:1px solid #d9d9d9;width:100%;height:100%;padding:.3125rem;z-index:0}.navbar-inverse{background-color:#337ab7;border-color:#337ab7}.sidebar{z-index:1;width:220px;top:0;left:0;height:100%}#page-wrapper{position:inherit;margin:70px 0 0 220px;padding:12px 30px;border-left:0 solid #e7e7e7}.sidebar .sidebar-nav.navbar-collapse{background-color:#F5F5F5;position:relative;color:#000;width:100%;padding:0;margin:0;list-style:none inside}.sidebar a{color:#555}.sidebar ul li:hover{color:red}.form-control{border-radius:8px}.form-control:focus,.highlight-border{border-color:#337ab7;box-shadow:0 0 0 rgba(0,0,0,.075) inset,0 0 0 rgba(29,157,116,1)}.btn-outline-primary.focus,.btn-outline-primary:focus,.btn-outline-primary:not(:disabled):not(.disabled).active:focus,.btn-outline-primary:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-primary.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(0,123,255,.5)}.browsehappy{margin:.2em 0;background:#ccc;color:#000;padding:.2em 0}.btn.btn-main{color:#fff;background-color:#337ab7;border-color:#337ab7}.btn-default-inverse,.btn-default-inverse:focus,.btn-default-inverse:hover,.btn-default:active{color:#337ab7;border-color:#337ab7;background:#fff}.btn-danger-inverse,.btn-danger-inverse:focus,.btn-danger-inverse:hover,.btn-danger:active{color:#d9534f;border-color:#d9534f;background:#fff}.btn-tab-active,.btn-tab-active:focus,.btn-tab-active:hover,.btn-tab-default:active,.btn-tab-default:focus,.btn-tab-default:hover{color:#337ab7;border-color:#337ab7;background:#fff;font-weight:600}.btn-tab-default{color:#777;background:#fff;font-weight:600}.pagination>.btn.active{color:#fff;background-color:#337ab7;border-color:#337ab7}.btn-default:active,.btn-default:focus,.btn-default:hover{color:#337ab7;border-color:#337ab7;background:#fff}.bootstrap-switch.bootstrap-switch-on{border-color:#337ab7}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success{color:#fff;background:#337ab7}.selectize-input-200>.selectize-input{min-width:200px;border-color:#337ab7}.btn-outline-primary{color:#007bff;background-color:transparent;background-image:none;border-color:#007bff}.btn-outline-primary:hover{color:#fff;background-color:#007bff;border-color:#007bff}.btn-outline-primary.disabled,.btn-outline-primary:disabled{color:#007bff;background-color:transparent}.btn-outline-primary:not(:disabled):not(.disabled).active,.btn-outline-primary:not(:disabled):not(.disabled):active,.show>.btn-outline-primary.dropdown-toggle{color:#fff;background-color:#007bff;border-color:#007bff}.btn-outline-secondary.focus,.btn-outline-secondary:focus,.btn-outline-secondary:not(:disabled):not(.disabled).active:focus,.btn-outline-secondary:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-secondary.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(108,117,125,.5)}.btn-outline-secondary{color:#6c757d;background-color:transparent;background-image:none;border-color:#6c757d}.btn-outline-secondary:hover{color:#fff;background-color:#6c757d;border-color:#6c757d}.btn-outline-secondary.disabled,.btn-outline-secondary:disabled{color:#6c757d;background-color:transparent}.btn-outline-secondary:not(:disabled):not(.disabled).active,.btn-outline-secondary:not(:disabled):not(.disabled):active,.show>.btn-outline-secondary.dropdown-toggle{color:#fff;background-color:#6c757d;border-color:#6c757d}.btn-outline-success.focus,.btn-outline-success:focus,.btn-outline-success:not(:disabled):not(.disabled).active:focus,.btn-outline-success:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-success.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(40,167,69,.5)}.btn-outline-success{color:#28a745;background-color:transparent;background-image:none;border-color:#28a745}.btn-outline-success:hover{color:#fff;background-color:#28a745;border-color:#28a745}.btn-outline-success.disabled,.btn-outline-success:disabled{color:#28a745;background-color:transparent}.btn-outline-success:not(:disabled):not(.disabled).active,.btn-outline-success:not(:disabled):not(.disabled):active,.show>.btn-outline-success.dropdown-toggle{color:#fff;background-color:#28a745;border-color:#28a745}.btn-outline-info.focus,.btn-outline-info:focus,.btn-outline-info:not(:disabled):not(.disabled).active:focus,.btn-outline-info:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-info.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(23,162,184,.5)}.btn-outline-info{color:#17a2b8;background-color:transparent;background-image:none;border-color:#17a2b8}.btn-outline-info:hover{color:#fff;background-color:#17a2b8;border-color:#17a2b8}.btn-outline-info.disabled,.btn-outline-info:disabled{color:#17a2b8;background-color:transparent}.btn-outline-info:not(:disabled):not(.disabled).active,.btn-outline-info:not(:disabled):not(.disabled):active,.show>.btn-outline-info.dropdown-toggle{color:#fff;background-color:#17a2b8;border-color:#17a2b8}.btn-outline-warning.focus,.btn-outline-warning:focus,.btn-outline-warning:not(:disabled):not(.disabled).active:focus,.btn-outline-warning:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-warning.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(255,193,7,.5)}.btn-outline-warning{color:#ffc107;background-color:transparent;background-image:none;border-color:#ffc107}.btn-outline-warning:hover{color:#212529;background-color:#ffc107;border-color:#ffc107}.btn-outline-warning.disabled,.btn-outline-warning:disabled{color:#ffc107;background-color:transparent}.btn-outline-warning:not(:disabled):not(.disabled).active,.btn-outline-warning:not(:disabled):not(.disabled):active,.show>.btn-outline-warning.dropdown-toggle{color:#212529;background-color:#ffc107;border-color:#ffc107}.btn-outline-danger.focus,.btn-outline-danger:focus,.btn-outline-danger:not(:disabled):not(.disabled).active:focus,.btn-outline-danger:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-danger.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(220,53,69,.5)}.btn-outline-danger{color:#dc3545;background-color:transparent;background-image:none;border-color:#dc3545}.btn-outline-danger:hover{color:#fff;background-color:#dc3545;border-color:#dc3545}.btn-outline-danger.disabled,.btn-outline-danger:disabled{color:#dc3545;background-color:transparent}.btn-outline-danger:not(:disabled):not(.disabled).active,.btn-outline-danger:not(:disabled):not(.disabled):active,.show>.btn-outline-danger.dropdown-toggle{color:#fff;background-color:#dc3545;border-color:#dc3545}.btn-outline-light.focus,.btn-outline-light:focus,.btn-outline-light:not(:disabled):not(.disabled).active:focus,.btn-outline-light:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-light.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(248,249,250,.5)}.btn-outline-light{color:#f8f9fa;background-color:transparent;background-image:none;border-color:#f8f9fa}.btn-outline-light:hover{color:#212529;background-color:#f8f9fa;border-color:#f8f9fa}.btn-outline-light.disabled,.btn-outline-light:disabled{color:#f8f9fa;background-color:transparent}.btn-outline-light:not(:disabled):not(.disabled).active,.btn-outline-light:not(:disabled):not(.disabled):active,.show>.btn-outline-light.dropdown-toggle{color:#212529;background-color:#f8f9fa;border-color:#f8f9fa}.btn-outline-dark.focus,.btn-outline-dark:focus,.btn-outline-dark:not(:disabled):not(.disabled).active:focus,.btn-outline-dark:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-dark.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(52,58,64,.5)}.btn-outline-dark{color:#343a40;background-color:transparent;background-image:none;border-color:#343a40}.btn-outline-dark:hover{color:#fff;background-color:#343a40;border-color:#343a40}.btn-outline-dark.disabled,.btn-outline-dark:disabled{color:#343a40;background-color:transparent}.btn-outline-dark:not(:disabled):not(.disabled).active,.btn-outline-dark:not(:disabled):not(.disabled):active,.show>.btn-outline-dark.dropdown-toggle{color:#fff;background-color:#343a40;border-color:#343a40} \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/dist/js/app.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/dist/js/app.js deleted file mode 100644 index ccab2f61..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/dist/js/app.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";var app;angular.module("sentinelDashboardApp",["oc.lazyLoad","ui.router","ui.bootstrap","angular-loading-bar","ngDialog","ui.bootstrap.datetimepicker","ui-notification","rzTable","angular-clipboard","selectize","angularUtils.directives.dirPagination"]).factory("AuthInterceptor",["$window","$state",function(t,r){return{responseError:function(e){return 401===e.status&&(t.localStorage.removeItem("session_sentinel_admin"),r.go("login")),e},response:function(e){return e},request:function(e){return e},requestError:function(e){return e}}}]).config(["$stateProvider","$urlRouterProvider","$ocLazyLoadProvider","$httpProvider",function(e,t,r,a){a.interceptors.push("AuthInterceptor"),r.config({debug:!1,events:!0}),t.otherwise("/dashboard/home"),e.state("login",{url:"/login",templateUrl:"app/views/login.html",controller:"LoginCtl",resolve:{loadMyFiles:["$ocLazyLoad",function(e){return e.load({name:"sentinelDashboardApp",files:["app/scripts/controllers/login.js"]})}]}}).state("dashboard",{url:"/dashboard",templateUrl:"app/views/dashboard/main.html",resolve:{loadMyDirectives:["$ocLazyLoad",function(e){return e.load({name:"sentinelDashboardApp",files:["app/scripts/directives/header/header.js","app/scripts/directives/sidebar/sidebar.js","app/scripts/directives/sidebar/sidebar-search/sidebar-search.js"]})}]}}).state("dashboard.home",{url:"/home",templateUrl:"app/views/dashboard/home.html",resolve:{loadMyFiles:["$ocLazyLoad",function(e){return e.load({name:"sentinelDashboardApp",files:["app/scripts/controllers/main.js"]})}]}}).state("dashboard.flowV1",{templateUrl:"app/views/flow_v1.html",url:"/flow/:app",controller:"FlowControllerV1",resolve:{loadMyFiles:["$ocLazyLoad",function(e){return e.load({name:"sentinelDashboardApp",files:["app/scripts/controllers/flow_v1.js"]})}]}}).state("dashboard.flow",{templateUrl:"app/views/flow_v2.html",url:"/v2/flow/:app",controller:"FlowControllerV2",resolve:{loadMyFiles:["$ocLazyLoad",function(e){return e.load({name:"sentinelDashboardApp",files:["app/scripts/controllers/flow_v2.js"]})}]}}).state("dashboard.paramFlow",{templateUrl:"app/views/param_flow.html",url:"/paramFlow/:app",controller:"ParamFlowController",resolve:{loadMyFiles:["$ocLazyLoad",function(e){return e.load({name:"sentinelDashboardApp",files:["app/scripts/controllers/param_flow.js"]})}]}}).state("dashboard.clusterAppAssignManage",{templateUrl:"app/views/cluster_app_assign_manage.html",url:"/cluster/assign_manage/:app",controller:"SentinelClusterAppAssignManageController",resolve:{loadMyFiles:["$ocLazyLoad",function(e){return e.load({name:"sentinelDashboardApp",files:["app/scripts/controllers/cluster_app_assign_manage.js"]})}]}}).state("dashboard.clusterAppServerList",{templateUrl:"app/views/cluster_app_server_list.html",url:"/cluster/server/:app",controller:"SentinelClusterAppServerListController",resolve:{loadMyFiles:["$ocLazyLoad",function(e){return e.load({name:"sentinelDashboardApp",files:["app/scripts/controllers/cluster_app_server_list.js"]})}]}}).state("dashboard.clusterAppClientList",{templateUrl:"app/views/cluster_app_client_list.html",url:"/cluster/client/:app",controller:"SentinelClusterAppTokenClientListController",resolve:{loadMyFiles:["$ocLazyLoad",function(e){return e.load({name:"sentinelDashboardApp",files:["app/scripts/controllers/cluster_app_token_client_list.js"]})}]}}).state("dashboard.clusterSingle",{templateUrl:"app/views/cluster_single_config.html",url:"/cluster/single/:app",controller:"SentinelClusterSingleController",resolve:{loadMyFiles:["$ocLazyLoad",function(e){return e.load({name:"sentinelDashboardApp",files:["app/scripts/controllers/cluster_single.js"]})}]}}).state("dashboard.authority",{templateUrl:"app/views/authority.html",url:"/authority/:app",controller:"AuthorityRuleController",resolve:{loadMyFiles:["$ocLazyLoad",function(e){return e.load({name:"sentinelDashboardApp",files:["app/scripts/controllers/authority.js"]})}]}}).state("dashboard.degrade",{templateUrl:"app/views/degrade.html",url:"/degrade/:app",controller:"DegradeCtl",resolve:{loadMyFiles:["$ocLazyLoad",function(e){return e.load({name:"sentinelDashboardApp",files:["app/scripts/controllers/degrade.js"]})}]}}).state("dashboard.system",{templateUrl:"app/views/system.html",url:"/system/:app",controller:"SystemCtl",resolve:{loadMyFiles:["$ocLazyLoad",function(e){return e.load({name:"sentinelDashboardApp",files:["app/scripts/controllers/system.js"]})}]}}).state("dashboard.machine",{templateUrl:"app/views/machine.html",url:"/app/:app",controller:"MachineCtl",resolve:{loadMyFiles:["$ocLazyLoad",function(e){return e.load({name:"sentinelDashboardApp",files:["app/scripts/controllers/machine.js"]})}]}}).state("dashboard.identity",{templateUrl:"app/views/identity.html",url:"/identity/:app",controller:"IdentityCtl",resolve:{loadMyFiles:["$ocLazyLoad",function(e){return e.load({name:"sentinelDashboardApp",files:["app/scripts/controllers/identity.js"]})}]}}).state("dashboard.gatewayIdentity",{templateUrl:"app/views/gateway/identity.html",url:"/gateway/identity/:app",controller:"GatewayIdentityCtl",resolve:{loadMyFiles:["$ocLazyLoad",function(e){return e.load({name:"sentinelDashboardApp",files:["app/scripts/controllers/gateway/identity.js"]})}]}}).state("dashboard.metric",{templateUrl:"app/views/metric.html",url:"/metric/:app",controller:"MetricCtl",resolve:{loadMyFiles:["$ocLazyLoad",function(e){return e.load({name:"sentinelDashboardApp",files:["app/scripts/controllers/metric.js"]})}]}}).state("dashboard.gatewayApi",{templateUrl:"app/views/gateway/api.html",url:"/gateway/api/:app",controller:"GatewayApiCtl",resolve:{loadMyFiles:["$ocLazyLoad",function(e){return e.load({name:"sentinelDashboardApp",files:["app/scripts/controllers/gateway/api.js"]})}]}}).state("dashboard.gatewayFlow",{templateUrl:"app/views/gateway/flow.html",url:"/gateway/flow/:app",controller:"GatewayFlowCtl",resolve:{loadMyFiles:["$ocLazyLoad",function(e){return e.load({name:"sentinelDashboardApp",files:["app/scripts/controllers/gateway/flow.js"]})}]}})}]),(app=angular.module("sentinelDashboardApp")).filter("range",[function(){return function(e,t){if(isNaN(t)||t<=0)return[];e=[];for(var r=1;r<=t;r++)e.push(r);return e}}]),(app=angular.module("sentinelDashboardApp")).service("VersionService",["$http",function(e){this.version=function(){return e({url:"/version",method:"GET"})}}]),(app=angular.module("sentinelDashboardApp")).service("AuthService",["$http",function(t){this.check=function(){return t({url:"/auth/check",method:"POST"})},this.login=function(e){return t({url:"/auth/login",params:e,method:"POST"})},this.logout=function(){return t({url:"/auth/logout",method:"POST"})}}]),(app=angular.module("sentinelDashboardApp")).service("AppService",["$http",function(e){this.getApps=function(){return e({url:"app/briefinfos.json",method:"GET"})}}]),(app=angular.module("sentinelDashboardApp")).service("FlowServiceV1",["$http",function(a){function t(e){return void 0===e||""===e||isNaN(e)||e<=0}this.queryMachineRules=function(e,t,r){return a({url:"/v1/flow/rules",params:{app:e,ip:t,port:r},method:"GET"})},this.newRule=function(e){e.resource,e.limitApp,e.grade,e.count,e.strategy,e.refResource,e.controlBehavior,e.warmUpPeriodSec,e.maxQueueingTimeMs,e.app,e.ip,e.port;return a({url:"/v1/flow/rule",data:e,method:"POST"})},this.saveRule=function(e){var t={id:e.id,resource:e.resource,limitApp:e.limitApp,grade:e.grade,count:e.count,strategy:e.strategy,refResource:e.refResource,controlBehavior:e.controlBehavior,warmUpPeriodSec:e.warmUpPeriodSec,maxQueueingTimeMs:e.maxQueueingTimeMs};return a({url:"/v1/flow/save.json",params:t,method:"PUT"})},this.deleteRule=function(e){var t={id:e.id,app:e.app};return a({url:"/v1/flow/delete.json",params:t,method:"DELETE"})},this.checkRuleValid=function(e){return void 0===e.resource||""===e.resource?(alert("资源名称不能为空"),!1):void 0===e.count||e.count<0?(alert("限流阈值必须大于等于 0"),!1):void 0===e.strategy||e.strategy<0?(alert("无效的流控模式"),!1):1!=e.strategy&&2!=e.strategy||void 0!==e.refResource&&""!=e.refResource?void 0===e.controlBehavior||e.controlBehavior<0?(alert("无效的流控整形方式"),!1):1==e.controlBehavior&&t(e.warmUpPeriodSec)?(alert("预热时长必须大于 0"),!1):2==e.controlBehavior&&t(e.maxQueueingTimeMs)?(alert("排队超时时间必须大于 0"),!1):!e.clusterMode||void 0!==e.clusterConfig&&void 0!==e.clusterConfig.thresholdType||(alert("集群限流配置不正确"),!1):(alert("请填写关联资源或入口"),!1)}}]),(app=angular.module("sentinelDashboardApp")).service("FlowServiceV2",["$http",function(a){function t(e){return void 0===e||""===e||isNaN(e)||e<=0}this.queryMachineRules=function(e,t,r){return a({url:"/v2/flow/rules",params:{app:e,ip:t,port:r},method:"GET"})},this.newRule=function(e){return a({url:"/v2/flow/rule",data:e,method:"POST"})},this.saveRule=function(e){return a({url:"/v2/flow/rule/"+e.id,data:e,method:"PUT"})},this.deleteRule=function(e){return a({url:"/v2/flow/rule/"+e.id,method:"DELETE"})},this.checkRuleValid=function(e){return void 0===e.resource||""===e.resource?(alert("资源名称不能为空"),!1):void 0===e.count||e.count<0?(alert("限流阈值必须大于等于 0"),!1):void 0===e.strategy||e.strategy<0?(alert("无效的流控模式"),!1):1!=e.strategy&&2!=e.strategy||void 0!==e.refResource&&""!=e.refResource?void 0===e.controlBehavior||e.controlBehavior<0?(alert("无效的流控整形方式"),!1):1==e.controlBehavior&&t(e.warmUpPeriodSec)?(alert("预热时长必须大于 0"),!1):2==e.controlBehavior&&t(e.maxQueueingTimeMs)?(alert("排队超时时间必须大于 0"),!1):!e.clusterMode||void 0!==e.clusterConfig&&void 0!==e.clusterConfig.thresholdType||(alert("集群限流配置不正确"),!1):(alert("请填写关联资源或入口"),!1)}}]),(app=angular.module("sentinelDashboardApp")).service("DegradeService",["$http",function(a){this.queryMachineRules=function(e,t,r){return a({url:"degrade/rules.json",params:{app:e,ip:t,port:r},method:"GET"})},this.newRule=function(e){return a({url:"/degrade/rule",data:e,method:"POST"})},this.saveRule=function(e){var t={id:e.id,resource:e.resource,limitApp:e.limitApp,grade:e.grade,count:e.count,timeWindow:e.timeWindow,statIntervalMs:e.statIntervalMs,minRequestAmount:e.minRequestAmount,slowRatioThreshold:e.slowRatioThreshold};return a({url:"/degrade/rule/"+e.id,data:t,method:"PUT"})},this.deleteRule=function(e){return a({url:"/degrade/rule/"+e.id,method:"DELETE"})},this.checkRuleValid=function(e){if(void 0===e.resource||""===e.resource)return alert("资源名称不能为空"),!1;if(void 0===e.grade||e.grade<0)return alert("未知的降级策略"),!1;if(void 0===e.count||""===e.count||e.count<0)return alert("降级阈值不能为空或小于 0"),!1;if(null==e.timeWindow||""===e.timeWindow||e.timeWindow<=0)return alert("熔断时长必须大于 0s"),!1;if(null==e.minRequestAmount||e.minRequestAmount<=0)return alert("最小请求数目需大于 0"),!1;if(null==e.statIntervalMs||e.statIntervalMs<=0)return alert("统计窗口时长需大于 0s"),!1;if(void 0!==e.statIntervalMs&&12e4=r?n.apply(null,t):function(){return e(t.concat([].slice.apply(arguments)))}}(e)}function n(){var n=arguments,r=n.length-1;return function(){for(var e=r,t=n[r].apply(this,arguments);e--;)t=n[e].call(this,t);return t}}function l(){for(var e=[],t=0;tthis._limit&&this.evict(),e},e.prototype.evict=function(){var t=this._items.shift();return this._evictListeners.forEach(function(e){return e(t)}),t},e.prototype.dequeue=function(){if(this.size())return this._items.splice(0,1)[0]},e.prototype.clear=function(){var e=this._items;return this._items=[],e},e.prototype.size=function(){return this._items.length},e.prototype.remove=function(e){var t=this._items.indexOf(e);return-1 "+Ue(e))},e.prototype.traceTransitionIgnored=function(e){this.enabled(g.Category.TRANSITION)&&console.log(st(e)+": Ignored <> "+Ue(e))},e.prototype.traceHookInvocation=function(e,t,n){if(this.enabled(g.Category.HOOK)){var r=S("traceData.hookType")(n)||"internal",i=S("traceData.context.state.name")(n)||S("traceData.context")(n)||"unknown",o=He(e.registeredHook.callback);console.log(st(t)+": Hook -> "+r+" context: "+i+", "+Fe(200,o))}},e.prototype.traceHookResult=function(e,t,n){this.enabled(g.Category.HOOK)&&console.log(st(t)+": <- Hook returned: "+Fe(200,Ue(e)))},e.prototype.traceResolvePath=function(e,t,n){this.enabled(g.Category.RESOLVE)&&console.log(st(n)+": Resolving "+e+" ("+t+")")},e.prototype.traceResolvableResolved=function(e,t){this.enabled(g.Category.RESOLVE)&&console.log(st(t)+": <- Resolved "+e+" to: "+Fe(200,Ue(e.data)))},e.prototype.traceError=function(e,t){this.enabled(g.Category.TRANSITION)&&console.log(st(t)+": <- Rejected "+Ue(t)+", reason: "+e)},e.prototype.traceSuccess=function(e,t){this.enabled(g.Category.TRANSITION)&&console.log(st(t)+": <- Success "+Ue(t)+", final state: "+e.name)},e.prototype.traceUIViewEvent=function(e,t,n){void 0===n&&(n=""),this.enabled(g.Category.UIVIEW)&&console.log("ui-view: "+Le(30,e)+" "+et(t)+n)},e.prototype.traceUIViewConfigUpdated=function(e,t){this.enabled(g.Category.UIVIEW)&&this.traceUIViewEvent("Updating",e," with ViewConfig from context='"+t+"'")},e.prototype.traceUIViewFill=function(e,t){this.enabled(g.Category.UIVIEW)&&this.traceUIViewEvent("Fill",e," with: "+Fe(200,t))},e.prototype.traceViewSync=function(e){if(this.enabled(g.Category.VIEWCONFIG)){var a="uiview component fqn",t=e.map(function(e){var t,n=e.uiView,r=e.viewConfig,i=n&&n.fqn,o=r&&r.viewDecl.$context.name+": ("+r.viewDecl.$name+")";return(t={})[a]=i,t["view config state (view name)"]=o,t}).sort(function(e,t){return(e[a]||"").localeCompare(t[a]||"")});it(t)}},e.prototype.traceViewServiceEvent=function(e,t){var n,r,i;this.enabled(g.Category.VIEWCONFIG)&&console.log("VIEWCONFIG: "+e+" "+(r=(n=t).viewDecl,i=r.$context.name||"(root)","[View#"+n.$id+" from '"+i+"' state]: target ui-view: '"+r.$uiViewName+"@"+r.$uiViewContextAnchor+"'"))},e.prototype.traceViewServiceUIViewEvent=function(e,t){this.enabled(g.Category.VIEWCONFIG)&&console.log("VIEWCONFIG: "+e+" "+et(t))},e}(),ut=new lt,ct=function(){function e(e){this.pattern=/.*/,this.inherit=!0,N(this,e)}return e.prototype.is=function(e,t){return!0},e.prototype.encode=function(e,t){return e},e.prototype.decode=function(e,t){return e},e.prototype.equals=function(e,t){return e==t},e.prototype.$subPattern=function(){var e=this.pattern.toString();return e.substr(1,e.length-2)},e.prototype.toString=function(){return"{ParamType:"+this.name+"}"},e.prototype.$normalize=function(e){return this.is(e)?e:this.decode(e)},e.prototype.$asArray=function(e,t){if(!e)return this;if("auto"===e&&!t)throw new Error("'auto' array mode is for query parameters only");return new dt(this,e)},e}();function dt(r,i){var o=this;function a(e){return E(e)?e:k(e)?[e]:[]}function s(n,r){return function(e){if(E(e)&&0===e.length)return e;var t=ce(a(e),n);return!0===r?0===se(t,function(e){return!e}).length:function(e){switch(e.length){case 0:return;case 1:return"auto"===i?e[0]:e;default:return e}}(t)}}function l(o){return function(e,t){var n=a(e),r=a(t);if(n.length!==r.length)return!1;for(var i=0;i=n.invokeLimit&&n.deregister()}}},o.prototype.handleHookResult=function(e){var t=this,n=this.getNotCurrentRejection();return n||(R(e)?e.then(function(e){return t.handleHookResult(e)}):(ut.traceHookResult(e,this.transition,this.options),!1===e?Ve.aborted("Hook aborted transition").toPromise():h($t)(e)?Ve.redirected(e).toPromise():void 0))},o.prototype.getNotCurrentRejection=function(){var e=this.transition.router;return e._disposed?Ve.aborted("UIRouter instance #"+e.$id+" has been stopped (disposed)").toPromise():this.transition._aborted?Ve.aborted().toPromise():this.isSuperseded()?Ve.superseded(this.options.current()).toPromise():void 0},o.prototype.toString=function(){var e=this.options,t=this.registeredHook;return(S("traceData.hookType")(e)||"internal")+" context: "+(S("traceData.context.state.name")(e)||S("traceData.context")(e)||"unknown")+", "+Fe(200,Ye(t.callback))},o.HANDLE_RESULT=function(t){return function(e){return t.handleHookResult(e)}},o.LOG_REJECTED_RESULT=function(t){return function(e){R(e)&&e.catch(function(e){return t.logError(Ve.normalize(e))})}},o.LOG_ERROR=function(t){return function(e){return t.logError(e)}},o.REJECT_ERROR=function(e){return function(e){return Pe(e)}},o.THROW_ERROR=function(e){return function(e){throw e}},o}();function Gt(e,t){var i=O(t)?[t]:t;return!!(D(i)?i:function(e){for(var t=i,n=0;n "+(this.valid()?"":"(X) ")+"'"+(T(t)?t.name:t)+"'"+Ue(n(this.params()))+" )"},t.diToken=t}();function en(e,t){var n=["",""],r=e.replace(/[\\\[\]\^$*+?.()|{}]/g,"\\$&");if(!t)return r;switch(t.squash){case!1:n=["(",")"+(t.isOptional?"?":"")];break;case!0:r=r.replace(/\/$/,""),n=["(?:/(",")|/)?"];break;default:n=["("+t.squash+"|",")?"]}return r+n[0]+t.type.pattern.source+n[1]}var tn=Xe("/"),nn={state:{params:{}},strict:!0,caseInsensitive:!0},rn=function(){function m(o,a,e,t){var s=this;this._cache={path:[this]},this._children=[],this._params=[],this._segments=[],this._compiled=[],this.config=t=te(t,nn),this.pattern=o;for(var n,r,i,l=/([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,u=/([:]?)([\w\[\].-]+)|\{([\w\[\].-]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,c=[],d=0,p=function(e){if(!m.nameValidator.test(e))throw new Error("Invalid parameter name '"+e+"' in pattern '"+o+"'");if(le(s._params,v("id",e)))throw new Error("Duplicate parameter name '"+e+"' in pattern '"+o+"'")},h=function(e,t){var n,r=e[2]||e[3],i=t?e[4]:e[4]||("*"===e[1]?"[\\s\\S]*":null);return{id:r,regexp:i,segment:o.substring(d,e.index),type:i?a.type(i)||(n=i,W(a.type(t?"query":"path"),{pattern:new RegExp(n,s.config.caseInsensitive?"i":void 0)})):null}};(n=l.exec(o))&&!(0<=(r=h(n,!1)).segment.indexOf("?"));)p(r.id),this._params.push(e.fromPath(r.id,r.type,t.state)),this._segments.push(r.segment),c.push([r.segment,De(this._params)]),d=l.lastIndex;var f=(i=o.substring(d)).indexOf("?");if(0<=f){var g=i.substring(f);if(i=i.substring(0,f),0r.weight?s:r}return r},t.prototype.sync=function(e){if(!e||!e.defaultPrevented){var t=this._router,n=t.urlService,r=t.stateService,i={path:n.path(),search:n.search(),hash:n.hash()},o=this.match(i);m([[O,function(e){return n.url(e,!0)}],[$t.isDef,function(e){return r.go(e.state,e.params,e.options)}],[h($t),function(e){return r.go(e.state(),e.params(),e.options())}]])(o&&o.rule.handler(o.match,i,t))}},t.prototype.listen=function(e){var t=this;if(!1!==e)return this._stopFn=this._stopFn||this._router.urlService.onChange(function(e){return t.sync(e)});this._stopFn&&this._stopFn(),delete this._stopFn},t.prototype.update=function(e){var t=this._router.locationService;e?this.location=t.url():t.url()!==this.location&&t.url(this.location,!0)},t.prototype.push=function(e,t,n){var r=n&&!!n.replace;this._router.urlService.url(e.format(t||{}),r)},t.prototype.href=function(e,t,n){var r=e.format(t);if(null==r)return null;n=n||{absolute:!1};var i,o,a,s,l=this._router.urlService.config,u=l.html5Mode();if(u||null===r||(r="#"+l.hashPrefix()+r),i=r,o=u,a=n.absolute,r="/"===(s=l.baseHref())?i:o?We(s)+i:a?s.slice(1)+i:i,!n.absolute||!r)return r;var c=!u&&r?"/":"",d=l.port(),p=80===d||443===d?"":":"+d;return[l.protocol(),"://",l.host(),p,c,r].join("")},t.prototype.rule=function(e){var t=this;if(!ln.isUrlRule(e))throw new Error("invalid rule");return e.$id=this._id++,e.priority=e.priority||0,this._rules.push(e),this._sorted=!1,function(){return t.removeRule(e)}},t.prototype.removeRule=function(e){Q(this._rules,e)},t.prototype.rules=function(){return this.ensureSorted(),this._rules.slice()},t.prototype.otherwise=function(e){var t=pn(e);this._otherwiseFn=this.urlRuleFactory.create(f(!0),t),this._sorted=!1},t.prototype.initial=function(e){var t=pn(e);this.rule(this.urlRuleFactory.create(function(e,t){return 0===t.globals.transitionHistory.size()&&!!/^\/?$/.exec(e.path)},t))},t.prototype.when=function(e,t,n){var r=this.urlRuleFactory.create(e,t);return k(n&&n.priority)&&(r.priority=n.priority),this.rule(r),r},t.prototype.deferIntercept=function(e){void 0===e&&(e=!0),this.interceptDeferred=e},t}();function pn(e){if(!(D(e)||O(e)||h($t)(e)||$t.isDef(e)))throw new Error("'handler' must be a string, function, TargetState, or have a state: 'newtarget' property");return D(e)?e:f(e)}var hn=function(){function l(e){var n=this;this.router=e,this._uiViews=[],this._viewConfigs=[],this._viewConfigFactories={},this._listeners=[],this._pluginapi={_rootViewContext:this._rootViewContext.bind(this),_viewConfigFactory:this._viewConfigFactory.bind(this),_registeredUIView:function(t){return le(n._uiViews,function(e){return n.router.$id+"."+e.id===t})},_registeredUIViews:function(){return n._uiViews},_activeViewConfigs:function(){return n._viewConfigs},_onSync:function(e){return n._listeners.push(e),function(){return Q(n._listeners,e)}}}}return l.normalizeUIViewTarget=function(e,t){void 0===t&&(t="");var n=t.split("@"),r=n[0]||"$default",i=O(n[1])?n[1]:"^",o=/^(\^(?:\.\^)*)\.(.*$)/.exec(r);o&&(i=o[1],r=o[2]),"!"===r.charAt(0)&&(r=r.substr(1),i="");/^(\^(?:\.\^)*)$/.exec(i)?i=i.split(".").reduce(function(e,t){return e.parent},e).name:"."===i&&(i=e.name);return{uiViewName:r,uiViewContextAnchor:i}},l.prototype._rootViewContext=function(e){return this._rootContext=e||this._rootContext},l.prototype._viewConfigFactory=function(e,t){this._viewConfigFactories[e]=t},l.prototype.createViewConfig=function(e,t){var n=this._viewConfigFactories[t.$type];if(!n)throw new Error("ViewService: No view config factory registered for type "+t.$type);var r=n(e,t);return E(r)?r:[r]},l.prototype.deactivateViewConfig=function(e){ut.traceViewServiceEvent("<- Removing",e),Q(this._viewConfigs,e)},l.prototype.activateViewConfig=function(e){ut.traceViewServiceEvent("-> Registering",e),this._viewConfigs.push(e)},l.prototype.sync=function(){var n=this,r=this._uiViews.map(function(e){return[e.fqn,e]}).reduce(ke,{});function i(e){for(var t=e.viewDecl.$context,n=0;++n&&t.parent;)t=t.parent;return n}var o=u(function(e,t,n,r){return t*(e(n)-e(r))}),e=this._uiViews.sort(o(function(e){var t=function(e){return e&&e.parent?t(e.parent)+1:1};return 1e4*e.fqn.split(".").length+t(e.creationContext)},1)).map(function(e){var t=n._viewConfigs.filter(l.matches(r,e));return 1 Registering",t);var e=this._uiViews;return e.filter(function(e){return e.fqn===t.fqn&&e.$type===t.$type}).length&&ut.traceViewServiceUIViewEvent("!!!! duplicate uiView named:",t),e.push(t),this.sync(),function(){-1!==e.indexOf(t)?(ut.traceViewServiceUIViewEvent("<- Deregistering",t),Q(e)(t)):ut.traceViewServiceUIViewEvent("Tried removing non-registered uiView",t)}},l.prototype.available=function(){return this._uiViews.map(w("fqn"))},l.prototype.active=function(){return this._uiViews.filter(w("$config")).map(w("name"))},l.matches=function(s,l){return function(e){if(l.$type!==e.viewDecl.$type)return!1;var t=e.viewDecl,n=t.$uiViewName.split("."),r=l.fqn.split(".");if(!q(n,r.slice(0-n.length)))return!1;var i=1-n.length||void 0,o=r.slice(0,i).join("."),a=s[o].creationContext;return t.$uiViewContextAnchor===(a&&a.name)}},l}(),fn=function(){function e(){this.params=new wt,this.lastStartedTransitionId=-1,this.transitionHistory=new Re([],1),this.successfulTransitions=new Re([],1)}return e.prototype.dispose=function(){this.transitionHistory.clear(),this.successfulTransitions.clear(),this.transition=null},e}(),gn=function(e){return e.reduce(function(e,t){return e[t]=I(t),e},{dispose:z})},mn=["url","path","search","hash","onChange"],vn=["port","protocol","host","baseHref","html5Mode","hashPrefix"],yn=["type","caseInsensitive","strictMode","defaultSquashPolicy"],wn=["sort","when","initial","otherwise","rules","rule","removeRule"],bn=["deferIntercept","listen","sync","match"],$n=function(){function e(e,t){void 0===t&&(t=!0),this.router=e,this.rules={},this.config={};var n=function(){return e.locationService};B(n,this,n,mn,t);var r=function(){return e.locationConfig};B(r,this.config,r,vn,t);var i=function(){return e.urlMatcherFactory};B(i,this.config,i,yn);var o=function(){return e.urlRouter};B(o,this.rules,o,wn),B(o,this,o,bn)}return e.prototype.url=function(e,t,n){},e.prototype.path=function(){},e.prototype.search=function(){},e.prototype.hash=function(){},e.prototype.onChange=function(e){},e.prototype.parts=function(){return{path:this.path(),search:this.search(),hash:this.hash()}},e.prototype.dispose=function(){},e.prototype.sync=function(e){},e.prototype.listen=function(e){},e.prototype.deferIntercept=function(e){},e.prototype.match=function(e){},e.locationServiceStub=gn(mn),e.locationConfigStub=gn(vn),e}(),_n=0,Cn=function(){function e(e,t){void 0===e&&(e=$n.locationServiceStub),void 0===t&&(t=$n.locationConfigStub),this.locationService=e,this.locationConfig=t,this.$id=_n++,this._disposed=!1,this._disposables=[],this.trace=ut,this.viewService=new hn(this),this.globals=new fn,this.transitionService=new zn(this),this.urlMatcherFactory=new sn,this.urlRouter=new dn(this),this.stateRegistry=new zt(this),this.stateService=new Bn(this),this.urlService=new $n(this),this._plugins={},this.viewService._pluginapi._rootViewContext(this.stateRegistry.root()),this.globals.$current=this.stateRegistry.root(),this.globals.current=this.globals.$current.self,this.disposable(this.globals),this.disposable(this.stateService),this.disposable(this.stateRegistry),this.disposable(this.transitionService),this.disposable(this.urlRouter),this.disposable(e),this.disposable(t)}return e.prototype.disposable=function(e){this._disposables.push(e)},e.prototype.dispose=function(e){var t=this;e&&D(e.dispose)?e.dispose(this):(this._disposed=!0,this._disposables.slice().forEach(function(e){try{"function"==typeof e.dispose&&e.dispose(t),Q(t._disposables,e)}catch(e){}}))},e.prototype.plugin=function(e,t){void 0===t&&(t={});var n=new e(this,t);if(!n.name)throw new Error("Required property `name` missing on plugin: "+n);return this._disposables.push(n),this._plugins[n.name]=n},e.prototype.getPlugin=function(e){return e?this._plugins[e]:de(this._plugins)},e}();function Sn(t){t.addResolvable(kt.fromData(Cn,t.router),""),t.addResolvable(kt.fromData(Jt,t),""),t.addResolvable(kt.fromData("$transition$",t),""),t.addResolvable(kt.fromData("$stateParams",t.params()),""),t.entering().forEach(function(e){t.addResolvable(kt.fromData("$state$",e),e)})}var kn=G(["$transition$",Jt]),Dn=function(e){var t=de(e.treeChanges()).reduce(fe,[]).reduce(ve,[]),n=function(e){return kn(e.token)?kt.fromData(e.token,null):e};t.forEach(function(e){e.resolvables=e.resolvables.map(n)})},xn=function(t){var e=t.to().redirectTo;if(e){var n=t.router.stateService;return D(e)?V.$q.when(e(t)).then(r):r(e)}function r(e){if(e)return e instanceof $t?e:O(e)?n.target(e,t.params(),t.options()):e.state||e.params?n.target(e.state||t.to(),e.params||t.params(),t.options()):void 0}};function On(n){return function(e,t){return(0,t.$$state()[n])(e,t)}}var Tn=On("onExit"),En=On("onRetain"),An=On("onEnter"),Pn=function(e){return new Et(e.treeChanges().to).resolvePath("EAGER",e).then(z)},Mn=function(e,t){return new Et(e.treeChanges().to).subContext(t.$$state()).resolvePath("LAZY",e).then(z)},Rn=function(e){return new Et(e.treeChanges().to).resolvePath("LAZY",e).then(z)},In=function(e){var t=V.$q,n=e.views("entering");if(n.length)return t.all(n.map(function(e){return t.when(e.load())})).then(z)},Vn=function(e){var t=e.views("entering"),n=e.views("exiting");if(t.length||n.length){var r=e.router.viewService;n.forEach(function(e){return r.deactivateViewConfig(e)}),t.forEach(function(e){return r.activateViewConfig(e)}),r.sync()}},Fn=function(e){var t=e.router.globals,n=function(){t.transition===e&&(t.transition=null)};e.onSuccess({},function(){t.successfulTransitions.enqueue(e),t.$current=e.$to(),t.current=t.$current.self,xe(e.params(),t.params)},{priority:1e4}),e.promise.then(n,n)},Ln=function(e){var t=e.options(),n=e.router.stateService,r=e.router.urlRouter;if("url"!==t.source&&t.location&&n.$current.navigable){var i={replace:"replace"===t.location};r.push(n.$current.navigable.url,n.params,i)}r.update(!0)},jn=function(a){var s=a.router;var e=a.entering().filter(function(e){return!!e.$$state().lazyLoad}).map(function(e){return Hn(a,e)});return V.$q.all(e).then(function(){if("url"!==a.originalTransition().options().source){var e=a.targetState();return s.stateService.target(e.identifier(),e.params(),e.options())}var t=s.urlService,n=t.match(t.parts()),r=n&&n.rule;if(r&&"STATE"===r.type){var i=r.state,o=n.match;return s.stateService.target(i,o,a.options())}s.urlService.sync()})};function Hn(t,n){var r=n.$$state().lazyLoad,e=r._promise;if(!e){e=r._promise=V.$q.when(r(t,n)).then(function(e){e&&Array.isArray(e.states)&&e.states.forEach(function(e){return t.router.stateRegistry.register(e)});return e}).then(function(e){return delete n.lazyLoad,delete n.$$state().lazyLoad,delete r._promise,e},function(e){return delete r._promise,V.$q.reject(e)})}return e}var Yn=function(e,t,n,r,i,o,a,s){void 0===i&&(i=!1),void 0===o&&(o=Wt.HANDLE_RESULT),void 0===a&&(a=Wt.REJECT_ERROR),void 0===s&&(s=!1),this.name=e,this.hookPhase=t,this.hookOrder=n,this.criteriaMatchPath=r,this.reverseSort=i,this.getResultHandler=o,this.getErrorHandler=a,this.synchronous=s};function Nn(e){var t=e._ignoredReason();if(t){ut.traceTransitionIgnored(e);var n=e.router.globals.transition;return"SameAsCurrent"===t&&n&&n.abort(),Ve.ignored().toPromise()}}function qn(e){if(!e.valid())throw new Error(e.error().toString())}var Un={location:!0,relative:null,inherit:!1,notify:!0,reload:!1,custom:{},current:function(){return null},source:"unknown"},zn=function(){function e(e){this._transitionCount=0,this._eventTypes=[],this._registeredHooks={},this._criteriaPaths={},this._router=e,this.$view=e.viewService,this._deregisterHookFns={},this._pluginapi=B(f(this),{},f(this),["_definePathType","_defineEvent","_getPathTypes","_getEvents","getHooks"]),this._defineCorePaths(),this._defineCoreEvents(),this._registerCoreTransitionHooks(),e.globals.successfulTransitions.onEvict(Dn)}return e.prototype.onCreate=function(e,t,n){},e.prototype.onBefore=function(e,t,n){},e.prototype.onStart=function(e,t,n){},e.prototype.onExit=function(e,t,n){},e.prototype.onRetain=function(e,t,n){},e.prototype.onEnter=function(e,t,n){},e.prototype.onFinish=function(e,t,n){},e.prototype.onSuccess=function(e,t,n){},e.prototype.onError=function(e,t,n){},e.prototype.dispose=function(e){de(this._registeredHooks).forEach(function(t){return t.forEach(function(e){e._deregistered=!0,Q(t,e)})})},e.prototype.create=function(e,t){return new Jt(e,t,this._router)},e.prototype._defineCoreEvents=function(){var e=g.TransitionHookPhase,t=Wt,n=this._criteriaPaths;this._defineEvent("onCreate",e.CREATE,0,n.to,!1,t.LOG_REJECTED_RESULT,t.THROW_ERROR,!0),this._defineEvent("onBefore",e.BEFORE,0,n.to),this._defineEvent("onStart",e.RUN,0,n.to),this._defineEvent("onExit",e.RUN,100,n.exiting,!0),this._defineEvent("onRetain",e.RUN,200,n.retained),this._defineEvent("onEnter",e.RUN,300,n.entering),this._defineEvent("onFinish",e.RUN,400,n.to),this._defineEvent("onSuccess",e.SUCCESS,0,n.to,!1,t.LOG_REJECTED_RESULT,t.LOG_ERROR,!0),this._defineEvent("onError",e.ERROR,0,n.to,!1,t.LOG_REJECTED_RESULT,t.LOG_ERROR,!0)},e.prototype._defineCorePaths=function(){var e=g.TransitionHookScope.STATE,t=g.TransitionHookScope.TRANSITION;this._definePathType("to",t),this._definePathType("from",t),this._definePathType("exiting",e),this._definePathType("retained",e),this._definePathType("entering",e)},e.prototype._defineEvent=function(e,t,n,r,i,o,a,s){void 0===i&&(i=!1),void 0===o&&(o=Wt.HANDLE_RESULT),void 0===a&&(a=Wt.REJECT_ERROR),void 0===s&&(s=!1);var l=new Yn(e,t,n,r,i,o,a,s);this._eventTypes.push(l),Qt(this,this,l)},e.prototype._getEvents=function(t){return(k(t)?this._eventTypes.filter(function(e){return e.hookPhase===t}):this._eventTypes.slice()).sort(function(e,t){var n=e.hookPhase-t.hookPhase;return 0===n?e.hookOrder-t.hookOrder:n})},e.prototype._definePathType=function(e,t){this._criteriaPaths[e]={name:e,scope:t}},e.prototype._getPathTypes=function(){return this._criteriaPaths},e.prototype.getHooks=function(e){return this._registeredHooks[e]},e.prototype._registerCoreTransitionHooks=function(){var e=this._deregisterHookFns;e.addCoreResolves=this.onCreate({},Sn),e.ignored=this.onBefore({},Nn,{priority:-9999}),e.invalid=this.onBefore({},qn,{priority:-1e4}),e.redirectTo=this.onStart({to:function(e){return!!e.redirectTo}},xn),e.onExit=this.onExit({exiting:function(e){return!!e.onExit}},Tn),e.onRetain=this.onRetain({retained:function(e){return!!e.onRetain}},En),e.onEnter=this.onEnter({entering:function(e){return!!e.onEnter}},An),e.eagerResolve=this.onStart({},Pn,{priority:1e3}),e.lazyResolve=this.onEnter({entering:f(!0)},Mn,{priority:1e3}),e.resolveAll=this.onFinish({},Rn,{priority:1e3}),e.loadViews=this.onFinish({},In),e.activateViews=this.onSuccess({},Vn),e.updateGlobals=this.onCreate({},Fn),e.updateUrl=this.onSuccess({},Ln,{priority:9999}),e.lazyLoad=this.onBefore({entering:function(e){return!!e.lazyLoad}},jn)},e}(),Bn=function(){function n(e){this.router=e,this.invalidCallbacks=[],this._defaultErrorHandler=function(e){e instanceof Error&&e.stack?(console.error(e),console.error(e.stack)):e instanceof Ve?(console.error(e.toString()),e.detail&&e.detail.stack&&console.error(e.detail.stack)):console.error(e)};var t=Object.keys(n.prototype).filter(d(G(["current","$current","params","transition"])));B(f(n.prototype),this,f(this),t)}return Object.defineProperty(n.prototype,"transition",{get:function(){return this.router.globals.transition},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"params",{get:function(){return this.router.globals.params},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"current",{get:function(){return this.router.globals.current},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"$current",{get:function(){return this.router.globals.$current},enumerable:!0,configurable:!0}),n.prototype.dispose=function(){this.defaultErrorHandler(z),this.invalidCallbacks=[]},n.prototype._handleInvalidTargetState=function(e,n){var r=this,i=_t.makeTargetState(this.router.stateRegistry,e),t=this.router.globals,o=function(){return t.transitionHistory.peekTail()},a=o(),s=new Re(this.invalidCallbacks.slice()),l=new Et(e).injector(),u=function(e){if(e instanceof $t){var t=e;return(t=r.target(t.identifier(),t.params(),t.options())).valid()?o()!==a?Ve.superseded().toPromise():r.transitionTo(t.identifier(),t.params(),t.options()):Ve.invalid(t.error()).toPromise()}};return function t(){var e=s.dequeue();return void 0===e?Ve.invalid(n.error()).toPromise():V.$q.when(e(n,i,l)).then(u).then(function(e){return e||t()})}()},n.prototype.onInvalid=function(e){return this.invalidCallbacks.push(e),function(){Q(this.invalidCallbacks)(e)}.bind(this)},n.prototype.reload=function(e){return this.transitionTo(this.current,this.params,{reload:!k(e)||e,inherit:!1,notify:!1})},n.prototype.go=function(e,t,n){var r=te(n,{relative:this.$current,inherit:!0},Un);return this.transitionTo(e,t,r)},n.prototype.target=function(e,t,n){if(void 0===n&&(n={}),T(n.reload)&&!n.reload.name)throw new Error("Invalid reload state object");var r=this.router.stateRegistry;if(n.reloadState=!0===n.reload?r.root():r.matcher.find(n.reload,n.relative),n.reload&&!n.reloadState)throw new Error("No such reload state '"+(O(n.reload)?n.reload:n.reload.name)+"'");return new $t(this.router.stateRegistry,e,t,n)},n.prototype.getCurrentPath=function(){var e=this,t=this.router.globals.successfulTransitions.peekTail();return t?t.treeChanges().to:[new bt(e.router.stateRegistry.root())]},n.prototype.transitionTo=function(e,t,n){var o=this;void 0===t&&(t={}),void 0===n&&(n={});var a=this.router,s=a.globals;n=te(n,Un);n=N(n,{current:function(){return s.transition}});var r=this.target(e,t,n),i=this.getCurrentPath();if(!r.exists())return this._handleInvalidTargetState(i,r);if(!r.valid())return Pe(r.error());var l=function(i){return function(e){if(e instanceof Ve){var t=a.globals.lastStartedTransitionId===i.$id;if(e.type===g.RejectType.IGNORED)return t&&a.urlRouter.update(),V.$q.when(s.current);var n=e.detail;if(e.type===g.RejectType.SUPERSEDED&&e.redirected&&n instanceof $t){var r=i.redirect(n);return r.run().catch(l(r))}if(e.type===g.RejectType.ABORTED)return t&&a.urlRouter.update(),V.$q.reject(e)}return o.defaultErrorHandler()(e),V.$q.reject(e)}},u=this.router.transitionService.create(i,r),c=u.run().catch(l(u));return Ae(c),N(c,{transition:u})},n.prototype.is=function(e,t,n){n=te(n,{relative:this.$current});var r=this.router.stateRegistry.matcher.find(e,n.relative);if(k(r)){if(this.$current!==r)return!1;if(!t)return!0;var i=r.parameters({inherit:!0,matchingKeys:t});return vt.equals(i,vt.values(i,t),this.params)}},n.prototype.includes=function(e,t,n){n=te(n,{relative:this.$current});var r=O(e)&&Me.fromString(e);if(r){if(!r.matches(this.$current.name))return!1;e=this.$current.name}var i=this.router.stateRegistry.matcher.find(e,n.relative),o=this.$current.includes;if(k(i)){if(!k(o[i.name]))return!1;if(!t)return!0;var a=i.parameters({inherit:!0,matchingKeys:t});return vt.equals(a,vt.values(a,t),this.params)}},n.prototype.href=function(e,t,n){n=te(n,{lossy:!0,inherit:!0,absolute:!1,relative:this.$current}),t=t||{};var r=this.router.stateRegistry.matcher.find(e,n.relative);if(!k(r))return null;n.inherit&&(t=this.params.$inherit(t,this.$current,r));var i=r&&n.lossy?r.navigable:r;return i&&void 0!==i.url&&null!==i.url?this.router.urlRouter.href(i.url,t,{absolute:n.absolute}):null},n.prototype.defaultErrorHandler=function(e){return this._defaultErrorHandler=e||this._defaultErrorHandler},n.prototype.get=function(e,t){var n=this.router.stateRegistry;return 0===arguments.length?n.get():n.get(e,t||this.$current)},n.prototype.lazyLoad=function(e,t){var n=this.get(e);if(!n||!n.lazyLoad)throw new Error("Can not lazy load "+e);var r=this.getCurrentPath(),i=_t.makeTargetState(this.router.stateRegistry,r);return Hn(t=t||this.router.transitionService.create(r,i),n)},n}(),Wn={when:function(n){return new Promise(function(e,t){return e(n)})},reject:function(n){return new Promise(function(e,t){t(n)})},defer:function(){var n={};return n.promise=new Promise(function(e,t){n.resolve=e,n.reject=t}),n},all:function(e){if(E(e))return Promise.all(e);if(T(e)){var t=Object.keys(e).map(function(t){return e[t].then(function(e){return{key:t,val:e}})});return Wn.all(t).then(function(e){return e.reduce(function(e,t){return e[t.key]=t.val,e},{})})}}},Gn={},Kn=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,Qn=/([^\s,]+)/g,Zn={get:function(e){return Gn[e]},has:function(e){return null!=Zn.get(e)},invoke:function(e,t,n){var r=N({},Gn,n||{}),i=Zn.annotate(e),o=be(function(e){return r.hasOwnProperty(e)},function(e){return"DI can't find injectable: '"+e+"'"}),a=i.filter(o).map(function(e){return r[e]});return D(e)?e.apply(t,a):e.slice(-1)[0].apply(t,a)},annotate:function(e){if(!M(e))throw new Error("Not an injectable function: "+e);if(e&&e.$inject)return e.$inject;if(E(e))return e.slice(0,-1);var t=e.toString().replace(Kn,"");return t.slice(t.indexOf("(")+1,t.indexOf(")")).match(Qn)||[]}},Xn=function(e,t){var n=t[0],r=t[1];return e.hasOwnProperty(n)?E(e[n])?e[n].push(r):e[n]=[e[n],r]:e[n]=r,e},Jn=function(e){return e.split("&").filter(U).map(Qe).reduce(Xn,{})};function er(e){var t=function(e){return e||""},n=Ge(e).map(t),r=n[0],i=n[1],o=Ke(r).map(t);return{path:o[0],search:o[1],hash:i,url:e}}var tr=function(e){var t=e.path(),n=e.search(),r=e.hash(),i=Object.keys(n).map(function(t){var e=n[t];return(E(e)?e:[e]).map(function(e){return t+"="+e})}).reduce(fe,[]).join("&");return t+(i?"?"+i:"")+(r?"#"+r:"")};function nr(r,i,o,a){return function(e){var t=e.locationService=new o(e),n=e.locationConfig=new a(e,i);return{name:r,service:t,configuration:n,dispose:function(e){e.dispose(t),e.dispose(n)}}}}var rr,ir,or,ar=function(){function e(e,t){var n=this;this.fireAfterUpdate=t,this._listeners=[],this._listener=function(t){return n._listeners.forEach(function(e){return e(t)})},this.hash=function(){return er(n._get()).hash},this.path=function(){return er(n._get()).path},this.search=function(){return Jn(er(n._get()).search)},this._location=F.location,this._history=F.history}return e.prototype.url=function(t,e){return void 0===e&&(e=!0),k(t)&&t!==this._get()&&(this._set(null,null,t,e),this.fireAfterUpdate&&this._listeners.forEach(function(e){return e({url:t})})),tr(this)},e.prototype.onChange=function(e){var t=this;return this._listeners.push(e),function(){return Q(t._listeners,e)}},e.prototype.dispose=function(e){ee(this._listeners)},e}(),sr=(rr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}rr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),lr=function(n){function e(e){var t=n.call(this,e,!1)||this;return F.addEventListener("hashchange",t._listener,!1),t}return sr(e,n),e.prototype._get=function(){return Ze(this._location.hash)},e.prototype._set=function(e,t,n,r){this._location.hash=n},e.prototype.dispose=function(e){n.prototype.dispose.call(this,e),F.removeEventListener("hashchange",this._listener)},e}(ar),ur=(ir=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}ir(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),cr=function(t){function e(e){return t.call(this,e,!0)||this}return ur(e,t),e.prototype._get=function(){return this._url},e.prototype._set=function(e,t,n,r){this._url=n},e}(ar),dr=(or=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}or(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),pr=function(n){function e(e){var t=n.call(this,e,!0)||this;return t._config=e.urlService.config,F.addEventListener("popstate",t._listener,!1),t}return dr(e,n),e.prototype._getBasePrefix=function(){return We(this._config.baseHref())},e.prototype._get=function(){var e=this._location,t=e.pathname,n=e.hash,r=e.search;r=Ke(r)[1],n=Ge(n)[1];var i=this._getBasePrefix(),o=t===this._config.baseHref(),a=t.substr(0,i.length)===i;return(t=o?"/":a?t.substring(i.length):t)+(r?"?"+r:"")+(n?"#"+n:"")},e.prototype._set=function(e,t,n,r){var i=this._getBasePrefix(),o=n&&"/"!==n[0]?"/":"",a=""===n||"/"===n?this._config.baseHref():i+o+n;r?this._history.replaceState(e,t,a):this._history.pushState(e,t,a)},e.prototype.dispose=function(e){n.prototype.dispose.call(this,e),F.removeEventListener("popstate",this._listener)},e}(ar),hr=function(){var t=this;this.dispose=z,this._baseHref="",this._port=80,this._protocol="http",this._host="localhost",this._hashPrefix="",this.port=function(){return t._port},this.protocol=function(){return t._protocol},this.host=function(){return t._host},this.baseHref=function(){return t._baseHref},this.html5Mode=function(){return!1},this.hashPrefix=function(e){return k(e)?t._hashPrefix=e:t._hashPrefix}},fr=function(){function e(e,t){void 0===t&&(t=!1),this._isHtml5=t,this._baseHref=void 0,this._hashPrefix=""}return e.prototype.port=function(){return location.port?Number(location.port):"https"===this.protocol()?443:80},e.prototype.protocol=function(){return location.protocol.replace(/:/g,"")},e.prototype.host=function(){return location.hostname},e.prototype.html5Mode=function(){return this._isHtml5},e.prototype.hashPrefix=function(e){return k(e)?this._hashPrefix=e:this._hashPrefix},e.prototype.baseHref=function(e){return k(e)&&(this._baseHref=e),b(this._baseHref)&&(this._baseHref=this.getBaseHref()),this._baseHref},e.prototype.getBaseHref=function(){var e=document.getElementsByTagName("base")[0];return e&&e.href?e.href.replace(/^(https?:)?\/\/[^/]*/,""):location.pathname||"/"},e.prototype.dispose=function(){},e}();function gr(e){return V.$injector=Zn,{name:"vanilla.services",$q:V.$q=Wn,$injector:Zn,dispose:function(){return null}}}var mr=nr("vanilla.hashBangLocation",!1,lr,fr),vr=nr("vanilla.pushStateLocation",!0,pr,fr),yr=nr("vanilla.memoryLocation",!1,cr,hr),wr=function(){function e(){}return e.prototype.dispose=function(e){},e}(),br=Object.freeze({root:F,fromJson:j,toJson:H,forEach:Y,extend:N,equals:q,identity:U,noop:z,createProxyFunctions:B,inherit:W,inArray:G,_inArray:K,removeFrom:Q,_removeFrom:Z,pushTo:X,_pushTo:J,deregAll:ee,defaults:te,mergeR:ne,ancestors:re,pick:ie,omit:oe,pluck:ae,filter:se,find:le,mapObj:ue,map:ce,values:de,allTrueR:pe,anyTrueR:he,unnestR:fe,flattenR:ge,pushR:me,uniqR:ve,unnest:ye,flatten:we,assertPredicate:be,assertMap:$e,assertFn:_e,pairs:Ce,arrayTuples:Se,applyPairs:ke,tail:De,copy:xe,_extend:Oe,silenceUncaughtInPromise:Ae,silentRejection:Pe,notImplemented:I,services:V,Glob:Me,curry:u,compose:n,pipe:l,prop:w,propEq:v,parse:S,not:d,and:r,or:i,all:c,any:p,is:h,eq:o,val:f,invoke:a,pattern:m,isUndefined:b,isDefined:k,isNull:$,isNullOrUndefined:_,isFunction:D,isNumber:x,isString:O,isObject:T,isArray:E,isDate:A,isRegExp:P,isInjectable:M,isPromise:R,Queue:Re,maxLength:Fe,padString:Le,kebobString:je,functionToString:He,fnToString:Ye,stringify:Ue,beforeAfterSubstr:ze,hostRegex:Be,stripLastPathElement:We,splitHash:Ge,splitQuery:Ke,splitEqual:Qe,trimHashVal:Ze,splitOnDelim:Xe,joinNeighborsR:Je,get Category(){return g.Category},Trace:lt,trace:ut,get DefType(){return g.DefType},Param:vt,ParamTypes:yt,StateParams:wt,ParamType:ct,PathNode:bt,PathUtils:_t,resolvePolicies:Ct,defaultResolvePolicy:St,Resolvable:kt,NATIVE_INJECTOR_TOKEN:Tt,ResolveContext:Et,resolvablesBuilder:Lt,StateBuilder:Yt,StateObject:Nt,StateMatcher:qt,StateQueueManager:Ut,StateRegistry:zt,StateService:Bn,TargetState:$t,get TransitionHookPhase(){return g.TransitionHookPhase},get TransitionHookScope(){return g.TransitionHookScope},HookBuilder:Zt,matchState:Gt,RegisteredHook:Kt,makeEvent:Qt,get RejectType(){return g.RejectType},Rejection:Ve,Transition:Jt,TransitionHook:Wt,TransitionEventType:Yn,defaultTransOpts:Un,TransitionService:zn,UrlMatcher:rn,ParamFactory:an,UrlMatcherFactory:sn,UrlRouter:dn,UrlRuleFactory:ln,BaseUrlRule:un,UrlService:$n,ViewService:hn,UIRouterGlobals:fn,UIRouter:Cn,$q:Wn,$injector:Zn,BaseLocationServices:ar,HashLocationService:lr,MemoryLocationService:cr,PushStateLocationService:pr,MemoryLocationConfig:hr,BrowserLocationConfig:fr,keyValsToObjectR:Xn,getParams:Jn,parseUrl:er,buildUrl:tr,locationPluginFactory:nr,servicesPlugin:gr,hashLocationPlugin:mr,pushStateLocationPlugin:vr,memoryLocationPlugin:yr,UIRouterPluginBase:wr});function $r(){var n=null;return function(e,t){return n=n||V.$injector.get("$templateFactory"),[new kr(e,t,n)]}}var _r=function(e,n){return e.reduce(function(e,t){return e||k(n[t])},!1)};function Cr(r){if(!r.parent)return{};var i=["component","bindings","componentProvider"],o=["templateProvider","templateUrl","template","notify","async"].concat(["controller","controllerProvider","controllerAs","resolveAs"]),e=i.concat(o);if(k(r.views)&&_r(e,r))throw new Error("State '"+r.name+"' has a 'views' object. It cannot also have \"view properties\" at the state level. Move the following properties into a view (in the 'views' object): "+e.filter(function(e){return k(r[e])}).join(", "));var a={},t=r.views||{$default:ie(r,e)};return Y(t,function(e,t){if(t=t||"$default",O(e)&&(e={component:e}),e=N({},e),_r(i,e)&&_r(o,e))throw new Error("Cannot combine: "+i.join("|")+" with: "+o.join("|")+" in stateview: '"+t+"@"+r.name+"'");e.resolveAs=e.resolveAs||"$resolve",e.$type="ng1",e.$context=r,e.$name=t;var n=hn.normalizeUIViewTarget(e.$context,e.$name);e.$uiViewName=n.uiViewName,e.$uiViewContextAnchor=n.uiViewContextAnchor,a[t]=e}),a}var Sr=0,kr=function(){function e(e,t,n){var r=this;this.path=e,this.viewDecl=t,this.factory=n,this.$id=Sr++,this.loaded=!1,this.getTemplate=function(e,t){return r.component?r.factory.makeComponentTemplate(e,t,r.component,r.viewDecl.bindings):r.template}}return e.prototype.load=function(){var t=this,e=V.$q,n=new Et(this.path),r=this.path.reduce(function(e,t){return N(e,t.paramValues)},{}),i={template:e.when(this.factory.fromConfig(this.viewDecl,r,n)),controller:e.when(this.getController(n))};return e.all(i).then(function(e){return ut.traceViewServiceEvent("Loaded",t),t.controller=e.controller,N(t,e.template),t})},e.prototype.getController=function(e){var t=this.viewDecl.controllerProvider;if(!M(t))return this.viewDecl.controller;var n=V.$injector.annotate(t),r=E(t)?De(t):t;return new kt("",r,n).get(e)},e}(),Dr=function(){function e(){var r=this;this._useHttp=C.version.minor<3,this.$get=["$http","$templateCache","$injector",function(e,t,n){return r.$templateRequest=n.has&&n.has("$templateRequest")&&n.get("$templateRequest"),r.$http=e,r.$templateCache=t,r}]}return e.prototype.useHttpService=function(e){this._useHttp=e},e.prototype.fromConfig=function(e,t,n){var r=function(e){return V.$q.when(e).then(function(e){return{template:e}})},i=function(e){return V.$q.when(e).then(function(e){return{component:e}})};return k(e.template)?r(this.fromString(e.template,t)):k(e.templateUrl)?r(this.fromUrl(e.templateUrl,t)):k(e.templateProvider)?r(this.fromProvider(e.templateProvider,t,n)):k(e.component)?i(e.component):k(e.componentProvider)?i(this.fromComponentProvider(e.componentProvider,t,n)):r("")},e.prototype.fromString=function(e,t){return D(e)?e(t):e},e.prototype.fromUrl=function(e,t){return D(e)&&(e=e(t)),null==e?null:this._useHttp?this.$http.get(e,{cache:this.$templateCache,headers:{Accept:"text/html"}}).then(function(e){return e.data}):this.$templateRequest(e)},e.prototype.fromProvider=function(e,t,n){var r=V.$injector.annotate(e),i=E(e)?De(e):e;return new kt("",i,r).get(n)},e.prototype.fromComponentProvider=function(e,t,n){var r=V.$injector.annotate(e),i=E(e)?De(e):e;return new kt("",i,r).get(n)},e.prototype.makeComponentTemplate=function(l,u,e,c){c=c||{};var d=3<=C.version.minor?"::":"",p=function(e){var t=je(e);return/^(x|data)-/.exec(t)?"x-"+t:t},t=function(e){var t=V.$injector.get(e+"Directive");if(!t||!t.length)throw new Error("Unable to find component named '"+e+"'");return t.map(xr).reduce(fe,[])}(e).map(function(e){var t=e.name,n=e.type,r=p(t);if(l.attr(r)&&!c[t])return r+"='"+l.attr(r)+"'";var i=c[t]||t;if("@"===n)return r+"='{{"+d+"$resolve."+i+"}}'";if("&"!==n)return r+"='"+d+"$resolve."+i+"'";var o=u.getResolvable(i),a=o&&o.data,s=a&&V.$injector.annotate(a)||[];return r+"='$resolve."+i+(E(a)?"["+(a.length-1)+"]":"")+"("+s.join(",")+")'"}).join(" "),n=p(e);return"<"+n+" "+t+">"},e}();var xr=function(e){return T(e.bindToController)?Or(e.bindToController):Or(e.scope)},Or=function(t){return Object.keys(t||{}).map(function(e){return[e,/^([=<@&])[?]?(.*)/.exec(t[e])]}).filter(function(e){return k(e)&&E(e[1])}).map(function(e){return{name:e[1][2]||e[0],type:e[1][1]}})},Tr=function(){function n(e,t){this.stateRegistry=e,this.stateService=t,B(f(n.prototype),this,f(this))}return n.prototype.decorator=function(e,t){return this.stateRegistry.decorator(e,t)||this},n.prototype.state=function(e,t){return T(e)?t=e:t.name=e,this.stateRegistry.register(t),this},n.prototype.onInvalid=function(e){return this.stateService.onInvalid(e)},n}(),Er=function(n){return function(e,t){var i=e[n],o="onExit"===n?"from":"to";return i?function(e,t){var n=new Et(e.treeChanges(o)).subContext(t.$$state()),r=N(Wr(n),{$state$:t,$transition$:e});return V.$injector.invoke(i,this,r)}:void 0}},Ar=function(){function e(e){this._urlListeners=[],this.$locationProvider=e;var t=f(e);B(t,this,t,["hashPrefix"])}return e.monkeyPatchPathParameterType=function(e){var t=e.urlMatcherFactory.type("path");t.encode=function(e){return null!=e?e.toString().replace(/(~|\/)/g,function(e){return{"~":"~~","/":"~2F"}[e]}):e},t.decode=function(e){return null!=e?e.toString().replace(/(~~|~2F)/g,function(e){return{"~~":"~","~2F":"/"}[e]}):e}},e.prototype.dispose=function(){},e.prototype.onChange=function(e){var t=this;return this._urlListeners.push(e),function(){return Q(t._urlListeners)(e)}},e.prototype.html5Mode=function(){var e=this.$locationProvider.html5Mode();return(e=T(e)?e.enabled:e)&&this.$sniffer.history},e.prototype.baseHref=function(){return this._baseHref||(this._baseHref=this.$browser.baseHref()||this.$window.location.pathname)},e.prototype.url=function(e,t,n){return void 0===t&&(t=!1),k(e)&&this.$location.url(e),t&&this.$location.replace(),n&&this.$location.state(n),this.$location.url()},e.prototype._runtimeServices=function(e,t,n,r,i){var o=this;this.$location=t,this.$sniffer=n,this.$browser=r,this.$window=i,e.$on("$locationChangeSuccess",function(t){return o._urlListeners.forEach(function(e){return e(t)})});var a=f(t);B(a,this,a,["replace","path","search","hash"]),B(a,this,a,["port","protocol","host"])},e}(),Pr=function(){function n(e){this._router=e,this._urlRouter=e.urlRouter}return n.injectableHandler=function(t,n){return function(e){return V.$injector.invoke(n,null,{$match:e,$stateParams:t.globals.params})}},n.prototype.$get=function(){var e=this._urlRouter;return e.update(!0),e.interceptDeferred||e.listen(),e},n.prototype.rule=function(e){var t=this;if(!D(e))throw new Error("'rule' must be a function");var n=new un(function(){return e(V.$injector,t._router.locationService)},U);return this._urlRouter.rule(n),this},n.prototype.otherwise=function(e){var t=this,n=this._urlRouter;if(O(e))n.otherwise(e);else{if(!D(e))throw new Error("'rule' must be a string or function");n.otherwise(function(){return e(V.$injector,t._router.locationService)})}return this},n.prototype.when=function(e,t){return(E(t)||D(t))&&(t=n.injectableHandler(this._router,t)),this._urlRouter.when(e,t),this},n.prototype.deferIntercept=function(e){this._urlRouter.deferIntercept(e)},n}();C.module("ui.router.angular1",[]);var Mr=C.module("ui.router.init",["ng"]),Rr=C.module("ui.router.util",["ui.router.init"]),Ir=C.module("ui.router.router",["ui.router.util"]),Vr=C.module("ui.router.state",["ui.router.router","ui.router.util","ui.router.angular1"]),Fr=C.module("ui.router",["ui.router.init","ui.router.state","ui.router.angular1"]),Lr=(C.module("ui.router.compat",["ui.router"]),null);function jr(e){(Lr=this.router=new Cn).stateProvider=new Tr(Lr.stateRegistry,Lr.stateService),Lr.stateRegistry.decorator("views",Cr),Lr.stateRegistry.decorator("onExit",Er("onExit")),Lr.stateRegistry.decorator("onRetain",Er("onRetain")),Lr.stateRegistry.decorator("onEnter",Er("onEnter")),Lr.viewService._pluginapi._viewConfigFactory("ng1",$r());var s=Lr.locationService=Lr.locationConfig=new Ar(e);function t(e,t,n,r,i,o,a){return s._runtimeServices(i,e,r,t,n),delete Lr.router,delete Lr.$get,Lr}return Ar.monkeyPatchPathParameterType(Lr),((Lr.router=Lr).$get=t).$inject=["$location","$browser","$window","$sniffer","$rootScope","$http","$templateCache"],Lr}jr.$inject=["$locationProvider"];var Hr=function(n){return["$uiRouterProvider",function(e){var t=e.router[n];return t.$get=function(){return t},t}]};function Yr(t,e,n){if(V.$injector=t,V.$q=e,!t.hasOwnProperty("strictDi"))try{t.invoke(function(e){})}catch(e){t.strictDi=!!/strict mode/.exec(e&&e.toString())}n.stateRegistry.get().map(function(e){return e.$$state().resolvables}).reduce(fe,[]).filter(function(e){return"deferred"===e.deps}).forEach(function(e){return e.deps=t.annotate(e.resolveFn,t.strictDi)})}Yr.$inject=["$injector","$q","$uiRouter"];function Nr(e){e.$watch(function(){ut.approximateDigests++})}Nr.$inject=["$rootScope"],Mr.provider("$uiRouter",jr),Ir.provider("$urlRouter",["$uiRouterProvider",function(e){return e.urlRouterProvider=new Pr(e)}]),Rr.provider("$urlService",Hr("urlService")),Rr.provider("$urlMatcherFactory",["$uiRouterProvider",function(){return Lr.urlMatcherFactory}]),Rr.provider("$templateFactory",function(){return new Dr}),Vr.provider("$stateRegistry",Hr("stateRegistry")),Vr.provider("$uiRouterGlobals",Hr("globals")),Vr.provider("$transitions",Hr("transitionService")),Vr.provider("$state",["$uiRouterProvider",function(){return N(Lr.stateProvider,{$get:function(){return Lr.stateService}})}]),Vr.factory("$stateParams",["$uiRouter",function(e){return e.globals.params}]),Fr.factory("$view",function(){return Lr.viewService}),Fr.service("$trace",function(){return ut}),Fr.run(Nr),Rr.run(["$urlMatcherFactory",function(e){}]),Vr.run(["$state",function(e){}]),Ir.run(["$urlRouter",function(e){}]),Mr.run(Yr);var qr,Ur,zr,Br,Wr=function(n){return n.getTokens().filter(O).map(function(e){var t=n.getResolvable(e);return[e,"NOWAIT"===n.getPolicy(t).async?t.promise:t.data]}).reduce(ke,{})};function Gr(e){var t,n=e.match(/^\s*({[^}]*})\s*$/);if(n&&(e="("+n[1]+")"),!(t=e.replace(/\n/g," ").match(/^\s*([^(]*?)\s*(\((.*)\))?\s*$/))||4!==t.length)throw new Error("Invalid state ref '"+e+"'");return{state:t[1]||null,paramExpr:t[3]||null}}function Kr(e){var t=e.parent().inheritedData("$uiView"),n=S("$cfg.path")(t);return n?De(n).state.name:void 0}function Qr(e,t,n){var r,i=n.uiState||e.current.name,o=N((r=e,{relative:Kr(t)||r.$current,inherit:!0,source:"sref"}),n.uiStateOpts||{}),a=e.href(i,n.uiStateParams,o);return{uiState:i,uiStateParams:n.uiStateParams,uiStateOpts:o,href:a}}function Zr(e){var t="[object SVGAnimatedString]"===Object.prototype.toString.call(e.prop("href")),n="FORM"===e[0].nodeName;return{attr:n?"action":t?"xlink:href":"href",isAnchor:"A"===e.prop("tagName").toUpperCase(),clickable:!n}}function Xr(o,a,s,l,u){return function(e){var t=e.which||e.button,n=u();if(!(1>>0;if(0===i)return-1;var o=+t||0;if(Math.abs(o)===1/0&&(o=0),i<=o)return-1;for(n=Math.max(0<=o?o:i-Math.abs(o),0);n
    ',this.loadingBarTemplate='
    ',this.$get=["$injector","$document","$timeout","$rootScope",function(i,o,a,s){function l(e){if(m){var t=100*e+"%";f.css("width",t),v=e,y&&(a.cancel(c),c=a(function(){n()},250))}}function n(){if(!(1<=r())){var e,t=r();e=0<=t&&t<.25?(3*Math.random()+3)/100:.25<=t&&t<.65?3*Math.random()/100:.65<=t&&t<.9?2*Math.random()/100:.9<=t&&t<.99?.005:0,l(r()+e)}}function r(){return v}function t(){v=0,m=!1}var u,c,d,p=this.parentSelector,h=angular.element(this.loadingBarTemplate),f=h.find("div").eq(0),g=angular.element(this.spinnerTemplate),m=!1,v=0,y=this.autoIncrement,w=this.includeSpinner,b=this.includeBar,$=this.startSize;return{start:function(){if(u||(u=i.get("$animate")),a.cancel(d),!m){var e=o[0],t=e.querySelector?e.querySelector(p):o.find(p)[0];t||(t=e.getElementsByTagName("body")[0]);var n=angular.element(t),r=t.lastChild&&angular.element(t.lastChild);s.$broadcast("cfpLoadingBar:started"),m=!0,b&&u.enter(h,n,r),w&&u.enter(g,n,h),l($)}},set:l,status:r,inc:n,complete:function(){u||(u=i.get("$animate")),s.$broadcast("cfpLoadingBar:completed"),l(1),a.cancel(d),d=a(function(){var e=u.leave(h,t);e&&e.then&&e.then(t),u.leave(g)},500)},autoIncrement:this.autoIncrement,includeSpinner:this.includeSpinner,latencyThreshold:this.latencyThreshold,parentSelector:this.parentSelector,startSize:this.startSize}}]})}(),angular.module("ui.bootstrap",["ui.bootstrap.tpls","ui.bootstrap.transition","ui.bootstrap.collapse","ui.bootstrap.accordion","ui.bootstrap.alert","ui.bootstrap.bindHtml","ui.bootstrap.buttons","ui.bootstrap.carousel","ui.bootstrap.dateparser","ui.bootstrap.position","ui.bootstrap.datepicker","ui.bootstrap.dropdown","ui.bootstrap.modal","ui.bootstrap.pagination","ui.bootstrap.tooltip","ui.bootstrap.popover","ui.bootstrap.progressbar","ui.bootstrap.rating","ui.bootstrap.tabs","ui.bootstrap.timepicker","ui.bootstrap.typeahead"]),angular.module("ui.bootstrap.tpls",["template/accordion/accordion-group.html","template/accordion/accordion.html","template/alert/alert.html","template/carousel/carousel.html","template/carousel/slide.html","template/datepicker/datepicker.html","template/datepicker/day.html","template/datepicker/month.html","template/datepicker/popup.html","template/datepicker/year.html","template/modal/backdrop.html","template/modal/window.html","template/pagination/pager.html","template/pagination/pagination.html","template/tooltip/tooltip-html-unsafe-popup.html","template/tooltip/tooltip-popup.html","template/popover/popover.html","template/progressbar/bar.html","template/progressbar/progress.html","template/progressbar/progressbar.html","template/rating/rating.html","template/tabs/tab.html","template/tabs/tabset.html","template/timepicker/timepicker.html","template/typeahead/typeahead-match.html","template/typeahead/typeahead-popup.html"]),angular.module("ui.bootstrap.transition",[]).factory("$transition",["$q","$timeout","$rootScope",function(a,s,l){function e(e){for(var t in e)if(void 0!==n.style[t])return e[t]}var u=function(e,t,n){n=n||{};var r=a.defer(),i=u[n.animation?"animationEndEventName":"transitionEndEventName"],o=function(){l.$apply(function(){e.unbind(i,o),r.resolve(e)})};return i&&e.bind(i,o),s(function(){angular.isString(t)?e.addClass(t):angular.isFunction(t)?t(e):angular.isObject(t)&&e.css(t),i||r.resolve(e)}),r.promise.cancel=function(){i&&e.unbind(i,o),r.reject("Transition cancelled")},r.promise},n=document.createElement("trans");return u.transitionEndEventName=e({WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"}),u.animationEndEventName=e({WebkitTransition:"webkitAnimationEnd",MozTransition:"animationend",OTransition:"oAnimationEnd",transition:"animationend"}),u}]),angular.module("ui.bootstrap.collapse",["ui.bootstrap.transition"]).directive("collapse",["$transition",function(l){return{link:function(e,r,t){function n(e){function t(){a===n&&(a=void 0)}var n=l(r,e);return a&&a.cancel(),(a=n).then(t,t),n}function i(){r.removeClass("collapsing"),r.addClass("collapse in"),r.css({height:"auto"})}function o(){r.removeClass("collapsing"),r.addClass("collapse")}var a,s=!0;e.$watch(t.collapse,function(e){e?s?(s=!1,o(),r.css({height:0})):(r.css({height:r[0].scrollHeight+"px"}),r[0].offsetWidth,r.removeClass("collapse in").addClass("collapsing"),n({height:0}).then(o)):s?(s=!1,i()):(r.removeClass("collapse").addClass("collapsing"),n({height:r[0].scrollHeight+"px"}).then(i))})}}}]),angular.module("ui.bootstrap.accordion",["ui.bootstrap.collapse"]).constant("accordionConfig",{closeOthers:!0}).controller("AccordionController",["$scope","$attrs","accordionConfig",function(e,n,r){this.groups=[],this.closeOthers=function(t){(angular.isDefined(n.closeOthers)?e.$eval(n.closeOthers):r.closeOthers)&&angular.forEach(this.groups,function(e){e!==t&&(e.isOpen=!1)})},this.addGroup=function(e){var t=this;this.groups.push(e),e.$on("$destroy",function(){t.removeGroup(e)})},this.removeGroup=function(e){var t=this.groups.indexOf(e);-1!==t&&this.groups.splice(t,1)}}]).directive("accordion",function(){return{restrict:"EA",controller:"AccordionController",transclude:!0,replace:!1,templateUrl:"template/accordion/accordion.html"}}).directive("accordionGroup",function(){return{require:"^accordion",restrict:"EA",transclude:!0,replace:!0,templateUrl:"template/accordion/accordion-group.html",scope:{heading:"@",isOpen:"=?",isDisabled:"=?"},controller:function(){this.setHeading=function(e){this.heading=e}},link:function(t,e,n,r){r.addGroup(t),t.$watch("isOpen",function(e){e&&r.closeOthers(t)}),t.toggleOpen=function(){t.isDisabled||(t.isOpen=!t.isOpen)}}}}).directive("accordionHeading",function(){return{restrict:"EA",transclude:!0,template:"",replace:!0,require:"^accordionGroup",link:function(e,t,n,r,i){r.setHeading(i(e,function(){}))}}}).directive("accordionTransclude",function(){return{require:"^accordionGroup",link:function(e,t,n,r){e.$watch(function(){return r[n.accordionTransclude]},function(e){e&&(t.html(""),t.append(e))})}}}),angular.module("ui.bootstrap.alert",[]).controller("AlertController",["$scope","$attrs",function(e,t){e.closeable="close"in t,this.close=e.close}]).directive("alert",function(){return{restrict:"EA",controller:"AlertController",templateUrl:"template/alert/alert.html",transclude:!0,replace:!0,scope:{type:"@",close:"&"}}}).directive("dismissOnTimeout",["$timeout",function(i){return{require:"alert",link:function(e,t,n,r){i(function(){r.close()},parseInt(n.dismissOnTimeout,10))}}}]),angular.module("ui.bootstrap.bindHtml",[]).directive("bindHtmlUnsafe",function(){return function(e,t,n){t.addClass("ng-binding").data("$binding",n.bindHtmlUnsafe),e.$watch(n.bindHtmlUnsafe,function(e){t.html(e||"")})}}),angular.module("ui.bootstrap.buttons",[]).constant("buttonConfig",{activeClass:"active",toggleEvent:"click"}).controller("ButtonsController",["buttonConfig",function(e){this.activeClass=e.activeClass||"active",this.toggleEvent=e.toggleEvent||"click"}]).directive("btnRadio",function(){return{require:["btnRadio","ngModel"],controller:"ButtonsController",link:function(t,n,r,e){var i=e[0],o=e[1];o.$render=function(){n.toggleClass(i.activeClass,angular.equals(o.$modelValue,t.$eval(r.btnRadio)))},n.bind(i.toggleEvent,function(){var e=n.hasClass(i.activeClass);(!e||angular.isDefined(r.uncheckable))&&t.$apply(function(){o.$setViewValue(e?null:t.$eval(r.btnRadio)),o.$render()})})}}}).directive("btnCheckbox",function(){return{require:["btnCheckbox","ngModel"],controller:"ButtonsController",link:function(r,e,t,n){function i(){return o(t.btnCheckboxTrue,!0)}function o(e,t){var n=r.$eval(e);return angular.isDefined(n)?n:t}var a=n[0],s=n[1];s.$render=function(){e.toggleClass(a.activeClass,angular.equals(s.$modelValue,i()))},e.bind(a.toggleEvent,function(){r.$apply(function(){s.$setViewValue(e.hasClass(a.activeClass)?o(t.btnCheckboxFalse,!1):i()),s.$render()})})}}}),angular.module("ui.bootstrap.carousel",["ui.bootstrap.transition"]).controller("CarouselController",["$scope","$timeout","$interval","$transition",function(a,t,n,s){function l(){r();var e=+a.interval;!isNaN(e)&&0=d.length?d[t-1]:d[t]):t
    ");e.attr({"ng-model":"date","ng-change":"dateSelection()"});var c=angular.element(e.children()[0]);i.datepickerOptions&&angular.forEach(r.$parent.$eval(i.datepickerOptions),function(e,t){c.attr(o(t),e)}),r.watchData={},angular.forEach(["minDate","maxDate","datepickerMode"],function(t){if(i[t]){var e=g(i[t]);if(r.$parent.$watch(e,function(e){r.watchData[t]=e}),c.attr(o(t),"watchData."+t),"datepickerMode"===t){var n=e.assign;r.$watch("watchData."+t,function(e,t){e!==t&&n(r.$parent,e)})}}}),i.dateDisabled&&c.attr("date-disabled","dateDisabled({ date: date, mode: mode })"),n.$parsers.unshift(a),r.dateSelection=function(e){angular.isDefined(e)&&(r.date=e),n.$setViewValue(r.date),n.$render(),l&&(r.isOpen=!1,t[0].focus())},t.bind("input change keyup",function(){r.$apply(function(){r.date=n.$modelValue})}),n.$render=function(){var e=n.$viewValue?y(n.$viewValue,s):"";t.val(e),r.date=a(n.$modelValue)};var d=function(e){r.isOpen&&e.target!==t[0]&&r.$apply(function(){r.isOpen=!1})},p=function(e){r.keydown(e)};t.bind("keydown",p),r.keydown=function(e){27===e.which?(e.preventDefault(),e.stopPropagation(),r.close()):40!==e.which||r.isOpen||(r.isOpen=!0)},r.$watch("isOpen",function(e){e?(r.$broadcast("datepicker.focus"),r.position=u?v.offset(t):v.position(t),r.position.top=r.position.top+t.prop("offsetHeight"),m.bind("click",d)):m.unbind("click",d)}),r.select=function(e){if("today"===e){var t=new Date;angular.isDate(n.$modelValue)?(e=new Date(n.$modelValue)).setFullYear(t.getFullYear(),t.getMonth(),t.getDate()):e=new Date(t.setHours(0,0,0,0))}r.dateSelection(e)},r.close=function(){r.isOpen=!1,t[0].focus()};var h=f(e)(r);e.remove(),u?m.find("body").append(h):t.after(h),r.$on("$destroy",function(){h.remove(),t.unbind("keydown",p),m.unbind("click",d)})}}}]).directive("datepickerPopupWrap",function(){return{restrict:"EA",replace:!0,transclude:!0,templateUrl:"template/datepicker/popup.html",link:function(e,t){t.bind("click",function(e){e.preventDefault(),e.stopPropagation()})}}}),angular.module("ui.bootstrap.dropdown",[]).constant("dropdownConfig",{openClass:"open"}).service("dropdownService",["$document",function(t){var n=null;this.open=function(e){n||(t.bind("click",r),t.bind("keydown",i)),n&&n!==e&&(n.isOpen=!1),n=e},this.close=function(e){n===e&&(n=null,t.unbind("click",r),t.unbind("keydown",i))};var r=function(e){if(n){var t=n.getToggleElement();e&&t&&t[0].contains(e.target)||n.$apply(function(){n.isOpen=!1})}},i=function(e){27===e.which&&(n.focusToggleElement(),r())}}]).controller("DropdownController",["$scope","$attrs","$parse","dropdownConfig","dropdownService","$animate",function(n,t,r,e,i,o){var a,s=this,l=n.$new(),u=e.openClass,c=angular.noop,d=t.onToggle?r(t.onToggle):angular.noop;this.init=function(e){s.$element=e,t.isOpen&&(a=r(t.isOpen),c=a.assign,n.$watch(a,function(e){l.isOpen=!!e}))},this.toggle=function(e){return l.isOpen=arguments.length?!!e:!l.isOpen},this.isOpen=function(){return l.isOpen},l.getToggleElement=function(){return s.toggleElement},l.focusToggleElement=function(){s.toggleElement&&s.toggleElement[0].focus()},l.$watch("isOpen",function(e,t){o[e?"addClass":"removeClass"](s.$element,u),e?(l.focusToggleElement(),i.open(l)):i.close(l),c(n,e),angular.isDefined(e)&&e!==t&&d(n,{open:!!e})}),n.$on("$locationChangeSuccess",function(){l.isOpen=!1}),n.$on("$destroy",function(){l.$destroy()})}]).directive("dropdown",function(){return{controller:"DropdownController",link:function(e,t,n,r){r.init(t)}}}).directive("dropdownToggle",function(){return{require:"?^dropdown",link:function(t,n,r,i){if(i){i.toggleElement=n;var e=function(e){e.preventDefault(),n.hasClass("disabled")||r.disabled||t.$apply(function(){i.toggle()})};n.bind("click",e),n.attr({"aria-haspopup":!0,"aria-expanded":!1}),t.$watch(i.isOpen,function(e){n.attr("aria-expanded",!!e)}),t.$on("$destroy",function(){n.unbind("click",e)})}}}}),angular.module("ui.bootstrap.modal",["ui.bootstrap.transition"]).factory("$$stackedMap",function(){return{createNew:function(){var r=[];return{add:function(e,t){r.push({key:e,value:t})},get:function(e){for(var t=0;t");i.attr("backdrop-class",t.backdropClass),h=c(i)(f),n.append(h)}var o=angular.element("
    ");o.attr({"template-url":t.windowTemplateUrl,"window-class":t.windowClass,size:t.size,index:m.length()-1,animate:"animate"}).html(t.content);var a=c(o)(t.scope);m.top().value.modalDomEl=a,n.append(a),n.addClass(g)},n.close=function(e,t){var n=m.get(e);n&&(n.value.deferred.resolve(t),r(e))},n.dismiss=function(e,t){var n=m.get(e);n&&(n.value.deferred.reject(t),r(e))},n.dismissAll=function(e){for(var t=this.getTop();t;)this.dismiss(t.key,e),t=this.getTop()},n.getTop=function(){return m.top()},n}]).provider("$modal",function(){var g={options:{backdrop:!0,keyboard:!0},$get:["$injector","$rootScope","$q","$http","$templateCache","$controller","$modalStack",function(l,u,c,d,p,h,f){var e={};return e.open=function(o){var a=c.defer(),e=c.defer(),s={result:a.promise,opened:e.promise,close:function(e){f.close(s,e)},dismiss:function(e){f.dismiss(s,e)}};if((o=angular.extend({},g.options,o)).resolve=o.resolve||{},!o.template&&!o.templateUrl)throw new Error("One of template or templateUrl options is required.");var t,n,r,i=c.all([(r=o,r.template?c.when(r.template):d.get(angular.isFunction(r.templateUrl)?r.templateUrl():r.templateUrl,{cache:p}).then(function(e){return e.data}))].concat((t=o.resolve,n=[],angular.forEach(t,function(e){(angular.isFunction(e)||angular.isArray(e))&&n.push(c.when(l.invoke(e)))}),n)));return i.then(function(n){var e=(o.scope||u).$new();e.$close=s.close,e.$dismiss=s.dismiss;var t,r={},i=1;o.controller&&(r.$scope=e,r.$modalInstance=s,angular.forEach(o.resolve,function(e,t){r[t]=n[i++]}),t=h(o.controller,r),o.controllerAs&&(e[o.controllerAs]=t)),f.open(s,{scope:e,deferred:a,content:n[0],backdrop:o.backdrop,keyboard:o.keyboard,backdropClass:o.backdropClass,windowClass:o.windowClass,windowTemplateUrl:o.windowTemplateUrl,size:o.size})},function(e){a.reject(e)}),i.then(function(){e.resolve(!0)},function(){e.reject(!1)}),s},e}]};return g}),angular.module("ui.bootstrap.pagination",[]).controller("PaginationController",["$scope","$attrs","$parse",function(n,r,i){var o=this,a={$setViewValue:angular.noop},t=r.numPages?i(r.numPages).assign:angular.noop;this.init=function(e,t){a=e,this.config=t,a.$render=function(){o.render()},r.itemsPerPage?n.$parent.$watch(i(r.itemsPerPage),function(e){o.itemsPerPage=parseInt(e,10),n.totalPages=o.calculateTotalPages()}):this.itemsPerPage=t.itemsPerPage},this.calculateTotalPages=function(){var e=this.itemsPerPage<1?1:Math.ceil(n.totalItems/this.itemsPerPage);return Math.max(e||0,1)},this.render=function(){n.page=parseInt(a.$viewValue,10)||1},n.selectPage=function(e){n.page!==e&&0e?n.selectPage(e):a.$render()})}]).constant("paginationConfig",{itemsPerPage:10,boundaryLinks:!1,directionLinks:!0,firstText:"First",previousText:"Previous",nextText:"Next",lastText:"Last",rotate:!0}).directive("pagination",["$parse","paginationConfig",function(s,l){return{restrict:"EA",scope:{totalItems:"=",firstText:"@",previousText:"@",nextText:"@",lastText:"@"},require:["pagination","?ngModel"],controller:"PaginationController",templateUrl:"template/pagination/pagination.html",replace:!0,link:function(e,t,n,r){function c(e,t,n){return{number:e,text:t,active:n}}var i=r[0],o=r[1];if(o){var d=angular.isDefined(n.maxSize)?e.$parent.$eval(n.maxSize):l.maxSize,p=angular.isDefined(n.rotate)?e.$parent.$eval(n.rotate):l.rotate;e.boundaryLinks=angular.isDefined(n.boundaryLinks)?e.$parent.$eval(n.boundaryLinks):l.boundaryLinks,e.directionLinks=angular.isDefined(n.directionLinks)?e.$parent.$eval(n.directionLinks):l.directionLinks,i.init(o,l),n.maxSize&&e.$parent.$watch(s(n.maxSize),function(e){d=parseInt(e,10),i.render()});var a=i.render;i.render=function(){a(),0';return{restrict:"EA",compile:function(){var _=o(i);return function(r,t,i){function e(){m.isOpen?o():n()}function n(){var e,t,n;(!g||r.$eval(i[S+"Enable"]))&&(n=i[S+"Placement"],m.placement=angular.isDefined(n)?n:D.placement,e=i[S+"PopupDelay"],t=parseInt(e,10),m.popupDelay=isNaN(t)?D.popupDelay:t,m.popupDelay?p||(p=x(a,m.popupDelay,!1)).then(function(e){e()}):a()())}function o(){r.$apply(function(){s()})}function a(){return p=null,d&&(x.cancel(d),d=null),m.content?(u&&l(),c=m.$new(),(u=_(c,function(e){h?O.find("body").append(e):t.after(e)})).css({top:0,left:0,display:"block"}),m.$digest(),v(),m.isOpen=!0,m.$digest(),v):angular.noop}function s(){m.isOpen=!1,x.cancel(p),p=null,m.animation?d||(d=x(l,500)):l()}function l(){d=null,u&&(u.remove(),u=null),c&&(c.$destroy(),c=null)}var u,c,d,p,h=!!angular.isDefined(D.appendToBody)&&D.appendToBody,f=k(void 0),g=angular.isDefined(i[S+"Enable"]),m=r.$new(!0),v=function(){var e=T.positionElements(t,u,m.placement,h);e.top+="px",e.left+="px",u.css(e)};m.isOpen=!1,i.$observe(C,function(e){!(m.content=e)&&m.isOpen&&s()}),i.$observe(S+"Title",function(e){m.title=e});var y,w=function(){t.unbind(f.show,n),t.unbind(f.hide,o)};y=i[S+"Trigger"],w(),(f=k(y)).show===f.hide?t.bind(f.show,e):(t.bind(f.show,n),t.bind(f.hide,o));var b=r.$eval(i[S+"Animation"]);m.animation=angular.isDefined(b)?!!b:D.animation;var $=r.$eval(i[S+"AppendToBody"]);(h=angular.isDefined($)?$:h)&&r.$on("$locationChangeSuccess",function(){m.isOpen&&s()}),r.$on("$destroy",function(){x.cancel(d),x.cancel(p),w(),l(),m=null})}}}}}]}).directive("tooltipPopup",function(){return{restrict:"EA",replace:!0,scope:{content:"@",placement:"@",animation:"&",isOpen:"&"},templateUrl:"template/tooltip/tooltip-popup.html"}}).directive("tooltip",["$tooltip",function(e){return e("tooltip","tooltip","mouseenter")}]).directive("tooltipHtmlUnsafePopup",function(){return{restrict:"EA",replace:!0,scope:{content:"@",placement:"@",animation:"&",isOpen:"&"},templateUrl:"template/tooltip/tooltip-html-unsafe-popup.html"}}).directive("tooltipHtmlUnsafe",["$tooltip",function(e){return e("tooltipHtmlUnsafe","tooltip","mouseenter")}]),angular.module("ui.bootstrap.popover",["ui.bootstrap.tooltip"]).directive("popoverPopup",function(){return{restrict:"EA",replace:!0,scope:{title:"@",content:"@",placement:"@",animation:"&",isOpen:"&"},templateUrl:"template/popover/popover.html"}}).directive("popover",["$tooltip",function(e){return e("popover","popover","click")}]),angular.module("ui.bootstrap.progressbar",[]).constant("progressConfig",{animate:!0,max:100}).controller("ProgressController",["$scope","$attrs","progressConfig",function(n,e,t){var r=this,i=angular.isDefined(e.animate)?n.$parent.$eval(e.animate):t.animate;this.bars=[],n.max=angular.isDefined(e.max)?n.$parent.$eval(e.max):t.max,this.addBar=function(t,e){i||e.css({transition:"none"}),this.bars.push(t),t.$watch("value",function(e){t.percent=+(100*e/n.max).toFixed(2)}),t.$on("$destroy",function(){e=null,r.removeBar(t)})},this.removeBar=function(e){this.bars.splice(this.bars.indexOf(e),1)}}]).directive("progress",function(){return{restrict:"EA",replace:!0,transclude:!0,controller:"ProgressController",require:"progress",scope:{},templateUrl:"template/progressbar/progress.html"}}).directive("bar",function(){return{restrict:"EA",replace:!0,transclude:!0,require:"^progress",scope:{value:"=",type:"@"},templateUrl:"template/progressbar/bar.html",link:function(e,t,n,r){r.addBar(e,t)}}}).directive("progressbar",function(){return{restrict:"EA",replace:!0,transclude:!0,controller:"ProgressController",scope:{value:"=",type:"@"},templateUrl:"template/progressbar/progressbar.html",link:function(e,t,n,r){r.addBar(e,angular.element(t.children()[0]))}}}),angular.module("ui.bootstrap.rating",[]).constant("ratingConfig",{max:5,stateOn:null,stateOff:null}).controller("RatingController",["$scope","$attrs","ratingConfig",function(n,r,i){var o={$setViewValue:angular.noop};this.init=function(e){(o=e).$render=this.render,this.stateOn=angular.isDefined(r.stateOn)?n.$parent.$eval(r.stateOn):i.stateOn,this.stateOff=angular.isDefined(r.stateOff)?n.$parent.$eval(r.stateOff):i.stateOff;var t=angular.isDefined(r.ratingStates)?n.$parent.$eval(r.ratingStates):new Array(angular.isDefined(r.max)?n.$parent.$eval(r.max):i.max);n.range=this.buildTemplateObjects(t)},this.buildTemplateObjects=function(e){for(var t=0,n=e.length;t");v.attr({id:t,matches:"matches",active:"activeIdx",select:"select(activeIdx)",query:"query",position:"position"}),angular.isDefined(e.typeaheadTemplateUrl)&&v.attr("template-url",e.typeaheadTemplateUrl);var y=function(){m.matches=[],m.activeIdx=-1,a.attr("aria-expanded",!1)},w=function(e){return t+"-option-"+e};m.$watch("activeIdx",function(e){e<0?a.removeAttr("aria-activedescendant"):a.attr("aria-activedescendant",w(e))});var b=function(r){var i={$viewValue:r};u(o,!0),x.when(g.source(o,i)).then(function(e){var t=r===s.$viewValue;if(t&&l)if(0=n?0$&"):e}}),angular.module("template/accordion/accordion-group.html",[]).run(["$templateCache",function(e){e.put("template/accordion/accordion-group.html",'
    \n
    \n

    \n {{heading}}\n

    \n
    \n
    \n\t
    \n
    \n
    \n')}]),angular.module("template/accordion/accordion.html",[]).run(["$templateCache",function(e){e.put("template/accordion/accordion.html",'
    ')}]),angular.module("template/alert/alert.html",[]).run(["$templateCache",function(e){e.put("template/alert/alert.html",'\n')}]),angular.module("template/carousel/carousel.html",[]).run(["$templateCache",function(e){e.put("template/carousel/carousel.html",'\n')}]),angular.module("template/carousel/slide.html",[]).run(["$templateCache",function(e){e.put("template/carousel/slide.html","
    \n")}]),angular.module("template/datepicker/datepicker.html",[]).run(["$templateCache",function(e){e.put("template/datepicker/datepicker.html",'
    \n \n \n \n
    ')}]),angular.module("template/datepicker/day.html",[]).run(["$templateCache",function(e){e.put("template/datepicker/day.html",'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    {{label.abbr}}
    {{ weekNumbers[$index] }}\n \n
    \n')}]),angular.module("template/datepicker/month.html",[]).run(["$templateCache",function(e){e.put("template/datepicker/month.html",'\n \n \n \n \n \n \n \n \n \n \n \n \n
    \n \n
    \n')}]),angular.module("template/datepicker/popup.html",[]).run(["$templateCache",function(e){e.put("template/datepicker/popup.html",'\n')}]),angular.module("template/datepicker/year.html",[]).run(["$templateCache",function(e){e.put("template/datepicker/year.html",'\n \n \n \n \n \n \n \n \n \n \n \n \n
    \n \n
    \n')}]),angular.module("template/modal/backdrop.html",[]).run(["$templateCache",function(e){e.put("template/modal/backdrop.html",'\n')}]),angular.module("template/modal/window.html",[]).run(["$templateCache",function(e){e.put("template/modal/window.html",'')}]),angular.module("template/pagination/pager.html",[]).run(["$templateCache",function(e){e.put("template/pagination/pager.html",'')}]),angular.module("template/pagination/pagination.html",[]).run(["$templateCache",function(e){e.put("template/pagination/pagination.html",'')}]),angular.module("template/tooltip/tooltip-html-unsafe-popup.html",[]).run(["$templateCache",function(e){e.put("template/tooltip/tooltip-html-unsafe-popup.html",'
    \n
    \n
    \n
    \n')}]),angular.module("template/tooltip/tooltip-popup.html",[]).run(["$templateCache",function(e){e.put("template/tooltip/tooltip-popup.html",'
    \n
    \n
    \n
    \n')}]),angular.module("template/popover/popover.html",[]).run(["$templateCache",function(e){e.put("template/popover/popover.html",'
    \n
    \n\n
    \n

    \n
    \n
    \n
    \n')}]),angular.module("template/progressbar/bar.html",[]).run(["$templateCache",function(e){e.put("template/progressbar/bar.html",'
    ')}]),angular.module("template/progressbar/progress.html",[]).run(["$templateCache",function(e){e.put("template/progressbar/progress.html",'
    ')}]),angular.module("template/progressbar/progressbar.html",[]).run(["$templateCache",function(e){e.put("template/progressbar/progressbar.html",'
    \n
    \n
    ')}]),angular.module("template/rating/rating.html",[]).run(["$templateCache",function(e){e.put("template/rating/rating.html",'\n \n ({{ $index < value ? \'*\' : \' \' }})\n \n')}]),angular.module("template/tabs/tab.html",[]).run(["$templateCache",function(e){e.put("template/tabs/tab.html",'
  • \n {{heading}}\n
  • \n')}]),angular.module("template/tabs/tabset.html",[]).run(["$templateCache",function(e){e.put("template/tabs/tabset.html",'
    \n \n
    \n
    \n
    \n
    \n
    \n')}]),angular.module("template/timepicker/timepicker.html",[]).run(["$templateCache",function(e){e.put("template/timepicker/timepicker.html",'\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n
     
    \n\t\t\t\t\n\t\t\t:\n\t\t\t\t\n\t\t\t
     
    \n')}]),angular.module("template/typeahead/typeahead-match.html",[]).run(["$templateCache",function(e){e.put("template/typeahead/typeahead-match.html",'')}]),angular.module("template/typeahead/typeahead-popup.html",[]).run(["$templateCache",function(e){e.put("template/typeahead/typeahead-popup.html",'\n')}]),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var e,i;function p(){return e.apply(null,arguments)}function s(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function l(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function u(e){return void 0===e}function c(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function d(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function h(e,t){var n,r=[];for(n=0;n>>0,r=0;rCe(e)?(o=e+1,s-Ce(e)):(o=e,s),{year:o,dayOfYear:a}}function Ne(e,t,n){var r,i,o=He(e.year(),t,n),a=Math.floor((e.dayOfYear()-o-1)/7)+1;return a<1?r=a+qe(i=e.year()-1,t,n):a>qe(e.year(),t,n)?(r=a-qe(e.year(),t,n),i=e.year()+1):(i=e.year(),r=a),{week:r,year:i}}function qe(e,t,n){var r=He(e,t,n),i=He(e+1,t,n);return(Ce(e)-r+i)/7}N("w",["ww",2],"wo","week"),N("W",["WW",2],"Wo","isoWeek"),P("week","w"),P("isoWeek","W"),V("week",5),V("isoWeek",5),le("w",Q),le("ww",Q,B),le("W",Q),le("WW",Q,B),he(["w","ww","W","WW"],function(e,t,n,r){t[r.substr(0,1)]=S(e)});N("d",0,"do","day"),N("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),N("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),N("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),N("e",0,0,"weekday"),N("E",0,0,"isoWeekday"),P("day","d"),P("weekday","e"),P("isoWeekday","E"),V("day",11),V("weekday",11),V("isoWeekday",11),le("d",Q),le("e",Q),le("E",Q),le("dd",function(e,t){return t.weekdaysMinRegex(e)}),le("ddd",function(e,t){return t.weekdaysShortRegex(e)}),le("dddd",function(e,t){return t.weekdaysRegex(e)}),he(["dd","ddd","dddd"],function(e,t,n,r){var i=n._locale.weekdaysParse(e,r,n._strict);null!=i?t.d=i:v(n).invalidWeekday=e}),he(["d","e","E"],function(e,t,n,r){t[r]=S(e)});var Ue="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var ze="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var Be="Su_Mo_Tu_We_Th_Fr_Sa".split("_");var We=ae;var Ge=ae;var Ke=ae;function Qe(){function e(e,t){return t.length-e.length}var t,n,r,i,o,a=[],s=[],l=[],u=[];for(t=0;t<7;t++)n=m([2e3,1]).day(t),r=this.weekdaysMin(n,""),i=this.weekdaysShort(n,""),o=this.weekdays(n,""),a.push(r),s.push(i),l.push(o),u.push(r),u.push(i),u.push(o);for(a.sort(e),s.sort(e),l.sort(e),u.sort(e),t=0;t<7;t++)s[t]=ce(s[t]),l[t]=ce(l[t]),u[t]=ce(u[t]);this._weekdaysRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i")}function Ze(){return this.hours()%12||12}function Xe(e,t){N(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function Je(e,t){return t._meridiemParse}N("H",["HH",2],0,"hour"),N("h",["hh",2],0,Ze),N("k",["kk",2],0,function(){return this.hours()||24}),N("hmm",0,0,function(){return""+Ze.apply(this)+F(this.minutes(),2)}),N("hmmss",0,0,function(){return""+Ze.apply(this)+F(this.minutes(),2)+F(this.seconds(),2)}),N("Hmm",0,0,function(){return""+this.hours()+F(this.minutes(),2)}),N("Hmmss",0,0,function(){return""+this.hours()+F(this.minutes(),2)+F(this.seconds(),2)}),Xe("a",!0),Xe("A",!1),P("hour","h"),V("hour",13),le("a",Je),le("A",Je),le("H",Q),le("h",Q),le("k",Q),le("HH",Q,B),le("hh",Q,B),le("kk",Q,B),le("hmm",Z),le("hmmss",X),le("Hmm",Z),le("Hmmss",X),pe(["H","HH"],ve),pe(["k","kk"],function(e,t,n){var r=S(e);t[ve]=24===r?0:r}),pe(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),pe(["h","hh"],function(e,t,n){t[ve]=S(e),v(n).bigHour=!0}),pe("hmm",function(e,t,n){var r=e.length-2;t[ve]=S(e.substr(0,r)),t[ye]=S(e.substr(r)),v(n).bigHour=!0}),pe("hmmss",function(e,t,n){var r=e.length-4,i=e.length-2;t[ve]=S(e.substr(0,r)),t[ye]=S(e.substr(r,2)),t[we]=S(e.substr(i)),v(n).bigHour=!0}),pe("Hmm",function(e,t,n){var r=e.length-2;t[ve]=S(e.substr(0,r)),t[ye]=S(e.substr(r))}),pe("Hmmss",function(e,t,n){var r=e.length-4,i=e.length-2;t[ve]=S(e.substr(0,r)),t[ye]=S(e.substr(r,2)),t[we]=S(e.substr(i))});var et,tt=xe("Hours",!0),nt={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Pe,monthsShort:Me,week:{dow:0,doy:6},weekdays:Ue,weekdaysMin:Be,weekdaysShort:ze,meridiemParse:/[ap]\.?m?\.?/i},rt={},it={};function ot(e){return e?e.toLowerCase().replace("_","-"):e}function at(e){var t=null;if(!rt[e]&&"undefined"!=typeof module&&module&&module.exports)try{t=et._abbr,require("./locale/"+e),st(t)}catch(e){}return rt[e]}function st(e,t){var n;return e&&((n=u(t)?ut(e):lt(e,t))?et=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),et._abbr}function lt(e,t){if(null===t)return delete rt[e],null;var n,r=nt;if(t.abbr=e,null!=rt[e])x("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),r=rt[e]._config;else if(null!=t.parentLocale)if(null!=rt[t.parentLocale])r=rt[t.parentLocale]._config;else{if(null==(n=at(t.parentLocale)))return it[t.parentLocale]||(it[t.parentLocale]=[]),it[t.parentLocale].push({name:e,config:t}),null;r=n._config}return rt[e]=new E(T(r,t)),it[e]&&it[e].forEach(function(e){lt(e.name,e.config)}),st(e),rt[e]}function ut(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return et;if(!s(e)){if(t=at(e))return t;e=[e]}return function(e){for(var t,n,r,i,o=0;o=t&&a(i,n,!0)>=t-1)break;t--}o++}return et}(e)}function ct(e){var t,n=e._a;return n&&-2===v(e).overflow&&(t=n[ge]<0||11Ee(n[fe],n[ge])?me:n[ve]<0||24qe(n,o,a)?v(e)._overflowWeeks=!0:null!=l?v(e)._overflowWeekday=!0:(s=Ye(n,r,i,o,a),e._a[fe]=s.year,e._dayOfYear=s.dayOfYear)}(e),null!=e._dayOfYear&&(o=dt(e._a[fe],r[fe]),(e._dayOfYear>Ce(o)||0===e._dayOfYear)&&(v(e)._overflowDayOfYear=!0),n=je(o,0,e._dayOfYear),e._a[ge]=n.getUTCMonth(),e._a[me]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=a[t]=r[t];for(;t<7;t++)e._a[t]=a[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[ve]&&0===e._a[ye]&&0===e._a[we]&&0===e._a[be]&&(e._nextDay=!0,e._a[ve]=0),e._d=(e._useUTC?je:function(e,t,n,r,i,o,a){var s=new Date(e,t,n,r,i,o,a);return e<100&&0<=e&&isFinite(s.getFullYear())&&s.setFullYear(e),s}).apply(null,a),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[ve]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(v(e).weekdayMismatch=!0)}}var ht=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ft=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,gt=/Z|[+-]\d\d(?::?\d\d)?/,mt=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],vt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],yt=/^\/?Date\((\-?\d+)/i;function wt(e){var t,n,r,i,o,a,s=e._i,l=ht.exec(s)||ft.exec(s);if(l){for(v(e).iso=!0,t=0,n=mt.length;tn.valueOf():n.valueOf()this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},un.isLocal=function(){return!!this.isValid()&&!this._isUTC},un.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},un.isUtc=Ht,un.isUTC=Ht,un.zoneAbbr=function(){return this._isUTC?"UTC":""},un.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},un.dates=n("dates accessor is deprecated. Use date instead.",nn),un.months=n("months accessor is deprecated. Use month instead",Ie),un.years=n("years accessor is deprecated. Use year instead",De),un.zone=n("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),un.isDSTShifted=n("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!u(this._isDSTShifted))return this._isDSTShifted;var e={};if(b(e,this),(e=kt(e))._a){var t=e._isUTC?m(e._a):xt(e._a);this._isDSTShifted=this.isValid()&&0-1/0&&t.selectable&&c[e]){var r=c[e](t.utcDateValue),i=[];if(r.weeks)for(var o=0;on+9,past:u.year()r.indexOf(e.startView))throw new Error("startView must be greater than minView");if(!a.isNumber(e.minuteStep))throw new Error("minuteStep must be numeric");if(e.minuteStep<=0||60<=e.minuteStep)throw new Error("minuteStep must be greater than zero and less than 60");if(null!==e.configureOn&&!a.isString(e.configureOn))throw new Error("configureOn must be a string");if(null!==e.configureOn&&e.configureOn.length<1)throw new Error("configureOn must not be an empty string");if(null!==e.renderOn&&!a.isString(e.renderOn))throw new Error("renderOn must be a string");if(null!==e.renderOn&&e.renderOn.length<1)throw new Error("renderOn must not be an empty string");if(null!==e.modelType&&!a.isString(e.modelType))throw new Error("modelType must be a string");if(null!==e.modelType&&e.modelType.length<1)throw new Error("modelType must not be an empty string");"Date"!==e.modelType&&"moment"!==e.modelType&&"milliseconds"!==e.modelType&&(e.parseFormat=e.modelType);if(null!==e.dropdownSelector&&!a.isString(e.dropdownSelector))throw new Error("dropdownSelector must be a string");null===e.dropdownSelector||"undefined"!=typeof jQuery&&"function"==typeof jQuery().dropdown||(i.error("Please DO NOT specify the dropdownSelector option unless you are using jQuery AND Bootstrap.js. Please include jQuery AND Bootstrap.js, or write code to close the dropdown in the on-set-time callback. \n\nThe dropdownSelector configuration option is being removed because it will not function properly."),delete e.dropdownSelector)}}}a.module("ui.bootstrap.datetimepicker",[]).service("dateTimePickerConfig",function(){var e={bg:{previous:"предишна",next:"следваща"},ca:{previous:"anterior",next:"següent"},da:{previous:"forrige",next:"næste"},de:{previous:"vorige",next:"weiter"},"en-au":{previous:"previous",next:"next"},"en-gb":{previous:"previous",next:"next"},en:{previous:"previous",next:"next"},"es-us":{previous:"atrás",next:"siguiente"},es:{previous:"atrás",next:"siguiente"},fi:{previous:"edellinen",next:"seuraava"},fr:{previous:"précédent",next:"suivant"},hu:{previous:"előző",next:"következő"},it:{previous:"precedente",next:"successivo"},ja:{previous:"前へ",next:"次へ"},ml:{previous:"മുൻപുള്ളത്",next:"അടുത്തത്"},nl:{previous:"vorige",next:"volgende"},pl:{previous:"poprzednia",next:"następna"},"pt-br":{previous:"anteriores",next:"próximos"},pt:{previous:"anterior",next:"próximo"},ro:{previous:"anterior",next:"următor"},ru:{previous:"предыдущая",next:"следующая"},sk:{previous:"predošlá",next:"ďalšia"},sv:{previous:"föregående",next:"nästa"},tr:{previous:"önceki",next:"sonraki"},uk:{previous:"назад",next:"далі"},"zh-cn":{previous:"上一页",next:"下一页"},"zh-tw":{previous:"上一頁",next:"下一頁"}}[b.locale().toLowerCase()];return a.extend({},{configureOn:null,dropdownSelector:null,minuteStep:5,minView:"minute",modelType:"Date",parseFormat:"YYYY-MM-DDTHH:mm:ss.SSSZZ",renderOn:null,startView:"day"},{screenReader:e})}).service("dateTimePickerValidator",t).directive("datetimepicker",e),e.$inject=["dateTimePickerConfig","dateTimePickerValidator"],t.$inject=["$log"]}),angular.module("rzTable",[]),angular.module("rzTable").directive("rzTable",["resizeStorage","$injector","$parse",function(g,i,u){function e(e){}function c(n,r,i){return function(e,t){!0!==i.busy&&void 0!==t&&t!==e&&(d(n),p(n,r,i))}}function d(e){k=!0,l.map(function(e){e.remove()}),l=[]}function p(e,t,n){if(!n.busy){b=$(e).find("th"),v=n.mode,y=!angular.isDefined(n.saveTableSizes)||n.saveTableSizes,w=n.profile;var r=function(t,e){try{var n=e.rzMode?t.mode:"BasicResizer",r=i.get(n);return r}catch(e){return console.error("The resizer "+t.mode+" was not found"),null}}(n,t);r&&(S=new r(e,b,h),y&&(D=g.loadTableSizes(e,n.mode,n.profile)),s=S.handles(b),a=S.ctrlColumns,S.setup(),(o=D)&&($(C).width("auto"),a.each(function(e,t){var n=angular.element(t).scope(),r=n.rzCol||$(t).attr("id"),i=o[r];$(t).css({width:i})}),S.onTableReady()),s.each(function(e,t){!function(e,t,n){var r=$("
    ",{class:e.options.handleClass||"rz-handle"});$(n).prepend(r),l.push(r);var i=S.handleMiddleware(r,n);p=e,h=r,f=i,$(h).mousedown(function(e){k&&(S.onFirstDrag(f,h),S.onTableReady(),k=!1),p.options.onResizeStarted&&p.options.onResizeStarted(f);var t={};S.intervene&&(((t=S.intervene.selector(f)).column=t).orgWidth=$(t).width()),e.preventDefault(),$(h).addClass(p.options.handleClassActive||"rz-handle-active");var n,r,i,o,a,s,l,u,c=e.clientX,d=$(f).width();o=p,a=f,s=c,l=d,u=t,_=function(e){var t=e.clientX,n=t-s,r=S.calculate(l,n);if(!(rt)||(this.fixedColumn.width()<=this.getMinWidth(this.fixedColumn)?(this.bound=t,$(this.fixedColumn).width(this.minWidth),!0):void 0)},e.prototype.onEndDrag=function(){this.bound=!1},e.prototype.calculate=function(e,t){return e-t},e}]),angular.module("rzTable").factory("OverflowResizer",["ResizerModel",function(r){function e(e,t,n){r.call(this,e,t,n)}return(e.prototype=Object.create(r.prototype)).setup=function(){$(this.container).css({overflow:"auto"})},e.prototype.onTableReady=function(){$(this.table).width(1)},e}]),function(e,t){"function"==typeof define&&define.amd?define(["angular"],t):"object"==typeof module&&module.exports?module.exports=t(require("angular")):e.angularClipboard=t(e.angular)}(this,function(i){return i.module("angular-clipboard",[]).factory("clipboard",["$document","$window",function(s,l){return{copyText:function(e,t){var n,r,i=l.pageXOffset||s[0].documentElement.scrollLeft,o=l.pageYOffset||s[0].documentElement.scrollTop,a=(n=e,(r=s[0].createElement("textarea")).style.position="absolute",r.style.fontSize="12pt",r.style.border="0",r.style.padding="0",r.style.margin="0",r.style.left="-10000px",r.style.top=(l.pageYOffset||s[0].documentElement.scrollTop)+"px",r.textContent=n,r);s[0].body.appendChild(a),function(e){try{s[0].body.style.webkitUserSelect="initial";var t=s[0].getSelection();t.removeAllRanges();var n=document.createRange();n.selectNodeContents(e),t.addRange(n),e.select(),e.setSelectionRange(0,999999);try{if(!s[0].execCommand("copy"))throw"failure copy"}finally{t.removeAllRanges()}}finally{s[0].body.style.webkitUserSelect=""}}(a),l.scrollTo(i,o),s[0].body.removeChild(a)},supported:"queryCommandSupported"in s[0]&&s[0].queryCommandSupported("copy")}}]).directive("clipboard",["clipboard",function(r){return{restrict:"A",scope:{onCopied:"&",onError:"&",text:"=",supported:"=?"},link:function(t,n){t.supported=r.supported,n.on("click",function(e){try{r.copyText(t.text,n[0]),i.isFunction(t.onCopied)&&t.$evalAsync(t.onCopied())}catch(e){i.isFunction(t.onError)&&t.$evalAsync(t.onError({err:e}))}})}}}])}),function(e,t){"function"==typeof define&&define.amd?define("sifter",t):"object"==typeof exports?module.exports=t():e.Sifter=t()}(this,function(){var e=function(e,t){this.items=e,this.settings=t||{diacritics:!0}};e.prototype.tokenize=function(e){if(!(e=s(String(e||"").toLowerCase()))||!e.length)return[];var t,n,r,i,o=[],a=e.split(/ +/);for(t=0,n=a.length;t/g,">").replace(/"/g,""")},t={before:function(e,t,n){var r=e[t];e[t]=function(){return n.apply(e,arguments),r.apply(e,arguments)}},after:function(t,e,n){var r=t[e];t[e]=function(){var e=r.apply(t,arguments);return n.apply(t,arguments),e}}},n=function(t,n,e){var r,i=t.trigger,o={};for(r in t.trigger=function(){var e=arguments[0];if(-1===n.indexOf(e))return i.apply(t,arguments);o[e]=arguments},e.apply(t,[]),t.trigger=i,o)o.hasOwnProperty(r)&&i.apply(t,o[r])},f=function(e){var t={};if("selectionStart"in e)t.start=e.selectionStart,t.length=e.selectionEnd-t.start;else if(document.selection){e.focus();var n=document.selection.createRange(),r=document.selection.createRange().text.length;n.moveStart("character",-e.value.length),t.start=n.text.length-r,t.length=r}return t},O=function(p){var h=null,e=function(e,t){var n,r,i,o,a,s,l,u,c,d;(t=t||{},(e=e||window.event||{}).metaKey||e.altKey)||(t.force||!1!==p.data("grow"))&&(n=p.val(),e.type&&"keydown"===e.type.toLowerCase()&&(i=48<=(r=e.keyCode)&&r<=57||65<=r&&r<=90||96<=r&&r<=111||186<=r&&r<=222||32===r,46===r||8===r?(u=f(p[0])).length?n=n.substring(0,u.start)+n.substring(u.start+u.length):8===r&&u.start?n=n.substring(0,u.start-1)+n.substring(u.start+1):46===r&&void 0!==u.start&&(n=n.substring(0,u.start)+n.substring(u.start+1)):i&&(s=e.shiftKey,l=String.fromCharCode(e.keyCode),n+=l=s?l.toUpperCase():l.toLowerCase())),o=p.attr("placeholder"),!n&&o&&(n=o),d=p,(a=((c=n)?(w.$testInput||(w.$testInput=S("").css({position:"absolute",top:-99999,left:-99999,width:"auto",padding:0,whiteSpace:"pre"}).appendTo("body")),w.$testInput.text(c),function(e,t,n){var r,i,o={};if(n)for(r=0,i=n.length;r").addClass(g.wrapperClass).addClass(s).addClass(a),t=S("
    ").addClass(g.inputClass).addClass("items").appendTo(e),n=S('').appendTo(t).attr("tabindex",w.is(":disabled")?"-1":f.tabIndex),o=S(g.dropdownParent||e),r=S("
    ").addClass(g.dropdownClass).addClass(a).hide().appendTo(o),i=S("
    ").addClass(g.dropdownContentClass).appendTo(r),(u=w.attr("id"))&&(n.attr("id",u+"-selectized"),S("label[for='"+u+"']").attr("for",u+"-selectized")),f.settings.copyClassesToDropdown&&r.addClass(s),e.css({width:w[0].style.width}),f.plugins.names.length&&(l="plugin-"+f.plugins.names.join(" plugin-"),e.addClass(l),r.addClass(l)),(null===g.maxItems||1[data-selectable]",function(e){e.stopImmediatePropagation()}),r.on("mouseenter","[data-selectable]",function(){return f.onOptionHover.apply(f,arguments)}),r.on("mousedown click","[data-selectable]",function(){return f.onOptionSelect.apply(f,arguments)}),d="mousedown",p="*:not(input)",h=function(){return f.onItemSelect.apply(f,arguments)},(c=t).on(d,p,function(e){for(var t=e.target;t&&t.parentNode!==c[0];)t=t.parentNode;return e.currentTarget=t,h.apply(this,[e])}),O(n),t.on({mousedown:function(){return f.onMouseDown.apply(f,arguments)},click:function(){return f.onClick.apply(f,arguments)}}),n.on({mousedown:function(e){e.stopPropagation()},keydown:function(){return f.onKeyDown.apply(f,arguments)},keyup:function(){return f.onKeyUp.apply(f,arguments)},keypress:function(){return f.onKeyPress.apply(f,arguments)},resize:function(){f.positionDropdown.apply(f,[])},blur:function(){return f.onBlur.apply(f,arguments)},focus:function(){return f.ignoreBlur=!1,f.onFocus.apply(f,arguments)},paste:function(){return f.onPaste.apply(f,arguments)}}),y.on("keydown"+m,function(e){f.isCmdDown=e[$?"metaKey":"ctrlKey"],f.isCtrlDown=e[$?"altKey":"ctrlKey"],f.isShiftDown=e.shiftKey}),y.on("keyup"+m,function(e){e.keyCode===C&&(f.isCtrlDown=!1),16===e.keyCode&&(f.isShiftDown=!1),e.keyCode===_&&(f.isCmdDown=!1)}),y.on("mousedown"+m,function(e){if(f.isFocused){if(e.target===f.$dropdown[0]||e.target.parentNode===f.$dropdown[0])return!1;f.$control.has(e.target).length||e.target===f.$control[0]||f.blur(e.target)}}),v.on(["scroll"+m,"resize"+m].join(" "),function(){f.isOpen&&f.positionDropdown.apply(f,arguments)}),v.on("mousemove"+m,function(){f.ignoreHover=!1}),this.revertSettings={$children:w.children().detach(),tabindex:w.attr("tabindex")},w.attr("tabindex",-1).hide().after(f.$wrapper),S.isArray(g.items)&&(f.setValue(g.items),delete g.items),D&&w.on("invalid"+m,function(e){e.preventDefault(),f.isInvalid=!0,f.refreshState()}),f.updateOriginalInput(),f.refreshItems(),f.refreshState(),f.updatePlaceholder(),f.isSetup=!0,w.is(":disabled")&&f.disable(),f.on("change",this.onChange),w.data("selectize",f),w.addClass("selectized"),f.trigger("initialize"),!0===g.preload&&f.onSearchChange("")},setupTemplates:function(){var n=this.settings.labelField,r=this.settings.optgroupLabelField,e={optgroup:function(e){return'
    '+e.html+"
    "},optgroup_header:function(e,t){return'
    '+t(e[r])+"
    "},option:function(e,t){return'
    '+t(e[n])+"
    "},item:function(e,t){return'
    '+t(e[n])+"
    "},option_create:function(e,t){return'
    Add '+t(e.input)+"
    "}};this.settings.render=S.extend({},e,this.settings.render)},setupCallbacks:function(){var e,t,n={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(e in n)n.hasOwnProperty(e)&&(t=this.settings[n[e]])&&this.on(e,t)},onClick:function(e){this.isFocused&&this.isOpen||(this.focus(),e.preventDefault())},onMouseDown:function(e){var t=this,n=e.isDefaultPrevented();S(e.target);if(t.isFocused){if(e.target!==t.$control_input[0])return"single"===t.settings.mode?t.isOpen?t.close():t.open():n||t.setActiveItem(null),!1}else n||window.setTimeout(function(){t.focus()},0)},onChange:function(){this.$input.trigger("change")},onPaste:function(e){var i=this;i.isFull()||i.isInputHidden||i.isLocked?e.preventDefault():i.settings.splitOn&&setTimeout(function(){var e=i.$control_input.val();if(e.match(i.settings.splitOn))for(var t=S.trim(e).split(i.settings.splitOn),n=0,r=t.length;n=this.settings.maxItems},updateOriginalInput:function(e){var t,n,r,i,o=this;if(e=e||{},1===o.tagType){for(r=[],t=0,n=o.items.length;t'+s(i)+"");r.length||this.$input.attr("multiple")||r.push(''),o.$input.html(r.join(""))}else o.$input.val(o.getValue()),o.$input.attr("value",o.$input.val());o.isSetup&&(e.silent||o.trigger("change",o.$input.val()))},updatePlaceholder:function(){if(this.settings.placeholder){var e=this.$control_input;this.items.length?e.removeAttr("placeholder"):e.attr("placeholder",this.settings.placeholder),e.triggerHandler("update",{force:!0})}},open:function(){var e=this;e.isLocked||e.isOpen||"multi"===e.settings.mode&&e.isFull()||(e.focus(),e.isOpen=!0,e.refreshState(),e.$dropdown.css({visibility:"hidden",display:"block"}),e.positionDropdown(),e.$dropdown.css({visibility:"visible"}),e.trigger("dropdown_open",e.$dropdown))},close:function(){var e=this,t=e.isOpen;"single"===e.settings.mode&&e.items.length&&(e.hideInput(),e.isBlurring||e.$control_input.blur()),e.isOpen=!1,e.$dropdown.hide(),e.setActiveOption(null),e.refreshState(),t&&e.trigger("dropdown_close",e.$dropdown)},positionDropdown:function(){var e=this.$control,t="body"===this.settings.dropdownParent?e.offset():e.position();t.top+=e.outerHeight(!0),this.$dropdown.css({width:e[0].getBoundingClientRect().width,top:t.top,left:t.left})},clear:function(e){var t=this;t.items.length&&(t.$control.children(":not(input)").remove(),t.items=[],t.lastQuery=null,t.setCaret(0),t.setActiveItem(null),t.updatePlaceholder(),t.updateOriginalInput({silent:e}),t.refreshState(),t.showInput(),t.trigger("clear"))},insertAtCaret:function(e){var t=Math.min(this.caretPos,this.items.length),n=e[0],r=this.buffer||this.$control[0];0===t?r.insertBefore(n,r.firstChild):r.insertBefore(n,r.childNodes[t]),this.setCaret(t+1)},deleteSelection:function(e){var t,n,r,i,o,a,s,l,u,c=this;if(r=e&&8===e.keyCode?-1:1,i=f(c.$control_input[0]),c.$activeOption&&!c.settings.hideSelected&&(s=c.getAdjacentOption(c.$activeOption,-1).attr("data-value")),o=[],c.$activeItems.length){for(u=c.$control.children(".active:"+(0
    '+e.title+'×
    '}},e),n.setup=(t=n.setup,function(){t.apply(n,arguments),n.$dropdown_header=S(e.html(e)),n.$dropdown.prepend(n.$dropdown_header)})}),w.define("optgroup_columns",function(s){var o,l=this;s=S.extend({equalizeWidth:!0,equalizeHeight:!0},s),this.getAdjacentOption=function(e,t){var n=e.closest("[data-group]").find("[data-selectable]"),r=n.index(e)+t;return 0<=r&&r
    ',e=e.firstChild,n.body.appendChild(e),t=u.width=e.offsetWidth-e.clientWidth,n.body.removeChild(e)),t},e=function(){var e,t,n,r,i,o,a;if((t=(a=S("[data-group]",l.$dropdown_content)).length)&&l.$dropdown_content.width()){if(s.equalizeHeight){for(e=n=0;e'+t.label+"",o.setup=(n=r.setup,function(){if(t.append){var i=r.settings.render.item;r.settings.render.item=function(e){return t=i.apply(o,arguments),n=a,r=t.search(/(<\/[^>]+>\s*)$/),t.substring(0,r)+n+t.substring(r);var t,n,r}}n.apply(o,arguments),o.$control.on("click","."+t.className,function(e){if(e.preventDefault(),!r.isLocked){var t=S(e.currentTarget).parent();r.setActiveItem(t),r.deleteSelection()&&r.setCaret(r.items.length)}})})):function(i,t){t.className="remove-single";var n,o=i,a=''+t.label+"";i.setup=(n=o.setup,function(){if(t.append){var e=S(o.$input.context).attr("id"),r=(S("#"+e),o.settings.render.item);o.settings.render.item=function(e){return t=r.apply(i,arguments),n=a,S("").append(t).append(n);var t,n}}n.apply(i,arguments),i.$control.on("click","."+t.className,function(e){e.preventDefault(),o.isLocked||o.clear()})})}(this,e)}),w.define("restore_on_backspace",function(r){var i,e=this;r.text=r.text||function(e){return e[this.settings.labelField]},this.onKeyDown=(i=e.onKeyDown,function(e){var t,n;return 8===e.keyCode&&""===this.$control_input.val()&&!this.$activeItems.length&&0<=(t=this.caretPos-1)&&t",{class:function(){var e=[];return e.push(i.options.state?"on":"off"),i.options.size&&e.push(i.options.size),i.options.disabled&&e.push("disabled"),i.options.readonly&&e.push("readonly"),i.options.indeterminate&&e.push("indeterminate"),i.options.inverse&&e.push("inverse"),i.$element.attr("id")&&e.push("id-"+i.$element.attr("id")),e.map(i._getClass.bind(i)).concat([i.options.baseClass],i._getClasses(i.options.wrapperClass)).join(" ")}}),this.$container=s("
    ",{class:this._getClass("container")}),this.$on=s("",{html:this.options.onText,class:this._getClass("handle-on")+" "+this._getClass(this.options.onColor)}),this.$off=s("",{html:this.options.offText,class:this._getClass("handle-off")+" "+this._getClass(this.options.offColor)}),this.$label=s("",{html:this.options.labelText,class:this._getClass("label")}),this.$element.on("init.bootstrapSwitch",this.options.onInit.bind(this,r)),this.$element.on("switchChange.bootstrapSwitch",function(){for(var e=arguments.length,t=Array(e),n=0;n-n._handleWidth/2;n._dragEnd=!1,n.state(n.options.inverse?!t:t)}else n.state(!n.options.state);n._dragStart=!1}},"mouseleave.bootstrapSwitch":function(){n.$label.trigger("mouseup.bootstrapSwitch")}})}},{key:"_externalLabelHandler",value:function(){var t=this,n=this.$element.closest("label");n.on("click",function(e){e.preventDefault(),e.stopImmediatePropagation(),e.target===n[0]&&t.toggleState()})}},{key:"_formHandler",value:function(){var e=this.$element.closest("form");e.data("bootstrap-switch")||e.on("reset.bootstrapSwitch",function(){window.setTimeout(function(){e.find("input").filter(function(){return s(this).data("bootstrap-switch")}).each(function(){return s(this).bootstrapSwitch("state",this.checked)})},1)}).data("bootstrap-switch",!0)}},{key:"_getClass",value:function(e){return this.options.baseClass+"-"+e}},{key:"_getClasses",value:function(e){return s.isArray(e)?e.map(this._getClass.bind(this)):[this._getClass(e)]}}]),t}();s.fn.bootstrapSwitch=function(o){for(var e=arguments.length,a=Array(1
    ');var r,i=f.overlay?"":" ngdialog-no-overlay";if((d=T('
    ')).html(f.overlay?'
    '+t+"
    ":'
    '+t+"
    "),d.data("$ngDialogOptions",f),c.ngDialogId=u,f.data&&O.isString(f.data)){var o=f.data.replace(/^\s*/,"")[0];c.ngDialogData="{"===o||"["===o?O.fromJson(f.data):new String(f.data),c.ngDialogData.ngDialogId=u}else f.data&&O.isObject(f.data)&&(c.ngDialogData=f.data,c.ngDialogData.ngDialogId=u);(f.className&&d.addClass(f.className),f.appendClassName&&d.addClass(f.appendClassName),f.width&&(h=d[0].querySelector(".ngdialog-content"),O.isString(f.width)?h.style.width=f.width:h.style.width=f.width+"px"),f.height&&(h=d[0].querySelector(".ngdialog-content"),O.isString(f.height)?h.style.height=f.height:h.style.height=f.height+"px"),f.disableAnimation&&d.addClass("ngdialog-disabled-animation"),p=f.appendTo&&O.isString(f.appendTo)?O.element(document.querySelector(f.appendTo)):b.body,$.applyAriaAttributes(d,f),f.preCloseCallback)&&(O.isFunction(f.preCloseCallback)?r=f.preCloseCallback:O.isString(f.preCloseCallback)&&c&&(O.isFunction(c[f.preCloseCallback])?r=c[f.preCloseCallback]:c.$parent&&O.isFunction(c.$parent[f.preCloseCallback])?r=c.$parent[f.preCloseCallback]:m&&O.isFunction(m[f.preCloseCallback])&&(r=m[f.preCloseCallback])),r&&d.data("$ngDialogPreCloseCallback",r));if(c.closeThisDialog=function(e){$.closeDialog(d,e)},f.controller&&(O.isString(f.controller)||O.isArray(f.controller)||O.isFunction(f.controller))){var a;f.controllerAs&&O.isString(f.controllerAs)&&(a=f.controllerAs);var s=w(f.controller,O.extend(n,{$scope:c,$element:d}),!0,a);f.bindToController&&O.extend(s.instance,{ngDialogId:c.ngDialogId,ngDialogData:c.ngDialogData,closeThisDialog:c.closeThisDialog,confirm:c.confirm}),"function"==typeof s?d.data("$ngDialogControllerController",s()):d.data("$ngDialogControllerController",s)}if(v(function(){var e=document.querySelectorAll(".ngdialog");$.deactivateAll(e),g(d)(c);var t=y.innerWidth-b.body.prop("clientWidth");b.html.addClass(f.bodyClassName),b.body.addClass(f.bodyClassName);var n=t-(y.innerWidth-b.body.prop("clientWidth"));0window.innerHeight&&(l=v,t++,e=0);var u=l?0===e?l:l+w:v,c=n+t*(b+s);o.css(o._positionY,u+"px"),"center"==o._positionX?o.css("left",parseInt(window.innerWidth/2-s/2)+"px"):o.css(o._positionX,c+"px"),r[o._positionY+o._positionX]=u+a,0m.maxCount&&0===i&&o.scope().kill(!0),e++}}},i=c(e)(n);i._positionY=h.positionY,i._positionX=h.positionX,i._priority=h.priority,i.addClass(h.type);var o=function(e){("click"===(e=e.originalEvent||e).type||"opacity"===e.propertyName&&1<=e.elapsedTime)&&(n.onClose&&n.$apply(n.onClose(i)),i.remove(),$.splice($.indexOf(i),1),n.$destroy(),r())};h.closeOnClick&&(i.addClass("clickable"),i.bind("click",o)),i.bind("webkitTransitionEnd oTransitionEnd otransitionend transitionend msTransitionEnd",o),angular.isNumber(h.delay)&&u(function(){i.addClass("killed")},h.delay),t("none"),angular.element(document.querySelector(h.container)).append(i);var a=-(parseInt(i[0].offsetHeight)+50);if(i.css(i._positionY,a+"px"),$.push(i),"center"==h.positionX){var s=parseInt(i[0].offsetWidth);i.css("left",parseInt(window.innerWidth/2-s/2)+"px")}u(function(){t("")}),n._templateElement=i,n.kill=function(e){e?(n.onClose&&n.$apply(n.onClose(n._templateElement)),$.splice($.indexOf(n._templateElement),1),n._templateElement.remove(),n.$destroy(),u(r)):n._templateElement.addClass("killed")},u(r),_||(angular.element(g).bind("resize",function(e){u(r)}),_=!0),l.resolve(n)}var l=a.defer();"object"==typeof h&&null!==h||(h={message:h}),h.scope=h.scope?h.scope:o,h.template=h.templateUrl?h.templateUrl:m.templateUrl,h.delay=angular.isUndefined(h.delay)?s:h.delay,h.type=e||h.type||m.type||"",h.positionY=h.positionY?h.positionY:m.positionY,h.positionX=h.positionX?h.positionX:m.positionX,h.replaceMessage=h.replaceMessage?h.replaceMessage:m.replaceMessage,h.onClose=h.onClose?h.onClose:m.onClose,h.closeOnClick=null!==h.closeOnClick&&void 0!==h.closeOnClick?h.closeOnClick:m.closeOnClick,h.container=h.container?h.container:m.container,h.priority=h.priority?h.priority:m.priority;var n=i.get(h.template);return n?t(n):r.get(h.template,{cache:!0}).then(function(e){t(e.data)}).catch(function(e){throw new Error("Template ("+h.template+") could not be loaded. "+e)}),l.promise};return t.primary=function(e){return this(e,"primary")},t.error=function(e){return this(e,"error")},t.success=function(e){return this(e,"success")},t.info=function(e){return this(e,"info")},t.warning=function(e){return this(e,"warning")},t.clearAll=function(){angular.forEach($,function(e){e.addClass("killed")})},t}]}),angular.module("ui-notification").run(["$templateCache",function(e){e.put("angular-ui-notification.html",'

    ')}]),function(){var w="__default";angular.module("angularUtils.directives.dirPagination",[]).directive("dirPaginate",["$compile","$parse","paginationService",function(m,v,y){return{terminal:!0,multiElement:!0,priority:100,compile:function(e,t){var f=t.dirPaginate,n=f.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/),r=/\|\s*itemsPerPage\s*:\s*(.*\(\s*\w*\)|([^\)]*?(?=\s+as\s+))|[^\)]*)/;if(null===n[2].match(r))throw"pagination directive: the 'itemsPerPage' filter must be set.";var i=n[2].replace(r,""),g=v(i);o=e,angular.forEach(o,function(e){1===e.nodeType&&angular.element(e).attr("dir-paginate-no-compile",!0)});var o;var a=t.paginationId||w;return y.registerInstance(a),function(e,t,n){var r=v(n.paginationId)(e)||n.paginationId||w;y.registerInstance(r);var i,o,a,s,l,u,c,d=(u=r,c=!!(l=f).match(/(\|\s*itemsPerPage\s*:[^|]*:[^|]*)/),u===w||c?l:l.replace(/(\|\s*itemsPerPage\s*:\s*[^|\s]*)/,"$1 : '"+u+"'"));o=n,a=d,(i=t)[0].hasAttribute("dir-paginate-start")||i[0].hasAttribute("data-dir-paginate-start")?(o.$set("ngRepeatStart",a),i.eq(i.length-1).attr("ng-repeat-end",!0)):o.$set("ngRepeat",a),s=t,angular.forEach(s,function(e){1===e.nodeType&&angular.element(e).removeAttr("dir-paginate-no-compile")}),s.eq(0).removeAttr("dir-paginate-start").removeAttr("dir-paginate").removeAttr("data-dir-paginate-start").removeAttr("data-dir-paginate"),s.eq(s.length-1).removeAttr("dir-paginate-end").removeAttr("data-dir-paginate-end");var p=m(t),h=function(e,t,n){var r;if(t.currentPage)r=v(t.currentPage);else{var i=(n+"__currentPage").replace(/\W/g,"_");e[i]=1,r=v(i)}return r}(e,n,r);y.setCurrentPageParser(r,h,e),void 0!==n.totalItems?(y.setAsyncModeTrue(r),e.$watch(function(){return v(n.totalItems)(e)},function(e){0<=e&&y.setCollectionLength(r,e)})):(y.setAsyncModeFalse(r),e.$watchCollection(function(){return g(e)},function(e){if(e){var t=e instanceof Array?e.length:Object.keys(e).length;y.setCollectionLength(r,t)}})),p(e)}}}}]).directive("dirPaginateNoCompile",function(){return{priority:5e3,terminal:!0}}).directive("dirPaginationControls",["paginationService","paginationTemplate",function(d,n){var p=/^\d+$/,e={restrict:"AE",scope:{maxSize:"=?",onPageChange:"&?",paginationId:"=?",autoHide:"=?"},link:function(r,e,t){var n=t.paginationId||w,i=r.paginationId||t.paginationId||w;if(!d.isRegistered(i)&&!d.isRegistered(n)){var o=i!==w?" (id: "+i+") ":" ";window.console&&console.warn("Pagination directive: the pagination controls"+o+"cannot be used without the corresponding pagination directive, which was not found at link time.")}r.maxSize||(r.maxSize=9);r.autoHide=void 0===r.autoHide||r.autoHide,r.directionLinks=!angular.isDefined(t.directionLinks)||r.$parent.$eval(t.directionLinks),r.boundaryLinks=!!angular.isDefined(t.boundaryLinks)&&r.$parent.$eval(t.boundaryLinks);var a=Math.max(r.maxSize,5);function s(e){if(d.isRegistered(i)&&c(e)){var t=r.pagination.current;r.pages=h(e,d.getCollectionLength(i),d.getItemsPerPage(i),a),r.pagination.current=e,u(),r.onPageChange&&r.onPageChange({newPageNumber:e,oldPageNumber:t})}}function l(){if(d.isRegistered(i)){var e=parseInt(d.getCurrentPage(i))||1;r.pages=h(e,d.getCollectionLength(i),d.getItemsPerPage(i),a),r.pagination.current=e,r.pagination.last=r.pages[r.pages.length-1],r.pagination.last
  • «
  • {{ pageNumber }}
  • »
  • ')}])}();var com_github_culmat_jsTreeTable=function(){function l(e,r,i){return i=i||"children",$.each(e,function(e,t){!function n(e){e[i]&&$.each(e[i],function(e,t){n(t)}),r(e)}(t)}),e}function t(e,n,o,a){var t=e;n=n||"id",o=o||"parent",a=a||"children";var s=[];$.each(t,function(e,t){s[t[n]]=t});var l=[];return $.each(t,function(e,r){var t=r[o];if($.isArray(t)||(t=[t]),0==t.length)l.push(r);else{var i=!1;$.each(t,function(e,t){var n=s[t];n&&(n[a]||(n[a]=[]),$.inArray(r,n[a])<0&&n[a].push(r),i=!0)}),i||l.push(r)}}),l}function u(e,u,c,d,p,t){u=u||"children",c=c||"id",t=t||{};var n=0,r=$("");$.each(t,function(e,t){"class"==e&&"jsTT"!=t?r.addClass(t):r.attr(e,t)});var i=$(""),o=$(""),h=$("");return r.append(i),i.append(o),r.append(h),d?$.each(d,function(e,t){$(o).append($(""))}):($(o).append($("")),$.each(e[0],function(e,t){e!=u&&e!=c&&$(o).append($(""))})),function o(e,a,s,l){n=Math.max(n,s),$.each(e,function(e,n){var r,t,i;n["data-tt-level"]=s,r=n,t=l,i=$(""),$(i).attr("data-tt-id",r[c]),$(i).attr("data-tt-level",r["data-tt-level"]),r[u]&&0!=r[u].length?$(i).attr("data-tt-isnode",!0):$(i).attr("data-tt-isleaf",!0),t&&$(i).attr("data-tt-parent-id",t[c]),p?p($(i),r):d?$.each(d,function(e,t){$(i).append($(""))}):($(i).append($("")),$.each(r,function(e,t){e!=u&&e!=c&&"data-tt-level"!=e&&$(i).append($(""))})),h.append(i),n[a]&&$.each(n[a],function(e,t){o([t],a,s+1,n)})})}(e,u,1),e[0]&&(e[0].maxLevel=n),r}function n(e,t){return $.each(e,function(e,n){$.each(t,function(e,t){n[t]=$(n).attr(t)})}),e}function c(i){i.addClass("jsTT"),i.expandLevel=function(n){$("tr[data-tt-level]",i).each(function(e){var t=parseInt($(this).attr("data-tt-level"));n-1')):r.prepend($('')),r.prepend($('')),t.trExpand=function(e){if(!(this.trChildren.length<1)){e&&(this.trChildrenVisible=!0,$("#state",this).get(0).src=o);var n=e||this.trChildrenVisible;$.each(this.trChildren,function(e,t){n&&$(t).css("display","table-row"),t.trExpand()})}},t.trCollapse=function(e){this.trChildren.length<1||(e&&(this.trChildrenVisible=!1,$("#state",this).get(0).src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAHlJREFUeNrcU1sNgDAQ6wgmcAM2MICGGlg1gJnNzWQcvwQGy1j4oUl/7tH0mpwzM7SgQyO+EZAUWh2MkkzSWhJwuRAlHYsJwEwyvs1gABDuzqoJcTw5qxaIJN0bgQRgIjnlmn1heSO5PE6Y2YXe+5Cr5+h++gs12AcAS6FS+7YOsj4AAAAASUVORK5CYII="),$.each(this.trChildren,function(e,t){$(t).css("display","none"),t.trCollapse()}))},$(t).click(function(){this.trChildrenVisible?this.trCollapse(!0):this.trExpand(!0)})}),i}return{depthFirst:l,makeTree:t,renderTree:u,attr2attr:n,treeTable:c,appendTreetable:function(e,t){(t=t||{}).idAttr=t.idAttr||"id",t.childrenAttr=t.childrenAttr||"children";var n=t.controls||[];t.mountPoint||(t.mountPoint=$("body")),t.depthFirst&&l(e,t.depthFirst,t.childrenAttr);var r=u(e,t.childrenAttr,t.idAttr,t.renderedAttr,t.renderer,t.tableAttributes);c(r),t.replaceContent&&t.mountPoint.html("");var i,o,a=t.initialExpandLevel?parseInt(t.initialExpandLevel):-1;if(a=Math.min(a,e[0].maxLevel),r.expandLevel(a),t.slider){var s=$('
    ');s.width("200px"),s.slider({min:1,max:e[0].maxLevel,range:"min",value:a,slide:function(e,t){r.expandLevel(t.value)}}),n=[s].concat(t.controls)}return 0"),$.each(i,function(e,t){o.append($('
    "+t+""+c+""+e+"
    "+r[e]+""+r[c]+""+t+"').append(t))}),$('').append(o))),t.mountPoint.append(r),r},jsTreeTable:"1.0",register:function(n){$.each(this,function(e,t){"register"!=e&&(n[e]=t)})}}}(); \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/gulpfile.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/gulpfile.js deleted file mode 100644 index 06ea3fc6..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/gulpfile.js +++ /dev/null @@ -1,134 +0,0 @@ -const gulp = require('gulp'); -const plugins = require('gulp-load-plugins')(); -const open = require('open'); -const app = { - srcPath: 'app/', // 源代码 - devPath: 'tmp/', // 开发打包 - prdPath: 'dist/' // 生产打包 -}; - -const JS_LIBS = [ - 'node_modules/angular-ui-router/release/angular-ui-router.js', - 'node_modules/oclazyload/dist/ocLazyLoad.min.js', - 'node_modules/angular-loading-bar/build/loading-bar.min.js', - 'node_modules/angular-bootstrap/ui-bootstrap-tpls.min.js', - 'node_modules/moment/moment.js', - 'node_modules/angular-date-time-input/src/dateTimeInput.js', - 'node_modules/angularjs-bootstrap-datetimepicker/src/js/datetimepicker.js', - 'node_modules/angular-table-resize/dist/angular-table-resize.min.js', - 'node_modules/angular-clipboard/angular-clipboard.js', - 'node_modules/selectize/dist/js/standalone/selectize.js', - 'node_modules/angular-selectize2/dist/selectize.js', - 'node_modules/bootstrap-switch/dist/js/bootstrap-switch.min.js', - 'node_modules/ng-dialog/js/ngDialog.js', - 'node_modules/angular-ui-notification/dist/angular-ui-notification.min.js', - 'node_modules/angular-utils-pagination/dirPagination.js', - 'app/scripts/libs/treeTable.js', -]; - -const CSS_APP = [ - 'node_modules/angular-loading-bar/build/loading-bar.min.css', - 'node_modules/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.css', - 'node_modules/ng-dialog/css/ngDialog.min.css', - 'node_modules/ng-dialog/css/ngDialog-theme-default.css', - 'node_modules/angularjs-bootstrap-datetimepicker/src/css/datetimepicker.css', - 'node_modules/angular-ui-notification/dist/angular-ui-notification.min.css', - 'node_modules/angular-table-resize/dist/angular-table-resize.css', - 'node_modules/selectize/dist/css/selectize.css', - 'app/styles/page.css', - 'app/styles/timeline.css', - 'app/styles/main.css' -]; - -const JS_APP = [ - 'app/scripts/app.js', - 'app/scripts/filters/filters.js', - 'app/scripts/services/version_service.js', - 'app/scripts/services/auth_service.js', - 'app/scripts/services/appservice.js', - 'app/scripts/services/flow_service_v1.js', - 'app/scripts/services/flow_service_v2.js', - 'app/scripts/services/degrade_service.js', - 'app/scripts/services/systemservice.js', - 'app/scripts/services/machineservice.js', - 'app/scripts/services/identityservice.js', - 'app/scripts/services/metricservice.js', - 'app/scripts/services/param_flow_service.js', - 'app/scripts/services/authority_service.js', - 'app/scripts/services/cluster_state_service.js', - 'app/scripts/services/gateway/api_service.js', - 'app/scripts/services/gateway/flow_service.js', -]; - -gulp.task('lib', function () { - gulp.src(JS_LIBS) - .pipe(plugins.concat('app.vendor.js')) - .pipe(gulp.dest(app.devPath + 'js')) - .pipe(plugins.uglify()) - .pipe(gulp.dest(app.prdPath + 'js')) - .pipe(plugins.connect.reload()); -}); - -/* -* css任务 -* 在src下创建style文件夹,里面存放less文件。 -*/ -gulp.task('css', function () { - gulp.src(CSS_APP) - .pipe(plugins.concat('app.css')) - .pipe(gulp.dest(app.devPath + 'css')) - .pipe(plugins.cssmin()) - .pipe(gulp.dest(app.prdPath + 'css')) - .pipe(plugins.connect.reload()); -}); - -/* -* js任务 -* 在src目录下创建script文件夹,里面存放所有的js文件 -*/ -gulp.task('js', function () { - gulp.src(JS_APP) - .pipe(plugins.concat('app.js')) - .pipe(gulp.dest(app.devPath + 'js')) - .pipe(plugins.uglify()) - .pipe(gulp.dest(app.prdPath + 'js')) - .pipe(plugins.connect.reload()); -}); - -/* -* js任务 -* 在src目录下创建script文件夹,里面存放所有的js文件 -*/ -gulp.task('jshint', function () { - gulp.src(JS_APP) - .pipe(plugins.jshint()) - .pipe(plugins.jshint.reporter()); -}); - -// 每次发布的时候,可能需要把之前目录内的内容清除,避免旧的文件对新的容有所影响。 需要在每次发布前删除dist和build目录 -gulp.task('clean', function () { - gulp.src([app.devPath, app.prdPath]) - .pipe(plugins.clean()); -}); - -// 总任务 -gulp.task('build', ['clean', 'jshint', 'lib', 'js', 'css']); - -// 服务 -gulp.task('serve', ['build'], function () { - plugins.connect.server({ //启动一个服务器 - root: [app.devPath], // 服务器从哪个路径开始读取,默认从开发路径读取 - livereload: true, // 自动刷新 - port: 1234 - }); - // 打开浏览器 - setTimeout(() => { - open('http://localhost:8080/index_dev.htm') - }, 200); - // 监听 - gulp.watch(app.srcPath + '**/*.js', ['js']); - gulp.watch(app.srcPath + '**/*.css', ['css']); -}); - -// 定义default任务 -gulp.task('default', ['serve']); diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/index.htm b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/index.htm deleted file mode 100644 index 24482898..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/index.htm +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - Sentinel Dashboard - - - - - - - - - - - -
    -
    -
    - - - - - - - - - - \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/index_dev.htm b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/index_dev.htm deleted file mode 100644 index 51131681..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/index_dev.htm +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - Sentinel 控制台 - - - - - - - - - - - -
    -
    -
    - - - - - - - - - - \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/css/bootstrap.min.css b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/css/bootstrap.min.css deleted file mode 100644 index c547283b..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/css/bootstrap.min.css +++ /dev/null @@ -1,7 +0,0 @@ -/*! - * Bootstrap v3.0.3 (http://getbootstrap.com) - * Copyright 2013 Twitter, Inc. - * Licensed under http://www.apache.org/licenses/LICENSE-2.0 - */ - -/*! normalize.css v2.1.3 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden],template{display:none}html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}a{background:transparent}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{margin:.67em 0;font-size:2em}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}hr{height:0;-moz-box-sizing:content-box;box-sizing:content-box}mark{color:#000;background:#ff0}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}pre{white-space:pre-wrap}q{quotes:"\201C" "\201D" "\2018" "\2019"}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:0}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid #c0c0c0}legend{padding:0;border:0}button,input,select,textarea{margin:0;font-family:inherit;font-size:100%}button,input{line-height:normal}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{cursor:pointer;-webkit-appearance:button}button[disabled],html input[disabled]{cursor:default}input[type="checkbox"],input[type="radio"]{padding:0;box-sizing:border-box}input[type="search"]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}@media print{*{color:#000!important;text-shadow:none!important;background:transparent!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100%!important}@page{margin:2cm .5cm}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}select{background:#fff!important}.navbar{display:none}.table td,.table th{background-color:#fff!important}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table-bordered th,.table-bordered td{border:1px solid #ddd!important}}*,*:before,*:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:62.5%;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.428571429;color:#333;background-color:#fff}input,button,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#428bca;text-decoration:none}a:hover,a:focus{color:#2a6496;text-decoration:underline}a:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}img{vertical-align:middle}.img-responsive{display:block;height:auto;max-width:100%}.img-rounded{border-radius:6px}.img-thumbnail{display:inline-block;height:auto;max-width:100%;padding:4px;line-height:1.428571429;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:500;line-height:1.1;color:inherit}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small,.h1 small,.h2 small,.h3 small,.h4 small,.h5 small,.h6 small,h1 .small,h2 .small,h3 .small,h4 .small,h5 .small,h6 .small,.h1 .small,.h2 .small,.h3 .small,.h4 .small,.h5 .small,.h6 .small{font-weight:normal;line-height:1;color:#999}h1,h2,h3{margin-top:20px;margin-bottom:10px}h1 small,h2 small,h3 small,h1 .small,h2 .small,h3 .small{font-size:65%}h4,h5,h6{margin-top:10px;margin-bottom:10px}h4 small,h5 small,h6 small,h4 .small,h5 .small,h6 .small{font-size:75%}h1,.h1{font-size:36px}h2,.h2{font-size:30px}h3,.h3{font-size:24px}h4,.h4{font-size:18px}h5,.h5{font-size:14px}h6,.h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:200;line-height:1.4}@media(min-width:768px){.lead{font-size:21px}}small,.small{font-size:85%}cite{font-style:normal}.text-muted{color:#999}.text-primary{color:#428bca}.text-primary:hover{color:#3071a9}.text-warning{color:#8a6d3b}.text-warning:hover{color:#66512c}.text-danger{color:#a94442}.text-danger:hover{color:#843534}.text-success{color:#3c763d}.text-success:hover{color:#2b542c}.text-info{color:#31708f}.text-info:hover{color:#245269}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ul,ol{margin-top:0;margin-bottom:10px}ul ul,ol ul,ul ol,ol ol{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;list-style:none}.list-inline>li{display:inline-block;padding-right:5px;padding-left:5px}.list-inline>li:first-child{padding-left:0}dl{margin-top:0;margin-bottom:20px}dt,dd{line-height:1.428571429}dt{font-weight:bold}dd{margin-left:0}@media(min-width:768px){.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}.dl-horizontal dd:before,.dl-horizontal dd:after{display:table;content:" "}.dl-horizontal dd:after{clear:both}.dl-horizontal dd:before,.dl-horizontal dd:after{display:table;content:" "}.dl-horizontal dd:after{clear:both}}abbr[title],abbr[data-original-title]{cursor:help;border-bottom:1px dotted #999}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;border-left:5px solid #eee}blockquote p{font-size:17.5px;font-weight:300;line-height:1.25}blockquote p:last-child{margin-bottom:0}blockquote small,blockquote .small{display:block;line-height:1.428571429;color:#999}blockquote small:before,blockquote .small:before{content:'\2014 \00A0'}blockquote.pull-right{padding-right:15px;padding-left:0;border-right:5px solid #eee;border-left:0}blockquote.pull-right p,blockquote.pull-right small,blockquote.pull-right .small{text-align:right}blockquote.pull-right small:before,blockquote.pull-right .small:before{content:''}blockquote.pull-right small:after,blockquote.pull-right .small:after{content:'\00A0 \2014'}blockquote:before,blockquote:after{content:""}address{margin-bottom:20px;font-style:normal;line-height:1.428571429}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;white-space:nowrap;background-color:#f9f2f4;border-radius:4px}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.428571429;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.container:before,.container:after{display:table;content:" "}.container:after{clear:both}.container:before,.container:after{display:table;content:" "}.container:after{clear:both}@media(min-width:768px){.container{width:750px}}@media(min-width:992px){.container{width:970px}}@media(min-width:1200px){.container{width:1170px}}.row{margin-right:-15px;margin-left:-15px}.row:before,.row:after{display:table;content:" "}.row:after{clear:both}.row:before,.row:after{display:table;content:" "}.row:after{clear:both}.col-xs-1,.col-sm-1,.col-md-1,.col-lg-1,.col-xs-2,.col-sm-2,.col-md-2,.col-lg-2,.col-xs-3,.col-sm-3,.col-md-3,.col-lg-3,.col-xs-4,.col-sm-4,.col-md-4,.col-lg-4,.col-xs-5,.col-sm-5,.col-md-5,.col-lg-5,.col-xs-6,.col-sm-6,.col-md-6,.col-lg-6,.col-xs-7,.col-sm-7,.col-md-7,.col-lg-7,.col-xs-8,.col-sm-8,.col-md-8,.col-lg-8,.col-xs-9,.col-sm-9,.col-md-9,.col-lg-9,.col-xs-10,.col-sm-10,.col-md-10,.col-lg-10,.col-xs-11,.col-sm-11,.col-md-11,.col-lg-11,.col-xs-12,.col-sm-12,.col-md-12,.col-lg-12{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.col-xs-10,.col-xs-11,.col-xs-12{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666666666666%}.col-xs-10{width:83.33333333333334%}.col-xs-9{width:75%}.col-xs-8{width:66.66666666666666%}.col-xs-7{width:58.333333333333336%}.col-xs-6{width:50%}.col-xs-5{width:41.66666666666667%}.col-xs-4{width:33.33333333333333%}.col-xs-3{width:25%}.col-xs-2{width:16.666666666666664%}.col-xs-1{width:8.333333333333332%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666666666666%}.col-xs-pull-10{right:83.33333333333334%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666666666666%}.col-xs-pull-7{right:58.333333333333336%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666666666667%}.col-xs-pull-4{right:33.33333333333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.666666666666664%}.col-xs-pull-1{right:8.333333333333332%}.col-xs-pull-0{right:0}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666666666666%}.col-xs-push-10{left:83.33333333333334%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666666666666%}.col-xs-push-7{left:58.333333333333336%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666666666667%}.col-xs-push-4{left:33.33333333333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.666666666666664%}.col-xs-push-1{left:8.333333333333332%}.col-xs-push-0{left:0}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666666666666%}.col-xs-offset-10{margin-left:83.33333333333334%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666666666666%}.col-xs-offset-7{margin-left:58.333333333333336%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666666666667%}.col-xs-offset-4{margin-left:33.33333333333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.666666666666664%}.col-xs-offset-1{margin-left:8.333333333333332%}.col-xs-offset-0{margin-left:0}@media(min-width:768px){.col-sm-1,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-10,.col-sm-11,.col-sm-12{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666666666666%}.col-sm-10{width:83.33333333333334%}.col-sm-9{width:75%}.col-sm-8{width:66.66666666666666%}.col-sm-7{width:58.333333333333336%}.col-sm-6{width:50%}.col-sm-5{width:41.66666666666667%}.col-sm-4{width:33.33333333333333%}.col-sm-3{width:25%}.col-sm-2{width:16.666666666666664%}.col-sm-1{width:8.333333333333332%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666666666666%}.col-sm-pull-10{right:83.33333333333334%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666666666666%}.col-sm-pull-7{right:58.333333333333336%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666666666667%}.col-sm-pull-4{right:33.33333333333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.666666666666664%}.col-sm-pull-1{right:8.333333333333332%}.col-sm-pull-0{right:0}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666666666666%}.col-sm-push-10{left:83.33333333333334%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666666666666%}.col-sm-push-7{left:58.333333333333336%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666666666667%}.col-sm-push-4{left:33.33333333333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.666666666666664%}.col-sm-push-1{left:8.333333333333332%}.col-sm-push-0{left:0}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666666666666%}.col-sm-offset-10{margin-left:83.33333333333334%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666666666666%}.col-sm-offset-7{margin-left:58.333333333333336%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666666666667%}.col-sm-offset-4{margin-left:33.33333333333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.666666666666664%}.col-sm-offset-1{margin-left:8.333333333333332%}.col-sm-offset-0{margin-left:0}}@media(min-width:992px){.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11,.col-md-12{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666666666666%}.col-md-10{width:83.33333333333334%}.col-md-9{width:75%}.col-md-8{width:66.66666666666666%}.col-md-7{width:58.333333333333336%}.col-md-6{width:50%}.col-md-5{width:41.66666666666667%}.col-md-4{width:33.33333333333333%}.col-md-3{width:25%}.col-md-2{width:16.666666666666664%}.col-md-1{width:8.333333333333332%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666666666666%}.col-md-pull-10{right:83.33333333333334%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666666666666%}.col-md-pull-7{right:58.333333333333336%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666666666667%}.col-md-pull-4{right:33.33333333333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.666666666666664%}.col-md-pull-1{right:8.333333333333332%}.col-md-pull-0{right:0}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666666666666%}.col-md-push-10{left:83.33333333333334%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666666666666%}.col-md-push-7{left:58.333333333333336%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666666666667%}.col-md-push-4{left:33.33333333333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.666666666666664%}.col-md-push-1{left:8.333333333333332%}.col-md-push-0{left:0}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666666666666%}.col-md-offset-10{margin-left:83.33333333333334%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666666666666%}.col-md-offset-7{margin-left:58.333333333333336%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666666666667%}.col-md-offset-4{margin-left:33.33333333333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.666666666666664%}.col-md-offset-1{margin-left:8.333333333333332%}.col-md-offset-0{margin-left:0}}@media(min-width:1200px){.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-10,.col-lg-11,.col-lg-12{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666666666666%}.col-lg-10{width:83.33333333333334%}.col-lg-9{width:75%}.col-lg-8{width:66.66666666666666%}.col-lg-7{width:58.333333333333336%}.col-lg-6{width:50%}.col-lg-5{width:41.66666666666667%}.col-lg-4{width:33.33333333333333%}.col-lg-3{width:25%}.col-lg-2{width:16.666666666666664%}.col-lg-1{width:8.333333333333332%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666666666666%}.col-lg-pull-10{right:83.33333333333334%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666666666666%}.col-lg-pull-7{right:58.333333333333336%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666666666667%}.col-lg-pull-4{right:33.33333333333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.666666666666664%}.col-lg-pull-1{right:8.333333333333332%}.col-lg-pull-0{right:0}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666666666666%}.col-lg-push-10{left:83.33333333333334%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666666666666%}.col-lg-push-7{left:58.333333333333336%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666666666667%}.col-lg-push-4{left:33.33333333333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.666666666666664%}.col-lg-push-1{left:8.333333333333332%}.col-lg-push-0{left:0}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666666666666%}.col-lg-offset-10{margin-left:83.33333333333334%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666666666666%}.col-lg-offset-7{margin-left:58.333333333333336%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666666666667%}.col-lg-offset-4{margin-left:33.33333333333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.666666666666664%}.col-lg-offset-1{margin-left:8.333333333333332%}.col-lg-offset-0{margin-left:0}}table{max-width:100%;background-color:transparent}th{text-align:left}.table{width:100%;margin-bottom:20px}.table>thead>tr>th,.table>tbody>tr>th,.table>tfoot>tr>th,.table>thead>tr>td,.table>tbody>tr>td,.table>tfoot>tr>td{padding:8px;line-height:1.428571429;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>th,.table>caption+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>td,.table>thead:first-child>tr:first-child>td{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>thead>tr>th,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>tbody>tr>td,.table-condensed>tfoot>tr>td{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>tbody>tr>td,.table-bordered>tfoot>tr>td{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>thead>tr>td{border-bottom-width:2px}.table-striped>tbody>tr:nth-child(odd)>td,.table-striped>tbody>tr:nth-child(odd)>th{background-color:#f9f9f9}.table-hover>tbody>tr:hover>td,.table-hover>tbody>tr:hover>th{background-color:#f5f5f5}table col[class*="col-"]{position:static;display:table-column;float:none}table td[class*="col-"],table th[class*="col-"]{display:table-cell;float:none}.table>thead>tr>.active,.table>tbody>tr>.active,.table>tfoot>tr>.active,.table>thead>.active>td,.table>tbody>.active>td,.table>tfoot>.active>td,.table>thead>.active>th,.table>tbody>.active>th,.table>tfoot>.active>th{background-color:#f5f5f5}.table-hover>tbody>tr>.active:hover,.table-hover>tbody>.active:hover>td,.table-hover>tbody>.active:hover>th{background-color:#e8e8e8}.table>thead>tr>.success,.table>tbody>tr>.success,.table>tfoot>tr>.success,.table>thead>.success>td,.table>tbody>.success>td,.table>tfoot>.success>td,.table>thead>.success>th,.table>tbody>.success>th,.table>tfoot>.success>th{background-color:#dff0d8}.table-hover>tbody>tr>.success:hover,.table-hover>tbody>.success:hover>td,.table-hover>tbody>.success:hover>th{background-color:#d0e9c6}.table>thead>tr>.danger,.table>tbody>tr>.danger,.table>tfoot>tr>.danger,.table>thead>.danger>td,.table>tbody>.danger>td,.table>tfoot>.danger>td,.table>thead>.danger>th,.table>tbody>.danger>th,.table>tfoot>.danger>th{background-color:#f2dede}.table-hover>tbody>tr>.danger:hover,.table-hover>tbody>.danger:hover>td,.table-hover>tbody>.danger:hover>th{background-color:#ebcccc}.table>thead>tr>.warning,.table>tbody>tr>.warning,.table>tfoot>tr>.warning,.table>thead>.warning>td,.table>tbody>.warning>td,.table>tfoot>.warning>td,.table>thead>.warning>th,.table>tbody>.warning>th,.table>tfoot>.warning>th{background-color:#fcf8e3}.table-hover>tbody>tr>.warning:hover,.table-hover>tbody>.warning:hover>td,.table-hover>tbody>.warning:hover>th{background-color:#faf2cc}@media(max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-x:scroll;overflow-y:hidden;border:1px solid #ddd;-ms-overflow-style:-ms-autohiding-scrollbar;-webkit-overflow-scrolling:touch}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>thead>tr>th,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tfoot>tr>td{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>thead>tr>th:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.table-responsive>.table-bordered>thead>tr>th:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>th,.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>td{border-bottom:0}}fieldset{padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;margin-bottom:5px;font-weight:bold}input[type="search"]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type="radio"],input[type="checkbox"]{margin:4px 0 0;margin-top:1px \9;line-height:normal}input[type="file"]{display:block}select[multiple],select[size]{height:auto}select optgroup{font-family:inherit;font-size:inherit;font-style:inherit}input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}input[type="number"]::-webkit-outer-spin-button,input[type="number"]::-webkit-inner-spin-button{height:auto}output{display:block;padding-top:7px;font-size:14px;line-height:1.428571429;color:#555;vertical-align:middle}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.428571429;color:#555;vertical-align:middle;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6)}.form-control:-moz-placeholder{color:#999}.form-control::-moz-placeholder{color:#999;opacity:1}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{cursor:not-allowed;background-color:#eee}textarea.form-control{height:auto}.form-group{margin-bottom:15px}.radio,.checkbox{display:block;min-height:20px;padding-left:20px;margin-top:10px;margin-bottom:10px;vertical-align:middle}.radio label,.checkbox label{display:inline;margin-bottom:0;font-weight:normal;cursor:pointer}.radio input[type="radio"],.radio-inline input[type="radio"],.checkbox input[type="checkbox"],.checkbox-inline input[type="checkbox"]{float:left;margin-left:-20px}.radio+.radio,.checkbox+.checkbox{margin-top:-5px}.radio-inline,.checkbox-inline{display:inline-block;padding-left:20px;margin-bottom:0;font-weight:normal;vertical-align:middle;cursor:pointer}.radio-inline+.radio-inline,.checkbox-inline+.checkbox-inline{margin-top:0;margin-left:10px}input[type="radio"][disabled],input[type="checkbox"][disabled],.radio[disabled],.radio-inline[disabled],.checkbox[disabled],.checkbox-inline[disabled],fieldset[disabled] input[type="radio"],fieldset[disabled] input[type="checkbox"],fieldset[disabled] .radio,fieldset[disabled] .radio-inline,fieldset[disabled] .checkbox,fieldset[disabled] .checkbox-inline{cursor:not-allowed}.input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm{height:30px;line-height:30px}textarea.input-sm{height:auto}.input-lg{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-lg{height:46px;line-height:46px}textarea.input-lg{height:auto}.has-warning .help-block,.has-warning .control-label,.has-warning .radio,.has-warning .checkbox,.has-warning .radio-inline,.has-warning .checkbox-inline{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;background-color:#fcf8e3;border-color:#8a6d3b}.has-error .help-block,.has-error .control-label,.has-error .radio,.has-error .checkbox,.has-error .radio-inline,.has-error .checkbox-inline{color:#a94442}.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;background-color:#f2dede;border-color:#a94442}.has-success .help-block,.has-success .control-label,.has-success .radio,.has-success .checkbox,.has-success .radio-inline,.has-success .checkbox-inline{color:#3c763d}.has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;background-color:#dff0d8;border-color:#3c763d}.form-control-static{margin-bottom:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media(min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block}.form-inline select.form-control{width:auto}.form-inline .radio,.form-inline .checkbox{display:inline-block;padding-left:0;margin-top:0;margin-bottom:0}.form-inline .radio input[type="radio"],.form-inline .checkbox input[type="checkbox"]{float:none;margin-left:0}}.form-horizontal .control-label,.form-horizontal .radio,.form-horizontal .checkbox,.form-horizontal .radio-inline,.form-horizontal .checkbox-inline{padding-top:7px;margin-top:0;margin-bottom:0}.form-horizontal .radio,.form-horizontal .checkbox{min-height:27px}.form-horizontal .form-group{margin-right:-15px;margin-left:-15px}.form-horizontal .form-group:before,.form-horizontal .form-group:after{display:table;content:" "}.form-horizontal .form-group:after{clear:both}.form-horizontal .form-group:before,.form-horizontal .form-group:after{display:table;content:" "}.form-horizontal .form-group:after{clear:both}.form-horizontal .form-control-static{padding-top:7px}@media(min-width:768px){.form-horizontal .control-label{text-align:right}}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:normal;line-height:1.428571429;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;background-image:none;border:1px solid transparent;border-radius:4px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.btn:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn:hover,.btn:focus{color:#333;text-decoration:none}.btn:active,.btn.active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{pointer-events:none;cursor:not-allowed;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default:hover,.btn-default:focus,.btn-default:active,.btn-default.active,.open .dropdown-toggle.btn-default{color:#333;background-color:#ebebeb;border-color:#adadad}.btn-default:active,.btn-default.active,.open .dropdown-toggle.btn-default{background-image:none}.btn-default.disabled,.btn-default[disabled],fieldset[disabled] .btn-default,.btn-default.disabled:hover,.btn-default[disabled]:hover,fieldset[disabled] .btn-default:hover,.btn-default.disabled:focus,.btn-default[disabled]:focus,fieldset[disabled] .btn-default:focus,.btn-default.disabled:active,.btn-default[disabled]:active,fieldset[disabled] .btn-default:active,.btn-default.disabled.active,.btn-default[disabled].active,fieldset[disabled] .btn-default.active{background-color:#fff;border-color:#ccc}.btn-default .badge{color:#fff;background-color:#fff}.btn-primary{color:#fff;background-color:#428bca;border-color:#357ebd}.btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.open .dropdown-toggle.btn-primary{color:#fff;background-color:#3276b1;border-color:#285e8e}.btn-primary:active,.btn-primary.active,.open .dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled,.btn-primary[disabled],fieldset[disabled] .btn-primary,.btn-primary.disabled:hover,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary:hover,.btn-primary.disabled:focus,.btn-primary[disabled]:focus,fieldset[disabled] .btn-primary:focus,.btn-primary.disabled:active,.btn-primary[disabled]:active,fieldset[disabled] .btn-primary:active,.btn-primary.disabled.active,.btn-primary[disabled].active,fieldset[disabled] .btn-primary.active{background-color:#428bca;border-color:#357ebd}.btn-primary .badge{color:#428bca;background-color:#fff}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning:hover,.btn-warning:focus,.btn-warning:active,.btn-warning.active,.open .dropdown-toggle.btn-warning{color:#fff;background-color:#ed9c28;border-color:#d58512}.btn-warning:active,.btn-warning.active,.open .dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled,.btn-warning[disabled],fieldset[disabled] .btn-warning,.btn-warning.disabled:hover,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning:hover,.btn-warning.disabled:focus,.btn-warning[disabled]:focus,fieldset[disabled] .btn-warning:focus,.btn-warning.disabled:active,.btn-warning[disabled]:active,fieldset[disabled] .btn-warning:active,.btn-warning.disabled.active,.btn-warning[disabled].active,fieldset[disabled] .btn-warning.active{background-color:#f0ad4e;border-color:#eea236}.btn-warning .badge{color:#f0ad4e;background-color:#fff}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger:hover,.btn-danger:focus,.btn-danger:active,.btn-danger.active,.open .dropdown-toggle.btn-danger{color:#fff;background-color:#d2322d;border-color:#ac2925}.btn-danger:active,.btn-danger.active,.open .dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled,.btn-danger[disabled],fieldset[disabled] .btn-danger,.btn-danger.disabled:hover,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger:hover,.btn-danger.disabled:focus,.btn-danger[disabled]:focus,fieldset[disabled] .btn-danger:focus,.btn-danger.disabled:active,.btn-danger[disabled]:active,fieldset[disabled] .btn-danger:active,.btn-danger.disabled.active,.btn-danger[disabled].active,fieldset[disabled] .btn-danger.active{background-color:#d9534f;border-color:#d43f3a}.btn-danger .badge{color:#d9534f;background-color:#fff}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success:hover,.btn-success:focus,.btn-success:active,.btn-success.active,.open .dropdown-toggle.btn-success{color:#fff;background-color:#47a447;border-color:#398439}.btn-success:active,.btn-success.active,.open .dropdown-toggle.btn-success{background-image:none}.btn-success.disabled,.btn-success[disabled],fieldset[disabled] .btn-success,.btn-success.disabled:hover,.btn-success[disabled]:hover,fieldset[disabled] .btn-success:hover,.btn-success.disabled:focus,.btn-success[disabled]:focus,fieldset[disabled] .btn-success:focus,.btn-success.disabled:active,.btn-success[disabled]:active,fieldset[disabled] .btn-success:active,.btn-success.disabled.active,.btn-success[disabled].active,fieldset[disabled] .btn-success.active{background-color:#5cb85c;border-color:#4cae4c}.btn-success .badge{color:#5cb85c;background-color:#fff}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info:hover,.btn-info:focus,.btn-info:active,.btn-info.active,.open .dropdown-toggle.btn-info{color:#fff;background-color:#39b3d7;border-color:#269abc}.btn-info:active,.btn-info.active,.open .dropdown-toggle.btn-info{background-image:none}.btn-info.disabled,.btn-info[disabled],fieldset[disabled] .btn-info,.btn-info.disabled:hover,.btn-info[disabled]:hover,fieldset[disabled] .btn-info:hover,.btn-info.disabled:focus,.btn-info[disabled]:focus,fieldset[disabled] .btn-info:focus,.btn-info.disabled:active,.btn-info[disabled]:active,fieldset[disabled] .btn-info:active,.btn-info.disabled.active,.btn-info[disabled].active,fieldset[disabled] .btn-info.active{background-color:#5bc0de;border-color:#46b8da}.btn-info .badge{color:#5bc0de;background-color:#fff}.btn-link{font-weight:normal;color:#428bca;cursor:pointer;border-radius:0}.btn-link,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:hover,.btn-link:focus,.btn-link:active{border-color:transparent}.btn-link:hover,.btn-link:focus{color:#2a6496;text-decoration:underline;background-color:transparent}.btn-link[disabled]:hover,fieldset[disabled] .btn-link:hover,.btn-link[disabled]:focus,fieldset[disabled] .btn-link:focus{color:#999;text-decoration:none}.btn-lg{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%;padding-right:0;padding-left:0}.btn-block+.btn-block{margin-top:5px}input[type="submit"].btn-block,input[type="reset"].btn-block,input[type="button"].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition:height .35s ease;transition:height .35s ease}@font-face{font-family:'Glyphicons Halflings';src:url('../fonts/glyphicons-halflings-regular.eot');src:url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'),url('../fonts/glyphicons-halflings-regular.woff') format('woff'),url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'),url('../fonts/glyphicons-halflings-regular.svg#glyphicons-halflingsregular') format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';-webkit-font-smoothing:antialiased;font-style:normal;font-weight:normal;line-height:1;-moz-osx-font-smoothing:grayscale}.glyphicon:empty{width:1em}.glyphicon-asterisk:before{content:"\2a"}.glyphicon-plus:before{content:"\2b"}.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px solid;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;list-style:none;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,0.175);box-shadow:0 6px 12px rgba(0,0,0,0.175);background-clip:padding-box}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:normal;line-height:1.428571429;color:#333;white-space:nowrap}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{color:#262626;text-decoration:none;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{color:#fff;text-decoration:none;background-color:#428bca;outline:0}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{color:#999}.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.428571429;color:#999}.dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{border-top:0;border-bottom:4px solid;content:""}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px}@media(min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group>.btn,.btn-group-vertical>.btn{position:relative;float:left}.btn-group>.btn:hover,.btn-group-vertical>.btn:hover,.btn-group>.btn:focus,.btn-group-vertical>.btn:focus,.btn-group>.btn:active,.btn-group-vertical>.btn:active,.btn-group>.btn.active,.btn-group-vertical>.btn.active{z-index:2}.btn-group>.btn:focus,.btn-group-vertical>.btn:focus{outline:0}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar:before,.btn-toolbar:after{display:table;content:" "}.btn-toolbar:after{clear:both}.btn-toolbar:before,.btn-toolbar:after{display:table;content:" "}.btn-toolbar:after{clear:both}.btn-toolbar .btn-group{float:left}.btn-toolbar>.btn+.btn,.btn-toolbar>.btn-group+.btn,.btn-toolbar>.btn+.btn-group,.btn-toolbar>.btn-group+.btn-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child>.btn:last-child,.btn-group>.btn-group:first-child>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child>.btn:first-child{border-bottom-left-radius:0;border-top-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group-xs>.btn{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-sm>.btn{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-lg>.btn{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.btn-group>.btn+.dropdown-toggle{padding-right:8px;padding-left:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-right:12px;padding-left:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after{display:table;content:" "}.btn-group-vertical>.btn-group:after{clear:both}.btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after{display:table;content:" "}.btn-group-vertical>.btn-group:after{clear:both}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-right-radius:0;border-bottom-left-radius:4px;border-top-left-radius:0}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child>.btn:last-child,.btn-group-vertical>.btn-group:first-child>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child>.btn:first-child{border-top-right-radius:0;border-top-left-radius:0}.btn-group-justified{display:table;width:100%;border-collapse:separate;table-layout:fixed}.btn-group-justified>.btn,.btn-group-justified>.btn-group{display:table-cell;float:none;width:1%}.btn-group-justified>.btn-group .btn{width:100%}[data-toggle="buttons"]>.btn>input[type="radio"],[data-toggle="buttons"]>.btn>input[type="checkbox"]{display:none}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*="col-"]{float:none;padding-right:0;padding-left:0}.input-group .form-control{width:100%;margin-bottom:0}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:46px;line-height:46px}textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn{height:auto}.input-group-addon,.input-group-btn,.input-group .form-control{display:table-cell}.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child),.input-group .form-control:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:normal;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type="radio"],.input-group-addon input[type="checkbox"]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:last-child>.btn,.input-group-btn:last-child>.dropdown-toggle,.input-group-btn:first-child>.btn:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;white-space:nowrap}.input-group-btn:first-child>.btn{margin-right:-1px}.input-group-btn:last-child>.btn{margin-left:-1px}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-4px}.input-group-btn>.btn:hover,.input-group-btn>.btn:active{z-index:2}.nav{padding-left:0;margin-bottom:0;list-style:none}.nav:before,.nav:after{display:table;content:" "}.nav:after{clear:both}.nav:before,.nav:after{display:table;content:" "}.nav:after{clear:both}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:hover,.nav>li>a:focus{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#999}.nav>li.disabled>a:hover,.nav>li.disabled>a:focus{color:#999;text-decoration:none;cursor:not-allowed;background-color:transparent}.nav .open>a,.nav .open>a:hover,.nav .open>a:focus{background-color:#eee;border-color:#428bca}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.428571429;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media(min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border:1px solid #ddd}@media(min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:hover,.nav-pills>li.active>a:focus{color:#fff;background-color:#428bca}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media(min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border:1px solid #ddd}@media(min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-right-radius:0;border-top-left-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}.navbar:before,.navbar:after{display:table;content:" "}.navbar:after{clear:both}.navbar:before,.navbar:after{display:table;content:" "}.navbar:after{clear:both}@media(min-width:768px){.navbar{border-radius:4px}}.navbar-header:before,.navbar-header:after{display:table;content:" "}.navbar-header:after{clear:both}.navbar-header:before,.navbar-header:after{display:table;content:" "}.navbar-header:after{clear:both}@media(min-width:768px){.navbar-header{float:left}}.navbar-collapse{max-height:340px;padding-right:15px;padding-left:15px;overflow-x:visible;border-top:1px solid transparent;box-shadow:inset 0 1px 0 rgba(255,255,255,0.1);-webkit-overflow-scrolling:touch}.navbar-collapse:before,.navbar-collapse:after{display:table;content:" "}.navbar-collapse:after{clear:both}.navbar-collapse:before,.navbar-collapse:after{display:table;content:" "}.navbar-collapse:after{clear:both}.navbar-collapse.in{overflow-y:auto}@media(min-width:768px){.navbar-collapse{width:auto;border-top:0;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{padding-right:0;padding-left:0}}.container>.navbar-header,.container>.navbar-collapse{margin-right:-15px;margin-left:-15px}@media(min-width:768px){.container>.navbar-header,.container>.navbar-collapse{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media(min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030}@media(min-width:768px){.navbar-fixed-top,.navbar-fixed-bottom{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;padding:15px 15px;font-size:18px;line-height:20px}.navbar-brand:hover,.navbar-brand:focus{text-decoration:none}@media(min-width:768px){.navbar>.container .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;padding:9px 10px;margin-top:8px;margin-right:15px;margin-bottom:8px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media(min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media(max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;box-shadow:none}.navbar-nav .open .dropdown-menu>li>a,.navbar-nav .open .dropdown-menu .dropdown-header{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:hover,.navbar-nav .open .dropdown-menu>li>a:focus{background-image:none}}@media(min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}.navbar-nav.navbar-right:last-child{margin-right:-15px}}@media(min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important}}.navbar-form{padding:10px 15px;margin-top:8px;margin-right:-15px;margin-bottom:8px;margin-left:-15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1);box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1)}@media(min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block}.navbar-form select.form-control{width:auto}.navbar-form .radio,.navbar-form .checkbox{display:inline-block;padding-left:0;margin-top:0;margin-bottom:0}.navbar-form .radio input[type="radio"],.navbar-form .checkbox input[type="checkbox"]{float:none;margin-left:0}}@media(max-width:767px){.navbar-form .form-group{margin-bottom:5px}}@media(min-width:768px){.navbar-form{width:auto;padding-top:0;padding-bottom:0;margin-right:0;margin-left:0;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-form.navbar-right:last-child{margin-right:-15px}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-right-radius:0;border-top-left-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-nav.pull-right>li>.dropdown-menu,.navbar-nav>li>.dropdown-menu.pull-right{right:0;left:auto}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media(min-width:768px){.navbar-text{float:left;margin-right:15px;margin-left:15px}.navbar-text.navbar-right:last-child{margin-right:0}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:hover,.navbar-default .navbar-brand:focus{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a{color:#777}.navbar-default .navbar-nav>li>a:hover,.navbar-default .navbar-nav>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:hover,.navbar-default .navbar-nav>.disabled>a:focus{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:hover,.navbar-default .navbar-toggle:focus{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#ccc}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:hover,.navbar-default .navbar-nav>.open>a:focus{color:#555;background-color:#e7e7e7}@media(max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-inverse{background-color:#222;border-color:#080808}.navbar-inverse .navbar-brand{color:#999}.navbar-inverse .navbar-brand:hover,.navbar-inverse .navbar-brand:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-text{color:#999}.navbar-inverse .navbar-nav>li>a{color:#999}.navbar-inverse .navbar-nav>li>a:hover,.navbar-inverse .navbar-nav>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:hover,.navbar-inverse .navbar-nav>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:hover,.navbar-inverse .navbar-nav>.disabled>a:focus{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:hover,.navbar-inverse .navbar-toggle:focus{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:hover,.navbar-inverse .navbar-nav>.open>a:focus{color:#fff;background-color:#080808}@media(max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#999}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#999}.navbar-inverse .navbar-link:hover{color:#fff}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{padding:0 5px;color:#ccc;content:"/\00a0"}.breadcrumb>.active{color:#999}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;margin-left:-1px;line-height:1.428571429;text-decoration:none;background-color:#fff;border:1px solid #ddd}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-bottom-left-radius:4px;border-top-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}.pagination>li>a:hover,.pagination>li>span:hover,.pagination>li>a:focus,.pagination>li>span:focus{background-color:#eee}.pagination>.active>a,.pagination>.active>span,.pagination>.active>a:hover,.pagination>.active>span:hover,.pagination>.active>a:focus,.pagination>.active>span:focus{z-index:2;color:#fff;cursor:default;background-color:#428bca;border-color:#428bca}.pagination>.disabled>span,.pagination>.disabled>span:hover,.pagination>.disabled>span:focus,.pagination>.disabled>a,.pagination>.disabled>a:hover,.pagination>.disabled>a:focus{color:#999;cursor:not-allowed;background-color:#fff;border-color:#ddd}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-bottom-left-radius:6px;border-top-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-top-right-radius:6px;border-bottom-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-bottom-left-radius:3px;border-top-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-top-right-radius:3px;border-bottom-right-radius:3px}.pager{padding-left:0;margin:20px 0;text-align:center;list-style:none}.pager:before,.pager:after{display:table;content:" "}.pager:after{clear:both}.pager:before,.pager:after{display:table;content:" "}.pager:after{clear:both}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:hover,.pager li>a:focus{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:hover,.pager .disabled>a:focus,.pager .disabled>span{color:#999;cursor:not-allowed;background-color:#fff}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:bold;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}.label[href]:hover,.label[href]:focus{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#999}.label-default[href]:hover,.label-default[href]:focus{background-color:#808080}.label-primary{background-color:#428bca}.label-primary[href]:hover,.label-primary[href]:focus{background-color:#3071a9}.label-success{background-color:#5cb85c}.label-success[href]:hover,.label-success[href]:focus{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:hover,.label-info[href]:focus{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:hover,.label-warning[href]:focus{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:hover,.label-danger[href]:focus{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:bold;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;background-color:#999;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}a.badge:hover,a.badge:focus{color:#fff;text-decoration:none;cursor:pointer}a.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#428bca;background-color:#fff}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding:30px;margin-bottom:30px;font-size:21px;font-weight:200;line-height:2.1428571435;color:inherit;background-color:#eee}.jumbotron h1,.jumbotron .h1{line-height:1;color:inherit}.jumbotron p{line-height:1.4}.container .jumbotron{border-radius:6px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding-top:48px;padding-bottom:48px}.container .jumbotron{padding-right:60px;padding-left:60px}.jumbotron h1,.jumbotron .h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.428571429;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.thumbnail>img,.thumbnail a>img{display:block;height:auto;max-width:100%;margin-right:auto;margin-left:auto}a.thumbnail:hover,a.thumbnail:focus,a.thumbnail.active{border-color:#428bca}.thumbnail .caption{padding:9px;color:#333}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:bold}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable{padding-right:35px}.alert-dismissable .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#428bca;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);-webkit-transition:width .6s ease;transition:width .6s ease}.progress-striped .progress-bar{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-size:40px 40px}.progress.active .progress-bar{-webkit-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.media,.media-body{overflow:hidden;zoom:1}.media,.media .media{margin-top:15px}.media:first-child{margin-top:0}.media-object{display:block}.media-heading{margin:0 0 5px}.media>.pull-left{margin-right:10px}.media>.pull-right{margin-left:10px}.media-list{padding-left:0;list-style:none}.list-group{padding-left:0;margin-bottom:20px}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-right-radius:4px;border-top-left-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}a.list-group-item{color:#555}a.list-group-item .list-group-item-heading{color:#333}a.list-group-item:hover,a.list-group-item:focus{text-decoration:none;background-color:#f5f5f5}a.list-group-item.active,a.list-group-item.active:hover,a.list-group-item.active:focus{z-index:2;color:#fff;background-color:#428bca;border-color:#428bca}a.list-group-item.active .list-group-item-heading,a.list-group-item.active:hover .list-group-item-heading,a.list-group-item.active:focus .list-group-item-heading{color:inherit}a.list-group-item.active .list-group-item-text,a.list-group-item.active:hover .list-group-item-text,a.list-group-item.active:focus .list-group-item-text{color:#e1edf7}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.05);box-shadow:0 1px 1px rgba(0,0,0,0.05)}.panel-body{padding:15px}.panel-body:before,.panel-body:after{display:table;content:" "}.panel-body:after{clear:both}.panel-body:before,.panel-body:after{display:table;content:" "}.panel-body:after{clear:both}.panel>.list-group{margin-bottom:0}.panel>.list-group .list-group-item{border-width:1px 0}.panel>.list-group .list-group-item:first-child{border-top-right-radius:0;border-top-left-radius:0}.panel>.list-group .list-group-item:last-child{border-bottom:0}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.panel>.table,.panel>.table-responsive>.table{margin-bottom:0}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive{border-top:1px solid #ddd}.panel>.table>tbody:first-child th,.panel>.table>tbody:first-child td{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.panel>.table-bordered>thead>tr:last-child>th,.panel>.table-responsive>.table-bordered>thead>tr:last-child>th,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th,.panel>.table-bordered>thead>tr:last-child>td,.panel>.table-responsive>.table-bordered>thead>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td{border-bottom:0}.panel>.table-responsive{margin-bottom:0;border:0}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-right-radius:3px;border-top-left-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px;color:inherit}.panel-title>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel-group .panel{margin-bottom:0;overflow:hidden;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse .panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse .panel-body{border-top-color:#ddd}.panel-default>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#428bca}.panel-primary>.panel-heading{color:#fff;background-color:#428bca;border-color:#428bca}.panel-primary>.panel-heading+.panel-collapse .panel-body{border-top-color:#428bca}.panel-primary>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#428bca}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse .panel-body{border-top-color:#d6e9c6}.panel-success>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#d6e9c6}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse .panel-body{border-top-color:#faebcc}.panel-warning>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse .panel-body{border-top-color:#ebccd1}.panel-danger>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#ebccd1}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse .panel-body{border-top-color:#bce8f1}.panel-info>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#bce8f1}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.05);box-shadow:inset 0 1px 1px rgba(0,0,0,0.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,0.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:bold;line-height:1;color:#000;text-shadow:0 1px 0 #fff;opacity:.2;filter:alpha(opacity=20)}.close:hover,.close:focus{color:#000;text-decoration:none;cursor:pointer;opacity:.5;filter:alpha(opacity=50)}button.close{padding:0;cursor:pointer;background:transparent;border:0;-webkit-appearance:none}.modal-open{overflow:hidden}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;display:none;overflow:auto;overflow-y:scroll}.modal.fade .modal-dialog{-webkit-transform:translate(0,-25%);-ms-transform:translate(0,-25%);transform:translate(0,-25%);-webkit-transition:-webkit-transform .3s ease-out;-moz-transition:-moz-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out}.modal.in .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);transform:translate(0,0)}.modal-dialog{position:relative;z-index:1050;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;border:1px solid #999;border:1px solid rgba(0,0,0,0.2);border-radius:6px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,0.5);box-shadow:0 3px 9px rgba(0,0,0,0.5);background-clip:padding-box}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1030;background-color:#000}.modal-backdrop.fade{opacity:0;filter:alpha(opacity=0)}.modal-backdrop.in{opacity:.5;filter:alpha(opacity=50)}.modal-header{min-height:16.428571429px;padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.428571429}.modal-body{position:relative;padding:20px}.modal-footer{padding:19px 20px 20px;margin-top:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer:before,.modal-footer:after{display:table;content:" "}.modal-footer:after{clear:both}.modal-footer:before,.modal-footer:after{display:table;content:" "}.modal-footer:after{clear:both}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}@media screen and (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,0.5);box-shadow:0 5px 15px rgba(0,0,0,0.5)}}.tooltip{position:absolute;z-index:1030;display:block;font-size:12px;line-height:1.4;opacity:0;filter:alpha(opacity=0);visibility:visible}.tooltip.in{opacity:.9;filter:alpha(opacity=90)}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-top-color:#000;border-width:5px 5px 0}.tooltip.top-left .tooltip-arrow{bottom:0;left:5px;border-top-color:#000;border-width:5px 5px 0}.tooltip.top-right .tooltip-arrow{right:5px;bottom:0;border-top-color:#000;border-width:5px 5px 0}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-right-color:#000;border-width:5px 5px 5px 0}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-left-color:#000;border-width:5px 0 5px 5px}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-bottom-color:#000;border-width:0 5px 5px}.tooltip.bottom-left .tooltip-arrow{top:0;left:5px;border-bottom-color:#000;border-width:0 5px 5px}.tooltip.bottom-right .tooltip-arrow{top:0;right:5px;border-bottom-color:#000;border-width:0 5px 5px}.popover{position:absolute;top:0;left:0;z-index:1010;display:none;max-width:276px;padding:1px;text-align:left;white-space:normal;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);box-shadow:0 5px 10px rgba(0,0,0,0.2);background-clip:padding-box}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;font-weight:normal;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover .arrow,.popover .arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover .arrow{border-width:11px}.popover .arrow:after{border-width:10px;content:""}.popover.top .arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,0.25);border-bottom-width:0}.popover.top .arrow:after{bottom:1px;margin-left:-10px;border-top-color:#fff;border-bottom-width:0;content:" "}.popover.right .arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,0.25);border-left-width:0}.popover.right .arrow:after{bottom:-10px;left:1px;border-right-color:#fff;border-left-width:0;content:" "}.popover.bottom .arrow{top:-11px;left:50%;margin-left:-11px;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,0.25);border-top-width:0}.popover.bottom .arrow:after{top:1px;margin-left:-10px;border-bottom-color:#fff;border-top-width:0;content:" "}.popover.left .arrow{top:50%;right:-11px;margin-top:-11px;border-left-color:#999;border-left-color:rgba(0,0,0,0.25);border-right-width:0}.popover.left .arrow:after{right:1px;bottom:-10px;border-left-color:#fff;border-right-width:0;content:" "}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>img,.carousel-inner>.item>a>img{display:block;height:auto;max-width:100%;line-height:1}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;bottom:0;left:0;width:15%;font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,0.6);opacity:.5;filter:alpha(opacity=50)}.carousel-control.left{background-image:-webkit-linear-gradient(left,color-stop(rgba(0,0,0,0.5) 0),color-stop(rgba(0,0,0,0.0001) 100%));background-image:linear-gradient(to right,rgba(0,0,0,0.5) 0,rgba(0,0,0,0.0001) 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000',endColorstr='#00000000',GradientType=1)}.carousel-control.right{right:0;left:auto;background-image:-webkit-linear-gradient(left,color-stop(rgba(0,0,0,0.0001) 0),color-stop(rgba(0,0,0,0.5) 100%));background-image:linear-gradient(to right,rgba(0,0,0,0.0001) 0,rgba(0,0,0,0.5) 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000',endColorstr='#80000000',GradientType=1)}.carousel-control:hover,.carousel-control:focus{color:#fff;text-decoration:none;outline:0;opacity:.9;filter:alpha(opacity=90)}.carousel-control .icon-prev,.carousel-control .icon-next,.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right{position:absolute;top:50%;z-index:5;display:inline-block}.carousel-control .icon-prev,.carousel-control .glyphicon-chevron-left{left:50%}.carousel-control .icon-next,.carousel-control .glyphicon-chevron-right{right:50%}.carousel-control .icon-prev,.carousel-control .icon-next{width:20px;height:20px;margin-top:-10px;margin-left:-10px;font-family:serif}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;padding-left:0;margin-left:-30%;text-align:center;list-style:none}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000 \9;background-color:rgba(0,0,0,0);border:1px solid #fff;border-radius:10px}.carousel-indicators .active{width:12px;height:12px;margin:0;background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,0.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicons-chevron-left,.carousel-control .glyphicons-chevron-right,.carousel-control .icon-prev,.carousel-control .icon-next{width:30px;height:30px;margin-top:-15px;margin-left:-15px;font-size:30px}.carousel-caption{right:20%;left:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.clearfix:before,.clearfix:after{display:table;content:" "}.clearfix:after{clear:both}.center-block{display:block;margin-right:auto;margin-left:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important;visibility:hidden!important}.affix{position:fixed}@-ms-viewport{width:device-width}.visible-xs,tr.visible-xs,th.visible-xs,td.visible-xs{display:none!important}@media(max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table}tr.visible-xs{display:table-row!important}th.visible-xs,td.visible-xs{display:table-cell!important}}@media(min-width:768px) and (max-width:991px){.visible-xs.visible-sm{display:block!important}table.visible-xs.visible-sm{display:table}tr.visible-xs.visible-sm{display:table-row!important}th.visible-xs.visible-sm,td.visible-xs.visible-sm{display:table-cell!important}}@media(min-width:992px) and (max-width:1199px){.visible-xs.visible-md{display:block!important}table.visible-xs.visible-md{display:table}tr.visible-xs.visible-md{display:table-row!important}th.visible-xs.visible-md,td.visible-xs.visible-md{display:table-cell!important}}@media(min-width:1200px){.visible-xs.visible-lg{display:block!important}table.visible-xs.visible-lg{display:table}tr.visible-xs.visible-lg{display:table-row!important}th.visible-xs.visible-lg,td.visible-xs.visible-lg{display:table-cell!important}}.visible-sm,tr.visible-sm,th.visible-sm,td.visible-sm{display:none!important}@media(max-width:767px){.visible-sm.visible-xs{display:block!important}table.visible-sm.visible-xs{display:table}tr.visible-sm.visible-xs{display:table-row!important}th.visible-sm.visible-xs,td.visible-sm.visible-xs{display:table-cell!important}}@media(min-width:768px) and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table}tr.visible-sm{display:table-row!important}th.visible-sm,td.visible-sm{display:table-cell!important}}@media(min-width:992px) and (max-width:1199px){.visible-sm.visible-md{display:block!important}table.visible-sm.visible-md{display:table}tr.visible-sm.visible-md{display:table-row!important}th.visible-sm.visible-md,td.visible-sm.visible-md{display:table-cell!important}}@media(min-width:1200px){.visible-sm.visible-lg{display:block!important}table.visible-sm.visible-lg{display:table}tr.visible-sm.visible-lg{display:table-row!important}th.visible-sm.visible-lg,td.visible-sm.visible-lg{display:table-cell!important}}.visible-md,tr.visible-md,th.visible-md,td.visible-md{display:none!important}@media(max-width:767px){.visible-md.visible-xs{display:block!important}table.visible-md.visible-xs{display:table}tr.visible-md.visible-xs{display:table-row!important}th.visible-md.visible-xs,td.visible-md.visible-xs{display:table-cell!important}}@media(min-width:768px) and (max-width:991px){.visible-md.visible-sm{display:block!important}table.visible-md.visible-sm{display:table}tr.visible-md.visible-sm{display:table-row!important}th.visible-md.visible-sm,td.visible-md.visible-sm{display:table-cell!important}}@media(min-width:992px) and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table}tr.visible-md{display:table-row!important}th.visible-md,td.visible-md{display:table-cell!important}}@media(min-width:1200px){.visible-md.visible-lg{display:block!important}table.visible-md.visible-lg{display:table}tr.visible-md.visible-lg{display:table-row!important}th.visible-md.visible-lg,td.visible-md.visible-lg{display:table-cell!important}}.visible-lg,tr.visible-lg,th.visible-lg,td.visible-lg{display:none!important}@media(max-width:767px){.visible-lg.visible-xs{display:block!important}table.visible-lg.visible-xs{display:table}tr.visible-lg.visible-xs{display:table-row!important}th.visible-lg.visible-xs,td.visible-lg.visible-xs{display:table-cell!important}}@media(min-width:768px) and (max-width:991px){.visible-lg.visible-sm{display:block!important}table.visible-lg.visible-sm{display:table}tr.visible-lg.visible-sm{display:table-row!important}th.visible-lg.visible-sm,td.visible-lg.visible-sm{display:table-cell!important}}@media(min-width:992px) and (max-width:1199px){.visible-lg.visible-md{display:block!important}table.visible-lg.visible-md{display:table}tr.visible-lg.visible-md{display:table-row!important}th.visible-lg.visible-md,td.visible-lg.visible-md{display:table-cell!important}}@media(min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table}tr.visible-lg{display:table-row!important}th.visible-lg,td.visible-lg{display:table-cell!important}}.hidden-xs{display:block!important}table.hidden-xs{display:table}tr.hidden-xs{display:table-row!important}th.hidden-xs,td.hidden-xs{display:table-cell!important}@media(max-width:767px){.hidden-xs,tr.hidden-xs,th.hidden-xs,td.hidden-xs{display:none!important}}@media(min-width:768px) and (max-width:991px){.hidden-xs.hidden-sm,tr.hidden-xs.hidden-sm,th.hidden-xs.hidden-sm,td.hidden-xs.hidden-sm{display:none!important}}@media(min-width:992px) and (max-width:1199px){.hidden-xs.hidden-md,tr.hidden-xs.hidden-md,th.hidden-xs.hidden-md,td.hidden-xs.hidden-md{display:none!important}}@media(min-width:1200px){.hidden-xs.hidden-lg,tr.hidden-xs.hidden-lg,th.hidden-xs.hidden-lg,td.hidden-xs.hidden-lg{display:none!important}}.hidden-sm{display:block!important}table.hidden-sm{display:table}tr.hidden-sm{display:table-row!important}th.hidden-sm,td.hidden-sm{display:table-cell!important}@media(max-width:767px){.hidden-sm.hidden-xs,tr.hidden-sm.hidden-xs,th.hidden-sm.hidden-xs,td.hidden-sm.hidden-xs{display:none!important}}@media(min-width:768px) and (max-width:991px){.hidden-sm,tr.hidden-sm,th.hidden-sm,td.hidden-sm{display:none!important}}@media(min-width:992px) and (max-width:1199px){.hidden-sm.hidden-md,tr.hidden-sm.hidden-md,th.hidden-sm.hidden-md,td.hidden-sm.hidden-md{display:none!important}}@media(min-width:1200px){.hidden-sm.hidden-lg,tr.hidden-sm.hidden-lg,th.hidden-sm.hidden-lg,td.hidden-sm.hidden-lg{display:none!important}}.hidden-md{display:block!important}table.hidden-md{display:table}tr.hidden-md{display:table-row!important}th.hidden-md,td.hidden-md{display:table-cell!important}@media(max-width:767px){.hidden-md.hidden-xs,tr.hidden-md.hidden-xs,th.hidden-md.hidden-xs,td.hidden-md.hidden-xs{display:none!important}}@media(min-width:768px) and (max-width:991px){.hidden-md.hidden-sm,tr.hidden-md.hidden-sm,th.hidden-md.hidden-sm,td.hidden-md.hidden-sm{display:none!important}}@media(min-width:992px) and (max-width:1199px){.hidden-md,tr.hidden-md,th.hidden-md,td.hidden-md{display:none!important}}@media(min-width:1200px){.hidden-md.hidden-lg,tr.hidden-md.hidden-lg,th.hidden-md.hidden-lg,td.hidden-md.hidden-lg{display:none!important}}.hidden-lg{display:block!important}table.hidden-lg{display:table}tr.hidden-lg{display:table-row!important}th.hidden-lg,td.hidden-lg{display:table-cell!important}@media(max-width:767px){.hidden-lg.hidden-xs,tr.hidden-lg.hidden-xs,th.hidden-lg.hidden-xs,td.hidden-lg.hidden-xs{display:none!important}}@media(min-width:768px) and (max-width:991px){.hidden-lg.hidden-sm,tr.hidden-lg.hidden-sm,th.hidden-lg.hidden-sm,td.hidden-lg.hidden-sm{display:none!important}}@media(min-width:992px) and (max-width:1199px){.hidden-lg.hidden-md,tr.hidden-lg.hidden-md,th.hidden-lg.hidden-md,td.hidden-lg.hidden-md{display:none!important}}@media(min-width:1200px){.hidden-lg,tr.hidden-lg,th.hidden-lg,td.hidden-lg{display:none!important}}.visible-print,tr.visible-print,th.visible-print,td.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table}tr.visible-print{display:table-row!important}th.visible-print,td.visible-print{display:table-cell!important}.hidden-print,tr.hidden-print,th.hidden-print,td.hidden-print{display:none!important}} \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/css/font-awesome.min.css b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/css/font-awesome.min.css deleted file mode 100644 index 540440ce..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/css/font-awesome.min.css +++ /dev/null @@ -1,4 +0,0 @@ -/*! - * Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome - * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) - */@font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.eot?v=4.7.0');src:url('../fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'),url('../fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'),url('../fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'),url('../fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left{margin-right:.3em}.fa.fa-pull-right{margin-left:.3em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scale(-1, 1);-ms-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";-webkit-transform:scale(1, -1);-ms-transform:scale(1, -1);transform:scale(1, -1)}:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-flip-horizontal,:root .fa-flip-vertical{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-remove:before,.fa-close:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-gear:before,.fa-cog:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-rotate-right:before,.fa-repeat:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-gears:before,.fa-cogs:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-feed:before,.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-save:before,.fa-floppy-o:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-unsorted:before,.fa-sort:before{content:"\f0dc"}.fa-sort-down:before,.fa-sort-desc:before{content:"\f0dd"}.fa-sort-up:before,.fa-sort-asc:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-legal:before,.fa-gavel:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-flash:before,.fa-bolt:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-paste:before,.fa-clipboard:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-unlink:before,.fa-chain-broken:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"}.fa-euro:before,.fa-eur:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-rupee:before,.fa-inr:before{content:"\f156"}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"}.fa-won:before,.fa-krw:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-turkish-lira:before,.fa-try:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-institution:before,.fa-bank:before,.fa-university:before{content:"\f19c"}.fa-mortar-board:before,.fa-graduation-cap:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:"\f1c5"}.fa-file-zip-o:before,.fa-file-archive-o:before{content:"\f1c6"}.fa-file-sound-o:before,.fa-file-audio-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-resistance:before,.fa-rebel:before{content:"\f1d0"}.fa-ge:before,.fa-empire:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-y-combinator-square:before,.fa-yc-square:before,.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-send:before,.fa-paper-plane:before{content:"\f1d8"}.fa-send-o:before,.fa-paper-plane-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-soccer-ball-o:before,.fa-futbol-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-shekel:before,.fa-sheqel:before,.fa-ils:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-intersex:before,.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-genderless:before{content:"\f22d"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-hotel:before,.fa-bed:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}.fa-yc:before,.fa-y-combinator:before{content:"\f23b"}.fa-optin-monster:before{content:"\f23c"}.fa-opencart:before{content:"\f23d"}.fa-expeditedssl:before{content:"\f23e"}.fa-battery-4:before,.fa-battery:before,.fa-battery-full:before{content:"\f240"}.fa-battery-3:before,.fa-battery-three-quarters:before{content:"\f241"}.fa-battery-2:before,.fa-battery-half:before{content:"\f242"}.fa-battery-1:before,.fa-battery-quarter:before{content:"\f243"}.fa-battery-0:before,.fa-battery-empty:before{content:"\f244"}.fa-mouse-pointer:before{content:"\f245"}.fa-i-cursor:before{content:"\f246"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-sticky-note:before{content:"\f249"}.fa-sticky-note-o:before{content:"\f24a"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-diners-club:before{content:"\f24c"}.fa-clone:before{content:"\f24d"}.fa-balance-scale:before{content:"\f24e"}.fa-hourglass-o:before{content:"\f250"}.fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"}.fa-hourglass-2:before,.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"}.fa-hourglass:before{content:"\f254"}.fa-hand-grab-o:before,.fa-hand-rock-o:before{content:"\f255"}.fa-hand-stop-o:before,.fa-hand-paper-o:before{content:"\f256"}.fa-hand-scissors-o:before{content:"\f257"}.fa-hand-lizard-o:before{content:"\f258"}.fa-hand-spock-o:before{content:"\f259"}.fa-hand-pointer-o:before{content:"\f25a"}.fa-hand-peace-o:before{content:"\f25b"}.fa-trademark:before{content:"\f25c"}.fa-registered:before{content:"\f25d"}.fa-creative-commons:before{content:"\f25e"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-tripadvisor:before{content:"\f262"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-get-pocket:before{content:"\f265"}.fa-wikipedia-w:before{content:"\f266"}.fa-safari:before{content:"\f267"}.fa-chrome:before{content:"\f268"}.fa-firefox:before{content:"\f269"}.fa-opera:before{content:"\f26a"}.fa-internet-explorer:before{content:"\f26b"}.fa-tv:before,.fa-television:before{content:"\f26c"}.fa-contao:before{content:"\f26d"}.fa-500px:before{content:"\f26e"}.fa-amazon:before{content:"\f270"}.fa-calendar-plus-o:before{content:"\f271"}.fa-calendar-minus-o:before{content:"\f272"}.fa-calendar-times-o:before{content:"\f273"}.fa-calendar-check-o:before{content:"\f274"}.fa-industry:before{content:"\f275"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-map-o:before{content:"\f278"}.fa-map:before{content:"\f279"}.fa-commenting:before{content:"\f27a"}.fa-commenting-o:before{content:"\f27b"}.fa-houzz:before{content:"\f27c"}.fa-vimeo:before{content:"\f27d"}.fa-black-tie:before{content:"\f27e"}.fa-fonticons:before{content:"\f280"}.fa-reddit-alien:before{content:"\f281"}.fa-edge:before{content:"\f282"}.fa-credit-card-alt:before{content:"\f283"}.fa-codiepie:before{content:"\f284"}.fa-modx:before{content:"\f285"}.fa-fort-awesome:before{content:"\f286"}.fa-usb:before{content:"\f287"}.fa-product-hunt:before{content:"\f288"}.fa-mixcloud:before{content:"\f289"}.fa-scribd:before{content:"\f28a"}.fa-pause-circle:before{content:"\f28b"}.fa-pause-circle-o:before{content:"\f28c"}.fa-stop-circle:before{content:"\f28d"}.fa-stop-circle-o:before{content:"\f28e"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-hashtag:before{content:"\f292"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-percent:before{content:"\f295"}.fa-gitlab:before{content:"\f296"}.fa-wpbeginner:before{content:"\f297"}.fa-wpforms:before{content:"\f298"}.fa-envira:before{content:"\f299"}.fa-universal-access:before{content:"\f29a"}.fa-wheelchair-alt:before{content:"\f29b"}.fa-question-circle-o:before{content:"\f29c"}.fa-blind:before{content:"\f29d"}.fa-audio-description:before{content:"\f29e"}.fa-volume-control-phone:before{content:"\f2a0"}.fa-braille:before{content:"\f2a1"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-asl-interpreting:before,.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-deafness:before,.fa-hard-of-hearing:before,.fa-deaf:before{content:"\f2a4"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-signing:before,.fa-sign-language:before{content:"\f2a7"}.fa-low-vision:before{content:"\f2a8"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-pied-piper:before{content:"\f2ae"}.fa-first-order:before{content:"\f2b0"}.fa-yoast:before{content:"\f2b1"}.fa-themeisle:before{content:"\f2b2"}.fa-google-plus-circle:before,.fa-google-plus-official:before{content:"\f2b3"}.fa-fa:before,.fa-font-awesome:before{content:"\f2b4"}.fa-handshake-o:before{content:"\f2b5"}.fa-envelope-open:before{content:"\f2b6"}.fa-envelope-open-o:before{content:"\f2b7"}.fa-linode:before{content:"\f2b8"}.fa-address-book:before{content:"\f2b9"}.fa-address-book-o:before{content:"\f2ba"}.fa-vcard:before,.fa-address-card:before{content:"\f2bb"}.fa-vcard-o:before,.fa-address-card-o:before{content:"\f2bc"}.fa-user-circle:before{content:"\f2bd"}.fa-user-circle-o:before{content:"\f2be"}.fa-user-o:before{content:"\f2c0"}.fa-id-badge:before{content:"\f2c1"}.fa-drivers-license:before,.fa-id-card:before{content:"\f2c2"}.fa-drivers-license-o:before,.fa-id-card-o:before{content:"\f2c3"}.fa-quora:before{content:"\f2c4"}.fa-free-code-camp:before{content:"\f2c5"}.fa-telegram:before{content:"\f2c6"}.fa-thermometer-4:before,.fa-thermometer:before,.fa-thermometer-full:before{content:"\f2c7"}.fa-thermometer-3:before,.fa-thermometer-three-quarters:before{content:"\f2c8"}.fa-thermometer-2:before,.fa-thermometer-half:before{content:"\f2c9"}.fa-thermometer-1:before,.fa-thermometer-quarter:before{content:"\f2ca"}.fa-thermometer-0:before,.fa-thermometer-empty:before{content:"\f2cb"}.fa-shower:before{content:"\f2cc"}.fa-bathtub:before,.fa-s15:before,.fa-bath:before{content:"\f2cd"}.fa-podcast:before{content:"\f2ce"}.fa-window-maximize:before{content:"\f2d0"}.fa-window-minimize:before{content:"\f2d1"}.fa-window-restore:before{content:"\f2d2"}.fa-times-rectangle:before,.fa-window-close:before{content:"\f2d3"}.fa-times-rectangle-o:before,.fa-window-close-o:before{content:"\f2d4"}.fa-bandcamp:before{content:"\f2d5"}.fa-grav:before{content:"\f2d6"}.fa-etsy:before{content:"\f2d7"}.fa-imdb:before{content:"\f2d8"}.fa-ravelry:before{content:"\f2d9"}.fa-eercast:before{content:"\f2da"}.fa-microchip:before{content:"\f2db"}.fa-snowflake-o:before{content:"\f2dc"}.fa-superpowers:before{content:"\f2dd"}.fa-wpexplorer:before{content:"\f2de"}.fa-meetup:before{content:"\f2e0"}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto} diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/fonts/fontawesome-webfont.ttf b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/fonts/fontawesome-webfont.ttf deleted file mode 100644 index 35acda2f..00000000 Binary files a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/fonts/fontawesome-webfont.ttf and /dev/null differ diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/fonts/fontawesome-webfont.woff b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/fonts/fontawesome-webfont.woff deleted file mode 100644 index 400014a4..00000000 Binary files a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/fonts/fontawesome-webfont.woff and /dev/null differ diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/fonts/fontawesome-webfont.woff2 b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/fonts/fontawesome-webfont.woff2 deleted file mode 100644 index 4d13fc60..00000000 Binary files a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/fonts/fontawesome-webfont.woff2 and /dev/null differ diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/fonts/glyphicons-halflings-regular.ttf b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/fonts/glyphicons-halflings-regular.ttf deleted file mode 100644 index a498ef4e..00000000 Binary files a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/fonts/glyphicons-halflings-regular.ttf and /dev/null differ diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/fonts/glyphicons-halflings-regular.woff b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/fonts/glyphicons-halflings-regular.woff deleted file mode 100644 index d83c539b..00000000 Binary files a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/fonts/glyphicons-halflings-regular.woff and /dev/null differ diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/js/angular.min.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/js/angular.min.js deleted file mode 100644 index b4f9b07e..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/js/angular.min.js +++ /dev/null @@ -1,295 +0,0 @@ -/* - AngularJS v1.4.8 - (c) 2010-2015 Google, Inc. http://angularjs.org - License: MIT -*/ -(function(S,X,u){'use strict';function G(a){return function(){var b=arguments[0],d;d="["+(a?a+":":"")+b+"] http://errors.angularjs.org/1.4.8/"+(a?a+"/":"")+b;for(b=1;b").append(a).html();try{return a[0].nodeType===Na?F(d):d.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,function(a,b){return"<"+F(b)})}catch(c){return F(d)}}function wc(a){try{return decodeURIComponent(a)}catch(b){}} -function xc(a){var b={};n((a||"").split("&"),function(a){var c,e,f;a&&(e=a=a.replace(/\+/g,"%20"),c=a.indexOf("="),-1!==c&&(e=a.substring(0,c),f=a.substring(c+1)),e=wc(e),y(e)&&(f=y(f)?wc(f):!0,qa.call(b,e)?I(b[e])?b[e].push(f):b[e]=[b[e],f]:b[e]=f))});return b}function Qb(a){var b=[];n(a,function(a,c){I(a)?n(a,function(a){b.push(ja(c,!0)+(!0===a?"":"="+ja(a,!0)))}):b.push(ja(c,!0)+(!0===a?"":"="+ja(a,!0)))});return b.length?b.join("&"):""}function ob(a){return ja(a,!0).replace(/%26/gi,"&").replace(/%3D/gi, -"=").replace(/%2B/gi,"+")}function ja(a,b){return encodeURIComponent(a).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,b?"%20":"+")}function Yd(a,b){var d,c,e=Oa.length;for(c=0;c/,">"));}b=b||[];b.unshift(["$provide",function(b){b.value("$rootElement",a)}]);d.debugInfoEnabled&&b.push(["$compileProvider",function(a){a.debugInfoEnabled(!0)}]);b.unshift("ng");c=eb(b,d.strictDi);c.invoke(["$rootScope", -"$rootElement","$compile","$injector",function(a,b,c,d){a.$apply(function(){b.data("$injector",d);c(b)(a)})}]);return c},e=/^NG_ENABLE_DEBUG_INFO!/,f=/^NG_DEFER_BOOTSTRAP!/;S&&e.test(S.name)&&(d.debugInfoEnabled=!0,S.name=S.name.replace(e,""));if(S&&!f.test(S.name))return c();S.name=S.name.replace(f,"");fa.resumeBootstrap=function(a){n(a,function(a){b.push(a)});return c()};z(fa.resumeDeferredBootstrap)&&fa.resumeDeferredBootstrap()}function $d(){S.name="NG_ENABLE_DEBUG_INFO!"+S.name;S.location.reload()} -function ae(a){a=fa.element(a).injector();if(!a)throw Aa("test");return a.get("$$testability")}function zc(a,b){b=b||"_";return a.replace(be,function(a,c){return(c?b:"")+a.toLowerCase()})}function ce(){var a;if(!Ac){var b=pb();(oa=q(b)?S.jQuery:b?S[b]:u)&&oa.fn.on?(B=oa,M(oa.fn,{scope:Pa.scope,isolateScope:Pa.isolateScope,controller:Pa.controller,injector:Pa.injector,inheritedData:Pa.inheritedData}),a=oa.cleanData,oa.cleanData=function(b){var c;if(Rb)Rb=!1;else for(var e=0,f;null!=(f=b[e]);e++)(c= -oa._data(f,"events"))&&c.$destroy&&oa(f).triggerHandler("$destroy");a(b)}):B=N;fa.element=B;Ac=!0}}function qb(a,b,d){if(!a)throw Aa("areq",b||"?",d||"required");return a}function Qa(a,b,d){d&&I(a)&&(a=a[a.length-1]);qb(z(a),b,"not a function, got "+(a&&"object"===typeof a?a.constructor.name||"Object":typeof a));return a}function Ra(a,b){if("hasOwnProperty"===a)throw Aa("badname",b);}function Bc(a,b,d){if(!b)return a;b=b.split(".");for(var c,e=a,f=b.length,g=0;g")+c[2];for(c=c[0];c--;)d=d.lastChild;f=cb(f,d.childNodes);d=e.firstChild;d.textContent=""}else f.push(b.createTextNode(a));e.textContent="";e.innerHTML="";n(f,function(a){e.appendChild(a)});return e}function N(a){if(a instanceof N)return a;var b;E(a)&&(a=U(a), -b=!0);if(!(this instanceof N)){if(b&&"<"!=a.charAt(0))throw Ub("nosel");return new N(a)}if(b){b=X;var d;a=(d=Ef.exec(a))?[b.createElement(d[1])]:(d=Lc(a,b))?d.childNodes:[]}Mc(this,a)}function Vb(a){return a.cloneNode(!0)}function ub(a,b){b||vb(a);if(a.querySelectorAll)for(var d=a.querySelectorAll("*"),c=0,e=d.length;cl&&this.remove(t.key);return b}},get:function(a){if(l").parent()[0])});var f=O(a,b,a,c,d,e);K.$$addScopeClass(a);var g=null;return function(b,c,d){qb(b,"scope");e&&e.needsNewScope&&(b=b.$parent.$new());d=d||{};var h=d.parentBoundTranscludeFn,k=d.transcludeControllers;d=d.futureParentElement;h&&h.$$boundTransclude&&(h=h.$$boundTransclude);g||(g=(d= -d&&d[0])?"foreignobject"!==ta(d)&&d.toString().match(/SVG/)?"svg":"html":"html");d="html"!==g?B(Yb(g,B("
    ").append(a).html())):c?Pa.clone.call(a):a;if(k)for(var l in k)d.data("$"+l+"Controller",k[l].instance);K.$$addScopeInfo(d,b);c&&c(d,b);f&&f(b,d,d,h);return d}}function O(a,b,c,d,e,f){function g(a,c,d,e){var f,k,l,m,t,w,D;if(p)for(D=Array(c.length),m=0;mq.priority)break;if(P=q.scope)q.templateUrl||(H(P)?(Ua("new/isolated scope",O||R,q,Z),O=q):Ua("new/isolated scope",O,q,Z)),R=R||q;x=q.name;!q.templateUrl&&q.controller&&(P=q.controller,T=T||$(),Ua("'"+x+"' controller",T[x],q,Z),T[x]=q);if(P=q.transclude)ga=!0,q.$$tlb||(Ua("transclusion",n,q,Z),n=q),"element"==P?(aa=!0,A=q.priority,P=Z,Z=d.$$element=B(X.createComment(" "+x+": "+d[x]+" ")),b=Z[0],Y(f,ra.call(P,0), -b),Ia=K(P,e,A,g&&g.name,{nonTlbTranscludeDirective:n})):(P=B(Vb(b)).contents(),Z.empty(),Ia=K(P,e,u,u,{needsNewScope:q.$$isolateScope||q.$$newScope}));if(q.template)if(L=!0,Ua("template",J,q,Z),J=q,P=z(q.template)?q.template(Z,d):q.template,P=ja(P),q.replace){g=q;P=Tb.test(P)?Xc(Yb(q.templateNamespace,U(P))):[];b=P[0];if(1!=P.length||1!==b.nodeType)throw ha("tplrt",x,"");Y(f,Z,b);P={$attr:{}};var Wc=V(b,[],P),W=a.splice(F+1,a.length-(F+1));(O||R)&&y(Wc,O,R);a=a.concat(Wc).concat(W);S(d,P);M=a.length}else Z.html(P); -if(q.templateUrl)L=!0,Ua("template",J,q,Z),J=q,q.replace&&(g=q),D=Of(a.splice(F,a.length-F),Z,d,f,ga&&Ia,h,l,{controllerDirectives:T,newScopeDirective:R!==q&&R,newIsolateScopeDirective:O,templateDirective:J,nonTlbTranscludeDirective:n}),M=a.length;else if(q.compile)try{G=q.compile(Z,d,Ia),z(G)?t(null,G,N,Q):G&&t(G.pre,G.post,N,Q)}catch(da){c(da,ua(Z))}q.terminal&&(D.terminal=!0,A=Math.max(A,q.priority))}D.scope=R&&!0===R.scope;D.transcludeOnThisElement=ga;D.templateOnThisElement=L;D.transclude=Ia; -m.hasElementTranscludeDirective=aa;return D}function y(a,b,c){for(var d=0,e=a.length;dm.priority)&&-1!=m.restrict.indexOf(f)&&(k&&(m=Ob(m,{$$start:k,$$end:l})),b.push(m),h=m)}catch(D){c(D)}}return h}function G(b){if(e.hasOwnProperty(b))for(var c=a.get(b+"Directive"),d=0,f=c.length;d"+b+"";return c.childNodes[0].childNodes;default:return b}}function Q(a,b){if("srcdoc"==b)return L.HTML;var c=ta(a);if("xlinkHref"==b||"form"==c&&"action"==b||"img"!=c&&("src"==b||"ngSrc"==b))return L.RESOURCE_URL}function W(a,c,d,e,f){var g=Q(a,e);f=h[e]||f;var k=b(d,!0,g,f);if(k){if("multiple"===e&&"select"===ta(a))throw ha("selmulti",ua(a));c.push({priority:100,compile:function(){return{pre:function(a,c,h){c=h.$$observers||(h.$$observers=$());if(l.test(e))throw ha("nodomevents"); -var m=h[e];m!==d&&(k=m&&b(m,!0,g,f),d=m);k&&(h[e]=k(a),(c[e]||(c[e]=[])).$$inter=!0,(h.$$observers&&h.$$observers[e].$$scope||a).$watch(k,function(a,b){"class"===e&&a!=b?h.$updateClass(a,b):h.$set(e,a)}))}}}})}}function Y(a,b,c){var d=b[0],e=b.length,f=d.parentNode,g,h;if(a)for(g=0,h=a.length;g=b)return a;for(;b--;)8===a[b].nodeType&&Pf.call(a,b,1);return a}function Xe(){var a={},b=!1;this.register=function(b,c){Ra(b,"controller");H(b)?M(a,b):a[b]=c};this.allowGlobals=function(){b=!0};this.$get=["$injector","$window",function(d,c){function e(a,b,c,d){if(!a||!H(a.$scope))throw G("$controller")("noscp", -d,b);a.$scope[b]=c}return function(f,g,h,k){var l,m,r;h=!0===h;k&&E(k)&&(r=k);if(E(f)){k=f.match(Uc);if(!k)throw Qf("ctrlfmt",f);m=k[1];r=r||k[3];f=a.hasOwnProperty(m)?a[m]:Bc(g.$scope,m,!0)||(b?Bc(c,m,!0):u);Qa(f,m,!0)}if(h)return h=(I(f)?f[f.length-1]:f).prototype,l=Object.create(h||null),r&&e(g,r,l,m||f.name),M(function(){var a=d.invoke(f,l,g,m);a!==l&&(H(a)||z(a))&&(l=a,r&&e(g,r,l,m||f.name));return l},{instance:l,identifier:r});l=d.instantiate(f,g,m);r&&e(g,r,l,m||f.name);return l}}]}function Ye(){this.$get= -["$window",function(a){return B(a.document)}]}function Ze(){this.$get=["$log",function(a){return function(b,d){a.error.apply(a,arguments)}}]}function Zb(a){return H(a)?da(a)?a.toISOString():db(a):a}function df(){this.$get=function(){return function(a){if(!a)return"";var b=[];oc(a,function(a,c){null===a||q(a)||(I(a)?n(a,function(a,d){b.push(ja(c)+"="+ja(Zb(a)))}):b.push(ja(c)+"="+ja(Zb(a))))});return b.join("&")}}}function ef(){this.$get=function(){return function(a){function b(a,e,f){null===a||q(a)|| -(I(a)?n(a,function(a,c){b(a,e+"["+(H(a)?c:"")+"]")}):H(a)&&!da(a)?oc(a,function(a,c){b(a,e+(f?"":"[")+c+(f?"":"]"))}):d.push(ja(e)+"="+ja(Zb(a))))}if(!a)return"";var d=[];b(a,"",!0);return d.join("&")}}}function $b(a,b){if(E(a)){var d=a.replace(Rf,"").trim();if(d){var c=b("Content-Type");(c=c&&0===c.indexOf($c))||(c=(c=d.match(Sf))&&Tf[c[0]].test(d));c&&(a=uc(d))}}return a}function ad(a){var b=$(),d;E(a)?n(a.split("\n"),function(a){d=a.indexOf(":");var e=F(U(a.substr(0,d)));a=U(a.substr(d+1));e&& -(b[e]=b[e]?b[e]+", "+a:a)}):H(a)&&n(a,function(a,d){var f=F(d),g=U(a);f&&(b[f]=b[f]?b[f]+", "+g:g)});return b}function bd(a){var b;return function(d){b||(b=ad(a));return d?(d=b[F(d)],void 0===d&&(d=null),d):b}}function cd(a,b,d,c){if(z(c))return c(a,b,d);n(c,function(c){a=c(a,b,d)});return a}function cf(){var a=this.defaults={transformResponse:[$b],transformRequest:[function(a){return H(a)&&"[object File]"!==sa.call(a)&&"[object Blob]"!==sa.call(a)&&"[object FormData]"!==sa.call(a)?db(a):a}],headers:{common:{Accept:"application/json, text/plain, */*"}, -post:ia(ac),put:ia(ac),patch:ia(ac)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",paramSerializer:"$httpParamSerializer"},b=!1;this.useApplyAsync=function(a){return y(a)?(b=!!a,this):b};var d=!0;this.useLegacyPromiseExtensions=function(a){return y(a)?(d=!!a,this):d};var c=this.interceptors=[];this.$get=["$httpBackend","$$cookieReader","$cacheFactory","$rootScope","$q","$injector",function(e,f,g,h,k,l){function m(b){function c(a){var b=M({},a);b.data=cd(a.data,a.headers,a.status,f.transformResponse); -a=a.status;return 200<=a&&300>a?b:k.reject(b)}function e(a,b){var c,d={};n(a,function(a,e){z(a)?(c=a(b),null!=c&&(d[e]=c)):d[e]=a});return d}if(!fa.isObject(b))throw G("$http")("badreq",b);var f=M({method:"get",transformRequest:a.transformRequest,transformResponse:a.transformResponse,paramSerializer:a.paramSerializer},b);f.headers=function(b){var c=a.headers,d=M({},b.headers),f,g,h,c=M({},c.common,c[F(b.method)]);a:for(f in c){g=F(f);for(h in d)if(F(h)===g)continue a;d[f]=c[f]}return e(d,ia(b))}(b); -f.method=sb(f.method);f.paramSerializer=E(f.paramSerializer)?l.get(f.paramSerializer):f.paramSerializer;var g=[function(b){var d=b.headers,e=cd(b.data,bd(d),u,b.transformRequest);q(e)&&n(d,function(a,b){"content-type"===F(b)&&delete d[b]});q(b.withCredentials)&&!q(a.withCredentials)&&(b.withCredentials=a.withCredentials);return r(b,e).then(c,c)},u],h=k.when(f);for(n(v,function(a){(a.request||a.requestError)&&g.unshift(a.request,a.requestError);(a.response||a.responseError)&&g.push(a.response,a.responseError)});g.length;){b= -g.shift();var m=g.shift(),h=h.then(b,m)}d?(h.success=function(a){Qa(a,"fn");h.then(function(b){a(b.data,b.status,b.headers,f)});return h},h.error=function(a){Qa(a,"fn");h.then(null,function(b){a(b.data,b.status,b.headers,f)});return h}):(h.success=dd("success"),h.error=dd("error"));return h}function r(c,d){function g(a,c,d,e){function f(){l(c,a,d,e)}J&&(200<=a&&300>a?J.put(R,[a,c,ad(d),e]):J.remove(R));b?h.$applyAsync(f):(f(),h.$$phase||h.$apply())}function l(a,b,d,e){b=-1<=b?b:0;(200<=b&&300>b?n.resolve: -n.reject)({data:a,status:b,headers:bd(d),config:c,statusText:e})}function r(a){l(a.data,a.status,ia(a.headers()),a.statusText)}function v(){var a=m.pendingRequests.indexOf(c);-1!==a&&m.pendingRequests.splice(a,1)}var n=k.defer(),D=n.promise,J,K,O=c.headers,R=t(c.url,c.paramSerializer(c.params));m.pendingRequests.push(c);D.then(v,v);!c.cache&&!a.cache||!1===c.cache||"GET"!==c.method&&"JSONP"!==c.method||(J=H(c.cache)?c.cache:H(a.cache)?a.cache:A);J&&(K=J.get(R),y(K)?K&&z(K.then)?K.then(r,r):I(K)?l(K[1], -K[0],ia(K[2]),K[3]):l(K,200,{},"OK"):J.put(R,D));q(K)&&((K=ed(c.url)?f()[c.xsrfCookieName||a.xsrfCookieName]:u)&&(O[c.xsrfHeaderName||a.xsrfHeaderName]=K),e(c.method,R,d,g,O,c.timeout,c.withCredentials,c.responseType));return D}function t(a,b){0=k&&(p.resolve(v),A(C.$$intervalId),delete f[C.$$intervalId]);n||a.$apply()},h);f[C.$$intervalId]=p;return C}var f={};e.cancel=function(a){return a&&a.$$intervalId in f?(f[a.$$intervalId].reject("canceled"),b.clearInterval(a.$$intervalId),delete f[a.$$intervalId],!0):!1};return e}]}function bc(a){a=a.split("/");for(var b=a.length;b--;)a[b]=ob(a[b]);return a.join("/")}function fd(a,b){var d=wa(a);b.$$protocol=d.protocol;b.$$host=d.hostname;b.$$port=ea(d.port)||Vf[d.protocol]|| -null}function gd(a,b){var d="/"!==a.charAt(0);d&&(a="/"+a);var c=wa(a);b.$$path=decodeURIComponent(d&&"/"===c.pathname.charAt(0)?c.pathname.substring(1):c.pathname);b.$$search=xc(c.search);b.$$hash=decodeURIComponent(c.hash);b.$$path&&"/"!=b.$$path.charAt(0)&&(b.$$path="/"+b.$$path)}function pa(a,b){if(0===b.indexOf(a))return b.substr(a.length)}function Fa(a){var b=a.indexOf("#");return-1==b?a:a.substr(0,b)}function ib(a){return a.replace(/(#.+)|#$/,"$1")}function cc(a,b,d){this.$$html5=!0;d=d||""; -fd(a,this);this.$$parse=function(a){var d=pa(b,a);if(!E(d))throw Db("ipthprfx",a,b);gd(d,this);this.$$path||(this.$$path="/");this.$$compose()};this.$$compose=function(){var a=Qb(this.$$search),d=this.$$hash?"#"+ob(this.$$hash):"";this.$$url=bc(this.$$path)+(a?"?"+a:"")+d;this.$$absUrl=b+this.$$url.substr(1)};this.$$parseLinkUrl=function(c,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;y(f=pa(a,c))?(g=f,g=y(f=pa(d,f))?b+(pa("/",f)||f):a+g):y(f=pa(b,c))?g=b+f:b==c+"/"&&(g=b);g&&this.$$parse(g); -return!!g}}function dc(a,b,d){fd(a,this);this.$$parse=function(c){var e=pa(a,c)||pa(b,c),f;q(e)||"#"!==e.charAt(0)?this.$$html5?f=e:(f="",q(e)&&(a=c,this.replace())):(f=pa(d,e),q(f)&&(f=e));gd(f,this);c=this.$$path;var e=a,g=/^\/[A-Z]:(\/.*)/;0===f.indexOf(e)&&(f=f.replace(e,""));g.exec(f)||(c=(f=g.exec(c))?f[1]:c);this.$$path=c;this.$$compose()};this.$$compose=function(){var b=Qb(this.$$search),e=this.$$hash?"#"+ob(this.$$hash):"";this.$$url=bc(this.$$path)+(b?"?"+b:"")+e;this.$$absUrl=a+(this.$$url? -d+this.$$url:"")};this.$$parseLinkUrl=function(b,d){return Fa(a)==Fa(b)?(this.$$parse(b),!0):!1}}function hd(a,b,d){this.$$html5=!0;dc.apply(this,arguments);this.$$parseLinkUrl=function(c,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;a==Fa(c)?f=c:(g=pa(b,c))?f=a+d+g:b===c+"/"&&(f=b);f&&this.$$parse(f);return!!f};this.$$compose=function(){var b=Qb(this.$$search),e=this.$$hash?"#"+ob(this.$$hash):"";this.$$url=bc(this.$$path)+(b?"?"+b:"")+e;this.$$absUrl=a+d+this.$$url}}function Eb(a){return function(){return this[a]}} -function id(a,b){return function(d){if(q(d))return this[a];this[a]=b(d);this.$$compose();return this}}function hf(){var a="",b={enabled:!1,requireBase:!0,rewriteLinks:!0};this.hashPrefix=function(b){return y(b)?(a=b,this):a};this.html5Mode=function(a){return $a(a)?(b.enabled=a,this):H(a)?($a(a.enabled)&&(b.enabled=a.enabled),$a(a.requireBase)&&(b.requireBase=a.requireBase),$a(a.rewriteLinks)&&(b.rewriteLinks=a.rewriteLinks),this):b};this.$get=["$rootScope","$browser","$sniffer","$rootElement","$window", -function(d,c,e,f,g){function h(a,b,d){var e=l.url(),f=l.$$state;try{c.url(a,b,d),l.$$state=c.state()}catch(g){throw l.url(e),l.$$state=f,g;}}function k(a,b){d.$broadcast("$locationChangeSuccess",l.absUrl(),a,l.$$state,b)}var l,m;m=c.baseHref();var r=c.url(),t;if(b.enabled){if(!m&&b.requireBase)throw Db("nobase");t=r.substring(0,r.indexOf("/",r.indexOf("//")+2))+(m||"/");m=e.history?cc:hd}else t=Fa(r),m=dc;var A=t.substr(0,Fa(t).lastIndexOf("/")+1);l=new m(t,A,"#"+a);l.$$parseLinkUrl(r,r);l.$$state= -c.state();var v=/^\s*(javascript|mailto):/i;f.on("click",function(a){if(b.rewriteLinks&&!a.ctrlKey&&!a.metaKey&&!a.shiftKey&&2!=a.which&&2!=a.button){for(var e=B(a.target);"a"!==ta(e[0]);)if(e[0]===f[0]||!(e=e.parent())[0])return;var h=e.prop("href"),k=e.attr("href")||e.attr("xlink:href");H(h)&&"[object SVGAnimatedString]"===h.toString()&&(h=wa(h.animVal).href);v.test(h)||!h||e.attr("target")||a.isDefaultPrevented()||!l.$$parseLinkUrl(h,k)||(a.preventDefault(),l.absUrl()!=c.url()&&(d.$apply(),g.angular["ff-684208-preventDefault"]= -!0))}});ib(l.absUrl())!=ib(r)&&c.url(l.absUrl(),!0);var n=!0;c.onUrlChange(function(a,b){q(pa(A,a))?g.location.href=a:(d.$evalAsync(function(){var c=l.absUrl(),e=l.$$state,f;a=ib(a);l.$$parse(a);l.$$state=b;f=d.$broadcast("$locationChangeStart",a,c,b,e).defaultPrevented;l.absUrl()===a&&(f?(l.$$parse(c),l.$$state=e,h(c,!1,e)):(n=!1,k(c,e)))}),d.$$phase||d.$digest())});d.$watch(function(){var a=ib(c.url()),b=ib(l.absUrl()),f=c.state(),g=l.$$replace,m=a!==b||l.$$html5&&e.history&&f!==l.$$state;if(n|| -m)n=!1,d.$evalAsync(function(){var b=l.absUrl(),c=d.$broadcast("$locationChangeStart",b,a,l.$$state,f).defaultPrevented;l.absUrl()===b&&(c?(l.$$parse(a),l.$$state=f):(m&&h(b,g,f===l.$$state?null:l.$$state),k(a,f)))});l.$$replace=!1});return l}]}function jf(){var a=!0,b=this;this.debugEnabled=function(b){return y(b)?(a=b,this):a};this.$get=["$window",function(d){function c(a){a instanceof Error&&(a.stack?a=a.message&&-1===a.stack.indexOf(a.message)?"Error: "+a.message+"\n"+a.stack:a.stack:a.sourceURL&& -(a=a.message+"\n"+a.sourceURL+":"+a.line));return a}function e(a){var b=d.console||{},e=b[a]||b.log||x;a=!1;try{a=!!e.apply}catch(k){}return a?function(){var a=[];n(arguments,function(b){a.push(c(b))});return e.apply(b,a)}:function(a,b){e(a,null==b?"":b)}}return{log:e("log"),info:e("info"),warn:e("warn"),error:e("error"),debug:function(){var c=e("debug");return function(){a&&c.apply(b,arguments)}}()}}]}function Va(a,b){if("__defineGetter__"===a||"__defineSetter__"===a||"__lookupGetter__"===a||"__lookupSetter__"=== -a||"__proto__"===a)throw ba("isecfld",b);return a}function jd(a,b){a+="";if(!E(a))throw ba("iseccst",b);return a}function xa(a,b){if(a){if(a.constructor===a)throw ba("isecfn",b);if(a.window===a)throw ba("isecwindow",b);if(a.children&&(a.nodeName||a.prop&&a.attr&&a.find))throw ba("isecdom",b);if(a===Object)throw ba("isecobj",b);}return a}function kd(a,b){if(a){if(a.constructor===a)throw ba("isecfn",b);if(a===Wf||a===Xf||a===Yf)throw ba("isecff",b);}}function ld(a,b){if(a&&(a===(0).constructor||a=== -(!1).constructor||a==="".constructor||a==={}.constructor||a===[].constructor||a===Function.constructor))throw ba("isecaf",b);}function Zf(a,b){return"undefined"!==typeof a?a:b}function md(a,b){return"undefined"===typeof a?b:"undefined"===typeof b?a:a+b}function W(a,b){var d,c;switch(a.type){case s.Program:d=!0;n(a.body,function(a){W(a.expression,b);d=d&&a.expression.constant});a.constant=d;break;case s.Literal:a.constant=!0;a.toWatch=[];break;case s.UnaryExpression:W(a.argument,b);a.constant=a.argument.constant; -a.toWatch=a.argument.toWatch;break;case s.BinaryExpression:W(a.left,b);W(a.right,b);a.constant=a.left.constant&&a.right.constant;a.toWatch=a.left.toWatch.concat(a.right.toWatch);break;case s.LogicalExpression:W(a.left,b);W(a.right,b);a.constant=a.left.constant&&a.right.constant;a.toWatch=a.constant?[]:[a];break;case s.ConditionalExpression:W(a.test,b);W(a.alternate,b);W(a.consequent,b);a.constant=a.test.constant&&a.alternate.constant&&a.consequent.constant;a.toWatch=a.constant?[]:[a];break;case s.Identifier:a.constant= -!1;a.toWatch=[a];break;case s.MemberExpression:W(a.object,b);a.computed&&W(a.property,b);a.constant=a.object.constant&&(!a.computed||a.property.constant);a.toWatch=[a];break;case s.CallExpression:d=a.filter?!b(a.callee.name).$stateful:!1;c=[];n(a.arguments,function(a){W(a,b);d=d&&a.constant;a.constant||c.push.apply(c,a.toWatch)});a.constant=d;a.toWatch=a.filter&&!b(a.callee.name).$stateful?c:[a];break;case s.AssignmentExpression:W(a.left,b);W(a.right,b);a.constant=a.left.constant&&a.right.constant; -a.toWatch=[a];break;case s.ArrayExpression:d=!0;c=[];n(a.elements,function(a){W(a,b);d=d&&a.constant;a.constant||c.push.apply(c,a.toWatch)});a.constant=d;a.toWatch=c;break;case s.ObjectExpression:d=!0;c=[];n(a.properties,function(a){W(a.value,b);d=d&&a.value.constant;a.value.constant||c.push.apply(c,a.value.toWatch)});a.constant=d;a.toWatch=c;break;case s.ThisExpression:a.constant=!1,a.toWatch=[]}}function nd(a){if(1==a.length){a=a[0].expression;var b=a.toWatch;return 1!==b.length?b:b[0]!==a?b:u}} -function od(a){return a.type===s.Identifier||a.type===s.MemberExpression}function pd(a){if(1===a.body.length&&od(a.body[0].expression))return{type:s.AssignmentExpression,left:a.body[0].expression,right:{type:s.NGValueParameter},operator:"="}}function qd(a){return 0===a.body.length||1===a.body.length&&(a.body[0].expression.type===s.Literal||a.body[0].expression.type===s.ArrayExpression||a.body[0].expression.type===s.ObjectExpression)}function rd(a,b){this.astBuilder=a;this.$filter=b}function sd(a, -b){this.astBuilder=a;this.$filter=b}function Fb(a){return"constructor"==a}function ec(a){return z(a.valueOf)?a.valueOf():$f.call(a)}function kf(){var a=$(),b=$();this.$get=["$filter",function(d){function c(a,b){return null==a||null==b?a===b:"object"===typeof a&&(a=ec(a),"object"===typeof a)?!1:a===b||a!==a&&b!==b}function e(a,b,d,e,f){var g=e.inputs,h;if(1===g.length){var k=c,g=g[0];return a.$watch(function(a){var b=g(a);c(b,k)||(h=e(a,u,u,[b]),k=b&&ec(b));return h},b,d,f)}for(var l=[],m=[],r=0,n= -g.length;r=this.promise.$$state.status&&d&&d.length&&a(function(){for(var a,e,f=0,g=d.length;fa)for(b in l++,f)qa.call(e,b)||(n--,delete f[b])}else f!==e&&(f=e,l++);return l}}c.$stateful=!0;var d=this,e,f,g,k=1n&&(v=4-n,q[v]||(q[v]=[]),q[v].push({msg:z(a.exp)?"fn: "+(a.exp.name||a.exp.toString()):a.exp,newVal:f,oldVal:h}));else if(a===c){r=!1;break a}}catch(y){g(y)}if(!(l=A.$$watchersCount&&A.$$childHead||A!==this&&A.$$nextSibling))for(;A!==this&&!(l=A.$$nextSibling);)A=A.$parent}while(A=l);if((r||u.length)&&!n--)throw w.$$phase=null,d("infdig", -b,q);}while(r||u.length);for(w.$$phase=null;L.length;)try{L.shift()()}catch(x){g(x)}},$destroy:function(){if(!this.$$destroyed){var a=this.$parent;this.$broadcast("$destroy");this.$$destroyed=!0;this===w&&k.$$applicationDestroyed();A(this,-this.$$watchersCount);for(var b in this.$$listenerCount)v(this,this.$$listenerCount[b],b);a&&a.$$childHead==this&&(a.$$childHead=this.$$nextSibling);a&&a.$$childTail==this&&(a.$$childTail=this.$$prevSibling);this.$$prevSibling&&(this.$$prevSibling.$$nextSibling= -this.$$nextSibling);this.$$nextSibling&&(this.$$nextSibling.$$prevSibling=this.$$prevSibling);this.$destroy=this.$digest=this.$apply=this.$evalAsync=this.$applyAsync=x;this.$on=this.$watch=this.$watchGroup=function(){return x};this.$$listeners={};this.$$nextSibling=null;m(this)}},$eval:function(a,b){return h(a)(this,b)},$evalAsync:function(a,b){w.$$phase||u.length||k.defer(function(){u.length&&w.$digest()});u.push({scope:this,expression:a,locals:b})},$$postDigest:function(a){L.push(a)},$apply:function(a){try{t("$apply"); -try{return this.$eval(a)}finally{w.$$phase=null}}catch(b){g(b)}finally{try{w.$digest()}catch(c){throw g(c),c;}}},$applyAsync:function(a){function b(){c.$eval(a)}var c=this;a&&aa.push(b);C()},$on:function(a,b){var c=this.$$listeners[a];c||(this.$$listeners[a]=c=[]);c.push(b);var d=this;do d.$$listenerCount[a]||(d.$$listenerCount[a]=0),d.$$listenerCount[a]++;while(d=d.$parent);var e=this;return function(){var d=c.indexOf(b);-1!==d&&(c[d]=null,v(e,1,a))}},$emit:function(a,b){var c=[],d,e=this,f=!1,h= -{name:a,targetScope:e,stopPropagation:function(){f=!0},preventDefault:function(){h.defaultPrevented=!0},defaultPrevented:!1},k=cb([h],arguments,1),l,m;do{d=e.$$listeners[a]||c;h.currentScope=e;l=0;for(m=d.length;lHa)throw ya("iequirks");var c=ia(la);c.isEnabled=function(){return a};c.trustAs=d.trustAs;c.getTrusted=d.getTrusted;c.valueOf=d.valueOf;a||(c.trustAs=c.getTrusted=function(a,b){return b},c.valueOf=Ya);c.parseAs=function(a,d){var e=b(d);return e.literal&&e.constant?e:b(d,function(b){return c.getTrusted(a,b)})};var e=c.parseAs,f=c.getTrusted,g=c.trustAs;n(la,function(a, -b){var d=F(b);c[fb("parse_as_"+d)]=function(b){return e(a,b)};c[fb("get_trusted_"+d)]=function(b){return f(a,b)};c[fb("trust_as_"+d)]=function(b){return g(a,b)}});return c}]}function qf(){this.$get=["$window","$document",function(a,b){var d={},c=ea((/android (\d+)/.exec(F((a.navigator||{}).userAgent))||[])[1]),e=/Boxee/i.test((a.navigator||{}).userAgent),f=b[0]||{},g,h=/^(Moz|webkit|ms)(?=[A-Z])/,k=f.body&&f.body.style,l=!1,m=!1;if(k){for(var r in k)if(l=h.exec(r)){g=l[0];g=g.substr(0,1).toUpperCase()+ -g.substr(1);break}g||(g="WebkitOpacity"in k&&"webkit");l=!!("transition"in k||g+"Transition"in k);m=!!("animation"in k||g+"Animation"in k);!c||l&&m||(l=E(k.webkitTransition),m=E(k.webkitAnimation))}return{history:!(!a.history||!a.history.pushState||4>c||e),hasEvent:function(a){if("input"===a&&11>=Ha)return!1;if(q(d[a])){var b=f.createElement("div");d[a]="on"+a in b}return d[a]},csp:Ba(),vendorPrefix:g,transitions:l,animations:m,android:c}}]}function sf(){this.$get=["$templateCache","$http","$q","$sce", -function(a,b,d,c){function e(f,g){e.totalPendingRequests++;E(f)&&a.get(f)||(f=c.getTrustedResourceUrl(f));var h=b.defaults&&b.defaults.transformResponse;I(h)?h=h.filter(function(a){return a!==$b}):h===$b&&(h=null);return b.get(f,{cache:a,transformResponse:h})["finally"](function(){e.totalPendingRequests--}).then(function(b){a.put(f,b.data);return b.data},function(a){if(!g)throw ha("tpload",f,a.status,a.statusText);return d.reject(a)})}e.totalPendingRequests=0;return e}]}function tf(){this.$get=["$rootScope", -"$browser","$location",function(a,b,d){return{findBindings:function(a,b,d){a=a.getElementsByClassName("ng-binding");var g=[];n(a,function(a){var c=fa.element(a).data("$binding");c&&n(c,function(c){d?(new RegExp("(^|\\s)"+ud(b)+"(\\s|\\||$)")).test(c)&&g.push(a):-1!=c.indexOf(b)&&g.push(a)})});return g},findModels:function(a,b,d){for(var g=["ng-","data-ng-","ng\\:"],h=0;ha;a=Math.abs(a);var g=Infinity===a;if(!g&&!isFinite(a))return"";var h=a+"",k="",l=!1,m=[];g&&(k="\u221e");if(!g&&-1!==h.indexOf("e")){var r=h.match(/([\d\.]+)e(-?)(\d+)/);r&&"-"==r[2]&&r[3]>e+1?a=0:(k=h,l=!0)}if(g||l)0a&&(k=a.toFixed(e),a=parseFloat(k),k=k.replace(ic,c));else{g=(h.split(ic)[1]||"").length; -q(e)&&(e=Math.min(Math.max(b.minFrac,g),b.maxFrac));a=+(Math.round(+(a.toString()+"e"+e)).toString()+"e"+-e);var g=(""+a).split(ic),h=g[0],g=g[1]||"",r=0,t=b.lgSize,n=b.gSize;if(h.length>=t+n)for(r=h.length-t,l=0;la&&(c="-",a=-a);for(a=""+a;a.length-d)e+=d;0===e&&-12==d&&(e=12);return Gb(e,b,c)}}function Hb(a,b){return function(d,c){var e=d["get"+a](),f=sb(b?"SHORT"+a:a);return c[f][e]}}function Dd(a){var b=(new Date(a,0,1)).getDay();return new Date(a,0,(4>=b?5:12)-b)}function Ed(a){return function(b){var d=Dd(b.getFullYear());b=+new Date(b.getFullYear(),b.getMonth(),b.getDate()+(4-b.getDay()))- -+d;b=1+Math.round(b/6048E5);return Gb(b,a)}}function jc(a,b){return 0>=a.getFullYear()?b.ERAS[0]:b.ERAS[1]}function zd(a){function b(a){var b;if(b=a.match(d)){a=new Date(0);var f=0,g=0,h=b[8]?a.setUTCFullYear:a.setFullYear,k=b[8]?a.setUTCHours:a.setHours;b[9]&&(f=ea(b[9]+b[10]),g=ea(b[9]+b[11]));h.call(a,ea(b[1]),ea(b[2])-1,ea(b[3]));f=ea(b[4]||0)-f;g=ea(b[5]||0)-g;h=ea(b[6]||0);b=Math.round(1E3*parseFloat("0."+(b[7]||0)));k.call(a,f,g,h,b)}return a}var d=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/; -return function(c,d,f){var g="",h=[],k,l;d=d||"mediumDate";d=a.DATETIME_FORMATS[d]||d;E(c)&&(c=hg.test(c)?ea(c):b(c));Q(c)&&(c=new Date(c));if(!da(c)||!isFinite(c.getTime()))return c;for(;d;)(l=ig.exec(d))?(h=cb(h,l,1),d=h.pop()):(h.push(d),d=null);var m=c.getTimezoneOffset();f&&(m=vc(f,c.getTimezoneOffset()),c=Pb(c,f,!0));n(h,function(b){k=jg[b];g+=k?k(c,a.DATETIME_FORMATS,m):b.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return g}}function cg(){return function(a,b){q(b)&&(b=2);return db(a,b)}}function dg(){return function(a, -b,d){b=Infinity===Math.abs(Number(b))?Number(b):ea(b);if(isNaN(b))return a;Q(a)&&(a=a.toString());if(!I(a)&&!E(a))return a;d=!d||isNaN(d)?0:ea(d);d=0>d?Math.max(0,a.length+d):d;return 0<=b?a.slice(d,d+b):0===d?a.slice(b,a.length):a.slice(Math.max(0,d+b),d)}}function Bd(a){function b(b,d){d=d?-1:1;return b.map(function(b){var c=1,h=Ya;if(z(b))h=b;else if(E(b)){if("+"==b.charAt(0)||"-"==b.charAt(0))c="-"==b.charAt(0)?-1:1,b=b.substring(1);if(""!==b&&(h=a(b),h.constant))var k=h(),h=function(a){return a[k]}}return{get:h, -descending:c*d}})}function d(a){switch(typeof a){case "number":case "boolean":case "string":return!0;default:return!1}}return function(a,e,f){if(!za(a))return a;I(e)||(e=[e]);0===e.length&&(e=["+"]);var g=b(e,f);g.push({get:function(){return{}},descending:f?-1:1});a=Array.prototype.map.call(a,function(a,b){return{value:a,predicateValues:g.map(function(c){var e=c.get(a);c=typeof e;if(null===e)c="string",e="null";else if("string"===c)e=e.toLowerCase();else if("object"===c)a:{if("function"===typeof e.valueOf&& -(e=e.valueOf(),d(e)))break a;if(qc(e)&&(e=e.toString(),d(e)))break a;e=b}return{value:e,type:c}})}});a.sort(function(a,b){for(var c=0,d=0,e=g.length;db||37<=b&&40>=b||m(a,this,this.value)});if(e.hasEvent("paste"))b.on("paste cut", -m)}b.on("change",k);c.$render=function(){var a=c.$isEmpty(c.$viewValue)?"":c.$viewValue;b.val()!==a&&b.val(a)}}function Kb(a,b){return function(d,c){var e,f;if(da(d))return d;if(E(d)){'"'==d.charAt(0)&&'"'==d.charAt(d.length-1)&&(d=d.substring(1,d.length-1));if(kg.test(d))return new Date(d);a.lastIndex=0;if(e=a.exec(d))return e.shift(),f=c?{yyyy:c.getFullYear(),MM:c.getMonth()+1,dd:c.getDate(),HH:c.getHours(),mm:c.getMinutes(),ss:c.getSeconds(),sss:c.getMilliseconds()/1E3}:{yyyy:1970,MM:1,dd:1,HH:0, -mm:0,ss:0,sss:0},n(e,function(a,c){c=s};g.$observe("min",function(a){s=n(a);h.$validate()})}if(y(g.max)||g.ngMax){var p;h.$validators.max=function(a){return!r(a)||q(p)||d(a)<=p};g.$observe("max",function(a){p=n(a);h.$validate()})}}}function Hd(a,b,d,c){(c.$$hasNativeValidators=H(b[0].validity))&&c.$parsers.push(function(a){var c=b.prop("validity")||{}; -return c.badInput&&!c.typeMismatch?u:a})}function Id(a,b,d,c,e){if(y(c)){a=a(c);if(!a.constant)throw lb("constexpr",d,c);return a(b)}return e}function lc(a,b){a="ngClass"+a;return["$animate",function(d){function c(a,b){var c=[],d=0;a:for(;d(?:<\/\1>|)$/,Tb=/<|&#?\w+;/, -Cf=/<([\w:-]+)/,Df=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,ka={option:[1,'"],thead:[1,"
    ","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};ka.optgroup=ka.option;ka.tbody=ka.tfoot=ka.colgroup=ka.caption=ka.thead;ka.th=ka.td;var Kf=Node.prototype.contains||function(a){return!!(this.compareDocumentPosition(a)& -16)},Pa=N.prototype={ready:function(a){function b(){d||(d=!0,a())}var d=!1;"complete"===X.readyState?setTimeout(b):(this.on("DOMContentLoaded",b),N(S).on("load",b))},toString:function(){var a=[];n(this,function(b){a.push(""+b)});return"["+a.join(", ")+"]"},eq:function(a){return 0<=a?B(this[a]):B(this[this.length+a])},length:0,push:mg,sort:[].sort,splice:[].splice},Cb={};n("multiple selected checked disabled readOnly required open".split(" "),function(a){Cb[F(a)]=a});var Rc={};n("input select option textarea button form details".split(" "), -function(a){Rc[a]=!0});var Zc={ngMinlength:"minlength",ngMaxlength:"maxlength",ngMin:"min",ngMax:"max",ngPattern:"pattern"};n({data:Wb,removeData:vb,hasData:function(a){for(var b in gb[a.ng339])return!0;return!1}},function(a,b){N[b]=a});n({data:Wb,inheritedData:Bb,scope:function(a){return B.data(a,"$scope")||Bb(a.parentNode||a,["$isolateScope","$scope"])},isolateScope:function(a){return B.data(a,"$isolateScope")||B.data(a,"$isolateScopeNoTemplate")},controller:Oc,injector:function(a){return Bb(a, -"$injector")},removeAttr:function(a,b){a.removeAttribute(b)},hasClass:yb,css:function(a,b,d){b=fb(b);if(y(d))a.style[b]=d;else return a.style[b]},attr:function(a,b,d){var c=a.nodeType;if(c!==Na&&2!==c&&8!==c)if(c=F(b),Cb[c])if(y(d))d?(a[b]=!0,a.setAttribute(b,c)):(a[b]=!1,a.removeAttribute(c));else return a[b]||(a.attributes.getNamedItem(b)||x).specified?c:u;else if(y(d))a.setAttribute(b,d);else if(a.getAttribute)return a=a.getAttribute(b,2),null===a?u:a},prop:function(a,b,d){if(y(d))a[b]=d;else return a[b]}, -text:function(){function a(a,d){if(q(d)){var c=a.nodeType;return 1===c||c===Na?a.textContent:""}a.textContent=d}a.$dv="";return a}(),val:function(a,b){if(q(b)){if(a.multiple&&"select"===ta(a)){var d=[];n(a.options,function(a){a.selected&&d.push(a.value||a.text)});return 0===d.length?null:d}return a.value}a.value=b},html:function(a,b){if(q(b))return a.innerHTML;ub(a,!0);a.innerHTML=b},empty:Pc},function(a,b){N.prototype[b]=function(b,c){var e,f,g=this.length;if(a!==Pc&&q(2==a.length&&a!==yb&&a!==Oc? -b:c)){if(H(b)){for(e=0;e <= >= && || ! = |".split(" "),function(a){Lb[a]=!0});var sg={n:"\n",f:"\f",r:"\r", -t:"\t",v:"\v","'":"'",'"':'"'},fc=function(a){this.options=a};fc.prototype={constructor:fc,lex:function(a){this.text=a;this.index=0;for(this.tokens=[];this.index=a&&"string"===typeof a},isWhitespace:function(a){return" "===a||"\r"===a|| -"\t"===a||"\n"===a||"\v"===a||"\u00a0"===a},isIdent:function(a){return"a"<=a&&"z">=a||"A"<=a&&"Z">=a||"_"===a||"$"===a},isExpOperator:function(a){return"-"===a||"+"===a||this.isNumber(a)},throwError:function(a,b,d){d=d||this.index;b=y(b)?"s "+b+"-"+this.index+" ["+this.text.substring(b,d)+"]":" "+d;throw ba("lexerr",a,b,this.text);},readNumber:function(){for(var a="",b=this.index;this.index","<=",">=");)a={type:s.BinaryExpression,operator:b.text,left:a,right:this.additive()};return a},additive:function(){for(var a=this.multiplicative(),b;b=this.expect("+","-");)a={type:s.BinaryExpression,operator:b.text,left:a,right:this.multiplicative()};return a},multiplicative:function(){for(var a=this.unary(),b;b=this.expect("*","/","%");)a={type:s.BinaryExpression,operator:b.text, -left:a,right:this.unary()};return a},unary:function(){var a;return(a=this.expect("+","-","!"))?{type:s.UnaryExpression,operator:a.text,prefix:!0,argument:this.unary()}:this.primary()},primary:function(){var a;this.expect("(")?(a=this.filterChain(),this.consume(")")):this.expect("[")?a=this.arrayDeclaration():this.expect("{")?a=this.object():this.constants.hasOwnProperty(this.peek().text)?a=bb(this.constants[this.consume().text]):this.peek().identifier?a=this.identifier():this.peek().constant?a=this.constant(): -this.throwError("not a primary expression",this.peek());for(var b;b=this.expect("(","[",".");)"("===b.text?(a={type:s.CallExpression,callee:a,arguments:this.parseArguments()},this.consume(")")):"["===b.text?(a={type:s.MemberExpression,object:a,property:this.expression(),computed:!0},this.consume("]")):"."===b.text?a={type:s.MemberExpression,object:a,property:this.identifier(),computed:!1}:this.throwError("IMPOSSIBLE");return a},filter:function(a){a=[a];for(var b={type:s.CallExpression,callee:this.identifier(), -arguments:a,filter:!0};this.expect(":");)a.push(this.expression());return b},parseArguments:function(){var a=[];if(")"!==this.peekToken().text){do a.push(this.expression());while(this.expect(","))}return a},identifier:function(){var a=this.consume();a.identifier||this.throwError("is not a valid identifier",a);return{type:s.Identifier,name:a.text}},constant:function(){return{type:s.Literal,value:this.consume().value}},arrayDeclaration:function(){var a=[];if("]"!==this.peekToken().text){do{if(this.peek("]"))break; -a.push(this.expression())}while(this.expect(","))}this.consume("]");return{type:s.ArrayExpression,elements:a}},object:function(){var a=[],b;if("}"!==this.peekToken().text){do{if(this.peek("}"))break;b={type:s.Property,kind:"init"};this.peek().constant?b.key=this.constant():this.peek().identifier?b.key=this.identifier():this.throwError("invalid key",this.peek());this.consume(":");b.value=this.expression();a.push(b)}while(this.expect(","))}this.consume("}");return{type:s.ObjectExpression,properties:a}}, -throwError:function(a,b){throw ba("syntax",b.text,a,b.index+1,this.text,this.text.substring(b.index));},consume:function(a){if(0===this.tokens.length)throw ba("ueoe",this.text);var b=this.expect(a);b||this.throwError("is unexpected, expecting ["+a+"]",this.peek());return b},peekToken:function(){if(0===this.tokens.length)throw ba("ueoe",this.text);return this.tokens[0]},peek:function(a,b,d,c){return this.peekAhead(0,a,b,d,c)},peekAhead:function(a,b,d,c,e){if(this.tokens.length>a){a=this.tokens[a]; -var f=a.text;if(f===b||f===d||f===c||f===e||!(b||d||c||e))return a}return!1},expect:function(a,b,d,c){return(a=this.peek(a,b,d,c))?(this.tokens.shift(),a):!1},constants:{"true":{type:s.Literal,value:!0},"false":{type:s.Literal,value:!1},"null":{type:s.Literal,value:null},undefined:{type:s.Literal,value:u},"this":{type:s.ThisExpression}}};rd.prototype={compile:function(a,b){var d=this,c=this.astBuilder.ast(a);this.state={nextId:0,filters:{},expensiveChecks:b,fn:{vars:[],body:[],own:{}},assign:{vars:[], -body:[],own:{}},inputs:[]};W(c,d.$filter);var e="",f;this.stage="assign";if(f=pd(c))this.state.computing="assign",e=this.nextId(),this.recurse(f,e),this.return_(e),e="fn.assign="+this.generateFunction("assign","s,v,l");f=nd(c.body);d.stage="inputs";n(f,function(a,b){var c="fn"+b;d.state[c]={vars:[],body:[],own:{}};d.state.computing=c;var e=d.nextId();d.recurse(a,e);d.return_(e);d.state.inputs.push(c);a.watchId=b});this.state.computing="fn";this.stage="main";this.recurse(c);e='"'+this.USE+" "+this.STRICT+ -'";\n'+this.filterPrefix()+"var fn="+this.generateFunction("fn","s,l,a,i")+e+this.watchFns()+"return fn;";e=(new Function("$filter","ensureSafeMemberName","ensureSafeObject","ensureSafeFunction","getStringValue","ensureSafeAssignContext","ifDefined","plus","text",e))(this.$filter,Va,xa,kd,jd,ld,Zf,md,a);this.state=this.stage=u;e.literal=qd(c);e.constant=c.constant;return e},USE:"use",STRICT:"strict",watchFns:function(){var a=[],b=this.state.inputs,d=this;n(b,function(b){a.push("var "+b+"="+d.generateFunction(b, -"s"))});b.length&&a.push("fn.inputs=["+b.join(",")+"];");return a.join("")},generateFunction:function(a,b){return"function("+b+"){"+this.varsPrefix(a)+this.body(a)+"};"},filterPrefix:function(){var a=[],b=this;n(this.state.filters,function(d,c){a.push(d+"=$filter("+b.escape(c)+")")});return a.length?"var "+a.join(",")+";":""},varsPrefix:function(a){return this.state[a].vars.length?"var "+this.state[a].vars.join(",")+";":""},body:function(a){return this.state[a].body.join("")},recurse:function(a,b, -d,c,e,f){var g,h,k=this,l,m;c=c||x;if(!f&&y(a.watchId))b=b||this.nextId(),this.if_("i",this.lazyAssign(b,this.computedMember("i",a.watchId)),this.lazyRecurse(a,b,d,c,e,!0));else switch(a.type){case s.Program:n(a.body,function(b,c){k.recurse(b.expression,u,u,function(a){h=a});c!==a.body.length-1?k.current().body.push(h,";"):k.return_(h)});break;case s.Literal:m=this.escape(a.value);this.assign(b,m);c(m);break;case s.UnaryExpression:this.recurse(a.argument,u,u,function(a){h=a});m=a.operator+"("+this.ifDefined(h, -0)+")";this.assign(b,m);c(m);break;case s.BinaryExpression:this.recurse(a.left,u,u,function(a){g=a});this.recurse(a.right,u,u,function(a){h=a});m="+"===a.operator?this.plus(g,h):"-"===a.operator?this.ifDefined(g,0)+a.operator+this.ifDefined(h,0):"("+g+")"+a.operator+"("+h+")";this.assign(b,m);c(m);break;case s.LogicalExpression:b=b||this.nextId();k.recurse(a.left,b);k.if_("&&"===a.operator?b:k.not(b),k.lazyRecurse(a.right,b));c(b);break;case s.ConditionalExpression:b=b||this.nextId();k.recurse(a.test, -b);k.if_(b,k.lazyRecurse(a.alternate,b),k.lazyRecurse(a.consequent,b));c(b);break;case s.Identifier:b=b||this.nextId();d&&(d.context="inputs"===k.stage?"s":this.assign(this.nextId(),this.getHasOwnProperty("l",a.name)+"?l:s"),d.computed=!1,d.name=a.name);Va(a.name);k.if_("inputs"===k.stage||k.not(k.getHasOwnProperty("l",a.name)),function(){k.if_("inputs"===k.stage||"s",function(){e&&1!==e&&k.if_(k.not(k.nonComputedMember("s",a.name)),k.lazyAssign(k.nonComputedMember("s",a.name),"{}"));k.assign(b,k.nonComputedMember("s", -a.name))})},b&&k.lazyAssign(b,k.nonComputedMember("l",a.name)));(k.state.expensiveChecks||Fb(a.name))&&k.addEnsureSafeObject(b);c(b);break;case s.MemberExpression:g=d&&(d.context=this.nextId())||this.nextId();b=b||this.nextId();k.recurse(a.object,g,u,function(){k.if_(k.notNull(g),function(){if(a.computed)h=k.nextId(),k.recurse(a.property,h),k.getStringValue(h),k.addEnsureSafeMemberName(h),e&&1!==e&&k.if_(k.not(k.computedMember(g,h)),k.lazyAssign(k.computedMember(g,h),"{}")),m=k.ensureSafeObject(k.computedMember(g, -h)),k.assign(b,m),d&&(d.computed=!0,d.name=h);else{Va(a.property.name);e&&1!==e&&k.if_(k.not(k.nonComputedMember(g,a.property.name)),k.lazyAssign(k.nonComputedMember(g,a.property.name),"{}"));m=k.nonComputedMember(g,a.property.name);if(k.state.expensiveChecks||Fb(a.property.name))m=k.ensureSafeObject(m);k.assign(b,m);d&&(d.computed=!1,d.name=a.property.name)}},function(){k.assign(b,"undefined")});c(b)},!!e);break;case s.CallExpression:b=b||this.nextId();a.filter?(h=k.filter(a.callee.name),l=[],n(a.arguments, -function(a){var b=k.nextId();k.recurse(a,b);l.push(b)}),m=h+"("+l.join(",")+")",k.assign(b,m),c(b)):(h=k.nextId(),g={},l=[],k.recurse(a.callee,h,g,function(){k.if_(k.notNull(h),function(){k.addEnsureSafeFunction(h);n(a.arguments,function(a){k.recurse(a,k.nextId(),u,function(a){l.push(k.ensureSafeObject(a))})});g.name?(k.state.expensiveChecks||k.addEnsureSafeObject(g.context),m=k.member(g.context,g.name,g.computed)+"("+l.join(",")+")"):m=h+"("+l.join(",")+")";m=k.ensureSafeObject(m);k.assign(b,m)}, -function(){k.assign(b,"undefined")});c(b)}));break;case s.AssignmentExpression:h=this.nextId();g={};if(!od(a.left))throw ba("lval");this.recurse(a.left,u,g,function(){k.if_(k.notNull(g.context),function(){k.recurse(a.right,h);k.addEnsureSafeObject(k.member(g.context,g.name,g.computed));k.addEnsureSafeAssignContext(g.context);m=k.member(g.context,g.name,g.computed)+a.operator+h;k.assign(b,m);c(b||m)})},1);break;case s.ArrayExpression:l=[];n(a.elements,function(a){k.recurse(a,k.nextId(),u,function(a){l.push(a)})}); -m="["+l.join(",")+"]";this.assign(b,m);c(m);break;case s.ObjectExpression:l=[];n(a.properties,function(a){k.recurse(a.value,k.nextId(),u,function(b){l.push(k.escape(a.key.type===s.Identifier?a.key.name:""+a.key.value)+":"+b)})});m="{"+l.join(",")+"}";this.assign(b,m);c(m);break;case s.ThisExpression:this.assign(b,"s");c("s");break;case s.NGValueParameter:this.assign(b,"v"),c("v")}},getHasOwnProperty:function(a,b){var d=a+"."+b,c=this.current().own;c.hasOwnProperty(d)||(c[d]=this.nextId(!1,a+"&&("+ -this.escape(b)+" in "+a+")"));return c[d]},assign:function(a,b){if(a)return this.current().body.push(a,"=",b,";"),a},filter:function(a){this.state.filters.hasOwnProperty(a)||(this.state.filters[a]=this.nextId(!0));return this.state.filters[a]},ifDefined:function(a,b){return"ifDefined("+a+","+this.escape(b)+")"},plus:function(a,b){return"plus("+a+","+b+")"},return_:function(a){this.current().body.push("return ",a,";")},if_:function(a,b,d){if(!0===a)b();else{var c=this.current().body;c.push("if(",a, -"){");b();c.push("}");d&&(c.push("else{"),d(),c.push("}"))}},not:function(a){return"!("+a+")"},notNull:function(a){return a+"!=null"},nonComputedMember:function(a,b){return a+"."+b},computedMember:function(a,b){return a+"["+b+"]"},member:function(a,b,d){return d?this.computedMember(a,b):this.nonComputedMember(a,b)},addEnsureSafeObject:function(a){this.current().body.push(this.ensureSafeObject(a),";")},addEnsureSafeMemberName:function(a){this.current().body.push(this.ensureSafeMemberName(a),";")}, -addEnsureSafeFunction:function(a){this.current().body.push(this.ensureSafeFunction(a),";")},addEnsureSafeAssignContext:function(a){this.current().body.push(this.ensureSafeAssignContext(a),";")},ensureSafeObject:function(a){return"ensureSafeObject("+a+",text)"},ensureSafeMemberName:function(a){return"ensureSafeMemberName("+a+",text)"},ensureSafeFunction:function(a){return"ensureSafeFunction("+a+",text)"},getStringValue:function(a){this.assign(a,"getStringValue("+a+",text)")},ensureSafeAssignContext:function(a){return"ensureSafeAssignContext("+ -a+",text)"},lazyRecurse:function(a,b,d,c,e,f){var g=this;return function(){g.recurse(a,b,d,c,e,f)}},lazyAssign:function(a,b){var d=this;return function(){d.assign(a,b)}},stringEscapeRegex:/[^ a-zA-Z0-9]/g,stringEscapeFn:function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)},escape:function(a){if(E(a))return"'"+a.replace(this.stringEscapeRegex,this.stringEscapeFn)+"'";if(Q(a))return a.toString();if(!0===a)return"true";if(!1===a)return"false";if(null===a)return"null";if("undefined"=== -typeof a)return"undefined";throw ba("esc");},nextId:function(a,b){var d="v"+this.state.nextId++;a||this.current().vars.push(d+(b?"="+b:""));return d},current:function(){return this.state[this.state.computing]}};sd.prototype={compile:function(a,b){var d=this,c=this.astBuilder.ast(a);this.expression=a;this.expensiveChecks=b;W(c,d.$filter);var e,f;if(e=pd(c))f=this.recurse(e);e=nd(c.body);var g;e&&(g=[],n(e,function(a,b){var c=d.recurse(a);a.input=c;g.push(c);a.watchId=b}));var h=[];n(c.body,function(a){h.push(d.recurse(a.expression))}); -e=0===c.body.length?function(){}:1===c.body.length?h[0]:function(a,b){var c;n(h,function(d){c=d(a,b)});return c};f&&(e.assign=function(a,b,c){return f(a,c,b)});g&&(e.inputs=g);e.literal=qd(c);e.constant=c.constant;return e},recurse:function(a,b,d){var c,e,f=this,g;if(a.input)return this.inputs(a.input,a.watchId);switch(a.type){case s.Literal:return this.value(a.value,b);case s.UnaryExpression:return e=this.recurse(a.argument),this["unary"+a.operator](e,b);case s.BinaryExpression:return c=this.recurse(a.left), -e=this.recurse(a.right),this["binary"+a.operator](c,e,b);case s.LogicalExpression:return c=this.recurse(a.left),e=this.recurse(a.right),this["binary"+a.operator](c,e,b);case s.ConditionalExpression:return this["ternary?:"](this.recurse(a.test),this.recurse(a.alternate),this.recurse(a.consequent),b);case s.Identifier:return Va(a.name,f.expression),f.identifier(a.name,f.expensiveChecks||Fb(a.name),b,d,f.expression);case s.MemberExpression:return c=this.recurse(a.object,!1,!!d),a.computed||(Va(a.property.name, -f.expression),e=a.property.name),a.computed&&(e=this.recurse(a.property)),a.computed?this.computedMember(c,e,b,d,f.expression):this.nonComputedMember(c,e,f.expensiveChecks,b,d,f.expression);case s.CallExpression:return g=[],n(a.arguments,function(a){g.push(f.recurse(a))}),a.filter&&(e=this.$filter(a.callee.name)),a.filter||(e=this.recurse(a.callee,!0)),a.filter?function(a,c,d,f){for(var r=[],n=0;n":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)>b(c,e,f,g);return d?{value:c}:c}},"binary<=":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)<=b(c,e,f,g);return d?{value:c}:c}},"binary>=":function(a,b,d){return function(c, -e,f,g){c=a(c,e,f,g)>=b(c,e,f,g);return d?{value:c}:c}},"binary&&":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)&&b(c,e,f,g);return d?{value:c}:c}},"binary||":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)||b(c,e,f,g);return d?{value:c}:c}},"ternary?:":function(a,b,d,c){return function(e,f,g,h){e=a(e,f,g,h)?b(e,f,g,h):d(e,f,g,h);return c?{value:e}:e}},value:function(a,b){return function(){return b?{context:u,name:u,value:a}:a}},identifier:function(a,b,d,c,e){return function(f,g,h,k){f= -g&&a in g?g:f;c&&1!==c&&f&&!f[a]&&(f[a]={});g=f?f[a]:u;b&&xa(g,e);return d?{context:f,name:a,value:g}:g}},computedMember:function(a,b,d,c,e){return function(f,g,h,k){var l=a(f,g,h,k),m,n;null!=l&&(m=b(f,g,h,k),m=jd(m),Va(m,e),c&&1!==c&&l&&!l[m]&&(l[m]={}),n=l[m],xa(n,e));return d?{context:l,name:m,value:n}:n}},nonComputedMember:function(a,b,d,c,e,f){return function(g,h,k,l){g=a(g,h,k,l);e&&1!==e&&g&&!g[b]&&(g[b]={});h=null!=g?g[b]:u;(d||Fb(b))&&xa(h,f);return c?{context:g,name:b,value:h}:h}},inputs:function(a, -b){return function(d,c,e,f){return f?f[b]:a(d,c,e)}}};var gc=function(a,b,d){this.lexer=a;this.$filter=b;this.options=d;this.ast=new s(this.lexer);this.astCompiler=d.csp?new sd(this.ast,b):new rd(this.ast,b)};gc.prototype={constructor:gc,parse:function(a){return this.astCompiler.compile(a,this.options.expensiveChecks)}};$();$();var $f=Object.prototype.valueOf,ya=G("$sce"),la={HTML:"html",CSS:"css",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"},ha=G("$compile"),Y=X.createElement("a"),wd=wa(S.location.href); -xd.$inject=["$document"];Jc.$inject=["$provide"];yd.$inject=["$locale"];Ad.$inject=["$locale"];var ic=".",jg={yyyy:ca("FullYear",4),yy:ca("FullYear",2,0,!0),y:ca("FullYear",1),MMMM:Hb("Month"),MMM:Hb("Month",!0),MM:ca("Month",2,1),M:ca("Month",1,1),dd:ca("Date",2),d:ca("Date",1),HH:ca("Hours",2),H:ca("Hours",1),hh:ca("Hours",2,-12),h:ca("Hours",1,-12),mm:ca("Minutes",2),m:ca("Minutes",1),ss:ca("Seconds",2),s:ca("Seconds",1),sss:ca("Milliseconds",3),EEEE:Hb("Day"),EEE:Hb("Day",!0),a:function(a,b){return 12> -a.getHours()?b.AMPMS[0]:b.AMPMS[1]},Z:function(a,b,d){a=-1*d;return a=(0<=a?"+":"")+(Gb(Math[0=a.getFullYear()?b.ERANAMES[0]:b.ERANAMES[1]}},ig=/((?:[^yMdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z|G+|w+))(.*)/,hg=/^\-?\d+$/;zd.$inject=["$locale"];var eg=na(F),fg=na(sb);Bd.$inject=["$parse"];var he=na({restrict:"E",compile:function(a,b){if(!b.href&&!b.xlinkHref)return function(a, -b){if("a"===b[0].nodeName.toLowerCase()){var e="[object SVGAnimatedString]"===sa.call(b.prop("href"))?"xlink:href":"href";b.on("click",function(a){b.attr(e)||a.preventDefault()})}}}}),tb={};n(Cb,function(a,b){function d(a,d,e){a.$watch(e[c],function(a){e.$set(b,!!a)})}if("multiple"!=a){var c=va("ng-"+b),e=d;"checked"===a&&(e=function(a,b,e){e.ngModel!==e[c]&&d(a,b,e)});tb[c]=function(){return{restrict:"A",priority:100,link:e}}}});n(Zc,function(a,b){tb[b]=function(){return{priority:100,link:function(a, -c,e){if("ngPattern"===b&&"/"==e.ngPattern.charAt(0)&&(c=e.ngPattern.match(lg))){e.$set("ngPattern",new RegExp(c[1],c[2]));return}a.$watch(e[b],function(a){e.$set(b,a)})}}}});n(["src","srcset","href"],function(a){var b=va("ng-"+a);tb[b]=function(){return{priority:99,link:function(d,c,e){var f=a,g=a;"href"===a&&"[object SVGAnimatedString]"===sa.call(c.prop("href"))&&(g="xlinkHref",e.$attr[g]="xlink:href",f=null);e.$observe(b,function(b){b?(e.$set(g,b),Ha&&f&&c.prop(f,e[g])):"href"===a&&e.$set(g,null)})}}}}); -var Ib={$addControl:x,$$renameControl:function(a,b){a.$name=b},$removeControl:x,$setValidity:x,$setDirty:x,$setPristine:x,$setSubmitted:x};Fd.$inject=["$element","$attrs","$scope","$animate","$interpolate"];var Nd=function(a){return["$timeout","$parse",function(b,d){function c(a){return""===a?d('this[""]').assign:d(a).assign||x}return{name:"form",restrict:a?"EAC":"E",require:["form","^^?form"],controller:Fd,compile:function(d,f){d.addClass(Wa).addClass(mb);var g=f.name?"name":a&&f.ngForm?"ngForm": -!1;return{pre:function(a,d,e,f){var n=f[0];if(!("action"in e)){var q=function(b){a.$apply(function(){n.$commitViewValue();n.$setSubmitted()});b.preventDefault()};d[0].addEventListener("submit",q,!1);d.on("$destroy",function(){b(function(){d[0].removeEventListener("submit",q,!1)},0,!1)})}(f[1]||n.$$parentForm).$addControl(n);var s=g?c(n.$name):x;g&&(s(a,n),e.$observe(g,function(b){n.$name!==b&&(s(a,u),n.$$parentForm.$$renameControl(n,b),s=c(n.$name),s(a,n))}));d.on("$destroy",function(){n.$$parentForm.$removeControl(n); -s(a,u);M(n,Ib)})}}}}}]},ie=Nd(),ve=Nd(!0),kg=/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/,tg=/^[A-Za-z][A-Za-z\d.+-]*:\/*(?:\w+(?::\w+)?@)?[^\s/]+(?::\d+)?(?:\/[\w#!:.?+=&%@\-/]*)?$/,ug=/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,vg=/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/,Od=/^(\d{4})-(\d{2})-(\d{2})$/,Pd=/^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,mc=/^(\d{4})-W(\d\d)$/,Qd=/^(\d{4})-(\d\d)$/, -Rd=/^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,Sd={text:function(a,b,d,c,e,f){jb(a,b,d,c,e,f);kc(c)},date:kb("date",Od,Kb(Od,["yyyy","MM","dd"]),"yyyy-MM-dd"),"datetime-local":kb("datetimelocal",Pd,Kb(Pd,"yyyy MM dd HH mm ss sss".split(" ")),"yyyy-MM-ddTHH:mm:ss.sss"),time:kb("time",Rd,Kb(Rd,["HH","mm","ss","sss"]),"HH:mm:ss.sss"),week:kb("week",mc,function(a,b){if(da(a))return a;if(E(a)){mc.lastIndex=0;var d=mc.exec(a);if(d){var c=+d[1],e=+d[2],f=d=0,g=0,h=0,k=Dd(c),e=7*(e-1);b&&(d=b.getHours(),f= -b.getMinutes(),g=b.getSeconds(),h=b.getMilliseconds());return new Date(c,0,k.getDate()+e,d,f,g,h)}}return NaN},"yyyy-Www"),month:kb("month",Qd,Kb(Qd,["yyyy","MM"]),"yyyy-MM"),number:function(a,b,d,c,e,f){Hd(a,b,d,c);jb(a,b,d,c,e,f);c.$$parserName="number";c.$parsers.push(function(a){return c.$isEmpty(a)?null:vg.test(a)?parseFloat(a):u});c.$formatters.push(function(a){if(!c.$isEmpty(a)){if(!Q(a))throw lb("numfmt",a);a=a.toString()}return a});if(y(d.min)||d.ngMin){var g;c.$validators.min=function(a){return c.$isEmpty(a)|| -q(g)||a>=g};d.$observe("min",function(a){y(a)&&!Q(a)&&(a=parseFloat(a,10));g=Q(a)&&!isNaN(a)?a:u;c.$validate()})}if(y(d.max)||d.ngMax){var h;c.$validators.max=function(a){return c.$isEmpty(a)||q(h)||a<=h};d.$observe("max",function(a){y(a)&&!Q(a)&&(a=parseFloat(a,10));h=Q(a)&&!isNaN(a)?a:u;c.$validate()})}},url:function(a,b,d,c,e,f){jb(a,b,d,c,e,f);kc(c);c.$$parserName="url";c.$validators.url=function(a,b){var d=a||b;return c.$isEmpty(d)||tg.test(d)}},email:function(a,b,d,c,e,f){jb(a,b,d,c,e,f);kc(c); -c.$$parserName="email";c.$validators.email=function(a,b){var d=a||b;return c.$isEmpty(d)||ug.test(d)}},radio:function(a,b,d,c){q(d.name)&&b.attr("name",++nb);b.on("click",function(a){b[0].checked&&c.$setViewValue(d.value,a&&a.type)});c.$render=function(){b[0].checked=d.value==c.$viewValue};d.$observe("value",c.$render)},checkbox:function(a,b,d,c,e,f,g,h){var k=Id(h,a,"ngTrueValue",d.ngTrueValue,!0),l=Id(h,a,"ngFalseValue",d.ngFalseValue,!1);b.on("click",function(a){c.$setViewValue(b[0].checked,a&& -a.type)});c.$render=function(){b[0].checked=c.$viewValue};c.$isEmpty=function(a){return!1===a};c.$formatters.push(function(a){return ma(a,k)});c.$parsers.push(function(a){return a?k:l})},hidden:x,button:x,submit:x,reset:x,file:x},Dc=["$browser","$sniffer","$filter","$parse",function(a,b,d,c){return{restrict:"E",require:["?ngModel"],link:{pre:function(e,f,g,h){h[0]&&(Sd[F(g.type)]||Sd.text)(e,f,g,h[0],b,a,d,c)}}}}],wg=/^(true|false|\d+)$/,Ne=function(){return{restrict:"A",priority:100,compile:function(a, -b){return wg.test(b.ngValue)?function(a,b,e){e.$set("value",a.$eval(e.ngValue))}:function(a,b,e){a.$watch(e.ngValue,function(a){e.$set("value",a)})}}}},ne=["$compile",function(a){return{restrict:"AC",compile:function(b){a.$$addBindingClass(b);return function(b,c,e){a.$$addBindingInfo(c,e.ngBind);c=c[0];b.$watch(e.ngBind,function(a){c.textContent=q(a)?"":a})}}}}],pe=["$interpolate","$compile",function(a,b){return{compile:function(d){b.$$addBindingClass(d);return function(c,d,f){c=a(d.attr(f.$attr.ngBindTemplate)); -b.$$addBindingInfo(d,c.expressions);d=d[0];f.$observe("ngBindTemplate",function(a){d.textContent=q(a)?"":a})}}}}],oe=["$sce","$parse","$compile",function(a,b,d){return{restrict:"A",compile:function(c,e){var f=b(e.ngBindHtml),g=b(e.ngBindHtml,function(a){return(a||"").toString()});d.$$addBindingClass(c);return function(b,c,e){d.$$addBindingInfo(c,e.ngBindHtml);b.$watch(g,function(){c.html(a.getTrustedHtml(f(b))||"")})}}}}],Me=na({restrict:"A",require:"ngModel",link:function(a,b,d,c){c.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}), -qe=lc("",!0),se=lc("Odd",0),re=lc("Even",1),te=La({compile:function(a,b){b.$set("ngCloak",u);a.removeClass("ng-cloak")}}),ue=[function(){return{restrict:"A",scope:!0,controller:"@",priority:500}}],Ic={},xg={blur:!0,focus:!0};n("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "),function(a){var b=va("ng-"+a);Ic[b]=["$parse","$rootScope",function(d,c){return{restrict:"A",compile:function(e,f){var g= -d(f[b],null,!0);return function(b,d){d.on(a,function(d){var e=function(){g(b,{$event:d})};xg[a]&&c.$$phase?b.$evalAsync(e):b.$apply(e)})}}}}]});var xe=["$animate",function(a){return{multiElement:!0,transclude:"element",priority:600,terminal:!0,restrict:"A",$$tlb:!0,link:function(b,d,c,e,f){var g,h,k;b.$watch(c.ngIf,function(b){b?h||f(function(b,e){h=e;b[b.length++]=X.createComment(" end ngIf: "+c.ngIf+" ");g={clone:b};a.enter(b,d.parent(),d)}):(k&&(k.remove(),k=null),h&&(h.$destroy(),h=null),g&&(k= -rb(g.clone),a.leave(k).then(function(){k=null}),g=null))})}}}],ye=["$templateRequest","$anchorScroll","$animate",function(a,b,d){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:fa.noop,compile:function(c,e){var f=e.ngInclude||e.src,g=e.onload||"",h=e.autoscroll;return function(c,e,m,n,q){var s=0,v,u,p,C=function(){u&&(u.remove(),u=null);v&&(v.$destroy(),v=null);p&&(d.leave(p).then(function(){u=null}),u=p,p=null)};c.$watch(f,function(f){var m=function(){!y(h)||h&&!c.$eval(h)|| -b()},u=++s;f?(a(f,!0).then(function(a){if(u===s){var b=c.$new();n.template=a;a=q(b,function(a){C();d.enter(a,null,e).then(m)});v=b;p=a;v.$emit("$includeContentLoaded",f);c.$eval(g)}},function(){u===s&&(C(),c.$emit("$includeContentError",f))}),c.$emit("$includeContentRequested",f)):(C(),n.template=null)})}}}}],Pe=["$compile",function(a){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(b,d,c,e){/SVG/.test(d[0].toString())?(d.empty(),a(Lc(e.template,X).childNodes)(b,function(a){d.append(a)}, -{futureParentElement:d})):(d.html(e.template),a(d.contents())(b))}}}],ze=La({priority:450,compile:function(){return{pre:function(a,b,d){a.$eval(d.ngInit)}}}}),Le=function(){return{restrict:"A",priority:100,require:"ngModel",link:function(a,b,d,c){var e=b.attr(d.$attr.ngList)||", ",f="false"!==d.ngTrim,g=f?U(e):e;c.$parsers.push(function(a){if(!q(a)){var b=[];a&&n(a.split(g),function(a){a&&b.push(f?U(a):a)});return b}});c.$formatters.push(function(a){return I(a)?a.join(e):u});c.$isEmpty=function(a){return!a|| -!a.length}}}},mb="ng-valid",Jd="ng-invalid",Wa="ng-pristine",Jb="ng-dirty",Ld="ng-pending",lb=G("ngModel"),yg=["$scope","$exceptionHandler","$attrs","$element","$parse","$animate","$timeout","$rootScope","$q","$interpolate",function(a,b,d,c,e,f,g,h,k,l){this.$modelValue=this.$viewValue=Number.NaN;this.$$rawModelValue=u;this.$validators={};this.$asyncValidators={};this.$parsers=[];this.$formatters=[];this.$viewChangeListeners=[];this.$untouched=!0;this.$touched=!1;this.$pristine=!0;this.$dirty=!1; -this.$valid=!0;this.$invalid=!1;this.$error={};this.$$success={};this.$pending=u;this.$name=l(d.name||"",!1)(a);this.$$parentForm=Ib;var m=e(d.ngModel),r=m.assign,t=m,s=r,v=null,B,p=this;this.$$setOptions=function(a){if((p.$options=a)&&a.getterSetter){var b=e(d.ngModel+"()"),f=e(d.ngModel+"($$$p)");t=function(a){var c=m(a);z(c)&&(c=b(a));return c};s=function(a,b){z(m(a))?f(a,{$$$p:p.$modelValue}):r(a,p.$modelValue)}}else if(!m.assign)throw lb("nonassign",d.ngModel,ua(c));};this.$render=x;this.$isEmpty= -function(a){return q(a)||""===a||null===a||a!==a};var C=0;Gd({ctrl:this,$element:c,set:function(a,b){a[b]=!0},unset:function(a,b){delete a[b]},$animate:f});this.$setPristine=function(){p.$dirty=!1;p.$pristine=!0;f.removeClass(c,Jb);f.addClass(c,Wa)};this.$setDirty=function(){p.$dirty=!0;p.$pristine=!1;f.removeClass(c,Wa);f.addClass(c,Jb);p.$$parentForm.$setDirty()};this.$setUntouched=function(){p.$touched=!1;p.$untouched=!0;f.setClass(c,"ng-untouched","ng-touched")};this.$setTouched=function(){p.$touched= -!0;p.$untouched=!1;f.setClass(c,"ng-touched","ng-untouched")};this.$rollbackViewValue=function(){g.cancel(v);p.$viewValue=p.$$lastCommittedViewValue;p.$render()};this.$validate=function(){if(!Q(p.$modelValue)||!isNaN(p.$modelValue)){var a=p.$$rawModelValue,b=p.$valid,c=p.$modelValue,d=p.$options&&p.$options.allowInvalid;p.$$runValidators(a,p.$$lastCommittedViewValue,function(e){d||b===e||(p.$modelValue=e?a:u,p.$modelValue!==c&&p.$$writeModelToScope())})}};this.$$runValidators=function(a,b,c){function d(){var c= -!0;n(p.$validators,function(d,e){var g=d(a,b);c=c&&g;f(e,g)});return c?!0:(n(p.$asyncValidators,function(a,b){f(b,null)}),!1)}function e(){var c=[],d=!0;n(p.$asyncValidators,function(e,g){var h=e(a,b);if(!h||!z(h.then))throw lb("$asyncValidators",h);f(g,u);c.push(h.then(function(){f(g,!0)},function(a){d=!1;f(g,!1)}))});c.length?k.all(c).then(function(){g(d)},x):g(!0)}function f(a,b){h===C&&p.$setValidity(a,b)}function g(a){h===C&&c(a)}C++;var h=C;(function(){var a=p.$$parserName||"parse";if(q(B))f(a, -null);else return B||(n(p.$validators,function(a,b){f(b,null)}),n(p.$asyncValidators,function(a,b){f(b,null)})),f(a,B),B;return!0})()?d()?e():g(!1):g(!1)};this.$commitViewValue=function(){var a=p.$viewValue;g.cancel(v);if(p.$$lastCommittedViewValue!==a||""===a&&p.$$hasNativeValidators)p.$$lastCommittedViewValue=a,p.$pristine&&this.$setDirty(),this.$$parseAndValidate()};this.$$parseAndValidate=function(){var b=p.$$lastCommittedViewValue;if(B=q(b)?u:!0)for(var c=0;ce||c.$isEmpty(b)||b.length<=e}}}}},Gc=function(){return{restrict:"A",require:"?ngModel",link:function(a,b,d,c){if(c){var e=0;d.$observe("minlength",function(a){e=ea(a)||0;c.$validate()});c.$validators.minlength=function(a,b){return c.$isEmpty(b)||b.length>=e}}}}};S.angular.bootstrap? -console.log("WARNING: Tried to load angular more than once."):(ce(),ee(fa),fa.module("ngLocale",[],["$provide",function(a){function b(a){a+="";var b=a.indexOf(".");return-1==b?0:a.length-b-1}a.value("$locale",{DATETIME_FORMATS:{AMPMS:["AM","PM"],DAY:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),ERANAMES:["Before Christ","Anno Domini"],ERAS:["BC","AD"],FIRSTDAYOFWEEK:6,MONTH:"January February March April May June July August September October November December".split(" "),SHORTDAY:"Sun Mon Tue Wed Thu Fri Sat".split(" "), -SHORTMONTH:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),WEEKENDRANGE:[5,6],fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",medium:"MMM d, y h:mm:ss a",mediumDate:"MMM d, y",mediumTime:"h:mm:ss a","short":"M/d/yy h:mm a",shortDate:"M/d/yy",shortTime:"h:mm a"},NUMBER_FORMATS:{CURRENCY_SYM:"$",DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},{gSize:3,lgSize:3,maxFrac:2,minFrac:2,minInt:1,negPre:"-\u00a4", -negSuf:"",posPre:"\u00a4",posSuf:""}]},id:"en-us",pluralCat:function(a,c){var e=a|0,f=c;u===f&&(f=Math.min(b(a),3));Math.pow(10,f);return 1==e&&0==f?"one":"other"}})}]),B(X).ready(function(){Zd(X,yc)}))})(window,document);!window.angular.$$csp().noInlineStyle&&window.angular.element(document.head).prepend(''); -//# sourceMappingURL=angular.min.js.map diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/js/bootstrap.min.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/js/bootstrap.min.js deleted file mode 100644 index 1a6258ef..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/js/bootstrap.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/*! - * Bootstrap v3.0.3 (http://getbootstrap.com) - * Copyright 2013 Twitter, Inc. - * Licensed under http://www.apache.org/licenses/LICENSE-2.0 - */ - -if("undefined"==typeof jQuery)throw new Error("Bootstrap requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]}}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(jQuery),+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one(a.support.transition.end,c).emulateTransitionEnd(150):c())};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),"string"==typeof b&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d)};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.is("input")?"val":"html",e=c.data();a+="Text",e.resetText||c.data("resetText",c[d]()),c[d](e[a]||this.options[a]),setTimeout(function(){"loadingText"==a?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.closest('[data-toggle="buttons"]'),b=!0;if(a.length){var c=this.$element.find("input");"radio"===c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?b=!1:a.find(".active").removeClass("active")),b&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}b&&this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition.end&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}this.sliding=!0,f&&this.pause();var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});if(!e.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid.bs.carousel",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(j),j.isDefaultPrevented())return;e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd(600)}else{if(this.$element.trigger(j),j.isDefaultPrevented())return;d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid.bs.carousel")}return f&&this.cycle(),this}};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?(this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350),void 0):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(jQuery),+function(a){"use strict";function b(){a(d).remove(),a(e).each(function(b){var d=c(a(this));d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown")),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown"))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){if("ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(''}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"html":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(c).is("body")?a(window):a(c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#\w/.test(e)&&a(e);return f&&f.length&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parents(".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top()),"function"==typeof h&&(h=f.bottom());var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;this.affixed!==i&&(this.unpin&&this.$element.css("top",""),this.affixed=i,this.unpin="bottom"==i?e.top-d:null,this.$element.removeClass(b.RESET).addClass("affix"+(i?"-"+i:"")),"bottom"==i&&this.$element.offset({top:document.body.offsetHeight-h-this.$element.height()}))}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(jQuery); \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/js/g2.min.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/js/g2.min.js deleted file mode 100644 index 74ec9541..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/js/g2.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.G2_3=e():t.G2_3=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=389)}([function(t,e,n){var i=n(127),r=n(16),a=i.mix({},i,{assign:i.mix,merge:i.deepMix,cloneDeep:i.clone,isFinite:isFinite,isNaN:isNaN,snapEqual:i.isNumberEqual,remove:i.pull,inArray:i.contains,toAllPadding:function(t){var e=0,n=0,i=0,r=0;return a.isNumber(t)||a.isString(t)?e=n=i=r=t:a.isArray(t)?(e=t[0],i=a.isNil(t[1])?t[0]:t[1],r=a.isNil(t[2])?t[0]:t[2],n=a.isNil(t[3])?i:t[3]):a.isObject(t)&&(e=t.top||0,i=t.right||0,r=t.bottom||0,n=t.left||0),[e,i,r,n]},getClipByRange:function(t){var e=t.tl,n=t.br;return new r.Rect({attrs:{x:e.x,y:e.y,width:n.x-e.x,height:n.y-e.y}})}});a.Array={groupToMap:i.groupToMap,group:i.group,merge:i.merge,values:i.valuesOfKey,getRange:i.getRange,firstValue:i.firstValue,remove:i.pull},t.exports=a},function(t,e,n){var i=n(81),r={};i.merge(r,i,{mixin:function(t,e){var n=t.CFG?"CFG":"ATTRS";if(t&&e){t._mixins=e,t[n]=t[n]||{};var i={};r.each(e,function(e){r.augment(t,e);var a=e[n];a&&r.merge(i,a)}),t[n]=r.merge(i,t[n])}}}),t.exports=r},function(t,e,n){var i=n(24),r=n(4);t.exports=function(t,e){if(t)if(r(t))for(var n=0,a=t.length;n0){var a=e.strokeOpacity;i.isNil(a)||1===a||(t.globalAlpha=a),t.stroke()}}this.afterPath(t)},afterPath:function(){},isHitBox:function(){return!0},isHit:function(t,e){var n=[t,e,1];if(this.invert(n),this.isHitBox()){var i=this.getBBox();if(i&&!o.box(i.minX,i.maxX,i.minY,i.maxY,n[0],n[1]))return!1}var r=this._attrs.clip;return r?(r.invert(n,this.get("canvas")),!!r.isPointInPath(n[0],n[1])&&this.isPointInPath(n[0],n[1])):this.isPointInPath(n[0],n[1])},calculateBox:function(){return null},getHitLineWidth:function(){var t=this._attrs,e=t.lineAppendWidth||0;return(t.lineWidth||0)+e},clearTotalMatrix:function(){this._cfg.totalMatrix=null,this._cfg.region=null},clearBBox:function(){this._cfg.box=null,this._cfg.region=null},getBBox:function(){var t=this._cfg.box;return t||((t=this.calculateBox())&&(t.x=t.minX,t.y=t.minY,t.width=t.maxX-t.minX,t.height=t.maxY-t.minY),this._cfg.box=t),t},clone:function(){var t=null,e=this._attrs,n={};return i.each(e,function(t,r){l[r]&&i.isArray(e[r])?n[r]=function(t){for(var e=[],n=0;n1){var y=f[1];y.change({nice:!1,min:0,max:Math.max.apply(null,y.values)})}s.scales=f;var x=new a[c](s);t[o]=x}},n._processData=function(){for(var t=this.get("data"),e=[],n=this._groupData(t),i=0;ia&&(a=c)}(re.max)&&e.change({min:r,max:a})},n._adjust=function(t){var e=this,n=e.get("adjusts"),i=this.viewTheme||u,r=e.getYScale(),a=e.getXScale(),s=a.field,c=r?r.field:null;l.each(n,function(n){var u=l.mix({xField:s,yField:c},n),h=l.upperFirst(n.type);if("Dodge"===h){var f=[];if(a.isCategory||a.isIdentity)f.push("x");else{if(r)throw new Error("dodge is not support linear attribute, please use category attribute!");f.push("y")}u.adjustNames=f,u.dodgeRatio=i.widthRatio.column}else if("Stack"===h){var p=e.get("coord");if(!r){u.height=p.getHeight();var g=e.getDefaultValue("size")||3;u.size=g}!p.isTransposed&&l.isNil(u.reverseOrder)&&(u.reverseOrder=!0)}new o[h](u).processAdjust(t),"Stack"===h&&r&&e._updateStackRange(c,r,t)})},n.setCoord=function(t){this.set("coord",t);var e=this.getAttr("position");this.get("shapeContainer").setMatrix(t.matrix),e&&(e.coord=t)},n.paint=function(){var t=this.get("dataArray"),e=[],n=this.getShapeFactory();n.setCoord(this.get("coord")),this.set("shapeFactory",n);var i=this.get("shapeContainer");this._beforeMapping(t);for(var r=0;r=0?e:n<=0?n:0},n._normalizeValues=function(t,e){var n=[];if(l.isArray(t))for(var i=0;i1)for(var h=0;h0)l.each(n,function(n){e+="-"+t[n]});else{var i,r=this.get("type"),a=this.getXScale(),o=this.getYScale(),s=a.field||"x",u=o.field||"y",c=t[u];i=a.isIdentity?a.value:t[s],e+="interval"===r||"schema"===r?"-"+i:"line"===r||"area"===r||"path"===r?"-"+r:"-"+i+"-"+c;var h=this._getGroupScales();l.isEmpty(h)||l.each(h,function(n){var i=n.field;"identity"!==n.type&&(e+="-"+t[i])})}return e},n.getDrawCfg=function(t){var e={origin:t,x:t.x,y:t.y,color:t.color,size:t.size,shape:t.shape,isInCircle:this.isInCircle(),opacity:t.opacity},n=this.get("styleOptions");return n&&n.style&&(e.style=this.getCallbackCfg(n.fields,n.style,t._origin)),this.get("generatePoints")&&(e.points=t.points,e.nextPoints=t.nextPoints),this.get("animate")&&(e._id=this._getShapeId(t._origin)),e},n.appendShapeInfo=function(t,e){t&&(t.setSilent("index",e),t.setSilent("coord",this.get("coord")),this.get("animate")&&this.get("animateCfg")&&t.setSilent("animateCfg",this.get("animateCfg")))},n._applyViewThemeShapeStyle=function(t,e,n){var i=this.viewTheme||u,r=n.name;e?e&&(e.indexOf("hollow")>-1||e.indexOf("liquid")>-1)&&(r="hollow"+l.upperFirst(r)):n.defaultShapeType.indexOf("hollow")>-1&&(r="hollow"+l.upperFirst(r));var a=i.shape[r]||{};t.style=l.mix({},a,t.style)},n.drawPoint=function(t,e,n,i){var r=t.shape,a=this.getDrawCfg(t);this._applyViewThemeShapeStyle(a,r,n);var o=n.drawShape(r,a,e);this.appendShapeInfo(o,i)},n.getAttr=function(t){return this.get("attrs")[t]},n.getXScale=function(){return this.getAttr("position").scales[0]},n.getYScale=function(){return this.getAttr("position").scales[1]},n.getShapes=function(){var t=[],e=this.get("shapeContainer").get("children");return l.each(e,function(e){e.get("origin")&&t.push(e)}),t},n.getAttrsForLegend=function(){var t=this.get("attrs"),e=[];return l.each(t,function(t){-1!==v.indexOf(t.type)&&e.push(t)}),e},n.getFieldsForLegend=function(){var t=[],e=this.get("attrOptions");return l.each(v,function(n){var i=e[n];i&&i.field&&l.isString(i.field)&&(t=t.concat(i.field.split("*")))}),l.uniq(t)},n.changeVisible=function(t,e){this.set("visible",t);var n=this.get("shapeContainer");n&&n.set("visible",t);var i=this.get("labelContainer");if(i&&i.set("visible",t),!e&&n){n.get("canvas").draw()}},n.reset=function(){this.set("attrOptions",{}),this.clearInner()},n.clearInner=function(){this.clearActivedShapes(),this.clearSelected();var t=this.get("shapeContainer");t&&t.clear();var e=this.get("labelContainer");e&&e.remove(),this.set("attrs",{}),this.set("groupScales",null),this.set("labelContainer",null),this.set("xDistance",null),this.set("isStacked",null)},n.clear=function(){this.clearInner(),this.set("scales",{})},n.destroy=function(){this.clear();var e=this.get("shapeContainer");e&&e.remove(),this.offEvents(),t.prototype.destroy.call(this)},n.bindEvents=function(){this.get("view")&&(this._bindActiveAction(),this._bindSelectedAction())},n.offEvents=function(){this.get("view")&&(this._offActiveAction(),this._offSelectedAction())},e}(s);t.exports=y},function(t,e,n){t.exports={Axis:n(306),Component:n(66),Guide:n(314),Label:n(323),Legend:n(324),Tooltip:n(330)}},function(t,e,n){function i(t,e){var n=t.getCenter();return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function r(t,e){for(var n=t.length,i=[t[0]],r=1;r=s[c]?1:0,p=h>Math.PI?1:0,g=n.convertPoint(l),d=i(n,g);if(d>=.5)if(h===2*Math.PI){var v={x:(l.x+s.x)/2,y:(l.y+s.y)/2},y=n.convertPoint(v);u.push(["A",d,d,0,p,f,y.x,y.y]),u.push(["A",d,d,0,p,f,g.x,g.y])}else u.push(["A",d,d,0,p,f,g.x,g.y]);return u}(n,o,t)):u.push(r(a,t));break;case"z":default:u.push(a)}}),function(t){a.each(t,function(e,n){if("a"===e[0].toLowerCase()){var i=t[n-1],r=t[n+1];r&&"a"===r[0].toLowerCase()?i&&"l"===i[0].toLowerCase()&&(i[0]="M"):i&&"a"===i[0].toLowerCase()&&r&&"l"===r[0].toLowerCase()&&(r[0]="M")}})}(u),u}};t.exports=s},function(t,e,n){var i=n(5);t.exports=function(t){return i(t)?"":t.toString()}},function(t,e){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=function(t){var e=void 0===t?"undefined":n(t);return null!==t&&"object"===e||"function"===e}},function(t,e,n){t.exports={Canvas:n(181),Group:n(101),Shape:n(6),Arc:n(105),Circle:n(106),Dom:n(107),Ellipse:n(108),Fan:n(109),Image:n(110),Line:n(111),Marker:n(56),Path:n(112),Polygon:n(113),Polyline:n(114),Rect:n(115),Text:n(116),PathSegment:n(39),PathUtil:n(57),Event:n(100),version:"3.3.5"}},function(t,e,n){var i=n(48),r=n(12);t.exports=function(t){if(!i(t)||!r(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}},function(t,e,n){var i=n(1),r=/[MLHVQTCSAZ]([^MLHVQTCSAZ]*)/gi,a=/[^\s\,]+/gi;t.exports={parseRadius:function(t){var e=0,n=0,r=0,a=0;return i.isArray(t)?1===t.length?e=n=r=a=t[0]:2===t.length?(e=r=t[0],n=a=t[1]):3===t.length?(e=t[0],n=a=t[1],r=t[2]):(e=t[0],n=t[1],r=t[2],a=t[3]):e=n=r=a=t,{r1:e,r2:n,r3:r,r4:a}},parsePath:function(t){return t=t||[],i.isArray(t)?t:i.isString(t)?(t=t.match(r),i.each(t,function(e,n){if((e=e.match(a))[0].length>1){var r=e[0].charAt(0);e.splice(1,0,e[0].substr(1)),e[0]=r}i.each(e,function(t,n){isNaN(t)||(e[n]=+t)}),t[n]=e}),t):void 0}}},function(t,e,n){"use strict";function i(t,e){return function(n){return t+n*e}}function r(t,e){var n=e-t;return n?i(t,n):Object(a.a)(isNaN(t)?e:t)}e.c=function(t,e){var n=e-t;return n?i(t,n>180||n<-180?n-360*Math.round(n/360):n):Object(a.a)(isNaN(t)?e:t)},e.b=function(t){return 1==(t=+t)?r:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}(e,n,t):Object(a.a)(isNaN(e)?n:e)}},e.a=r;var a=n(121)},function(t,e,n){function i(t,e){return r(e)?e:t.invert(t.scale(e))}var r=n(10),a=n(4),o=n(5),s=n(8),l=n(2),u=function(){function t(t){var e=this;this.type="base",this.name=null,this.method=null,this.values=[],this.scales=[],this.linear=null;var n=null,i=this.callback;if(t.callback){var r=t.callback;n=function(){for(var t=arguments.length,n=new Array(t),a=0;a1&&(e=(t[1].value-t[0].value)/2);for(var n=[],i=0;i0){var s=e.value-a[r-1].value;s/=t.get("subTickCount")+1;for(var l=1;l<=n;l++){var u={text:"",value:r?a[r-1].value+l*s:l*s},c=t.getTickPoint(u.value),h=void 0;h=o&&o.length?o.length:parseInt(.6*i.length,10),t._addTickItem(l-1,c,h,"sub")}}})}},n._addTickLine=function(t,e){var n=r.mix({},e),i=[];r.each(t,function(t){i.push(["M",t.x1,t.y1]),i.push(["L",t.x2,t.y2])}),delete n.length,n.path=i;var a=this.get("group").addShape("path",{attrs:n});a.name="axis-ticks",a._id=this.get("_id")+"-ticks",a.set("coord",this.get("coord")),this.get("appendInfo")&&a.setSilent("appendInfo",this.get("appendInfo"))},n._renderTicks=function(){var t=this.get("tickItems"),e=this.get("subTickItems");if(!r.isEmpty(t)){var n=this.get("tickLine");this._addTickLine(t,n)}if(!r.isEmpty(e)){var i=this.get("subTickLine")||this.get("tickLine");this._addTickLine(e,i)}},n._renderGrid=function(){var t=this.get("grid");if(t){t.coord=this.get("coord"),t.appendInfo=this.get("appendInfo");var e=this.get("group");this.set("gridGroup",e.addGroup(a,t))}},n._renderLabels=function(){var t=this.get("labelRenderer"),e=this.get("labelItems");t&&(t.set("items",e),t._dryDraw())},n.paint=function(){var t=this.get("tickLine"),e=!0;t&&t.hasOwnProperty("alignWithLabel")&&(e=t.alignWithLabel),this._renderLine();var n=this.get("type");("cat"===n||"timeCat"===n)&&!1===e?this._processCatTicks():this._processTicks(),this._renderTicks(),this._renderGrid(),this._renderLabels();var i=this.get("label");i&&i.autoRotate&&this.autoRotateLabels(),i&&i.autoHide&&this.autoHideLabels()},n.parseTick=function(t,e,n){return{text:t,value:e/(n-1)}},n.getTextAnchor=function(t){return Math.abs(t[1]/t[0])>=1?"center":t[0]>0?"start":"end"},n.getMaxLabelWidth=function(t){var e=t.getLabels(),n=0;return r.each(e,function(t){var e=t.getBBox().width;ne)&&(this.min=e),(i(this.max)||this.max=t.min&&e<=t.max&&n.push(e)}),n.length||(n.push(t.min),n.push(t.max)),t.ticks=n}},n.scale=function(t){if(i(t))return NaN;var e=this.max,n=this.min;if(e===n)return 0;var r=(t-n)/(e-n),a=this.rangeMin();return a+r*(this.rangeMax()-a)},n.invert=function(t){var e=(t-this.rangeMin())/(this.rangeMax()-this.rangeMin());return this.min+e*(this.max-this.min)},e}(a);a.Linear=s,t.exports=s},function(t,e,n){var i=n(13);t.exports=function(t){return i(t)?Array.prototype.slice.call(t):[]}},function(t,e){t.exports=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e-5;return Math.abs(t-e)n&&(r=2*Math.PI-t+e,a=t-n):(r=t-e,a=n-t),r>a?n:e}function a(t,e,n,i){var a=0;return n-e>=2*Math.PI&&(a=2*Math.PI),e=s.mod(e,2*Math.PI),n=s.mod(n,2*Math.PI)+a,t=s.mod(t,2*Math.PI),i?e>=n?t>n&&tn?t:r(t,e,n):e<=n?ee||tt.x&&(g=t.x),dt.y&&(v=t.y),y0&&p>0?h=Math.PI/2-g:f<0&&p<0?h=-Math.PI/2-g:f>=0&&p<0?h=-g-Math.PI/2:f<=0&&p>0&&(h=Math.PI/2-g);var d=function(t){var e,n=[],i=a.parsePath(t.path);if(!Array.isArray(i)||0===i.length||"M"!==i[0][0]&&"m"!==i[0][0])return!1;for(var r=i.length,s=0;s=0,p=f?n.toUpperCase():n,g=t,v=e.endPoint,y=g[1],x=g[2];switch(p){default:break;case"M":h=f?i(y,x,v):{x:y,y:x},this.command="M",this.params=[v,h],this.subStart=h,this.endPoint=h;break;case"L":h=f?i(y,x,v):{x:y,y:x},this.command="L",this.params=[v,h],this.subStart=e.subStart,this.endPoint=h,this.endTangent=function(){return[h.x-v.x,h.y-v.y]},this.startTangent=function(){return[v.x-h.x,v.y-h.y]};break;case"H":h=f?i(y,0,v):{x:y,y:v.y},this.command="L",this.params=[v,h],this.subStart=e.subStart,this.endPoint=h,this.endTangent=function(){return[h.x-v.x,h.y-v.y]},this.startTangent=function(){return[v.x-h.x,v.y-h.y]};break;case"V":h=f?i(0,y,v):{x:v.x,y:y},this.command="L",this.params=[v,h],this.subStart=e.subStart,this.endPoint=h,this.endTangent=function(){return[h.x-v.x,h.y-v.y]},this.startTangent=function(){return[v.x-h.x,v.y-h.y]};break;case"Q":f?(a=i(y,x,v),u=i(g[3],g[4],v)):(a={x:y,y:x},u={x:g[3],y:g[4]}),this.command="Q",this.params=[v,a,u],this.subStart=e.subStart,this.endPoint=u,this.endTangent=function(){return[u.x-a.x,u.y-a.y]},this.startTangent=function(){return[v.x-a.x,v.y-a.y]};break;case"T":u=f?i(y,x,v):{x:y,y:x},"Q"===e.command?(a=r(e.params[1],v),this.command="Q",this.params=[v,a,u],this.subStart=e.subStart,this.endPoint=u,this.endTangent=function(){return[u.x-a.x,u.y-a.y]},this.startTangent=function(){return[v.x-a.x,v.y-a.y]}):(this.command="TL",this.params=[v,u],this.subStart=e.subStart,this.endPoint=u,this.endTangent=function(){return[u.x-v.x,u.y-v.y]},this.startTangent=function(){return[v.x-u.x,v.y-u.y]});break;case"C":f?(a=i(y,x,v),u=i(g[3],g[4],v),c=i(g[5],g[6],v)):(a={x:y,y:x},u={x:g[3],y:g[4]},c={x:g[5],y:g[6]}),this.command="C",this.params=[v,a,u,c],this.subStart=e.subStart,this.endPoint=c,this.endTangent=function(){return[c.x-u.x,c.y-u.y]},this.startTangent=function(){return[v.x-a.x,v.y-a.y]};break;case"S":f?(u=i(y,x,v),c=i(g[3],g[4],v)):(u={x:y,y:x},c={x:g[3],y:g[4]}),"C"===e.command?(a=r(e.params[2],v),this.command="C",this.params=[v,a,u,c],this.subStart=e.subStart,this.endPoint=c,this.endTangent=function(){return[c.x-u.x,c.y-u.y]},this.startTangent=function(){return[v.x-a.x,v.y-a.y]}):(this.command="SQ",this.params=[v,u,c],this.subStart=e.subStart,this.endPoint=c,this.endTangent=function(){return[c.x-u.x,c.y-u.y]},this.startTangent=function(){return[v.x-u.x,v.y-u.y]});break;case"A":var m=y,_=x,b=g[3],w=g[4],S=g[5];h=f?i(g[6],g[7],v):{x:g[6],y:g[7]},this.command="A";var M=function(t,e,n,i,r,a,u){var c=l.mod(l.toRadian(u),2*Math.PI),h=t.x,f=t.y,p=e.x,g=e.y,d=Math.cos(c)*(h-p)/2+Math.sin(c)*(f-g)/2,v=-1*Math.sin(c)*(h-p)/2+Math.cos(c)*(f-g)/2,y=d*d/(r*r)+v*v/(a*a);y>1&&(r*=Math.sqrt(y),a*=Math.sqrt(y));var x=r*r*(v*v)+a*a*(d*d),m=Math.sqrt((r*r*(a*a)-x)/x);n===i&&(m*=-1),isNaN(m)&&(m=0);var _=m*r*v/a,b=m*-a*d/r,w=(h+p)/2+Math.cos(c)*_-Math.sin(c)*b,S=(f+g)/2+Math.sin(c)*_+Math.cos(c)*b,M=s([1,0],[(d-_)/r,(v-b)/a]),C=[(d-_)/r,(v-b)/a],A=[(-1*d-_)/r,(-1*v-b)/a],k=s(C,A);return o(C,A)<=-1&&(k=Math.PI),o(C,A)>=1&&(k=0),0===i&&k>0&&(k-=2*Math.PI),1===i&&k<0&&(k+=2*Math.PI),[t,w,S,r,a,M,k,c,i]}(v,h,w,S,m,_,b);this.params=M;var C=e.subStart;this.subStart=C,this.endPoint=h;var A=M[5]%(2*Math.PI);l.isNumberEqual(A,2*Math.PI)&&(A=0);var k=M[6]%(2*Math.PI);l.isNumberEqual(k,2*Math.PI)&&(k=0);var P=.001;this.startTangent=function(){0===S&&(P*=-1);var t=M[3]*Math.cos(A-P)+M[1],e=M[4]*Math.sin(A-P)+M[2];return[t-C.x,e-C.y]},this.endTangent=function(){var t=M[6];t-2*Math.PI<1e-4&&(t=0);var e=M[3]*Math.cos(A+t+P)+M[1],n=M[4]*Math.sin(A+t-P)+M[2];return[v.x-e,v.y-n]};break;case"Z":this.command="Z",this.params=[v,e.subStart],this.subStart=e.subStart,this.endPoint=e.subStart}},isInside:function(t,e,n){var i=this.command,r=this.params,a=this.box;if(a&&!u.box(a.minX,a.maxX,a.minY,a.maxY,t,e))return!1;switch(i){default:break;case"M":return!1;case"TL":case"L":case"Z":return u.line(r[0].x,r[0].y,r[1].x,r[1].y,n,t,e);case"SQ":case"Q":return u.quadraticline(r[0].x,r[0].y,r[1].x,r[1].y,r[2].x,r[2].y,n,t,e);case"C":return u.cubicline(r[0].x,r[0].y,r[1].x,r[1].y,r[2].x,r[2].y,r[3].x,r[3].y,n,t,e);case"A":var o=r,s=o[1],l=o[2],c=o[3],h=o[4],f=o[5],d=o[6],v=o[7],y=o[8],x=c>h?c:h,m=c>h?1:c/h,_=c>h?h/c:1;o=[t,e,1];var b=[1,0,0,0,1,0,0,0,1];return g.translate(b,b,[-s,-l]),g.rotate(b,b,-v),g.scale(b,b,[1/m,1/_]),p.transformMat3(o,o,b),u.arcline(0,0,x,f,f+d,1-y,n,o[0],o[1])}return!1},draw:function(t){var e,n,i,r=this.command,a=this.params;switch(r){default:break;case"M":t.moveTo(a[1].x,a[1].y);break;case"TL":case"L":t.lineTo(a[1].x,a[1].y);break;case"SQ":case"Q":e=a[1],n=a[2],t.quadraticCurveTo(e.x,e.y,n.x,n.y);break;case"C":e=a[1],n=a[2],i=a[3],t.bezierCurveTo(e.x,e.y,n.x,n.y,i.x,i.y);break;case"A":var o=a,s=o[1],l=o[2],u=o[3],c=o[4],h=o[5],f=o[6],p=o[7],g=o[8],d=u>c?u:c,v=u>c?1:u/c,y=u>c?c/u:1;t.translate(s,l),t.rotate(p),t.scale(v,y),t.arc(0,0,d,h,h+f,1-g),t.scale(1/v,1/y),t.rotate(-p),t.translate(-s,-l);break;case"Z":t.closePath()}},getBBox:function(t){var e,n,i,r,a=t/2,o=this.params;switch(this.command){default:case"M":case"Z":break;case"TL":case"L":this.box={minX:Math.min(o[0].x,o[1].x)-a,maxX:Math.max(o[0].x,o[1].x)+a,minY:Math.min(o[0].y,o[1].y)-a,maxY:Math.max(o[0].y,o[1].y)+a};break;case"SQ":case"Q":for(i=0,r=(n=h.extrema(o[0].x,o[1].x,o[2].x)).length;iS&&(S=A)}var k=f.yExtrema(y,p,g),P=1/0,T=-1/0,I=[m,_];for(i=2*-Math.PI;i<=2*Math.PI;i+=Math.PI){var O=k+i;1===x?mT&&(T=L)}this.box={minX:w-a,maxX:S+a,minY:P-a,maxY:T+a}}}}),t.exports=v},function(t,e,n){"use strict";e.a=function(t,e){return t=+t,e-=t,function(n){return t+e*n}}},function(t,e,n){var i=n(13),r=Array.prototype.indexOf;t.exports=function(t,e){return!!i(t)&&r.call(t,e)>-1}},function(t,e){t.exports=function(t){for(var e=[],n=0;n2&&void 0!==arguments[2]?arguments[2]:0,i=this.matrix,r=[t,e,n];return l.transformMat3(r,r,i),r}},{key:"invertMatrix",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=this.matrix,r=s.invert([],i),a=[t,e,n];return l.transformMat3(a,a,r),a}},{key:"convert",value:function(t){var e=this.convertPoint(t),n=e.x,i=e.y,r=this.applyMatrix(n,i,1);return{x:r[0],y:r[1]}}},{key:"invert",value:function(t){var e=this.invertMatrix(t.x,t.y,1);return this.invertPoint({x:e[0],y:e[1]})}},{key:"rotate",value:function(t){var e=this.matrix,n=this.center;return s.translate(e,e,[-n.x,-n.y]),s.rotate(e,e,t),s.translate(e,e,[n.x,n.y]),this}},{key:"reflect",value:function(t){switch(t){case"x":this._swapDim("x");break;case"y":this._swapDim("y");break;default:this._swapDim("y")}return this}},{key:"scale",value:function(t,e){var n=this.matrix,i=this.center;return s.translate(n,n,[-i.x,-i.y]),s.scale(n,n,[t,e]),s.translate(n,n,[i.x,i.y]),this}},{key:"translate",value:function(t,e){var n=this.matrix;return s.translate(n,n,[t,e]),this}},{key:"transpose",value:function(){return this.isTransposed=!this.isTransposed,this}}]),t}();t.exports=u},function(t,e,n){var i=n(0),r={splitPoints:function(t){var e=[],n=t.x,r=t.y;return r=i.isArray(r)?r:[r],i.each(r,function(t,r){var a={x:i.isArray(n)?n[r]:n,y:t};e.push(a)}),e},addFillAttrs:function(t,e){e.color&&(t.fill=e.color),i.isNumber(e.opacity)&&(t.opacity=t.fillOpacity=e.opacity)},addStrokeAttrs:function(t,e){e.color&&(t.stroke=e.color),i.isNumber(e.opacity)&&(t.opacity=t.strokeOpacity=e.opacity)}};t.exports=r},function(t,e,n){var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r=n(4);t.exports=function t(e){if("object"!==(void 0===e?"undefined":i(e))||null===e)return e;var n=void 0;if(r(e)){n=[];for(var a=0,o=e.length;an?n:t}},function(t,e,n){var i=n(182);i.translate=function(t,e,n){var r=new Array(9);return i.fromTranslation(r,n),i.multiply(t,r,e)},i.rotate=function(t,e,n){var r=new Array(9);return i.fromRotation(r,n),i.multiply(t,r,e)},i.scale=function(t,e,n){var r=new Array(9);return i.fromScaling(r,n),i.multiply(t,r,e)},t.exports=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setMatrixArrayType=function(t){e.ARRAY_TYPE=r=t},e.toRadian=function(t){return t*a},e.equals=function(t,e){return Math.abs(t-e)<=i*Math.max(1,Math.abs(t),Math.abs(e))};var i=e.EPSILON=1e-6,r=e.ARRAY_TYPE="undefined"!=typeof Float32Array?Float32Array:Array,a=(e.RANDOM=Math.random,Math.PI/180)},function(t,e,n){var i;!function(e){"use strict";function r(){}function a(t,e){for(var n=t.length;n--;)if(t[n].listener===e)return n;return-1}function o(t){return function(){return this[t].apply(this,arguments)}}function s(t){return"function"==typeof t||t instanceof RegExp||!(!t||"object"!=typeof t)&&s(t.listener)}var l=r.prototype,u=e.EventEmitter;l.getListeners=function(t){var e,n,i=this._getEvents();if(t instanceof RegExp){e={};for(n in i)i.hasOwnProperty(n)&&t.test(n)&&(e[n]=i[n])}else e=i[t]||(i[t]=[]);return e},l.flattenListeners=function(t){var e,n=[];for(e=0;e=0&&v=0&&r<=1&&h.push(r);else{var f=u*u-4*l*c;o.isNumberEqual(f,0)?h.push(-u/(2*l)):f>0&&(a=(-u-(s=Math.sqrt(f)))/(2*l),(r=(-u+s)/(2*l))>=0&&r<=1&&h.push(r),a>=0&&a<=1&&h.push(a))}return h},len:function(t,e,n,i,r,s,l,u,c){o.isNil(c)&&(c=1);for(var h=(c=c>1?1:c<0?0:c)/2,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],g=0,d=0;d<12;d++){var v=h*f[d]+h,y=a(v,t,n,r,l),x=a(v,e,i,s,u),m=y*y+x*x;g+=p[d]*Math.sqrt(m)}return h*g}}},function(t,e,n){var i=n(1),r=n(6),a=n(27),o=n(39),s=function t(e){t.superclass.constructor.call(this,e)};s.Symbols={circle:function(t,e,n){return[["M",t,e],["m",-n,0],["a",n,n,0,1,0,2*n,0],["a",n,n,0,1,0,2*-n,0]]},square:function(t,e,n){return[["M",t-n,e-n],["L",t+n,e-n],["L",t+n,e+n],["L",t-n,e+n],["Z"]]},diamond:function(t,e,n){return[["M",t-n,e],["L",t,e-n],["L",t+n,e],["L",t,e+n],["Z"]]},triangle:function(t,e,n){var i=n*Math.sin(1/3*Math.PI);return[["M",t-n,e+i],["L",t,e-i],["L",t+n,e+i],["z"]]},"triangle-down":function(t,e,n){var i=n*Math.sin(1/3*Math.PI);return[["M",t-n,e-i],["L",t+n,e-i],["L",t,e+i],["Z"]]}},s.ATTRS={path:null,lineWidth:1},i.extend(s,r),i.augment(s,{type:"marker",canFill:!0,canStroke:!0,getDefaultAttrs:function(){return{x:0,y:0,lineWidth:1}},calculateBox:function(){var t=this._attrs,e=t.x,n=t.y,i=t.radius,r=this.getHitLineWidth()/2+i;return{minX:e-r,minY:n-r,maxX:e+r,maxY:n+r}},_getPath:function(){var t=this._attrs,e=t.x,n=t.y,r=t.radius||t.r,a=t.symbol||"circle";return(i.isFunction(a)?a:s.Symbols[a])(e,n,r)},createPath:function(t){var e=this._cfg.segments;if(!e||this._cfg.hasUpdate){var n=a.parsePath(this._getPath());t.beginPath();var i;e=[];for(var r=0;r2&&(n.push([i].concat(a.splice(0,2))),o="l",i="m"===i?"l":"L"),"o"===o&&1===a.length&&n.push([i,a[0]]),"r"===o)n.push([i].concat(a));else for(;a.length>=e[o]&&(n.push([i].concat(a.splice(0,e[o]))),e[o]););}),n},f=function(t,e){for(var n=[],i=0,r=t.length;r-2*!e>i;i+=2){var a=[{x:+t[i-2],y:+t[i-1]},{x:+t[i],y:+t[i+1]},{x:+t[i+2],y:+t[i+3]},{x:+t[i+4],y:+t[i+5]}];e?i?r-4===i?a[3]={x:+t[0],y:+t[1]}:r-2===i&&(a[2]={x:+t[0],y:+t[1]},a[3]={x:+t[2],y:+t[3]}):a[0]={x:+t[r-2],y:+t[r-1]}:r-4===i?a[3]=a[2]:i||(a[0]={x:+t[i],y:+t[i+1]}),n.push(["C",(-a[0].x+6*a[1].x+a[2].x)/6,(-a[0].y+6*a[1].y+a[2].y)/6,(a[1].x+6*a[2].x-a[3].x)/6,(a[1].y+6*a[2].y-a[3].y)/6,a[2].x,a[2].y])}return n},p=function(t,e,n,i,r){var a=[];if(null===r&&null===i&&(i=n),t=+t,e=+e,n=+n,i=+i,null!==r){var o=Math.PI/180,s=t+n*Math.cos(-i*o),l=t+n*Math.cos(-r*o);a=[["M",s,e+n*Math.sin(-i*o)],["A",n,n,0,+(r-i>180),0,l,e+n*Math.sin(-r*o)]]}else a=[["M",t,e],["m",0,-i],["a",n,i,0,1,1,0,2*i],["a",n,i,0,1,1,0,-2*i],["z"]];return a},g=function(t){if(!(t=h(t))||!t.length)return[["M",0,0]];var e,n,i=[],r=0,a=0,o=0,s=0,l=0;"M"===t[0][0]&&(o=r=+t[0][1],s=a=+t[0][2],l++,i[0]=["M",r,a]);for(var u,c,g=3===t.length&&"M"===t[0][0]&&"R"===t[1][0].toUpperCase()&&"Z"===t[2][0].toUpperCase(),d=l,v=t.length;d1&&(i*=w=Math.sqrt(w),r*=w);var S=i*i,M=r*r,C=(o===s?-1:1)*Math.sqrt(Math.abs((S*M-S*b*b-M*_*_)/(S*b*b+M*_*_)));g=C*i*b/r+(e+l)/2,d=C*-r*_/i+(n+u)/2,f=Math.asin(((n-d)/r).toFixed(9)),p=Math.asin(((u-d)/r).toFixed(9)),f=ep&&(f-=2*Math.PI),!s&&p>f&&(p-=2*Math.PI)}var A=p-f;if(Math.abs(A)>v){var k=p,P=l,T=u;p=f+v*(s&&p>f?1:-1),x=t(l=g+i*Math.cos(p),u=d+r*Math.sin(p),i,r,a,0,s,P,T,[p,k,g,d])}A=p-f;var I=Math.cos(f),O=Math.sin(f),L=Math.cos(p),E=Math.sin(p),D=Math.tan(A/4),F=4/3*i*D,B=4/3*r*D,R=[e,n],j=[e+F*O,n-B*I],N=[l+F*E,u-B*L],z=[l,u];if(j[0]=2*R[0]-j[0],j[1]=2*R[1]-j[1],c)return[j,N,z].concat(x);for(var Y=[],V=0,X=(x=[j,N,z].concat(x).join().split(",")).length;V7){t[e].shift();for(var a=t[e];a.length;)s[e]="A",r&&(l[e]="A"),t.splice(e++,0,["C"].concat(a.splice(0,6)));t.splice(e,1),n=Math.max(i.length,r&&r.length||0)}},p=function(t,e,a,o,s){t&&e&&"M"===t[s][0]&&"M"!==e[s][0]&&(e.splice(s,0,["M",o.x,o.y]),a.bx=0,a.by=0,a.x=t[s][1],a.y=t[s][2],n=Math.max(i.length,r&&r.length||0))};n=Math.max(i.length,r&&r.length||0);for(var y=0;y1?1:l<0?0:l)/2,c=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],h=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],f=0,p=0;p<12;p++){var g=u*c[p]+u,d=_(g,t,n,r,o),v=_(g,e,i,a,s),y=d*d+v*v;f+=h[p]*Math.sqrt(y)}return u*f},w=function(t,e,n,i,r,a,o,s){if(!(Math.max(t,n)Math.max(r,o)||Math.max(e,i)Math.max(a,s))){var l=(t-n)*(a-s)-(e-i)*(r-o);if(l){var u=((t*i-e*n)*(r-o)-(t-n)*(r*s-a*o))/l,c=((t*i-e*n)*(a-s)-(e-i)*(r*s-a*o))/l,h=+u.toFixed(2),f=+c.toFixed(2);if(!(h<+Math.min(t,n).toFixed(2)||h>+Math.max(t,n).toFixed(2)||h<+Math.min(r,o).toFixed(2)||h>+Math.max(r,o).toFixed(2)||f<+Math.min(e,i).toFixed(2)||f>+Math.max(e,i).toFixed(2)||f<+Math.min(a,s).toFixed(2)||f>+Math.max(a,s).toFixed(2)))return{x:u,y:c}}}},S=function(t,e,n){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height},M=function(t,e,n,i,r){if(r)return[["M",+t+ +r,e],["l",n-2*r,0],["a",r,r,0,0,1,r,r],["l",0,i-2*r],["a",r,r,0,0,1,-r,r],["l",2*r-n,0],["a",r,r,0,0,1,-r,-r],["l",0,2*r-i],["a",r,r,0,0,1,r,-r],["z"]];var a=[["M",t,e],["l",n,0],["l",0,i],["l",-n,0],["z"]];return a.parsePathArray=m,a},C=function(t,e,n,i){return null===t&&(t=e=n=i=0),null===e&&(e=t.y,n=t.width,i=t.height,t=t.x),{x:t,y:e,width:n,w:n,height:i,h:i,x2:t+n,y2:e+i,cx:t+n/2,cy:e+i/2,r1:Math.min(n,i)/2,r2:Math.max(n,i)/2,r0:Math.sqrt(n*n+i*i)/2,path:M(t,e,n,i),vb:[t,e,n,i].join(" ")}},A=function(t,e,n,i,r,a,o,l){s.isArray(t)||(t=[t,e,n,i,r,a,o,l]);var u=function(t,e,n,i,r,a,o,s){for(var l,u,c,h,f=[],p=[[],[]],g=0;g<2;++g)if(0===g?(u=6*t-12*n+6*r,l=-3*t+9*n-9*r+3*o,c=3*n-3*t):(u=6*e-12*i+6*a,l=-3*e+9*i-9*a+3*s,c=3*i-3*e),Math.abs(l)<1e-12){if(Math.abs(u)<1e-12)continue;(h=-c/u)>0&&h<1&&f.push(h)}else{var d=u*u-4*c*l,v=Math.sqrt(d);if(!(d<0)){var y=(-u+v)/(2*l);y>0&&y<1&&f.push(y);var x=(-u-v)/(2*l);x>0&&x<1&&f.push(x)}}for(var m,_=f.length,b=_;_--;)m=1-(h=f[_]),p[0][_]=m*m*m*t+3*m*m*h*n+3*m*h*h*r+h*h*h*o,p[1][_]=m*m*m*e+3*m*m*h*i+3*m*h*h*a+h*h*h*s;return p[0][b]=t,p[1][b]=e,p[0][b+1]=o,p[1][b+1]=s,p[0].length=p[1].length=b+2,{min:{x:Math.min.apply(0,p[0]),y:Math.min.apply(0,p[1])},max:{x:Math.max.apply(0,p[0]),y:Math.max.apply(0,p[1])}}}.apply(null,t);return C(u.min.x,u.min.y,u.max.x-u.min.x,u.max.y-u.min.y)},k=function(t,e,n,i,r,a,o,s,l){var u=1-l,c=Math.pow(u,3),h=Math.pow(u,2),f=l*l,p=f*l,g=t+2*l*(n-t)+f*(r-2*n+t),d=e+2*l*(i-e)+f*(a-2*i+e),v=n+2*l*(r-n)+f*(o-2*r+n),y=i+2*l*(a-i)+f*(s-2*a+i);return{x:c*t+3*h*l*n+3*u*l*l*r+p*o,y:c*e+3*h*l*i+3*u*l*l*a+p*s,m:{x:g,y:d},n:{x:v,y:y},start:{x:u*t+l*n,y:u*e+l*i},end:{x:u*r+l*o,y:u*a+l*s},alpha:90-180*Math.atan2(g-v,d-y)/Math.PI}},P=function(t,e,n){if(!function(t,e){return t=C(t),e=C(e),S(e,t.x,t.y)||S(e,t.x2,t.y)||S(e,t.x,t.y2)||S(e,t.x2,t.y2)||S(t,e.x,e.y)||S(t,e.x2,e.y)||S(t,e.x,e.y2)||S(t,e.x2,e.y2)||(t.xe.x||e.xt.x)&&(t.ye.y||e.yt.y)}(A(t),A(e)))return n?0:[];for(var i=~~(b.apply(0,t)/8),r=~~(b.apply(0,e)/8),a=[],o=[],s={},l=n?0:[],u=0;u=0&&P<=1&&T>=0&&T<=1&&(n?l++:l.push({x:M.x,y:M.y,t1:P,t2:T}))}}return l},T=function(t,e,n){if(1===n)return[[].concat(t)];var r=[];if("L"===e[0]||"C"===e[0]||"Q"===e[0])r=r.concat(function(t,e,n){var r=[[t[1],t[2]]];n=n||2;var a=[];"A"===e[0]?(r.push(e[6]),r.push(e[7])):"C"===e[0]?(r.push([e[1],e[2]]),r.push([e[3],e[4]]),r.push([e[5],e[6]])):"S"===e[0]||"Q"===e[0]?(r.push([e[1],e[2]]),r.push([e[3],e[4]])):r.push([e[1],e[2]]);for(var o=r,s=1/n,l=0;l=3&&(3===t.length&&e.push("Q"),e=e.concat(t[1])),2===t.length&&e.push("L"),e=e.concat(t[t.length-1])})}(t,e,n));else{var a=[].concat(t);"M"===a[0]&&(a[0]="L");for(var o=0;o<=n-1;o++)r.push(a)}return r},I=function(t,e){if(t.length!==e.length)return!1;var n=!0;return s.each(t,function(t,i){if(t!==e[i])return n=!1,!1}),n};t.exports={parsePathString:h,parsePathArray:m,pathTocurve:y,pathToAbsolute:g,catmullRomToBezier:f,rectPath:M,fillPath:function(t,e){if(1===t.length)return t;var n=t.length-1,i=e.length-1,r=n/i,a=[];if(1===t.length&&"M"===t[0][0]){for(var o=0;o=0;f--)s=o[f].index,"add"===o[f].type?t.splice(s,0,[].concat(t[s])):t.splice(s,1)}var p=a-(i=t.length);if(i0)){t[i]=e[i];break}n=a(n,t[i-1],1)}t[i]=["Q"].concat(n.reduce(function(t,e){return t.concat(e)},[]));break;case"T":t[i]=["T"].concat(n[0]);break;case"C":if(n.length<3){if(!(i>0)){t[i]=e[i];break}n=a(n,t[i-1],2)}t[i]=["C"].concat(n.reduce(function(t,e){return t.concat(e)},[]));break;case"S":if(n.length<2){if(!(i>0)){t[i]=e[i];break}n=a(n,t[i-1],1)}t[i]=["S"].concat(n.reduce(function(t,e){return t.concat(e)},[]));break;default:t[i]=e[i]}return t},intersection:function(t,e){return function(t,e,n){t=y(t),e=y(e);for(var i,r,a,o,s,l,u,c,h,f,p=n?0:[],g=0,d=t.length;g=0&&e._call.call(null,t),e=e._next;--p}function l(){x=(y=_.now())+m,p=g=0;try{s()}finally{p=0,function(){var t,e,n=h,i=1/0;for(;n;)n._call?(i>n._time&&(i=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:h=e);f=t,c(i)}(),x=0}}function u(){var t=_.now(),e=t-y;e>v&&(m-=e,y=t)}function c(t){if(!p){g&&(g=clearTimeout(g));t-x>24?(t<1/0&&(g=setTimeout(l,t-_.now()-m)),d&&(d=clearInterval(d))):(d||(y=_.now(),d=setInterval(u,v)),p=1,b(l))}}e.b=i,e.a=a,e.c=o,e.d=s;var h,f,p=0,g=0,d=0,v=1e3,y=0,x=0,m=0,_="object"==typeof performance&&performance.now?performance:Date,b="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};a.prototype=o.prototype={constructor:a,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?i():+n)+(null==e?0:+e),this._next||f===this||(f?f._next=this:h=this,f=this),this._call=t,this._time=n,c()},stop:function(){this._call&&(this._call=null,this._time=1/0,c())}}},function(t,e,n){"use strict";var i=n(19),r=n(119),a=n(122),o=n(123),s=n(40),l=n(124),u=n(125),c=n(121);e.a=function(t,e){var n,h=typeof e;return null==e||"boolean"===h?Object(c.a)(e):("number"===h?s.a:"string"===h?(n=Object(i.a)(e))?(e=n,r.a):u.a:e instanceof i.a?r.a:e instanceof Date?o.a:Array.isArray(e)?a.a:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?l.a:s.a)(t,e)}},function(t,e,n){"use strict";function i(){}function r(t){var e;return t=(t+"").trim().toLowerCase(),(e=_.exec(t))?(e=parseInt(e[1],16),new u(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1)):(e=b.exec(t))?a(parseInt(e[1],16)):(e=w.exec(t))?new u(e[1],e[2],e[3],1):(e=S.exec(t))?new u(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=M.exec(t))?o(e[1],e[2],e[3],e[4]):(e=C.exec(t))?o(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=A.exec(t))?c(e[1],e[2]/100,e[3]/100,1):(e=k.exec(t))?c(e[1],e[2]/100,e[3]/100,e[4]):P.hasOwnProperty(t)?a(P[t]):"transparent"===t?new u(NaN,NaN,NaN,0):null}function a(t){return new u(t>>16&255,t>>8&255,255&t,1)}function o(t,e,n,i){return i<=0&&(t=e=n=NaN),new u(t,e,n,i)}function s(t){return t instanceof i||(t=r(t)),t?(t=t.rgb(),new u(t.r,t.g,t.b,t.opacity)):new u}function l(t,e,n,i){return 1===arguments.length?s(t):new u(t,e,n,null==i?1:i)}function u(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function c(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new f(t,e,n,i)}function h(t,e,n,a){return 1===arguments.length?function(t){if(t instanceof f)return new f(t.h,t.s,t.l,t.opacity);if(t instanceof i||(t=r(t)),!t)return new f;if(t instanceof f)return t;var e=(t=t.rgb()).r/255,n=t.g/255,a=t.b/255,o=Math.min(e,n,a),s=Math.max(e,n,a),l=NaN,u=s-o,c=(s+o)/2;return u?(l=e===s?(n-a)/u+6*(n0&&c<1?0:l,new f(l,u,c,t.opacity)}(t):new f(t,e,n,null==a?1:a)}function f(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function p(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}e.a=i,n.d(e,"d",function(){return d}),n.d(e,"c",function(){return v}),e.e=r,e.h=s,e.g=l,e.b=u,e.f=h;var g=n(61),d=.7,v=1/d,y="\\s*([+-]?\\d+)\\s*",x="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",m="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_=/^#([0-9a-f]{3})$/,b=/^#([0-9a-f]{6})$/,w=new RegExp("^rgb\\("+[y,y,y]+"\\)$"),S=new RegExp("^rgb\\("+[m,m,m]+"\\)$"),M=new RegExp("^rgba\\("+[y,y,y,x]+"\\)$"),C=new RegExp("^rgba\\("+[m,m,m,x]+"\\)$"),A=new RegExp("^hsl\\("+[x,m,m]+"\\)$"),k=new RegExp("^hsla\\("+[x,m,m,x]+"\\)$"),P={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Object(g.a)(i,r,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),Object(g.a)(u,l,Object(g.b)(i,{brighter:function(t){return t=null==t?v:Math.pow(v,t),new u(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?d:Math.pow(d,t),new u(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},toString:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),Object(g.a)(f,h,Object(g.b)(i,{brighter:function(t){return t=null==t?v:Math.pow(v,t),new f(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?d:Math.pow(d,t),new f(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new u(p(t>=240?t-240:t+120,r,i),p(t,r,i),p(t<120?t+240:t-120,r,i),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}))},function(t,e,n){"use strict";e.b=function(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n},e.a=function(t,e,n){t.prototype=e.prototype=n,n.constructor=t}},function(t,e,n){"use strict";function i(t,e,n,i,r){var a=t*t,o=a*t;return((1-3*t+3*a-o)*e+(4-6*a+3*o)*n+(1+3*t+3*a-3*o)*i+o*r)/6}e.a=i,e.b=function(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),a=t[r],o=t[r+1],s=r>0?t[r-1]:2*a-o,l=r0&&e.lineToLabel(t)})},n.lineToLabel=function(){},n.getLabelPoint=function(t,e,n){function i(e,n){return o.isArray(e)&&(e=1===t.text.length?e.length<=2?e[e.length-1]:function(t){var e=0;return o.each(t,function(t){e+=t}),e/t.length}(e):e[n]),e}var r=this.get("coord"),a=t.text.length,s={text:t.text[n]};if(e&&"polygon"===this.get("geomType")){var l=function(t,e){for(var n,i,r=-1,a=0,o=0,s=t.length-1,l=0;++ru&&(u=t.x)}),s.x=(s.x+u)/2}"pyramid"===e.shape&&!e.nextPoints&&e.points&&e.points.forEach(function(t){t=r.convert(t),(o.isArray(t.x)&&-1===e.x.indexOf(t.x)||o.isNumber(t.x)&&e.x!==t.x)&&(s.x=(s.x+t.x)/2)}),t.position&&this.setLabelPosition(s,e,n,t.position);var c=this.getLabelOffset(t,n,a);return t.offsetX&&(c.x+=t.offsetX),t.offsetY&&(c.y+=t.offsetY),this.transLabelPoint(s),s.start={x:s.x,y:s.y},s.x+=c.x,s.y+=c.y,s.color=e.color,s},n.setLabelPosition=function(){},n.transLabelPoint=function(t){var e=this.get("coord").applyMatrix(t.x,t.y,1);t.x=e[0],t.y=e[1]},n.getOffsetVector=function(t){var e=t.offset||0,n=this.get("coord");return n.isTransposed?n.applyMatrix(e,0):n.applyMatrix(0,e)},n.getDefaultOffset=function(t){var e=this.get("coord"),n=this.getOffsetVector(t);return e.isTransposed?n[0]:n[1]},n.getLabelOffset=function(t,e,n){var i=this.getDefaultOffset(t),r=this.get("coord").isTransposed,a=r?"x":"y",o=r?1:-1,s={x:0,y:0};return s[a]=e>0||1===n?i*o:i*o*-1,s},n.getLabelAlign=function(t,e,n){var i="center";if(this.get("coord").isTransposed){var r=this.getDefaultOffset(t);i=r<0?"right":0===r?"center":"left",n>1&&0===e&&("right"===i?i="left":"left"===i&&(i="right"))}return i},n._getLabelValue=function(t,e){o.isArray(e)||(e=[e]);var n=[];return o.each(e,function(e){var i=t[e.field];if(o.isArray(i)){var r=[];o.each(i,function(t){r.push(e.getText(t))}),i=r}else i=e.getText(i);(o.isNil(i)||""===i)&&n.push(null),n.push(i)}),n},n._getLabelCfgs=function(t){var e=this,n=this.get("labelCfg"),i=n.scales,r=this.get("label"),a=[];n.globalCfg&&n.globalCfg.type&&e.set("type",n.globalCfg.type),o.each(t,function(t,s){var l={},u=t._origin,c=e._getLabelValue(u,i);if(n.callback){var h=i.map(function(t){return u[t.field]});l=n.callback.apply(null,h)}if(l||0===l){if(o.isString(l)||o.isNumber(l)?l={text:l}:(l.text=l.content||c[0],delete l.content),l=o.mix({},r,n.globalCfg||{},l),t.point=u,l.htmlTemplate&&(l.useHtml=!0,l.text=l.htmlTemplate.call(null,l.text,t,s),delete l.htmlTemplate),l.formatter&&(l.text=l.formatter.call(null,l.text,t,s),delete l.formatter),l.label){var f=l.label;delete l.label,l=o.mix(l,f)}if(l.textStyle){delete l.textStyle.offset;var p=l.textStyle;o.isFunction(p)&&(l.textStyle=p.call(null,l.text,t,s))}l.labelLine&&(l.labelLine=o.mix({},r.labelLine,l.labelLine)),l.textStyle=o.mix({},r.textStyle,l.textStyle),delete l.items,a.push(l)}else a.push(null)}),this.set("labelItemCfgs",a)},n.showLabels=function(t,e){var n=this.get("labelRenderer"),i=this.getLabelsItems(t,e);e=[].concat(e);var r=this.get("type");i=this.adjustItems(i,e),this.drawLines(i),n.set("items",i.filter(function(t,n){return!!t||(e.splice(n,1),!1)})),r&&(n.set("shapes",e),n.set("type",r),n.set("points",t)),n.set("canvas",this.get("canvas")),n.draw()},n.destroy=function(){this.get("labelRenderer").destroy(),t.prototype.destroy.call(this)},e}(i);t.exports=l},function(t,e,n){function i(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var r=n(53),a=n(3),o=function(t){function e(e){var n,r=i(i(n=t.call(this)||this)),o={visible:!0},s=r.getDefaultCfg();return r._attrs=o,a.deepMix(o,s,e),n}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){return{}},n.get=function(t){return this._attrs[t]},n.set=function(t,e){this._attrs[t]=e},n.changeVisible=function(){},n.destroy=function(){this._attrs={},this.removeAllListeners(),this.destroyed=!0},e}(r);t.exports=o},function(t,e,n){var i=n(3),r=n(158),a=n(327),o=n(14).FONT_FAMILY,s=i.Event,l=i.Group,u=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return i.mix({},e,{type:"continuous-legend",items:null,layout:"vertical",width:20,height:156,textStyle:{fill:"#333",textAlign:"center",textBaseline:"middle",stroke:"#fff",lineWidth:5,fontFamily:o},hoverTextStyle:{fill:"rgba(0,0,0,0.25)"},slidable:!0,triggerAttr:{fill:"#fff",shadowBlur:10,shadowColor:"rgba(0,0,0,0.65)",radius:2},_range:[0,100],middleBackgroundStyle:{fill:"#D9D9D9"},textOffset:4,lineStyle:{lineWidth:1,stroke:"#fff"},pointerStyle:{fill:"rgb(230, 230, 230)"}})},n._calStartPoint=function(){var t={x:10,y:this.get("titleGap")-8},e=this.get("titleShape");if(e){var n=e.getBBox();t.y+=n.height}return t},n.beforeRender=function(){var e=this.get("items");i.isArray(e)&&!i.isEmpty(e)&&(t.prototype.beforeRender.call(this),this.set("firstItem",e[0]),this.set("lastItem",e[e.length-1]))},n._formatItemValue=function(t){var e=this.get("formatter")||this.get("itemFormatter");return e&&(t=e.call(this,t)),t},n.render=function(){t.prototype.render.call(this),this.get("slidable")?this._renderSlider():this._renderUnslidable()},n._renderSlider=function(){var t=new l,e=new l,n=new l,i=this._calStartPoint(),r=this.get("group").addGroup(a,{minHandleElement:t,maxHandleElement:e,backgroundElement:n,layout:this.get("layout"),range:this.get("_range"),width:this.get("width"),height:this.get("height")});r.translate(i.x,i.y),this.set("slider",r);this._renderSliderShape().attr("clip",r.get("middleHandleElement")),this._renderTrigger()},n._addMiddleBar=function(t,e,n){return t.addShape(e,{attrs:i.mix({},n,this.get("middleBackgroundStyle"))}),t.addShape(e,{attrs:n})},n._renderTrigger=function(){var t=this.get("firstItem"),e=this.get("lastItem"),n=this.get("layout"),r=this.get("textStyle"),a=this.get("triggerAttr"),o=i.mix({},a),s=i.mix({},a),l=i.mix({text:this._formatItemValue(t.value)+""},r),u=i.mix({text:this._formatItemValue(e.value)+""},r);"vertical"===n?(this._addVerticalTrigger("min",o,l),this._addVerticalTrigger("max",s,u)):(this._addHorizontalTrigger("min",o,l),this._addHorizontalTrigger("max",s,u))},n._addVerticalTrigger=function(t,e,n){var r=this.get("slider").get(t+"HandleElement"),a=this.get("width"),o=r.addShape("rect",{attrs:i.mix({x:a/2-8-2,y:"min"===t?0:-8,width:18,height:8},e)}),s=r.addShape("text",{attrs:i.mix(n,{x:a+this.get("textOffset"),y:"max"===t?-4:4,textAlign:"start",lineHeight:1,textBaseline:"middle"})}),l="vertical"===this.get("layout")?"ns-resize":"ew-resize";o.attr("cursor",l),s.attr("cursor",l),this.set(t+"ButtonElement",o),this.set(t+"TextElement",s)},n._addHorizontalTrigger=function(t,e,n){var r=this.get("slider").get(t+"HandleElement"),a=r.addShape("rect",{attrs:i.mix({x:"min"===t?-8:0,y:-8-this.get("height")/2,width:8,height:16},e)}),o=r.addShape("text",{attrs:i.mix(n,{x:"min"===t?-12:12,y:4+this.get("textOffset")+10,textAlign:"min"===t?"end":"start",textBaseline:"middle"})}),s="vertical"===this.get("layout")?"ns-resize":"ew-resize";a.attr("cursor",s),o.attr("cursor",s),this.set(t+"ButtonElement",a),this.set(t+"TextElement",o)},n._bindEvents=function(){var t=this;if(this.get("slidable")){this.get("slider").on("sliderchange",function(e){var n=e.range,i=t.get("firstItem").value,r=t.get("lastItem").value,a=i+n[0]/100*(r-i),o=i+n[1]/100*(r-i);t._updateElement(a,o);var l=new s("itemfilter",e,!0,!0);l.range=[a,o],t.emit("itemfilter",l)})}this.get("hoverable")&&(this.get("group").on("mousemove",i.wrapBehavior(this,"_onMouseMove")),this.get("group").on("mouseleave",i.wrapBehavior(this,"_onMouseLeave")))},n._updateElement=function(t,e){var n=this.get("minTextElement"),i=this.get("maxTextElement");e>1&&(t=parseInt(t,10),e=parseInt(e,10)),n.attr("text",this._formatItemValue(t)+""),i.attr("text",this._formatItemValue(e)+"")},n._onMouseLeave=function(){var t=this.get("group").findById("hoverPointer");t&&t.destroy();var e=this.get("group").findById("hoverText");e&&e.destroy(),this.get("canvas").draw()},n._onMouseMove=function(t){var e,n=this.get("height"),i=this.get("width"),r=this.get("items"),a=this.get("canvas").get("el").getBoundingClientRect(),o=this.get("group").getBBox();if("vertical"===this.get("layout")){var s=5;"color-legend"===this.get("type")&&(s=30);var l=this.get("titleGap"),u=this.get("titleShape");u&&(l+=u.getBBox().maxY-u.getBBox().minY);var c=t.clientY||t.event.clientY;c=c-a.y-this.get("group").attr("matrix")[7]+o.y-s+l,e=r[0].value+(1-c/n)*(r[r.length-1].value-r[0].value)}else{var h=t.clientX||t.event.clientX;h=h-a.x-this.get("group").attr("matrix")[6],e=r[0].value+h/i*(r[r.length-1].value-r[0].value)}e=e.toFixed(2),this.activate(e),this.emit("mousehover",{value:e})},n.activate=function(t){if(t){var e=this.get("group").findById("hoverPointer"),n=this.get("group").findById("hoverText"),r=this.get("items");if(!(tr[r.length-1].value)){var a,o=this.get("height"),s=this.get("width"),l=this.get("titleShape"),u=this.get("titleGap"),c=[],h=(t-r[0].value)/(r[r.length-1].value-r[0].value);if("vertical"===this.get("layout")){var f=0,p=0;"color-legend"===this.get("type")&&(f=u,l&&(f+=l.getBBox().height)),this.get("slidable")&&("color-legend"===this.get("type")?f-=13:(f=u-15,l&&(f+=l.getBBox().height)),p+=10),c=[[p,(h=(1-h)*o)+f],[p-10,h+f-5],[p-10,h+f+5]],a=i.mix({},{x:s+this.get("textOffset")/2+p,y:h+f,text:this._formatItemValue(t)+""},this.get("textStyle"),{textAlign:"start"})}else{var g=0,d=0;"color-legend"===this.get("type")&&(g=u,l&&(g+=l.getBBox().height)),this.get("slidable")&&("color-legend"===this.get("type")?g-=7:(g=u,l||(g-=7)),d+=10),c=[[(h*=s)+d,g],[h+d-5,g-10],[h+d+5,g-10]],a=i.mix({},{x:h-5,y:o+this.get("textOffset")+g,text:this._formatItemValue(t)+""},this.get("textStyle"))}var v=i.mix(a,this.get("hoverTextStyle"));n?n.attr(v):(n=this.get("group").addShape("text",{attrs:v})).set("id","hoverText"),e?e.attr(i.mix({points:c},this.get("pointerStyle"))):(e=this.get("group").addShape("Polygon",{attrs:i.mix({points:c},this.get("pointerStyle"))})).set("id","hoverPointer"),this.get("canvas").draw()}}},n.deactivate=function(){var t=this.get("group").findById("hoverPointer");t&&t.destroy();var e=this.get("group").findById("hoverText");e&&e.destroy(),this.get("canvas").draw()},e}(r);t.exports=u},function(t,e,n){var i=n(66),r=n(3),a=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return r.mix({},e,{x:0,y:0,items:null,titleContent:null,showTitle:!0,plotRange:null,offset:10,timeStamp:0,inPlot:!0,crosshairs:null})},n.isContentChange=function(t,e){var n=this.get("titleContent"),i=this.get("items"),a=!(t===n&&i.length===e.length);return a||r.each(e,function(t,e){var n=i[e];for(var o in t)if(t.hasOwnProperty(o)&&!r.isObject(t[o])&&t[o]!==n[o]){a=!0;break}if(a)return!1}),a},n.setContent=function(t,e){var n=(new Date).valueOf();return this.set("items",e),this.set("titleContent",t),this.set("timeStamp",n),this.render(),this},n.setPosition=function(t,e){this.set("x",t),this.set("y",e)},n.render=function(){},n.clear=function(){},n.show=function(){this.set("visible",!0)},n.hide=function(){this.set("visible",!1)},n.destroy=function(){},e}(i);t.exports=a},function(t,e,n){"use strict";function i(t,e){this._groups=t,this._parents=e}function r(){return new i([[document.documentElement]],F)}n.d(e,"c",function(){return F}),e.a=i;var a=n(402),o=n(403),s=n(404),l=n(405),u=n(382),c=n(407),h=n(408),f=n(409),p=n(410),g=n(411),d=n(412),v=n(413),y=n(414),x=n(415),m=n(416),_=n(417),b=n(384),w=n(418),S=n(419),M=n(420),C=n(421),A=n(422),k=n(423),P=n(424),T=n(425),I=n(426),O=n(427),L=n(428),E=n(374),D=n(429),F=[null];i.prototype=r.prototype={constructor:i,select:a.a,selectAll:o.a,filter:s.a,data:l.a,enter:u.b,exit:c.a,merge:h.a,order:f.a,sort:p.a,call:g.a,nodes:d.a,node:v.a,size:y.a,empty:x.a,each:m.a,attr:_.a,style:b.a,property:w.a,classed:S.a,text:M.a,html:C.a,raise:A.a,lower:k.a,append:P.a,insert:T.a,remove:I.a,clone:O.a,datum:L.a,on:E.b,dispatch:D.a},e.b=r},function(t,e,n){"use strict";function i(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}n.d(e,"c",function(){return u}),n.d(e,"d",function(){return c}),n.d(e,"b",function(){return p}),n.d(e,"a",function(){return g}),e.g=function(t,e){var n=i(t,e);if(n.state>l)throw new Error("too late; already scheduled");return n},e.h=function(t,e){var n=i(t,e);if(n.state>c)throw new Error("too late; already started");return n},e.f=i;var r=n(438),a=n(170),o=Object(r.a)("start","end","interrupt"),s=[],l=0,u=1,c=2,h=3,f=4,p=5,g=6;e.e=function(t,e,n,i,r,d){var v=t.__transition;if(v){if(n in v)return}else t.__transition={};!function(t,e,n){function i(p){var d,v,y,x;if(n.state!==u)return o();for(d in l)if((x=l[d]).name===n.name){if(x.state===h)return Object(a.timeout)(i);x.state===f?(x.state=g,x.timer.stop(),x.on.call("interrupt",t,t.__data__,x.index,x.group),delete l[d]):+d0?new Date(t).getTime():new Date(t.replace(/-/gi,"/")).getTime()),r(t)&&(t=t.getTime()),t}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(401);n.d(e,"create",function(){return i.a});var r=n(360);n.d(e,"creator",function(){return r.a});var a=n(430);n.d(e,"local",function(){return a.a});var o=n(381);n.d(e,"matcher",function(){return o.a});var s=n(431);n.d(e,"mouse",function(){return s.a});var l=n(370);n.d(e,"namespace",function(){return l.a});var u=n(371);n.d(e,"namespaces",function(){return u.a});var c=n(361);n.d(e,"clientPoint",function(){return c.a});var h=n(379);n.d(e,"select",function(){return h.a});var f=n(432);n.d(e,"selectAll",function(){return f.a});var p=n(69);n.d(e,"selection",function(){return p.b});var g=n(372);n.d(e,"selector",function(){return g.a});var d=n(380);n.d(e,"selectorAll",function(){return d.a});var v=n(384);n.d(e,"style",function(){return v.b});var y=n(433);n.d(e,"touch",function(){return y.a});var x=n(434);n.d(e,"touches",function(){return x.a});var m=n(373);n.d(e,"window",function(){return m.a});var _=n(374);n.d(e,"event",function(){return _.c}),n.d(e,"customEvent",function(){return _.a})},function(t,e,n){t.exports={Position:n(292),Color:n(293),Shape:n(294),Size:n(295),Opacity:n(296),ColorUtil:n(149)}},function(t,e,n){var i=n(75),r=n(17);r.Linear=n(33),r.Identity=n(175),r.Cat=n(77),r.Time=n(176),r.TimeCat=n(178),r.Log=n(179),r.Pow=n(180);var a=function(t){if(r.hasOwnProperty(t)){var e=i(t);r[e]=function(e){return new r[t](e)}}};for(var o in r)a(o);var s=["cat","timeCat"];r.isCategory=function(t){return s.indexOf(t)>=0},t.exports=r},function(t,e,n){var i=n(23);t.exports=function(t){var e=i(t);return e.charAt(0).toLowerCase()+e.substring(1)}},function(t,e){function n(t,e){var n=t.length;if(0===n)return NaN;var i=t[0];if(e=t[n-1])return t[n-1];for(var r=1;rt[n-1])return NaN;if(er&&(e=parseFloat(e.toFixed(n)))}else for(;t>10;)e*=10,t/=10;return e}(t*=i);i*=o,t/=o}var s=(t="floor"===n?a.snapFloor(e,t):"ceil"===n?a.snapCeiling(e,t):a.snapTo(e,t))*i;if(Math.abs(i)<1&&s.toString().length>r){s=t/parseInt(1/i)*(i>0?1:-1)}return s},snapMultiple:function(t,e,n){return("ceil"===n?Math.ceil(t/e):"floor"===n?Math.floor(t/e):Math.round(t/e))*e},snapTo:function(t,e){var r=n(t,e),a=i(t,e);if(isNaN(r)||isNaN(a)){if(t[0]>=e)return t[0];var o=t[t.length-1];if(o<=e)return o}return Math.abs(e-r)20&&(r=20),parseFloat(t.toFixed(r))}};t.exports=a},function(t,e,n){var i=n(17),r=n(78),a=n(2),o=n(9),s=n(10),l=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n._initDefaultCfg=function(){t.prototype._initDefaultCfg.call(this),this.type="cat",this.isCategory=!0,this.isRounding=!0},n.init=function(){var t=this.values,e=this.tickCount;if(a(t,function(e,n){t[n]=e.toString()}),!this.ticks){var n=t;if(e){n=r({maxCount:e,data:t,isRounding:this.isRounding}).ticks}this.ticks=n}},n.getText=function(e){return-1===this.values.indexOf(e)&&o(e)&&(e=this.values[Math.round(e)]),t.prototype.getText.call(this,e)},n.translate=function(t){var e=this.values.indexOf(t);return-1===e&&o(t)?e=t:-1===e&&(e=NaN),e},n.scale=function(t){var e,n=this.rangeMin(),i=this.rangeMax();return(s(t)||-1!==this.values.indexOf(t))&&(t=this.translate(t)),e=this.values.length>1?t/(this.values.length-1):t,n+e*(i-n)},n.invert=function(t){if(s(t))return t;var e=this.rangeMin(),n=this.rangeMax();tn&&(t=n);var i=(t-e)/(n-e),r=Math.round(i*(this.values.length-1))%this.values.length;return r=r||0,this.values[r]},e}(i);i.Cat=l,t.exports=l},function(t,e,n){var i=n(2);t.exports=function(t){var e,n={},r=[],a=t.isRounding,o=function(t){var e=[];return i(t,function(t){e=e.concat(t)}),e}(t.data),s=o.length,l=t.maxCount||8;if(a?2===(e=function(t,e){var n;for(n=e;n>0&&t%n!=0;n--);if(1===n)for(n=e;n>0&&(t-1)%n!=0;n--);return n}(s-1,l-1)+1)?e=l:e3?0:(t-t%10!=10)*t%10]}};var x={D:function(t){return t.getDate()},DD:function(t){return s(t.getDate())},Do:function(t,e){return e.DoFn(t.getDate())},d:function(t){return t.getDay()},dd:function(t){return s(t.getDay())},ddd:function(t,e){return e.dayNamesShort[t.getDay()]},dddd:function(t,e){return e.dayNames[t.getDay()]},M:function(t){return t.getMonth()+1},MM:function(t){return s(t.getMonth()+1)},MMM:function(t,e){return e.monthNamesShort[t.getMonth()]},MMMM:function(t,e){return e.monthNames[t.getMonth()]},YY:function(t){return String(t.getFullYear()).substr(2)},YYYY:function(t){return s(t.getFullYear(),4)},h:function(t){return t.getHours()%12||12},hh:function(t){return s(t.getHours()%12||12)},H:function(t){return t.getHours()},HH:function(t){return s(t.getHours())},m:function(t){return t.getMinutes()},mm:function(t){return s(t.getMinutes())},s:function(t){return t.getSeconds()},ss:function(t){return s(t.getSeconds())},S:function(t){return Math.round(t.getMilliseconds()/100)},SS:function(t){return s(Math.round(t.getMilliseconds()/10),2)},SSS:function(t){return s(t.getMilliseconds(),3)},a:function(t,e){return t.getHours()<12?e.amPm[0]:e.amPm[1]},A:function(t,e){return t.getHours()<12?e.amPm[0].toUpperCase():e.amPm[1].toUpperCase()},ZZ:function(t){var e=t.getTimezoneOffset();return(e>0?"-":"+")+s(100*Math.floor(Math.abs(e)/60)+Math.abs(e)%60,4)}},m={D:[c,function(t,e){t.day=e}],Do:[new RegExp(c.source+h.source),function(t,e){t.day=parseInt(e,10)}],M:[c,function(t,e){t.month=e-1}],YY:[c,function(t,e){var n=+(""+(new Date).getFullYear()).substr(0,2);t.year=""+(e>68?n-1:n)+e}],h:[c,function(t,e){t.hour=e}],m:[c,function(t,e){t.minute=e}],s:[c,function(t,e){t.second=e}],YYYY:[/\d{4}/,function(t,e){t.year=e}],S:[/\d/,function(t,e){t.millisecond=100*e}],SS:[/\d{2}/,function(t,e){t.millisecond=10*e}],SSS:[/\d{3}/,function(t,e){t.millisecond=e}],d:[c,p],ddd:[h,p],MMM:[h,o("monthNamesShort")],MMMM:[h,o("monthNames")],a:[h,function(t,e,n){var i=e.toLowerCase();i===n.amPm[0]?t.isPm=!1:i===n.amPm[1]&&(t.isPm=!0)}],ZZ:[/([\+\-]\d\d:?\d\d|Z)/,function(t,e){"Z"===e&&(e="+00:00");var n,i=(e+"").match(/([\+\-]|\d\d)/gi);i&&(n=60*i[1]+parseInt(i[2],10),t.timezoneOffset="+"===i[0]?n:-n)}]};m.dd=m.d,m.dddd=m.ddd,m.DD=m.D,m.mm=m.m,m.hh=m.H=m.HH=m.h,m.MM=m.M,m.ss=m.s,m.A=m.a,l.masks={default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"},l.format=function(t,e,n){var i=n||l.i18n;if("number"==typeof t&&(t=new Date(t)),"[object Date]"!==Object.prototype.toString.call(t)||isNaN(t.getTime()))throw new Error("Invalid Date in fecha.format");var r=[];return e=(e=l.masks[e]||e||l.masks.default).replace(f,function(t,e){return r.push(e),"??"}),(e=e.replace(u,function(e){return e in x?x[e](t,i):e.slice(1,e.length-1)})).replace(/\?\?/g,function(){return r.shift()})},l.parse=function(t,e,n){var i=n||l.i18n;if("string"!=typeof e)throw new Error("Invalid format in fecha.parse");if(e=l.masks[e]||e,t.length>1e3)return!1;var r=!0,a={};if(e.replace(u,function(e){if(m[e]){var n=m[e],o=t.search(n[0]);~o?t.replace(n[0],function(e){return n[1](a,e,i),t=t.substr(o+e.length),e}):r=!1}return m[e]?"":e.slice(1,e.length-1)}),!r)return!1;var o=new Date;!0===a.isPm&&null!=a.hour&&12!=+a.hour?a.hour=+a.hour+12:!1===a.isPm&&12==+a.hour&&(a.hour=0);var s;return null!=a.timezoneOffset?(a.minute=+(a.minute||0)-+a.timezoneOffset,s=new Date(Date.UTC(a.year||o.getFullYear(),a.month||0,a.day||1,a.hour||0,a.minute||0,a.second||0,a.millisecond||0))):s=new Date(a.year||o.getFullYear(),a.month||0,a.day||1,a.hour||0,a.minute||0,a.second||0,a.millisecond||0),s},void 0!==t&&t.exports?t.exports=l:void 0!==(i=function(){return l}.call(e,n,e,t))&&(t.exports=i)}()},function(t,e,n){var i=n(12);t.exports=function(t){return i(t,"Date")}},function(t,e,n){t.exports={isFunction:n(11),isObject:n(24),isBoolean:n(82),isNil:n(5),isString:n(10),isArray:n(4),isNumber:n(9),isEmpty:n(83),uniqueId:n(86),clone:n(46),deepMix:n(47),assign:n(8),merge:n(47),upperFirst:n(87),each:n(2),isEqual:n(49),toArray:n(34),extend:n(88),augment:n(89),remove:n(90),isNumberEqual:n(35),toRadian:n(91),toDegree:n(92),mod:n(93),clamp:n(50),createDom:n(94),modifyCSS:n(95),requestAnimationFrame:n(96),getRatio:function(){return window.devicePixelRatio?window.devicePixelRatio:2},mat3:n(51),vec2:n(97),vec3:n(98),transform:n(99)}},function(t,e,n){var i=n(12);t.exports=function(t){return i(t,"Boolean")}},function(t,e,n){var i=n(5),r=n(13),a=n(84),o=n(85),s=Object.prototype.hasOwnProperty;t.exports=function(t){if(i(t))return!0;if(r(t))return!t.length;var e=a(t);if("Map"===e||"Set"===e)return!t.size;if(o(t))return!Object.keys(t).length;for(var n in t)if(s.call(t,n))return!1;return!0}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).replace(/^\[object /,"").replace(/\]$/,"")}},function(t,e){var n=Object.prototype;t.exports=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||n)}},function(t,e){var n=function(){var t={};return function(e){return e=e||"g",t[e]?t[e]+=1:t[e]=1,e+t[e]}}();t.exports=n},function(t,e,n){var i=n(23);t.exports=function(t){var e=i(t);return e.charAt(0).toUpperCase()+e.substring(1)}},function(t,e,n){var i=n(11),r=n(8);t.exports=function(t,e,n,a){i(e)||(n=e,e=t,t=function(){});var o=Object.create?function(t,e){return Object.create(t,{constructor:{value:e}})}:function(t,e){function n(){}n.prototype=t;var i=new n;return i.constructor=e,i},s=o(e.prototype,t);return t.prototype=r(s,t.prototype),t.superclass=o(e.prototype,e),r(s,n),r(t,a),t}},function(t,e,n){var i=n(11),r=n(34),a=n(8);t.exports=function(t){for(var e=r(arguments),n=1;n-1;)i.call(t,s,1);return t}},function(t,e){var n=Math.PI/180;t.exports=function(t){return n*t}},function(t,e){var n=180/Math.PI;t.exports=function(t){return n*t}},function(t,e){t.exports=function(t,e){return(t%e+e)%e}},function(t,e){var n=document.createElement("table"),i=document.createElement("tr"),r=/^\s*<(\w+|!)[^>]*>/,a={tr:document.createElement("tbody"),tbody:n,thead:n,tfoot:n,td:i,th:i,"*":document.createElement("div")};t.exports=function(t){var e=r.test(t)&&RegExp.$1;e in a||(e="*");var n=a[e];t=t.replace(/(^\s*)|(\s*$)/g,""),n.innerHTML=""+t;var i=n.childNodes[0];return n.removeChild(i),i}},function(t,e){t.exports=function(t,e){if(t)for(var n in e)e.hasOwnProperty(n)&&(t.style[n]=e[n]);return t}},function(t,e){t.exports=function(t){return(window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(t){return setTimeout(t,16)})(t)}},function(t,e,n){var i=n(183),r=n(50);i.angle=function(t,e){var n=i.dot(t,e)/(i.length(t)*i.length(e));return Math.acos(r(n,-1,1))},i.direction=function(t,e){return t[0]*e[1]-e[0]*t[1]},i.angleTo=function(t,e,n){var r=i.angle(t,e),a=i.direction(t,e)>=0;return n?a?2*Math.PI-r:r:a?r:2*Math.PI-r},i.vertical=function(t,e,n){return n?(t[0]=e[1],t[1]=-1*e[0]):(t[0]=-1*e[1],t[1]=e[0]),t},t.exports=i},function(t,e,n){var i=n(184);t.exports=i},function(t,e,n){var i=n(46),r=n(2),a=n(51);t.exports=function(t,e){return t=i(t),r(e,function(e){switch(e[0]){case"t":a.translate(t,t,[e[1],e[2]]);break;case"s":a.scale(t,t,[e[1],e[2]]);break;case"r":a.rotate(t,t,e[1]);break;case"m":a.multiply(t,t,e[1]);break;default:return!1}}),t}},function(t,e,n){var i=n(1),r=function(t,e,n,i){this.type=t,this.target=null,this.currentTarget=null,this.bubbles=n,this.cancelable=i,this.timeStamp=(new Date).getTime(),this.defaultPrevented=!1,this.propagationStopped=!1,this.removed=!1,this.event=e};i.augment(r,{preventDefault:function(){this.defaultPrevented=this.cancelable&&!0},stopPropagation:function(){this.propagationStopped=!0},remove:function(){this.remove=!0},clone:function(){return i.clone(this)},toString:function(){return"[Event (type="+this.type+")]"}}),t.exports=r},function(t,e,n){function i(t,e,n){for(var i,r=t.length-1;r>=0;r--){var a=t[r];if(a._cfg.visible&&a._cfg.capture&&(a.isGroup?i=a.getShape(e,n):a.isHit(e,n)&&(i=a)),i)break}return i}function r(t){if(!t._cfg&&t!==c){var e=t.superclass.constructor;e&&!e._cfg&&r(e),t._cfg={},a.merge(t._cfg,e._cfg),a.merge(t._cfg,t.CFG)}}var a=n(1),o=n(102),s=n(188),l={},u="_INDEX",c=function t(e){t.superclass.constructor.call(this,e),this.set("children",[]),this.set("tobeRemoved",[]),this._beforeRenderUI(),this._renderUI(),this._bindUI()};a.extend(c,o),a.augment(c,{isGroup:!0,type:"group",canFill:!0,canStroke:!0,getDefaultCfg:function(){return r(this.constructor),a.merge({},this.constructor._cfg)},_beforeRenderUI:function(){},_renderUI:function(){},_bindUI:function(){},addShape:function(t,e){var n=this.get("canvas");e=e||{};var i=l[t];if(i||(i=a.upperFirst(t),l[t]=i),e.attrs&&n){var r=e.attrs;if("text"===t){var o=n.get("fontFamily");o&&(r.fontFamily=r.fontFamily?r.fontFamily:o)}}e.canvas=n,e.type=t;var u=new s[i](e);return this.add(u),u},addGroup:function(t,e){var n,i=this.get("canvas");if(e=a.merge({},e),a.isFunction(t))e?(e.canvas=i,e.parent=this,n=new t(e)):n=new t({canvas:i,parent:this}),this.add(n);else if(a.isObject(t))t.canvas=i,n=new c(t),this.add(n);else{if(void 0!==t)return!1;n=new c,this.add(n)}return n},renderBack:function(t,e){var n=this.get("backShape"),i=this.getBBox();return a.merge(e,{x:i.minX-t[3],y:i.minY-t[0],width:i.width+t[1]+t[3],height:i.height+t[0]+t[2]}),n?n.attr(e):n=this.addShape("rect",{zIndex:-1,attrs:e}),this.set("backShape",n),this.sort(),n},removeChild:function(t,e){if(arguments.length>=2)this.contain(t)&&t.remove(e);else{if(1===arguments.length){if(!a.isBoolean(t))return this.contain(t)&&t.remove(!0),this;e=t}0===arguments.length&&(e=!0),c.superclass.remove.call(this,e)}return this},add:function(t){var e=this,n=e.get("children");if(a.isArray(t))a.each(t,function(t){var n=t.get("parent");n&&n.removeChild(t,!1),e._setCfgProperty(t)}),e._cfg.children=n.concat(t);else{var i=t,r=i.get("parent");r&&r.removeChild(i,!1),e._setCfgProperty(i),n.push(i)}return e},_setCfgProperty:function(t){var e=this._cfg;t.set("parent",this),t.set("canvas",e.canvas),e.timeline&&t.set("timeline",e.timeline)},contain:function(t){return this.get("children").indexOf(t)>-1},getChildByIndex:function(t){return this.get("children")[t]},getFirst:function(){return this.getChildByIndex(0)},getLast:function(){var t=this.get("children").length-1;return this.getChildByIndex(t)},getBBox:function(){var t=1/0,e=-1/0,n=1/0,i=-1/0,r=this.get("children");r.length>0?a.each(r,function(r){if(r.get("visible")){if(r.isGroup&&0===r.get("children").length)return;var a=r.getBBox();if(!a)return!0;var o=[a.minX,a.minY,1],s=[a.minX,a.maxY,1],l=[a.maxX,a.minY,1],u=[a.maxX,a.maxY,1];r.apply(o),r.apply(s),r.apply(l),r.apply(u);var c=Math.min(o[0],s[0],l[0],u[0]),h=Math.max(o[0],s[0],l[0],u[0]),f=Math.min(o[1],s[1],l[1],u[1]),p=Math.max(o[1],s[1],l[1],u[1]);ce&&(e=h),fi&&(i=p)}}):(t=0,e=0,n=0,i=0);var o={minX:t,minY:n,maxX:e,maxY:i};return o.x=o.minX,o.y=o.minY,o.width=o.maxX-o.minX,o.height=o.maxY-o.minY,o},getCount:function(){return this.get("children").length},sort:function(){var t=this.get("children");return a.each(t,function(t,e){return t[u]=e,t}),t.sort(function(t){return function(e,n){var i=t(e,n);return 0===i?e[u]-n[u]:i}}(function(t,e){return t.get("zIndex")-e.get("zIndex")})),this},findById:function(t){return this.find(function(e){return e.get("id")===t})},find:function(t){if(a.isString(t))return this.findById(t);var e=this.get("children"),n=null;return a.each(e,function(e){if(t(e)?n=e:e.find&&(n=e.find(t)),n)return!1}),n},findAll:function(t){var e=this.get("children"),n=[],i=[];return a.each(e,function(e){t(e)&&n.push(e),e.findAllBy&&(i=e.findAllBy(t),n=n.concat(i))}),n},findBy:function(t){var e=this.get("children"),n=null;return a.each(e,function(e){if(t(e)?n=e:e.findBy&&(n=e.findBy(t)),n)return!1}),n},findAllBy:function(t){var e=this.get("children"),n=[],i=[];return a.each(e,function(e){t(e)&&n.push(e),e.findAllBy&&(i=e.findAllBy(t),n=n.concat(i))}),n},getShape:function(t,e){var n,r=this._attrs.clip,a=this._cfg.children;if(r){var o=[t,e,1];r.invert(o,this.get("canvas")),r.isPointInPath(o[0],o[1])&&(n=i(a,t,e))}else n=i(a,t,e);return n},clearTotalMatrix:function(){if(this.get("totalMatrix")){this.setSilent("totalMatrix",null);for(var t=this._cfg.children,e=0;e=0;n--)e[n].remove(!0,t);return this._cfg.children=[],this},destroy:function(){this.get("destroyed")||(this.clear(),c.superclass.destroy.call(this))},clone:function(){var t=this._cfg.children,e=new c;return a.each(t,function(t){e.add(t.clone())}),e}}),t.exports=c},function(t,e,n){var i=n(1),r=n(185),a=n(186),o=n(187),s=n(53),l=function(t){this._cfg={zIndex:0,capture:!0,visible:!0,destroyed:!1},i.assign(this._cfg,this.getDefaultCfg(),t),this.initAttrs(this._cfg.attrs),this._cfg.attrs={},this.initTransform(),this.init()};l.CFG={id:null,zIndex:0,canvas:null,parent:null,capture:!0,context:null,visible:!0,destroyed:!1},i.augment(l,r,a,s,o,{init:function(){this.setSilent("animable",!0),this.setSilent("animating",!1)},getParent:function(){return this._cfg.parent},getDefaultCfg:function(){return{}},set:function(t,e){return"zIndex"===t&&this._beforeSetZIndex&&this._beforeSetZIndex(e),"loading"===t&&this._beforeSetLoading&&this._beforeSetLoading(e),this._cfg[t]=e,this},setSilent:function(t,e){this._cfg[t]=e},get:function(t){return this._cfg[t]},show:function(){return this._cfg.visible=!0,this},hide:function(){return this._cfg.visible=!1,this},remove:function(t,e){var n=this._cfg,r=n.parent,a=n.el;return r&&i.remove(r.get("children"),this),a&&(e?r&&r._cfg.tobeRemoved.push(a):a.parentNode.removeChild(a)),(t||void 0===t)&&this.destroy(),this},destroy:function(){this.get("destroyed")||(this._attrs=null,this.removeEvent(),this._cfg={destroyed:!0})},toFront:function(){var t=this._cfg,e=t.parent;if(e){var n=e._cfg.children,i=t.el,r=n.indexOf(this);n.splice(r,1),n.push(this),i&&(i.parentNode.removeChild(i),t.el=null)}},toBack:function(){var t=this._cfg,e=t.parent;if(e){var n=e._cfg.children,i=t.el,r=n.indexOf(this);if(n.splice(r,1),n.unshift(this),i){var a=i.parentNode;a.removeChild(i),a.insertBefore(i,a.firstChild)}}},_beforeSetZIndex:function(t){var e=this._cfg.parent;this._cfg.zIndex=t,i.isNil(e)||e.sort();var n=this._cfg.el;if(n){var r=e._cfg.children,a=r.indexOf(this),o=n.parentNode;o.removeChild(n),a===r.length-1?o.appendChild(n):o.insertBefore(n,o.childNodes[a])}return t},_setAttrs:function(t){return this.attr(t),t},setZIndex:function(t){return this._cfg.zIndex=t,this._beforeSetZIndex(t)},clone:function(){return i.clone(this)},getBBox:function(){}}),t.exports=l},function(t,e,n){function i(t,e,n,i){var r=1-i;return r*(r*t+2*i*e)+i*i*n}function r(t,e,n,r,a,s,l,u,c){var h,f,p,g,d,v,y,x=.005,m=1/0,_=[l,u];for(d=0;d<1;d+=.05)p=[i(t,n,a,d),i(e,r,s,d)],(f=o.squaredDistance(_,p))=0&&f=0?[r]:[]}}},function(t,e){t.exports={xAt:function(t,e,n,i,r){return e*Math.cos(t)*Math.cos(r)-n*Math.sin(t)*Math.sin(r)+i},yAt:function(t,e,n,i,r){return e*Math.sin(t)*Math.cos(r)+n*Math.cos(t)*Math.sin(r)+i},xExtrema:function(t,e,n){return Math.atan(-n/e*Math.tan(t))},yExtrema:function(t,e,n){return Math.atan(n/(e*Math.tan(t)))}}},function(t,e,n){function i(t,e,n){return t+e*Math.cos(n)}function r(t,e,n){return t+e*Math.sin(n)}var a=n(1),o=n(6),s=n(37),l=n(38),u=function t(e){t.superclass.constructor.call(this,e)};u.ATTRS={x:0,y:0,r:0,startAngle:0,endAngle:0,clockwise:!1,lineWidth:1,startArrow:!1,endArrow:!1},a.extend(u,o),a.augment(u,{canStroke:!0,type:"arc",getDefaultAttrs:function(){return{x:0,y:0,r:0,startAngle:0,endAngle:0,clockwise:!1,lineWidth:1,startArrow:!1,endArrow:!1}},calculateBox:function(){var t=this._attrs,e=t.x,n=t.y,i=t.r,r=t.startAngle,a=t.endAngle,o=t.clockwise,l=this.getHitLineWidth()/2,u=s.box(e,n,i,r,a,o);return u.minX-=l,u.minY-=l,u.maxX+=l,u.maxY+=l,u},getStartTangent:function(){var t=this._attrs,e=t.x,n=t.y,a=t.startAngle,o=t.r,s=t.clockwise,l=Math.PI/180;s&&(l*=-1);var u=[],c=i(e,o,a+l),h=r(n,o,a+l),f=i(e,o,a),p=r(n,o,a);return u.push([c,h]),u.push([f,p]),u},getEndTangent:function(){var t=this._attrs,e=t.x,n=t.y,a=t.endAngle,o=t.r,s=t.clockwise,l=Math.PI/180,u=[];s&&(l*=-1);var c=i(e,o,a+l),h=r(n,o,a+l),f=i(e,o,a),p=r(n,o,a);return u.push([f,p]),u.push([c,h]),u},createPath:function(t){var e=this._attrs,n=e.x,i=e.y,r=e.r,a=e.startAngle,o=e.endAngle,s=e.clockwise;(t=t||self.get("context")).beginPath(),t.arc(n,i,r,a,o,s)},afterPath:function(t){var e=this._attrs;if(t=t||this.get("context"),e.startArrow){var n=this.getStartTangent();l.addStartArrow(t,e,n[0][0],n[0][1],n[1][0],n[1][1])}if(e.endArrow){var i=this.getEndTangent();l.addEndArrow(t,e,i[0][0],i[0][1],i[1][0],i[1][1])}}}),t.exports=u},function(t,e,n){var i=n(1),r=n(6),a=function t(e){t.superclass.constructor.call(this,e)};a.ATTRS={x:0,y:0,r:0,lineWidth:1},i.extend(a,r),i.augment(a,{canFill:!0,canStroke:!0,type:"circle",getDefaultAttrs:function(){return{lineWidth:1}},calculateBox:function(){var t=this._attrs,e=t.x,n=t.y,i=t.r,r=this.getHitLineWidth()/2+i;return{minX:e-r,minY:n-r,maxX:e+r,maxY:n+r}},createPath:function(t){var e=this._attrs,n=e.x,i=e.y,r=e.r;t.beginPath(),t.arc(n,i,r,0,2*Math.PI,!1),t.closePath()}}),t.exports=a},function(t,e,n){var i=n(1),r=n(6),a=function t(e){t.superclass.constructor.call(this,e)};i.extend(a,r),i.augment(a,{canFill:!0,canStroke:!0,type:"dom",calculateBox:function(){var t=this._attrs,e=t.x,n=t.y,i=t.width,r=t.height,a=this.getHitLineWidth()/2;return{minX:e-a,minY:n-a,maxX:e+i+a,maxY:n+r+a}}}),t.exports=a},function(t,e,n){var i=n(1),r=n(6),a=function t(e){t.superclass.constructor.call(this,e)};a.ATTRS={x:0,y:0,rx:1,ry:1,lineWidth:1},i.extend(a,r),i.augment(a,{canFill:!0,canStroke:!0,type:"ellipse",getDefaultAttrs:function(){return{lineWidth:1}},calculateBox:function(){var t=this._attrs,e=t.x,n=t.y,i=t.rx,r=t.ry,a=this.getHitLineWidth(),o=i+a/2,s=r+a/2;return{minX:e-o,minY:n-s,maxX:e+o,maxY:n+s}},createPath:function(t){var e=this._attrs,n=e.x,r=e.y,a=e.rx,o=e.ry;t=t||self.get("context");var s=a>o?a:o,l=a>o?1:a/o,u=a>o?o/a:1,c=[1,0,0,0,1,0,0,0,1];i.mat3.scale(c,c,[l,u]),i.mat3.translate(c,c,[n,r]),t.beginPath(),t.save(),t.transform(c[0],c[1],c[3],c[4],c[6],c[7]),t.arc(0,0,s,0,2*Math.PI),t.restore(),t.closePath()}}),t.exports=a},function(t,e,n){var i=n(1),r=n(6),a=n(37),o=function t(e){t.superclass.constructor.call(this,e)};o.ATTRS={x:0,y:0,rs:0,re:0,startAngle:0,endAngle:0,clockwise:!1,lineWidth:1},i.extend(o,r),i.augment(o,{canFill:!0,canStroke:!0,type:"fan",getDefaultAttrs:function(){return{clockwise:!1,lineWidth:1,rs:0,re:0}},calculateBox:function(){var t=this._attrs,e=t.x,n=t.y,i=t.rs,r=t.re,o=t.startAngle,s=t.endAngle,l=t.clockwise,u=this.getHitLineWidth(),c=a.box(e,n,i,o,s,l),h=a.box(e,n,r,o,s,l),f=u/2;return{minX:Math.min(c.minX,h.minX)-f,minY:Math.min(c.minY,h.minY)-f,maxX:Math.max(c.maxX,h.maxX)+f,maxY:Math.max(c.maxY,h.maxY)+f}},createPath:function(t){var e=this._attrs,n=e.x,i=e.y,r=e.rs,a=e.re,o=e.startAngle,s=e.endAngle,l=e.clockwise,u={x:Math.cos(o)*r+n,y:Math.sin(o)*r+i},c={x:Math.cos(o)*a+n,y:Math.sin(o)*a+i},h={x:Math.cos(s)*r+n,y:Math.sin(s)*r+i};(t=t||self.get("context")).beginPath(),t.moveTo(u.x,u.y),t.lineTo(c.x,c.y),t.arc(n,i,a,o,s,l),t.lineTo(h.x,h.y),t.arc(n,i,r,s,o,!l),t.closePath()}}),t.exports=o},function(t,e,n){var i=n(1),r=n(6),a=function t(e){t.superclass.constructor.call(this,e)};a.ATTRS={x:0,y:0,img:void 0,width:0,height:0,sx:null,sy:null,swidth:null,sheight:null},i.extend(a,r),i.augment(a,{type:"image",isHitBox:function(){return!1},calculateBox:function(){var t=this._attrs;this._cfg.attrs&&this._cfg.attrs.img===t.img||this._setAttrImg();var e=t.x,n=t.y;return{minX:e,minY:n,maxX:e+t.width,maxY:n+t.height}},_beforeSetLoading:function(t){var e=this.get("canvas");return!1===t&&!0===this.get("toDraw")&&(this._cfg.loading=!1,e.draw()),t},_setAttrImg:function(){var t=this,e=t._attrs,n=e.img;if(!i.isString(n))return n instanceof Image?(e.width||t.attr("width",n.width),e.height||t.attr("height",n.height),n):n instanceof HTMLElement&&i.isString(n.nodeName)&&"CANVAS"===n.nodeName.toUpperCase()?(e.width||t.attr("width",Number(n.getAttribute("width"))),e.height||t.attr("height",Number(n.getAttribute("height"))),n):n instanceof ImageData?(e.width||t.attr("width",n.width),e.height||t.attr("height",n.height),n):null;var r=new Image;r.onload=function(){if(t.get("destroyed"))return!1;t.attr("imgSrc",n),t.attr("img",r);var e=t.get("callback");e&&e.call(t),t.set("loading",!1)},r.src=n,r.crossOrigin="Anonymous",t.set("loading",!0)},drawInner:function(t){this._cfg.hasUpdate&&this._setAttrImg(),this.get("loading")?this.set("toDraw",!0):(this._drawImage(t),this._cfg.hasUpdate=!1)},_drawImage:function(t){var e=this._attrs,n=e.x,r=e.y,a=e.img,o=e.width,s=e.height,l=e.sx,u=e.sy,c=e.swidth,h=e.sheight;this.set("toDraw",!1);var f=a;if(f instanceof ImageData&&((f=new Image).src=a),f instanceof Image||f instanceof HTMLElement&&i.isString(f.nodeName)&&"CANVAS"===f.nodeName.toUpperCase()){if(i.isNil(l)||i.isNil(u)||i.isNil(c)||i.isNil(h))return void t.drawImage(f,n,r,o,s);if(!(i.isNil(l)||i.isNil(u)||i.isNil(c)||i.isNil(h)))return void t.drawImage(f,l,u,c,h,n,r,o,s)}}}),t.exports=a},function(t,e,n){var i=n(1),r=n(6),a=n(38),o=n(36),s=function t(e){t.superclass.constructor.call(this,e)};s.ATTRS={x1:0,y1:0,x2:0,y2:0,lineWidth:1,startArrow:!1,endArrow:!1},i.extend(s,r),i.augment(s,{canStroke:!0,type:"line",getDefaultAttrs:function(){return{lineWidth:1,startArrow:!1,endArrow:!1}},calculateBox:function(){var t=this._attrs,e=t.x1,n=t.y1,i=t.x2,r=t.y2,a=this.getHitLineWidth();return o.box(e,n,i,r,a)},createPath:function(t){var e=this._attrs,n=e.x1,i=e.y1,r=e.x2,a=e.y2;(t=t||self.get("context")).beginPath(),t.moveTo(n,i),t.lineTo(r,a)},afterPath:function(t){var e=this._attrs,n=e.x1,i=e.y1,r=e.x2,o=e.y2;t=t||this.get("context"),e.startArrow&&a.addStartArrow(t,e,r,o,n,i),e.endArrow&&a.addEndArrow(t,e,n,i,r,o)},getPoint:function(t){var e=this._attrs;return{x:o.at(e.x1,e.x2,t),y:o.at(e.y1,e.y2,t)}}}),t.exports=s},function(t,e,n){var i=n(1),r=n(6),a=n(39),o=n(27),s=n(38),l=n(57),u=n(55),c=function t(e){t.superclass.constructor.call(this,e)};c.ATTRS={path:null,lineWidth:1,startArrow:!1,endArrow:!1},i.extend(c,r),i.augment(c,{canFill:!0,canStroke:!0,type:"path",getDefaultAttrs:function(){return{lineWidth:1,startArrow:!1,endArrow:!1}},_afterSetAttrPath:function(t){if(i.isNil(t))return this.setSilent("segments",null),void this.setSilent("box",void 0);var e,n=o.parsePath(t),r=[];if(i.isArray(n)&&0!==n.length&&("M"===n[0][0]||"m"===n[0][0])){for(var s=n.length,l=0;lr&&(r=i.maxX),i.minYo&&(o=i.maxY))}),n===1/0||a===1/0?{minX:0,minY:0,maxX:0,maxY:0}:{minX:n,minY:a,maxX:r,maxY:o}},_setTcache:function(){var t,e,n,r,a=0,o=0,s=[],l=this._cfg.curve;l&&(i.each(l,function(t,e){n=l[e+1],r=t.length,n&&(a+=u.len(t[r-2],t[r-1],n[1],n[2],n[3],n[4],n[5],n[6]))}),i.each(l,function(i,c){n=l[c+1],r=i.length,n&&((t=[])[0]=o/a,e=u.len(i[r-2],i[r-1],n[1],n[2],n[3],n[4],n[5],n[6]),o+=e,t[1]=o/a,s.push(t))}),this._cfg.tCache=s)},_calculateCurve:function(){var t=this._attrs.path;this._cfg.curve=l.pathTocurve(t)},getStartTangent:function(){var t,e,n,r,a=this.get("segments");if(a.length>1)if(t=a[0].endPoint,e=a[1].endPoint,n=a[1].startTangent,r=[],i.isFunction(n)){var o=n();r.push([t.x-o[0],t.y-o[1]]),r.push([t.x,t.y])}else r.push([e.x,e.y]),r.push([t.x,t.y]);return r},getEndTangent:function(){var t,e,n,r,a=this.get("segments"),o=a.length;if(o>1)if(t=a[o-2].endPoint,e=a[o-1].endPoint,n=a[o-1].endTangent,r=[],i.isFunction(n)){var s=n();r.push([e.x-s[0],e.y-s[1]]),r.push([e.x,e.y])}else r.push([t.x,t.y]),r.push([e.x,e.y]);return r},getPoint:function(t){var e,n,r=this._cfg.tCache;r||(this._calculateCurve(),this._setTcache(),r=this._cfg.tCache);var a=this._cfg.curve;if(!r)return a?{x:a[0][1],y:a[0][2]}:null;i.each(r,function(i,r){t>=i[0]&&t<=i[1]&&(e=(t-i[0])/(i[1]-i[0]),n=r)});var o=a[n];if(i.isNil(o)||i.isNil(n))return null;var s=o.length,l=a[n+1];return{x:u.at(o[s-2],l[1],l[3],l[5],1-e),y:u.at(o[s-1],l[2],l[4],l[6],1-e)}},createPath:function(t){var e=this.get("segments");if(i.isArray(e)){(t=t||this.get("context")).beginPath();for(var n=e.length,r=0;ra&&(a=e),io&&(o=i)});var s=e/2;return{minX:n-s,minY:r-s,maxX:a+s,maxY:o+s}},createPath:function(t){var e=this._attrs.points;e.length<2||((t=t||this.get("context")).beginPath(),i.each(e,function(e,n){0===n?t.moveTo(e[0],e[1]):t.lineTo(e[0],e[1])}),t.closePath())}}),t.exports=a},function(t,e,n){var i=n(1),r=n(6),a=n(38),o=n(36),s=function t(e){t.superclass.constructor.call(this,e)};s.ATTRS={points:null,lineWidth:1,startArrow:!1,endArrow:!1,tCache:null},i.extend(s,r),i.augment(s,{canStroke:!0,type:"polyline",tCache:null,getDefaultAttrs:function(){return{lineWidth:1,startArrow:!1,endArrow:!1}},calculateBox:function(){var t=this._attrs,e=this.getHitLineWidth(),n=t.points;if(!n||0===n.length)return null;var r=1/0,a=1/0,o=-1/0,s=-1/0;i.each(n,function(t){var e=t[0],n=t[1];eo&&(o=e),ns&&(s=n)});var l=e/2;return{minX:r-l,minY:a-l,maxX:o+l,maxY:s+l}},_setTcache:function(){var t,e,n=this._attrs.points,r=0,a=0,s=[];n&&0!==n.length&&(i.each(n,function(t,e){n[e+1]&&(r+=o.len(t[0],t[1],n[e+1][0],n[e+1][1]))}),r<=0||(i.each(n,function(i,l){n[l+1]&&((t=[])[0]=a/r,e=o.len(i[0],i[1],n[l+1][0],n[l+1][1]),a+=e,t[1]=a/r,s.push(t))}),this.tCache=s))},createPath:function(t){var e,n,i=this._attrs.points;if(!(i.length<2)){for((t=t||this.get("context")).beginPath(),t.moveTo(i[0][0],i[0][1]),n=1,e=i.length-1;n=i[0]&&t<=i[1]&&(e=(t-i[0])/(i[1]-i[0]),n=r)}),{x:o.at(r[n][0],r[n+1][0],e),y:o.at(r[n][1],r[n+1][1],e)}}}),t.exports=s},function(t,e,n){var i=n(1),r=n(27).parseRadius,a=n(6),o=function t(e){t.superclass.constructor.call(this,e)};o.ATTRS={x:0,y:0,width:0,height:0,radius:0,lineWidth:1},i.extend(o,a),i.augment(o,{canFill:!0,canStroke:!0,type:"rect",getDefaultAttrs:function(){return{lineWidth:1,radius:0}},calculateBox:function(){var t=this._attrs,e=t.x,n=t.y,i=t.width,r=t.height,a=this.getHitLineWidth()/2;return{minX:e-a,minY:n-a,maxX:e+i+a,maxY:n+r+a}},createPath:function(t){var e=this._attrs,n=e.x,i=e.y,a=e.width,o=e.height,s=e.radius;if((t=t||this.get("context")).beginPath(),0===s)t.rect(n,i,a,o);else{var l=r(s);t.moveTo(n+l.r1,i),t.lineTo(n+a-l.r2,i),0!==l.r2&&t.arc(n+a-l.r2,i+l.r2,l.r2,-Math.PI/2,0),t.lineTo(n+a,i+o-l.r3),0!==l.r3&&t.arc(n+a-l.r3,i+o-l.r3,l.r3,0,Math.PI/2),t.lineTo(n+l.r4,i+o),0!==l.r4&&t.arc(n+l.r4,i+o-l.r4,l.r4,Math.PI/2,Math.PI),t.lineTo(n,i+l.r1),0!==l.r1&&t.arc(n+l.r1,i+l.r1,l.r1,Math.PI,1.5*Math.PI),t.closePath()}}}),t.exports=o},function(t,e,n){var i=n(1),r=n(6),a=function t(e){t.superclass.constructor.call(this,e)};a.ATTRS={x:0,y:0,text:null,fontSize:12,fontFamily:"sans-serif",fontStyle:"normal",fontWeight:"normal",fontVariant:"normal",textAlign:"start",textBaseline:"bottom",lineHeight:null,textArr:null},i.extend(a,r),i.augment(a,{canFill:!0,canStroke:!0,type:"text",getDefaultAttrs:function(){return{lineWidth:1,lineCount:1,fontSize:12,fontFamily:"sans-serif",fontStyle:"normal",fontWeight:"normal",fontVariant:"normal",textAlign:"start",textBaseline:"bottom"}},initTransform:function(){var t=this._attrs.fontSize;t&&+t<12&&this.transform([["t",-1*this._attrs.x,-1*this._attrs.y],["s",+t/12,+t/12],["t",this._attrs.x,this._attrs.y]])},_assembleFont:function(){var t=this._attrs,e=t.fontSize,n=t.fontFamily,i=t.fontWeight,r=t.fontStyle,a=t.fontVariant;t.font=[r,a,i,e+"px",n].join(" ")},_setAttrText:function(){var t=this._attrs,e=t.text,n=null;if(i.isString(e)&&-1!==e.indexOf("\n")){var r=(n=e.split("\n")).length;t.lineCount=r}t.textArr=n},_getTextHeight:function(){var t=this._attrs,e=t.lineCount,n=1*t.fontSize;if(e>1){return n*e+this._getSpaceingY()*(e-1)}return n},isHitBox:function(){return!1},calculateBox:function(){var t=this._attrs,e=this._cfg;e.attrs&&!e.hasUpdate||(this._assembleFont(),this._setAttrText()),t.textArr||this._setAttrText();var n=t.x,i=t.y,r=this.measureText();if(!r)return{minX:n,minY:i,maxX:n,maxY:i};var a=this._getTextHeight(),o=t.textAlign,s=t.textBaseline,l=this.getHitLineWidth(),u={x:n,y:i-a};o&&("end"===o||"right"===o?u.x-=r:"center"===o&&(u.x-=r/2)),s&&("top"===s?u.y+=a:"middle"===s&&(u.y+=a/2)),this.set("startPoint",u);var c=l/2;return{minX:u.x-c,minY:u.y-c,maxX:u.x+r+c,maxY:u.y+a+c}},_getSpaceingY:function(){var t=this._attrs,e=t.lineHeight,n=1*t.fontSize;return e?e-n:.14*n},drawInner:function(t){var e=this._attrs,n=this._cfg;n.attrs&&!n.hasUpdate||(this._assembleFont(),this._setAttrText()),t.font=e.font;var r=e.text;if(r){var a=e.textArr,o=e.x,s=e.y;if(t.beginPath(),this.hasStroke()){var l=e.strokeOpacity;i.isNil(l)||1===l||(t.globalAlpha=l),a?this._drawTextArr(t,!1):t.strokeText(r,o,s),t.globalAlpha=1}if(this.hasFill()){var u=e.fillOpacity;i.isNil(u)||1===u||(t.globalAlpha=u),a?this._drawTextArr(t,!0):t.fillText(r,o,s)}n.hasUpdate=!1}},_drawTextArr:function(t,e){var n,r=this._attrs.textArr,a=this._attrs.textBaseline,o=1*this._attrs.fontSize,s=this._getSpaceingY(),l=this._attrs.x,u=this._attrs.y,c=this.getBBox(),h=c.maxY-c.minY;i.each(r,function(i,r){n=u+r*(s+o)-h+o,"middle"===a&&(n+=h-o-(h-o)/2),"top"===a&&(n+=h-o),e?t.fillText(i,l,n):t.strokeText(i,l,n)})},measureText:function(){var t,e=this._attrs,n=e.text,r=e.font,a=e.textArr,o=0;if(!i.isNil(n)){var s=document.createElement("canvas").getContext("2d");return s.save(),s.font=r,a?i.each(a,function(e){t=s.measureText(e).width,ol&&(s=e.slice(l,s),c[u]?c[u]+=s:c[++u]=s),(n=n[0])===(o=o[0])?c[u]?c[u]+=o:c[++u]=o:(c[++u]=null,h.push({i:u,x:Object(i.a)(n,o)})),l=a.lastIndex;return lo&&(n=t,o=s)}),n}}},function(t,e){t.exports=parseInt},function(t,e){t.exports=function(t,e){return t.hasOwnProperty(e)}},function(t,e,n){var i=n(2),r=n(11),a=Object.values?function(t){return Object.values(t)}:function(t){var e=[];return i(t,function(n,i){r(t)&&"prototype"===i||e.push(n)}),e};t.exports=a},function(t,e,n){var i=n(137);t.exports=function(t,e,n,r,a){if(a)return[["M",+t+ +a,e],["l",n-2*a,0],["a",a,a,0,0,1,a,a],["l",0,r-2*a],["a",a,a,0,0,1,-a,a],["l",2*a-n,0],["a",a,a,0,0,1,-a,-a],["l",0,2*a-r],["a",a,a,0,0,1,a,-a],["z"]];var o=[["M",t,e],["l",n,0],["l",0,r],["l",-n,0],["z"]];return o.parsePathArray=i,o}},function(t,e){var n=/,?([a-z]),?/gi;t.exports=function(t){return t.join(",").replace(n,"$1")}},function(t,e,n){var i=n(139),r=function(t,e,n,i){return[t,e,n,i,n,i]},a=function(t,e,n,i,r,a){return[1/3*t+2/3*n,1/3*e+2/3*i,1/3*r+2/3*n,1/3*a+2/3*i,r,a]};t.exports=function(t,e){var n=i(t),o=e&&i(e),s={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},l={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},u=[],c=[],h="",f="",p=void 0,g=function(t,e,n){var i=void 0,o=void 0;if(!t)return["C",e.x,e.y,e.x,e.y,e.x,e.y];switch(!(t[0]in{T:1,Q:1})&&(e.qx=e.qy=null),t[0]){case"M":e.X=t[1],e.Y=t[2];break;case"A":t=["C"].concat(function t(e,n,i,r,a,o,s,l,u,c){i===r&&(i+=1);var h=120*Math.PI/180,f=Math.PI/180*(+a||0),p=[],g=void 0,d=void 0,v=void 0,y=void 0,x=void 0,m=function(t,e,n){return{x:t*Math.cos(n)-e*Math.sin(n),y:t*Math.sin(n)+e*Math.cos(n)}};if(c)d=c[0],v=c[1],y=c[2],x=c[3];else{e=(g=m(e,n,-f)).x,n=g.y,l=(g=m(l,u,-f)).x,u=g.y,e===l&&n===u&&(l+=1,u+=1);var _=(e-l)/2,b=(n-u)/2,w=_*_/(i*i)+b*b/(r*r);w>1&&(i*=w=Math.sqrt(w),r*=w);var S=i*i,M=r*r,C=(o===s?-1:1)*Math.sqrt(Math.abs((S*M-S*b*b-M*_*_)/(S*b*b+M*_*_)));y=C*i*b/r+(e+l)/2,x=C*-r*_/i+(n+u)/2,d=Math.asin(((n-x)/r).toFixed(9)),v=Math.asin(((u-x)/r).toFixed(9)),d=ev&&(d-=2*Math.PI),!s&&v>d&&(v-=2*Math.PI)}var A=v-d;if(Math.abs(A)>h){var k=v,P=l,T=u;v=d+h*(s&&v>d?1:-1),p=t(l=y+i*Math.cos(v),u=x+r*Math.sin(v),i,r,a,0,s,P,T,[v,k,y,x])}A=v-d;var I=Math.cos(d),O=Math.sin(d),L=Math.cos(v),E=Math.sin(v),D=Math.tan(A/4),F=4/3*i*D,B=4/3*r*D,R=[e,n],j=[e+F*O,n-B*I],N=[l+F*E,u-B*L],z=[l,u];if(j[0]=2*R[0]-j[0],j[1]=2*R[1]-j[1],c)return[j,N,z].concat(p);for(var Y=[],V=0,X=(p=[j,N,z].concat(p).join().split(",")).length;V7){t[e].shift();for(var i=t[e];i.length;)u[e]="A",o&&(c[e]="A"),t.splice(e++,0,["C"].concat(i.splice(0,6)));t.splice(e,1),p=Math.max(n.length,o&&o.length||0)}},v=function(t,e,i,r,a){t&&e&&"M"===t[a][0]&&"M"!==e[a][0]&&(e.splice(a,0,["M",r.x,r.y]),i.bx=0,i.by=0,i.x=t[a][1],i.y=t[a][2],p=Math.max(n.length,o&&o.length||0))};p=Math.max(n.length,o&&o.length||0);for(var y=0;y180),0,l,e+n*Math.sin(-r*o)]]}else a=[["M",t,e],["m",0,-i],["a",n,i,0,1,1,0,2*i],["a",n,i,0,1,1,0,-2*i],["z"]];return a}var r=n(140),a=n(141);t.exports=function(t){if(!(t=r(t))||!t.length)return[["M",0,0]];var e=[],n=0,o=0,s=0,l=0,u=0,c=void 0,h=void 0;"M"===t[0][0]&&(s=n=+t[0][1],l=o=+t[0][2],u++,e[0]=["M",n,o]);for(var f,p,g=3===t.length&&"M"===t[0][0]&&"R"===t[1][0].toUpperCase()&&"Z"===t[2][0].toUpperCase(),d=u,v=t.length;d2&&(i.push([n].concat(o.splice(0,2))),s="l",n="m"===n?"l":"L"),"o"===s&&1===o.length&&i.push([n,o[0]]),"r"===s)i.push([n].concat(o));else for(;o.length>=e[s]&&(i.push([n].concat(o.splice(0,e[s]))),e[s]););}),i}},function(t,e){t.exports=function(t,e){for(var n=[],i=0,r=t.length;r-2*!e>i;i+=2){var a=[{x:+t[i-2],y:+t[i-1]},{x:+t[i],y:+t[i+1]},{x:+t[i+2],y:+t[i+3]},{x:+t[i+4],y:+t[i+5]}];e?i?r-4===i?a[3]={x:+t[0],y:+t[1]}:r-2===i&&(a[2]={x:+t[0],y:+t[1]},a[3]={x:+t[2],y:+t[3]}):a[0]={x:+t[r-2],y:+t[r-1]}:r-4===i?a[3]=a[2]:i||(a[0]={x:+t[i],y:+t[i+1]}),n.push(["C",(-a[0].x+6*a[1].x+a[2].x)/6,(-a[0].y+6*a[1].y+a[2].y)/6,(a[1].x+6*a[2].x-a[3].x)/6,(a[1].y+6*a[2].y-a[3].y)/6,a[2].x,a[2].y])}return n}},function(t,e,n){var i=n(23);t.exports=function(t){return i(t).toLowerCase()}},function(t,e,n){var i=n(23);t.exports=function(t){return i(t).toUpperCase()}},function(t,e,n){var i=n(145);t.exports=function(t,e){if(!e)return[t];var n=i(t,e),r=[];for(var a in n)r.push(n[a]);return r}},function(t,e,n){var i=n(11),r=n(4),a=n(146);t.exports=function(t,e){if(!e)return{0:t};if(!i(e)){var n=r(e)?e:e.replace(/\s+/g,"").split("*");e=function(t){for(var e="_",i=0,r=n.length;i');t.appendChild(a),this.set("wrapperEl",a),this.get("forceFit")&&(n=s.getWidth(t,n),this.set("width",n));var l=this.get("renderer"),u=new o({containerDOM:a,width:n,height:i,pixelRatio:"svg"===l?1:this.get("pixelRatio"),renderer:l});this.set("canvas",u)},n._initPlot=function(){this._initPlotBack();var t=this.get("canvas"),e=t.addGroup({zIndex:1}),n=t.addGroup({zIndex:0}),i=t.addGroup({zIndex:3});this.set("backPlot",e),this.set("middlePlot",n),this.set("frontPlot",i)},n._initPlotBack=function(){var t=this.get("canvas"),e=this.get("viewTheme"),n=t.addGroup(u,{padding:this.get("padding"),plotBackground:r.mix({},e.plotBackground,this.get("plotBackground")),background:r.mix({},e.background,this.get("background"))});this.set("plot",n),this.set("plotRange",n.get("plotRange"))},n._initEvents=function(){this.get("forceFit")&&window.addEventListener("resize",r.wrapBehavior(this,"_initForceFitEvent"))},n._initForceFitEvent=function(){var t=setTimeout(r.wrapBehavior(this,"forceFit"),200);clearTimeout(this.get("resizeTimer")),this.set("resizeTimer",t)},n._renderLegends=function(){var t=this.get("options").legends;if(r.isNil(t)||!1!==t){var e=this.get("legendController");if(e.options=t||{},e.plotRange=this.get("plotRange"),t&&t.custom)e.addCustomLegend();else{var n=this.getAllGeoms(),i=[];r.each(n,function(t){var n=t.get("view"),a=t.getAttrsForLegend();r.each(a,function(a){var o=a.type,s=a.getScale(o);if(s.field&&"identity"!==s.type&&!function(t,e){var n=!1;return r.each(t,function(t){var i=[].concat(t.values),r=[].concat(e.values);t.type!==e.type||t.field!==e.field||i.sort().toString()!==r.sort().toString()||(n=!0)}),n}(i,s)){i.push(s);var l=n.getFilteredOutValues(s.field);e.addLegend(s,a,t,l)}})});var a=this.getYScales();0===i.length&&a.length>1&&e.addMixedLegend(a,n)}e.alignLegends()}},n._renderTooltips=function(){var t=this.get("options");if(r.isNil(t.tooltip)||!1!==t.tooltip){var e=this.get("tooltipController");e.options=t.tooltip||{},e.renderTooltip()}},n.getAllGeoms=function(){var t=[];t=t.concat(this.get("geoms"));var e=this.get("views");return r.each(e,function(e){t=t.concat(e.get("geoms"))}),t},n.forceFit=function(){if(this&&!this.destroyed){var t=this.get("container"),e=this.get("width"),n=s.getWidth(t,e);if(0!==n&&n!==e){var i=this.get("height");this.changeSize(n,i)}return this}},n.resetPlot=function(){var t=this.get("plot"),e=this.get("padding");i(e,t.get("padding"))||(t.set("padding",e),t.repaint())},n.changeSize=function(t,e){this.get("canvas").changeSize(t,e);var n=this.get("plot");return this.set("width",t),this.set("height",e),n.repaint(),this.set("keepPadding",!0),this.repaint(),this.set("keepPadding",!1),this.emit("afterchangesize"),this},n.changeWidth=function(t){return this.changeSize(t,this.get("height"))},n.changeHeight=function(t){return this.changeSize(this.get("width"),t)},n.view=function(t){(t=t||{}).theme=this.get("theme"),t.parent=this,t.backPlot=this.get("backPlot"),t.middlePlot=this.get("middlePlot"),t.frontPlot=this.get("frontPlot"),t.canvas=this.get("canvas"),r.isNil(t.animate)&&(t.animate=this.get("animate")),t.options=r.mix({},this._getSharedOptions(),t.options);var e=new a(t);return e.set("_id","view"+this.get("views").length),this.get("views").push(e),this.emit("addview",{view:e}),e},n.removeView=function(t){var e=this.get("views");r.Array.remove(e,t),t.destroy()},n._getSharedOptions=function(){var t=this.get("options"),e={};return r.each(["scales","coord","axes"],function(n){e[n]=r.cloneDeep(t[n])}),e},n.getViewRegion=function(){var t=this.get("plotRange");return{start:t.bl,end:t.tr}},n.legend=function(t,e){var n=this.get("options");n.legends||(n.legends={});var i={};return!1===t?n.legends=!1:r.isObject(t)?i=t:r.isString(t)?i[t]=e:i=e,r.mix(n.legends,i),this},n.tooltip=function(t,e){var n=this.get("options");return n.tooltip||(n.tooltip={}),!1===t?n.tooltip=!1:r.isObject(t)?r.mix(n.tooltip,t):r.mix(n.tooltip,e),this},n.clear=function(){this.emit("beforeclear");for(var e=this.get("views");e.length>0;){e.shift().destroy()}t.prototype.clear.call(this);var n=this.get("canvas");return this.resetPlot(),n.draw(),this.emit("afterclear"),this},n.clearInner=function(){var e=this.get("views");r.each(e,function(t){t.clearInner()});var n=this.get("tooltipController");if(n&&n.clear(),!this.get("keepLegend")){var i=this.get("legendController");i&&i.clear()}t.prototype.clearInner.call(this)},n.drawComponents=function(){t.prototype.drawComponents.call(this),this.get("keepLegend")||this._renderLegends()},n.render=function(){if(!this.get("keepPadding")&&this._isAutoPadding()){this.beforeRender(),this.drawComponents();var e=this._getAutoPadding(),n=this.get("plot");i(n.get("padding"),e)||(n.set("padding",e),n.repaint())}var a=this.get("middlePlot");if(this.get("limitInPlot")&&!a.attr("clip")){var o=r.getClipByRange(this.get("plotRange"));a.attr("clip",o)}t.prototype.render.call(this),this._renderTooltips()},n.repaint=function(){this.get("keepPadding")||this.resetPlot(),t.prototype.repaint.call(this)},n.changeVisible=function(t){var e=this.get("wrapperEl"),n=t?"":"none";e.style.display=n},n.toDataURL=function(){var t=this.get("canvas"),e=this.get("renderer"),n=t.get("el"),i="";if("svg"===e){var r=n.cloneNode(!0),a=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),o=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",a);o.replaceChild(r,o.documentElement);var s=(new XMLSerializer).serializeToString(o);i="data:image/svg+xml;charset=utf8,"+encodeURIComponent(s)}else"canvas"===e&&(i=n.toDataURL("image/png"));return i},n.downloadImage=function(t){var e=this,n=document.createElement("a"),i=e.get("renderer"),r=(t||"chart")+("svg"===i?".svg":".png");e.get("canvas").get("timeline").stopAllAnimations(),setTimeout(function(){var t=e.toDataURL();if(window.Blob&&window.URL&&"svg"!==i){for(var a=t.split(","),o=a[0].match(/:(.*?);/)[1],s=atob(a[1]),l=s.length,u=new Uint8Array(l);l--;)u[l]=s.charCodeAt(l);var c=new Blob([u],{type:o});window.navigator.msSaveBlob?window.navigator.msSaveBlob(c,r):n.addEventListener("click",function(){n.download=r,n.href=window.URL.createObjectURL(c)})}else n.addEventListener("click",function(){n.download=r,n.href=t});var h=document.createEvent("MouseEvents");h.initEvent("click",!1,!1),n.dispatchEvent(h)},16)},n.showTooltip=function(t){var e=this.getViewsByPoint(t);if(e.length){this.get("tooltipController").showTooltip(t,e)}return this},n.hideTooltip=function(){return this.get("tooltipController").hideTooltip(),this},n.getTooltipItems=function(t){var e=this.getViewsByPoint(t),n=[];return r.each(e,function(e){var i=e.get("geoms");r.each(i,function(e){var i=e.get("dataArray"),a=[];r.each(i,function(n){var i=e.findPoint(t,n);if(i){var r=e.getTipItems(i);a=a.concat(r)}}),n=n.concat(a)})}),n},n.destroy=function(){this.emit("beforedestroy"),clearTimeout(this.get("resizeTimer"));var e=this.get("canvas"),n=this.get("wrapperEl");n.parentNode.removeChild(n),t.prototype.destroy.call(this),e.destroy(),window.removeEventListener("resize",r.getWrapBehavior(this,"_initForceFitEvent")),this.emit("afterdestroy")},e}(a);t.exports=g},function(t,e,n){var i=n(53),r=n(0),a=function(t){function e(e){var n,i={visible:!0},a=(n=t.call(this)||this).getDefaultCfg();return n._attrs=i,r.assign(i,a,e),n}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){return{}},n.get=function(t){return this._attrs[t]},n.set=function(t,e){this._attrs[t]=e},n.show=function(){this.get("visible")||(this.set("visible",!0),this.changeVisible(!0))},n.hide=function(){this.get("visible")&&(this.set("visible",!1),this.changeVisible(!1))},n.changeVisible=function(){},n.destroy=function(){this._attrs={},this.removeAllListeners(),this.destroyed=!0},e}(i);t.exports=a},function(t,e,n){function i(t,e,n,i){return t[i]+(e[i]-t[i])*n}function r(t){return"#"+a(t[0])+a(t[1])+a(t[2])}function a(t){return t=Math.round(t),1===(t=t.toString(16)).length&&(t="0"+t),t}function o(t){var e=[];return e.push(parseInt(t.substr(1,2),16)),e.push(parseInt(t.substr(3,2),16)),e.push(parseInt(t.substr(5,2),16)),e}var s=n(9),l=n(10),u=n(2),c=/rgba?\(([\s.,0-9]+)\)/,h={},f=null,p={toRGB:function(t){if("#"===t[0]&&7===t.length)return t;f||(f=function(){var t=document.createElement("i");return t.title="Web Colour Picker",t.style.display="none",document.body.appendChild(t),t}());var e;if(h[t])e=h[t];else{f.style.color=t,e=document.defaultView.getComputedStyle(f,"").getPropertyValue("color");e=r(c.exec(e)[1].split(/\s*,\s*/)),h[t]=e}return e},rgb2arr:o,gradient:function(t){var e=[];return l(t)&&(t=t.split("-")),u(t,function(t){-1===t.indexOf("#")&&(t=p.toRGB(t)),e.push(o(t))}),function(t){return function(t,e){(isNaN(e)||!s(e)||e<0)&&(e=0),e>1&&(e=1);var n=t.length-1,a=Math.floor(n*e),o=n*e-a,l=t[a],u=a===n?l:t[a+1];return r([i(l,u,o,0),i(l,u,o,1),i(l,u,o,2)])}(e,t)}}};t.exports=p},function(t,e,n){var i=n(2),r={values:n(64)};t.exports={isAdjust:function(t){return this.adjustNames.indexOf(t)>=0},_getDimValues:function(t){var e={},n=[];if(this.xField&&this.isAdjust("x")&&n.push(this.xField),this.yField&&this.isAdjust("y")&&n.push(this.yField),i(n,function(n){var i=r.values(t,n);i.sort(function(t,e){return t-e}),e[n]=i}),!this.yField&&this.isAdjust("y")){var a=[0,1];e.y=a}return e},adjustData:function(t,e){var n=this,r=n._getDimValues(e);i(t,function(e,a){i(r,function(i,r){n.adjustDim(r,i,e,t.length,a)})})},getAdjustRange:function(t,e,n){var i,r,a=n.indexOf(e),o=n.length;return!this.yField&&this.isAdjust("y")?(i=0,r=1):o>1?(i=0===a?n[0]:n[a-1],r=a===o-1?n[o-1]:n[a+1],0!==a?i+=(e-i)/2:i-=(r-e)/2,a!==o-1?r-=(r-e)/2:r+=(e-n[o-2])/2):(i=0===e?0:e-.5,r=0===e?1:e+.5),{pre:i,next:r}},groupData:function(t,e){var n={};return i(t,function(t){var i=t[e];void 0===i&&(i=t[e]=0),n[i]||(n[i]=[]),n[i].push(t)}),n}}},function(t,e,n){var i={default:n(152),dark:n(304)};t.exports=i},function(t,e){var n,i,r='"-apple-system", BlinkMacSystemFont, "Segoe UI", Roboto,"Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",SimSun, "sans-serif"',a={defaultColor:"#1890FF",plotCfg:{padding:[20,20,95,80]},fontFamily:r,defaultLegendPosition:"bottom",colors:["#1890FF","#2FC25B","#FACC14","#223273","#8543E0","#13C2C2","#3436C7","#F04864"],colors_16:["#1890FF","#41D9C7","#2FC25B","#FACC14","#E6965C","#223273","#7564CC","#8543E0","#5C8EE6","#13C2C2","#5CA3E6","#3436C7","#B381E6","#F04864","#D598D9"],colors_24:["#1890FF","#66B5FF","#41D9C7","#2FC25B","#6EDB8F","#9AE65C","#FACC14","#E6965C","#57AD71","#223273","#738AE6","#7564CC","#8543E0","#A877ED","#5C8EE6","#13C2C2","#70E0E0","#5CA3E6","#3436C7","#8082FF","#DD81E6","#F04864","#FA7D92","#D598D9"],colors_pie:["#1890FF","#13C2C2","#2FC25B","#FACC14","#F04864","#8543E0","#3436C7","#223273"],colors_pie_16:["#1890FF","#73C9E6","#13C2C2","#6CD9B3","#2FC25B","#9DD96C","#FACC14","#E6965C","#F04864","#D66BCA","#8543E0","#8E77ED","#3436C7","#737EE6","#223273","#7EA2E6"],shapes:{point:["hollowCircle","hollowSquare","hollowDiamond","hollowBowtie","hollowTriangle","hollowHexagon","cross","tick","plus","hyphen","line"],line:["line","dash","dot"],area:["area"]},sizes:[1,10],opacities:[.1,.9],axis:{top:{position:"top",title:null,label:{offset:16,textStyle:{fill:"#545454",fontSize:12,lineHeight:16,textBaseline:"middle",fontFamily:r},autoRotate:!0},line:{lineWidth:1,stroke:"#BFBFBF"},tickLine:{lineWidth:1,stroke:"#BFBFBF",length:4,alignWithLabel:!0}},bottom:{position:"bottom",title:null,label:{offset:16,autoRotate:!0,textStyle:{fill:"#545454",fontSize:12,lineHeight:16,textBaseline:"middle",fontFamily:r}},line:{lineWidth:1,stroke:"#BFBFBF"},tickLine:{lineWidth:1,stroke:"#BFBFBF",length:4,alignWithLabel:!0}},left:{position:"left",title:null,label:{offset:8,autoRotate:!0,textStyle:{fill:"#545454",fontSize:12,lineHeight:16,textBaseline:"middle",fontFamily:r}},line:null,tickLine:null,grid:{zIndex:-1,lineStyle:{stroke:"#E9E9E9",lineWidth:1,lineDash:[3,3]},hideFirstLine:!0}},right:{position:"right",title:null,label:{offset:8,autoRotate:!0,textStyle:{fill:"#545454",fontSize:12,lineHeight:16,textBaseline:"middle",fontFamily:r}},line:null,tickLine:null,grid:{lineStyle:{stroke:"#E9E9E9",lineWidth:1,lineDash:[3,3]},hideFirstLine:!0}},circle:{zIndex:1,title:null,label:{offset:8,textStyle:{fill:"#545454",fontSize:12,lineHeight:16,fontFamily:r}},line:{lineWidth:1,stroke:"#BFBFBF"},tickLine:{lineWidth:1,stroke:"#BFBFBF",length:4,alignWithLabel:!0},grid:{lineStyle:{stroke:"#E9E9E9",lineWidth:1,lineDash:[3,3]},hideFirstLine:!0}},radius:{zIndex:0,label:{offset:12,textStyle:{fill:"#545454",fontSize:12,textBaseline:"middle",lineHeight:16,fontFamily:r}},line:{lineWidth:1,stroke:"#BFBFBF"},tickLine:{lineWidth:1,stroke:"#BFBFBF",length:4,alignWithLabel:!0},grid:{lineStyle:{stroke:"#E9E9E9",lineWidth:1,lineDash:[3,3]},type:"circle"}},helix:{grid:null,label:null,title:null,line:{lineWidth:1,stroke:"#BFBFBF"},tickLine:{lineWidth:1,length:4,stroke:"#BFBFBF",alignWithLabel:!0}}},label:{offset:20,textStyle:{fill:"#545454",fontSize:12,textBaseline:"middle",fontFamily:r}},treemapLabels:{offset:10,textStyle:{fill:"#fff",fontSize:12,textBaseline:"top",fontStyle:"bold",fontFamily:r}},innerLabels:{textStyle:{fill:"#fff",fontSize:12,textBaseline:"middle",fontFamily:r}},thetaLabels:{labelHeight:14,offset:30},legend:{right:{position:"right",layout:"vertical",itemMarginBottom:8,width:16,height:156,title:null,legendStyle:{LIST_CLASS:{textAlign:"left"}},textStyle:{fill:"#8C8C8C",fontSize:12,textAlign:"start",textBaseline:"middle",lineHeight:0,fontFamily:r},unCheckColor:"#bfbfbf"},left:{position:"left",layout:"vertical",itemMarginBottom:8,width:16,height:156,title:null,textStyle:{fill:"#8C8C8C",fontSize:12,textAlign:"start",textBaseline:"middle",lineHeight:20,fontFamily:r},unCheckColor:"#bfbfbf"},top:{position:"top",offset:[0,6],layout:"horizontal",title:null,itemGap:10,width:156,height:16,textStyle:{fill:"#8C8C8C",fontSize:12,textAlign:"start",textBaseline:"middle",lineHeight:20,fontFamily:r},unCheckColor:"#bfbfbf"},bottom:{position:"bottom",offset:[0,6],layout:"horizontal",title:null,itemGap:10,width:156,height:16,textStyle:{fill:"#8C8C8C",fontSize:12,textAlign:"start",textBaseline:"middle",lineHeight:20,fontFamily:r},unCheckColor:"#bfbfbf"},html:(n={},n["g2-legend"]={height:"auto",width:"auto",position:"absolute",overflow:"auto",fontSize:"12px",fontFamily:r,lineHeight:"20px",color:"#8C8C8C"},n["g2-legend-title"]={marginBottom:"4px"},n["g2-legend-list"]={listStyleType:"none",margin:0,padding:0},n["g2-legend-list-item"]={cursor:"pointer",marginBottom:"5px",marginRight:"24px"},n["g2-legend-marker"]={width:"9px",height:"9px",borderRadius:"50%",display:"inline-block",marginRight:"8px",verticalAlign:"middle"},n),gradient:{textStyle:{fill:"#8C8C8C",fontSize:12,textAlign:"center",textBaseline:"middle",lineHeight:20,fontFamily:r},lineStyle:{lineWidth:1,stroke:"#fff"},unCheckColor:"#bfbfbf"},margin:[0,5,24,5],legendMargin:24},tooltip:(i={useHtml:!0,crosshairs:!1,offset:15},i["g2-tooltip"]={position:"absolute",visibility:"hidden",zIndex:8,transition:"visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1), left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.4s cubic-bezier(0.23, 1, 0.32, 1)",backgroundColor:"rgba(255, 255, 255, 0.9)",boxShadow:"0px 0px 10px #aeaeae",borderRadius:"3px",color:"rgb(87, 87, 87)",fontSize:"12px",fontFamily:r,lineHeight:"20px",padding:"10px 10px 6px 10px"},i["g2-tooltip-title"]={marginBottom:"4px"},i["g2-tooltip-list"]={margin:0,listStyleType:"none",padding:0},i["g2-tooltip-list-item"]={marginBottom:"4px"},i["g2-tooltip-marker"]={width:"5px",height:"5px",borderRadius:"50%",display:"inline-block",marginRight:"8px"},i["g2-tooltip-value"]={display:"inline-block",float:"right",marginLeft:"30px"},i),tooltipMarker:{symbol:function(t,e,n){return[["M",t,e],["m",-n,0],["a",n,n,0,1,0,2*n,0],["a",n,n,0,1,0,2*-n,0]]},stroke:"#fff",shadowBlur:10,shadowOffsetX:0,shadowOffSetY:0,shadowColor:"rgba(0,0,0,0.09)",lineWidth:2,radius:4},tooltipCrosshairsRect:{type:"rect",rectStyle:{fill:"#CCD6EC",opacity:.3}},tooltipCrosshairsLine:{lineStyle:{stroke:"rgba(0, 0, 0, 0.25)",lineWidth:1}},shape:{point:{lineWidth:1,fill:"#1890FF",radius:4},hollowPoint:{fill:"#fff",lineWidth:1,stroke:"#1890FF",radius:3},interval:{lineWidth:0,fill:"#1890FF",fillOpacity:.85},hollowInterval:{fill:"#fff",stroke:"#1890FF",fillOpacity:0,lineWidth:2},area:{lineWidth:0,fill:"#1890FF",fillOpacity:.6},polygon:{lineWidth:0,fill:"#1890FF",fillOpacity:1},hollowPolygon:{fill:"#fff",stroke:"#1890FF",fillOpacity:0,lineWidth:2},hollowArea:{fill:"#fff",stroke:"#1890FF",fillOpacity:0,lineWidth:2},line:{stroke:"#1890FF",lineWidth:2,fill:null},edge:{stroke:"#1890FF",lineWidth:1,fill:null},schema:{stroke:"#1890FF",lineWidth:1,fill:null}},guide:{line:{lineStyle:{stroke:"rgba(0, 0, 0, .65)",lineDash:[2,2],lineWidth:1},text:{position:"start",autoRotate:!0,style:{fill:"rgba(0, 0, 0, .45)",fontSize:12,textAlign:"start",fontFamily:r,textBaseline:"bottom"}}},text:{style:{fill:"rgba(0,0,0,.5)",fontSize:12,textBaseline:"middle",textAlign:"start",fontFamily:r}},region:{style:{lineWidth:0,fill:"#000",fillOpacity:.04}},html:{alignX:"middle",alignY:"middle"},dataRegion:{style:{region:{lineWidth:0,fill:"#000000",opacity:.04},text:{textAlign:"center",textBaseline:"bottom",fontSize:12,fill:"rgba(0, 0, 0, .65)"}}},dataMarker:{top:!0,style:{point:{r:3,fill:"#FFFFFF",stroke:"#1890FF",lineWidth:2},line:{stroke:"#A3B1BF",lineWidth:1},text:{fill:"rgba(0, 0, 0, .65)",opacity:1,fontSize:12,textAlign:"start"}},display:{point:!0,line:!0,text:!0},lineLength:20,direction:"upward",autoAdjust:!0}},pixelRatio:null};t.exports=a},function(t,e,n){var i=n(25).Group,r=n(3),a=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){return{zIndex:1,type:"line",lineStyle:null,items:null,alternateColor:null,matrix:null,hideFirstLine:!1,hideLastLine:!1,hightLightZero:!1,zeroLineStyle:{stroke:"#595959",lineDash:[0,0]}}},n._renderUI=function(){t.prototype._renderUI.call(this),this._drawLines()},n._drawLines=function(){var t=this.get("lineStyle"),e=this.get("items");e&&e.length&&(this._precessItems(e),this._drawGridLines(e,t))},n._precessItems=function(t){var e,n=this;r.each(t,function(t,i){e&&n.get("alternateColor")&&n._drawAlternativeBg(t,e,i),e=t})},n._drawGridLines=function(t,e){var n,i,a,o,s=this,l=this.get("type"),u=t.length;"line"===l||"polygon"===l?r.each(t,function(t,c){s.get("hideFirstLine")&&0===c||s.get("hideLastLine")&&c===u-1||(o=t.points,i=[],"line"===l?(i.push(["M",o[0].x,o[0].y]),i.push(["L",o[o.length-1].x,o[o.length-1].y])):r.each(o,function(t,e){0===e?i.push(["M",t.x,t.y]):i.push(["L",t.x,t.y])}),a=s._drawZeroLine(l,c)?r.mix({},s.get("zeroLineStyle"),{path:i}):r.mix({},e,{path:i}),(n=s.addShape("path",{attrs:a})).name="axis-grid",n._id=t._id,n.set("coord",s.get("coord")),s.get("appendInfo")&&n.setSilent("appendInfo",s.get("appendInfo")))}):r.each(t,function(t,l){s.get("hideFirstLine")&&0===l||s.get("hideLastLine")&&l===u-1||(o=t.points,i=[],r.each(o,function(t,e){var n=t.radius;0===e?i.push(["M",t.x,t.y]):i.push(["A",n,n,0,0,t.flag,t.x,t.y])}),a=r.mix({},e,{path:i}),(n=s.addShape("path",{attrs:a})).name="axis-grid",n._id=t._id,n.set("coord",s.get("coord")),s.get("appendInfo")&&n.setSilent("appendInfo",s.get("appendInfo")))})},n._drawZeroLine=function(t,e){var n=this.get("tickValues");return!("line"!==t||!n||0!==n[e]||!this.get("hightLightZero"))},n._drawAlternativeBg=function(t,e,n){var i,a,o,s=this.get("alternateColor");r.isString(s)?a=s:r.isArray(s)&&(a=s[0],o=s[1]),n%2==0?o&&(i=this._getBackItem(e.points,t.points,o)):a&&(i=this._getBackItem(e.points,t.points,a));var l=this.addShape("Path",{attrs:i});l.name="axis-grid-rect",l._id=t._id&&t._id.replace("grid","grid-rect"),l.set("coord",this.get("coord")),this.get("appendInfo")&&l.setSilent("appendInfo",this.get("appendInfo"))},n._getBackItem=function(t,e,n){var i=[],a=this.get("type");if("line"===a)i.push(["M",t[0].x,t[0].y]),i.push(["L",t[t.length-1].x,t[t.length-1].y]),i.push(["L",e[e.length-1].x,e[e.length-1].y]),i.push(["L",e[0].x,e[0].y]),i.push(["Z"]);else if("polygon"===a){r.each(t,function(t,e){0===e?i.push(["M",t.x,t.y]):i.push(["L",t.x,t.y])});for(var o=e.length-1;o>=0;o--)i.push(["L",e[o].x,e[o].y]);i.push(["Z"])}else{var s=t[0].flag;r.each(t,function(t,e){var n=t.radius;0===e?i.push(["M",t.x,t.y]):i.push(["A",n,n,0,0,t.flag,t.x,t.y])});for(var l=e.length-1;l>=0;l--){var u=e[l],c=u.radius;l===e.length-1?i.push(["M",u.x,u.y]):i.push(["A",c,c,0,0,1===s?0:1,u.x,u.y])}}return{fill:n,path:i}},e}(i);t.exports=a},function(t,e,n){var i=n(3),r=i.DomUtil,a=n(32),o={scatter:n(307),map:n(308),treemap:n(309)},s=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return i.mix({},e,{name:"label",type:"default",textStyle:null,formatter:null,items:null,useHtml:!1,containerTpl:'
    ',itemTpl:'
    {text}
    ',labelLine:!1,lineGroup:null,shapes:null,config:!0,capture:!0})},n.clear=function(){var e=this.get("group"),n=this.get("container");e&&!e.get("destroyed")&&e.clear(),n&&(n.innerHTML=""),t.prototype.clear.call(this)},n.destroy=function(){var t=this.get("group"),e=this.get("container");t.destroy||t.destroy(),e&&(e.innerHTML="")},n.render=function(){this.clear(),this._init(),this.beforeDraw(),this.draw(),this.afterDraw()},n._dryDraw=function(){var t=this,e=t.get("items"),n=t.getLabels(),r=n.length;i.each(e,function(e,i){if(i=e.length;a--)n[a].remove();t._adjustLabels(),!t.get("labelLine")&&t.get("config")||t.drawLines()},n.draw=function(){this._dryDraw(),this.get("canvas").draw()},n.changeLabel=function(t,e){if(t)if(t.tagName){var n=this._createDom(e);t.innerHTML=n.innerHTML,this._setCustomPosition(e,t)}else t._id=e._id,t.attr("text",e.text),t.attr("x")===e.x&&t.attr("y")===e.y||(t.resetMatrix(),e.textStyle.rotate&&(t.rotateAtStart(e.textStyle.rotate),delete e.textStyle.rotate),t.attr(e))},n.show=function(){var t=this.get("group"),e=this.get("container");t&&t.show(),e&&(e.style.opacity=1)},n.hide=function(){var t=this.get("group"),e=this.get("container");t&&t.hide(),e&&(e.style.opacity=0)},n.drawLines=function(){var t=this;"boolean"==typeof t.get("labelLine")&&t.set("labelLine",{});var e=t.get("lineGroup");!e||e.get("destroyed")?(e=t.get("group").addGroup({elCls:"x-line-group"}),t.set("lineGroup",e)):e.clear(),i.each(t.get("items"),function(n){t.lineToLabel(n,e)})},n.lineToLabel=function(t,e){if(this.get("config")||t.labelLine){var n=t.labelLine||this.get("labelLine"),r=void 0===t.capture?this.get("capture"):t.capture,a=n.path;if(a&&i.isFunction(n.path)&&(a=n.path(t)),!a){var o=t.start||{x:t.x-t._offset.x,y:t.y-t._offset.y};a=[["M",o.x,o.y],["L",t.x,t.y]]}var s=t.color;s||(s=t.textStyle&&t.textStyle.fill?t.textStyle.fill:"#000");var l=e.addShape("path",{attrs:i.mix({path:a,fill:null,stroke:s},n),capture:r});l.name=this.get("name"),l._id=t._id&&t._id.replace("glabel","glabelline"),l.set("coord",this.get("coord"))}},n._adjustLabels=function(){var t=this.get("type"),e=this.getLabels(),n=this.get("shapes"),i=o[t];"default"!==t&&i&&i(e,n)},n.getLabels=function(){var t=this.get("container");return t?i.toArray(t.childNodes):this.get("group").get("children")},n._addLabel=function(t,e){var n=t;return this.get("config")&&(n=this._getLabelCfg(t,e)),this._createText(n)},n._getLabelCfg=function(t,e){var n=this.get("textStyle")||{},r=this.get("formatter"),a=this.get("htmlTemplate");if(!i.isObject(t)){var o=t;(t={}).text=o}i.isFunction(n)&&(n=n(t.text,t,e)),r&&(t.text=r(t.text,t,e)),a&&(t.useHtml=!0,i.isFunction(a)&&(t.text=a(t.text,t,e))),i.isNil(t.text)&&(t.text=""),t.text=t.text+"";return i.mix({},t,{textStyle:n},{x:t.x||0,y:t.y||0})},n._init=function(){if(!this.get("group")){var t=this.get("canvas").addGroup({id:"label-group"});this.set("group",t)}},n.initHtmlContainer=function(){var t=this.get("container");if(t)i.isString(t)&&(t=document.getElementById(t))&&this.set("container",t);else{var e=this.get("containerTpl"),n=this.get("canvas").get("el").parentNode;t=r.createDom(e),n.style.position="relative",n.appendChild(t),this.set("container",t)}return t},n._createText=function(t){var e,n=this.get("container"),r=void 0===t.capture?this.get("capture"):t.capture;if(!t.useHtml&&!t.htmlTemplate){var a=this.get("name"),o=t.point,s=this.get("group");delete t.point;var l=t.rotate;return t.textStyle&&(t.textStyle.rotate&&(l=t.textStyle.rotate,delete t.textStyle.rotate),t=i.mix({x:t.x,y:t.y,textAlign:t.textAlign,text:t.text},t.textStyle)),e=s.addShape("text",{attrs:t,capture:r}),l&&(Math.abs(l)>2*Math.PI&&(l=l/180*Math.PI),e.transform([["t",-t.x,-t.y],["r",l],["t",t.x,t.y]])),e.setSilent("origin",o||t),e.name=a,this.get("appendInfo")&&e.setSilent("appendInfo",this.get("appendInfo")),e}n||(n=this.initHtmlContainer());var u=this._createDom(t);n.appendChild(u),this._setCustomPosition(t,u)},n._createDom=function(t){var e=this.get("itemTpl"),n=i.substitute(e,{text:t.text});return r.createDom(n)},n._setCustomPosition=function(t,e){var n=t.textAlign||"left",i=t.y,a=t.x,o=r.getOuterWidth(e);i-=r.getOuterHeight(e)/2,"center"===n?a-=o/2:"right"===n&&(a-=o),e.style.top=parseInt(i,10)+"px",e.style.left=parseInt(a,10)+"px"},e}(a);t.exports=s},function(t,e){var n=function(){function t(){this.bitmap=[]}var e=t.prototype;return e.hasGap=function(t){for(var e=!0,n=this.bitmap,i=Math.floor(t.minX),r=Math.ceil(t.maxX),a=Math.floor(t.minY),o=Math.ceil(t.maxY)-1,s=i;sn&&a.each(e,function(t){h=t.getBBox(),u=f||h.width,c=h.height+r,n-li&&a.each(n,function(t){p=t.getBBox(),h=p.width,f=p.height,u?g=u+r:h>g&&(g=h+r),i-c-1?t:t.parentNode?t.parentNode.className===h?t.parentNode:r(t.parentNode,e):null}function a(t,e){var n=null,i=e instanceof c?e.get("value"):e;return o.each(t,function(t){if(t.value===i)return n=t,!1}),n}var o=n(3),s=n(157),l=n(14).FONT_FAMILY,u=o.DomUtil,c=o.Group,h="g2-legend",f="g2-legend-list",p="g2-legend-list-item",g="g2-legend-marker",d=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return o.mix({},e,{type:"category-legend",container:null,containerTpl:'

      ',itemTpl:'
    • {value}
    • ',legendStyle:{},textStyle:{fill:"#333",fontSize:12,textAlign:"middle",textBaseline:"top",fontFamily:l},abridgeText:!1,tipTpl:'
      ',tipStyle:{display:"none",fontSize:"12px",backgroundColor:"#fff",position:"absolute",width:"auto",height:"auto",padding:"3px",boxShadow:"2px 2px 5px #888"},autoPosition:!0})},n._init=function(){},n.beforeRender=function(){},n.render=function(){this._renderHTML()},n._bindEvents=function(){var t=this,e=i(this.get("legendWrapper"),f);this.get("hoverable")&&(e.onmousemove=function(e){return t._onMousemove(e)},e.onmouseout=function(e){return t._onMouseleave(e)}),this.get("clickable")&&(e.onclick=function(e){return t._onClick(e)})},n._onMousemove=function(t){var e=this.get("items"),n=t.target,i=n.className;if(!((i=i.split(" ")).indexOf(h)>-1||i.indexOf(f)>-1)){var o=r(n,p),s=a(e,o.getAttribute("data-value"));s?(this.deactivate(),this.activate(o.getAttribute("data-value")),this.emit("itemhover",{item:s,currentTarget:o,checked:s.checked})):s||(this.deactivate(),this.emit("itemunhover",t))}},n._onMouseleave=function(t){this.deactivate(),this.emit("itemunhover",t)},n._onClick=function(t){var e=this,n=i(this.get("legendWrapper"),f),s=this.get("unCheckColor"),l=this.get("items"),u=this.get("selectedMode"),c=n.childNodes,d=t.target,v=d.className;if(!((v=v.split(" ")).indexOf(h)>-1||v.indexOf(f)>-1)){var y=r(d,p),x=i(y,"g2-legend-text"),m=i(y,g),_=a(l,y.getAttribute("data-value"));if(_){var b=y.className,w=y.getAttribute("data-color");if("single"===u)_.checked=!0,o.each(c,function(t){if(t!==y){i(t,g).style.backgroundColor=s,t.className=t.className.replace("checked","unChecked"),t.style.color=s;a(l,t.getAttribute("data-value")).checked=!1}else x&&(x.style.color=e.get("textStyle").fill),m&&(m.style.backgroundColor=w),y.className=b.replace("unChecked","checked")});else{var S=-1!==b.indexOf("checked"),M=0;if(o.each(c,function(t){-1!==t.className.indexOf("checked")&&M++}),!this.get("allowAllCanceled")&&S&&1===M)return void this.emit("clicklastitem",{item:_,currentTarget:y,checked:"single"===u||_.checked});_.checked=!_.checked,S?(m&&(m.style.backgroundColor=s),y.className=b.replace("checked","unChecked"),y.style.color=s):(m&&(m.style.backgroundColor=w),y.className=b.replace("unChecked","checked"),y.style.color=this.get("textStyle").fill)}this.emit("itemclick",{item:_,currentTarget:y,checked:"single"===u||_.checked})}}},n.activate=function(t){var e=this,n=this,r=n.get("items"),o=a(r,t);i(n.get("legendWrapper"),f).childNodes.forEach(function(t){var s=i(t,g),l=a(r,t.getAttribute("data-value"));if(e.get("highlight")){if(l===o&&l.checked)return void(s.style.border="1px solid #333")}else l===o?s.style.opacity=n.get("activeOpacity"):l.checked&&(s.style.opacity=n.get("inactiveOpacity"))})},n.deactivate=function(){var t=this,e=this;i(e.get("legendWrapper"),f).childNodes.forEach(function(n){var r=i(n,g);t.get("highlight")?r.style.border="1px solid #fff":r.style.opacity=e.get("inactiveOpacity")})},n._renderHTML=function(){var t=this,e=this.get("container"),n=this.get("title"),r=this.get("containerTpl"),a=u.createDom(r),s=i(a,"g2-legend-title"),c=i(a,f),d=this.get("unCheckColor"),v=o.deepMix({},{CONTAINER_CLASS:{height:"auto",width:"auto",position:"absolute",overflowY:"auto",fontSize:"12px",fontFamily:l,lineHeight:"20px",color:"#8C8C8C"},TITLE_CLASS:{marginBottom:this.get("titleGap")+"px",fontSize:"12px",color:"#333",textBaseline:"middle",fontFamily:l},LIST_CLASS:{listStyleType:"none",margin:0,padding:0,textAlign:"center"},LIST_ITEM_CLASS:{cursor:"pointer",marginBottom:"5px",marginRight:"24px"},MARKER_CLASS:{width:"9px",height:"9px",borderRadius:"50%",display:"inline-block",marginRight:"4px",verticalAlign:"middle"}},this.get("legendStyle"));if(/^\#/.test(e)||"string"==typeof e&&e.constructor===String){var y=e.replace("#","");(e=document.getElementById(y)).appendChild(a)}else{var x=this.get("position"),m={};m="left"===x||"right"===x?{maxHeight:(this.get("maxLength")||e.offsetHeight)+"px"}:{maxWidth:(this.get("maxLength")||e.offsetWidth)+"px"},u.modifyCSS(a,o.mix({},v.CONTAINER_CLASS,m,this.get(h))),e.appendChild(a)}u.modifyCSS(c,o.mix({},v.LIST_CLASS,this.get(f))),s&&(n&&n.text?(s.innerHTML=n.text,u.modifyCSS(s,o.mix({},v.TITLE_CLASS,this.get("g2-legend-title"),n))):a.removeChild(s));var _=this.get("items"),b=this.get("itemTpl"),w=this.get("position"),S=this.get("layout"),M="right"===w||"left"===w||"vertical"===S?"block":"inline-block",C=o.mix({},v.LIST_ITEM_CLASS,{display:M},this.get(p)),A=o.mix({},v.MARKER_CLASS,this.get(g));if(o.each(_,function(e,n){var r,s=e.checked,l=t._formatItemValue(e.value),h=e.marker.fill||e.marker.stroke,f=s?h:d;r=o.isFunction(b)?b(l,f,s,n):b;var p=o.substitute(r,o.mix({},e,{index:n,checked:s?"checked":"unChecked",value:l,color:f,originColor:h,originValue:e.value.replace(/\"/g,""")})),v=u.createDom(p);v.style.color=t.get("textStyle").fill;var y=i(v,g),x=i(v,"g2-legend-text");if(u.modifyCSS(v,C),y&&u.modifyCSS(y,A),s||(v.style.color=d,y&&(y.style.backgroundColor=d)),c.appendChild(v),t.get("abridgeText")){var m=l,_=v.offsetWidth,w=t.get("textStyle").fontSize;isNaN(w)&&(-1!==w.indexOf("pt")?w=1*parseFloat(w.substr(0,w.length-2))/72*96:-1!==w.indexOf("px")&&(w=parseFloat(w.substr(0,w.length-2))));var S=w*m.length,M=Math.floor(_/w);_<2*w?m="":_1&&(m=m.substr(0,M-1)+"..."),x.innerText=m,v.addEventListener("mouseover",function(){var t=i(a.parentNode,"textTip");t.style.display="block",t.style.left=v.offsetLeft+v.offsetWidth+"px",t.style.top=v.offsetTop+15+"px",t.innerText=l}),v.addEventListener("mouseout",function(){i(a.parentNode,"textTip").style.display="none"})}}),this.get("abridgeText")){var k=this.get("tipTpl"),P=u.createDom(k),T=this.get("tipStyle");u.modifyCSS(P,T),a.parentNode.appendChild(P),P.addEventListener("mouseover",function(){P.style.display="none"})}this.set("legendWrapper",a)},n._adjustPositionOffset=function(){var t=this.get("position"),e=this.get("offset"),n=this.get("offsetX"),i=this.get("offsetY");n&&(e[0]=n),i&&(e[1]=i);var r=this.get("legendWrapper");r.style.left=t[0]+"px",r.style.top=t[1]+"px",r.style.marginLeft=e[0]+"px",r.style.marginTop=e[1]+"px"},n.getWidth=function(){return u.getOuterWidth(this.get("legendWrapper"))},n.getHeight=function(){return u.getOuterHeight(this.get("legendWrapper"))},n.move=function(e,n){/^\#/.test(this.get("container"))?t.prototype.move.call(this,e,n):(u.modifyCSS(this.get("legendWrapper"),{left:e+"px",top:n+"px"}),this.set("x",e),this.set("y",n))},n.destroy=function(){var t=this.get("legendWrapper");t&&t.parentNode&&t.parentNode.removeChild(t)},e}(s);t.exports=d},function(t,e,n){var i=n(32),r=n(3),a=function(t){function e(e){var n;return(n=t.call(this,e)||this)._init_(),n.render(),n}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return r.mix({},e,{type:null,plot:null,plotRange:null,rectStyle:{fill:"#CCD6EC",opacity:.3},lineStyle:{stroke:"rgba(0, 0, 0, 0.25)",lineWidth:1},isTransposed:!1})},n._init_=function(){var t,e=this.get("plot");t="rect"===this.type?e.addGroup({zIndex:0}):e.addGroup(),this.set("container",t)},n._addLineShape=function(t,e){var n=this.get("container").addShape("line",{capture:!1,attrs:t});return this.set("crossLineShape"+e,n),n},n._renderHorizontalLine=function(t,e){var n=r.mix(this.get("lineStyle"),this.get("style")),i=r.mix({x1:e?e.bl.x:t.get("width"),y1:0,x2:e?e.br.x:0,y2:0},n);this._addLineShape(i,"X")},n._renderVerticalLine=function(t,e){var n=r.mix(this.get("lineStyle"),this.get("style")),i=r.mix({x1:0,y1:e?e.bl.y:t.get("height"),x2:0,y2:e?e.tl.y:0},n);this._addLineShape(i,"Y")},n._renderBackground=function(t,e){var n=r.mix(this.get("rectStyle"),this.get("style")),i=this.get("container"),a=r.mix({x:e?e.tl.x:0,y:e?e.tl.y:t.get("height"),width:e?e.br.x-e.bl.x:t.get("width"),height:e?Math.abs(e.tl.y-e.bl.y):t.get("height")},n),o=i.addShape("rect",{attrs:a,capture:!1});return this.set("crosshairsRectShape",o),o},n._updateRectShape=function(t){var e,n=this.get("crosshairsRectShape"),i=this.get("isTransposed"),a=t[0],o=t[t.length-1],s=i?"y":"x",l=i?"height":"width",u=a[s];if(t.length>1&&a[s]>o[s]&&(u=o[s]),this.get("width"))n.attr(s,u-this.get("crosshairs").width/2),n.attr(l,this.get("width"));else if(r.isArray(a.point[s])&&!a.size){var c=a.point[s][1]-a.point[s][0];n.attr(s,a.point[s][0]),n.attr(l,c)}else e=3*a.size/4,n.attr(s,u-e),1===t.length?n.attr(l,3*a.size/2):n.attr(l,Math.abs(o[s]-a[s])+2*e)},n.render=function(){var t=this.get("canvas"),e=this.get("plotRange"),n=this.get("isTransposed");switch(this.clear(),this.get("type")){case"x":this._renderHorizontalLine(t,e);break;case"y":this._renderVerticalLine(t,e);break;case"cross":this._renderHorizontalLine(t,e),this._renderVerticalLine(t,e);break;case"rect":this._renderBackground(t,e);break;default:n?this._renderHorizontalLine(t,e):this._renderVerticalLine(t,e)}},n.show=function(){var e=this.get("container");t.prototype.show.call(this),e.show()},n.hide=function(){var e=this.get("container");t.prototype.hide.call(this),e.hide()},n.clear=function(){var e=this.get("container");this.set("crossLineShapeX",null),this.set("crossLineShapeY",null),this.set("crosshairsRectShape",null),t.prototype.clear.call(this),e.clear()},n.destroy=function(){var e=this.get("container");t.prototype.destroy.call(this),e.remove()},n.setPosition=function(t,e,n){var i=this.get("crossLineShapeX"),r=this.get("crossLineShapeY"),a=this.get("crosshairsRectShape");r&&!r.get("destroyed")&&r.move(t,0),i&&!i.get("destroyed")&&i.move(0,e),a&&!a.get("destroyed")&&this._updateRectShape(n)},e}(i);t.exports=a},function(t,e){var n={_calcTooltipPosition:function(t,e,n,i,r,a){var o=0,s=0,l=20;if(a){var u=a.getBBox();o=u.width,s=u.height,t=u.x,e=u.y,l=5}switch(n){case"inside":t=t+o/2-i/2,e=e+s/2-r/2;break;case"top":t=t+o/2-i/2,e=e-r-l;break;case"left":t=t-i-l,e=e+s/2-r/2;break;case"right":t=t+o+l,e=e+s/2-r/2;break;case"bottom":default:t=t+o/2-i/2,e=e+s+l}return[t,e]},_constraintPositionInBoundary:function(t,e,n,i,r,a){return t+n+20>r?t=(t-=n+20)<0?0:t:t+20<0?t=20:t+=20,e+i+20>a?e=(e-=i+20)<0?0:e:e+20<0?e=20:e+=20,[t,e]},_constraintPositionInPlot:function(t,e,n,i,r,a){return t+n>r.tr.x&&(t-=n+40),tr.bl.y&&(e-=i+40),ee&&!a){t+=2*Math.asin(e/(2*o))}else o+=e;return{x:r.x+o*Math.cos(t),y:r.y+o*Math.sin(t),angle:t,r:o}},n.getArcPoint=function(t,e){var n;return e=e||0,n=a.isArray(t.x)||a.isArray(t.y)?{x:a.isArray(t.x)?t.x[e]:t.x,y:a.isArray(t.y)?t.y[e]:t.y}:t,this.transLabelPoint(n),n},n.getPointAngle=function(t){var e=this.get("coord");return r.getPointAngle(e,t)},n.getMiddlePoint=function(t){var e=this.get("coord"),n=t.length,i={x:0,y:0};return a.each(t,function(t){i.x+=t.x,i.y+=t.y}),i.x/=n,i.y/=n,i=e.convert(i)},n._isToMiddle=function(t){return t.x.length>2},n.getLabelPoint=function(t,e,n){var i,r=t.text[n],a=1;this._isToMiddle(e)?i=this.getMiddlePoint(e.points):(1===t.text.length&&0===n?n=1:0===n&&(a=-1),i=this.getArcPoint(e,n));var o=this.getDefaultOffset(t);o*=a;var s=this.getPointAngle(i),l=this.getCirclePoint(s,o,i);if(l?(l.text=r,l.angle=s,l.color=e.color):l={text:""},t.autoRotate||void 0===t.autoRotate){var u=l.textStyle?l.textStyle.rotate:null;u||(u=l.rotate||this.getLabelRotate(s,o,e)),l.rotate=u}return l.start={x:i.x,y:i.y},l},n._isEmitLabels=function(){return this.get("label").labelEmit},n.getLabelRotate=function(t){var e;return e=180*t/Math.PI,e+=90,this._isEmitLabels()&&(e-=90),e&&(e>90?e-=180:e<-90&&(e+=180)),e/180*Math.PI},n.getLabelAlign=function(t){var e,n=this.get("coord");if(this._isEmitLabels())e=t.angle<=Math.PI/2&&t.angle>-Math.PI/2?"left":"right";else if(n.isTransposed){var i=n.getCenter(),r=this.getDefaultOffset(t);e=Math.abs(t.x-i.x)<1?"center":t.angle>Math.PI||t.angle<=0?r>0?"left":"right":r>0?"right":"left"}else e="center";return e},e}(i);t.exports=o},function(t,e,n){t.exports={Scale:n(341),Coord:n(342),Axis:n(347),Guide:n(348),Legend:n(351),Tooltip:n(353),Event:n(354)}},function(t,e,n){function i(t,e,n){void 0===n&&(n=1);var i=[t.x,t.y,n];return a.vec3.transformMat3(i,i,e),{x:i[0],y:i[1]}}var r=n(16),a=n(0),o=n(167);t.exports=function(t,e){var n=e;return a.each(t.get("children"),function(t){if(t instanceof r.Group||t instanceof r.Path)n=o(n,t.getBBox());else if(t instanceof r.Text){var e=function(t){var e=t.getBBox(),n={x:e.minX,y:e.minY},r={x:e.maxX,y:e.maxY},a=t.attr("matrix");return n=i(n,a),r=i(r,a),{minX:n.x,minY:n.y,maxX:r.x,maxY:r.y}}(t),s=Math.abs(e.maxX-e.minX),l=Math.abs(e.maxY-e.minY);n=s0?e=0:n=0,n-e<5&&!l&&n-e>=1&&(l=1)),i(l)){var m=(n-e)/(v-1);l=a.snapFactorTo(m,x,"ceil"),f!==h&&((y=parseInt((n-e)/l,10))>f&&(y=f),ye&&(_-=l),n=a.fixedBase(M,l),e=a.fixedBase(_,l)}n=Math.min(n,d),e=Math.max(e,g),c.push(e);for(var C=1;Cn?(s=o,o=n):s>n&&(s=n),l1&&(e.minTickInterval=s-o),(a(e.min)||e._toTimeStamp(e.min)>o)&&(e.min=o),(a(e.max)||e._toTimeStamp(e.max)d&&(d=n);var m=d/x,_=i(p);if(m>.51){for(var b=Math.ceil(m),w=i(g),S=_;S<=w+b;S+=b)f.push(r(S));d=null}else if(m>.0834){for(var M=Math.ceil(m/.0834),C=a(p),A=function(t,e){var n=i(t),r=i(e),o=a(t);return 12*(r-n)+(a(e)-o)%12}(p,g),k=0;k<=A+M;k+=M)f.push(o(_,k+C));d=null}else if(d>.5*y){var P=new Date(p),T=P.getFullYear(),I=P.getMonth(p),O=P.getDate(),L=Math.ceil(d/y),E=function(t,e){return Math.ceil((e-t)/h)}(p,g);d=L*y;for(var D=0;Dc){var F=new Date(p),B=F.getFullYear(),R=F.getMonth(p),j=F.getDate(),N=F.getHours(),z=s.snapTo(u,Math.ceil(d/c)),Y=function(t,e){return Math.ceil((e-t)/c)}(p,g);d=z*c;for(var V=0;V<=Y+z;V+=z)f.push(new Date(B,R,j,N+V).getTime())}else if(d>6e4){var X=function(t,e){return Math.ceil((e-t)/6e4)}(p,g),H=Math.ceil(d/6e4);d=6e4*H;for(var W=0;W<=X+H;W+=H)f.push(p+6e4*W)}else{d<1e3&&(d=1e3),p=1e3*Math.floor(p/1e3);var G=Math.ceil((g-p)/1e3),q=Math.ceil(d/1e3);d=1e3*q;for(var U=0;U-1?r/(this.values.length-1):0,n+e*(i-n)},n.getText=function(t){var e="",n=this.translate(t);e=n>-1?this.values[n]:t;var i=this.formatter;return e=parseInt(e,10),e=i?i(e):a.format(e,this.mask)},n.getTicks=function(){var t=this,e=this.ticks,n=[];return l(e,function(e){var i;i=c(e)?e:{text:h(e)?e:t.getText(e),value:t.scale(e),tickValue:e},n.push(i)}),n},n._toTimeStamp=function(t){return s.toTimeStamp(t)},e}(r);i.TimeCat=f,t.exports=f},function(t,e,n){function i(t,e){return 1===t?1:Math.log(e)/Math.log(t)}var r=n(2),a=n(17),o=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n._initDefaultCfg=function(){t.prototype._initDefaultCfg.call(this),this.type="log",this.tickCount=10,this.base=2,this._minTick=null},n.calculateTicks=function(){var t,e=this.base;if(this.min<0)throw new Error("The minimum value must be greater than zero!");var n=i(e,this.max);if(this.min>0)t=Math.floor(i(e,this.min));else{var a=this.values,o=this.max;r(a,function(t){t>0&&t1&&(o=1),t=Math.floor(i(e,o)),this._minTick=t,this.positiveMin=o}for(var s=n-t,l=this.tickCount,u=Math.ceil(s/l),c=[],h=t;h=0?Math.floor(i(e,this.min)):0)>n){var r=n;n=t,t=r}for(var a=n-t,o=this.tickCount,s=Math.ceil(a/o),l=[],u=t;u0&&(r=1/Math.sqrt(r),t[0]=e[0]*r,t[1]=e[1]*r),t},e.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},e.cross=function(t,e,n){var i=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=i,t},e.lerp=function(t,e,n,i){var r=e[0],a=e[1];return t[0]=r+i*(n[0]-r),t[1]=a+i*(n[1]-a),t},e.random=function(t,e){e=e||1;var n=2*h.RANDOM()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t},e.transformMat2=function(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[2]*r,t[1]=n[1]*i+n[3]*r,t},e.transformMat2d=function(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[2]*r+n[4],t[1]=n[1]*i+n[3]*r+n[5],t},e.transformMat3=function(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[3]*r+n[6],t[1]=n[1]*i+n[4]*r+n[7],t},e.transformMat4=function(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[4]*r+n[12],t[1]=n[1]*i+n[5]*r+n[13],t},e.rotate=function(t,e,n,i){var r=e[0]-n[0],a=e[1]-n[1],o=Math.sin(i),s=Math.cos(i);return t[0]=r*s-a*o+n[0],t[1]=r*o+a*s+n[1],t},e.angle=function(t,e){var n=t[0],i=t[1],r=e[0],a=e[1],o=n*n+i*i;o>0&&(o=1/Math.sqrt(o));var s=r*r+a*a;s>0&&(s=1/Math.sqrt(s));var l=(n*r+i*a)*o*s;return l>1?0:l<-1?Math.PI:Math.acos(l)},e.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]},e.equals=function(t,e){var n=t[0],i=t[1],r=e[0],a=e[1];return Math.abs(n-r)<=h.EPSILON*Math.max(1,Math.abs(n),Math.abs(r))&&Math.abs(i-a)<=h.EPSILON*Math.max(1,Math.abs(i),Math.abs(a))};var h=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(52));e.len=u,e.sub=r,e.mul=a,e.div=o,e.dist=s,e.sqrDist=l,e.sqrLen=c,e.forEach=function(){var t=i();return function(e,n,i,r,a,o){var s=void 0,l=void 0;for(n||(n=2),i||(i=0),l=r?Math.min(r*n+i,e.length):e.length,s=i;s0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t}function p(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}Object.defineProperty(e,"__esModule",{value:!0}),e.forEach=e.sqrLen=e.len=e.sqrDist=e.dist=e.div=e.mul=e.sub=void 0,e.create=i,e.clone=function(t){var e=new g.ARRAY_TYPE(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},e.length=r,e.fromValues=a,e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},e.set=function(t,e,n,i){return t[0]=e,t[1]=n,t[2]=i,t},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t},e.subtract=o,e.multiply=s,e.divide=l,e.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t},e.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t},e.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t},e.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t},e.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t},e.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t},e.scaleAndAdd=function(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t[2]=e[2]+n[2]*i,t},e.distance=u,e.squaredDistance=c,e.squaredLength=h,e.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t},e.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t},e.normalize=f,e.dot=p,e.cross=function(t,e,n){var i=e[0],r=e[1],a=e[2],o=n[0],s=n[1],l=n[2];return t[0]=r*l-a*s,t[1]=a*o-i*l,t[2]=i*s-r*o,t},e.lerp=function(t,e,n,i){var r=e[0],a=e[1],o=e[2];return t[0]=r+i*(n[0]-r),t[1]=a+i*(n[1]-a),t[2]=o+i*(n[2]-o),t},e.hermite=function(t,e,n,i,r,a){var o=a*a,s=o*(2*a-3)+1,l=o*(a-2)+a,u=o*(a-1),c=o*(3-2*a);return t[0]=e[0]*s+n[0]*l+i[0]*u+r[0]*c,t[1]=e[1]*s+n[1]*l+i[1]*u+r[1]*c,t[2]=e[2]*s+n[2]*l+i[2]*u+r[2]*c,t},e.bezier=function(t,e,n,i,r,a){var o=1-a,s=o*o,l=a*a,u=s*o,c=3*a*s,h=3*l*o,f=l*a;return t[0]=e[0]*u+n[0]*c+i[0]*h+r[0]*f,t[1]=e[1]*u+n[1]*c+i[1]*h+r[1]*f,t[2]=e[2]*u+n[2]*c+i[2]*h+r[2]*f,t},e.random=function(t,e){e=e||1;var n=2*g.RANDOM()*Math.PI,i=2*g.RANDOM()-1,r=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(n)*r,t[1]=Math.sin(n)*r,t[2]=i*e,t},e.transformMat4=function(t,e,n){var i=e[0],r=e[1],a=e[2],o=n[3]*i+n[7]*r+n[11]*a+n[15];return o=o||1,t[0]=(n[0]*i+n[4]*r+n[8]*a+n[12])/o,t[1]=(n[1]*i+n[5]*r+n[9]*a+n[13])/o,t[2]=(n[2]*i+n[6]*r+n[10]*a+n[14])/o,t},e.transformMat3=function(t,e,n){var i=e[0],r=e[1],a=e[2];return t[0]=i*n[0]+r*n[3]+a*n[6],t[1]=i*n[1]+r*n[4]+a*n[7],t[2]=i*n[2]+r*n[5]+a*n[8],t},e.transformQuat=function(t,e,n){var i=n[0],r=n[1],a=n[2],o=n[3],s=e[0],l=e[1],u=e[2],c=r*u-a*l,h=a*s-i*u,f=i*l-r*s,p=r*f-a*h,g=a*c-i*f,d=i*h-r*c,v=2*o;return c*=v,h*=v,f*=v,p*=2,g*=2,d*=2,t[0]=s+c+p,t[1]=l+h+g,t[2]=u+f+d,t},e.rotateX=function(t,e,n,i){var r=[],a=[];return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],a[0]=r[0],a[1]=r[1]*Math.cos(i)-r[2]*Math.sin(i),a[2]=r[1]*Math.sin(i)+r[2]*Math.cos(i),t[0]=a[0]+n[0],t[1]=a[1]+n[1],t[2]=a[2]+n[2],t},e.rotateY=function(t,e,n,i){var r=[],a=[];return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],a[0]=r[2]*Math.sin(i)+r[0]*Math.cos(i),a[1]=r[1],a[2]=r[2]*Math.cos(i)-r[0]*Math.sin(i),t[0]=a[0]+n[0],t[1]=a[1]+n[1],t[2]=a[2]+n[2],t},e.rotateZ=function(t,e,n,i){var r=[],a=[];return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],a[0]=r[0]*Math.cos(i)-r[1]*Math.sin(i),a[1]=r[0]*Math.sin(i)+r[1]*Math.cos(i),a[2]=r[2],t[0]=a[0]+n[0],t[1]=a[1]+n[1],t[2]=a[2]+n[2],t},e.angle=function(t,e){var n=a(t[0],t[1],t[2]),i=a(e[0],e[1],e[2]);f(n,n),f(i,i);var r=p(n,i);return r>1?0:r<-1?Math.PI:Math.acos(r)},e.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},e.equals=function(t,e){var n=t[0],i=t[1],r=t[2],a=e[0],o=e[1],s=e[2];return Math.abs(n-a)<=g.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(i-o)<=g.EPSILON*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(r-s)<=g.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))};var g=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(52));e.sub=o,e.mul=s,e.div=l,e.dist=u,e.sqrDist=c,e.len=r,e.sqrLen=h,e.forEach=function(){var t=i();return function(e,n,i,r,a,o){var s=void 0,l=void 0;for(n||(n=3),i||(i=0),l=r?Math.min(r*n+i,e.length):e.length,s=i;s2*Math.PI&&(t=t/180*Math.PI),this.transform([["t",-e,-n],["r",t],["t",e,n]])},move:function(t,e){var n=this.get("x")||0,i=this.get("y")||0;return this.translate(t-n,e-i),this.set("x",t),this.set("y",e),this},transform:function(t){var e=this,n=this._attrs.matrix;return o.each(t,function(t){switch(t[0]){case"t":e.translate(t[1],t[2]);break;case"s":e.scale(t[1],t[2]);break;case"r":e.rotate(t[1]);break;case"m":e.attr("matrix",o.mat3.multiply([],n,t[1])),e.clearTotalMatrix()}}),e},setTransform:function(t){return this.attr("matrix",[1,0,0,0,1,0,0,0,1]),this.transform(t)},getMatrix:function(){return this.attr("matrix")},setMatrix:function(t){return this.attr("matrix",t),this.clearTotalMatrix(),this},apply:function(t,e){var n;return n=e?this._getMatrixByRoot(e):this.attr("matrix"),o.vec3.transformMat3(t,t,n),this},_getMatrixByRoot:function(t){t=t||this;for(var e=this,n=[];e!==t;)n.unshift(e),e=e.get("parent");n.unshift(e);var i=[1,0,0,0,1,0,0,0,1];return o.each(n,function(t){o.mat3.multiply(i,t.attr("matrix"),i)}),i},getTotalMatrix:function(){var t=this._cfg.totalMatrix;if(!t){t=[1,0,0,0,1,0,0,0,1];var e=this._cfg.parent;if(e){a(t,e.getTotalMatrix())}a(t,this.attr("matrix")),this._cfg.totalMatrix=t}return t},clearTotalMatrix:function(){},invert:function(t){var e=this.getTotalMatrix();if(r(e))t[0]/=e[0],t[1]/=e[4];else{var n=o.mat3.invert([],e);n&&o.vec3.transformMat3(t,t,n)}return this},resetTransform:function(t){var e=this.attr("matrix");i(e)||t.transform(e[0],e[1],e[3],e[4],e[6],e[7])}}},function(t,e,n){var i=n(1),r={delay:"delay",rotate:"rotate"},a={fill:"fill",stroke:"stroke",fillStyle:"fillStyle",strokeStyle:"strokeStyle"};t.exports={animate:function(t,e,n,o,s){void 0===s&&(s=0);this.set("animating",!0);var l=this.get("timeline");l||(l=this.get("canvas").get("timeline"),this.setSilent("timeline",l));var u=this.get("animators")||[];l._timer||l.initTimer(),i.isNumber(o)&&(s=o,o=null),i.isFunction(n)?(o=n,n="easeLinear"):n=n||"easeLinear";var c=function(t,e){var n={matrix:null,attrs:{}},o=e._attrs;for(var s in t)if("transform"===s)n.matrix=i.transform(e.getMatrix(),t[s]);else if("rotate"===s)n.matrix=i.transform(e.getMatrix(),[["r",t[s]]]);else if("matrix"===s)n.matrix=t[s];else{if(a[s]&&/^[r,R,L,l]{1}[\s]*\(/.test(t[s]))continue;r[s]||o[s]===t[s]||(n.attrs[s]=t[s])}return n}(t,this),h={fromAttrs:function(t,e){var n={},i=e._attrs;for(var r in t.attrs)n[r]=i[r];return n}(c,this),toAttrs:c.attrs,fromMatrix:i.clone(this.getMatrix()),toMatrix:c.matrix,duration:e,easing:n,callback:o,delay:s,startTime:l.getTime(),id:i.uniqueId()};u.length>0?u=function(t,e){var n=e.delay,r=Object.prototype.hasOwnProperty;return i.each(e.toAttrs,function(e,a){i.each(t,function(t){n').getContext("2d"),l={arc:function(t,e){var n=this._attrs,i=n.x,r=n.y,o=n.r,s=n.startAngle,l=n.endAngle,u=n.clockwise,c=this.getHitLineWidth();return!!this.hasStroke()&&a.arcline(i,r,o,s,l,u,c,t,e)},circle:function(t,e){var n=this._attrs,i=n.x,r=n.y,o=n.r,s=this.getHitLineWidth(),l=this.hasFill(),u=this.hasStroke();return l&&u?a.circle(i,r,o,t,e)||a.arcline(i,r,o,0,2*Math.PI,!1,s,t,e):l?a.circle(i,r,o,t,e):!!u&&a.arcline(i,r,o,0,2*Math.PI,!1,s,t,e)},dom:function(t,e){if(!this._cfg.el)return!1;var n=this._cfg.el.getBBox();return a.box(n.x,n.x+n.width,n.y,n.y+n.height,t,e)},ellipse:function(t,e){var n=this._attrs,i=this.hasFill(),o=this.hasStroke(),s=n.x,l=n.y,u=n.rx,c=n.ry,h=this.getHitLineWidth(),f=u>c?u:c,p=u>c?1:u/c,g=u>c?c/u:1,d=[t,e,1],v=[1,0,0,0,1,0,0,0,1];r.mat3.scale(v,v,[p,g]),r.mat3.translate(v,v,[s,l]);var y=r.mat3.invert([],v);return r.vec3.transformMat3(d,d,y),i&&o?a.circle(0,0,f,d[0],d[1])||a.arcline(0,0,f,0,2*Math.PI,!1,h,d[0],d[1]):i?a.circle(0,0,f,d[0],d[1]):!!o&&a.arcline(0,0,f,0,2*Math.PI,!1,h,d[0],d[1])},fan:function(t,e){function n(){var t=o.arc.nearAngle(m,d,v,y);if(r.isNumberEqual(m,t)){var e=r.vec2.squaredLength(x);if(p*p<=e&&e<=g*g)return!0}return!1}function i(){var n=s.getHitLineWidth(),i={x:Math.cos(d)*p+h,y:Math.sin(d)*p+f},r={x:Math.cos(d)*g+h,y:Math.sin(d)*g+f},o={x:Math.cos(v)*p+h,y:Math.sin(v)*p+f},l={x:Math.cos(v)*g+h,y:Math.sin(v)*g+f};return!!(a.line(i.x,i.y,r.x,r.y,n,t,e)||a.line(o.x,o.y,l.x,l.y,n,t,e)||a.arcline(h,f,p,d,v,y,n,t,e)||a.arcline(h,f,g,d,v,y,n,t,e))}var s=this,l=s.hasFill(),u=s.hasStroke(),c=s._attrs,h=c.x,f=c.y,p=c.rs,g=c.re,d=c.startAngle,v=c.endAngle,y=c.clockwise,x=[t-h,e-f],m=r.vec2.angleTo([1,0],x);return l&&u?n()||i():l?n():!!u&&i()},image:function(t,e){var n=this._attrs;if(this.get("toDraw")||!n.img)return!1;this._cfg.attrs&&this._cfg.attrs.img===n.img||this._setAttrImg();var i=n.x,r=n.y,o=n.width,s=n.height;return a.rect(i,r,o,s,t,e)},line:function(t,e){var n=this._attrs,i=n.x1,r=n.y1,o=n.x2,s=n.y2,l=this.getHitLineWidth();return!!this.hasStroke()&&a.line(i,r,o,s,l,t,e)},path:function(t,e){function n(){if(!r.isEmpty(o)){for(var n=a.getHitLineWidth(),i=0,s=o.length;i=3&&o.push(n[0]),a.polyline(o,i,t,e)}var r=this,o=r.hasFill(),s=r.hasStroke();return o&&s?i(t,e,r)||n():o?i(t,e,r):!!s&&n()},polyline:function(t,e){var n=this._attrs;if(this.hasStroke()){var i=n.points;if(i.length<2)return!1;var r=n.lineWidth;return a.polyline(i,r,t,e)}return!1},rect:function(t,e){function n(){var n=r._attrs,i=n.x,o=n.y,s=n.width,l=n.height,u=n.radius,c=r.getHitLineWidth();if(0===u){var h=c/2;return a.line(i-h,o,i+s+h,o,c,t,e)||a.line(i+s,o-h,i+s,o+l+h,c,t,e)||a.line(i+s+h,o+l,i-h,o+l,c,t,e)||a.line(i,o+l+h,i,o-h,c,t,e)}return a.line(i+u,o,i+s-u,o,c,t,e)||a.line(i+s,o+u,i+s,o+l-u,c,t,e)||a.line(i+s-u,o+l,i+u,o+l,c,t,e)||a.line(i,o+l-u,i,o+u,c,t,e)||a.arcline(i+s-u,o+u,u,1.5*Math.PI,2*Math.PI,!1,c,t,e)||a.arcline(i+s-u,o+l-u,u,0,.5*Math.PI,!1,c,t,e)||a.arcline(i+u,o+l-u,u,.5*Math.PI,Math.PI,!1,c,t,e)||a.arcline(i+u,o+u,u,Math.PI,1.5*Math.PI,!1,c,t,e)}var r=this,o=r.hasFill(),s=r.hasStroke();return o&&s?i(t,e,r)||n():o?i(t,e,r):!!s&&n()},text:function(t,e){var n=this.getBBox();if(this.hasFill()||this.hasStroke())return a.box(n.minX,n.maxX,n.minY,n.maxY,t,e)}};t.exports={isPointInPath:function(t,e){var n=l[this.type];return!!n&&n.call(this,t,e)}}},function(t,e,n){function i(t,e,n){var i=e.startTime;if(ng.length?(p=a.parsePathString(o[f]),g=a.parsePathString(s[f]),g=a.fillPathByDiff(g,p),g=a.formatPath(g,p),e.fromAttrs.path=g,e.toAttrs.path=p):e.pathFormatted||(p=a.parsePathString(o[f]),g=a.parsePathString(s[f]),g=a.formatPath(g,p),e.fromAttrs.path=g,e.toAttrs.path=p,e.pathFormatted=!0),i[f]=[];for(var d=0;d0){for(var l=r._animators.length-1;l>=0;l--)if((t=r._animators[l]).get("destroyed"))a.removeAnimator(l);else{if(!t.get("pause").isPaused)for(var u=(e=t.get("animators")).length-1;u>=0;u--)n=e[u],(s=i(t,n,o))&&(e.splice(u,1),s=!1,n.callback&&n.callback());0===e.length&&a.removeAnimator(l)}r.canvas.draw()}})},addAnimator:function(t){this._animators.push(t)},removeAnimator:function(t){this._animators.splice(t,1)},isAnimating:function(){return!!this._animators.length},stop:function(){this._timer&&this._timer.stop()},stopAllAnimations:function(){this._animators.forEach(function(t){t.stopAnimate()}),this._animators=[],this.canvas.draw()},getTime:function(){return this._current}}),t.exports=h},function(t,e,n){"use strict";var i=n(58);e.a=function(t,e,n){var r=new i.a;return e=null==e?0:+e,r.restart(function(n){r.stop(),t(n+e)},e,n),r}},function(t,e,n){"use strict";var i=n(58);e.a=function(t,e,n){var r=new i.a,a=e;return null==e?(r.restart(t,e,n),r):(e=+e,n=null==n?Object(i.b)():+n,r.restart(function i(o){o+=a,r.restart(i,a+=e,n),t(o)},e,n),r)}},function(t,e,n){"use strict";e.a=function(t){return+t}},function(t,e,n){"use strict";e.a=function(t){return t*t},e.c=function(t){return t*(2-t)},e.b=function(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}},function(t,e,n){"use strict";e.a=function(t){return t*t*t},e.c=function(t){return--t*t*t+1},e.b=function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}},function(t,e,n){"use strict";n.d(e,"a",function(){return i}),n.d(e,"c",function(){return r}),n.d(e,"b",function(){return a});var i=function t(e){function n(t){return Math.pow(t,e)}return e=+e,n.exponent=t,n}(3),r=function t(e){function n(t){return 1-Math.pow(1-t,e)}return e=+e,n.exponent=t,n}(3),a=function t(e){function n(t){return((t*=2)<=1?Math.pow(t,e):2-Math.pow(2-t,e))/2}return e=+e,n.exponent=t,n}(3)},function(t,e,n){"use strict";e.a=function(t){return 1-Math.cos(t*r)},e.c=function(t){return Math.sin(t*r)},e.b=function(t){return(1-Math.cos(i*t))/2};var i=Math.PI,r=i/2},function(t,e,n){"use strict";e.a=function(t){return Math.pow(2,10*t-10)},e.c=function(t){return 1-Math.pow(2,-10*t)},e.b=function(t){return((t*=2)<=1?Math.pow(2,10*t-10):2-Math.pow(2,10-10*t))/2}},function(t,e,n){"use strict";e.a=function(t){return 1-Math.sqrt(1-t*t)},e.c=function(t){return Math.sqrt(1- --t*t)},e.b=function(t){return((t*=2)<=1?1-Math.sqrt(1-t*t):Math.sqrt(1-(t-=2)*t)+1)/2}},function(t,e,n){"use strict";function i(t){return(t=+t)b?Math.pow(t,1/3):t/_+x}function s(t){return t>m?t*t*t:_*(t-x)}function l(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function u(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function c(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof h)return new h(t.h,t.c,t.l,t.opacity);t instanceof a||(t=i(t));var e=Math.atan2(t.b,t.a)*g.b;return new h(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new h(t,e,n,null==r?1:r)}function h(t,e,n,i){this.h=+t,this.c=+e,this.l=+n,this.opacity=+i}e.a=r,e.b=c;var f=n(61),p=n(60),g=n(118),d=.95047,v=1,y=1.08883,x=4/29,m=6/29,_=3*m*m,b=m*m*m;Object(f.a)(a,r,Object(f.b)(p.a,{brighter:function(t){return new a(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new a(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return t=v*s(t),e=d*s(e),n=y*s(n),new p.b(l(3.2404542*e-1.5371385*t-.4985314*n),l(-.969266*e+1.8760108*t+.041556*n),l(.0556434*e-.2040259*t+1.0572252*n),this.opacity)}})),Object(f.a)(h,c,Object(f.b)(p.a,{brighter:function(t){return new h(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new h(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return i(this).rgb()}}))},function(t,e,n){"use strict";function i(t,e,n,i){return 1===arguments.length?function(t){if(t instanceof r)return new r(t.h,t.s,t.l,t.opacity);t instanceof o.b||(t=Object(o.h)(t));var e=t.r/255,n=t.g/255,i=t.b/255,a=(d*i+p*e-g*n)/(d+p-g),l=i-a,u=(f*(n-a)-c*l)/h,v=Math.sqrt(u*u+l*l)/(f*a*(1-a)),y=v?Math.atan2(u,l)*s.b-120:NaN;return new r(y<0?y+360:y,v,a,t.opacity)}(t):new r(t,e,n,null==i?1:i)}function r(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}e.a=i;var a=n(61),o=n(60),s=n(118),l=-.14861,u=1.78277,c=-.29227,h=-.90649,f=1.97294,p=f*h,g=f*u,d=u*c-h*l;Object(a.a)(r,i,Object(a.b)(o.a,{brighter:function(t){return t=null==t?o.c:Math.pow(o.c,t),new r(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?o.d:Math.pow(o.d,t),new r(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*s.a,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),i=Math.cos(t),r=Math.sin(t);return new o.b(255*(e+n*(l*i+u*r)),255*(e+n*(c*i+h*r)),255*(e+n*(f*i)),this.opacity)}}))},function(t,e,n){"use strict";e.a=function(t,e){return t=+t,e-=t,function(n){return Math.round(t+e*n)}}},function(t,e,n){"use strict";function i(t,e,n,i){function a(t){return t.length?t.pop()+" ":""}return function(o,s){var l=[],u=[];return o=t(o),s=t(s),function(t,i,a,o,s,l){if(t!==a||i!==o){var u=s.push("translate(",null,e,null,n);l.push({i:u-4,x:Object(r.a)(t,a)},{i:u-2,x:Object(r.a)(i,o)})}else(a||o)&&s.push("translate("+a+e+o+n)}(o.translateX,o.translateY,s.translateX,s.translateY,l,u),function(t,e,n,o){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(a(n)+"rotate(",null,i)-2,x:Object(r.a)(t,e)})):e&&n.push(a(n)+"rotate("+e+i)}(o.rotate,s.rotate,l,u),function(t,e,n,o){t!==e?o.push({i:n.push(a(n)+"skewX(",null,i)-2,x:Object(r.a)(t,e)}):e&&n.push(a(n)+"skewX("+e+i)}(o.skewX,s.skewX,l,u),function(t,e,n,i,o,s){if(t!==n||e!==i){var l=o.push(a(o)+"scale(",null,",",null,")");s.push({i:l-4,x:Object(r.a)(t,n)},{i:l-2,x:Object(r.a)(e,i)})}else 1===n&&1===i||o.push(a(o)+"scale("+n+","+i+")")}(o.scaleX,o.scaleY,s.scaleX,s.scaleY,l,u),o=s=null,function(t){for(var e,n=-1,i=u.length;++n');return t.appendChild(n),this.type="canvas",this.canvas=n,this.context=n.getContext("2d"),this.toDraw=!1,this}var e=t.prototype;return e.beforeDraw=function(){var t=this.canvas;this.context&&this.context.clearRect(0,0,t.width,t.height)},e.draw=function(t){function e(){n.animateHandler=i.requestAnimationFrame(function(){n.animateHandler=void 0,n.toDraw&&e()}),n.beforeDraw();try{n._drawGroup(t)}catch(t){console.warn("error in draw canvas, detail as:"),console.warn(t),n.toDraw=!1}n.toDraw=!1}var n=this;n.animateHandler?n.toDraw=!0:e()},e.drawSync=function(t){this.beforeDraw(),this._drawGroup(t)},e._drawGroup=function(t){if(!t._cfg.removed&&!t._cfg.destroyed&&t._cfg.visible){var e=t._cfg.children,n=null;this.setContext(t);for(var i=0;i-1){var s=n[o];"fillStyle"===o&&(s=r.parseStyle(s,t,e)),"strokeStyle"===o&&(s=r.parseStyle(s,t,e)),"lineDash"===o&&e.setLineDash?i.isArray(s)?e.setLineDash(s):i.isString(s)&&e.setLineDash(s.split(" ")):e[o]=s}},t}();t.exports=o},function(t,e,n){function i(t,e){var n=t.match(c);r.each(n,function(t){t=t.split(":"),e.addColorStop(t[0],t[1])})}var r=n(1),a=/[MLHVQTCSAZ]([^MLHVQTCSAZ]*)/gi,o=/[^\s\,]+/gi,s=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,l=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,u=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,c=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;t.exports={parsePath:function(t){return t=t||[],r.isArray(t)?t:r.isString(t)?(t=t.match(a),r.each(t,function(e,n){if((e=e.match(o))[0].length>1){var i=e[0].charAt(0);e.splice(1,0,e[0].substr(1)),e[0]=i}r.each(e,function(t,n){isNaN(t)||(e[n]=+t)}),t[n]=e}),t):void 0},parseStyle:function(t,e,n){if(r.isString(t)){if("("===t[1]||"("===t[2]){if("l"===t[0])return function(t,e,n){var a,o,l=s.exec(t),u=r.mod(r.toRadian(parseFloat(l[1])),2*Math.PI),c=l[2],h=e.getBBox();u>=0&&u<.5*Math.PI?(a={x:h.minX,y:h.minY},o={x:h.maxX,y:h.maxY}):.5*Math.PI<=u&&u');return t.appendChild(n),this.type="svg",this.canvas=n,this.context=new o(n),this.toDraw=!1,this}var e=t.prototype;return e.draw=function(t){function e(){n.animateHandler=i.requestAnimationFrame(function(){n.animateHandler=void 0,n.toDraw&&e()});try{n._drawChildren(t)}catch(t){console.warn("error in draw canvas, detail as:"),console.warn(t),n.toDraw=!1}n.toDraw=!1}var n=this;n.animateHandler?n.toDraw=!0:e()},e.drawSync=function(t){this._drawChildren(t)},e._drawGroup=function(t,e){var n=t._cfg;n.removed||n.destroyed||(n.tobeRemoved&&(i.each(n.tobeRemoved,function(t){t.parentNode&&t.parentNode.removeChild(t)}),n.tobeRemoved=[]),this._drawShape(t,e),n.children&&n.children.length>0&&this._drawChildren(t))},e._drawChildren=function(t){var e,n=t._cfg.children;if(n)for(var i=0;is?1:0,f=Math.abs(l-s)>Math.PI?1:0,p=n.rs,g=n.re,d=e(s,n.rs,a),v=e(l,n.rs,a);n.rs>0?(o.push("M "+c.x+","+c.y),o.push("L "+v.x+","+v.y),o.push("A "+p+","+p+",0,"+f+","+(1===h?0:1)+","+d.x+","+d.y),o.push("L "+u.x+" "+u.y)):(o.push("M "+a.x+","+a.y),o.push("L "+u.x+","+u.y)),o.push("A "+g+","+g+",0,"+f+","+h+","+c.x+","+c.y),n.rs>0?o.push("L "+v.x+","+v.y):o.push("Z"),r.el.setAttribute("d",o.join(" "))},e._updateText=function(t){var e=t._attrs,n=t._cfg.attrs,i=t._cfg.el;this._setFont(t);for(var r in e)if(e[r]!==n[r]){if("text"===r){this._setText(t,""+e[r]);continue}if("fillStyle"===r||"strokeStyle"===r){this._setColor(t,r,e[r]);continue}if("matrix"===r){this._setTransform(t);continue}l[r]&&i.setAttribute(l[r],e[r])}t._cfg.attrs=Object.assign({},t._attrs),t._cfg.hasUpdate=!1},e._setFont=function(t){var e=t.get("el"),n=t._attrs,i=n.fontSize;e.setAttribute("alignment-baseline",u[n.textBaseline]||"baseline"),e.setAttribute("text-anchor",c[n.textAlign]||"left"),i&&+i<12&&(n.matrix=[1,0,0,0,1,0,0,0,1],t.transform([["t",-n.x,-n.y],["s",+i/12,+i/12],["t",n.x,n.y]]))},e._setText=function(t,e){var n=t._cfg.el,r=t._attrs.textBaseline||"bottom";if(e)if(~e.indexOf("\n")){var a=t._attrs.x,o=e.split("\n"),s=o.length-1,l="";i.each(o,function(t,e){0===e?"alphabetic"===r?l+=''+t+"":"top"===r?l+=''+t+"":"middle"===r?l+=''+t+"":"bottom"===r?l+=''+t+"":"hanging"===r&&(l+=''+t+""):l+=''+t+""}),n.innerHTML=l}else n.innerHTML=e;else n.innerHTML=""},e._setClip=function(t,e){var n=t._cfg.el;if(e)if(n.hasAttribute("clip-path"))e._cfg.hasUpdate&&this._updateShape(e);else{this._createDom(e),this._updateShape(e);var i=this.context.addClip(e);n.setAttribute("clip-path","url(#"+i+")")}else n.removeAttribute("clip-path")},e._setColor=function(t,e,n){var i=t._cfg.el,r=this.context;if(n)if(n=n.trim(),/^[r,R,L,l]{1}[\s]*\(/.test(n)){var a=r.find("gradient",n);a||(a=r.addGradient(n)),i.setAttribute(l[e],"url(#"+a+")")}else if(/^[p,P]{1}[\s]*\(/.test(n)){var o=r.find("pattern",n);o||(o=r.addPattern(n)),i.setAttribute(l[e],"url(#"+o+")")}else i.setAttribute(l[e],n);else i.setAttribute(l[e],"none")},e._setShadow=function(t){var e=t._cfg.el,n=t._attrs,i={dx:n.shadowOffsetX,dy:n.shadowOffsetY,blur:n.shadowBlur,color:n.shadowColor};if(i.dx||i.dy||i.blur||i.color){var r=this.context.find("filter",i);r||(r=this.context.addShadow(i,this)),e.setAttribute("filter","url(#"+r+")")}else e.removeAttribute("filter")},t}();t.exports=h},function(t,e,n){var i=n(1),r=n(222),a=n(223),o=n(224),s=n(225),l=n(226),u=function(){function t(t){var e=document.createElementNS("http://www.w3.org/2000/svg","defs"),n=i.uniqueId("defs_");e.id=n,t.appendChild(e),this.children=[],this.defaultArrow={},this.el=e,this.canvas=t}var e=t.prototype;return e.find=function(t,e){for(var n=this.children,i=null,r=0;r'}),n}var r=n(1),a=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,o=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,s=/[\d.]+:(#[^\s]+|[^\)]+\))/gi,l=function(){function t(t){var e=null,n=r.uniqueId("gradient_");return"l"===t.toLowerCase()[0]?function(t,e){var n,o,s=a.exec(t),l=r.mod(r.toRadian(parseFloat(s[1])),2*Math.PI),u=s[2];l>=0&&l<.5*Math.PI?(n={x:0,y:0},o={x:1,y:1}):.5*Math.PI<=l&&l';e.innerHTML=n},t}();t.exports=o},function(t,e,n){var i=n(1),r=function(){function t(t,e){var n=document.createElementNS("http://www.w3.org/2000/svg","marker"),r=i.uniqueId("marker_");n.setAttribute("id",r);var a=document.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("stroke","none"),a.setAttribute("fill",t.stroke||"#000"),n.appendChild(a),n.setAttribute("overflow","visible"),n.setAttribute("orient","auto-start-reverse"),this.el=n,this.child=a,this.id=r,this.cfg=t["marker-start"===e?"startArrow":"endArrow"],this.stroke=t.stroke||"#000",!0===this.cfg?this._setDefaultPath(e,a):this._setMarker(t.lineWidth,a),this}var e=t.prototype;return e.match=function(){return!1},e._setDefaultPath=function(t,e){var n=this.el;e.setAttribute("d","M0,0 L6,3 L0,6 L3,3Z"),n.setAttribute("refX",3),n.setAttribute("refY",3)},e._setMarker=function(t,e){var n=this.el,r=this.cfg.path,a=this.cfg.d;i.isArray(r)&&(r=r.map(function(t){return t.join(" ")}).join("")),e.setAttribute("d",r),n.appendChild(e),a&&n.setAttribute("refX",a/t)},e.update=function(t){var e=this.child;e.attr?e.attr("fill",t):e.setAttribute("fill",t)},t}();t.exports=r},function(t,e,n){var i=n(1),r=function(){function t(t){this.type="clip";var e=document.createElementNS("http://www.w3.org/2000/svg","clipPath");this.el=e,this.id=i.uniqueId("clip_"),e.id=this.id;var n=t._cfg.el;return e.appendChild(n.cloneNode(!0)),this.cfg=t,this}var e=t.prototype;return e.match=function(){return!1},e.remove=function(){var t=this.el;t.parentNode.removeChild(t)},t}();t.exports=r},function(t,e,n){var i=n(1),r=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,a=function(){function t(t){function e(){console.log(l.width,l.height),n.setAttribute("width",l.width),n.setAttribute("height",l.height)}var n=document.createElementNS("http://www.w3.org/2000/svg","pattern");n.setAttribute("patternUnits","userSpaceOnUse");var a=document.createElementNS("http://www.w3.org/2000/svg","image");n.appendChild(a);var o=i.uniqueId("pattern_");n.id=o,this.el=n,this.id=o,this.cfg=t;var s=r.exec(t)[2];a.setAttribute("href",s);var l=new Image;return s.match(/^data:/i)||(l.crossOrigin="Anonymous"),l.src=s,l.complete?e():(l.onload=e,l.src=l.src),this}return t.prototype.match=function(t,e){return this.cfg===e},t}();t.exports=a},function(t,e){var n={svg:"svg",circle:"circle",rect:"rect",text:"text",path:"path",foreignObject:"foreignObject",polygon:"polygon",ellipse:"ellipse",image:"image"};t.exports=function(t,e,i){var r=i.target||i.srcElement;if(!n[r.tagName]){for(var a=r.parentNode;a&&!n[a.tagName];)a=a.parentNode;r=a}return this._cfg.el===r?this:this.find(function(t){return t._cfg&&t._cfg.el===r})}},function(t,e,n){t.exports={addEventListener:n(229),createDom:n(94),getBoundingClientRect:n(230),getHeight:n(231),getOuterHeight:n(232),getOuterWidth:n(233),getRatio:n(234),getStyle:n(235),getWidth:n(236),modifyCSS:n(95),requestAnimationFrame:n(96)}},function(t,e){t.exports=function(t,e,n){if(t){if(t.addEventListener)return t.addEventListener(e,n,!1),{remove:function(){t.removeEventListener(e,n,!1)}};if(t.attachEvent)return t.attachEvent("on"+e,n),{remove:function(){t.detachEvent("on"+e,n)}}}}},function(t,e){t.exports=function(t,e){if(t&&t.getBoundingClientRect){var n=t.getBoundingClientRect(),i=document.documentElement.clientTop,r=document.documentElement.clientLeft;return{top:n.top-i,bottom:n.bottom-i,left:n.left-r,right:n.right-r}}return e||null}},function(t,e){t.exports=function(t,e){var n=this.getStyle(t,"height",e);return"auto"===n&&(n=t.offsetHeight),parseFloat(n)}},function(t,e){t.exports=function(t,e){var n=this.getHeight(t,e),i=parseFloat(this.getStyle(t,"borderTopWidth"))||0,r=parseFloat(this.getStyle(t,"paddingTop"))||0,a=parseFloat(this.getStyle(t,"paddingBottom"))||0;return n+i+(parseFloat(this.getStyle(t,"borderBottomWidth"))||0)+r+a}},function(t,e){t.exports=function(t,e){var n=this.getWidth(t,e),i=parseFloat(this.getStyle(t,"borderLeftWidth"))||0,r=parseFloat(this.getStyle(t,"paddingLeft"))||0,a=parseFloat(this.getStyle(t,"paddingRight"))||0;return n+i+(parseFloat(this.getStyle(t,"borderRightWidth"))||0)+r+a}},function(t,e){t.exports=function(){return window.devicePixelRatio?window.devicePixelRatio:2}},function(t,e,n){var i=n(5);t.exports=function(t,e,n){try{return window.getComputedStyle?window.getComputedStyle(t,null)[e]:t.currentStyle[e]}catch(t){return i(n)?null:n}}},function(t,e){t.exports=function(t,e){var n=this.getStyle(t,"width",e);return"auto"===n&&(n=t.offsetWidth),parseFloat(n)}},function(t,e,n){t.exports={contains:n(41),difference:n(238),find:n(239),firstValue:n(240),flatten:n(241),flattenDeep:n(242),getRange:n(243),merge:n(42),pull:n(90),pullAt:n(130),reduce:n(244),remove:n(245),sortBy:n(246),union:n(247),uniq:n(131),valuesOfKey:n(64)}},function(t,e,n){var i=n(63),r=n(41);t.exports=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return i(t,function(t){return!r(e,t)})}},function(t,e,n){var i=n(11),r=n(26),a=n(128);t.exports=function(t,e){var n=void 0;if(i(e)&&(n=e),r(e)&&(n=function(t){return a(t,e)}),n)for(var o=0;o1&&void 0!==arguments[1]?arguments[1]:[];if(i(e))for(var r=0;re[i])return 1;if(t[i]1){var i=e[0].charAt(0);e.splice(1,0,e[0].substr(1)),e[0]=i}a(e,function(t,n){isNaN(t)||(e[n]=+t)}),t[n]=e}),t):void 0}},function(t,e,n){var i=n(4);t.exports=function(t){var e=0,n=0,r=0,a=0;return i(t)?1===t.length?e=n=r=a=t[0]:2===t.length?(e=r=t[0],n=a=t[1]):3===t.length?(e=t[0],n=a=t[1],r=t[2]):(e=t[0],n=t[1],r=t[2],a=t[3]):e=n=r=a=t,{r1:e,r2:n,r3:r,r4:a}}},function(t,e,n){var i=n(35);t.exports={clamp:n(50),fixedBase:n(256),isDecimal:n(257),isEven:n(258),isInteger:n(259),isNegative:n(260),isNumberEqual:i,isOdd:n(261),isPositive:n(262),maxBy:n(132),minBy:n(263),mod:n(93),snapEqual:i,toDegree:n(92),toInt:n(133),toInteger:n(133),toRadian:n(91)}},function(t,e){t.exports=function(t,e){var n=e.toString(),i=n.indexOf(".");if(-1===i)return Math.round(t);var r=n.substr(i+1).length;return r>20&&(r=20),parseFloat(t.toFixed(r))}},function(t,e,n){var i=n(9);t.exports=function(t){return i(t)&&t%1!=0}},function(t,e,n){var i=n(9);t.exports=function(t){return i(t)&&t%2==0}},function(t,e,n){var i=n(9),r=Number.isInteger?Number.isInteger:function(t){return i(t)&&t%1==0};t.exports=r},function(t,e,n){var i=n(9);t.exports=function(t){return i(t)&&t<0}},function(t,e,n){var i=n(9);t.exports=function(t){return i(t)&&t%2!=0}},function(t,e,n){var i=n(9);t.exports=function(t){return i(t)&&t>0}},function(t,e,n){var i=n(4),r=n(11),a=n(2);t.exports=function(t,e){if(i(t)){var n=t[0],o=void 0;o=r(e)?e(t[0]):t[0][e];var s=void 0;return a(t,function(t){(s=r(e)?e(t):t[e])1?1:u<0?0:u)/2,h=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],p=0,g=0;g<12;g++){var d=c*h[g]+c,v=o(d,t,n,r,s),y=o(d,e,i,a,l),x=v*v+y*y;p+=f[g]*Math.sqrt(x)}return c*p},l=function(t,e,n,i,r,a,o,s){if(!(Math.max(t,n)Math.max(r,o)||Math.max(e,i)Math.max(a,s))){var l=(t-n)*(a-s)-(e-i)*(r-o);if(l){var u=((t*i-e*n)*(r-o)-(t-n)*(r*s-a*o))/l,c=((t*i-e*n)*(a-s)-(e-i)*(r*s-a*o))/l,h=+u.toFixed(2),f=+c.toFixed(2);if(!(h<+Math.min(t,n).toFixed(2)||h>+Math.max(t,n).toFixed(2)||h<+Math.min(r,o).toFixed(2)||h>+Math.max(r,o).toFixed(2)||f<+Math.min(e,i).toFixed(2)||f>+Math.max(e,i).toFixed(2)||f<+Math.min(a,s).toFixed(2)||f>+Math.max(a,s).toFixed(2)))return{x:u,y:c}}}},u=function(t,e,n){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height},c=function(t,e,n,i){return null===t&&(t=e=n=i=0),null===e&&(e=t.y,n=t.width,i=t.height,t=t.x),{x:t,y:e,width:n,w:n,height:i,h:i,x2:t+n,y2:e+i,cx:t+n/2,cy:e+i/2,r1:Math.min(n,i)/2,r2:Math.max(n,i)/2,r0:Math.sqrt(n*n+i*i)/2,path:r(t,e,n,i),vb:[t,e,n,i].join(" ")}},h=function(t,e,n,r,a,o,s,l){i(t)||(t=[t,e,n,r,a,o,s,l]);var u=function(t,e,n,i,r,a,o,s){for(var l=[],u=[[],[]],c=void 0,h=void 0,f=void 0,p=void 0,g=0;g<2;++g)if(0===g?(h=6*t-12*n+6*r,c=-3*t+9*n-9*r+3*o,f=3*n-3*t):(h=6*e-12*i+6*a,c=-3*e+9*i-9*a+3*s,f=3*i-3*e),Math.abs(c)<1e-12){if(Math.abs(h)<1e-12)continue;(p=-f/h)>0&&p<1&&l.push(p)}else{var d=h*h-4*f*c,v=Math.sqrt(d);if(!(d<0)){var y=(-h+v)/(2*c);y>0&&y<1&&l.push(y);var x=(-h-v)/(2*c);x>0&&x<1&&l.push(x)}}for(var m=l.length,_=m,b=void 0;m--;)b=1-(p=l[m]),u[0][m]=b*b*b*t+3*b*b*p*n+3*b*p*p*r+p*p*p*o,u[1][m]=b*b*b*e+3*b*b*p*i+3*b*p*p*a+p*p*p*s;return u[0][_]=t,u[1][_]=e,u[0][_+1]=o,u[1][_+1]=s,u[0].length=u[1].length=_+2,{min:{x:Math.min.apply(0,u[0]),y:Math.min.apply(0,u[1])},max:{x:Math.max.apply(0,u[0]),y:Math.max.apply(0,u[1])}}}.apply(null,t);return c(u.min.x,u.min.y,u.max.x-u.min.x,u.max.y-u.min.y)},f=function(t,e,n,i,r,a,o,s,l){var u=1-l,c=Math.pow(u,3),h=Math.pow(u,2),f=l*l,p=f*l,g=t+2*l*(n-t)+f*(r-2*n+t),d=e+2*l*(i-e)+f*(a-2*i+e),v=n+2*l*(r-n)+f*(o-2*r+n),y=i+2*l*(a-i)+f*(s-2*a+i);return{x:c*t+3*h*l*n+3*u*l*l*r+p*o,y:c*e+3*h*l*i+3*u*l*l*a+p*s,m:{x:g,y:d},n:{x:v,y:y},start:{x:u*t+l*n,y:u*e+l*i},end:{x:u*r+l*o,y:u*a+l*s},alpha:90-180*Math.atan2(g-v,d-y)/Math.PI}},p=function(t,e,n){if(!function(t,e){return t=c(t),e=c(e),u(e,t.x,t.y)||u(e,t.x2,t.y)||u(e,t.x,t.y2)||u(e,t.x2,t.y2)||u(t,e.x,e.y)||u(t,e.x2,e.y)||u(t,e.x,e.y2)||u(t,e.x2,e.y2)||(t.xe.x||e.xt.x)&&(t.ye.y||e.yt.y)}(h(t),h(e)))return n?0:[];for(var i=~~(s.apply(0,t)/8),r=~~(s.apply(0,e)/8),a=[],o=[],p={},g=n?0:[],d=0;d=0&&P<=1&&T>=0&&T<=1&&(n?g++:g.push({x:k.x,y:k.y,t1:P,t2:T}))}}return g};t.exports=function(t,e){return function(t,e,n){t=a(t),e=a(e);for(var i=void 0,r=void 0,o=void 0,s=void 0,l=void 0,u=void 0,c=void 0,h=void 0,f=void 0,g=void 0,d=n?0:[],v=0,y=t.length;v=3&&(3===t.length&&e.push("Q"),e=e.concat(t[1])),2===t.length&&e.push("L"),e=e.concat(t[t.length-1])})}(t,e,i));else{var a=[].concat(t);"M"===a[0]&&(a[0]="L");for(var o=0;o<=i-1;o++)r.push(a)}return r}t.exports=function(t,e){if(1===t.length)return t;var n=t.length-1,r=e.length-1,a=n/r,o=[];if(1===t.length&&"M"===t[0][0]){for(var s=0;s=0;p--)l=s[p].index,"add"===s[p].type?t.splice(l,0,[].concat(t[l])):t.splice(l,1)}if((a=t.length)0)){t[a]=e[a];break}r=i(r,t[a-1],1)}t[a]=["Q"].concat(r.reduce(function(t,e){return t.concat(e)},[]));break;case"T":t[a]=["T"].concat(r[0]);break;case"C":if(r.length<3){if(!(a>0)){t[a]=e[a];break}r=i(r,t[a-1],2)}t[a]=["C"].concat(r.reduce(function(t,e){return t.concat(e)},[]));break;case"S":if(r.length<2){if(!(a>0)){t[a]=e[a];break}r=i(r,t[a-1],1)}t[a]=["S"].concat(r.reduce(function(t,e){return t.concat(e)},[]));break;default:t[a]=e[a]}return t}},function(t,e,n){var i={lc:n(275),lowerCase:n(142),lowerFirst:n(75),substitute:n(276),uc:n(277),upperCase:n(143),upperFirst:n(87)};t.exports=i},function(t,e,n){t.exports=n(142)},function(t,e){t.exports=function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,function(t,n){return"\\"===t.charAt(0)?t.slice(1):void 0===e[n]?"":e[n]}):t}},function(t,e,n){t.exports=n(143)},function(t,e,n){var i=n(12),r={getType:n(84),isArray:n(4),isArrayLike:n(13),isBoolean:n(82),isFunction:n(11),isNil:n(5),isNull:n(279),isNumber:n(9),isObject:n(24),isObjectLike:n(48),isPlainObject:n(26),isPrototype:n(85),isType:i,isUndefined:n(280),isString:n(10),isRegExp:n(281),isDate:n(80),isArguments:n(282),isError:n(283)};t.exports=r},function(t,e){t.exports=function(t){return null===t}},function(t,e){t.exports=function(t){return void 0===t}},function(t,e,n){var i=n(12);t.exports=function(t){return i(t,"RegExp")}},function(t,e,n){var i=n(12);t.exports=function(t){return i(t,"Arguments")}},function(t,e,n){var i=n(12);t.exports=function(t){return i(t,"Error")}},function(t,e){t.exports=function(t,e,n){var i=void 0;return function(){var r=this,a=arguments,o=n&&!i;clearTimeout(i),i=setTimeout(function(){i=null,n||t.apply(r,a)},e),o&&t.apply(r,a)}}},function(t,e,n){var i=n(13);t.exports=function(t,e){if(!i(t))return-1;var n=Array.prototype.indexOf;if(n)return n.call(t,e);for(var r=-1,a=0;ae?(i&&(clearTimeout(i),i=null),s=u,o=t.apply(r,a),i||(r=a=null)):i||!1===n.trailing||(i=setTimeout(l,c)),o};return u.cancel=function(){clearTimeout(i),s=0,i=r=a=null},u}},function(t,e,n){function i(t,e){var n,i,r=function(t){if(f.isEmpty(t))return null;var e=t[0].x,n=t[0].x,i=t[0].y,r=t[0].y;return f.each(t,function(t){e=e>t.x?t.x:e,n=nt.y?t.y:i,r=r0?o.maxX:o.minX,l,1];t.apply(u),t.attr({transform:[["t",-n,-l],["s",.01,1],["t",n,l]]});var c={transform:[["t",-n,-l],["s",100,1],["t",n,l]]},h=r(e,a,i);t.animate(c,h.duration,h.easing,h.callback,h.delay)}function s(t,e,n){var i,a,o=t._id,s=t.get("index");if(n.isPolar&&"point"!==t.name)i=n.getCenter().x,a=n.getCenter().y;else{var l=t.getBBox();i=(l.minX+l.maxX)/2,a=(l.minY+l.maxY)/2}var u=[i,a,1];t.apply(u),t.attr({transform:[["t",-i,-a],["s",.01,.01],["t",i,a]]});var c={transform:[["t",-i,-a],["s",100,100],["t",i,a]]},h=r(e,s,o);t.animate(c,h.duration,h.easing,h.callback,h.delay)}function l(t,e){if("path"===t.get("type")){var n=t._id,i=t.get("index"),a=g.pathToAbsolute(t.attr("path"));t.attr("path",[a[0]]);var o={path:a},s=r(e,i,n);t.animate(o,s.duration,s.easing,s.callback,s.delay)}}function u(t,e,n,i,a){var o,s=function(t){var e,n,i,r,a,o=t.start,s=t.end,l=t.getWidth(),u=t.getHeight();return t.isPolar?(r=t.getRadius(),i=t.getCenter(),e=t.startAngle,n=t.endAngle,(a=new p.Fan({attrs:{x:i.x,y:i.y,rs:0,re:r+200,startAngle:e,endAngle:e}})).endState={endAngle:n}):(a=new p.Rect({attrs:{x:o.x-200,y:s.y-200,width:t.isTransposed?l+400:0,height:t.isTransposed?0:u+400}}),t.isTransposed?a.endState={height:u+400}:a.endState={width:l+400}),a.isClip=!0,a}(n),l=t.get("canvas"),u=t._id,c=t.get("index");i?(s.attr("startAngle",i),s.attr("endAngle",i),o={endAngle:a}):o=s.endState,s.set("canvas",l),t.attr("clip",s),t.setSilent("animating",!0);var h=r(e,c,u);s.animate(o,h.duration,h.easing,function(){t&&!t.get("destroyed")&&(t.attr("clip",null),t.setSilent("cacheShape",null),t.setSilent("animating",!1),s.remove())},h.delay)}function c(t,e){var n=t._id,i=t.get("index"),a=f.isNil(t.attr("fillOpacity"))?1:t.attr("fillOpacity"),o=f.isNil(t.attr("strokeOpacity"))?1:t.attr("strokeOpacity");t.attr("fillOpacity",0),t.attr("strokeOpacity",0);var s={fillOpacity:a,strokeOpacity:o},l=r(e,i,n);t.animate(s,l.duration,l.easing,l.callback,l.delay)}function h(t,e,n){var r=i(t,n),a=r.endAngle;u(t,e,n,r.startAngle,a)}var f=n(0),p=n(16),g=f.PathUtil;t.exports={enter:{clipIn:u,zoomIn:s,pathIn:l,scaleInY:a,scaleInX:o,fanIn:h,fadeIn:c},leave:{lineWidthOut:function(t,e){var n={lineWidth:0,opacity:0},i=t._id,a=r(e,t.get("index"),i);t.animate(n,a.duration,a.easing,function(){t.remove()},a.delay)},zoomOut:function(t,e,n){var i,a,o=t._id,s=t.get("index");if(n.isPolar&&"point"!==t.name)i=n.getCenter().x,a=n.getCenter().y;else{var l=t.getBBox();i=(l.minX+l.maxX)/2,a=(l.minY+l.maxY)/2}var u=[i,a,1];t.apply(u);var c={transform:[["t",-i,-a],["s",.01,.01],["t",i,a]]},h=r(e,s,o);t.animate(c,h.duration,h.easing,function(){t.remove()},h.delay)},pathOut:function(t,e){if("path"===t.get("type")){var n=t._id,i=t.get("index"),a={path:[g.pathToAbsolute(t.attr("path"))[0]]},o=r(e,i,n);t.animate(a,o.duration,o.easing,function(){t.remove()},o.delay)}},fadeOut:function(t,e){var n=t._id,i={fillOpacity:0,strokeOpacity:0},a=r(e,t.get("index"),n);t.animate(i,a.duration,a.easing,function(){t.remove()},a.delay)}},appear:{clipIn:u,zoomIn:s,pathIn:l,scaleInY:a,scaleInX:o,fanIn:h,fadeIn:c},update:{fadeIn:c,fanIn:h}}},function(t,e,n){function i(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function r(t,e,n){var i=(t-e)/(n-e);return i>=0&&i<=1}function a(t,e){var n=!1;if(t){if("theta"===t.type){var i=t.start,a=t.end;n=r(e.x,i.x,a.x)&&r(e.y,i.y,a.y)}else{var o=t.invert(e);n=o.x>=0&&o.y>=0&&o.x<=1&&o.y<=1}}return n}var o=n(148),s=n(20),l=n(0),u=n(165),c=n(7),h=n(151),f=n(355),p={};l.each(s,function(t,e){var n=l.lowerFirst(e);p[n]=function(e){var n=new t(e);return this.addGeom(n),n}});var g=function(t){function e(e){var n,r=i(i(n=t.call(this,e)||this));return r._setTheme(),l.each(s,function(t,e){var n=l.lowerFirst(e);r[n]=function(e){void 0===e&&(e={}),e.viewTheme=r.get("viewTheme");var n=new t(e);return r.addGeom(n),n}}),r.init(),n}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){return{viewContainer:null,coord:null,start:{x:0,y:0},end:{x:1,y:1},geoms:[],scales:{},options:{},scaleController:null,padding:0,theme:null,parent:null,tooltipEnable:!0,animate:c.animate,visible:!0}},n._setTheme=function(){var t=this.get("theme"),e={},n={};l.isObject(t)?n=t:-1!==l.indexOf(Object.keys(h),t)&&(n=h[t]),l.deepMix(e,c,n),this.set("viewTheme",e)},n.init=function(){this._initViewPlot(),this.get("data")&&this._initData(this.get("data")),this._initOptions(),this._initControllers(),this._bindEvents()},n._initOptions=function(){var t=this,e=l.mix({},t.get("options"));e.scales||(e.scales={}),e.coord||(e.coord={}),!1===e.animate&&this.set("animate",!1),(!1===e.tooltip||l.isNull(e.tooltip))&&this.set("tooltipEnable",!1),e.geoms&&e.geoms.length&&l.each(e.geoms,function(e){t._createGeom(e)});var n=t.get("scaleController");n&&(n.defs=e.scales);var i=t.get("coordController");i&&i.reset(e.coord),this.set("options",e)},n._createGeom=function(t){var e,n=t.type;this[n]&&(e=this[n](),l.each(t,function(t,n){if(e[n])if(l.isObject(t)&&t.field)if("label"===t)e[n](t.field,t.callback,t.cfg);else{var i;l.each(t,function(t,e){"field"!==e&&(i=t)}),e[n](t.field,i)}else e[n](t)}))},n._initControllers=function(){var t=this.get("options"),e=this.get("viewTheme"),n=this.get("canvas"),i=new u.Scale({viewTheme:e,defs:t.scales}),r=new u.Coord(t.coord);this.set("scaleController",i),this.set("coordController",r);var a=new u.Axis({canvas:n,viewTheme:e});this.set("axisController",a);var o=new u.Guide({viewTheme:e,options:t.guides||[]});this.set("guideController",o)},n._initViewPlot=function(){this.get("viewContainer")||this.set("viewContainer",this.get("middlePlot"))},n._initGeoms=function(){for(var t=this.get("geoms"),e=this.get("filteredData"),n=this.get("coord"),i=this.get("_id"),r=0;r0;){t.shift().destroy()}},n._drawGeoms=function(){this.emit("beforedrawgeoms");for(var t=this.get("geoms"),e=this.get("coord"),n=0;n0?r.change({min:0}):s<=0&&r.change({max:0}))}}},n._setCatScalesRange=function(){var t=this.get("coord"),e=this.get("viewTheme"),n=this.getXScale(),i=this.getYScales(),r=[];n&&r.push(n),r=r.concat(i);var a=t.isPolar&&function(t){var e=t.startAngle,n=t.endAngle;return!(!l.isNil(e)&&!l.isNil(n)&&n-e<2*Math.PI)}(t),o=this.get("scaleController").defs;l.each(r,function(n){if((n.isCategory||n.isIdentity)&&n.values&&(!o[n.field]||!o[n.field].range)){var i,r=n.values.length;if(1===r)i=[.5,1];else{var s=0;i=a?t.isTransposed?[(s=1/r*e.widthRatio.multiplePie)/2,1-s/2]:[0,1-1/r]:[s=1/r*1/2,1-s]}n.range=i}})},n.getXScale=function(){var t=this.get("geoms"),e=null;return l.isEmpty(t)||(e=t[0].getXScale()),e},n.getYScales=function(){for(var t=this.get("geoms"),e=[],n=0;n=0?"positive":"negative";o[d][g]||(o[d][g]=0),h[n]=[o[d][g],p+o[d][g]],o[d][g]+=p}}},e}(a);a.Stack=o,t.exports=o},function(t,e,n){var i={merge:n(42),values:n(64)},r=n(144),a=n(2);t.exports={processAdjust:function(t){var e=i.merge(t),n=this.dodgeBy,a=t;n&&(a=r(e,n)),this.cacheMap={},this.adjDataArray=a,this.mergeData=e,this.adjustData(a,e),this.adjDataArray=null,this.mergeData=null},getDistribution:function(t){var e=this.adjDataArray,n=this.cacheMap,r=n[t];return r||(r={},a(e,function(e,n){var o=i.values(e,t);o.length||o.push(0),a(o,function(t){r[t]||(r[t]=[]),r[t].push(n)})}),n[t]=r),r},adjustDim:function(t,e,n,i,r){var o=this,s=o.getDistribution(t),l=o.groupData(n,t);a(l,function(n,i){i=parseFloat(i);var l;l=1===e.length?{pre:e[0]-1,next:e[0]+1}:o.getAdjustRange(t,i,e),a(n,function(e){var n=e[t],i=s[n],a=i.indexOf(r);e[t]=o.getDodgeOffset(l,a,i.length)})})}}},function(t,e){t.exports={_initDefaultCfg:function(){this.xField=null,this.yField=null,this.height=null,this.size=10,this.reverseOrder=!1,this.adjustNames=["y"]},processOneDimStack:function(t){var e=this.xField,n=this.yField||"y",i=this.height,r={};this.reverseOrder&&(t=t.slice(0).reverse());for(var a=0,o=t.length;ai.width||n.height>i.height?r.push(t[a]):n.width*n.height>i.width*i.height&&r.push(t[a]);for(var o=0;o0?e="left":t[0]<0&&(e="right"),e},n.getLinePath=function(){var t=this.get("center"),e=t.x,n=t.y,i=this.get("radius"),r=i,a=this.get("startAngle"),o=this.get("endAngle"),s=this.get("inner"),l=[];if(Math.abs(o-a)===2*Math.PI)l=[["M",e,n],["m",0,-r],["a",i,r,0,1,1,0,2*r],["a",i,r,0,1,1,0,-2*r],["z"]];else{var u=this._getCirclePoint(a),c=this._getCirclePoint(o),h=Math.abs(o-a)>Math.PI?1:0,f=a>o?0:1;if(s){var p=this.getSideVector(s*i,u),g=this.getSideVector(s*i,c),d={x:p[0]+e,y:p[1]+n},v={x:g[0]+e,y:g[1]+n};l=[["M",d.x,d.y],["L",u.x,u.y],["A",i,r,0,h,f,c.x,c.y],["L",v.x,v.y],["A",i*s,r*s,0,h,Math.abs(f-1),d.x,d.y]]}else l=[["M",e,n],["L",u.x,u.y],["A",i,r,0,h,f,c.x,c.y],["L",e,n]]}return l},n.addLabel=function(e,n,i){var r=this.get("label").offset||this.get("_labelOffset")||.001;n=this.getSidePoint(n,r),t.prototype.addLabel.call(this,e,n,i)},n.autoRotateLabels=function(){var t=this.get("ticks"),e=this.get("labelRenderer");if(e&&t.length>12){var n=this.get("radius"),r=this.get("startAngle"),a=this.get("endAngle")-r,o=a/(t.length-1),s=Math.sin(o/2)*n*2,l=this.getMaxLabelWidth(e);i.each(e.get("group").get("children"),function(e,n){var i=t[n].value*a+r,o=i%(2*Math.PI);lMath.PI&&(i-=Math.PI),i-=Math.PI/2,e.attr("textAlign","center")):o>Math.PI/2?i-=Math.PI:oo.x)&&(u=!0);var c=a.vertical([],l,u);return a.scale([],c,t*n)},n.getAxisVector=function(){var t=this.get("start"),e=this.get("end");return[e.x-t.x,e.y-t.y]},n.getLinePath=function(){var t=this.get("start"),e=this.get("end"),n=[];return n.push(["M",t.x,t.y]),n.push(["L",e.x,e.y]),n},n.getTickEnd=function(t,e){var n=this.getSideVector(e);return{x:t.x+n[0],y:t.y+n[1]}},n.getTickPoint=function(t){var e=this.get("start"),n=this.get("end"),i=n.x-e.x,r=n.y-e.y;return{x:e.x+i*t,y:e.y+r*t}},n.renderTitle=function(){var t=this.get("title"),e=this.getTickPoint(.5),n=t.offset;if(r.isNil(n)){n=20;var i=this.get("labelsGroup");if(i){n+=this.getMaxLabelWidth(i)+(this.get("label").offset||this.get("_labelOffset"))}}var o=t.textStyle,s=r.mix({},o);if(t.text){var l=this.getAxisVector();if(t.autoRotate&&r.isNil(o.rotate)){var u=0;if(!r.snapEqual(l[1],0)){var c=[l[0],l[1]];u=a.angleTo(c,[1,0],!0)}s.rotate=u*(180/Math.PI)}else r.isNil(o.rotate)||(s.rotate=o.rotate/180*Math.PI);var h,f=this.getSideVector(n),p=t.position;h="start"===p?{x:this.get("start").x+f[0],y:this.get("start").y+f[1]}:"end"===p?{x:this.get("end").x+f[0],y:this.get("end").y+f[1]}:{x:e.x+f[0],y:e.y+f[1]},s.x=h.x,s.y=h.y,s.text=t.text;var g=this.get("group").addShape("Text",{zIndex:2,attrs:s});g.name="axis-title",this.get("appendInfo")&&g.setSilent("appendInfo",this.get("appendInfo"))}},n.autoRotateLabels=function(){var t=this.get("labelRenderer"),e=this.get("title");if(t){var n=t.get("group").get("children"),i=this.get("label").offset,a=e?e.offset:48;if(a<0)return;var o,s,l=this.getAxisVector();if(r.snapEqual(l[0],0)&&e&&e.text)(s=this.getMaxLabelWidth(t))>a-i-12&&(o=-1*Math.acos((a-i-12)/s));else if(r.snapEqual(l[1],0)&&n.length>1){var u=Math.abs(this._getAvgLabelLength(t));(s=this.getMaxLabelWidth(t))>u&&(o=Math.asin(1.25*(a-i-12)/s))}if(o){var c=this.get("factor");r.each(n,function(t){t.rotateAtStart(o),r.snapEqual(l[1],0)&&(c>0?t.attr("textAlign","left"):t.attr("textAlign","right"))})}}},n.autoHideLabels=function(){var t,e,n=this.get("labelRenderer");if(n){var i=n.get("group").get("children"),a=this.getAxisVector();if(i.length<2)return;if(r.snapEqual(a[0],0)){var o=this.getMaxLabelHeight(n)+8,s=Math.abs(this._getAvgLabelHeightSpace(n));o>s&&(t=o,e=s)}else if(r.snapEqual(a[1],0)&&i.length>1){var l=this.getMaxLabelWidth(n)+8,u=Math.abs(this._getAvgLabelLength(n));l>u&&(t=l,e=u)}if(t&&e){var c=Math.ceil(t/e);r.each(i,function(t,e){e%c!=0&&t.attr("text","")})}}},e}(i);t.exports=o},function(t,e,n){var i=n(3),r=n(31),a=i.MatrixUtil,o=i.PathUtil,s=a.vec2,l=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return i.mix({},e,{type:"polyline"})},n.getLinePath=function(){var t=this.get("tickPoints"),e=this.get("start"),n=this.get("end"),r=[];r.push(e.x),r.push(e.y),i.each(t,function(t){r.push(t.x),r.push(t.y)}),r.push(n.x),r.push(n.y);var a=o.catmullRomToBezier(r);return a.unshift(["M",e.x,e.y]),a},n.getTickPoint=function(t,e){return this.get("tickPoints")[e]},n.getTickEnd=function(t,e,n){var i=this.get("tickLine"),r=e||i.length,a=this.getSideVector(r,t,n);return{x:t.x+a[0],y:t.y+a[1]}},n.getSideVector=function(t,e,n){var i;if(0===n){if((i=this.get("start")).x===e.x&&i.y===e.y)return[0,0]}else{i=this.get("tickPoints")[n-1]}var r=[e.x-i.x,e.y-i.y],a=s.normalize([],r),o=s.vertical([],a,!1);return s.scale([],o,t)},e}(r);t.exports=l},function(t,e,n){t.exports={Guide:n(15),Arc:n(315),DataMarker:n(316),DataRegion:n(317),Html:n(318),Image:n(319),Line:n(320),Region:n(321),Text:n(322)}},function(t,e,n){function i(t,e){var n,i=t.x-e.x,r=t.y-e.y;return 0===r?n=i<0?o/2:270*o/180:i>=0&&r>0?n=2*o-s(i/r):i<=0&&r<0?n=o-s(i/r):i>0&&r<0?n=o+s(-i/r):i<0&&r>0&&(n=s(i/-r)),n}var r=n(3),a=n(15),o=Math.PI,s=Math.atan,l=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return r.mix({},e,{name:"arc",start:null,end:null,style:{stroke:"#999",lineWidth:1}})},n.render=function(t,e){var n,a=this.parsePoint(t,this.get("start")),s=this.parsePoint(t,this.get("end")),l=t.getCenter(),u=Math.sqrt((a.x-l.x)*(a.x-l.x)+(a.y-l.y)*(a.y-l.y)),c=i(a,l),h=i(s,l);if(ho?1:0;n=[["M",a.x,a.y],["A",u,u,0,f,1,s.x,s.y]]}var p=e.addShape("path",{zIndex:this.get("zIndex"),attrs:r.mix({path:n},this.get("style"))});p.name="guide-arc",this.get("appendInfo")&&p.setSilent("appendInfo",this.get("appendInfo")),this.set("el",p)},e}(a);t.exports=l},function(t,e,n){var i=n(3),r=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return i.mix({},e,{name:"dataMarker",zIndex:1,top:!0,position:null,style:{point:{r:3,fill:"#FFFFFF",stroke:"#1890FF",lineWidth:2},line:{stroke:"#A3B1BF",lineWidth:1},text:{fill:"#000000",opacity:.65,fontSize:12,textAlign:"start"}},display:{point:!0,line:!0,text:!0},lineLength:20,direction:"upward",autoAdjust:!0})},n.render=function(t,e){var n=this.parsePoint(t,this.get("position")),i=e.addGroup();i.name="guide-data-marker";var r,a,o=this._getElementPosition(n),s=this.get("display");if(s.line){var l=o.line;r=this._drawLine(l,i)}if(s.text&&this.get("content")){var u=o.text;a=this._drawText(u,i)}if(s.point){var c=o.point;this._drawPoint(c,i)}if(this.get("autoAdjust")){var h=i.getBBox(),f=h.minX,p=h.minY,g=h.maxX,d=h.maxY,v=t.start,y=t.end;if(a){f<=v.x&&a.attr("textAlign","start"),g>=y.x&&a.attr("textAlign","end");var x=this.get("direction");if("upward"===x&&p<=y.y||"upward"!==x&&d>=v.y){var m,_;"upward"===x&&p<=y.y?(m="top",_=1):(m="bottom",_=-1),a.attr("textBaseline",m);var b=0;if(this.get("display").line){b=this.get("lineLength");var w=[["M",n.x,n.y],["L",n.x,n.y+b*_]];r.attr("path",w)}var S=n.y+(b+2)*_;a.attr("y",S)}}}this.get("appendInfo")&&i.setSilent("appendInfo",this.get("appendInfo")),this.set("el",i)},n._getElementPosition=function(t){var e=t.x,n=t.y,i=this.get("display").line?this.get("lineLength"):0,r=this.get("direction");this.get("style").text.textBaseline="upward"===r?"bottom":"top";var a="upward"===r?-1:1;return{point:{x:e,y:n},line:[{x:e,y:n},{x:e,y:i*a+n}],text:{x:e,y:(i+2)*a+n}}},n._drawLine=function(t,e){var n=this.get("style").line,r=[["M",t[0].x,t[0].y],["L",t[1].x,t[1].y]];return e.addShape("path",{attrs:i.mix({path:r},n)})},n._drawText=function(t,e){var n=this.get("style").text;return e.addShape("text",{attrs:i.mix({text:this.get("content")},n,t)})},n._drawPoint=function(t,e){var n=this.get("style").point;return e.addShape("circle",{attrs:i.mix({},n,t)})},e}(n(15));t.exports=r},function(t,e,n){var i=n(3),r=n(156),a=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return i.mix({},e,{name:"dataRegion",start:null,end:null,content:"",style:{region:{lineWidth:0,fill:"#000000",opacity:.04},text:{textAlign:"center",textBaseline:"bottom",fontSize:12,fill:"rgba(0, 0, 0, .65)"}}})},n.render=function(t,e,n){var r=this.get("lineLength")||0,a=this._getRegionData(t,n);if(a.length){var o=this._getBBox(a),s=[];s.push(["M",a[0].x,o.yMin-r]);for(var l=0,u=a.length;l=n&&h.push(this.parsePoint(t,[g[s],g[l]])),g[s]===c)break}return h},n._getBBox=function(t){for(var e=[],n=[],r=0;r');a.appendChild(o);var s=this.get("htmlContent")||this.get("html");if(i.isFunction(s)){s=s(this.get("xScales"),this.get("yScales"))}var l=r.createDom(s);o.appendChild(l),r.modifyCSS(o,{position:"absolute"}),this._setDomPosition(o,l,n),this.set("el",o)},n._setDomPosition=function(t,e,n){var i=this.get("alignX"),a=this.get("alignY"),o=r.getOuterWidth(e),s=r.getOuterHeight(e),l={x:n.x,y:n.y};"middle"===i&&"top"===a?l.x-=Math.round(o/2):"middle"===i&&"bottom"===a?(l.x-=Math.round(o/2),l.y-=Math.round(s)):"left"===i&&"bottom"===a?l.y-=Math.round(s):"left"===i&&"middle"===a?l.y-=Math.round(s/2):"left"===i&&"top"===a?(l.x=n.x,l.y=n.y):"right"===i&&"bottom"===a?(l.x-=Math.round(o),l.y-=Math.round(s)):"right"===i&&"middle"===a?(l.x-=Math.round(o),l.y-=Math.round(s/2)):"right"===i&&"top"===a?l.x-=Math.round(o):(l.x-=Math.round(o/2),l.y-=Math.round(s/2));var u=this.get("offsetX");u&&(l.x+=u);var c=this.get("offsetY");c&&(l.y+=c),r.modifyCSS(t,{top:Math.round(l.y)+"px",left:Math.round(l.x)+"px",visibility:"visible",zIndex:this.get("zIndex")})},n.clear=function(){var t=this.get("el");t&&t.parentNode&&t.parentNode.removeChild(t)},e}(n(15));t.exports=a},function(t,e,n){var i=n(3),r=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return i.mix({},e,{type:"image",start:null,end:null,src:null,offsetX:null,offsetY:null})},n.render=function(t,e){var n=this.parsePoint(t,this.get("start")),i={x:n.x,y:n.y};if(i.img=this.get("src"),this.get("end")){var r=this.parsePoint(t,this.get("end"));i.width=r.x-n.x,i.height=r.y-n.y}else i.width=this.get("width")||32,i.height=this.get("height")||32;this.get("offsetX")&&(i.x+=this.get("offsetX")),this.get("offsetY")&&(i.y+=this.get("offsetY"));var a=e.addShape("Image",{zIndex:1,attrs:i});a.name="guide-image",this.get("appendInfo")&&a.setSilent("appendInfo",this.get("appendInfo")),this.set("el",a)},e}(n(15));t.exports=r},function(t,e,n){var i=n(3),r=n(15),a=i.MatrixUtil.vec2,o=n(14).FONT_FAMILY,s=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return i.mix({},e,{name:"line",start:null,end:null,lineStyle:{stroke:"#000",lineWidth:1},text:{position:"end",autoRotate:!0,style:{fill:"#999",fontSize:12,fontWeight:500,fontFamily:o},content:null}})},n.render=function(t,e){var n=this.parsePoint(t,this.get("start")),i=this.parsePoint(t,this.get("end")),r=e.addGroup({viewId:e.get("viewId")});this._drawLines(n,i,r);var a=this.get("text");a&&a.content&&this._drawText(n,i,r),this.set("el",r)},n._drawLines=function(t,e,n){var r=[["M",t.x,t.y],["L",e.x,e.y]],a=n.addShape("Path",{attrs:i.mix({path:r},this.get("lineStyle"))});a.name="guide-line",this.get("appendInfo")&&a.setSilent("appendInfo",this.get("appendInfo"))},n._drawText=function(t,e,n){var r,o=this.get("text"),s=o.position,l=o.style||{};((r="start"===s?0:"center"===s?.5:i.isString(s)&&-1!==s.indexOf("%")?parseInt(s,10)/100:i.isNumber(s)?s:1)>1||r<0)&&(r=1);var u={x:t.x+(e.x-t.x)*r,y:t.y+(e.y-t.y)*r};if(o.offsetX&&(u.x+=o.offsetX),o.offsetY&&(u.y+=o.offsetY),u.text=o.content,u=i.mix({},u,l),o.autoRotate&&i.isNil(l.rotate)){var c=a.angleTo([e.x-t.x,e.y-t.y],[1,0],1);u.rotate=c}else i.isNil(l.rotate)||(u.rotate=l.rotate*Math.PI/180);var h=n.addShape("Text",{attrs:u});h.name="guide-line-text",this.get("appendInfo")&&h.setSilent("appendInfo",this.get("appendInfo"))},e}(r);t.exports=s},function(t,e,n){var i=n(3),r=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return i.mix({},e,{name:"region",zIndex:1,start:null,end:null,style:{lineWidth:0,fill:"#CCD7EB",opacity:.4}})},n.render=function(t,e){var n=this.get("style"),r=this._getPath(t),a=e.addShape("path",{zIndex:this.get("zIndex"),attrs:i.mix({path:r},n)});a.name="guide-region",this.get("appendInfo")&&a.setSilent("appendInfo",this.get("appendInfo")),this.set("el",a)},n._getPath=function(t){var e=this.parsePoint(t,this.get("start")),n=this.parsePoint(t,this.get("end"));return[["M",e.x,e.y],["L",n.x,e.y],["L",n.x,n.y],["L",e.x,n.y],["z"]]},e}(n(15));t.exports=r},function(t,e,n){var i=n(3),r=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return i.mix({},e,{name:"text",position:null,content:null,style:{fill:"#999",fontSize:12,fontWeight:500,textAlign:"center"},offsetX:null,offsetY:null,top:!0})},n.render=function(t,e){var n=this.parsePoint(t,this.get("position")),r=i.mix({},this.get("style")),a=this.get("offsetX"),o=this.get("offsetY");a&&(n.x+=a),o&&(n.y+=o),r.rotate&&(r.rotate=r.rotate*Math.PI/180);var s=e.addShape("Text",{zIndex:this.get("zIndex"),attrs:i.mix({text:this.get("content")},r,n)});s.name="guide-text",this.get("appendInfo")&&s.setSilent("appendInfo",this.get("appendInfo")),this.set("el",s)},e}(n(15));t.exports=r},function(t,e,n){var i=n(154);t.exports=i},function(t,e,n){t.exports={Category:n(157),CatHtml:n(159),CatPageHtml:n(325),Color:n(326),Size:n(328),CircleSize:n(329)}},function(t,e,n){function i(t,e){return t.getElementsByClassName(e)[0]}var r=n(3),a=n(159),o=n(14).FONT_FAMILY,s=r.DomUtil,l=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return r.mix({},e,{type:"category-page-legend",container:null,caretStyle:{fill:"rgba(0,0,0,0.65)"},pageNumStyle:{display:"inline-block",fontSize:"12px",fontFamily:o,cursor:"default"},slipDomStyle:{width:"auto",height:"auto",position:"absolute"},slipTpl:'

      1

      /2

      ',slipWidth:65,legendOverflow:"unset"})},n.render=function(){t.prototype._renderHTML.call(this),this._renderFlipPage()},n._renderFlipPage=function(){var t=document.getElementsByClassName("g2-legend")[0],e=i(t,"g2-legend-list"),n=this.get("position"),a=this.get("layout"),o="right"===n||"left"===n||"vertical"===a?"block":"inline-block";if(t.scrollHeight>t.offsetHeight){var l=this.get("slipTpl"),u=s.createDom(l),c=i(u,"g2-caret-up"),h=i(u,"g2-caret-down");s.modifyCSS(c,this.get("caretStyle")),s.modifyCSS(c,{fill:"rgba(0,0,0,0.25)"}),s.modifyCSS(h,this.get("caretStyle"));var f=i(u,"cur-pagenum"),p=i(u,"next-pagenum"),g=this.get("pageNumStyle");s.modifyCSS(f,r.mix({},g,{paddingLeft:"10px"})),s.modifyCSS(p,r.mix({},g,{opacity:.3,paddingRight:"10px"})),s.modifyCSS(u,r.mix({},this.get("slipDomStyle"),{top:t.offsetHeight+"px"})),t.style.overflow=this.get("legendOverflow"),t.appendChild(u);for(var d=e.childNodes,v=0,y=1,x=[],m=0;m=t.offsetHeight&&(y++,x.forEach(function(t){t.style.display="none"}),x=[]),x.push(d[m]);p.innerText="/"+y,d.forEach(function(e){e.style.display=o,(v=e.offsetTop+e.offsetHeight)>t.offsetHeight&&(e.style.display="none")}),c.addEventListener("click",function(){if(d[0].style.display!==o){var e=-1;d.forEach(function(t,n){t.style.display===o&&(e=-1===e?n:e,t.style.display="none")});for(var n=e-1;n>=0&&(d[n].style.display=o,v=d[e-1].offsetTop+d[e-1].offsetHeight,d[n].style.display="none",v0){var g=i.toRGB(l[p-1].color);u+=1-l[p].percentage+":"+g+" "}h.addShape("text",{attrs:r.mix({},{x:a+this.get("textOffset")/2,y:o-l[p].percentage*o,text:this._formatItemValue(l[p].value)+""},this.get("textStyle"),{textAlign:"start"})})}}else{u+="l (0) ";for(var d=0;d0){var v=i.toRGB(l[d-1].color);u+=l[d].percentage+":"+v+" "}u+=l[d].percentage+":"+n+" ",h.addShape("text",{attrs:r.mix({},{x:l[d].percentage*a,y:o+5+this.get("textOffset"),text:this._formatItemValue(l[d].value)+""},this.get("textStyle"))})}}h.addShape("rect",{attrs:{x:0,y:0,width:a,height:o,fill:u,strokeOpacity:0}}),h.addShape("path",{attrs:r.mix({path:c},this.get("lineStyle"))}),h.move(0,e)},e}(n(67));t.exports=a},function(t,e,n){var i=n(3),r=i.DomUtil,a=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){return{range:null,middleAttr:{fill:"#fff",fillOpacity:0},backgroundElement:null,minHandleElement:null,maxHandleElement:null,middleHandleElement:null,currentTarget:null,layout:"vertical",width:null,height:null,pageX:null,pageY:null}},n._beforeRenderUI=function(){var t=this.get("layout"),e=this.get("backgroundElement"),n=this.get("minHandleElement"),i=this.get("maxHandleElement"),r=this.addShape("rect",{attrs:this.get("middleAttr")}),a="vertical"===t?"ns-resize":"ew-resize";this.add([e,n,i]),this.set("middleHandleElement",r),e.set("zIndex",0),r.set("zIndex",1),n.set("zIndex",2),i.set("zIndex",2),r.attr("cursor","move"),n.attr("cursor",a),i.attr("cursor",a),this.sort()},n._renderUI=function(){"horizontal"===this.get("layout")?this._renderHorizontal():this._renderVertical()},n._transform=function(t){var e=this.get("range"),n=e[0]/100,i=e[1]/100,r=this.get("width"),a=this.get("height"),o=this.get("minHandleElement"),s=this.get("maxHandleElement"),l=this.get("middleHandleElement");o.resetMatrix(),s.resetMatrix(),"horizontal"===t?(l.attr({x:r*n,y:0,width:(i-n)*r,height:a}),o.translate(n*r,a),s.translate(i*r,a)):(l.attr({x:0,y:a*(1-i),width:r,height:(i-n)*a}),o.translate(1,(1-n)*a),s.translate(1,(1-i)*a))},n._renderHorizontal=function(){this._transform("horizontal")},n._renderVertical=function(){this._transform("vertical")},n._bindUI=function(){this.on("mousedown",i.wrapBehavior(this,"_onMouseDown"))},n._isElement=function(t,e){var n=this.get(e);if(t===n)return!0;if(n.isGroup){return n.get("children").indexOf(t)>-1}return!1},n._getRange=function(t,e){var n=t+e;return n=n>100?100:n,n=n<0?0:n},n._updateStatus=function(t,e){var n="x"===t?this.get("width"):this.get("height");t=i.upperFirst(t);var r,a=this.get("range"),o=this.get("page"+t),s=this.get("currentTarget"),l=this.get("rangeStash"),u="vertical"===this.get("layout")?-1:1,c=e["page"+t],h=(c-o)/n*100*u;a[1]<=a[0]?(this._isElement(s,"minHandleElement")||this._isElement(s,"maxHandleElement"))&&(a[0]=this._getRange(h,a[0]),a[1]=this._getRange(h,a[0])):(this._isElement(s,"minHandleElement")&&(a[0]=this._getRange(h,a[0])),this._isElement(s,"maxHandleElement")&&(a[1]=this._getRange(h,a[1]))),this._isElement(s,"middleHandleElement")&&(r=l[1]-l[0],a[0]=this._getRange(h,a[0]),a[1]=a[0]+r,a[1]>100&&(a[1]=100,a[0]=a[1]-r)),this.emit("sliderchange",{range:a}),this.set("page"+t,c),this._renderUI(),this.get("canvas").draw()},n._onMouseDown=function(t){var e=t.currentTarget,n=t.event,i=this.get("range");n.stopPropagation(),n.preventDefault(),this.set("pageX",n.pageX),this.set("pageY",n.pageY),this.set("currentTarget",e),this.set("rangeStash",[i[0],i[1]]),this._bindCanvasEvents()},n._bindCanvasEvents=function(){var t=this.get("canvas").get("containerDOM");this.onMouseMoveListener=r.addEventListener(t,"mousemove",i.wrapBehavior(this,"_onCanvasMouseMove")),this.onMouseUpListener=r.addEventListener(t,"mouseup",i.wrapBehavior(this,"_onCanvasMouseUp")),this.onMouseLeaveListener=r.addEventListener(t,"mouseleave",i.wrapBehavior(this,"_onCanvasMouseUp"))},n._onCanvasMouseMove=function(t){if(!this._mouseOutArea(t)){"horizontal"===this.get("layout")?this._updateStatus("x",t):this._updateStatus("y",t)}},n._onCanvasMouseUp=function(){this._removeDocumentEvents()},n._removeDocumentEvents=function(){this.onMouseMoveListener.remove(),this.onMouseUpListener.remove()},n._mouseOutArea=function(t){var e=this.get("canvas").get("el").getBoundingClientRect(),n=this.get("parent"),i=n.getBBox(),r=n.attr("matrix")[6],a=n.attr("matrix")[7],o=r+i.width,s=a+i.height,l=t.clientX-e.x,u=t.clientY-e.y;return lo||us},e}(i.Group);t.exports=a},function(t,e,n){var i=n(3),r=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return i.mix({},e,{type:"size-legend",width:100,height:200,_unslidableElementStyle:{fill:"#4E7CCC",fillOpacity:1},frontMiddleBarStyle:{fill:"rgb(64, 141, 251)"}})},n._renderSliderShape=function(){var t=this.get("slider").get("backgroundElement"),e=this.get("layout"),n=this.get("width"),r=this.get("height"),a=this.get("height")/2,o=this.get("frontMiddleBarStyle"),s="vertical"===e?[[0,0],[n,0],[n,r],[n-4,r]]:[[0,a+r/2],[0,a+r/2-4],[n,a-r/2],[n,a+r/2]];return this._addMiddleBar(t,"Polygon",i.mix({points:s},o))},n._renderUnslidable=function(){var t=this.get("layout"),e=this.get("width"),n=this.get("height"),r=this.get("frontMiddleBarStyle"),a="vertical"===t?[[0,0],[e,0],[e,n],[e-4,n]]:[[0,n],[0,n-4],[e,0],[e,n]];this.get("group").addGroup().addShape("Polygon",{attrs:i.mix({points:a},r)});var o=this._formatItemValue(this.get("firstItem").value),s=this._formatItemValue(this.get("lastItem").value);"vertical"===this.get("layout")?(this._addText(e+10,n-3,o),this._addText(e+10,3,s)):(this._addText(0,n,o),this._addText(e,n,s))},n._addText=function(t,e,n){var r=this.get("group").addGroup(),a=this.get("textStyle"),o=this.get("titleShape"),s=this.get("titleGap");o&&(s+=o.getBBox().height),"vertical"===this.get("layout")?r.addShape("text",{attrs:i.mix({x:t+this.get("textOffset"),y:e,text:0===n?"0":n},a)}):(e+=s+this.get("textOffset")-20,o||(e+=10),r.addShape("text",{attrs:i.mix({x:t,y:e,text:0===n?"0":n},a)}))},e}(n(67));t.exports=r},function(t,e,n){var i=n(3),r=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return i.mix({},e,{type:"size-circle-legend",width:100,height:200,_unslidableCircleStyle:{stroke:"rgb(99, 161, 248)",fill:"rgb(99, 161, 248)",fillOpacity:.3,lineWidth:1.5},triggerAttr:{fill:"white",shadowOffsetX:-2,shadowOffsetY:2,shadowBlur:10,shadowColor:"#ccc"},frontMiddleBarStyle:{fill:"rgb(64, 141, 251)"}})},n._renderSliderShape=function(){var t=this.get("slider").get("backgroundElement"),e=this.get("layout"),n="vertical"===e?2:this.get("width"),r="vertical"===e?this.get("height"):2,a=this.get("height")/2,o=this.get("frontMiddleBarStyle"),s="vertical"===e?[[0,0],[n,0],[n,r],[0,r]]:[[0,a+r],[0,a-r],[5+n-4,a-r],[5+n-4,a+r]];return this._addMiddleBar(t,"Polygon",i.mix({points:s},o))},n._addHorizontalTrigger=function(t,e,n,r){var a=this.get("slider").get(t+"HandleElement"),o=-this.get("height")/2,s=a.addShape("circle",{attrs:i.mix({x:0,y:o,r:r},e)}),l=a.addShape("text",{attrs:i.mix(n,{x:0,y:o+r+10,textAlign:"center",textBaseline:"middle"})}),u="vertical"===this.get("layout")?"ns-resize":"ew-resize";s.attr("cursor",u),l.attr("cursor",u),this.set(t+"ButtonElement",s),this.set(t+"TextElement",l)},n._addVerticalTrigger=function(t,e,n,r){var a=this.get("slider").get(t+"HandleElement"),o=a.addShape("circle",{attrs:i.mix({x:0,y:0,r:r},e)}),s=a.addShape("text",{attrs:i.mix(n,{x:r+10,y:0,textAlign:"start",textBaseline:"middle"})}),l="vertical"===this.get("layout")?"ns-resize":"ew-resize";o.attr("cursor",l),s.attr("cursor",l),this.set(t+"ButtonElement",o),this.set(t+"TextElement",s)},n._renderTrigger=function(){var t=this.get("firstItem"),e=this.get("lastItem"),n=this.get("layout"),r=this.get("textStyle"),a=this.get("triggerAttr"),o=i.mix({},a),s=i.mix({},a),l=i.mix({text:this._formatItemValue(t.value)+""},r),u=i.mix({text:this._formatItemValue(e.value)+""},r);"vertical"===n?(this._addVerticalTrigger("min",o,l,5),this._addVerticalTrigger("max",s,u,16)):(this._addHorizontalTrigger("min",o,l,5),this._addHorizontalTrigger("max",s,u,16))},n._bindEvents=function(){var t=this;if(this.get("slidable")){this.get("slider").on("sliderchange",function(e){var n=e.range,i=t.get("firstItem").value,r=t.get("lastItem").value,a=i+n[0]/100*(r-i),o=i+n[1]/100*(r-i),s=5+n[0]/100*11,l=5+n[1]/100*11;t._updateElement(a,o,s,l);var u=new Event("itemfilter",e,!0,!0);u.range=[a,o],t.emit("itemfilter",u)})}},n._updateElement=function(e,n,i,r){t.prototype._updateElement.call(this,e,n);var a=this.get("minTextElement"),o=this.get("maxTextElement"),s=this.get("minButtonElement"),l=this.get("maxButtonElement");s.attr("r",i),l.attr("r",r);if("vertical"===this.get("layout"))a.attr("x",i+10),o.attr("x",r+10);else{var u=-this.get("height")/2;a.attr("y",u+i+10),o.attr("y",u+r+10)}},n._addCircle=function(t,e,n,r,a){var o=this.get("group").addGroup(),s=this.get("_unslidableCircleStyle"),l=this.get("textStyle"),u=this.get("titleShape"),c=this.get("titleGap");u&&(c+=u.getBBox().height),o.addShape("circle",{attrs:i.mix({x:t,y:e+c,r:0===n?1:n},s)}),"vertical"===this.get("layout")?o.addShape("text",{attrs:i.mix({x:a+20+this.get("textOffset"),y:e+c,text:0===r?"0":r},l)}):o.addShape("text",{attrs:i.mix({x:t,y:e+c+a+13+this.get("textOffset"),text:0===r?"0":r},l)})},n._renderUnslidable=function(){var t=this.get("firstItem").value,e=this.get("lastItem").value;if(t>e){var n=e;e=t,t=n}var i=this._formatItemValue(t),r=this._formatItemValue(e),a=t<5?5:t,o=e>16?16:e;a>o&&(a=5,o=16),"vertical"===this.get("layout")?(this._addCircle(o,o,a,i,2*o),this._addCircle(o,2*o+16+a,o,r,2*o)):(this._addCircle(o,o,a,i,2*o),this._addCircle(2*o+16+a,o,o,r,2*o))},n.activate=function(e){this.get("slidable")&&t.prototype.activate.call(this,e)},e}(n(67));t.exports=r},function(t,e,n){var i=n(68);i.Html=n(331),i.Canvas=n(163),i.Mini=n(333),t.exports=i},function(t,e,n){function i(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function r(t,e){return t.getElementsByClassName(e)[0]}var a=n(68),o=n(3),s=o.DomUtil,l=n(332),u=n(160),c=n(161),h=n(162),f=function(t){function e(e){var n;n=t.call(this,e)||this,o.assign(i(i(n)),c),o.assign(i(i(n)),h);var r=l;n.style=function(t,e){return Object.keys(t).forEach(function(n){e[n]&&(t[n]=o.mix(t[n],e[n]))}),t}(r,e),n._init_(),n.get("items")&&n.render();var a=n.get("crosshairs");if(a){var s="rect"===a.type?n.get("backPlot"):n.get("frontPlot"),f=new u(o.mix({plot:s,plotRange:n.get("plotRange"),canvas:n.get("canvas")},n.get("crosshairs")));f.hide(),n.set("crosshairGroup",f)}return n}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return o.mix({},e,{containerTpl:'
        ',itemTpl:'
      • {name}{value}
      • ',htmlContent:null,follow:!0,enterable:!1})},n._init_=function(){var t,e=this.get("containerTpl"),n=this.get("canvas").get("el").parentNode;if(!this.get("htmlContent")){if(/^\#/.test(e)){var i=e.replace("#","");t=document.getElementById(i)}else t=s.createDom(e),s.modifyCSS(t,this.style["g2-tooltip"]),n.appendChild(t),n.style.position="relative";this.set("container",t)}},n.render=function(){if(this.clear(),this.get("htmlContent")){var t=this.get("canvas").get("el").parentNode,e=this._getHtmlContent();t.appendChild(e),this.set("container",e)}else this._renderTpl()},n._renderTpl=function(){var t=this,e=t.get("showTitle"),n=t.get("titleContent"),i=t.get("container"),a=r(i,"g2-tooltip-title"),l=r(i,"g2-tooltip-list"),u=t.get("items");a&&e&&(s.modifyCSS(a,t.style["g2-tooltip-title"]),a.innerHTML=n),l&&(s.modifyCSS(l,t.style["g2-tooltip-list"]),o.each(u,function(e,n){l.appendChild(t._addItem(e,n))}))},n.clear=function(){var t=this.get("container");if(this.get("htmlContent"))t&&t.remove();else{var e=r(t,"g2-tooltip-title"),n=r(t,"g2-tooltip-list");e&&(e.innerHTML=""),n&&(n.innerHTML="")}},n.show=function(){var e=this.get("container");e.style.visibility="visible",e.style.display="block";var n=this.get("crosshairGroup");n&&n.show();var i=this.get("markerGroup");i&&i.show(),t.prototype.show.call(this),this.get("canvas").draw()},n.hide=function(){var e=this.get("container");e.style.visibility="hidden",e.style.display="none";var n=this.get("crosshairGroup");n&&n.hide();var i=this.get("markerGroup");i&&i.hide(),t.prototype.hide.call(this),this.get("canvas").draw()},n.destroy=function(){var e=this.get("container"),n=this.get("containerTpl");e&&!/^\#/.test(n)&&e.parentNode.removeChild(e);var i=this.get("crosshairGroup");i&&i.destroy();var r=this.get("markerGroup");r&&r.remove(),t.prototype.destroy.call(this)},n._addItem=function(t,e){var n=this.get("itemTpl"),i=o.substitute(n,o.mix({index:e},t)),a=s.createDom(i);s.modifyCSS(a,this.style["g2-tooltip-list-item"]);var l=r(a,"g2-tooltip-marker");l&&s.modifyCSS(l,this.style["g2-tooltip-marker"]);var u=r(a,"g2-tooltip-value");return u&&s.modifyCSS(u,this.style["g2-tooltip-value"]),a},n._getHtmlContent=function(){var t=this.get("htmlContent")(this.get("titleContent"),this.get("items"));return s.createDom(t)},n.setPosition=function(e,n,i){var r,a=this.get("container"),l=this.get("canvas").get("el"),u=s.getWidth(l),c=s.getHeight(l),h=a.clientWidth,f=a.clientHeight,p=e,g=n,d=this.get("prePosition")||{x:0,y:0};if(this.get("enterable"))r=[e,n-=a.clientHeight/2],d&&e-d.x>0?e-=a.clientWidth+1:e+=1;else if(this.get("position")){var v=a.clientWidth,y=a.clientHeight;e=(r=this._calcTooltipPosition(e,n,this.get("position"),v,y,i))[0],n=r[1]}else e=(r=this._constraintPositionInBoundary(e,n,h,f,u,c))[0],n=r[1];if(this.get("inPlot")){var x=this.get("plotRange");e=(r=this._constraintPositionInPlot(e,n,h,f,x,this.get("enterable")))[0],n=r[1]}var m=this.get("markerItems");o.isEmpty(m)||(p=m[0].x,g=m[0].y),this.set("prePosition",r);this.get("follow")&&(a.style.left=e+"px",a.style.top=n+"px");var _=this.get("crosshairGroup");if(_){var b=this.get("items");_.setPosition(p,g,b)}t.prototype.setPosition.call(this,e,n)},e}(a);t.exports=f},function(t,e,n){var i,r=n(14).FONT_FAMILY,a=(i={crosshairs:!1,offset:15},i["g2-tooltip"]={position:"absolute",visibility:"hidden",zIndex:8,transition:"visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1), left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.4s cubic-bezier(0.23, 1, 0.32, 1)",backgroundColor:"rgba(255, 255, 255, 0.9)",boxShadow:"0px 0px 10px #aeaeae",borderRadius:"3px",color:"rgb(87, 87, 87)",fontSize:"12px",fontFamily:r,lineHeight:"20px",padding:"10px 10px 6px 10px"},i["g2-tooltip-title"]={marginBottom:"4px"},i["g2-tooltip-list"]={margin:0,listStyleType:"none",padding:0},i["g2-tooltip-list-item"]={marginBottom:"4px"},i["g2-tooltip-marker"]={width:"5px",height:"5px",borderRadius:"50%",display:"inline-block",marginRight:"8px"},i["g2-tooltip-value"]={display:"inline-block",float:"right",marginLeft:"30px"},i);t.exports=a},function(t,e,n){var i=n(3),r=n(163),a=n(14).FONT_FAMILY,o=i.DomUtil,s=i.MatrixUtil,l=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return i.mix({},e,{boardStyle:{x:0,y:0,width:0,height:0,radius:3},valueStyle:{x:0,y:0,text:"",fontFamily:a,fontSize:12,stroke:"#fff",lineWidth:2,fill:"black",textBaseline:"top",textAlign:"start"},padding:{top:5,right:5,bottom:0,left:5},triangleWidth:10,triangleHeight:4})},n._init_=function(){var t=this.get("padding"),e=this.get("frontPlot").addGroup();this.set("container",e);var n=e.addShape("rect",{attrs:i.mix({},this.get("boardStyle"))});this.set("board",n);var r=e.addShape("path",{attrs:{fill:this.get("boardStyle").fill}});this.set("triangleShape",r);var a=e.addGroup();a.move(t.left,t.top);var o=a.addShape("text",{attrs:i.mix({},this.get("valueStyle"))});this.set("valueShape",o)},n.render=function(){this.clear();var t=this.get("board"),e=this.get("valueShape"),n=this.get("padding"),i=this.get("items")[0];e&&e.attr("text",i.value);var r=e?e.getBBox():{width:80,height:30},a=n.left+r.width+n.right,o=n.top+r.height+n.bottom;t.attr("width",a),t.attr("height",o),this._centerTriangleShape()},n.clear=function(){this.get("valueShape").attr("text","")},n.setPosition=function(t,e,n){var i=this.get("container"),r=this.get("plotRange"),a=i.getBBox(),l=a.width,u=a.height;if(t-=l/2,n&&("point"===n.name||"interval"===n.name)){e=n.getBBox().y}if(e-=u,this.get("inPlot"))tr.tr.x?(t=r.tr.x-l,this._rightTriangleShape()):this._centerTriangleShape(),er.bl.y&&(e=r.bl.y-u);else{var c=this.get("canvas").get("el"),h=o.getWidth(c),f=o.getHeight(c);t<0?(t=0,this._leftTriangleShape()):t+l/2>h?(t=h-l,this._rightTriangleShape()):this._centerTriangleShape(),e<0?e=0:e+u>f&&(e=f-u)}var p=s.transform([1,0,0,0,1,0,0,0,1],[["t",t,e]]);i.stopAnimate(),i.animate({matrix:p},this.get("animationDuration"))},n._centerTriangleShape=function(){var t=this.get("triangleShape"),e=this.get("triangleWidth"),n=this.get("triangleHeight"),i=this.get("board").getBBox(),r=i.width,a=i.height,o=[["M",0,0],["L",e,0],["L",e/2,n],["L",0,0],["Z"]];t.attr("path",o),t.move(r/2-e/2,a-1)},n._leftTriangleShape=function(){var t=this.get("triangleShape"),e=this.get("triangleWidth"),n=this.get("triangleHeight"),i=this.get("board").getBBox().height,r=[["M",0,0],["L",e,0],["L",0,n+3],["L",0,0],["Z"]];t.attr("path",r),t.move(0,i-3)},n._rightTriangleShape=function(){var t=this.get("triangleShape"),e=this.get("triangleWidth"),n=this.get("triangleHeight"),i=this.get("board").getBBox(),r=i.width,a=i.height,o=[["M",0,0],["L",e,0],["L",e,n+4],["L",0,0],["Z"]];t.attr("path",o),t.move(r-e-1,a-4)},e}(r);t.exports=l},function(t,e,n){var i=n(0).MatrixUtil.vec2;t.exports={catmullRom2bezier:function(t,e,n){for(var r=!!e,a=[],o=0,s=t.length;o0&&(e=this._distribute(e,n)),t.prototype.adjustItems.call(this,e)},n._distribute=function(t,e){var n=this.get("coord"),i=n.getRadius(),r=this.get("label").labelHeight,a=n.getCenter(),o=2*(i+e)+2*r,s={start:n.start,end:n.end},l=this.get("geom");if(l){var u=l.get("view");s=u.getViewRegion()}var c=[[],[]];return t.forEach(function(t){t&&("right"===t.textAlign?c[0].push(t):c[1].push(t))}),c.forEach(function(t,e){var n=parseInt(o/r,10);t.length>n&&(t.sort(function(t,e){return e["..percent"]-t["..percent"]}),t.splice(n,t.length-n)),t.sort(function(t,e){return t.y-e.y}),function(t,e,n,i,r){var a,o=!0,s=n.start,l=n.end,u=Math.min(s.y,l.y),c=Math.abs(s.y-l.y),h=0,f=Number.MIN_VALUE,p=t.map(function(t){return t.y>h&&(h=t.y),t.yc&&(c=h-u);o;)for(p.forEach(function(t){var e=(Math.min.apply(f,t.targets)+Math.max.apply(f,t.targets))/2;t.pos=Math.min(Math.max(f,e-t.size/2),c-t.size)}),o=!1,a=p.length;a--;)if(a>0){var g=p[a-1],d=p[a];g.pos+g.size>d.pos&&(g.size+=d.size,g.targets=g.targets.concat(d.targets),g.pos+g.size>c&&(g.pos=c-g.size),p.splice(a,1),o=!0)}a=0,p.forEach(function(n){var i=u+e/2;n.targets.forEach(function(){t[a].y=n.pos+i,i+=e,a++})}),t.forEach(function(t){var e=t.r*t.r,n=Math.pow(Math.abs(t.y-i.y),2);if(e90&&(n-=180),n<-90&&(n+=180)),n/180*Math.PI},n.getLabelAlign=function(t){var e,n=this.get("coord").getCenter();e=t.angle<=Math.PI/2&&t.x>=n.x?"left":"right";return this.getDefaultOffset(t)<=0&&(e="right"===e?"left":"right"),e},n.getArcPoint=function(t){return t},n.getPointAngle=function(t){var e=this.get("coord"),n={x:r.isArray(t.x)?t.x[0]:t.x,y:t.y[0]};this.transLabelPoint(n);var i={x:r.isArray(t.x)?t.x[1]:t.x,y:t.y[1]};this.transLabelPoint(i);var a,s=o.getPointAngle(e,n);if(t.points&&t.points[0].y===t.points[1].y)a=s;else{var l=o.getPointAngle(e,i);s>=l&&(l+=2*Math.PI),a=s+(l-s)/2}return a},n.getCirclePoint=function(t,e){var n=this.get("coord"),r=n.getCenter(),a=n.getRadius()+e,o=i(r,t,a);return o.angle=t,o.r=a,o},e}(a);t.exports=l},function(t,e,n){var i=n(0),r=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);return e.prototype.setLabelPosition=function(t,e,n,r){i.isFunction(r)&&(r=r(t.text,e._origin,n));var a=this.get("coord"),o=a.isTransposed,s=a.convertPoint(e.points[0]),l=a.convertPoint(e.points[2]),u=(s.x-l.x)/2*(o?-1:1),c=(s.y-l.y)/2*(o?-1:1);switch(r){case"right":o?(t.x-=u,t.y+=c,t.textAlign=t.textAlign||"center"):(t.x-=u,t.y+=c,t.textAlign=t.textAlign||"left");break;case"left":o?(t.x-=u,t.y-=c,t.textAlign=t.textAlign||"center"):(t.x+=u,t.y+=c,t.textAlign=t.textAlign||"right");break;case"bottom":o?(t.x-=2*u,t.textAlign=t.textAlign||"left"):(t.y+=2*c,t.textAlign=t.textAlign||"center");break;case"middle":o?t.x-=u:t.y+=c,t.textAlign=t.textAlign||"center";break;case"top":t.textAlign=o?t.textAlign||"left":t.textAlign||"center"}},e}(n(65));t.exports=r},function(t,e,n){function i(t){return t.alias||t.field}var r=n(0),a=n(7).defaultColor,o={_getIntervalSize:function(t){var e=null,n=this.get("type"),i=this.get("coord");if(i.isRect&&("interval"===n||"schema"===n)){e=this.getSize(t._origin);var a=i.isTransposed?"y":"x";if(r.isArray(t[a])){e=e(1+i.rangeMax())/2&&(r=i.rangeMin()),e=i.invert(r),i.isCategory&&(e=i.translate(e)),e},_getOriginByPoint:function(t){var e=this.getXScale(),n=this.getYScale(),i=e.field,r=n.field,a=this.get("coord").invert(t),o=e.invert(a.x),s=n.invert(a.y),l={};return l[i]=o,l[r]=s,l},_getScale:function(t){var e=this.get("scales"),n=null;return r.each(e,function(e){if(e.field===t)return n=e,!1}),n},_getTipValueScale:function(){var t,e=this.getAttrsForLegend();r.each(e,function(e){var n=e.getScale(e.type);if(n.isLinear)return t=n,!1});var n=this.getXScale(),i=this.getYScale();return!t&&i&&"..y"===i.field?n:t||i||n},_getTipTitleScale:function(t){if(t)return this._getScale(t);var e,n=this.getAttr("position").getFields();return r.each(n,function(t){if(-1===t.indexOf(".."))return e=t,!1}),this._getScale(e)},_filterValue:function(t,e){var n=this.get("coord"),i=this.getYScale(),a=i.field,o=n.invert(e).y;o=i.invert(o);var s=t[t.length-1];return r.each(t,function(t){var e=t._origin;if(e[a][0]<=o&&e[a][1]>=o)return s=t,!1}),s},getXDistance:function(){var t=this.get("xDistance");if(!t){var e=this.getXScale();if(e.isCategory)t=1;else{var n=e.values,i=e.translate(n[0]),a=i;r.each(n,function(t){(t=e.translate(t))a&&(a=t)});var o=n.length;t=(a-i)/(o-1)}this.set("xDistance",t)}return t},findPoint:function(t,e){var n=this,i=n.get("type"),a=n.getXScale(),o=n.getYScale(),s=a.field,l=o.field,u=null;if(r.indexOf(["heatmap","point"],i)>-1){var c=n.get("coord").invert(t),h=a.invert(c.x),f=o.invert(c.y),p=1/0;return r.each(e,function(t){var e=Math.pow(t._origin[s]-h,2)+Math.pow(t._origin[l]-f,2);e=v){if(!_)return u=t,!1;r.isArray(u)||(u=[]),u.push(t)}}),r.isArray(u)&&(u=this._filterValue(u,t));else{var b;if(a.isLinear||"timeCat"===a.type){if((v>a.translate(m)||va.max||vMath.abs(a.translate(b._origin[s])-v)&&(d=b)}var A=n.getXDistance();return!u&&Math.abs(a.translate(d._origin[s])-v)<=A/2&&(u=d),u},getTipTitle:function(t,e){var n="",i=this._getTipTitleScale(e);if(i){var r=t[i.field];n=i.getText(r)}else if("heatmap"===this.get("type")){var a=this.getXScale(),o=this.getYScale();n="( "+a.getText(t[a.field])+", "+o.getText(t[o.field])+" )"}return n},getTipValue:function(t,e){var n,i=e.field,a=t.key;if(n=t[i],r.isArray(n)){var o=[];r.each(n,function(t){o.push(e.getText(t))}),n=o.join("-")}else n=e.getText(n,a);return n},getTipName:function(t){var e,n,a=this._getGroupScales();if(a.length&&r.each(a,function(t){return n=t,!1}),n){var o=n.field;e=n.getText(t[o])}else{e=i(this._getTipValueScale())}return e},getTipItems:function(t,e){function n(e,n,i){if(!r.isNil(n)&&""!==n){var o={title:c,point:t,name:e||c,value:n,color:t.color||a,marker:!0};o.size=l._getIntervalSize(t),f.push(r.mix({},o,i))}}var o,s,l=this,u=t._origin,c=l.getTipTitle(u,e),h=l.get("tooltipCfg"),f=[];if(h){var p=h.fields,g=h.cfg,d=[];if(r.each(p,function(t){d.push(u[t])}),g){r.isFunction(g)&&(g=g.apply(null,d));var v=r.mix({},{point:t,title:c,color:t.color||a,marker:!0},g);v.size=l._getIntervalSize(t),f.push(v)}else r.each(p,function(t){if(!r.isNil(u[t])){var e=l._getScale(t);o=i(e),s=e.getText(u[t]),n(o,s)}})}else{var y=l._getTipValueScale();r.isNil(u[y.field])||(s=l.getTipValue(u,y),n(o=l.getTipName(u),s))}return f},isShareTooltip:function(){var t,e=this.get("shareTooltip"),n=this.get("type"),i=this.get("view");if(t=i.get("parent")?i.get("parent").get("options"):i.get("options"),"interval"===n){var a=this.get("coord"),o=a.type;("theta"===o||"polar"===o&&a.isTransposed)&&(e=!1)}else this.getYScale()&&!r.inArray(["contour","point","polygon","edge"],n)||(e=!1);return t.tooltip&&r.isBoolean(t.tooltip.shared)&&(e=t.tooltip.shared),e}};t.exports=o},function(t,e,n){function i(t,e){if(!t)return!0;if(t.length!==e.length)return!0;var n=!1;return a.each(e,function(e,i){if(!function(t,e){if(a.isNil(t)||a.isNil(e))return!1;var n=t.get("origin"),i=e.get("origin");return a.isEqual(n,i)}(e,t[i]))return n=!0,!1}),n}function r(t,e){var n={};return a.each(t,function(t,i){var r=e.attr(i);a.isArray(r)&&(r=a.cloneDeep(r)),n[i]=r}),n}var a=n(0),o={_isAllowActive:function(){var t=this.get("allowActive");if(!a.isNil(t))return t;var e=this.get("view"),n=this.isShareTooltip();return!1===e.get("options").tooltip||!n},_onMouseenter:function(t){var e=t.shape,n=this.get("shapeContainer");e&&n.contain(e)&&this._isAllowActive()&&this.setShapesActived(e)},_onMouseleave:function(){var t=this.get("view").get("canvas");this.get("activeShapes")&&(this.clearActivedShapes(),t.draw())},_bindActiveAction:function(){var t=this.get("view"),e=this.get("type");t.on(e+":mouseenter",a.wrapBehavior(this,"_onMouseenter")),t.on(e+":mouseleave",a.wrapBehavior(this,"_onMouseleave"))},_offActiveAction:function(){var t=this.get("view"),e=this.get("type");t.off(e+":mouseenter",a.getWrapBehavior(this,"_onMouseenter")),t.off(e+":mouseleave",a.getWrapBehavior(this,"_onMouseleave"))},_setActiveShape:function(t){var e=this.get("activedOptions")||{},n=t.get("origin"),i=n.shape||this.getDefaultValue("shape");a.isArray(i)&&(i=i[0]);var o=this.get("shapeFactory"),s=a.mix({},t.attr(),{origin:n}),l=o.getActiveCfg(i,s);e.style&&a.mix(l,e.style);var u=r(l,t);t.setSilent("_originAttrs",u),e.animate?t.animate(l,300):t.attr(l),t.set("zIndex",1)},setShapesActived:function(t){var e=this;a.isArray(t)||(t=[t]);var n=e.get("activeShapes");if(i(n,t)){var r=e.get("view").get("canvas"),o=e.get("shapeContainer"),s=e.get("activedOptions");s&&s.highlight?(a.each(t,function(t){t.get("animating")&&t.stopAnimate()}),e.highlightShapes(t)):(n&&e.clearActivedShapes(),a.each(t,function(t){t.get("animating")&&t.stopAnimate(),t.get("visible")&&!t.get("selected")&&e._setActiveShape(t)})),e.set("activeShapes",t),o.sort(),r.draw()}},clearActivedShapes:function(){var t=this.get("shapeContainer"),e=this.get("activedOptions"),n=e&&e.animate;if(t&&!t.get("destroyed")){var i=this.get("activeShapes");a.each(i,function(t){if(!t.get("selected")){var e=t.get("_originAttrs");n?(t.stopAnimate(),t.animate(e,300)):t.attr(e),t.setZIndex(0),t.set("_originAttrs",null)}});if(this.get("preHighlightShapes")){var r=t.get("children");a.each(r,function(t){if(!t.get("selected")){var e=t.get("_originAttrs");e&&(n?(t.stopAnimate(),t.animate(e,300)):t.attr(e),t.setZIndex(0),t.set("_originAttrs",null))}})}t.get("children").sort(function(t,e){return t._INDEX-e._INDEX}),this.set("activeShapes",null),this.set("preHighlightShapes",null)}},getGroupShapesByPoint:function(t){var e=[];if(this.get("shapeContainer")){var n=this.getXScale().field,i=this.getShapes(),r=this._getOriginByPoint(t);a.each(i,function(t){var i=t.get("origin");if(t.get("visible")&&i){i._origin[n]===r[n]&&e.push(t)}})}return e},getSingleShapeByPoint:function(t){var e,n=this.get("shapeContainer"),i=n.get("canvas").get("pixelRatio");if(n&&(e=n.getShape(t.x*i,t.y*i)),e&&e.get("origin"))return e},highlightShapes:function(t,e){a.isArray(t)||(t=[t]);var n=this.get("activeShapes");if(i(n,t)){n&&this.clearActivedShapes();var o=this.getShapes(),s=this.get("activedOptions"),l=s&&s.animate,u=s&&s.style;a.each(o,function(n){var i={};n.stopAnimate(),-1!==a.indexOf(t,n)?(a.mix(i,u,e),n.setZIndex(1)):(a.mix(i,{fillOpacity:.3,opacity:.3}),n.setZIndex(0));var o=r(i,n);n.setSilent("_originAttrs",o),l?n.animate(i,300):n.attr(i)}),this.set("preHighlightShapes",t),this.set("activeShapes",t)}}};t.exports=o},function(t,e,n){function i(t,e){if(r.isNil(t)||r.isNil(e))return!1;var n=t.get("origin"),i=e.get("origin");return r.isEqual(n,i)}var r=n(0),a={_isAllowSelect:function(){var t=this.get("allowSelect");if(!r.isNil(t))return t;var e=this.get("type"),n=this.get("coord"),i=n&&n.type;return"interval"===e&&"theta"===i},_onClick:function(t){if(this._isAllowSelect()){this.clearActivedShapes();var e=t.shape,n=this.get("shapeContainer");e&&!e.get("animating")&&n.contain(e)&&this.setShapeSelected(e)}},_bindSelectedAction:function(){var t=this.get("view"),e=this.get("type");t.on(e+":click",r.wrapBehavior(this,"_onClick"))},_offSelectedAction:function(){var t=this.get("view"),e=this.get("type");t.off(e+":click",r.getWrapBehavior(this,"_onClick"))},_setShapeStatus:function(t,e){var n=this.get("view"),i=this.get("selectedOptions")||{},a=!1!==i.animate,o=n.get("canvas");t.set("selected",e);var s=t.get("origin");if(e){var l=s.shape||this.getDefaultValue("shape");r.isArray(l)&&(l=l[0]);var u=this.get("shapeFactory"),c=r.mix({geom:this,point:s},i),h=u.getSelectedCfg(l,c);r.mix(h,c.style),t.get("_originAttrs")||(t.get("animating")&&t.stopAnimate(),t.set("_originAttrs",function(t,e){var n={};return r.each(t,function(t,i){"transform"===i&&(i="matrix");var a=e.attr(i);r.isArray(a)&&(a=r.cloneDeep(a)),n[i]=a}),n}(h,t))),a?t.animate(h,300):(t.attr(h),o.draw())}else{var f=t.get("_originAttrs");t.set("_originAttrs",null),a?t.animate(f,300):(t.attr(f),o.draw())}},setShapeSelected:function(t){var e=this._getSelectedShapes(),n=this.get("selectedOptions")||{},a=!1!==n.cancelable;if("multiple"===n.mode)-1===r.indexOf(e,t)?(e.push(t),this._setShapeStatus(t,!0)):a&&(r.Array.remove(e,t),this._setShapeStatus(t,!1));else{var o=e[0];a&&(t=i(o,t)?null:t),i(o,t)||(o&&this._setShapeStatus(o,!1),t&&this._setShapeStatus(t,!0))}},clearSelected:function(){var t=this,e=t.get("shapeContainer");if(e&&!e.get("destroyed")){var n=t._getSelectedShapes();r.each(n,function(e){t._setShapeStatus(e,!1),e.set("_originAttrs",null)})}},setSelected:function(t){var e=this,n=e.getShapes();return r.each(n,function(n){var i=n.get("origin");i&&i._origin===t&&e.setShapeSelected(n)}),this},_getSelectedShapes:function(){var t=this.getShapes(),e=[];return r.each(t,function(t){t.get("selected")&&e.push(t)}),this.set("selectedShapes",e),e}};t.exports=a},function(t,e,n){var i=n(0);t.exports=function(t){return i.isArray(t)?t:i.isString(t)?t.split("*"):[t]}},function(t,e,n){var i=n(74),r=n(0),a=/^(?:(?!0000)[0-9]{4}([-/.]+)(?:(?:0?[1-9]|1[0-2])\1(?:0?[1-9]|1[0-9]|2[0-8])|(?:0?[13-9]|1[0-2])\1(?:29|30)|(?:0?[13578]|1[02])\1(?:31))|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)([-/.]?)0?2\2(?:29))(\s+([01]|([01][0-9]|2[0-3])):([0-9]|[0-5][0-9]):([0-9]|[0-5][0-9]))?$/,o={LINEAR:"linear",CAT:"cat",TIME:"time"},s=function(){function t(t){this.defs={},this.viewTheme={scales:{}},this.filters={},r.assign(this,t)}var e=t.prototype;return e._getDef=function(t){var e=this.defs,n=this.viewTheme,i=null;return(n.scales[t]||e[t])&&(i=r.mix({},n.scales[t]),r.each(e[t],function(t,e){r.isNil(t)?delete i[e]:i[e]=t}),this.filters[t]&&(delete i.min,delete i.max)),i},e._getDefaultType=function(t,e){var n=o.LINEAR,i=r.Array.firstValue(e,t);return r.isArray(i)&&(i=i[0]),a.test(i)?n=o.TIME:r.isString(i)&&(n=o.CAT),n},e._getScaleCfg=function(t,e,n){var a={field:e},o=r.Array.values(n,e);if(a.values=o,!i.isCategory(t)&&"time"!==t){var s=r.Array.getRange(o);a.min=s.min,a.max=s.max,a.nice=!0}return"time"===t&&(a.nice=!1),a},e.createScale=function(t,e){var n,a=this._getDef(t);if(!e||!e.length)return n=a&&a.type?i[a.type](a):i.identity({value:t,field:t.toString(),values:[t]});var o=r.Array.firstValue(e,t);if(r.isNumber(t)||r.isNil(o)&&!a)n=i.identity({value:t,field:t.toString(),values:[t]});else{var s;a&&(s=a.type),s=s||this._getDefaultType(t,e);var l=this._getScaleCfg(s,t,e);a&&r.mix(l,a),n=i[s](l)}return n},t}();t.exports=s},function(t,e,n){var i=n(0),r=n(343),a=function(){function t(t){this.type="rect",this.actions=[],this.cfg={},i.mix(this,t),this.option=t||{}}var e=t.prototype;return e.reset=function(t){return this.actions=t.actions||[],this.type=t.type,this.cfg=t.cfg,this.option.actions=this.actions,this.option.type=this.type,this.option.cfg=this.cfg,this},e._execActions=function(t){var e=this.actions;i.each(e,function(e){var n=e[0];t[n](e[1],e[2])})},e.hasAction=function(t){var e=this.actions,n=!1;return i.each(e,function(e){if(t===e[0])return n=!0,!1}),n},e.createCoord=function(t,e){var n,a,o=this.type,s=this.cfg,l=i.mix({start:t,end:e},s);return"theta"===o?(n=r.Polar,this.hasAction("transpose")||this.transpose(),(a=new n(l)).type=o):a=new(n=r[i.upperFirst(o||"")]||r.Rect)(l),this._execActions(a),a},e.rotate=function(t){return t=t*Math.PI/180,this.actions.push(["rotate",t]),this},e.reflect=function(t){return this.actions.push(["reflect",t]),this},e.scale=function(t,e){return this.actions.push(["scale",t,e]),this},e.transpose=function(){return this.actions.push(["transpose"]),this},t}();t.exports=a},function(t,e,n){"use strict";var i=n(44);i.Cartesian=n(344),i.Rect=i.Cartesian,i.Polar=n(345),i.Helix=n(346),t.exports=i},function(t,e,n){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){return!e||"object"!==i(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function a(t,e){for(var n=0;nf/l?(a=f/l,o={x:n.x-(.5-c)*f,y:n.y-(.5-h)*a*u}):(a=p/u,o={x:n.x-(.5-c)*a*l,y:n.y-(.5-h)*p}),t?t>0&&t<=1?t*=a:(t<=0||t>a)&&(t=a):t=a;var g={start:i,end:r},d={start:e*t,end:t};this.x=g,this.y=d,this.radius=t,this.circleCentre=o,this.center=o}},{key:"getCenter",value:function(){return this.circleCentre}},{key:"getOneBox",value:function(){var t=this.startAngle,e=this.endAngle;if(Math.abs(e-t)>=2*Math.PI)return{minX:-1,maxX:1,minY:-1,maxY:1};for(var n=[0,Math.cos(t),Math.cos(e)],i=[0,Math.sin(t),Math.sin(e)],r=Math.min(t,e);r0?l:-l;var u=this.invertDim(s,"y"),c={};return c.x=this.isTransposed?u:l,c.y=this.isTransposed?l:u,c}}]),e}();t.exports=y},function(t,e,n){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){return!e||"object"!==i(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function a(t,e){for(var n=0;n=0&&n<=1&&(s*=n);var l=Math.floor(s*(1-i)/o),u=l/(2*Math.PI),c={start:r,end:a},h={start:i*s,end:i*s+.99*l};this.a=u,this.d=l,this.x=c,this.y=h}},{key:"getCenter",value:function(){return this.center}},{key:"convertPoint",value:function(t){var e,n,i=this.a,r=this.center;this.isTransposed?(e=t.y,n=t.x):(e=t.x,n=t.y);var a=this.convertDim(e,"x"),o=i*a,s=this.convertDim(n,"y");return{x:r.x+Math.cos(a)*(o+s),y:r.y+Math.sin(a)*(o+s)}}},{key:"invertPoint",value:function(t){var e=this.center,n=this.a,i=this.d+this.y.start,r=g.subtract([],[t.x,t.y],[e.x,e.y]),a=g.angleTo(r,[1,0],!0),o=a*n;g.length(r)u.x||!o&&s.y>u.y?1:-1,{isVertical:o,factor:r,start:s,end:l}},e._getCircleCfg=function(t){var e,n={},i=t.x,r=t.y,a=r.start>r.end;e=t.isTransposed?{x:a?0:1,y:0}:{x:0,y:a?0:1},e=t.convert(e);var s,l=t.circleCentre,u=[e.x-l.x,e.y-l.y],c=[1,0],h=(s=e.y>l.y?o.angle(u,c):-1*o.angle(u,c))+(i.end-i.start);return n.startAngle=s,n.endAngle=h,n.center=l,n.radius=Math.sqrt(Math.pow(e.x-l.x,2)+Math.pow(e.y-l.y,2)),n.inner=t.innerRadius||0,n},e._getRadiusCfg=function(t){var e,n,i=t.x.start<0?-1:1;return t.isTransposed?(e={x:0,y:0},n={x:1,y:0}):(e={x:0,y:0},n={x:0,y:1}),{factor:i,start:t.convert(e),end:t.convert(n)}},e._getAxisPosition=function(t,e,n,i){var r="",a=this.options;if(a[i]&&a[i].position)r=a[i].position;else{var o=t.type;t.isRect?"x"===e?r="bottom":"y"===e&&(r=n?"right":"left"):r="helix"===o?"helix":"x"===e?t.isTransposed?"radius":"circle":t.isTransposed?"circle":"radius"}return r},e._getAxisDefaultCfg=function(t,e,n,i){var a=this.viewTheme,o={},s=this.options,l=e.field;if(o=r.deepMix({},a.axis[i],o,s[l]),o.viewTheme=a,o.title){var u=r.isPlainObject(o.title)?o.title:{};u.text=u.text||e.alias||l,r.deepMix(o,{title:u})}return o.ticks=e.getTicks(),t.isPolar&&!e.isCategory&&"x"===n&&Math.abs(t.endAngle-t.startAngle)===2*Math.PI&&o.ticks.pop(),o.coord=t,o.label&&r.isNil(o.label.autoRotate)&&(o.label.autoRotate=!0),s.hasOwnProperty("xField")&&s.xField.hasOwnProperty("grid")&&"left"===o.position&&r.deepMix(o,s.xField),o},e._getAxisCfg=function(t,e,n,i,a,o){void 0===a&&(a="");var s=this,l=s._getAxisPosition(t,i,a,e.field),u=s._getAxisDefaultCfg(t,e,i,l);if(!r.isEmpty(u.grid)&&n){var c=[],h=[],f=function(t){var e=[];if(t.length>0){var n=(e=t.slice(0))[0],i=e[e.length-1];0!==n.value&&e.unshift({value:0}),1!==i.value&&e.push({value:1})}return e}(n.getTicks());if(f.length){var p=function(t,e,n){var i=[];return t.length<1?i:(t.length>=2&&e&&n&&i.push({text:"",tickValue:"",value:0}),0!==t[0].value&&i.push({text:"",tickValue:"",value:0}),1!==(i=i.concat(t))[i.length-1].value&&i.push({text:"",tickValue:"",value:1}),i)}(u.ticks,e.isLinear,"center"===u.grid.align);r.each(p,function(n,l){h.push(n.tickValue);var g=[],d=n.value;if("center"===u.grid.align&&(d=s._getMiddleValue(d,p,l,e.isLinear)),!r.isNil(d)){var v=t.x,y=t.y;r.each(f,function(e){var n="x"===i?d:e.value,r="x"===i?e.value:d,a=t.convert({x:n,y:r});if(t.isPolar){var o=t.circleCentre;y.start>y.end&&(r=1-r),a.flag=v.start>v.end?0:1,a.radius=Math.sqrt(Math.pow(a.x-o.x,2)+Math.pow(a.y-o.y,2))}g.push(a)}),c.push({_id:o+"-"+i+a+"-grid-"+n.tickValue,points:g})}})}u.grid.items=c,u.grid.tickValues=h}return u.type=e.type,u},e._getHelixCfg=function(t){for(var e={},n=t.a,i=t.startAngle,r=t.endAngle,a=[],o=0;o<=100;o++){var s=t.convert({x:o/100,y:0});a.push(s.x),a.push(s.y)}var l=t.convert({x:0,y:0});return e.a=n,e.startAngle=i,e.endAngle=r,e.crp=a,e.axisStart=l,e.center=t.center,e.inner=t.y.start,e},e._drawAxis=function(t,e,n,i,o,s,l){var u,c,h=this.container,f=this.canvas;"cartesian"===t.type?(u=a.Line,c=this._getLineCfg(t,e,i,l)):"helix"===t.type&&"x"===i?(u=a.Helix,c=this._getHelixCfg(t)):"x"===i?(u=a.Circle,c=this._getCircleCfg(t)):(u=a.Line,c=this._getRadiusCfg(t));var p=this._getAxisCfg(t,e,n,i,l,o);p=r.mix({},p,c),"y"===i&&s&&"circle"===s.get("type")&&(p.circle=s),p._id=o+"-"+i,r.isNil(l)||(p._id=o+"-"+i+l),r.mix(p,{canvas:f,group:h});var g=new u(p);return g.render(),this.axes.push(g),g},e.createAxis=function(t,e,n){var i=this,a=this.coord,o=a.type;if("theta"!==o&&("polar"!==o||!a.isTransposed)){var s;t&&!i._isHide(t.field)&&(s=i._drawAxis(a,t,e[0],"x",n)),r.isEmpty(e)||"helix"===o||r.each(e,function(e,r){i._isHide(e.field)||i._drawAxis(a,e,t,"y",n,s,r)})}},e.changeVisible=function(t){var e=this.axes;r.each(e,function(e){e.set("visible",t)})},e.clear=function(){var t=this.axes;r.each(t,function(t){t.clear()}),this.axes=[]},t}();t.exports=s},function(t,e,n){var i=n(0),r=n(349),a=function(){function t(t){this.guides=[],this.options=[],this.xScales=null,this.yScales=null,this.view=null,this.viewTheme=null,this.frontGroup=null,this.backGroup=null,i.mix(this,t)}var e=t.prototype;return e._creatGuides=function(){var t=this,e=this.options,n=this.xScales,a=this.yScales,o=this.view,s=this.viewTheme;return this.backContainer&&o&&(this.backGroup=this.backContainer.addGroup({viewId:o.get("_id")})),this.frontContainer&&o&&(this.frontGroup=this.frontContainer.addGroup({viewId:o.get("_id")})),e.forEach(function(e){var o=e.type,l=i.deepMix({xScales:n,yScales:a,viewTheme:s},s?s.guide[o]:{},e);o=i.upperFirst(o);var u=new r[o](l);t.guides.push(u)}),t.guides},e.line=function(t){return void 0===t&&(t={}),this.options.push(i.mix({type:"line"},t)),this},e.arc=function(t){return void 0===t&&(t={}),this.options.push(i.mix({type:"arc"},t)),this},e.text=function(t){return void 0===t&&(t={}),this.options.push(i.mix({type:"text"},t)),this},e.image=function(t){return void 0===t&&(t={}),this.options.push(i.mix({type:"image"},t)),this},e.region=function(t){return void 0===t&&(t={}),this.options.push(i.mix({type:"region"},t)),this},e.regionFilter=function(t){return void 0===t&&(t={}),this.options.push(i.mix({type:"regionFilter"},t)),this},e.dataMarker=function(t){return void 0===t&&(t={}),this.options.push(i.mix({type:"dataMarker"},t)),this},e.dataRegion=function(t){return void 0===t&&(t={}),this.options.push(i.mix({type:"dataRegion"},t)),this},e.html=function(t){return void 0===t&&(t={}),this.options.push(i.mix({type:"html"},t)),this},e.render=function(t){var e=this,n=e.view,r=n&&n.get("data"),a=e._creatGuides();i.each(a,function(i){var a;a=i.get("top")?e.frontGroup||e.frontContainer:e.backGroup||e.backContainer,i.render(t,a,r,n)})},e.clear=function(){this.options=[],this.reset()},e.changeVisible=function(t){var e=this.guides;i.each(e,function(e){e.changeVisible(t)})},e.reset=function(){var t=this.guides;i.each(t,function(t){t.clear()}),this.guides=[],this.backGroup&&this.backGroup.remove(),this.frontGroup&&this.frontGroup.remove()},t}();t.exports=a},function(t,e,n){var i=n(21).Guide,r=n(350);i.RegionFilter=r,t.exports=i},function(t,e,n){var i=n(0),r=n(15),a=n(25).Path,o=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return i.mix({},e,{name:"regionFilter",zIndex:1,top:!0,start:null,end:null,color:null,apply:null,style:{opacity:1}})},n.render=function(t,e,n,i){var r=this,a=e.addGroup();a.name="guide-region-filter",i.once("afterpaint",function(){if(!a.get("destroyed")){r._drawShapes(i,a);var e=r._drawClip(t);a.attr({clip:e}),r.set("clip",e),r.get("appendInfo")&&a.setSilent("appendInfo",r.get("appendInfo")),r.set("el",a)}})},n._drawShapes=function(t,e){var n=this,r=[];return t.getAllGeoms().map(function(t){var a=t.getShapes(),o=t.get("type");return n._geomFilter(o)&&a.map(function(t){var a=t.type,o=i.cloneDeep(t.attr());n._adjustDisplay(o);var s=e.addShape(a,{attrs:o});return r.push(s),t}),t}),r},n._drawClip=function(t){var e=this.parsePoint(t,this.get("start")),n=this.parsePoint(t,this.get("end")),i=[["M",e.x,e.y],["L",n.x,e.y],["L",n.x,n.y],["L",e.x,n.y],["z"]];return new a({attrs:{path:i,opacity:1}})},n._adjustDisplay=function(t){var e=this.get("color");t.fill&&(t.fill=t.fillStyle=e),t.stroke=t.strokeStyle=e},n._geomFilter=function(t){var e=this.get("apply");return!e||i.contains(e,t)},n.clear=function(){t.prototype.clear.call(this);var e=this.get("clip");e&&e.remove()},e}(r);t.exports=o},function(t,e,n){var i=n(0),r=n(21).Legend,a=n(352),o=n(18),s=n(166),l=n(168),u=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,c=function(){function t(t){this.options={},i.mix(this,t),this.clear();var e=this.chart;this.container=e.get("frontPlot"),this.plotRange=e.get("plotRange")}var e=t.prototype;return e.clear=function(){var t=this.legends;this.backRange=null,i.each(t,function(t){i.each(t,function(t){t.destroy()})}),this.legends={}},e.getBackRange=function(){var t=this.backRange;if(!t){var e=this.chart.get("backPlot");t=s(e,l(this.chart.get("plotRange")));var n=this.plotRange;t.maxX-t.minX0){var a=e.getXScale(),o=e.getYScale(),s=a.field,l=o.field,u=t.get("origin")._origin,c=e.get("labelContainer").get("labelsGroup").get("children");i.each(c,function(e){var i=e.get("origin")||[];i[s]===u[s]&&i[l]===u[l]&&(e.set("visible",n),t.set("gLabel",e))})}}},e._bindFilterEvent=function(t,e){var n=this,r=this.chart,a=e.field;t.on("itemfilter",function(t){var e=t.range;r.filterShape(function(t,r,o){if(!i.isNil(t[a])){var s=t[a]>=e[0]&&t[a]<=e[1];return n._filterLabels(r,o,s),s}return!0});for(var o=r.getAllGeoms()||[],s=function(t){var n=o[t];"heatmap"===n.get("type")&&u(function(){n.drawWithRange(e)})},l=0;l1?l:n;if("left"===x[0]||"right"===x[0])s=u.br.y,m=this._getXAlign(x[0],o,n,c,g,d),_=e?e.get("group").get("y")+e.getHeight()+v:this._getYAlignVertical(x[1],s,b,c,0,d,a.get("height"));else if("top"===x[0]||"bottom"===x[0])if(_=this._getYAlignHorizontal(x[0],s,n,c,p,d),e){var w=e.getWidth();m=e.get("group").get("x")+w+v}else m=this._getXAlign(x[1],o,b,c,0,d),"right"===x[1]&&(m=u.br.x-b.totalWidth);t.move(m+h,_+f)},e._getXAlign=function(t,e,n,i,r,a){var o="left"===t?i.minX-r-a[3]:i.maxX+a[1];return"center"===t&&(o=(e-n.totalWidth)/2),o},e._getYAlignHorizontal=function(t,e,n,i,r,a){return"top"===t?i.minY-r-a[0]:i.maxY+a[2]},e._getYAlignVertical=function(t,e,n,i,r,a,o){var s="top"===t?i.minY-r-a[0]:e-n.totalHeight;return"center"===t&&(s=(o-n.totalHeight)/2),s},e._getSubRegion=function(t){var e=0,n=0,r=0,a=0;return i.each(t,function(t){var i=t.getWidth(),o=t.getHeight();e1){var g=Array(f.callback.length-1).fill("");c.color=f.mapping.apply(f,[l].concat(g)).join("")||b.defaultColor}else c.color=f.mapping(l).join("")||b.defaultColor;if(y&&p)if(p.callback&&p.callback.length>1){var v=Array(p.callback.length-1).fill("");m=p.mapping.apply(p,[l].concat(v)).join("")}else m=p.mapping(l).join("");var _=o.getShapeFactory(x).getMarkerCfg(m,c);i.isFunction(m)&&(_.symbol=m),d.push({value:r,dataValue:l,checked:h,marker:_})});var A=i.deepMix({},b.legend[M[0]],h[c]||h,{viewId:_.get("_id"),maxLength:C,items:d,container:g,position:[0,0]});A.title&&i.deepMix(A,{title:{text:t.alias||t.field}});var k;if(u._isTailLegend(h,n))A.chart=u.chart,A.geom=n,k=new a(A);else if(h.useHtml){var P=g.get("canvas").get("el");if(g=h.container,i.isString(g)&&/^\#/.test(g)){var T=g.replace("#","");g=document.getElementById(T)}g||(g=P.parentNode),A.container=g,void 0===A.legendStyle&&(A.legendStyle={}),A.legendStyle.CONTAINER_CLASS={position:"absolute",overflow:"auto","z-index":""===P.style.zIndex?1:parseInt(P.style.zIndex,10)+1},h.flipPage?(A.legendStyle.CONTAINER_CLASS.height="right"===M[0]||"left"===M[0]?C+"px":"auto",A.legendStyle.CONTAINER_CLASS.width="right"!==M[0]&&"left"!==M[0]?C+"px":"auto",k=new r.CatPageHtml(A)):k=new r.CatHtml(A)}else k=new r.Category(A);return u._bindClickEvent(k,t,s),p[l].push(k),k},e._bindChartMove=function(t){var e=this.chart,n=this.legends;e.on("plotmove",function(e){var r=!1;if(e.target){var a=e.target.get("origin");if(a){var o=a._origin||a[0]._origin,s=t.field;if(o){var l=o[s];i.each(n,function(t){i.each(t,function(t){r=!0,!t.destroyed&&t.activate(l)})})}}}r||i.each(n,function(t){i.each(t,function(t){!t.destroyed&&t.deactivate()})})})},e._addContinuousLegend=function(t,e,n){var a=this.legends;a[n]=a[n]||[];var o,s,l,u=this.container,c=t.field,h=t.getTicks(),f=[],p=this.viewTheme;i.each(h,function(n){var i=n.value,r=t.invert(i),a=e.mapping(r).join("");f.push({value:n.tickValue,attrValue:a,color:a,scaleValue:i}),0===i&&(s=!0),1===i&&(l=!0)}),s||f.push({value:t.min,attrValue:e.mapping(0).join(""),color:e.mapping(0).join(""),scaleValue:0}),l||f.push({value:t.max,attrValue:e.mapping(1).join(""),color:e.mapping(1).join(""),scaleValue:1});var g=this.options,d=n.split("-"),v=p.legend[d[0]];(g&&!1===g.slidable||g[c]&&!1===g[c].slidable)&&(v=i.mix({},v,p.legend.gradient));var y=i.deepMix({},v,g[c]||g,{items:f,attr:e,formatter:t.formatter,container:u,position:[0,0]});if(y.title&&i.deepMix(y,{title:{text:t.alias||t.field}}),"color"===e.type)o=new r.Color(y);else{if("size"!==e.type)return;o=g&&"circle"===g.sizeType?new r.CircleSize(y):new r.Size(y)}return this._bindFilterEvent(o,t),a[n].push(o),o},e._isTailLegend=function(t,e){if(t.hasOwnProperty("attachLast")&&t.attachLast){var n=e.get("type");if("line"===n||"lineStack"===n||"area"===n||"areaStack"===n)return!0}return!1},e._adjustPosition=function(t,e){var n;if(e)n="right-top";else if(i.isArray(t))n=String(t[0])+"-"+String(t[1]);else{var r=t.split("-");1===r.length?("left"===r[0]&&(n="left-bottom"),"right"===r[0]&&(n="right-bottom"),"top"===r[0]&&(n="top-center"),"bottom"===r[0]&&(n="bottom-center")):n=t}return n},e.addLegend=function(t,e,n,i){var r=this.options,a=t.field,o=r[a],s=this.viewTheme;if(!1===o)return null;if(o&&o.custom)this.addCustomLegend(a);else{var l=r.position||s.defaultLegendPosition;l=this._adjustPosition(l,this._isTailLegend(r,n)),o&&o.position&&(l=this._adjustPosition(o.position,this._isTailLegend(o,n)));var u;(u=t.isLinear?this._addContinuousLegend(t,e,l):this._addCategoryLegend(t,e,n,i,l))&&(this._bindHoverEvent(u,a),r.reactive&&this._bindChartMove(t))}},e.addCustomLegend=function(t){var e=this.chart,n=this.viewTheme,a=this.container,o=this.options;t&&(o=o[t]);var s=o.position||n.defaultLegendPosition;s=this._adjustPosition(s);var l=this.legends;l[s]=l[s]||[];var u=o.items;if(u){var c=e.getAllGeoms();i.each(u,function(t){var e=function(t,e){var n;return i.each(t,function(t){t.get("visible")&&t.getYScale().field===e&&(n=t)}),n}(c,t.value);i.isObject(t.marker)?t.marker.radius=t.marker.radius||4.5:t.marker={symbol:t.marker?t.marker:"circle",fill:t.fill,radius:4.5},t.checked=!!i.isNil(t.checked)||t.checked,t.geom=e});var h,f=e.get("canvas"),p=this.plotRange,g=s.split("-"),d="right"===g[0]||"left"===g[0]?p.bl.y-p.tr.y:f.get("width"),v=i.deepMix({},n.legend[g[0]],o,{maxLength:d,items:u,container:a,position:[0,0]});if(o.useHtml){var y=o.container;if(/^\#/.test(a)){var x=y.replace("#","");y=document.getElementById(x)}else y||(y=a.get("canvas").get("el").parentNode);v.container=y,void 0===v.legendStyle&&(v.legendStyle={}),v.legendStyle.CONTAINER_CLASS||(v.legendStyle.CONTAINER_CLASS={height:"right"===g[0]||"left"===g[0]?d+"px":"auto",width:"right"!==g[0]&&"left"!==g[0]?d+"px":"auto",position:"absolute",overflow:"auto"}),h=o.flipPage?new r.CatPageHtml(v):new r.CatHtml(v)}else h=new r.Category(v);return l[s].push(h),h.on("itemclick",function(t){o.onClick&&o.onClick(t)}),this._bindHoverEvent(h),h}},e.addMixedLegend=function(t,e){var n=[];i.each(t,function(t){var r=t.field;i.each(e,function(e){if(e.getYScale()===t&&t.values&&t.values.length>0){var i=e.get("shapeType")||"point",a=e.getDefaultValue("shape")||"circle",s=o.getShapeFactory(i),l={color:e.getDefaultValue("color")},u=s.getMarkerCfg(a,l),c={value:r,marker:u};n.push(c)}})});var r={custom:!0,items:n};this.options=i.deepMix({},r,this.options);var a=this.addCustomLegend();this._bindClickEventForMix(a)},e.alignLegends=function(){var t=this,e=t.legends,n=t._getRegion(e);t.totalRegion=n;var r=0;return i.each(e,function(e,a){var o=n.subs[r];i.each(e,function(n,i){var r=e[i-1];n.get("useHtml")&&!n.get("autoPosition")||t._alignLegend(n,r,o,a)}),r++}),this},t}();t.exports=c},function(t,e,n){var i=n(0),r=n(21),a=n(7),o=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return i.mix({},e,{type:"tail-legend",layout:"vertical",autoLayout:!0})},n._addItem=function(t){var e=this.get("itemsGroup"),n=this._getNextX(),r=this.get("unCheckColor"),a=e.addGroup({x:0,y:0,value:t.value,scaleValue:t.scaleValue,checked:t.checked});a.translate(n,0),a.set("viewId",e.get("viewId"));var o=this.get("textStyle"),s=this.get("_wordSpaceing"),l=0;if(t.marker){var u=i.mix({},t.marker,{x:t.marker.radius,y:0});t.checked||(u.fill&&(u.fill=r),u.stroke&&(u.stroke=r));var c=a.addShape("marker",{type:"marker",attrs:u});c.attr("cursor","pointer"),c.name="legend-marker",l+=c.getBBox().width+s}var h=i.mix({},o,{x:l,y:0,text:this._formatItemValue(t.value)});t.checked||i.mix(h,{fill:r});var f=a.addShape("text",{attrs:h});f.attr("cursor","pointer"),f.name="legend-text",this.get("appendInfo")&&f.setSilent("appendInfo",this.get("appendInfo"));var p=a.getBBox(),g=this.get("itemWidth"),d=a.addShape("rect",{attrs:{x:n,y:0-p.height/2,fill:"#fff",fillOpacity:0,width:g||p.width,height:p.height}});return d.attr("cursor","pointer"),d.setSilent("origin",t),d.name="legend-item",this.get("appendInfo")&&d.setSilent("appendInfo",this.get("appendInfo")),a.name="legendGroup",a},n._adjust=function(){if(this.get("geom")){this.get("group").attr("matrix")[7]=0;var t=this.get("geom").get("dataArray"),e=this.get("itemsGroup").get("children"),n=0;i.each(e,function(e){var r=t[n],a=r[r.length-1].y;i.isArray(a)&&(a=a[1]);var o=e.getBBox().height,s=e.get("x"),l=a-o/2;e.translate(s,l),n++}),this.get("autoLayout")&&this._antiCollision(e)}},n.render=function(){var e=this;t.prototype.render.call(this);this.get("chart").once("afterpaint",function(){e._adjust()})},n._getPreviousY=function(t){return t.attr("matrix")[7]+t.getBBox().height},n._adjustDenote=function(t,e,n){var i=2*-a.legend.legendMargin;t.addShape("path",{attrs:{path:"M-2,"+e+"L"+i+","+(n+3),lineWidth:1,lineDash:[2,2],stroke:"#999999"}})},n._antiCollision=function(t){var e=this;t.sort(function(t,e){return t.attr("matrix")[7]-e.attr("matrix")[7]});var n=!0,i=e.get("chart").get("plotRange"),r=i.tl.y,a=Math.abs(r-i.bl.y),o=t[0].getBBox().height,s=Number.MIN_VALUE,l=0,u=t.map(function(t){var e=t.attr("matrix")[7];return e>l&&(l=e),e0){var g=u[c-1],d=u[c];g.pos+g.size>d.pos&&(g.size+=d.size,g.targets=g.targets.concat(d.targets),u.splice(c,1),n=!0)}}c=0;var v=this.get("itemsGroup").addGroup();u.forEach(function(n){var i=r+o;n.targets.forEach(function(){var r=t[c].attr("matrix")[7],a=n.pos+i-o/2;Math.abs(r-a)>o/2&&e._adjustDenote(v,a,r-e.get("group").attr("matrix")[7]/2),t[c].translate(0,-r),t[c].translate(0,a),i+=o,c++})})},e}(r.Legend.Category);t.exports=o},function(t,e,n){function i(t,e){if(!t)return!1;return!!t.className&&-1!==(a.isNil(t.className.baseVal)?t.className:t.className.baseVal).indexOf(e)}function r(t){var e=[];return a.each(t,function(t){var n=function(t,e){var n=-1;return a.each(t,function(t,i){var r=!0;for(var o in e)if(e.hasOwnProperty(o)&&-1===h.indexOf(o)&&!a.isObject(e[o])&&e[o]!==t[o]){r=!1;break}if(r)return n=i,!1}),n}(e,t);-1===n?e.push(t):e[n]=t}),e}var a=n(0),o=n(18),s=n(21).Tooltip,l=a.MatrixUtil.vec2,u=["line","area","path","areaStack"],c=["line","area"],h=["marker","showMarker"],f=function(){function t(t){a.assign(this,t),this.timeStamp=0}var e=t.prototype;return e._normalizeEvent=function(t){var e=this.chart,n=this._getCanvas(),i=n.getPointByClient(t.clientX,t.clientY),r=n.get("pixelRatio");i.x=i.x/r,i.y=i.y/r;var a=e.getViewsByPoint(i);return i.views=a,i},e._getCanvas=function(){return this.chart.get("canvas")},e._getTriggerEvent=function(){var t,e=this.options.triggerOn;return e&&"mousemove"!==e?"click"===e?t="plotclick":"none"===e&&(t=null):t="plotmove",t},e._getDefaultTooltipCfg=function(){var t=this.chart,e=this.viewTheme,n=this.options,i=a.mix({},e.tooltip),r=t.getAllGeoms().filter(function(t){return t.get("visible")}),o=[];a.each(r,function(t){var e=t.get("type"),n=t.get("adjusts"),i=!1;n&&a.each(n,function(t){if("symmetric"===t.type||"Symmetric"===t.type)return i=!0,!1}),-1!==a.indexOf(o,e)||i||o.push(e)});var s,l=!(!r.length||!r[0].get("coord"))&&r[0].get("coord").isTransposed;if(r.length&&r[0].get("coord")&&"cartesian"===r[0].get("coord").type)if("interval"===o[0]&&!1!==n.shared){var u=a.mix({},e.tooltipCrosshairsRect);u.isTransposed=l,s={zIndex:0,crosshairs:u}}else if(a.indexOf(c,o[0])>-1){var h=a.mix({},e.tooltipCrosshairsLine);h.isTransposed=l,s={crosshairs:h}}return a.mix(i,s,{})},e._bindEvent=function(){var t=this.chart,e=this._getTriggerEvent();e&&(t.on(e,a.wrapBehavior(this,"onMouseMove")),t.on("plotleave",a.wrapBehavior(this,"onMouseOut")))},e._offEvent=function(){var t=this.chart,e=this._getTriggerEvent();e&&(t.off(e,a.getWrapBehavior(this,"onMouseMove")),t.off("plotleave",a.getWrapBehavior(this,"onMouseOut")))},e._setTooltip=function(t,e,n,i){var o=this.tooltip,s=this.prePoint;if(!s||s.x!==t.x||s.y!==t.y){e=r(e),this.prePoint=t;var l=this.chart,u=this.viewTheme,c=a.isArray(t.x)?t.x[t.x.length-1]:t.x,h=a.isArray(t.y)?t.y[t.y.length-1]:t.y;o.get("visible")||l.emit("tooltip:show",{x:c,y:h,tooltip:o});var f=e[0],p=f.title||f.name;o.isContentChange(p,e)&&(l.emit("tooltip:change",{tooltip:o,x:c,y:h,items:e}),p=e[0].title||e[0].name,o.setContent(p,e),a.isEmpty(n)?(o.clearMarkers(),o.set("markerItems",[])):!0===this.options.hideMarkers?o.set("markerItems",n):o.setMarkers(n,u.tooltipMarker));i===this._getCanvas()&&"mini"===o.get("type")?o.hide():(o.setPosition(c,h,i),o.show())}},e.hideTooltip=function(){var t=this.tooltip,e=this.chart,n=this._getCanvas();this.prePoint=null,t.hide(),e.emit("tooltip:hide",{tooltip:t}),n.draw()},e.onMouseMove=function(t){if(!a.isEmpty(t.views)){var e=this.timeStamp,n=+new Date,i={x:t.x,y:t.y};n-e>16&&!this.chart.get("stopTooltip")&&(this.showTooltip(i,t.views,t.shape),this.timeStamp=n)}},e.onMouseOut=function(t){var e=this.tooltip;e.get("visible")&&e.get("follow")&&(t&&t.toElement&&(i(t.toElement,"g2-tooltip")||function(t,e){for(var n=t.parentNode,r=!1;n&&n!==document.body;){if(i(n,e)){r=!0;break}n=n.parentNode}return r}(t.toElement,"g2-tooltip"))||this.hideTooltip())},e.renderTooltip=function(){var t=this;if(!t.tooltip){var e=t.chart,n=t.viewTheme,i=t._getCanvas(),r=t._getDefaultTooltipCfg(),o=t.options;(o=a.deepMix({plotRange:e.get("plotRange"),capture:!1,canvas:i,frontPlot:e.get("frontPlot"),viewTheme:n.tooltip,backPlot:e.get("backPlot")},r,o)).crosshairs&&"rect"===o.crosshairs.type&&(o.zIndex=0),o.visible=!1;var l;"mini"===o.type?(o.crosshairs=!1,o.position="top",l=new s.Mini(o)):l=o.useHtml?new s.Html(o):new s.Canvas(o),t.tooltip=l;var u=t._getTriggerEvent();if(!l.get("enterable")&&"plotmove"===u){var c=l.get("container");c&&(c.onmousemove=function(n){var i=t._normalizeEvent(n);e.emit(u,i)})}t._bindEvent()}},e.showTooltip=function(t,e,n){var i=this;if(!a.isEmpty(e)&&t){this.tooltip||this.renderTooltip();var r=i.options,o=[],s=[];if(a.each(e,function(e){if(!e.get("tooltipEnable"))return!0;var n=e.get("geoms"),l=e.get("coord");a.each(n,function(e){var n=e.get("type");if(e.get("visible")&&!1!==e.get("tooltipCfg")){var c=e.get("dataArray");if(e.isShareTooltip()||!1===r.shared&&a.inArray(["area","line","path","polygon"],n))a.each(c,function(c){var h=e.findPoint(t,c);if(h){var f=e.getTipItems(h,r.title);a.each(f,function(t){var r=t.point;if(r&&r.x&&r.y){var s=a.isArray(r.x)?r.x[r.x.length-1]:r.x,c=a.isArray(r.y)?r.y[r.y.length-1]:r.y;r=l.applyMatrix(s,c,1),t.x=r[0],t.y=r[1],t.showMarker=!0;var h=i._getItemMarker(e,t.color);t.marker=h,-1!==a.indexOf(u,n)&&o.push(t)}}),s=s.concat(f)}});else{var h=e.get("shapeContainer"),f=h.get("canvas").get("pixelRatio"),p=h.getShape(t.x*f,t.y*f);p&&p.get("visible")&&p.get("origin")&&(s=e.getTipItems(p.get("origin"),r.title))}}}),a.each(s,function(t){var e=t.point,n=a.isArray(e.x)?e.x[e.x.length-1]:e.x,i=a.isArray(e.y)?e.y[e.y.length-1]:e.y;e=l.applyMatrix(n,i,1),t.x=e[0],t.y=e[1]})}),s.length){var c=s[0];if(!s.every(function(t){return t.title===c.title})){var h=c,f=1/0;s.forEach(function(e){var n=l.distance([t.x,t.y],[e.x,e.y]);n1){var p=s[0],g=Math.abs(t.y-p.y);a.each(s,function(e){Math.abs(t.y-e.y)<=g&&(p=e,g=Math.abs(t.y-e.y))}),p&&p.x&&p.y&&(o=[p]),s=[p]}i._setTooltip(t,s,o,n)}else i.hideTooltip()}},e.clear=function(){var t=this.tooltip;t&&t.destroy(),this.tooltip=null,this.prePoint=null,this._offEvent()},e._getItemMarker=function(t,e){var n=t.get("shapeType")||"point",i=t.getDefaultValue("shape")||"circle",r={color:e};return o.getShapeFactory(n).getMarkerCfg(i,r)},t}();t.exports=f},function(t,e,n){function i(t,e){if(a.isNil(t)||a.isNil(e))return!1;var n=t.get("origin"),i=e.get("origin");return a.isNil(n)&&a.isNil(i)?a.isEqual(t,e):a.isEqual(n,i)}function r(t){t.shape&&t.shape.get("origin")&&(t.data=t.shape.get("origin"))}var a=n(0),o=function(){function t(t){this.view=null,this.canvas=null,a.assign(this,t),this._init()}var e=t.prototype;return e._init=function(){this.pixelRatio=this.canvas.get("pixelRatio")},e._getShapeEventObj=function(t){return{x:t.x/this.pixelRatio,y:t.y/this.pixelRatio,target:t.target,toElement:t.event.toElement||t.event.relatedTarget}},e._getShape=function(t,e){return this.view.get("canvas").getShape(t,e)},e._getPointInfo=function(t){var e=this.view,n={x:t.x/this.pixelRatio,y:t.y/this.pixelRatio},i=e.getViewsByPoint(n);return n.views=i,n},e._getEventObj=function(t,e,n){return{x:e.x,y:e.y,target:t.target,toElement:t.event.toElement||t.event.relatedTarget,views:n}},e.bindEvents=function(){var t=this.canvas;t.on("mousedown",a.wrapBehavior(this,"onDown")),t.on("mousemove",a.wrapBehavior(this,"onMove")),t.on("mouseleave",a.wrapBehavior(this,"onOut")),t.on("mouseup",a.wrapBehavior(this,"onUp")),t.on("click",a.wrapBehavior(this,"onClick")),t.on("dblclick",a.wrapBehavior(this,"onClick")),t.on("touchstart",a.wrapBehavior(this,"onTouchstart")),t.on("touchmove",a.wrapBehavior(this,"onTouchmove")),t.on("touchend",a.wrapBehavior(this,"onTouchend"))},e._triggerShapeEvent=function(t,e,n){if(t&&t.name&&!t.get("destroyed")){var i=this.view;if(i.isShapeInView(t)){var r=t.name+":"+e;n.view=i,n.appendInfo=t.get("appendInfo"),i.emit(r,n);var a=i.get("parent");a&&a.emit(r,n)}}},e.onDown=function(t){var e=this.view,n=this._getShapeEventObj(t);n.shape=this.currentShape,r(n),e.emit("mousedown",n),this._triggerShapeEvent(this.currentShape,"mousedown",n)},e.onMove=function(t){var e=this.view,n=this.currentShape;n&&n.get("destroyed")&&(n=null,this.currentShape=null);var a=this._getShape(t.x,t.y)||t.currentTarget,o=this._getShapeEventObj(t);if(o.shape=a,r(o),e.emit("mousemove",o),this._triggerShapeEvent(a,"mousemove",o),n&&!i(n,a)){var s=this._getShapeEventObj(t);s.shape=n,s.toShape=a,r(s),this._triggerShapeEvent(n,"mouseleave",s)}if(a&&!i(n,a)){var l=this._getShapeEventObj(t);l.shape=a,l.fromShape=n,r(l),this._triggerShapeEvent(a,"mouseenter",l)}this.currentShape=a;var u=this._getPointInfo(t),c=this.curViews||[];0===c.length&&u.views.length&&e.emit("plotenter",this._getEventObj(t,u,u.views)),c.length&&0===u.views.length&&e.emit("plotleave",this._getEventObj(t,u,c)),u.views.length&&((o=this._getEventObj(t,u,u.views)).shape=a,r(o),e.emit("plotmove",o)),this.curViews=u.views},e.onOut=function(t){var e=this.view,n=this._getPointInfo(t),i=this.curViews||[],r=this._getEventObj(t,n,i);!this.curViews||0===this.curViews.length||r.toElement&&"CANVAS"===r.toElement.tagName||(e.emit("plotleave",r),this.curViews=[])},e.onUp=function(t){var e=this.view,n=this._getShapeEventObj(t);n.shape=this.currentShape,e.emit("mouseup",n),this._triggerShapeEvent(this.currentShape,"mouseup",n)},e.onClick=function(t){var e=this.view,n=this._getShape(t.x,t.y)||t.currentTarget,i=this._getShapeEventObj(t);i.shape=n,r(i),e.emit("click",i),this._triggerShapeEvent(n,t.type,i),this.currentShape=n;var o=this._getPointInfo(t),s=o.views;if(!a.isEmpty(s)){var l=this._getEventObj(t,o,s);if(this.currentShape){var u=this.currentShape;l.shape=u,r(l)}e.emit("plotclick",l),"dblclick"===t.type&&(e.emit("plotdblclick",l),e.emit("dblclick",i))}},e.onTouchstart=function(t){var e=this.view,n=this._getShape(t.x,t.y)||t.currentTarget,i=this._getShapeEventObj(t);i.shape=n,r(i),e.emit("touchstart",i),this._triggerShapeEvent(n,"touchstart",i),this.currentShape=n},e.onTouchmove=function(t){var e=this.view,n=this._getShape(t.x,t.y)||t.currentTarget,i=this._getShapeEventObj(t);i.shape=n,r(i),e.emit("touchmove",i),this._triggerShapeEvent(n,"touchmove",i),this.currentShape=n},e.onTouchend=function(t){var e=this.view,n=this._getShapeEventObj(t);n.shape=this.currentShape,r(n),e.emit("touchend",n),this._triggerShapeEvent(this.currentShape,"touchend",n)},e.clearEvents=function(){var t=this.canvas;t.off("mousemove",a.getWrapBehavior(this,"onMove")),t.off("mouseleave",a.getWrapBehavior(this,"onOut")),t.off("mousedown",a.getWrapBehavior(this,"onDown")),t.off("mouseup",a.getWrapBehavior(this,"onUp")),t.off("click",a.getWrapBehavior(this,"onClick")),t.off("dblclick",a.getWrapBehavior(this,"onClick")),t.off("touchstart",a.getWrapBehavior(this,"onTouchstart")),t.off("touchmove",a.getWrapBehavior(this,"onTouchmove")),t.off("touchend",a.getWrapBehavior(this,"onTouchend"))},t}();t.exports=o},function(t,e,n){function i(t,e){var n=[];if(!1===t.get("animate"))return[];var r=t.get("children");return s.each(r,function(t){if(t.isGroup)n=n.concat(i(t,e));else if(t.isShape&&t._id){var r=t._id;(r=r.split("-")[0])===e&&n.push(t)}}),n}function r(t,e,n,i){return i?l.Action[n][i]:l.getAnimation(t,e,n)}function a(t,e,n){var i=l.getAnimateCfg(t,e);return n&&n[e]?s.deepMix({},i,n[e]):i}function o(t,e,n,i){var o,l,c=!1;if(i){var h=[],f=[];s.each(e,function(e){var n=t[e._id];n?(e.setSilent("cacheShape",n),h.push(e),delete t[e._id]):f.push(e)}),s.each(t,function(t){var e=t.name,i=t.coord,h=t._id,f=t.attrs,p=t.index,g=t.type;if(l=a(e,"leave",t.animateCfg),o=r(e,i,"leave",l.animation),s.isFunction(o)){var d=n.addShape(g,{attrs:f,index:p});if(d._id=h,d.name=e,i&&"label"!==e){var v=d.getMatrix(),y=u.multiply([],v,i.matrix);d.setMatrix(y)}c=!0,o(d,l,i)}}),s.each(h,function(t){var e=t.name,n=t.get("coord"),i=t.get("cacheShape").attrs;if(!s.isEqual(i,t.attr())){if(l=a(e,"update",t.get("animateCfg")),o=r(e,n,"update",l.animation),s.isFunction(o))o(t,l,n);else{var u=s.cloneDeep(t.attr());t.attr(i),t.animate(u,l.duration,l.easing,function(){t.setSilent("cacheShape",null)})}c=!0}}),s.each(f,function(t){var e=t.name,n=t.get("coord");l=a(e,"enter",t.get("animateCfg")),o=r(e,n,"enter",l.animation),s.isFunction(o)&&(o(t,l,n),c=!0)})}else s.each(e,function(t){var e=t.name,n=t.get("coord");l=a(e,"appear",t.get("animateCfg")),o=r(e,n,"appear",l.animation),s.isFunction(o)&&(o(t,l,n),c=!0)});return c}var s=n(0),l=n(126),u=s.MatrixUtil.mat3;t.exports={execAnimation:function(t,e){var n=t.get("middlePlot"),r=t.get("backPlot"),a=t.get("_id"),l=t.get("canvas"),u=l.get(a+"caches")||[];0===u.length&&(e=!1);var c=i(n,a),h=i(r,a),f=c.concat(h);l.setSilent(a+"caches",function(t){var e={};return s.each(t,function(t){if(t._id&&!t.isClip){var n=t._id;e[n]={_id:n,type:t.get("type"),attrs:s.cloneDeep(t.attr()),name:t.name,index:t.get("index"),animateCfg:t.get("animateCfg"),coord:t.get("coord")}}}),e}(f));(e?o(u,f,l,e):o(u,c,l,e))||l.draw()}}},function(t,e,n){var i=n(0),r=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){return{type:"plotBack",padding:null,background:null,plotRange:null,plotBackground:null}},n._beforeRenderUI=function(){this._calculateRange()},n._renderUI=function(){this._renderBackground(),this._renderPlotBackground()},n._renderBackground=function(){var t=this.get("background");if(t){var e=this.get("canvas"),n={x:0,y:0,width:this.get("width")||e.get("width"),height:this.get("height")||e.get("height")},r=this.get("backgroundShape");r?r.attr(n):(r=this.addShape("rect",{attrs:i.mix(n,t)}),this.set("backgroundShape",r))}},n._renderPlotBackground=function(){var t=this.get("plotBackground");if(t){var e=this.get("plotRange"),n=e.br.x-e.bl.x,r=e.br.y-e.tr.y,a=e.tl,o={x:a.x,y:a.y,width:n,height:r},s=this.get("plotBackShape");s?s.attr(o):(t.image?(o.img=t.image,s=this.addShape("image",{attrs:o})):(i.mix(o,t),s=this.addShape("rect",{attrs:o})),this.set("plotBackShape",s))}},n._convert=function(t,e){if(i.isString(t))if("auto"===t)t=0;else if(-1!==t.indexOf("%")){var n=this.get("canvas"),r=this.get("width")||n.get("width"),a=this.get("height")||n.get("height");t=parseInt(t,10)/100,t=e?t*r:t*a}return t},n._calculateRange=function(){var t=this.get("plotRange");i.isNil(t)&&(t={});var e=this.get("padding"),n=this.get("canvas"),r=this.get("width")||n.get("width"),a=this.get("height")||n.get("height"),o=i.toAllPadding(e),s=this._convert(o[0],!1),l=this._convert(o[1],!0),u=this._convert(o[2],!1),c=this._convert(o[3],!0),h=Math.min(c,r-l),f=Math.max(c,r-l),p=Math.min(a-u,s),g=Math.max(a-u,s);t.tl={x:h,y:p},t.tr={x:f,y:p},t.bl={x:h,y:g},t.br={x:f,y:g},t.cc={x:(f+h)/2,y:(g+p)/2},this.set("plotRange",t)},n.repaint=function(){return this._calculateRange(),this._renderBackground(),this._renderPlotBackground(),this},e}(n(16).Group);t.exports=r},function(t,e,n){var i=n(7),r=n(0),a={getDefaultSize:function(){var t=this.get("defaultSize"),e=this.get("viewTheme")||i;if(!t){var n,a=this.get("coord"),o=this.getXScale(),s=o.values,l=this.get("dataArray");if(o.isLinear&&s.length>1){s.sort();var u=function(t,e){var n=t.length;r.isString(t[0])&&(t=t.map(function(t){return e.translate(t)}));for(var i=t[1]-t[0],a=2;ao&&(i=o)}return i}(s,o);n=(o.max-o.min)/u,s.length>n&&(n=s.length)}else n=s.length;var c=o.range,h=1/n,f=1;if(this.isInCircle()?f=a.isTransposed&&n>1?e.widthRatio.multiplePie:e.widthRatio.rose:(o.isLinear&&(h*=c[1]-c[0]),f=e.widthRatio.column),h*=f,this.hasAdjust("dodge")){h/=this._getDodgeCount(l)}t=h,this.set("defaultSize",t)}return t},_getDodgeCount:function(t){var e,n=this.get("adjusts"),i=t.length;if(r.each(n,function(t){"dodge"===t.type&&(e=t.dodgeBy)}),e){var a=r.Array.merge(t);i=r.Array.values(a,e).length}return i},getDimWidth:function(t){var e=this.get("coord"),n=e.convertPoint({x:0,y:0}),i=e.convertPoint({x:"x"===t?1:0,y:"x"===t?0:1}),r=0;return n&&i&&(r=Math.sqrt(Math.pow(i.x-n.x,2)+Math.pow(i.y-n.y,2))),r},_getWidth:function(){var t=this.get("coord");return this.isInCircle()&&!t.isTransposed?(t.endAngle-t.startAngle)*t.radius:this.getDimWidth("x")},_toNormalizedSize:function(t){return t/this._getWidth()},_toCoordSize:function(t){return this._getWidth()*t},getNormalizedSize:function(t){var e=this.getAttrValue("size",t);return e=r.isNil(e)?this.getDefaultSize():this._toNormalizedSize(e)},getSize:function(t){var e=this.getAttrValue("size",t);if(r.isNil(e)){var n=this.getDefaultSize();e=this._toCoordSize(n)}return e}};t.exports=a},function(t,e,n){var i=n(0),r=n(7);t.exports={splitData:function(t){var e=this.get("viewTheme")||r;if(!t.length)return[];var n,a=[],o=[],s=this.getYScale().field;return i.each(t,function(t){n=t._origin?t._origin[s]:t[s],e.connectNulls?i.isNil(n)||o.push(t):i.isArray(n)&&i.isNil(n[0])||i.isNil(n)?o.length&&(a.push(o),o=[]):o.push(t)}),o.length&&a.push(o),a}}},function(t,e,n){function i(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var r=n(20),a=n(358),o=n(0),s=function(t){function e(e){var n;return n=t.call(this,e)||this,o.assign(i(i(n)),a),n}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return e.type="path",e.shapeType="line",e},n.getDrawCfg=function(e){var n=t.prototype.getDrawCfg.call(this,e);return n.isStack=this.hasStack(),n},n.draw=function(t,e,n,i){var r=this,a=this.splitData(t),s=this.getDrawCfg(t[0]);r._applyViewThemeShapeStyle(s,s.shape,n),s.origin=t,o.each(a,function(t,a){if(!o.isEmpty(t)){s.splitedIndex=a,s.points=t;var l=n.drawShape(s.shape,s,e);r.appendShapeInfo(l,i+a)}})},e}(r);r.Path=s,t.exports=s},function(t,e,n){"use strict";var i=n(370),r=n(371);e.a=function(t){var e=Object(i.a)(t);return(e.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===r.b&&e.documentElement.namespaceURI===r.b?e.createElement(t):e.createElementNS(n,t)}})(e)}},function(t,e,n){"use strict";e.a=function(t,e){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var i=n.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}},function(t,e,n){"use strict";e.b=function(t,e,n){var r=t._id;return t.each(function(){var t=Object(i.h)(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return Object(i.f)(t,r).value[e]}};var i=n(70);e.a=function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,a=Object(i.f)(this.node(),n).tween,o=0,s=a.length;o0;)i-=2*Math.PI;var c=a-t+(i=i/Math.PI/2*n)-2*t;l.push(["M",c,e]);for(var h=0,f=0;f=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),i.a.hasOwnProperty(e)?{space:i.a[e],local:t}:t}},function(t,e,n){"use strict";n.d(e,"b",function(){return i});var i="http://www.w3.org/1999/xhtml";e.a={svg:"http://www.w3.org/2000/svg",xhtml:i,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"}},function(t,e,n){"use strict";e.a=function(t){return null==t?function(){}:function(){return this.querySelector(t)}}},function(t,e,n){"use strict";e.a=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}},function(t,e,n){"use strict";function i(t,e,n){return function(i){var r=o;o=i;try{t.call(this,this.__data__,e,n)}finally{o=r}}}function r(t,e,n){var r=a.hasOwnProperty(t.type)?function(t,e,n){return t=i(t,e,n),function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t.call(this,e)}}:i;return function(i,a,o){var s,l=this.__on,u=r(e,a,o);if(l)for(var c=0,h=l.length;c=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}})}(t+""),s=o.length;{if(!(arguments.length<2)){for(l=e?r:function(t){return function(){var e=this.__on;if(e){for(var n,i=0,r=-1,a=e.length;in.max&&(n.max=e.max)):"timeCat"===o?(i.each(s,function(t,e){s[e]=r.toTimeStamp(t)}),s.sort(function(t,e){return t-e}),n=s):n=s,n}},function(t,e,n){"use strict";var i=n(69);e.a=function(t){return"string"==typeof t?new i.a([[document.querySelector(t)]],[document.documentElement]):new i.a([[t]],i.c)}},function(t,e,n){"use strict";e.a=function(t){return null==t?function(){return[]}:function(){return this.querySelectorAll(t)}}},function(t,e,n){"use strict";var i=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var r=document.documentElement;if(!r.matches){var a=r.webkitMatchesSelector||r.msMatchesSelector||r.mozMatchesSelector||r.oMatchesSelector;i=function(t){return function(){return a.call(this,t)}}}}e.a=i},function(t,e,n){"use strict";function i(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}e.a=i;var r=n(383),a=n(69);e.b=function(){return new a.a(this._enter||this._groups.map(r.a),this._parents)},i.prototype={constructor:i,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}}},function(t,e,n){"use strict";e.a=function(t){return new Array(t.length)}},function(t,e,n){"use strict";function i(t,e){return t.style.getPropertyValue(e)||Object(r.a)(t).getComputedStyle(t,null).getPropertyValue(e)}e.b=i;var r=n(373);e.a=function(t,e,n){return arguments.length>1?this.each((null==e?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof e?function(t,e,n){return function(){var i=e.apply(this,arguments);null==i?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}:function(t,e,n){return function(){this.style.setProperty(t,e,n)}})(t,e,null==n?"":n)):i(this.node(),t)}},function(t,e,n){"use strict";var i=n(70);e.a=function(t,e){var n,r,a,o=t.__transition,s=!0;if(o){e=null==e?null:e+"";for(a in o)(n=o[a]).name===e?(r=n.state>i.d&&n.state0&&(o[0][0]="L"),i=i.concat(o)}),i.push(["Z"]),i}function o(t){return{symbol:function(t,e){return[["M",t-5.5,e-4],["L",t+5.5,e-4],["L",t+5.5,e+4],["L",t-5.5,e+4],["Z"]]},radius:5,fill:t.color,fillOpacity:.6}}var s=n(0),l=n(18),u=n(22),c=n(45),h=n(7),f=l.registerFactory("area",{defaultShapeType:"area",getDefaultPoints:function(t){var e=[],n=t.x,i=t.y,r=t.y0;return i=s.isArray(i)?i:[r,i],s.each(i,function(t){e.push({x:n,y:t})}),e},getActiveCfg:function(t,e){return function(t,e){if("line"===t||"smoothLine"===t)return{lineWidth:(e.lineWidth||0)+1};var n=e.fillOpacity||e.opacity||1;return{fillOpacity:n-.15,strokeOpacity:n-.15}}(t,e)},drawShape:function(t,e,n){var i,r=this.getShape(t);return(i=1===e.points.length&&h.showSinglePoint?function(t,e,n){var i=t._coord.convertPoint(e.points[0][1]);return n.addShape("circle",{attrs:s.mix({x:i.x,y:i.y,r:2,fill:e.color},e.style)})}(this,e,n):r.draw(e,n))&&(i.set("origin",e.origin),i._id=e.splitedIndex?e._id+e.splitedIndex:e._id,i.name=this.name),i},getSelectedCfg:function(t,e){return e&&e.style?e.style:this.getActiveCfg(t,e)}});l.registerShape("area","area",{draw:function(t,e){var n=r(t),i=a(t,!1,this);return e.addShape("path",{attrs:s.mix(n,{path:i})})},getMarkerCfg:function(t){return o(t)}}),l.registerShape("area","smooth",{draw:function(t,e){var n=r(t),i=this._coord;t.constraint=[[i.start.x,i.end.y],[i.end.x,i.start.y]];var o=a(t,!0,this);return e.addShape("path",{attrs:s.mix(n,{path:o})})},getMarkerCfg:function(t){return o(t)}}),l.registerShape("area","line",{draw:function(t,e){var n=i(t),r=a(t,!1,this);return e.addShape("path",{attrs:s.mix(n,{path:r})})},getMarkerCfg:function(t){return o(t)}}),l.registerShape("area","smoothLine",{draw:function(t,e){var n=i(t),r=a(t,!0,this);return e.addShape("path",{attrs:s.mix(n,{path:r})})},getMarkerCfg:function(t){return o(t)}}),f.spline=f.smooth,t.exports=f},function(t,e,n){var i=n(20);n(393);var r=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);return e.prototype.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return e.type="edge",e.shapeType="edge",e.generatePoints=!0,e},e}(i);i.Edge=r,t.exports=r},function(t,e,n){function i(t){var e=u.shape.edge,n=o.mix({},e,t.style);return l.addStrokeAttrs(n,t),n}function r(t,e){var n=[];n.push({x:t.x,y:.5*t.y+1*e.y/2}),n.push({y:.5*t.y+1*e.y/2,x:e.x}),n.push(e);var i=["C"];return o.each(n,function(t){i.push(t.x,t.y)}),i}function a(t,e){var n=[];n.push({x:e.x,y:e.y}),n.push(t);var i=["Q"];return o.each(n,function(t){i.push(t.x,t.y)}),i}var o=n(0),s=n(18),l=n(45),u=n(7),c=n(22),h=1/3,f=s.registerFactory("edge",{defaultShapeType:"line",getDefaultPoints:function(t){return l.splitPoints(t)},getActiveCfg:function(t,e){return{lineWidth:(e.lineWidth||0)+1}}});s.registerShape("edge","line",{draw:function(t,e){var n=this.parsePoints(t.points),r=i(t),a=c.getLinePath(n);return e.addShape("path",{attrs:o.mix(r,{path:a})})},getMarkerCfg:function(t){return o.mix({symbol:"circle",radius:4.5},i(t))}}),s.registerShape("edge","vhv",{draw:function(t,e){var n=t.points,r=i(t),a=function(t,e){var n=[];n.push({y:t.y*(1-h)+e.y*h,x:t.x}),n.push({y:t.y*(1-h)+e.y*h,x:e.x}),n.push(e);var i=[["M",t.x,t.y]];return o.each(n,function(t){i.push(["L",t.x,t.y])}),i}(n[0],n[1]);a=this.parsePath(a);return e.addShape("path",{attrs:o.mix(r,{path:a})})},getMarkerCfg:function(t){return o.mix({symbol:"circle",radius:4.5},i(t))}}),s.registerShape("edge","smooth",{draw:function(t,e){var n=t.points,a=i(t),s=function(t,e){var n=r(t,e),i=[["M",t.x,t.y]];return i.push(n),i}(n[0],n[1]);s=this.parsePath(s);return e.addShape("path",{attrs:o.mix(a,{path:s})})},getMarkerCfg:function(t){return o.mix({symbol:"circle",radius:4.5},i(t))}}),s.registerShape("edge","arc",{draw:function(t,e){var n,s,l=t.points,u=l.length>2?"weight":"normal",c=i(t);if(t.isInCircle){var h={x:0,y:1};"normal"===u?s=function(t,e,n){var i=a(e,n),r=[["M",t.x,t.y]];return r.push(i),r}(l[0],l[1],h):(c.fill=c.stroke,s=function(t,e){var n=a(t[1],e),i=a(t[3],e),r=[["M",t[0].x,t[0].y]];return r.push(i),r.push(["L",t[3].x,t[3].y]),r.push(["L",t[2].x,t[2].y]),r.push(n),r.push(["L",t[1].x,t[1].y]),r.push(["L",t[0].x,t[0].y]),r.push(["Z"]),r}(l,h)),s=this.parsePath(s),n=e.addShape("path",{attrs:o.mix(c,{path:s})})}else if("normal"===u)l=this.parsePoints(l),n=e.addShape("arc",{attrs:o.mix(c,{x:(l[1].x+l[0].x)/2,y:l[0].y,r:Math.abs(l[1].x-l[0].x)/2,startAngle:Math.PI,endAngle:2*Math.PI})});else{s=[["M",l[0].x,l[0].y],["L",l[1].x,l[1].y]];var f=r(l[1],l[3]),p=r(l[2],l[0]);s.push(f),s.push(["L",l[3].x,l[3].y]),s.push(["L",l[2].x,l[2].y]),s.push(p),s.push(["Z"]),s=this.parsePath(s),c.fill=c.stroke,n=e.addShape("path",{attrs:o.mix(c,{path:s})})}return n},getMarkerCfg:function(t){return o.mix({symbol:"circle",radius:4.5},i(t))}}),t.exports=f},function(t,e,n){var i=n(73).ColorUtil,r=n(20),a=n(0),o=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return e.type="heatmap",e.paletteCache={},e},n._prepareRange=function(){var t=this.get("mappedData"),e=this.getAttr("color").field,n=1/0,i=-1/0;t.forEach(function(t){var r=t._origin[e];r>i&&(i=r),r=t[0]}));for(var c=this._getScale(o),h=0;h1?t[1]:e;return{min:e,max:n,min1:i,max1:t.length>3?t[3]:n,median:t.length>2?t[2]:i}}function r(t,e,n){var r,a,s=[];return o.isArray(e)?r=[[t-n/2,(a=i(e)).max],[t+n/2,a.max],[t,a.max],[t,a.max1],[t-n/2,a.min1],[t-n/2,a.max1],[t+n/2,a.max1],[t+n/2,a.min1],[t,a.min1],[t,a.min],[t-n/2,a.min],[t+n/2,a.min],[t-n/2,a.median],[t+n/2,a.median]]:(e=e||.5,r=[[(a=i(t)).min,e-n/2],[a.min,e+n/2],[a.min,e],[a.min1,e],[a.min1,e-n/2],[a.min1,e+n/2],[a.max1,e+n/2],[a.max1,e-n/2],[a.max1,e],[a.max,e],[a.max,e-n/2],[a.max,e+n/2],[a.median,e-n/2],[a.median,e+n/2]]),function(t,e){o.each(t,function(t){e.push({x:t[0],y:t[1]})})}(r,s),s}function a(t,e,n){var i=function(t){o.isArray(t)||(t=[t]);var e=t.sort(function(t,e){return te[n].radius+B)return!1;return!0}(e,t)}),u=0,c=0,h=[];if(o.length>1){var f=l(o);for(n=0;n-1){var m=t[d.parentIndex[x]],_=Math.atan2(d.x-m.x,d.y-m.y),b=Math.atan2(g.x-m.x,g.y-m.y),w=b-_;w<0&&(w+=2*Math.PI);var S=b-w/2,M=a(v,{x:m.x+m.radius*Math.sin(S),y:m.y+m.radius*Math.cos(S)});M>2*m.radius&&(M=2*m.radius),(null===y||y.width>M)&&(y={circle:m,width:M,p1:d,p2:g})}null!==y&&(h.push(y),u+=r(y.circle.radius,y.width),g=d)}}else{var C=t[0];for(n=1;nMath.abs(C.radius-t[n].radius)){A=!0;break}A?u=c=0:(u=C.radius*C.radius*Math.PI,h.push({circle:C,p1:{x:C.x,y:C.y+C.radius},p2:{x:C.x-B,y:C.y+C.radius},width:2*C.radius}))}return c/=2,e&&(e.area=u+c,e.arcArea=u,e.polygonArea=c,e.arcs=h,e.innerPoints=o,e.intersectionPoints=i),u+c}function r(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function a(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))}function o(t,e,n){if(n>=t+e)return 0;if(n<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);var i=e-(n*n-t*t+e*e)/(2*n);return r(t,t-(n*n-e*e+t*t)/(2*n))+r(e,i)}function s(t,e){var n=a(t,e),i=t.radius,r=e.radius;if(n>=i+r||n<=Math.abs(i-r))return[];var o=(i*i-r*r+n*n)/(2*n),s=Math.sqrt(i*i-o*o),l=t.x+o*(e.x-t.x)/n,u=t.y+o*(e.y-t.y)/n,c=-(e.y-t.y)*(s/n),h=-(e.x-t.x)*(s/n);return[{x:l+c,y:u-h},{x:l-c,y:u+h}]}function l(t){for(var e={x:0,y:0},n=0;n=v[d-1].fx){var P=!1;if(b.fx>k.fx?(g(w,1+f,_,-f,k),w.fx=t(w),w.fx=1)break;for(y=1;yl+a*r*u||c>=d)f=r;else{if(Math.abs(p)<=-o*u)return r;p*(f-s)>=0&&(f=s),s=r,d=c}return 0}var l=n.fx,u=h(n.fxprime,e),c=l,f=l,p=u,d=0;r=r||1,a=a||1e-6,o=o||.1;for(var v=0;v<10;++v){if(g(i.x,1,n.x,r,e),c=i.fx=t(i.x,i.fxprime),p=h(i.fxprime,e),c>l+a*r*u||v&&c>=f)return s(d,r,f);if(Math.abs(p)<=-o*u)return r;if(p>=0)return s(r,d,c);f=c,d=r,r*=2}return r}function y(t,e,n){var i,r,a,o={x:e.slice(),fx:0,fxprime:e.slice()},s={x:e.slice(),fx:0,fxprime:e.slice()},l=e.slice(),u=1;a=(n=n||{}).maxIterations||20*e.length,o.fx=t(o.x,o.fxprime),p(i=o.fxprime.slice(),o.fxprime,-1);for(var c=0;ce}),e=0;e0)throw"Initial bisect points must have opposite signs";if(0===o)return e;if(0===s)return n;for(var u=0;u=0&&(e=c),Math.abs(l)=8){var r=function(t,e){var n,i=(e=e||{}).restarts||10,r=[],a={};for(n=0;n=Math.min(e[a].size,e[o].size)?l=1:t.size<=1e-10&&(l=-1),r[a][o]=r[o][a]=l}),{distances:i,constraints:r}}(t,r,a),l=s.distances,h=s.constraints,g=f(l.map(f))/l.length;l=l.map(function(t){return t.map(function(t){return t/g})});var d,v,x=function(t,e){return function(t,e,n,i){var r,a=0;for(r=0;r0&&g<=h||f<0&&g>=h||(a+=2*d*d,e[2*r]+=4*d*(o-u),e[2*r+1]+=4*d*(s-c),e[2*l]+=4*d*(u-o),e[2*l+1]+=4*d*(c-s))}return a}(t,e,l,h)};for(n=0;n=Math.min(l[g].size,l[d].size)&&(p=0),u[g].push({set:d,size:f.size,weight:p}),u[d].push({set:g,size:f.size,weight:p})}var v=[];for(a in u)if(u.hasOwnProperty(a)){var y=0;for(c=0;c0){var r=t[0].x,o=t[0].y;for(i=0;i1){var s,l,u=Math.atan2(t[1].x,t[1].y)-e,c=Math.cos(u),h=Math.sin(u);for(i=0;i2){for(var f=Math.atan2(t[2].x,t[2].y)-e;f<0;)f+=2*Math.PI;for(;f>2*Math.PI;)f-=2*Math.PI;if(f>Math.PI){var p=t[1].y/(1e-10+t[1].x);for(i=0;iu&&p.node().getComputedTextLength()>o&&(h.pop(),p.text(h.join(" ")),h=[c],p=r.append("tspan").text(c),f++)}var g=.35-1.1*f/2,d=r.attr("x"),v=r.attr("y");r.selectAll("tspan").attr("x",d).attr("y",v).attr("dy",function(t,e){return g+1.1*e+"em"})}}function T(t,e,n){var i,r,o=e[0].radius-a(e[0],t);for(i=1;i=u&&(s=r[n],u=c)}var h=d(function(n){return-1*T({x:n[0],y:n[1]},t,e)},[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x,f={x:h[0],y:h[1]},p=!0;for(n=0;nt[n].radius){p=!1;break}for(n=0;n0&&console.log("WARNING: area "+a+" not represented on screen")}return n}function E(t,e,n){var i=[];return i.push("\nM",t,e),i.push("\nm",-n,0),i.push("\na",n,n,0,1,0,2*n,0),i.push("\na",n,n,0,1,0,2*-n,0),i.join(" ")}function D(t){var e=t.split(" ");return{x:parseFloat(e[1]),y:parseFloat(e[2]),radius:-parseFloat(e[4])}}function F(t){var e={};i(t,e);var n=e.arcs;if(0===n.length)return"M 0 0";if(1==n.length){var r=n[0].circle;return E(r.x,r.y,r.radius)}for(var a=["\nM",n[0].p2.x,n[0].p2.y],o=0;ol;a.push("\nA",l,l,0,u?1:0,1,s.p1.x,s.p1.y)}return a.join(" ")}var B=1e-10,R=1e-10;t.intersectionArea=i,t.circleCircleIntersection=s,t.circleOverlap=o,t.circleArea=r,t.distance=a,t.venn=x,t.greedyLayout=b,t.scaleSolution=k,t.normalizeSolution=A,t.bestInitialLayout=_,t.lossFunction=w,t.disjointCluster=M,t.distanceFromIntersectArea=m,t.VennDiagram=function(){function t(t){function f(t){return t.sets in b?b[t.sets]:1==t.sets.length?""+t.sets[0]:void 0}var p=t.datum(),g={};p.forEach(function(t){0==t.size&&1==t.sets.length&&(g[t.sets[0]]=1)});var x={},m={};if((p=p.filter(function(t){return!t.sets.some(function(t){return t in g})})).length>0){var _=v(p,{lossFunction:y});s&&(_=A(_,o,h)),x=k(_,n,i,r),m=L(x,p)}var b={};p.forEach(function(t){t.label&&(b[t.sets]=t.label)}),t.selectAll("svg").data([x]).enter().append("svg");var w=t.select("svg").attr("width",n).attr("height",i),S={},M=!1;w.selectAll(".venn-area path").each(function(t){var n=e.select(this).attr("d");1==t.sets.length&&n&&(M=!0,S[t.sets[0]]=D(n))});var C=function(t){return function(e){return F(t.sets.map(function(t){var r=S[t],a=x[t];return r||(r={x:n/2,y:i/2,radius:1}),a||(a={x:n/2,y:i/2,radius:1}),{x:r.x*(1-e)+a.x*e,y:r.y*(1-e)+a.y*e,radius:r.radius*(1-e)+a.radius*e}}))}},T=w.selectAll(".venn-area").data(p,function(t){return t.sets}),I=T.enter().append("g").attr("class",function(t){return"venn-area venn-"+(1==t.sets.length?"circle":"intersection")}).attr("data-venn-sets",function(t){return t.sets.join("_")}),O=I.append("path"),E=I.append("text").attr("class","label").text(function(t){return f(t)}).attr("text-anchor","middle").attr("dy",".35em").attr("x",n/2).attr("y",i/2);u&&(O.style("fill-opacity","0").filter(function(t){return 1==t.sets.length}).style("fill",function(t){return d(t.sets)}).style("fill-opacity",".25"),E.style("fill",function(t){return 1==t.sets.length?d(t.sets):"#444"}));var B=t;M?(B=t.transition("venn").duration(a)).selectAll("path").attrTween("d",C):B.selectAll("path").attr("d",function(t){return F(t.sets.map(function(t){return x[t]}))});var R=B.selectAll("text").filter(function(t){return t.sets in m}).text(function(t){return f(t)}).attr("x",function(t){return Math.floor(m[t.sets].x)}).attr("y",function(t){return Math.floor(m[t.sets].y)});l&&(M?"on"in R?R.on("end",P(x,f)):R.each("end",P(x,f)):R.each(P(x,f)));var j=T.exit().transition("venn").duration(a).remove();j.selectAll("path").attrTween("d",C);var N=j.selectAll("text").attr("x",n/2).attr("y",i/2);return null!==c&&(E.style("font-size","0px"),R.style("font-size",c),N.style("font-size","0px")),{circles:x,textCentres:m,nodes:T,enter:I,update:B,exit:j}}var n=600,i=350,r=15,a=1e3,o=Math.PI/2,s=!0,l=!0,u=!0,c=null,h=null,f={},p=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],g=0,d=function(t){if(t in f)return f[t];var e=f[t]=p[g];return(g+=1)>=p.length&&(g=0),e},v=x,y=w;return t.wrap=function(e){return arguments.length?(l=e,t):l},t.width=function(e){return arguments.length?(n=e,t):n},t.height=function(e){return arguments.length?(i=e,t):i},t.padding=function(e){return arguments.length?(r=e,t):r},t.colours=function(e){return arguments.length?(d=e,t):d},t.fontSize=function(e){return arguments.length?(c=e,t):c},t.duration=function(e){return arguments.length?(a=e,t):a},t.layoutFunction=function(e){return arguments.length?(v=e,t):v},t.normalize=function(e){return arguments.length?(s=e,t):s},t.styled=function(e){return arguments.length?(u=e,t):u},t.orientation=function(e){return arguments.length?(o=e,t):o},t.orientationOrder=function(e){return arguments.length?(h=e,t):h},t.lossFunction=function(e){return arguments.length?(y=e,t):y},t},t.wrapText=P,t.computeTextCentres=L,t.computeTextCentre=I,t.sortAreas=function(t,e){function n(t){for(var e=0;e=M&&(M=S+1);!(w=_[M])&&++M=0;)(i=r[a])&&(o&&o!==i.nextSibling&&o.parentNode.insertBefore(i,o),o=i);return this}},function(t,e,n){"use strict";function i(t,e){return te?1:t>=e?0:NaN}var r=n(69);e.a=function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=i);for(var n=this._groups,a=n.length,o=new Array(a),s=0;s1?this.each((null==e?function(t){return function(){delete this[t]}}:"function"==typeof e?function(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}:function(t,e){return function(){this[t]=e}})(t,e)):this.node()[t]}},function(t,e,n){"use strict";function i(t){return t.trim().split(/^|\s+/)}function r(t){return t.classList||new a(t)}function a(t){this._node=t,this._names=i(t.getAttribute("class")||"")}function o(t,e){for(var n=r(t),i=-1,a=e.length;++i=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}},e.a=function(t,e){var n=i(t+"");if(arguments.length<2){for(var a=r(this.node()),l=-1,u=n.length;++l=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})}(t+"",i),o=-1,s=r.length;{if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o0)for(var n,i,r=new Array(n),a=0;a=0&&(t=t.slice(0,e)),!t||"start"===t})}(e)?i.g:i.h;return function(){var i=o(this,t),s=i.on;s!==r&&(a=(r=s).copy()).on(e,n),i.on=a}}(n,t,e))}},function(t,e,n){"use strict";e.a=function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))}},function(t,e,n){"use strict";var i=n(72),r=n(169),a=n(70);e.a=function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=Object(i.selector)(t));for(var o=this._groups,s=o.length,l=new Array(s),u=0;ur.c&&n.name===e)return new i.a([[t]],a,e,+o)}return null}},function(t,e,n){function i(t){var e=s.shape.venn,n=r.mix({},e,t.style);return o.addFillAttrs(n,t),n}var r=n(0),a=n(18),o=n(45),s=n(7),l=r.PathUtil,u=a.registerFactory("venn",{defaultShapeType:"venn",getDefaultPoints:function(t){var e=[];return r.each(t.x,function(n,i){var r=t.y[i];e.push({x:n,y:r})}),e},getActiveCfg:function(t,e){var n=e.lineWidth||1;if("hollow"===t)return{lineWidth:n+1};return{fillOpacity:(e.fillOpacity||e.opacity||1)-.08}},getSelectedCfg:function(t,e){return e&&e.style?e.style:this.getActiveCfg(t,e)}});a.registerShape("venn","venn",{draw:function(t,e){var n=t.origin._origin.path,a=i(t),o=l.parsePathString(n);return e.addShape("path",{attrs:r.mix(a,{path:o})})},getMarkerCfg:function(t){return r.mix({symbol:"circle",radius:4},i(t))}}),a.registerShape("venn","hollow",{draw:function(t,e){var n=t.origin._origin.path,i=function(t){var e=s.shape.hollowVenn,n=r.mix({},e,t.style);return o.addStrokeAttrs(n,t),n}(t),a=l.parsePathString(n);return e.addShape("path",{attrs:r.mix(i,{path:a})})},getMarkerCfg:function(t){return r.mix({symbol:"circle",radius:4},i(t))}}),t.exports=u},function(t,e,n){function i(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}function r(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var a=n(20),o=n(0),s=n(357);n(460);var l=function(t){function e(e){var n;return n=t.call(this,e)||this,o.assign(r(r(n)),s),n}i(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return e.type="violin",e.shapeType="violin",e.generatePoints=!0,e},n.createShapePointsCfg=function(e){var n=t.prototype.createShapePointsCfg.call(this,e);n.size=this.getNormalizedSize(e);var i=this.get("_sizeField");return n._size=e._origin[i],n},n.clearInner=function(){t.prototype.clearInner.call(this),this.set("defaultSize",null)},n._initAttrs=function(){var e=this.get("attrOptions"),n=e.size?e.size.field:this.get("_sizeField")?this.get("_sizeField"):"size";this.set("_sizeField",n),delete e.size,t.prototype._initAttrs.call(this)},e}(a),u=function(t){function e(){return t.apply(this,arguments)||this}i(e,t);return e.prototype.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return e.hasDefaultAdjust=!0,e.adjusts=[{type:"dodge"}],e},e}(l);l.Dodge=u,a.Violin=l,a.ViolinDodge=u,t.exports=l},function(t,e,n){function i(t){var e=c.shape.venn,n=s.mix({},e,t.style);return u.addFillAttrs(n,t),t.color&&(n.stroke=n.stroke||t.color),n}function r(t){var e=c.shape.hollowVenn,n=s.mix({},e,t.style);return u.addStrokeAttrs(n,t),n}function a(t){for(var e=[],n=0;n=0;r--)for(var a=e.getFacetsByLevel(t,r),o=0;op.x||a.yf.y)return}s.style.cursor="crosshair",e.startPoint=a,e.brushShape=null,e.brushing=!0,c?c.clear():(c=n.addGroup({zIndex:5})).initTransform(),e.container=c,"POLYGON"===i&&(e.polygonPath="M "+a.x+" "+a.y)}}}},n.process=function(t){var e=this,n=e.brushing,i=e.dragging,a=e.type,o=e.plot,s=e.startPoint,l=e.xScale,u=e.yScale,c=e.canvas;if(n||i){var h={x:t.offsetX,y:t.offsetY},f=c.get("canvasDOM");if(n){f.style.cursor="crosshair";var p=o.start,g=o.end,d=e.polygonPath,v=e.brushShape,y=e.container;e.plot&&e.inPlot&&(h=e._limitCoordScope(h));var x,m,_,b;"Y"===a?(x=p.x,m=h.y>=s.y?s.y:h.y,_=Math.abs(p.x-g.x),b=Math.abs(s.y-h.y)):"X"===a?(x=h.x>=s.x?s.x:h.x,m=g.y,_=Math.abs(s.x-h.x),b=Math.abs(g.y-p.y)):"XY"===a?(h.x>=s.x?(x=s.x,m=h.y>=s.y?s.y:h.y):(x=h.x,m=h.y>=s.y?s.y:h.y),_=Math.abs(s.x-h.x),b=Math.abs(s.y-h.y)):"POLYGON"===a&&(d+="L "+h.x+" "+h.y,e.polygonPath=d,v?!v.get("destroyed")&&v.attr(r.mix({},v._attrs,{path:d})):v=y.addShape("path",{attrs:r.mix(e.style,{path:d})})),"POLYGON"!==a&&(v?!v.get("destroyed")&&v.attr(r.mix({},v._attrs,{x:x,y:m,width:_,height:b})):v=y.addShape("rect",{attrs:r.mix(e.style,{x:x,y:m,width:_,height:b})})),e.brushShape=v}else if(i){f.style.cursor="move";var w=e.selection;if(w&&!w.get("destroyed"))if("POLYGON"===a){var S=e.prePoint;e.selection.translate(h.x-S.x,h.y-S.y)}else e.dragoffX&&w.attr("x",h.x-e.dragoffX),e.dragoffY&&w.attr("y",h.y-e.dragoffY)}e.prePoint=h,c.draw();var M=e._getSelected(),C=M.data,A=M.shapes,k=M.xValues,P=M.yValues,T={data:C,shapes:A,x:h.x,y:h.y};l&&(T[l.field]=k),u&&(T[u.field]=P),e.onDragmove&&e.onDragmove(T),e.onBrushmove&&e.onBrushmove(T)}},n.end=function(t){var e=this,n=e.data,i=e.shapes,a=e.xValues,o=e.yValues,s=e.canvas,l=e.type,u=e.startPoint,c=e.chart,h=e.container,f=e.xScale,p=e.yScale,g=t.offsetX,d=t.offsetY;if(s.get("canvasDOM").style.cursor="default",Math.abs(u.x-g)<=1&&Math.abs(u.y-d)<=1)return e.brushing=!1,void(e.dragging=!1);var v={data:n,shapes:i,x:g,y:d};if(f&&(v[f.field]=a),p&&(v[p.field]=o),e.dragging)e.dragging=!1,e.onDragend&&e.onDragend(v);else if(e.brushing){e.brushing=!1;var y=e.brushShape,x=e.polygonPath;"POLYGON"===l&&(x+="z",y&&!y.get("destroyed")&&y.attr(r.mix({},y._attrs,{path:x})),e.polygonPath=x,s.draw()),e.onBrushend?e.onBrushend(v):c&&e.filter&&(h.clear(),"X"===l?f&&c.filter(f.field,function(t){return a.indexOf(t)>-1}):"Y"===l?p&&c.filter(p.field,function(t){return o.indexOf(t)>-1}):(f&&c.filter(f.field,function(t){return a.indexOf(t)>-1}),p&&c.filter(p.field,function(t){return o.indexOf(t)>-1})),c.repaint())}},n.reset=function(){var t=this.chart,e=this.filter,n=this.brushShape,i=this.canvas;t&&e&&(t.get("options").filters={},t.repaint()),n&&(n.destroy(),i.draw())},n._limitCoordScope=function(t){var e=this.plot,n=e.start,i=e.end;return t.xi.x&&(t.x=i.x),t.yn.y&&(t.y=n.y),t},n._getSelected=function(){var t=this,e=t.chart,n=t.xScale,i=t.yScale,r=t.brushShape,a=t.canvas,o=a.get("pixelRatio"),s=[],l=[],u=[],c=[];if(e){e.get("geoms").map(function(t){return t.getShapes().map(function(t){var e=t.get("origin");return Array.isArray(e)||(e=[e]),e.map(function(e){if(r.isHit(e.x*o,e.y*o)){s.push(t);var a=e._origin;c.push(a),n&&l.push(a[n.field]),i&&u.push(a[i.field])}return e}),t}),t})}return t.shapes=s,t.xValues=l,t.yValues=u,t.data=c,a.draw(),{data:c,xValues:l,yValues:u,shapes:s}},e}(n(171));t.exports=s},function(t,e,n){function i(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var r=n(0),a=n(171),o=n(469),s=n(377),l=n(378),u=["X","Y","XY"],c="X",h=function(t){function e(e,n){var a,s=i(i(a=t.call(this,e,n)||this));s.type=s.type.toUpperCase(),s.chart=n,s.coord=n.get("coord");var h=s.data=n.get("data");o(n);var f=n.getYScales(),p=n.getXScale();f.push(p);var g=n.get("scaleController");return f.forEach(function(t){var e=t.field;s.limitRange[e]=l(h,t);var n=g.defs[e]||{};s.originScaleDefsByField[e]=r.mix(n,{nice:!!n.nice}),t.isLinear&&(s.stepByField[e]=(t.max-t.min)*s.stepRatio)}),-1===u.indexOf(s.type)&&(s.type=c),s._disableTooltip(),a}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return r.mix({},e,{type:c,stepRatio:.05,limitRange:{},stepByField:{},threshold:20,originScaleDefsByField:{},previousPoint:null,isDragging:!1})},n._disableTooltip=function(){var t=this.chart;t.get("tooltipController")&&(this._showTooltip=!0,t.tooltip(!1))},n._enableTooltip=function(t){var e=this.chart;this._showTooltip&&(e.tooltip(!0),e.showTooltip(t))},n._applyTranslate=function(t,e,n){void 0===e&&(e=0);t.isLinear?this._translateLinearScale(t,e,n):this._translateCatScale(t,e,n)},n._translateCatScale=function(t,e,n){var i=this.chart,a=t.type,o=t.field,l=t.values,u=t.ticks,c=s(i,o),h=this.limitRange[o],f=e/n,p=l.length,g=Math.max(1,Math.abs(parseInt(f*p))),d=h.indexOf(l[0]),v=h.indexOf(l[p-1]);if(e>0&&d>=0){for(var y=0;y0;y++)d-=1,v-=1;var x=h.slice(d,v+1),m=null;if("timeCat"===a){for(var _=u.length>2?u[1]-u[0]:864e5,b=u[0]-_;b>=x[0];b-=_)u.unshift(b);m=u}i.scale(o,r.mix({},c,{values:x,ticks:m}))}else if(e<0&&v<=h.length-1){for(var w=0;w2?u[1]-u[0]:864e5,A=u[u.length-1]+C;A<=S[S.length-1];A+=C)u.push(A);M=u}i.scale(o,r.mix({},c,{values:S,ticks:M}))}},n._translateLinearScale=function(t,e,n){var i=this.chart,a=this.limitRange,o=t.min,l=t.max,u=t.field;if(o!==a[u].min||l!==a[u].max){var c=e/n,h=l-o,f=s(i,u);i.scale(u,r.mix({},f,{nice:!1,min:o+c*h,max:l+c*h}))}},n.start=function(t){this.canvas.get("canvasDOM").style.cursor="pointer",this.isDragging=!0,this.previousPoint={x:t.x,y:t.y},this._disableTooltip()},n.process=function(t){var e=this;if(e.isDragging){var n=e.chart,i=e.type,r=e.canvas,a=e.coord,o=e.threshold;r.get("canvasDOM").style.cursor="move";var s=e.previousPoint,l=t,u=l.x-s.x,c=l.y-s.y,h=!1;if(Math.abs(u)>o&&i.indexOf("X")>-1){h=!0;var f=n.getXScale();e._applyTranslate(f,f.isLinear?-u:u,a.width)}if(Math.abs(c)>o&&i.indexOf("Y")>-1){h=!0;n.getYScales().forEach(function(t){e._applyTranslate(t,l.y-s.y,a.height)})}h&&(e.previousPoint=l,n.repaint())}},n.end=function(t){this.isDragging=!1;this.canvas.get("canvasDOM").style.cursor="default",this._enableTooltip(t)},n.reset=function(){var t=this.view,e=this.originScaleDefsByField,n=t.getYScales(),i=t.getXScale();n.push(i),n.forEach(function(n){if(n.isLinear){var i=n.field;t.scale(i,e[i])}}),t.repaint(),this._disableTooltip()},e}(a);t.exports=h},function(t,e,n){var i=n(0),r=n(71),a=n(376);t.exports=function(t){t.on("beforeinitgeoms",function(){t.set("limitInPlot",!0);var e=t.get("data"),n=a(t);if(!n)return e;var o=t.get("geoms"),s=!1;i.each(o,function(t){if(-1!==["area","line","path"].indexOf(t.get("type")))return s=!0,!1});var l=[];if(i.each(n,function(t,e){!s&&t&&(t.values||t.min||t.max)&&l.push(e)}),0===l.length)return e;var u=[];i.each(e,function(t){var e=!0;i.each(l,function(a){var o=t[a];if(o){var s=n[a];if("timeCat"===s.type){var l=s.values;i.isNumber(l[0])&&(o=r.toTimeStamp(o))}(s.values&&-1===s.values.indexOf(o)||s.min&&os.max)&&(e=!1)}}),e&&u.push(t)}),t.set("filteredData",u)})}},function(t,e,n){var i=n(0),r=n(171),a=n(471),o=n(378),s=function(t){function e(e,n){var r,a=(r=t.call(this,e,n)||this).getDefaultCfg();return n.set("_scrollBarCfg",i.deepMix({},a,e)),n.set("_limitRange",{}),n.get("_horizontalBar")||n.get("_verticalBar")||r._renderScrollBars(),r}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return i.mix({},e,{startEvent:null,processEvent:null,endEvent:null,resetEvent:null,type:"X",xStyle:{backgroundColor:"rgba(202, 215, 239, .2)",fillerColor:"rgba(202, 215, 239, .75)",size:4,lineCap:"round",offsetX:0,offsetY:-10},yStyle:{backgroundColor:"rgba(202, 215, 239, .2)",fillerColor:"rgba(202, 215, 239, .75)",size:4,lineCap:"round",offsetX:8,offsetY:0}})},n._renderScrollBars=function(){var t=this.chart,e=t.get("_scrollBarCfg");if(e){var n=t.get("data"),i=t.get("plotRange");i.width=Math.abs(i.br.x-i.bl.x),i.height=Math.abs(i.tl.y-i.bl.y);var r=t.get("backPlot"),s=t.get("canvas").get("height"),l=t.get("_limitRange"),u=e.type;if(u.indexOf("X")>-1){var c=e.xStyle,h=c.offsetX,f=c.offsetY,p=c.lineCap,g=c.backgroundColor,d=c.fillerColor,v=c.size,y=t.getXScale(),x=l[y.field];x||(x=o(n,y),l[y.field]=x);var m=a(y,x,y.type),_=t.get("_horizontalBar"),b=s-v/2+f;if(_){_.get("children")[1].attr({x1:Math.max(i.bl.x+i.width*m[0]+h,i.bl.x),x2:Math.min(i.bl.x+i.width*m[1]+h,i.br.x)})}else(_=r.addGroup({className:"horizontalBar"})).addShape("line",{attrs:{x1:i.bl.x+h,y1:b,x2:i.br.x+h,y2:b,lineWidth:v,stroke:g,lineCap:p}}),_.addShape("line",{attrs:{x1:Math.max(i.bl.x+i.width*m[0]+h,i.bl.x),y1:b,x2:Math.min(i.bl.x+i.width*m[1]+h,i.br.x),y2:b,lineWidth:v,stroke:d,lineCap:p}}),t.set("_horizontalBar",_)}if(u.indexOf("Y")>-1){var w=e.yStyle,S=w.offsetX,M=w.offsetY,C=w.lineCap,A=w.backgroundColor,k=w.fillerColor,P=w.size,T=t.getYScales()[0],I=l[T.field];I||(I=o(n,T),l[T.field]=I);var O=a(T,I,T.type),L=t.get("_verticalBar"),E=P/2+S;if(L){L.get("children")[1].attr({y1:Math.max(i.tl.y+i.height*O[0]+M,i.tl.y),y2:Math.min(i.tl.y+i.height*O[1]+M,i.bl.y)})}else(L=r.addGroup({className:"verticalBar"})).addShape("line",{attrs:{x1:E,y1:i.tl.y+M,x2:E,y2:i.bl.y+M,lineWidth:P,stroke:A,lineCap:C}}),L.addShape("line",{attrs:{x1:E,y1:Math.max(i.tl.y+i.height*O[0]+M,i.tl.y),x2:E,y2:Math.min(i.tl.y+i.height*O[1]+M,i.bl.y),lineWidth:P,stroke:k,lineCap:C}}),t.set("_verticalBar",L)}}},n._clear=function(){var t=this.chart;if(t){var e=t.get("_horizontalBar"),n=t.get("_verticalBar");e&&e.remove(!0),n&&n.remove(!0),t.set("_horizontalBar",null),t.set("_verticalBar",null)}},n._bindEvents=function(){this._onAfterclearOrBeforechangedata=this._onAfterclearOrBeforechangedata.bind(this),this._onAfterclearinner=this._onAfterclearinner.bind(this),this._onAfterdrawgeoms=this._onAfterdrawgeoms.bind(this);var t=this.chart;t.on("afterclear",this._onAfterclearOrBeforechangedata),t.on("beforechangedata",this._onAfterclearOrBeforechangedata),t.on("afterclearinner",this._onAfterclearinner),t.on("afterdrawgeoms",this._onAfterdrawgeoms)},n._onAfterclearOrBeforechangedata=function(){this.chart&&this.chart.set("_limitRange",{})},n._onAfterclearinner=function(){this._clear()},n._onAfterdrawgeoms=function(){this._renderScrollBars()},n._clearEvents=function(){var t=this.chart;t&&(t.off("afterclear",this._onAfterclearOrBeforechangedata),t.off("beforechangedata",this._onAfterclearOrBeforechangedata),t.off("afterclearinner",this._onAfterclearinner),t.off("afterdrawgeoms",this._onAfterdrawgeoms))},n.destroy=function(){this._clearEvents(),this._clear(),this.canvas.draw()},e}(r);t.exports=s},function(t,e){t.exports=function(t,e,n){if(!t)return[0,1];var i=0,r=0;if("linear"===n){var a=e.min,o=e.max-a;i=(t.min-a)/o,r=(t.max-a)/o}else{var s=e,l=t.values,u=s.indexOf(l[0]),c=s.indexOf(l[l.length-1]);i=u/(s.length-1),r=c/(s.length-1)}return[i,r]}},function(t,e,n){function i(t,e){var n={};for(var i in e)n[i]=t[i];return n}var r=n(0),a=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return r.mix({},e,{startEvent:"mouseup",processEvent:null,selectStyle:{fillOpacity:1},unSelectStyle:{fillOpacity:.1},cancelable:!0})},n.start=function(t){var e,n=[];if(this.view.eachShape(function(i,r){r.isPointInPath(t.x,t.y)?e=r:n.push(r)}),e)if(e.get("_selected")){if(!this.cancelable)return;this.reset()}else{var a=this.selectStyle,o=this.unSelectStyle,s=i(e.attr(),e);e.set("_originAttrs",s),e.attr(a),r.each(n,function(t){var e=t.get("_originAttrs");e&&t.attr(e),t.set("_selected",!1),o&&(e=i(t.attr(),o),t.set("_originAttrs",e),t.attr(o))}),e.set("_selected",!0),this.selectedShape=e,this.canvas.draw()}else this.reset()},n.end=function(t){var e=this.selectedShape;e&&!e.get("destroyed")&&e.get("origin")&&(t.data=e.get("origin")._origin,t.shapeInfo=e.get("origin"),t.shape=e,t.selected=!!e.get("_selected"))},n.reset=function(){if(this.selectedShape){var t=this.view.get("geoms")[0].get("container").get("children")[0].get("children");r.each(t,function(t){var e=t.get("_originAttrs");e&&(t._attrs=e,t.set("_originAttrs",null)),t.set("_selected",!1)}),this.canvas.draw()}},e}(n(171));t.exports=a},function(t,e,n){function i(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var r=n(474),a=n(147),o=n(0),s=n(16),l=n(7),u=n(171),c=n(377),h=n(376),f=s.Canvas,p=o.DomUtil,g=o.isNumber,d=function(t){function e(e,n){var r,a=i(i(r=t.call(this,e,n)||this));return a._initContainer(),a._initStyle(),a.render(),r}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return o.mix({},e,{startEvent:null,processEvent:null,endEvent:null,resetEvent:null,height:26,width:"auto",padding:l.plotCfg.padding,container:null,xAxis:null,yAxis:null,fillerStyle:{fill:"#BDCCED",fillOpacity:.3},backgroundStyle:{stroke:"#CCD6EC",fill:"#CCD6EC",fillOpacity:.3,lineWidth:1},range:[0,100],layout:"horizontal",textStyle:{fill:"#545454"},handleStyle:{img:"https://gw.alipayobjects.com/zos/rmsportal/QXtfhORGlDuRvLXFzpsQ.png",width:5},backgroundChart:{type:["area"],color:"#CCD6EC"}})},n._initContainer=function(){var t=this.container;if(!t)throw new Error("Please specify the container for the Slider!");o.isString(t)?this.domContainer=document.getElementById(t):this.domContainer=t},n.forceFit=function(){var t=this;if(t&&!t.destroyed){var e=p.getWidth(t.domContainer),n=t.height;if(e!==t.domWidth){var i=t.canvas;i.changeSize(e,n),t.bgChart&&t.bgChart.changeWidth(e),i.clear(),t._initWidth(),t._initSlider(),t._bindEvent(),i.draw()}}},n._initForceFitEvent=function(){var t=setTimeout(o.wrapBehavior(this,"forceFit"),200);clearTimeout(this.resizeTimer),this.resizeTimer=t},n._initStyle=function(){var t=this;t.handleStyle=o.mix({width:t.height,height:t.height},t.handleStyle),"auto"===t.width&&window.addEventListener("resize",o.wrapBehavior(t,"_initForceFitEvent"))},n._initWidth=function(){var t,e=this;t="auto"===e.width?p.getWidth(e.domContainer):e.width,e.domWidth=t;var n=o.toAllPadding(e.padding);"horizontal"===e.layout?(e.plotWidth=t-n[1]-n[3],e.plotPadding=n[3],e.plotHeight=e.height):"vertical"===e.layout&&(e.plotWidth=e.width,e.plotHeight=e.height-n[0]-n[2],e.plotPadding=n[0])},n._initCanvas=function(){var t=this.domWidth,e=this.height,n=new f({width:t,height:e,containerDOM:this.domContainer,capture:!1}),i=n.get("el");i.style.position="absolute",i.style.top=0,i.style.left=0,i.style.zIndex=3,this.canvas=n},n._initBackground=function(){var t,e=this,n=this.chart,i=n.getAllGeoms[0],r=e.data=e.data||n.get("data"),s=n.getXScale(),l=e.xAxis||s.field,u=e.yAxis||n.getYScales()[0].field,c=o.deepMix((t={},t[""+l]={range:[0,1]},t),h(n),e.scales);if(delete c[l].min,delete c[l].max,!r)throw new Error("Please specify the data!");if(!l)throw new Error("Please specify the xAxis!");if(!u)throw new Error("Please specify the yAxis!");var f=e.backgroundChart,p=f.type||i.get("type"),g=f.color||"grey";o.isArray(p)||(p=[p]);var d=o.toAllPadding(e.padding),v=new a({container:e.container,width:e.domWidth,height:e.height,padding:[0,d[1],0,d[3]],animate:!1});v.source(r),v.scale(c),v.axis(!1),v.tooltip(!1),v.legend(!1),o.each(p,function(t){v[t]().position(l+"*"+u).color(g).opacity(1)}),v.render(),e.bgChart=v,e.scale="horizontal"===e.layout?v.getXScale():v.getYScales()[0],"vertical"===e.layout&&v.destroy()},n._initRange=function(){var t=this,e=t.startRadio,n=t.endRadio,i=t._startValue,r=t._endValue,a=t.scale,o=0,s=1;g(e)?o=e:i&&(o=a.scale(a.translate(i))),g(n)?s=n:r&&(s=a.scale(a.translate(r)));var l=t.minSpan,u=t.maxSpan,c=0;if("time"===a.type||"timeCat"===a.type){var h=a.values,f=h[0];c=h[h.length-1]-f}else a.isLinear&&(c=a.max-a.min);c&&l&&(t.minRange=l/c*100),c&&u&&(t.maxRange=u/c*100);var p=[100*o,100*s];return t.range=p,p},n._getHandleValue=function(t){var e=this,n=e.range,i=n[0]/100,r=n[1]/100,a=e.scale;return"min"===t?e._startValue?e._startValue:a.invert(i):e._endValue?e._endValue:a.invert(r)},n._initSlider=function(){var t=this,e=t.canvas,n=t._initRange(),i=t.scale,a=e.addGroup(r,{middleAttr:t.fillerStyle,range:n,minRange:t.minRange,maxRange:t.maxRange,layout:t.layout,width:t.plotWidth,height:t.plotHeight,backgroundStyle:t.backgroundStyle,textStyle:t.textStyle,handleStyle:t.handleStyle,minText:i.getText(t._getHandleValue("min")),maxText:i.getText(t._getHandleValue("max"))});"horizontal"===t.layout?a.translate(t.plotPadding,0):"vertical"===t.layout&&a.translate(0,t.plotPadding),t.rangeElement=a},n._updateElement=function(t,e){var n=this,i=n.chart,r=n.scale,a=n.rangeElement,s=r.field,l=a.get("minTextElement"),u=a.get("maxTextElement"),h=r.invert(t),f=r.invert(e),p=r.getText(h),g=r.getText(f);l.attr("text",p),u.attr("text",g),n._startValue=p,n._endValue=g,n.onChange&&n.onChange({startText:p,endText:g,startValue:h,endValue:f,startRadio:t,endRadio:e}),i.scale(s,o.mix({},c(i,s),{nice:!1,min:h,max:f})),i.repaint()},n._bindEvent=function(){var t=this;t.rangeElement.on("sliderchange",function(e){var n=e.range,i=n[0]/100,r=n[1]/100;t._updateElement(i,r)})},n.clear=function(){var t=this;t.canvas.clear(),t.bgChart&&t.bgChart.destroy(),t.bgChart=null,t.scale=null,t.canvas.draw()},n.repaint=function(){this.clear(),this.render()},n.render=function(){var t=this;t._initWidth(),t._initCanvas(),t._initBackground(),t._initSlider(),t._bindEvent(),t.canvas.draw()},n.destroy=function(){var t=this;clearTimeout(t.resizeTimer);t.rangeElement.off("sliderchange"),t.bgChart&&t.bgChart.destroy(),t.canvas.destroy();for(var e=t.domContainer;e.hasChildNodes();)e.removeChild(e.firstChild);window.removeEventListener("resize",o.getWrapBehavior(t,"_initForceFitEvent")),t.destroyed=!0},e}(u);t.exports=d},function(t,e,n){var i=n(0),r=n(16).Group,a=i.DomUtil,o=function(t){function e(){return t.apply(this,arguments)||this}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){return{range:null,middleAttr:null,backgroundElement:null,minHandleElement:null,maxHandleElement:null,middleHandleElement:null,currentTarget:null,layout:"vertical",width:null,height:null,pageX:null,pageY:null}},n._initHandle=function(t){var e,n,r,a=this.addGroup(),o=this.get("layout"),s=this.get("handleStyle"),l=s.img,u=s.width,c=s.height;if("horizontal"===o){var h=s.width;r="ew-resize",n=a.addShape("Image",{attrs:{x:-h/2,y:0,width:h,height:c,img:l,cursor:r}}),e=a.addShape("Text",{attrs:i.mix({x:"min"===t?-(h/2+5):h/2+5,y:c/2,textAlign:"min"===t?"end":"start",textBaseline:"middle",text:"min"===t?this.get("minText"):this.get("maxText"),cursor:r},this.get("textStyle"))})}else r="ns-resize",n=a.addShape("Image",{attrs:{x:0,y:-c/2,width:u,height:c,img:l,cursor:r}}),e=a.addShape("Text",{attrs:i.mix({x:u/2,y:"min"===t?c/2+5:-(c/2+5),textAlign:"center",textBaseline:"middle",text:"min"===t?this.get("minText"):this.get("maxText"),cursor:r},this.get("textStyle"))});return this.set(t+"TextElement",e),this.set(t+"IconElement",n),a},n._initSliderBackground=function(){var t=this.addGroup();return t.initTransform(),t.translate(0,0),t.addShape("Rect",{attrs:i.mix({x:0,y:0,width:this.get("width"),height:this.get("height")},this.get("backgroundStyle"))}),t},n._beforeRenderUI=function(){var t=this._initSliderBackground(),e=this._initHandle("min"),n=this._initHandle("max"),i=this.addShape("rect",{attrs:this.get("middleAttr")});this.set("middleHandleElement",i),this.set("minHandleElement",e),this.set("maxHandleElement",n),this.set("backgroundElement",t),t.set("zIndex",0),i.set("zIndex",1),e.set("zIndex",2),n.set("zIndex",2),i.attr("cursor","move"),this.sort()},n._renderUI=function(){"horizontal"===this.get("layout")?this._renderHorizontal():this._renderVertical()},n._transform=function(t){var e=this.get("range"),n=e[0]/100,i=e[1]/100,r=this.get("width"),a=this.get("height"),o=this.get("minHandleElement"),s=this.get("maxHandleElement"),l=this.get("middleHandleElement");o.resetMatrix?(o.resetMatrix(),s.resetMatrix()):(o.initTransform(),s.initTransform()),"horizontal"===t?(l.attr({x:r*n,y:0,width:(i-n)*r,height:a}),o.translate(n*r,0),s.translate(i*r,0)):(l.attr({x:0,y:a*(1-i),width:r,height:(i-n)*a}),o.translate(0,(1-n)*a),s.translate(0,(1-i)*a))},n._renderHorizontal=function(){this._transform("horizontal")},n._renderVertical=function(){this._transform("vertical")},n._bindUI=function(){this.on("mousedown",i.wrapBehavior(this,"_onMouseDown"))},n._isElement=function(t,e){var n=this.get(e);if(t===n)return!0;if(n.isGroup){return n.get("children").indexOf(t)>-1}return!1},n._getRange=function(t,e){var n=t+e;return n=n>100?100:n,n=n<0?0:n},n._limitRange=function(t,e,n){n[0]=this._getRange(t,n[0]),n[1]=n[0]+e,n[1]>100&&(n[1]=100,n[0]=n[1]-e)},n._updateStatus=function(t,e){var n="x"===t?this.get("width"):this.get("height");t=i.upperFirst(t);var r,a=this.get("range"),o=this.get("page"+t),s=this.get("currentTarget"),l=this.get("rangeStash"),u="vertical"===this.get("layout")?-1:1,c=e["page"+t],h=(c-o)/n*100*u,f=this.get("minRange"),p=this.get("maxRange");a[1]<=a[0]?(this._isElement(s,"minHandleElement")||this._isElement(s,"maxHandleElement"))&&(a[0]=this._getRange(h,a[0]),a[1]=this._getRange(h,a[0])):(this._isElement(s,"minHandleElement")&&(a[0]=this._getRange(h,a[0]),f&&a[1]-a[0]<=f&&this._limitRange(h,f,a),p&&a[1]-a[0]>=p&&this._limitRange(h,p,a)),this._isElement(s,"maxHandleElement")&&(a[1]=this._getRange(h,a[1]),f&&a[1]-a[0]<=f&&this._limitRange(h,f,a),p&&a[1]-a[0]>=p&&this._limitRange(h,p,a))),this._isElement(s,"middleHandleElement")&&(r=l[1]-l[0],this._limitRange(h,r,a)),this.emit("sliderchange",{range:a}),this.set("page"+t,c),this._renderUI(),this.get("canvas").draw()},n._onMouseDown=function(t){var e=t.currentTarget,n=t.event,i=this.get("range");n.stopPropagation(),n.preventDefault(),this.set("pageX",n.pageX),this.set("pageY",n.pageY),this.set("currentTarget",e),this.set("rangeStash",[i[0],i[1]]),this._bindCanvasEvents()},n._bindCanvasEvents=function(){var t=this.get("canvas").get("containerDOM");this.onMouseMoveListener=a.addEventListener(t,"mousemove",i.wrapBehavior(this,"_onCanvasMouseMove")),this.onMouseUpListener=a.addEventListener(t,"mouseup",i.wrapBehavior(this,"_onCanvasMouseUp")),this.onMouseLeaveListener=a.addEventListener(t,"mouseleave",i.wrapBehavior(this,"_onCanvasMouseUp"))},n._onCanvasMouseMove=function(t){"horizontal"===this.get("layout")?this._updateStatus("x",t):this._updateStatus("y",t)},n._onCanvasMouseUp=function(){this._removeDocumentEvents()},n._removeDocumentEvents=function(){this.onMouseMoveListener.remove(),this.onMouseUpListener.remove(),this.onMouseLeaveListener.remove()},e}(r);t.exports=o},function(t,e,n){function i(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var r=n(0),a=n(171),o=n(377),s=n(378),l=["X","Y","XY"],u="X",c=function(t){function e(e,n){var a,o=i(i(a=t.call(this,e,n)||this));o.chart=n,o.type=o.type.toUpperCase();var c=o.data=n.get("data"),h=n.getYScales(),f=n.getXScale();h.push(f);var p=n.get("scaleController");return h.forEach(function(t){var e=t.field,n=p.defs[e]||{};o.limitRange[e]=s(c,t),o.originScaleDefsByField[e]=r.mix(n,{nice:!!n.nice}),t.isLinear?o.stepByField[e]=(t.max-t.min)*o.stepRatio:o.stepByField[e]=o.catStep}),-1===l.indexOf(o.type)&&(o.type=u),a}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var n=e.prototype;return n.getDefaultCfg=function(){var e=t.prototype.getDefaultCfg.call(this);return r.mix({},e,{processEvent:"mousewheel",type:u,stepRatio:.05,stepByField:{},minScale:1,maxScale:4,catStep:2,limitRange:{},originScaleDefsByField:{}})},n._applyScale=function(t,e,n,i){void 0===n&&(n=0);var a=this,s=a.chart,l=a.stepByField;if(t.isLinear){var u=t.min,c=t.max,h=t.field,f=1-n,p=l[h]*e,g=u+p*n,d=c-p*f;d>g&&s.scale(h,{nice:!1,min:g,max:d})}else{var v=t.field,y=t.values,x=a.chart,m=x.get("coord"),_=o(x,v),b=a.limitRange[v],w=b.length,S=w/a.maxScale,M=w/a.minScale,C=y.length,A=m.invertPoint(i).x,k=C-e*this.catStep,P=parseInt(k*A),T=k+P;if(e>0&&C>=S){var I=P,O=T;T>C&&(O=C-1,I=C-k);var L=y.slice(I,O);x.scale(v,r.mix({},_,{values:L}))}else if(e<0&&C<=M){var E=b.indexOf(y[0]),D=b.indexOf(y[C-1]),F=Math.max(0,E-P),B=Math.min(D+T,w),R=b.slice(F,B);x.scale(v,r.mix({},_,{values:R}))}}},n.process=function(t){var e=this,n=e.chart,i=e.type,r=n.get("coord"),a=t.deltaY,o=r.invertPoint(t);if(a){e.onZoom&&e.onZoom(a,o,e),a>0?e.onZoomin&&e.onZoomin(a,o,e):e.onZoomout&&e.onZoomout(a,o,e);var s=a/Math.abs(a);if(i.indexOf("X")>-1&&e._applyScale(n.getXScale(),s,o.x,t),i.indexOf("Y")>-1){n.getYScales().forEach(function(n){e._applyScale(n,s,o.y,t)})}}n.repaint()},n.reset=function(){var t=this.view,e=this.originScaleDefsByField,n=t.getYScales(),i=t.getXScale();n.push(i),n.forEach(function(n){if(n.isLinear){var i=n.field;t.scale(i,e[i])}}),t.repaint()},e}(a);t.exports=c}])}); \ No newline at end of file diff --git a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/js/jquery.min.js b/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/js/jquery.min.js deleted file mode 100644 index fad9ab12..00000000 --- a/pig-visual/pig-sentinel-dashboard/src/main/webapp/resources/lib/js/jquery.min.js +++ /dev/null @@ -1,5 +0,0 @@ -/*! jQuery v2.1.4 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */ -!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)+1>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b="length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+K.uid++}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){ -return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthx",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,ba=/<([\w:]+)/,ca=/<|&#?\w+;/,da=/<(?:script|style|link)/i,ea=/checked\s*(?:[^=]|=\s*.checked.)/i,fa=/^$|\/(?:java|ecma)script/i,ga=/^true\/(.*)/,ha=/^\s*\s*$/g,ia={option:[1,""],thead:[1,"","
        "],col:[2,"","
        "],tr:[2,"","
        "],td:[3,"","
        "],_default:[0,"",""]};ia.optgroup=ia.option,ia.tbody=ia.tfoot=ia.colgroup=ia.caption=ia.thead,ia.th=ia.td;function ja(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function ka(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function la(a){var b=ga.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function ma(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function na(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function oa(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pa(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=oa(h),f=oa(a),d=0,e=f.length;e>d;d++)pa(f[d],g[d]);if(b)if(c)for(f=f||oa(a),g=g||oa(h),d=0,e=f.length;e>d;d++)na(f[d],g[d]);else na(a,h);return g=oa(h,"script"),g.length>0&&ma(g,!i&&oa(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(ca.test(e)){f=f||k.appendChild(b.createElement("div")),g=(ba.exec(e)||["",""])[1].toLowerCase(),h=ia[g]||ia._default,f.innerHTML=h[1]+e.replace(aa,"<$1>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=oa(k.appendChild(e),"script"),i&&ma(f),c)){j=0;while(e=f[j++])fa.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=ja(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=ja(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(oa(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&ma(oa(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(oa(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!da.test(a)&&!ia[(ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(aa,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(oa(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(oa(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&ea.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(oa(c,"script"),ka),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,oa(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,la),j=0;g>j;j++)h=f[j],fa.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(ha,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qa,ra={};function sa(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function ta(a){var b=l,c=ra[a];return c||(c=sa(a,b),"none"!==c&&c||(qa=(qa||n("';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}if(e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i(".layui-layer-move")[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),i("#layui-layer-shade"+e.index).css({"background-color":t.shade[1]||"#000",opacity:t.shade[0]||t.shade}),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():e.offset(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||setTimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]){var u="layer-anim "+l.anim[t.anim];e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){i(this).removeClass(u)})}t.isOutAnim&&e.layero.data("isOutAnim",!0)}},s.pt.auto=function(e){var t=this,a=t.config,o=i("#"+l[0]+e);""===a.area[0]&&a.maxWidth>0&&(r.ie&&r.ie<8&&a.btn&&o.width(o.innerWidth()),o.outerWidth()>a.maxWidth&&o.width(a.maxWidth));var s=[o.innerWidth(),o.innerHeight()],f=o.find(l[1]).outerHeight()||0,c=o.find("."+l[6]).outerHeight()||0,u=function(e){e=o.find(e),e.height(s[1]-f-c-2*(0|parseFloat(e.css("padding-top"))))};switch(a.type){case 2:u("iframe");break;default:""===a.area[1]?a.maxHeight>0&&o.outerHeight()>a.maxHeight?(s[1]=a.maxHeight,u("."+l[5])):a.fixed&&s[1]>=n.height()&&(s[1]=n.height(),u("."+l[5])):u("."+l[5])}return t},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/2,e.offsetLeft=(n.width()-a[0])/2,o?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;af&&(a=f),ou&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index)}):a.success(n,t.index)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),n.find("."+l[7]).on("click",e),a.shadeClose&&i("#layui-layer-shade"+t.index).on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n);e===!1||r.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasClass("layui-layer-maxmin")?(r.restore(t.index),a.restore&&a.restore(n)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n)},100))}),a.end&&(o.end[t.index]=a.end)},o.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+l[0])[0]||1==n.attr("layer")&&i("."+l[0]).length<1&&n.removeAttr("layer").show(),n=null})},s.pt.IE6=function(e){i("select").each(function(e,t){var n=i(this);n.parents("."+l[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},s.pt.openLayer=function(){var e=this;r.zIndex=e.config.zIndex,r.setTop=function(e){var t=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",t),r.zIndex}},o.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:t})},o.rescollbar=function(e){l.html.attr("layer-full")==e&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},e.layer=r,r.getChildFrame=function(e,t){return t=t||i("."+l[4]).attr("times"),i("#"+l[0]+t).find("iframe").contents().find(e)},r.getFrameIndex=function(e){return i("#"+e).parents("."+l[4]).attr("times")},r.iframeAuto=function(e){if(e){var t=r.getChildFrame("html",e).outerHeight(),n=i("#"+l[0]+e),a=n.find(l[1]).outerHeight()||0,o=n.find("."+l[6]).outerHeight()||0;n.css({height:t+a+o}),n.find("iframe").css({height:t})}},r.iframeSrc=function(e,t){i("#"+l[0]+e).find("iframe").attr("src",t)},r.style=function(e,t,n){var a=i("#"+l[0]+e),r=a.find(".layui-layer-content"),s=a.attr("type"),f=a.find(l[1]).outerHeight()||0,c=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft");s!==o.type[3]&&s!==o.type[4]&&(n||(parseFloat(t.width)<=260&&(t.width=260),parseFloat(t.height)-f-c<=64&&(t.height=64+f+c)),a.css(t),c=a.find("."+l[6]).outerHeight(),s===o.type[2]?a.find("iframe").css({height:parseFloat(t.height)-f-c}):r.css({height:parseFloat(t.height)-f-c-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom"))}))},r.min=function(e,t){var a=i("#"+l[0]+e),s=a.find(l[1]).outerHeight()||0,f=a.attr("minLeft")||181*o.minIndex+"px",c=a.css("position");o.record(a),o.minLeft[0]&&(f=o.minLeft[0],o.minLeft.shift()),a.attr("position",c),r.style(e,{width:180,height:s,left:f,top:n.height()-s,position:"fixed",overflow:"hidden"},!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),a.attr("minLeft")||o.minIndex++,a.attr("minLeft",f)},r.restore=function(e){var t=i("#"+l[0]+e),n=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(n[0]),height:parseFloat(n[1]),top:parseFloat(n[2]),left:parseFloat(n[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===t.attr("type")&&t.find(l[4]).show(),o.rescollbar(e)},r.full=function(e){var t,a=i("#"+l[0]+e);o.record(a),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",e),clearTimeout(t),t=setTimeout(function(){var t="fixed"===a.css("position");r.style(e,{top:t?0:n.scrollTop(),left:t?0:n.scrollLeft(),width:n.width(),height:n.height()},!0),a.find(".layui-layer-min").hide()},100)},r.title=function(e,t){var n=i("#"+l[0]+(t||r.index)).find(l[1]);n.html(e)},r.close=function(e){var t=i("#"+l[0]+e),n=t.attr("type"),a="layer-anim-close";if(t[0]){var s="layui-layer-wrap",f=function(){if(n===o.type[1]&&"object"===t.attr("conType")){t.children(":not(."+l[5]+")").remove();for(var a=t.find("."+s),r=0;r<2;r++)a.unwrap();a.css("display",a.data("display")).removeClass(s)}else{if(n===o.type[2])try{var f=i("#"+l[4]+e)[0];f.contentWindow.document.write(""),f.contentWindow.close(),t.find("."+l[5])[0].removeChild(f)}catch(c){}t[0].innerHTML="",t.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e]};t.data("isOutAnim")&&t.addClass("layer-anim "+a),i("#layui-layer-moves, #layui-layer-shade"+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),t.attr("minLeft")&&(o.minIndex--,o.minLeft.push(t.attr("minLeft"))),r.ie&&r.ie<10||!t.data("isOutAnim")?f():setTimeout(function(){f()},200)}},r.closeAll=function(e){i.each(i("."+l[0]),function(){var t=i(this),n=e?t.attr("type")===e:1;n&&r.close(t.attr("times")),n=null})};var f=r.cache||{},c=function(e){return f.skin?" "+f.skin+" "+f.skin+"-"+e:""};r.prompt=function(e,t){var a="";if(e=e||{},"function"==typeof e&&(t=e),e.area){var o=e.area;a='style="width: '+o[0]+"; height: "+o[1]+';"',delete e.area}var s,l=2==e.formType?'":function(){return''}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["确定","取消"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(e){s=e.find(".layui-layer-input"),s.focus(),"function"==typeof f&&f(e)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("最多输入"+(e.maxlength||500)+"个字数",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n="layui-this",a=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,a="";if(e>0)for(a=''+t[0].title+"";i"+t[i].title+"";return a}(),content:'
          '+function(){var e=t.length,i=1,a="";if(e>0)for(a='
        • '+(t[0].content||"no content")+"
        • ";i'+(t[i].content||"no content")+"";return a}()+"
        ",success:function(t){var o=t.find(".layui-layer-title").children(),r=t.find(".layui-layer-tabmain").children();o.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var a=i(this),o=a.index();a.addClass(n).siblings().removeClass(n),r.eq(o).show().siblings().hide(),"function"==typeof e.change&&e.change(o)}),"function"==typeof a&&a(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=t.photos.constructor===Object,f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("没有图片")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0),h()}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.hover(function(){s.imgsee.show()},function(){s.imgsee.hide()}),s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev()}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext()}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),o(u[d].src,function(n){r.close(s.loadi),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]'+(u[d].alt||
        '+(u.length>1?'':"")+'
        '+(u[d].alt||"")+""+s.imgIndex+"/"+u.length+"
        ",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imguide,.layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("当前图片地址异常
        是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define(["jquery"],function(){return o.run(e.jQuery),r}):function(){o.run(e.jQuery),r.ready()}()}(window); \ No newline at end of file diff --git a/pig-visual/pig-xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/icon-ext.png b/pig-visual/pig-xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/icon-ext.png deleted file mode 100755 index bbbb669b..00000000 Binary files a/pig-visual/pig-xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/icon-ext.png and /dev/null differ diff --git a/pig-visual/pig-xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/icon.png b/pig-visual/pig-xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/icon.png deleted file mode 100755 index 3e17da8b..00000000 Binary files a/pig-visual/pig-xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/icon.png and /dev/null differ diff --git a/pig-visual/pig-xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/layer.css b/pig-visual/pig-xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/layer.css deleted file mode 100755 index 820b4a99..00000000 --- a/pig-visual/pig-xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/layer.css +++ /dev/null @@ -1 +0,0 @@ -.layui-layer-imgbar,.layui-layer-imgtit a,.layui-layer-tab .layui-layer-title span,.layui-layer-title{text-overflow:ellipsis;white-space:nowrap}html #layuicss-layer{display:none;position:absolute;width:1989px}.layui-layer,.layui-layer-shade{position:fixed;_position:absolute;pointer-events:auto}.layui-layer-shade{top:0;left:0;width:100%;height:100%;_height:expression(document.body.offsetHeight+"px")}.layui-layer{-webkit-overflow-scrolling:touch;top:150px;left:0;margin:0;padding:0;background-color:#fff;-webkit-background-clip:content;border-radius:2px;box-shadow:1px 1px 50px rgba(0,0,0,.3)}.layui-layer-close{position:absolute}.layui-layer-content{position:relative}.layui-layer-border{border:1px solid #B2B2B2;border:1px solid rgba(0,0,0,.1);box-shadow:1px 1px 5px rgba(0,0,0,.2)}.layui-layer-load{background:url(loading-1.gif) center center no-repeat #eee}.layui-layer-ico{background:url(icon.png) no-repeat}.layui-layer-btn a,.layui-layer-dialog .layui-layer-ico,.layui-layer-setwin a{display:inline-block;*display:inline;*zoom:1;vertical-align:top}.layui-layer-move{display:none;position:fixed;*position:absolute;left:0;top:0;width:100%;height:100%;cursor:move;opacity:0;filter:alpha(opacity=0);background-color:#fff;z-index:2147483647}.layui-layer-resize{position:absolute;width:15px;height:15px;right:0;bottom:0;cursor:se-resize}.layer-anim{-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.3s;animation-duration:.3s}@-webkit-keyframes layer-bounceIn{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes layer-bounceIn{0%{opacity:0;-webkit-transform:scale(.5);-ms-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}.layer-anim-00{-webkit-animation-name:layer-bounceIn;animation-name:layer-bounceIn}@-webkit-keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);-ms-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);-ms-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-01{-webkit-animation-name:layer-zoomInDown;animation-name:layer-zoomInDown}@-webkit-keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);-ms-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}.layer-anim-02{-webkit-animation-name:layer-fadeInUpBig;animation-name:layer-fadeInUpBig}@-webkit-keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);-ms-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);-ms-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-03{-webkit-animation-name:layer-zoomInLeft;animation-name:layer-zoomInLeft}@-webkit-keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0);transform:translateX(0) rotate(0)}}@keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);-ms-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0) rotate(0);-ms-transform:translateX(0) rotate(0);transform:translateX(0) rotate(0)}}.layer-anim-04{-webkit-animation-name:layer-rollIn;animation-name:layer-rollIn}@keyframes layer-fadeIn{0%{opacity:0}100%{opacity:1}}.layer-anim-05{-webkit-animation-name:layer-fadeIn;animation-name:layer-fadeIn}@-webkit-keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);transform:translateX(10px)}}@keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);-ms-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);-ms-transform:translateX(10px);transform:translateX(10px)}}.layer-anim-06{-webkit-animation-name:layer-shake;animation-name:layer-shake}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}.layui-layer-title{padding:0 80px 0 20px;height:42px;line-height:42px;border-bottom:1px solid #eee;font-size:14px;color:#333;overflow:hidden;background-color:#F8F8F8;border-radius:2px 2px 0 0}.layui-layer-setwin{position:absolute;right:15px;*right:0;top:15px;font-size:0;line-height:initial}.layui-layer-setwin a{position:relative;width:16px;height:16px;margin-left:10px;font-size:12px;_overflow:hidden}.layui-layer-setwin .layui-layer-min cite{position:absolute;width:14px;height:2px;left:0;top:50%;margin-top:-1px;background-color:#2E2D3C;cursor:pointer;_overflow:hidden}.layui-layer-setwin .layui-layer-min:hover cite{background-color:#2D93CA}.layui-layer-setwin .layui-layer-max{background-position:-32px -40px}.layui-layer-setwin .layui-layer-max:hover{background-position:-16px -40px}.layui-layer-setwin .layui-layer-maxmin{background-position:-65px -40px}.layui-layer-setwin .layui-layer-maxmin:hover{background-position:-49px -40px}.layui-layer-setwin .layui-layer-close1{background-position:1px -40px;cursor:pointer}.layui-layer-setwin .layui-layer-close1:hover{opacity:.7}.layui-layer-setwin .layui-layer-close2{position:absolute;right:-28px;top:-28px;width:30px;height:30px;margin-left:0;background-position:-149px -31px;*right:-18px;_display:none}.layui-layer-setwin .layui-layer-close2:hover{background-position:-180px -31px}.layui-layer-btn{text-align:right;padding:0 15px 12px;pointer-events:auto;user-select:none;-webkit-user-select:none}.layui-layer-btn a{height:28px;line-height:28px;margin:5px 5px 0;padding:0 15px;border:1px solid #dedede;background-color:#fff;color:#333;border-radius:2px;font-weight:400;cursor:pointer;text-decoration:none}.layui-layer-btn a:hover{opacity:.9;text-decoration:none}.layui-layer-btn a:active{opacity:.8}.layui-layer-btn .layui-layer-btn0{border-color:#1E9FFF;background-color:#1E9FFF;color:#fff}.layui-layer-btn-l{text-align:left}.layui-layer-btn-c{text-align:center}.layui-layer-dialog{min-width:260px}.layui-layer-dialog .layui-layer-content{position:relative;padding:20px;line-height:24px;word-break:break-all;overflow:hidden;font-size:14px;overflow-x:hidden;overflow-y:auto}.layui-layer-dialog .layui-layer-content .layui-layer-ico{position:absolute;top:16px;left:15px;_left:-40px;width:30px;height:30px}.layui-layer-ico1{background-position:-30px 0}.layui-layer-ico2{background-position:-60px 0}.layui-layer-ico3{background-position:-90px 0}.layui-layer-ico4{background-position:-120px 0}.layui-layer-ico5{background-position:-150px 0}.layui-layer-ico6{background-position:-180px 0}.layui-layer-rim{border:6px solid #8D8D8D;border:6px solid rgba(0,0,0,.3);border-radius:5px;box-shadow:none}.layui-layer-msg{min-width:180px;border:1px solid #D3D4D3;box-shadow:none}.layui-layer-hui{min-width:100px;background-color:#000;filter:alpha(opacity=60);background-color:rgba(0,0,0,.6);color:#fff;border:none}.layui-layer-hui .layui-layer-content{padding:12px 25px;text-align:center}.layui-layer-dialog .layui-layer-padding{padding:20px 20px 20px 55px;text-align:left}.layui-layer-page .layui-layer-content{position:relative;overflow:auto}.layui-layer-iframe .layui-layer-btn,.layui-layer-page .layui-layer-btn{padding-top:10px}.layui-layer-nobg{background:0 0}.layui-layer-iframe iframe{display:block;width:100%}.layui-layer-loading{border-radius:100%;background:0 0;box-shadow:none;border:none}.layui-layer-loading .layui-layer-content{width:60px;height:24px;background:url(loading-0.gif) no-repeat}.layui-layer-loading .layui-layer-loading1{width:37px;height:37px;background:url(loading-1.gif) no-repeat}.layui-layer-ico16,.layui-layer-loading .layui-layer-loading2{width:32px;height:32px;background:url(loading-2.gif) no-repeat}.layui-layer-tips{background:0 0;box-shadow:none;border:none}.layui-layer-tips .layui-layer-content{position:relative;line-height:22px;min-width:12px;padding:8px 15px;font-size:12px;_float:left;border-radius:2px;box-shadow:1px 1px 3px rgba(0,0,0,.2);background-color:#000;color:#fff}.layui-layer-tips .layui-layer-close{right:-2px;top:-1px}.layui-layer-tips i.layui-layer-TipsG{position:absolute;width:0;height:0;border-width:8px;border-color:transparent;border-style:dashed;*overflow:hidden}.layui-layer-tips i.layui-layer-TipsB,.layui-layer-tips i.layui-layer-TipsT{left:5px;border-right-style:solid;border-right-color:#000}.layui-layer-tips i.layui-layer-TipsT{bottom:-8px}.layui-layer-tips i.layui-layer-TipsB{top:-8px}.layui-layer-tips i.layui-layer-TipsL,.layui-layer-tips i.layui-layer-TipsR{top:5px;border-bottom-style:solid;border-bottom-color:#000}.layui-layer-tips i.layui-layer-TipsR{left:-8px}.layui-layer-tips i.layui-layer-TipsL{right:-8px}.layui-layer-lan[type=dialog]{min-width:280px}.layui-layer-lan .layui-layer-title{background:#4476A7;color:#fff;border:none}.layui-layer-lan .layui-layer-btn{padding:5px 10px 10px;text-align:right;border-top:1px solid #E9E7E7}.layui-layer-lan .layui-layer-btn a{background:#fff;border-color:#E9E7E7;color:#333}.layui-layer-lan .layui-layer-btn .layui-layer-btn1{background:#C9C5C5}.layui-layer-molv .layui-layer-title{background:#009f95;color:#fff;border:none}.layui-layer-molv .layui-layer-btn a{background:#009f95;border-color:#009f95}.layui-layer-molv .layui-layer-btn .layui-layer-btn1{background:#92B8B1}.layui-layer-iconext{background:url(icon-ext.png) no-repeat}.layui-layer-prompt .layui-layer-input{display:block;width:230px;height:36px;margin:0 auto;line-height:30px;padding-left:10px;border:1px solid #e6e6e6;color:#333}.layui-layer-prompt textarea.layui-layer-input{width:300px;height:100px;line-height:20px;padding:6px 10px}.layui-layer-prompt .layui-layer-content{padding:20px}.layui-layer-prompt .layui-layer-btn{padding-top:0}.layui-layer-tab{box-shadow:1px 1px 50px rgba(0,0,0,.4)}.layui-layer-tab .layui-layer-title{padding-left:0;overflow:visible}.layui-layer-tab .layui-layer-title span{position:relative;float:left;min-width:80px;max-width:260px;padding:0 20px;text-align:center;overflow:hidden;cursor:pointer}.layui-layer-tab .layui-layer-title span.layui-this{height:43px;border-left:1px solid #eee;border-right:1px solid #eee;background-color:#fff;z-index:10}.layui-layer-tab .layui-layer-title span:first-child{border-left:none}.layui-layer-tabmain{line-height:24px;clear:both}.layui-layer-tabmain .layui-layer-tabli{display:none}.layui-layer-tabmain .layui-layer-tabli.layui-this{display:block}.layui-layer-photos{-webkit-animation-duration:.8s;animation-duration:.8s}.layui-layer-photos .layui-layer-content{overflow:hidden;text-align:center}.layui-layer-photos .layui-layer-phimg img{position:relative;width:100%;display:inline-block;*display:inline;*zoom:1;vertical-align:top}.layui-layer-imgbar,.layui-layer-imguide{display:none}.layui-layer-imgnext,.layui-layer-imgprev{position:absolute;top:50%;width:27px;_width:44px;height:44px;margin-top:-22px;outline:0;blr:expression(this.onFocus=this.blur())}.layui-layer-imgprev{left:10px;background-position:-5px -5px;_background-position:-70px -5px}.layui-layer-imgprev:hover{background-position:-33px -5px;_background-position:-120px -5px}.layui-layer-imgnext{right:10px;_right:8px;background-position:-5px -50px;_background-position:-70px -50px}.layui-layer-imgnext:hover{background-position:-33px -50px;_background-position:-120px -50px}.layui-layer-imgbar{position:absolute;left:0;bottom:0;width:100%;height:32px;line-height:32px;background-color:rgba(0,0,0,.8);background-color:#000\9;filter:Alpha(opacity=80);color:#fff;overflow:hidden;font-size:0}.layui-layer-imgtit *{display:inline-block;*display:inline;*zoom:1;vertical-align:top;font-size:12px}.layui-layer-imgtit a{max-width:65%;overflow:hidden;color:#fff}.layui-layer-imgtit a:hover{color:#fff;text-decoration:underline}.layui-layer-imgtit em{padding-left:10px;font-style:normal}@-webkit-keyframes layer-bounceOut{100%{opacity:0;-webkit-transform:scale(.7);transform:scale(.7)}30%{-webkit-transform:scale(1.05);transform:scale(1.05)}0%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes layer-bounceOut{100%{opacity:0;-webkit-transform:scale(.7);-ms-transform:scale(.7);transform:scale(.7)}30%{-webkit-transform:scale(1.05);-ms-transform:scale(1.05);transform:scale(1.05)}0%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}.layer-anim-close{-webkit-animation-name:layer-bounceOut;animation-name:layer-bounceOut;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.2s;animation-duration:.2s}@media screen and (max-width:1100px){.layui-layer-iframe{overflow-y:auto;-webkit-overflow-scrolling:touch}} \ No newline at end of file diff --git a/pig-visual/pig-xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/loading-0.gif b/pig-visual/pig-xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/loading-0.gif deleted file mode 100755 index 6f3c9539..00000000 Binary files a/pig-visual/pig-xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/loading-0.gif and /dev/null differ diff --git a/pig-visual/pig-xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/loading-1.gif b/pig-visual/pig-xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/loading-1.gif deleted file mode 100755 index db3a483e..00000000 Binary files a/pig-visual/pig-xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/loading-1.gif and /dev/null differ diff --git a/pig-visual/pig-xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/loading-2.gif b/pig-visual/pig-xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/loading-2.gif deleted file mode 100755 index 5bb90fd6..00000000 Binary files a/pig-visual/pig-xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/loading-2.gif and /dev/null differ diff --git a/pig-visual/pig-xxl-job-admin/src/main/resources/templates/common/common.exception.ftl b/pig-visual/pig-xxl-job-admin/src/main/resources/templates/common/common.exception.ftl deleted file mode 100755 index e448125e..00000000 --- a/pig-visual/pig-xxl-job-admin/src/main/resources/templates/common/common.exception.ftl +++ /dev/null @@ -1,31 +0,0 @@ - - - - - Error - - - - - - -
        -

        System Error

        -

        ${exceptionMsg}

        - Back -

        -
        - - - \ No newline at end of file diff --git a/pig-visual/pig-xxl-job-admin/src/main/resources/templates/common/common.macro.ftl b/pig-visual/pig-xxl-job-admin/src/main/resources/templates/common/common.macro.ftl deleted file mode 100755 index aace849f..00000000 --- a/pig-visual/pig-xxl-job-admin/src/main/resources/templates/common/common.macro.ftl +++ /dev/null @@ -1,239 +0,0 @@ -<#macro commonStyle> - - <#-- favicon --> - - - - - - - - - - - - - - - - - - - - - - - - - <#-- i18n --> - <#global I18n = I18nUtil.getMultString()?eval /> - - - -<#macro commonScript> - - - - - - - - - - - - - - <#-- jquery cookie --> - - <#-- jquery.validate --> - - - <#-- layer --> - - - <#-- common --> - - - - - -<#macro commonHeader> -
        - - -
        - - - - - - -<#macro commonLeft pageName > - - - - -<#macro commonControl > - - - - -
        - - -<#macro commonFooter > -
        - Powered by XXL-JOB ${I18n.admin_version} - -
        - \ No newline at end of file diff --git a/pig-visual/pig-xxl-job-admin/src/main/resources/templates/help.ftl b/pig-visual/pig-xxl-job-admin/src/main/resources/templates/help.ftl deleted file mode 100755 index 1409fc50..00000000 --- a/pig-visual/pig-xxl-job-admin/src/main/resources/templates/help.ftl +++ /dev/null @@ -1,47 +0,0 @@ - - - - <#import "./common/common.macro.ftl" as netCommon> - <@netCommon.commonStyle /> - ${I18n.admin_name} - -sidebar-collapse "> -
        - - <@netCommon.commonHeader /> - - <@netCommon.commonLeft "help" /> - - -
        - -
        -

        ${I18n.job_help}

        -
        - - -
        -
        -

        ${I18n.admin_name_full}

        -
        -

        - Github     - -

        - ${I18n.job_help_document} -

        - -

        -

        -
        -
        - -
        - - - - <@netCommon.commonFooter /> -
        -<@netCommon.commonScript /> - - diff --git a/pig-visual/pig-xxl-job-admin/src/main/resources/templates/index.ftl b/pig-visual/pig-xxl-job-admin/src/main/resources/templates/index.ftl deleted file mode 100755 index d642f4e6..00000000 --- a/pig-visual/pig-xxl-job-admin/src/main/resources/templates/index.ftl +++ /dev/null @@ -1,147 +0,0 @@ - - - - <#import "./common/common.macro.ftl" as netCommon> - <@netCommon.commonStyle /> - - - ${I18n.admin_name} - -sidebar-collapse "> -
        - - <@netCommon.commonHeader /> - - <@netCommon.commonLeft "index" /> - - -
        - -
        -

        ${I18n.job_dashboard_name}

        - -
        - - -
        - - -
        - - <#-- 任务信息 --> -
        -
        - - -
        - ${I18n.job_dashboard_job_num} - ${jobInfoCount} - -
        -
        -
        - ${I18n.job_dashboard_job_num_tip} -
        -
        -
        - - <#-- 调度信息 --> -
        -
        - - -
        - ${I18n.job_dashboard_trigger_num} - ${jobLogCount} - -
        -
        -
        - - ${I18n.job_dashboard_trigger_num_tip} - <#--<#if jobLogCount gt 0> - 调度成功率:${(jobLogSuccessCount*100/jobLogCount)?string("0.00")}% - --> - -
        -
        -
        - - <#-- 执行器 --> -
        -
        - - -
        - ${I18n.job_dashboard_jobgroup_num} - ${executorCount} - -
        -
        -
        - ${I18n.job_dashboard_jobgroup_num_tip} -
        -
        -
        - -
        - - <#-- 调度报表:时间区间筛选,左侧折线图 + 右侧饼图 --> -
        -
        -
        -
        -

        ${I18n.job_dashboard_report}

        - <#----> - - -
        - - <#----> -
        - - -
        -
        -
        - <#-- 左侧折线图 --> -
        -
        -
        - <#-- 右侧饼图 --> -
        -
        -
        -
        -
        -
        -
        -
        - -
        - -
        - - - - <@netCommon.commonFooter /> -
        -<@netCommon.commonScript /> - - - -<#-- echarts --> - - - - diff --git a/pig-visual/pig-xxl-job-admin/src/main/resources/templates/jobcode/jobcode.index.ftl b/pig-visual/pig-xxl-job-admin/src/main/resources/templates/jobcode/jobcode.index.ftl deleted file mode 100755 index a386b288..00000000 --- a/pig-visual/pig-xxl-job-admin/src/main/resources/templates/jobcode/jobcode.index.ftl +++ /dev/null @@ -1,164 +0,0 @@ - - - - <#import "../common/common.macro.ftl" as netCommon> - <@netCommon.commonStyle /> - - - ${I18n.admin_name} - - - - -
        - -
        - -
        - -
        - - - <#--<@netCommon.commonFooter />--> -
        - - - - -<@netCommon.commonScript /> - - - <#assign glueTypeModeSrc = "${request.contextPath}/static/plugins/codemirror/mode/clike/clike.js" /> - <#assign glueTypeIdeMode = "text/x-java" /> - - <#if jobInfo.glueType == "GLUE_GROOVY" > - <#assign glueTypeModeSrc = "${request.contextPath}/static/plugins/codemirror/mode/clike/clike.js" /> - <#assign glueTypeIdeMode = "text/x-java" /> - <#elseif jobInfo.glueType == "GLUE_SHELL" > - <#assign glueTypeModeSrc = "${request.contextPath}/static/plugins/codemirror/mode/shell/shell.js" /> - <#assign glueTypeIdeMode = "text/x-sh" /> - <#elseif jobInfo.glueType == "GLUE_PYTHON" > - <#assign glueTypeModeSrc = "${request.contextPath}/static/plugins/codemirror/mode/python/python.js" /> - <#assign glueTypeIdeMode = "text/x-python" /> - <#elseif jobInfo.glueType == "GLUE_PHP" > - <#assign glueTypeModeSrc = "${request.contextPath}/static/plugins/codemirror/mode/php/php.js" /> - <#assign glueTypeIdeMode = "text/x-php" /> - <#assign glueTypeModeSrc02 = "${request.contextPath}/static/plugins/codemirror/mode/clike/clike.js" /> - <#elseif jobInfo.glueType == "GLUE_NODEJS" > - <#assign glueTypeModeSrc = "${request.contextPath}/static/plugins/codemirror/mode/javascript/javascript.js" /> - <#assign glueTypeIdeMode = "text/javascript" /> - <#elseif jobInfo.glueType == "GLUE_POWERSHELL" > - <#assign glueTypeModeSrc = "${request.contextPath}/static/plugins/codemirror/mode/powershell/powershell.js" /> - <#assign glueTypeIdeMode = "powershell" /> - - - - - -<#if glueTypeModeSrc02?exists> - - - - - - - - - - diff --git a/pig-visual/pig-xxl-job-admin/src/main/resources/templates/jobgroup/jobgroup.index.ftl b/pig-visual/pig-xxl-job-admin/src/main/resources/templates/jobgroup/jobgroup.index.ftl deleted file mode 100755 index 778df9ec..00000000 --- a/pig-visual/pig-xxl-job-admin/src/main/resources/templates/jobgroup/jobgroup.index.ftl +++ /dev/null @@ -1,172 +0,0 @@ - - - - <#import "../common/common.macro.ftl" as netCommon> - <@netCommon.commonStyle /> - - - ${I18n.admin_name} - -sidebar-collapse "> -
        - - <@netCommon.commonHeader /> - - <@netCommon.commonLeft "jobgroup" /> - - -
        - -
        -

        ${I18n.jobgroup_name}

        -
        - - -
        - -
        -
        -
        - AppName - -
        -
        -
        -
        - ${I18n.jobgroup_field_title} - -
        -
        -
        - -
        -
        - -
        -
        - -
        -
        -
        -
        - - - - - - - - - - - - - -
        IDAppName${I18n.jobgroup_field_title}${I18n.jobgroup_field_addressType}OnLine ${I18n.jobgroup_field_registryList}${I18n.system_opt}
        -
        -
        -
        -
        -
        -
        - - - - - - - - - <@netCommon.commonFooter /> -
        - -<@netCommon.commonScript /> - - - - - - diff --git a/pig-visual/pig-xxl-job-admin/src/main/resources/templates/jobinfo/jobinfo.index.ftl b/pig-visual/pig-xxl-job-admin/src/main/resources/templates/jobinfo/jobinfo.index.ftl deleted file mode 100755 index 3a5d7d8a..00000000 --- a/pig-visual/pig-xxl-job-admin/src/main/resources/templates/jobinfo/jobinfo.index.ftl +++ /dev/null @@ -1,540 +0,0 @@ - - - - <#import "../common/common.macro.ftl" as netCommon> - <@netCommon.commonStyle /> - - - ${I18n.admin_name} - -sidebar-collapse"> -
        - - <@netCommon.commonHeader /> - - <@netCommon.commonLeft "jobinfo" /> - - -
        - -
        -

        ${I18n.jobinfo_name}

        -
        - - -
        - -
        -
        -
        - ${I18n.jobinfo_field_jobgroup} - -
        -
        -
        -
        - -
        -
        -
        -
        - -
        -
        -
        -
        - -
        -
        -
        -
        - -
        -
        -
        - -
        -
        - -
        -
        - -
        -
        -
        - <#--
        -

        调度列表

        -
        --> -
        - - - - - - - - - - - - - - - - - - - -
        ${I18n.jobinfo_field_id}${I18n.jobinfo_field_jobgroup}${I18n.jobinfo_field_jobdesc}${I18n.schedule_type}${I18n.jobinfo_field_gluetype}${I18n.jobinfo_field_executorparam}addTimeupdateTime${I18n.jobinfo_field_author}${I18n.jobinfo_field_alarmemail}${I18n.system_status}${I18n.system_opt}
        -
        -
        -
        -
        -
        -
        - - - <@netCommon.commonFooter /> -
        - - - - - - - -<#-- trigger --> - - -<@netCommon.commonScript /> - - - - - -<#-- cronGen --> - - - - diff --git a/pig-visual/pig-xxl-job-admin/src/main/resources/templates/joblog/joblog.detail.ftl b/pig-visual/pig-xxl-job-admin/src/main/resources/templates/joblog/joblog.detail.ftl deleted file mode 100644 index bb8072f9..00000000 --- a/pig-visual/pig-xxl-job-admin/src/main/resources/templates/joblog/joblog.detail.ftl +++ /dev/null @@ -1,70 +0,0 @@ - - - - <#import "../common/common.macro.ftl" as netCommon> - <@netCommon.commonStyle /> - ${I18n.admin_name} - - - -
        - -
        - -
        - -
        -
        -
        -                
        -
      • -
        -
        -
        - - - <@netCommon.commonFooter /> - -
        - -<@netCommon.commonScript /> - - - - - \ No newline at end of file diff --git a/pig-visual/pig-xxl-job-admin/src/main/resources/templates/joblog/joblog.index.ftl b/pig-visual/pig-xxl-job-admin/src/main/resources/templates/joblog/joblog.index.ftl deleted file mode 100755 index a2e983de..00000000 --- a/pig-visual/pig-xxl-job-admin/src/main/resources/templates/joblog/joblog.index.ftl +++ /dev/null @@ -1,180 +0,0 @@ - - - - <#import "../common/common.macro.ftl" as netCommon> - <@netCommon.commonStyle /> - - - - - ${I18n.admin_name} - -sidebar-collapse "> -
        - - <@netCommon.commonHeader /> - - <@netCommon.commonLeft "joblog" /> - - -
        - -
        -

        ${I18n.joblog_name}

        -
        - - -
        -
        -
        -
        - ${I18n.jobinfo_field_jobgroup} - -
        -
        -
        -
        - ${I18n.jobinfo_job} - -
        -
        - -
        -
        - ${I18n.joblog_status} - -
        -
        - -
        -
        - - ${I18n.joblog_field_triggerTime} - - -
        -
        - -
        - -
        - -
        - -
        -
        - -
        -
        -
        - <#--

        调度日志

        --> -
        - - - - - - <#-- - - --> - - - - - - - - - - -
        ${I18n.jobinfo_field_id}jobGroup执行器地址运行模式任务参数${I18n.joblog_field_triggerTime}${I18n.joblog_field_triggerCode}${I18n.joblog_field_triggerMsg}${I18n.joblog_field_handleTime}${I18n.joblog_field_handleCode}${I18n.joblog_field_handleMsg}${I18n.system_opt}
        -
        -
        -
        -
        -
        -
        - - - <@netCommon.commonFooter /> -
        - - - - -<@netCommon.commonScript /> - - - - - - - - - diff --git a/pig-visual/pig-xxl-job-admin/src/main/resources/templates/login.ftl b/pig-visual/pig-xxl-job-admin/src/main/resources/templates/login.ftl deleted file mode 100755 index c3f69638..00000000 --- a/pig-visual/pig-xxl-job-admin/src/main/resources/templates/login.ftl +++ /dev/null @@ -1,45 +0,0 @@ - - - - <#import "./common/common.macro.ftl" as netCommon> - <@netCommon.commonStyle /> - - ${I18n.admin_name} - - - -<@netCommon.commonScript /> - - - - - diff --git a/pig-visual/pig-xxl-job-admin/src/main/resources/templates/user/user.index.ftl b/pig-visual/pig-xxl-job-admin/src/main/resources/templates/user/user.index.ftl deleted file mode 100755 index 01203982..00000000 --- a/pig-visual/pig-xxl-job-admin/src/main/resources/templates/user/user.index.ftl +++ /dev/null @@ -1,188 +0,0 @@ - - - - <#import "../common/common.macro.ftl" as netCommon> - <@netCommon.commonStyle /> - - - ${I18n.admin_name} - -sidebar-collapse"> -
        - - <@netCommon.commonHeader /> - - <@netCommon.commonLeft "user" /> - - -
        - -
        -

        ${I18n.user_manage}

        -
        - - -
        - -
        -
        -
        - ${I18n.user_role} - -
        -
        -
        -
        - ${I18n.user_username} - -
        -
        -
        - -
        -
        - -
        -
        - -
        -
        -
        -
        - - - - - - - - - - - - - -
        ID${I18n.user_username}${I18n.user_password}${I18n.user_role}${I18n.user_permission}${I18n.system_opt}
        -
        -
        -
        -
        -
        -
        - - - <@netCommon.commonFooter /> -
        - - - - - - - -<@netCommon.commonScript /> - - - - - - diff --git a/pig-visual/pom.xml b/pig-visual/pom.xml index 9469be1b..dc772450 100755 --- a/pig-visual/pom.xml +++ b/pig-visual/pom.xml @@ -21,7 +21,7 @@ com.pig4cloud pig - 3.6.7 + 3.7.0-JDK8 pig-visual @@ -31,8 +31,7 @@ pig-codegen + pig-quartz pig-monitor - pig-sentinel-dashboard - pig-xxl-job-admin diff --git a/pom.xml b/pom.xml index 53f5f1d4..904ad576 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ com.pig4cloud pig ${project.artifactId} - 3.6.7 + 3.7.0-JDK8 pom https://www.pig4cloud.com @@ -35,8 +35,8 @@ 1.8 2.7.10 0.4.3 - 3.6.0 2.2.2 + 0.0.1 2.3 3.1 1.10