mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-08 12:39:05 +08:00
Merge branch 'leng_dev' of https://git.pig4cloud.com/pigx/pigx into lucky_dev
Conflicts: docker-compose.yml
This commit is contained in:
commit
04353a43b7
414 files changed
+8608
-7403
No files matched your search
@@ -1,13 +1,11 @@
|
||||
### 环境信息 (*)
|
||||
### 环境信息 (必填)
|
||||
|
||||
- pigx版本:
|
||||
- 是否修改包名:
|
||||
|
||||
### 描述(无法理解工单,将直接关闭)
|
||||
|
||||
### 问题描述(*)
|
||||
|
||||
|
||||
### 详细回显步骤
|
||||
日志、截图、回显步骤
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,19 +3,9 @@
|
||||
pigX并非一个开源软件,作者保留全部的权利。
|
||||
擅自窃用,即属严重侵权行为,与盗窃无异。产生的一切任何后果责任由侵权者自负。
|
||||
|
||||
### 🌹权益
|
||||
|
||||
1. 个人使用
|
||||
2. 允许用于学习、毕设等。
|
||||
|
||||
### 🚫禁止
|
||||
|
||||
1. 将本项目的部分或全部代码和资源进行任何形式的再发行(尤其上传GitHub、Gitee )
|
||||
2. 利用本项目的部分或全部代码和资源进行`任何商业行为`
|
||||
|
||||
### 免责声明
|
||||
|
||||
PigX 未对任何组织、团队,书面授权商业使用。如若出现任何商业后果、纠纷和本人无关,特此声明
|
||||
将本项目的部分或全部代码和资源进行任何形式的再发行(上传GitHub、Gitee )
|
||||
|
||||
## 贡献代码
|
||||
|
||||
|
||||
+159
-213
@@ -11,8 +11,8 @@ CREATE TABLE `sys_dept` (
|
||||
`dept_id` int(20) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(50) DEFAULT NULL,
|
||||
`sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序',
|
||||
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`del_flag` char(1) DEFAULT '0',
|
||||
`parent_id` int(11) DEFAULT NULL,
|
||||
`tenant_id` int(11) DEFAULT NULL,
|
||||
@@ -71,6 +71,7 @@ INSERT INTO `sys_dept_relation` VALUES (7, 12);
|
||||
INSERT INTO `sys_dept_relation` VALUES (8, 8);
|
||||
COMMIT;
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_dict
|
||||
-- ----------------------------
|
||||
@@ -79,15 +80,15 @@ CREATE TABLE `sys_dict` (
|
||||
`id` int(64) NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||
`type` varchar(100) DEFAULT NULL,
|
||||
`description` varchar(100) DEFAULT NULL,
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`remarks` varchar(255) DEFAULT NULL,
|
||||
`system` char(1) DEFAULT '0',
|
||||
`del_flag` char(1) DEFAULT '0',
|
||||
`tenant_id` int(11) NOT NULL DEFAULT '0' COMMENT '所属租户',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `sys_dict_del_flag` (`del_flag`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8mb4 COMMENT='字典表';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8mb4 COMMENT='字典表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_dict
|
||||
@@ -104,25 +105,13 @@ INSERT INTO `sys_dict` VALUES (8, 'gender', '性别', '2019-03-27 13:44:06', '20
|
||||
INSERT INTO `sys_dict` VALUES (9, 'subscribe', '订阅状态', '2019-03-27 13:48:33', '2019-03-27 13:48:33', '公众号订阅状态', '1', '0', 1);
|
||||
INSERT INTO `sys_dict` VALUES (10, 'response_type', '回复', '2019-03-28 21:29:21', '2019-03-28 21:29:21', '微信消息是否已回复', '1', '0', 1);
|
||||
INSERT INTO `sys_dict` VALUES (11, 'param_type', '参数配置', '2019-04-29 18:20:47', '2019-04-29 18:20:47', '检索、原文、报表、安全、文档、消息、其他', '1', '0', 1);
|
||||
INSERT INTO `sys_dict` VALUES (12, 'tenant_status_type', '租户状态', '2019-05-15 16:31:08', '2019-05-15 16:31:08', '租户状态', '1', '0', 1);
|
||||
INSERT INTO `sys_dict` VALUES (12, 'status_type', '租户状态', '2019-05-15 16:31:08', '2019-05-15 16:31:08', '租户状态', '1', '0', 1);
|
||||
INSERT INTO `sys_dict` VALUES (13, 'dict_type', '字典类型', '2019-05-16 14:16:20', '2019-05-16 14:20:16', '系统类不能修改', '1', '0', 1);
|
||||
INSERT INTO `sys_dict` VALUES (14, 'channel_status', '支付渠道状态', '2019-05-30 16:14:43', '2019-05-30 16:14:43', '支付渠道状态(0-正常,1-冻结)', '0', '0', 1);
|
||||
INSERT INTO `sys_dict` VALUES (15, 'channel_id', '渠道编码ID', '2019-05-30 18:59:12', '2019-05-30 18:59:12', '不同的支付方式', '0', '0', 1);
|
||||
INSERT INTO `sys_dict` VALUES (16, 'order_status', '订单状态', '2019-06-27 08:17:40', '2019-06-27 08:17:40', '支付订单状态', '0', '0', 1);
|
||||
INSERT INTO `sys_dict` VALUES (17, 'grant_types', '授权类型', '2019-08-13 07:34:10', '2019-08-13 07:34:10', NULL, '0', '0', 1);
|
||||
INSERT INTO `sys_dict` VALUES (18, 'log_type', '日志类型', '2019-03-19 11:06:44', '2019-03-19 11:06:44', '异常、正常', '1', '0', 2);
|
||||
INSERT INTO `sys_dict` VALUES (19, 'social_type', '社交登录', '2019-03-19 11:09:44', '2019-03-19 11:09:44', '微信、QQ', '1', '0', 2);
|
||||
INSERT INTO `sys_dict` VALUES (20, 'leave_status', '请假状态', '2019-03-19 11:09:44', '2019-03-19 11:09:44', '未提交、审批中、完成、驳回', '1', '0', 2);
|
||||
INSERT INTO `sys_dict` VALUES (21, 'job_type', '定时任务类型', '2019-03-19 11:22:21', '2019-03-19 11:22:21', 'quartz', '1', '0', 2);
|
||||
INSERT INTO `sys_dict` VALUES (22, 'job_status', '定时任务状态', '2019-03-19 11:24:57', '2019-03-19 11:24:57', '发布状态、运行状态', '1', '0', 2);
|
||||
INSERT INTO `sys_dict` VALUES (23, 'job_execute_status', '定时任务执行状态', '2019-03-19 11:26:15', '2019-03-19 11:26:15', '正常、异常', '1', '0', 2);
|
||||
INSERT INTO `sys_dict` VALUES (24, 'misfire_policy', '定时任务错失执行策略', '2019-03-19 11:27:19', '2019-03-19 11:27:19', '周期', '1', '0', 2);
|
||||
INSERT INTO `sys_dict` VALUES (25, 'gender', '性别', '2019-03-27 13:44:06', '2019-03-27 13:44:06', '微信用户性别', '1', '0', 2);
|
||||
INSERT INTO `sys_dict` VALUES (26, 'subscribe', '订阅状态', '2019-03-27 13:48:33', '2019-03-27 13:48:33', '公众号订阅状态', '1', '0', 2);
|
||||
INSERT INTO `sys_dict` VALUES (27, 'response_type', '回复', '2019-03-28 21:29:21', '2019-03-28 21:29:21', '微信消息是否已回复', '1', '0', 2);
|
||||
INSERT INTO `sys_dict` VALUES (28, 'param_type', '参数配置', '2019-04-29 18:20:47', '2019-04-29 18:20:47', '检索、原文、报表、安全、文档、消息、其他', '1', '0', 2);
|
||||
INSERT INTO `sys_dict` VALUES (29, 'tenant_status_type', '租户状态', '2019-05-15 16:31:08', '2019-05-15 16:31:08', '租户状态', '1', '0', 2);
|
||||
INSERT INTO `sys_dict` VALUES (30, 'dict_type', '字典类型', '2019-05-16 14:16:20', '2019-05-16 14:20:16', '系统类不能修改', '1', '0', 2);
|
||||
INSERT INTO `sys_dict` VALUES (14, 'channel_status', '支付渠道状态', '2019-05-30 16:14:43', '2019-05-30 16:14:43', '支付渠道状态(0-正常,1-冻结)', '1', '0', 1);
|
||||
INSERT INTO `sys_dict` VALUES (15, 'channel_id', '渠道编码ID', '2019-05-30 18:59:12', '2019-05-30 18:59:12', '不同的支付方式', '1', '0', 1);
|
||||
INSERT INTO `sys_dict` VALUES (16, 'order_status', '订单状态', '2019-06-27 08:17:40', '2019-06-27 08:17:40', '支付订单状态', '1', '0', 1);
|
||||
INSERT INTO `sys_dict` VALUES (17, 'grant_types', '授权类型', '2019-08-13 07:34:10', '2019-08-13 07:34:10', NULL, '1', '0', 1);
|
||||
INSERT INTO `sys_dict` VALUES (18, 'style_type', '前端风格', '2020-02-07 03:49:28', '2020-02-07 03:50:40', '0-Avue 1-element', '1', '0', 1);
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
@@ -137,8 +126,8 @@ CREATE TABLE `sys_dict_item` (
|
||||
`type` varchar(100) DEFAULT NULL,
|
||||
`description` varchar(100) DEFAULT NULL,
|
||||
`sort` int(10) NOT NULL DEFAULT '0' COMMENT '排序(升序)',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`remarks` varchar(255) DEFAULT NULL,
|
||||
`del_flag` char(1) DEFAULT '0',
|
||||
`tenant_id` int(11) NOT NULL DEFAULT '0' COMMENT '所属租户',
|
||||
@@ -146,7 +135,7 @@ CREATE TABLE `sys_dict_item` (
|
||||
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 AUTO_INCREMENT=96 DEFAULT CHARSET=utf8mb4 COMMENT='字典项';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=58 DEFAULT CHARSET=utf8mb4 COMMENT='字典项';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_dict_item
|
||||
@@ -207,46 +196,8 @@ INSERT INTO `sys_dict_item` VALUES (52, 17, 'authorization_code', '授权码模
|
||||
INSERT INTO `sys_dict_item` VALUES (53, 17, 'client_credentials', '客户端模式', 'grant_types', 'oauth2 客户端模式', 2, '2019-08-13 07:36:30', '2019-08-13 07:36:30', NULL, '0', 1);
|
||||
INSERT INTO `sys_dict_item` VALUES (54, 17, 'refresh_token', '刷新模式', 'grant_types', 'oauth2 刷新token', 3, '2019-08-13 07:36:54', '2019-08-13 07:36:54', NULL, '0', 1);
|
||||
INSERT INTO `sys_dict_item` VALUES (55, 17, 'implicit', '简化模式', 'grant_types', 'oauth2 简化模式', 4, '2019-08-13 07:39:32', '2019-08-13 07:39:32', NULL, '0', 1);
|
||||
INSERT INTO `sys_dict_item` VALUES (56, 18, '9', '异常', 'log_type', '日志异常', 1, '2019-03-19 11:08:59', '2019-03-25 12:49:13', NULL, '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (57, 18, '0', '正常', 'log_type', '日志正常', 0, '2019-03-19 11:09:17', '2019-03-25 12:49:18', NULL, '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (58, 19, 'WX', '微信', 'social_type', '微信登录', 0, '2019-03-19 11:10:02', '2019-03-25 12:49:36', NULL, '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (59, 19, 'QQ', 'QQ', 'social_type', 'QQ登录', 1, '2019-03-19 11:10:14', '2019-03-25 12:49:36', NULL, '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (60, 19, 'GITEE', '码云', 'social_type', '码云', 2, '2019-06-28 09:59:12', '2019-06-28 09:59:12', '码云', '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (61, 19, 'OSC', '开源中国', 'social_type', '开源中国登录', 0, '2019-06-28 10:04:32', '2019-06-28 10:04:32', 'http://gitee.huaxiadaowei.com/#/authredirect', '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (62, 20, '0', '未提交', 'leave_status', '未提交', 0, '2019-03-19 11:18:34', '2019-03-25 12:49:36', NULL, '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (63, 20, '1', '审批中', 'leave_status', '审批中', 1, '2019-03-19 11:18:45', '2019-03-25 12:49:36', NULL, '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (64, 20, '2', '完成', 'leave_status', '完成', 2, '2019-03-19 11:19:02', '2019-03-25 12:49:36', NULL, '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (65, 20, '9', '驳回', 'leave_status', '驳回', 9, '2019-03-19 11:19:20', '2019-03-25 12:49:36', NULL, '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (66, 21, '1', 'java类', 'job_type', 'java类', 1, '2019-03-19 11:22:37', '2019-03-25 12:49:36', NULL, '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (67, 21, '2', 'spring bean', 'job_type', 'spring bean容器实例', 2, '2019-03-19 11:23:05', '2019-03-25 12:49:36', NULL, '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (68, 21, '9', '其他', 'job_type', '其他类型', 9, '2019-03-19 11:23:31', '2019-03-25 12:49:36', NULL, '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (69, 21, '3', 'Rest 调用', 'job_type', 'Rest 调用', 3, '2019-03-19 11:23:57', '2019-03-25 12:49:36', NULL, '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (70, 21, '4', 'jar', 'job_type', 'jar类型', 4, '2019-03-19 11:24:20', '2019-03-25 12:49:36', NULL, '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (71, 22, '1', '未发布', 'job_status', '未发布', 1, '2019-03-19 11:25:18', '2019-03-25 12:49:36', NULL, '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (72, 22, '2', '运行中', 'job_status', '运行中', 2, '2019-03-19 11:25:31', '2019-03-25 12:49:36', NULL, '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (73, 22, '3', '暂停', 'job_status', '暂停', 3, '2019-03-19 11:25:42', '2019-03-25 12:49:36', NULL, '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (74, 23, '0', '正常', 'job_execute_status', '正常', 0, '2019-03-19 11:26:27', '2019-03-25 12:49:36', NULL, '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (75, 23, '1', '异常', 'job_execute_status', '异常', 1, '2019-03-19 11:26:41', '2019-03-25 12:49:36', NULL, '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (76, 24, '1', '错失周期立即执行', 'misfire_policy', '错失周期立即执行', 1, '2019-03-19 11:27:45', '2019-03-25 12:49:36', NULL, '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (77, 24, '2', '错失周期执行一次', 'misfire_policy', '错失周期执行一次', 2, '2019-03-19 11:27:57', '2019-03-25 12:49:36', NULL, '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (78, 24, '3', '下周期执行', 'misfire_policy', '下周期执行', 3, '2019-03-19 11:28:08', '2019-03-25 12:49:36', NULL, '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (79, 25, '1', '男', 'gender', '微信-男', 0, '2019-03-27 13:45:13', '2019-03-27 13:45:13', '微信-男', '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (80, 25, '2', '女', 'gender', '女-微信', 1, '2019-03-27 13:45:34', '2019-03-27 13:45:34', '女-微信', '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (81, 25, '0', '未知', 'gender', 'x性别未知', 3, '2019-03-27 13:45:57', '2019-03-27 13:45:57', 'x性别未知', '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (82, 26, '0', '未关注', 'subscribe', '公众号-未关注', 0, '2019-03-27 13:49:07', '2019-03-27 13:49:07', '公众号-未关注', '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (83, 26, '1', '已关注', 'subscribe', '公众号-已关注', 1, '2019-03-27 13:49:26', '2019-03-27 13:49:26', '公众号-已关注', '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (84, 27, '0', '未回复', 'response_type', '微信消息-未回复', 0, '2019-03-28 21:29:47', '2019-03-28 21:29:47', '微信消息-未回复', '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (85, 27, '1', '已回复', 'response_type', '微信消息-已回复', 1, '2019-03-28 21:30:08', '2019-03-28 21:30:08', '微信消息-已回复', '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (86, 28, '1', '检索', 'param_type', '检索', 0, '2019-04-29 18:22:17', '2019-04-29 18:22:17', '检索', '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (87, 28, '2', '原文', 'param_type', '原文', 0, '2019-04-29 18:22:27', '2019-04-29 18:22:27', '原文', '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (88, 28, '3', '报表', 'param_type', '报表', 0, '2019-04-29 18:22:36', '2019-04-29 18:22:36', '报表', '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (89, 28, '4', '安全', 'param_type', '安全', 0, '2019-04-29 18:22:46', '2019-04-29 18:22:46', '安全', '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (90, 28, '5', '文档', 'param_type', '文档', 0, '2019-04-29 18:22:56', '2019-04-29 18:22:56', '文档', '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (91, 28, '6', '消息', 'param_type', '消息', 0, '2019-04-29 18:23:05', '2019-04-29 18:23:05', '消息', '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (92, 28, '9', '其他', 'param_type', '其他', 0, '2019-04-29 18:23:16', '2019-04-29 18:23:16', '其他', '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (93, 28, '0', '默认', 'param_type', '默认', 0, '2019-04-29 18:23:30', '2019-04-29 18:23:30', '默认', '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (94, 30, '1', '系统类', 'dict_type', '系统类字典', 0, '2019-05-16 14:20:40', '2019-05-16 14:20:40', '不能修改删除', '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (95, 30, '0', '业务类', 'dict_type', '业务类字典', 0, '2019-05-16 14:20:59', '2019-05-16 14:20:59', '可以修改', '0', 2);
|
||||
INSERT INTO `sys_dict_item` VALUES (56, 18, '0', 'Avue', 'style_type', 'Avue风格', 0, '2020-02-07 03:52:52', '2020-02-07 03:52:52', '', '0', 1);
|
||||
INSERT INTO `sys_dict_item` VALUES (57, 18, '1', 'element', 'style_type', 'element-ui', 1, '2020-02-07 03:53:12', '2020-02-07 03:53:12', '', '0', 1);
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
@@ -311,9 +262,10 @@ CREATE TABLE `sys_menu` (
|
||||
`sort` int(11) DEFAULT '1' COMMENT '排序值',
|
||||
`keep_alive` char(1) DEFAULT '0',
|
||||
`type` char(1) DEFAULT '0',
|
||||
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`del_flag` char(1) DEFAULT '0',
|
||||
`tenant_id` int(11) unsigned DEFAULT NULL COMMENT '租户ID',
|
||||
PRIMARY KEY (`menu_id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10013 DEFAULT CHARSET=utf8mb4 COMMENT='菜单权限表';
|
||||
|
||||
@@ -321,129 +273,125 @@ CREATE TABLE `sys_menu` (
|
||||
-- Records of sys_menu
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `sys_menu` VALUES (1000, '权限管理', NULL, '/user', -1, 'icon-quanxianguanli', 0, '0', '0', '2018-09-28 08:29:53', '2018-09-28 08:53:01', '0');
|
||||
INSERT INTO `sys_menu` VALUES (1100, '用户管理', NULL, '/admin/user/index', 1000, 'icon-yonghuguanli', 1, '1', '0', '2017-11-02 22:24:37', '2019-06-24 14:36:36', '0');
|
||||
INSERT INTO `sys_menu` VALUES (1101, '用户新增', 'sys_user_add', NULL, 1100, NULL, NULL, '0', '1', '2017-11-08 09:52:09', '2018-09-28 09:06:34', '0');
|
||||
INSERT INTO `sys_menu` VALUES (1102, '用户修改', 'sys_user_edit', NULL, 1100, NULL, NULL, '0', '1', '2017-11-08 09:52:48', '2018-09-28 09:06:37', '0');
|
||||
INSERT INTO `sys_menu` VALUES (1103, '用户删除', 'sys_user_del', NULL, 1100, NULL, NULL, '0', '1', '2017-11-08 09:54:01', '2018-09-28 09:06:42', '0');
|
||||
INSERT INTO `sys_menu` VALUES (1200, '菜单管理', NULL, '/admin/menu/index', 1000, 'icon-caidanguanli', 2, '0', '0', '2017-11-08 09:57:27', '2019-06-24 14:42:07', '0');
|
||||
INSERT INTO `sys_menu` VALUES (1201, '菜单新增', 'sys_menu_add', NULL, 1200, NULL, NULL, '0', '1', '2017-11-08 10:15:53', '2018-09-28 09:07:16', '0');
|
||||
INSERT INTO `sys_menu` VALUES (1202, '菜单修改', 'sys_menu_edit', NULL, 1200, NULL, NULL, '0', '1', '2017-11-08 10:16:23', '2018-09-28 09:07:18', '0');
|
||||
INSERT INTO `sys_menu` VALUES (1203, '菜单删除', 'sys_menu_del', NULL, 1200, NULL, NULL, '0', '1', '2017-11-08 10:16:43', '2018-09-28 09:07:22', '0');
|
||||
INSERT INTO `sys_menu` VALUES (1300, '角色管理', NULL, '/admin/role/index', 1000, 'icon-jiaoseguanli', 3, '0', '0', '2017-11-08 10:13:37', '2018-09-28 09:00:48', '0');
|
||||
INSERT INTO `sys_menu` VALUES (1301, '角色新增', 'sys_role_add', NULL, 1300, NULL, NULL, '0', '1', '2017-11-08 10:14:18', '2018-09-28 09:07:46', '0');
|
||||
INSERT INTO `sys_menu` VALUES (1302, '角色修改', 'sys_role_edit', NULL, 1300, NULL, NULL, '0', '1', '2017-11-08 10:14:41', '2018-09-28 09:07:49', '0');
|
||||
INSERT INTO `sys_menu` VALUES (1303, '角色删除', 'sys_role_del', NULL, 1300, NULL, NULL, '0', '1', '2017-11-08 10:14:59', '2018-09-28 09:07:53', '0');
|
||||
INSERT INTO `sys_menu` VALUES (1304, '分配权限', 'sys_role_perm', NULL, 1300, NULL, NULL, '0', '1', '2018-04-20 07:22:55', '2018-09-28 09:13:23', '0');
|
||||
INSERT INTO `sys_menu` VALUES (1400, '部门管理', NULL, '/admin/dept/index', 1000, 'icon-web-icon-', 4, '0', '0', '2018-01-20 13:17:19', '2018-12-09 16:35:12', '0');
|
||||
INSERT INTO `sys_menu` VALUES (1401, '部门新增', 'sys_dept_add', NULL, 1400, NULL, NULL, '0', '1', '2018-01-20 14:56:16', '2018-09-28 09:08:13', '0');
|
||||
INSERT INTO `sys_menu` VALUES (1402, '部门修改', 'sys_dept_edit', NULL, 1400, NULL, NULL, '0', '1', '2018-01-20 14:56:59', '2018-09-28 09:08:16', '0');
|
||||
INSERT INTO `sys_menu` VALUES (1403, '部门删除', 'sys_dept_del', NULL, 1400, NULL, NULL, '0', '1', '2018-01-20 14:57:28', '2018-09-28 09:08:18', '0');
|
||||
INSERT INTO `sys_menu` VALUES (1500, '租户管理', '', '/admin/tenant/index', 1000, 'icon-erji-zuhushouye', 5, '0', '0', '2018-01-20 13:17:19', '2019-05-17 15:36:11', '0');
|
||||
INSERT INTO `sys_menu` VALUES (1501, '租户新增', 'admin_systenant_add', NULL, 1500, '1', 0, '0', '1', '2018-05-15 21:35:18', '2019-05-17 15:36:34', '0');
|
||||
INSERT INTO `sys_menu` VALUES (1502, '租户修改', 'admin_systenant_edit', NULL, 1500, '1', 1, '0', '1', '2018-05-15 21:35:18', '2019-05-17 15:36:53', '0');
|
||||
INSERT INTO `sys_menu` VALUES (1503, '租户删除', 'admin_systenant_del', NULL, 1500, '1', 2, '0', '1', '2018-05-15 21:35:18', '2019-05-17 15:37:00', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2000, '系统管理', NULL, '/admin', -1, 'icon-xitongguanli', 1, '0', '0', '2017-11-07 20:56:00', '2018-09-28 08:53:18', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2100, '日志管理', NULL, '/admin/log/index', 2000, 'icon-rizhiguanli', 5, '0', '0', '2017-11-20 14:06:22', '2018-09-28 09:01:52', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2101, '日志删除', 'sys_log_del', NULL, 2100, NULL, NULL, '0', '1', '2017-11-20 20:37:37', '2018-09-28 09:08:44', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2200, '字典管理', NULL, '/admin/dict/index', 2000, 'icon-navicon-zdgl', 6, '0', '0', '2017-11-29 11:30:52', '2018-09-28 09:01:47', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2201, '字典删除', 'sys_dict_del', NULL, 2200, NULL, NULL, '0', '1', '2017-11-29 11:30:11', '2018-09-28 09:09:10', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2202, '字典新增', 'sys_dict_add', NULL, 2200, NULL, NULL, '0', '1', '2018-05-11 22:34:55', '2018-09-28 09:09:12', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2203, '字典修改', 'sys_dict_edit', NULL, 2200, NULL, NULL, '0', '1', '2018-05-11 22:36:03', '2018-09-28 09:09:16', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2210, '参数管理', NULL, '/admin/param/index', 2000, 'icon-canshu', 7, '1', '0', '2019-04-29 22:16:50', '2019-06-24 14:52:00', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2211, '参数新增', 'admin_syspublicparam_add', NULL, 2210, NULL, 1, '0', '1', '2019-04-29 22:17:36', NULL, '0');
|
||||
INSERT INTO `sys_menu` VALUES (2212, '参数删除', 'admin_syspublicparam_del', NULL, 2210, NULL, 1, '0', '1', '2019-04-29 22:17:55', NULL, '0');
|
||||
INSERT INTO `sys_menu` VALUES (2213, '参数编辑', 'admin_syspublicparam_edit', NULL, 2210, NULL, 1, '0', '1', '2019-04-29 22:18:14', '2019-04-29 22:19:25', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2300, '代码生成', '', '/gen/index', 10006, 'icon-weibiaoti46', 1, '0', '0', '2018-01-20 13:17:19', '2019-08-12 10:28:44', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2400, '终端管理', '', '/admin/client/index', 2000, 'icon-shouji', 9, '0', '0', '2018-01-20 13:17:19', '2018-09-28 09:01:43', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2401, '客户端新增', 'sys_client_add', NULL, 2400, '1', NULL, '0', '1', '2018-05-15 21:35:18', '2018-09-28 09:10:25', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2402, '客户端修改', 'sys_client_edit', NULL, 2400, NULL, NULL, '0', '1', '2018-05-15 21:37:06', '2018-09-28 09:10:27', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2403, '客户端删除', 'sys_client_del', NULL, 2400, NULL, NULL, '0', '1', '2018-05-15 21:39:16', '2018-09-28 09:10:30', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2500, '密钥管理', '', '/admin/social/index', 2000, 'icon-miyue', 10, '0', '0', '2018-01-20 13:17:19', '2018-09-28 09:01:41', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2501, '密钥新增', 'sys_social_details_add', NULL, 2500, '1', 0, '0', '1', '2018-05-15 21:35:18', '2019-03-25 11:52:18', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2502, '密钥修改', 'sys_social_details_edit', NULL, 2500, '1', 1, '0', '1', '2018-05-15 21:35:18', '2019-03-25 11:51:36', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2503, '密钥删除', 'sys_social_details_del', NULL, 2500, '1', 2, '0', '1', '2018-05-15 21:35:18', '2019-03-25 11:51:30', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2600, '令牌管理', NULL, '/admin/token/index', 2000, 'icon-denglvlingpai', 11, '0', '0', '2018-09-04 05:58:41', '2018-09-28 09:01:38', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2601, '令牌删除', 'sys_token_del', NULL, 2600, NULL, 1, '0', '1', '2018-09-04 05:59:50', '2018-09-28 09:11:24', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2700, '动态路由', NULL, '/admin/route/index', 2000, 'icon-luyou', 12, '0', '0', '2018-09-04 05:58:41', '2019-06-24 15:14:28', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2800, 'Quartz管理', '', '/daemon/job-manage/index', 2000, 'icon-guanwangfangwen', 8, '0', '0', '2018-01-20 13:17:19', '2019-03-25 13:52:14', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2810, '任务新增', 'job_sys_job_add', NULL, 2800, '1', 0, '0', '1', '2018-05-15 21:35:18', '2019-03-25 11:50:23', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2820, '任务修改', 'job_sys_job_edit', NULL, 2800, '1', 0, '0', '1', '2018-05-15 21:35:18', '2019-03-25 11:50:26', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2830, '任务删除', 'job_sys_job_del', NULL, 2800, '1', 0, '0', '1', '2018-05-15 21:35:18', '2019-03-25 11:50:30', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2840, '任务暂停', 'job_sys_job_shutdown_job', NULL, 2800, '1', 0, '0', '1', '2018-05-15 21:35:18', '2019-03-25 11:50:18', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2850, '任务开始', 'job_sys_job_start_job', NULL, 2800, '1', 0, '0', '1', '2018-05-15 21:35:18', '2019-03-25 11:50:35', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2860, '任务刷新', 'job_sys_job_refresh_job', NULL, 2800, '1', 0, '0', '1', '2018-05-15 21:35:18', '2019-03-25 11:50:39', '0');
|
||||
INSERT INTO `sys_menu` VALUES (2870, '执行任务', 'job_sys_job_run_job', NULL, 2800, '1', 0, '0', '1', '2019-08-08 15:35:18', '2019-08-08 15:50:35', '0');
|
||||
INSERT INTO `sys_menu` VALUES (3000, '系统监控', NULL, '/daemon', -1, 'icon-msnui-supervise', 2, '0', '0', '2018-07-27 01:13:21', '2018-09-28 08:53:24', '0');
|
||||
INSERT INTO `sys_menu` VALUES (3100, '服务监控', NULL, 'http://127.0.0.1:5001', 3000, 'icon-server', 0, '0', '0', '2018-06-26 10:50:32', '2019-05-01 23:54:05', '0');
|
||||
INSERT INTO `sys_menu` VALUES (3110, '缓存监控', NULL, '/monitor/redis/index', 3000, 'icon-qingchuhuancun', 1, '1', '0', '2019-05-08 23:51:27', '2019-06-24 15:17:45', '0');
|
||||
INSERT INTO `sys_menu` VALUES (3200, '接口文档', NULL, 'http://127.0.0.1:9999/swagger-ui.html', 3000, 'icon-wendang', 1, '0', '0', '2018-06-26 10:50:32', '2019-05-01 23:57:11', '0');
|
||||
INSERT INTO `sys_menu` VALUES (3300, '事务监控', NULL, '/tx/index', 3000, 'icon-gtsquanjushiwufuwuGTS', 5, '0', '0', '2018-08-19 11:02:39', '2019-06-24 15:18:04', '0');
|
||||
INSERT INTO `sys_menu` VALUES (3400, '在线事务', NULL, '/tx/model', 3000, 'icon-online', 6, '0', '0', '2018-08-19 11:32:04', '2019-06-24 15:18:13', '0');
|
||||
INSERT INTO `sys_menu` VALUES (3500, '文档扩展', NULL, 'http://127.0.0.1:9999/doc.html', 3000, 'icon-wendang', 2, '0', '0', '2018-06-26 10:50:32', '2019-05-01 23:57:42', '0');
|
||||
INSERT INTO `sys_menu` VALUES (3600, '任务轨迹', '', '/daemon/status-trace-log/index', 3000, 'icon-guiji', 8, '0', '0', '2018-01-20 13:17:19', '2019-06-24 15:18:41', '0');
|
||||
INSERT INTO `sys_menu` VALUES (3601, '删除轨迹', 'daemon_status_trace_log_del', NULL, 3600, '1', 2, '0', '1', '2018-05-15 21:35:18', '2019-03-30 09:31:06', '0');
|
||||
INSERT INTO `sys_menu` VALUES (3620, 'Quartz日志', '', '/daemon/job-log/index', 3000, 'icon-gtsquanjushiwufuwuGTS', 8, '0', '0', '2018-01-20 13:17:19', '2019-06-24 15:18:54', '0');
|
||||
INSERT INTO `sys_menu` VALUES (3630, '任务日志', '', '/daemon/execution-log/index', 3000, 'icon-wendang', 7, '0', '0', '2018-01-20 13:17:19', '2019-06-24 15:19:07', '0');
|
||||
INSERT INTO `sys_menu` VALUES (3631, '删除日志', 'daemon_execution_log_del', NULL, 3900, '1', 2, '0', '1', '2018-05-15 21:35:18', '2019-03-30 09:30:45', '0');
|
||||
INSERT INTO `sys_menu` VALUES (3700, '注册配置', NULL, '', 3000, 'icon-line', 10, '0', '0', '2018-01-25 11:08:52', '2019-06-24 15:35:10', '1');
|
||||
INSERT INTO `sys_menu` VALUES (4000, '协同管理', NULL, '/activti', -1, 'icon-kuaisugongzuoliu_o', 3, '0', '0', '2018-09-26 01:38:13', '2018-09-28 08:58:24', '0');
|
||||
INSERT INTO `sys_menu` VALUES (4100, '模型管理', NULL, '/activiti/index', 4000, 'icon-weibiaoti13', 1, '0', '0', '2018-09-26 01:39:07', '2019-06-24 15:20:00', '0');
|
||||
INSERT INTO `sys_menu` VALUES (4101, '模型管理', 'act_model_manage', NULL, 4100, '1', 0, '0', '1', '2018-05-15 21:35:18', '2018-09-28 09:12:07', '0');
|
||||
INSERT INTO `sys_menu` VALUES (4200, '流程管理', '/activiti/process', '/activiti/process', 4000, 'icon-liucheng', 2, '0', '0', '2018-09-26 06:41:05', '2019-06-24 08:31:07', '0');
|
||||
INSERT INTO `sys_menu` VALUES (4201, '流程管理', 'act_process_manage', NULL, 4200, '1', 0, '0', '1', '2018-05-15 21:35:18', '2018-09-28 09:12:07', '0');
|
||||
INSERT INTO `sys_menu` VALUES (4300, '请假管理', '/activiti/leave', '/activiti/leave', 4000, 'icon-qingjia', 3, '0', '0', '2018-01-20 13:17:19', '2019-06-24 08:31:11', '0');
|
||||
INSERT INTO `sys_menu` VALUES (4301, '请假新增', 'act_leavebill_add', NULL, 4300, '1', 0, '0', '1', '2018-05-15 21:35:18', '2018-09-28 09:12:07', '0');
|
||||
INSERT INTO `sys_menu` VALUES (4302, '请假修改', 'act_leavebill_edit', NULL, 4300, '1', 1, '0', '1', '2018-05-15 21:35:18', '2018-09-28 09:12:09', '0');
|
||||
INSERT INTO `sys_menu` VALUES (4303, '请假删除', 'act_leavebill_del', NULL, 4300, '1', 2, '0', '1', '2018-05-15 21:35:18', '2018-09-28 09:12:14', '0');
|
||||
INSERT INTO `sys_menu` VALUES (4400, '待办任务', '/activiti/task', '/activiti/task', 4000, 'icon-renwu', 4, '0', '0', '2018-09-27 09:52:31', '2019-06-24 08:31:18', '0');
|
||||
INSERT INTO `sys_menu` VALUES (4401, '流程管理', 'act_task_manage', NULL, 4400, '1', 0, '0', '1', '2018-05-15 21:35:18', '2018-09-28 09:12:07', '0');
|
||||
INSERT INTO `sys_menu` VALUES (5000, '支付管理', NULL, '/pay', -1, 'icon-pay6zhifu', 4, '1', '0', '2019-05-30 15:28:03', '2019-06-20 16:13:23', '0');
|
||||
INSERT INTO `sys_menu` VALUES (5100, '渠道管理', NULL, '/pay/paychannel/index', 5000, 'icon-zhifuqudaoguanli', 1, '1', '0', '2019-05-30 15:32:17', '2019-05-30 19:43:27', '0');
|
||||
INSERT INTO `sys_menu` VALUES (5110, '增加渠道', 'pay_paychannel_add', NULL, 5100, NULL, 1, '0', '1', '2019-05-30 15:46:14', NULL, '0');
|
||||
INSERT INTO `sys_menu` VALUES (5120, '编辑渠道', 'pay_paychannel_edit', NULL, 5100, NULL, 1, '0', '1', '2019-05-30 15:46:35', NULL, '0');
|
||||
INSERT INTO `sys_menu` VALUES (5130, '删除渠道', 'pay_paychannel_del', NULL, 5100, NULL, 1, '0', '1', '2019-05-30 15:47:08', NULL, '0');
|
||||
INSERT INTO `sys_menu` VALUES (5200, '收银台', NULL, '/pay/cd/index', 5000, 'icon-shouyintai', 0, '1', '0', '2019-05-30 19:44:00', '2019-05-30 19:45:05', '0');
|
||||
INSERT INTO `sys_menu` VALUES (5300, '商品订单', '', '/pay/goods/index', 5000, 'icon-dingdan', 2, '0', '0', '2018-01-20 13:17:19', '2019-06-16 18:02:21', '0');
|
||||
INSERT INTO `sys_menu` VALUES (5310, '商品订单新增', 'generator_paygoodsorder_add', NULL, 5300, '1', 0, '0', '1', '2018-05-15 21:35:18', '2018-07-29 13:38:59', '0');
|
||||
INSERT INTO `sys_menu` VALUES (5320, '商品订单修改', 'generator_paygoodsorder_edit', NULL, 5300, '1', 1, '0', '1', '2018-05-15 21:35:18', '2018-07-29 13:38:59', '0');
|
||||
INSERT INTO `sys_menu` VALUES (5330, '商品订单删除', 'generator_paygoodsorder_del', NULL, 5300, '1', 2, '0', '1', '2018-05-15 21:35:18', '2018-07-29 13:38:59', '0');
|
||||
INSERT INTO `sys_menu` VALUES (5400, '支付订单', '', '/pay/orders/index', 5000, 'icon-zhifu', 3, '0', '0', '2018-01-20 13:17:19', '2019-06-16 18:02:06', '0');
|
||||
INSERT INTO `sys_menu` VALUES (5410, '支付订单新增', 'generator_paytradeorder_add', NULL, 5400, '1', 0, '0', '1', '2018-05-15 21:35:18', '2018-07-29 13:38:59', '0');
|
||||
INSERT INTO `sys_menu` VALUES (5420, '支付订单修改', 'generator_paytradeorder_edit', NULL, 5400, '1', 1, '0', '1', '2018-05-15 21:35:18', '2018-07-29 13:38:59', '0');
|
||||
INSERT INTO `sys_menu` VALUES (5430, '支付订单删除', 'generator_paytradeorder_del', NULL, 5400, '1', 2, '0', '1', '2018-05-15 21:35:18', '2018-07-29 13:38:59', '0');
|
||||
INSERT INTO `sys_menu` VALUES (5500, '回调记录', '', '/pay/notify/index', 5000, 'icon-huitiao', 4, '0', '0', '2018-01-20 13:17:19', '2019-06-16 18:01:49', '0');
|
||||
INSERT INTO `sys_menu` VALUES (5510, '记录新增', 'generator_paynotifyrecord_add', NULL, 5500, '1', 0, '0', '1', '2018-05-15 21:35:18', '2018-07-29 13:38:59', '0');
|
||||
INSERT INTO `sys_menu` VALUES (5520, '记录修改', 'generator_paynotifyrecord_edit', NULL, 5500, '1', 1, '0', '1', '2018-05-15 21:35:18', '2018-07-29 13:38:59', '0');
|
||||
INSERT INTO `sys_menu` VALUES (5530, '记录删除', 'generator_paynotifyrecord_del', NULL, 5500, '1', 2, '0', '1', '2018-05-15 21:35:18', '2018-07-29 13:38:59', '0');
|
||||
INSERT INTO `sys_menu` VALUES (6000, '微信管理', NULL, '/mp', -1, 'icon-gongzhonghao', 4, '0', '0', '2018-09-26 01:38:13', '2018-09-28 08:58:24', '0');
|
||||
INSERT INTO `sys_menu` VALUES (6100, '账号管理', '', '/mp/wxaccount/index', 6000, 'icon-weixincaidan', 8, '0', '0', '2018-01-20 13:17:19', '2019-06-24 15:24:36', '0');
|
||||
INSERT INTO `sys_menu` VALUES (6101, '公众号新增', 'mp_wxaccount_add', '', 6100, '1', 0, '0', '1', '2018-05-15 21:35:18', '2019-06-24 15:24:33', '0');
|
||||
INSERT INTO `sys_menu` VALUES (6102, '公众号修改', 'mp_wxaccount_edit', NULL, 6100, '1', 1, '0', '1', '2018-05-15 21:35:18', '2018-07-29 13:38:59', '0');
|
||||
INSERT INTO `sys_menu` VALUES (6103, '公众号删除', 'mp_wxaccount_del', NULL, 6100, '1', 2, '0', '1', '2018-05-15 21:35:18', '2018-07-29 13:38:59', '0');
|
||||
INSERT INTO `sys_menu` VALUES (6200, '粉丝管理', '', '/mp/wxaccountfans/index', 6000, 'icon-fensiguanli', 8, '0', '0', '2018-01-20 13:17:19', '2019-06-24 15:24:46', '0');
|
||||
INSERT INTO `sys_menu` VALUES (6201, '粉丝新增', 'mp_wxaccountfans_add', NULL, 6200, '1', 0, '0', '1', '2018-05-15 21:35:18', '2018-07-29 13:38:59', '0');
|
||||
INSERT INTO `sys_menu` VALUES (6202, '粉丝修改', 'mp_wxaccountfans_edit', NULL, 6200, '1', 1, '0', '1', '2018-05-15 21:35:18', '2018-07-29 13:38:59', '0');
|
||||
INSERT INTO `sys_menu` VALUES (6203, '粉丝删除', 'mp_wxaccountfans_del', NULL, 6200, '1', 2, '0', '1', '2018-05-15 21:35:18', '2018-07-29 13:38:59', '0');
|
||||
INSERT INTO `sys_menu` VALUES (6300, '消息管理', '', '/mp/wxfansmsg/index', 6000, 'icon-xiaoxiguanli', 8, '0', '0', '2018-01-20 13:17:19', '2019-06-24 15:24:57', '0');
|
||||
INSERT INTO `sys_menu` VALUES (6301, '消息新增', 'mp_wxfansmsg_add', NULL, 6300, '1', 0, '0', '1', '2018-05-15 21:35:18', '2018-07-29 13:38:59', '0');
|
||||
INSERT INTO `sys_menu` VALUES (6302, '消息修改', 'mp_wxfansmsg_edit', NULL, 6300, '1', 1, '0', '1', '2018-05-15 21:35:18', '2018-07-29 13:38:59', '0');
|
||||
INSERT INTO `sys_menu` VALUES (6303, '消息删除', 'mp_wxfansmsg_del', NULL, 6300, '1', 2, '0', '1', '2018-05-15 21:35:18', '2018-07-29 13:38:59', '0');
|
||||
INSERT INTO `sys_menu` VALUES (6304, '消息回复', 'mp_wxfansmsgres_add', NULL, 6300, '1', 3, '0', '1', '2018-05-15 21:35:18', '2018-07-29 13:38:59', '0');
|
||||
INSERT INTO `sys_menu` VALUES (6305, '回复删除', 'mp_wxfansmsgres_del', NULL, 6300, NULL, 1, '0', '1', '2019-03-28 22:53:49', NULL, '0');
|
||||
INSERT INTO `sys_menu` VALUES (6400, '菜单设置', NULL, '/mp/wxmenu/index', 6000, 'icon-anniu_weixincaidanlianjie', 6, '1', '0', '2019-03-29 15:20:12', '2019-06-24 15:25:07', '0');
|
||||
INSERT INTO `sys_menu` VALUES (6401, '保存', 'mp_wxmenu_add', NULL, 6400, NULL, 1, '0', '1', '2019-03-29 15:43:22', '2019-03-29 15:43:30', '0');
|
||||
INSERT INTO `sys_menu` VALUES (6402, '发布', 'mp_wxmenu_push', NULL, 6400, NULL, 1, '0', '1', '2019-03-29 15:43:54', NULL, '0');
|
||||
INSERT INTO `sys_menu` VALUES (6500, '运营数据', NULL, '/mp/wxstatistics/index', 6000, 'icon-zhexiantu', 7, '1', '0', '2019-04-14 00:15:35', '2019-06-24 15:25:15', '0');
|
||||
INSERT INTO `sys_menu` VALUES (10000, '文件管理', NULL, '/admin/file/index', 2000, 'icon-wenjianguanli', 6, '1', '0', '2019-06-25 12:44:46', NULL, '0');
|
||||
INSERT INTO `sys_menu` VALUES (10001, '删除文件', 'sys_file_del', NULL, 10000, NULL, 1, '0', '1', '2019-06-25 13:41:41', NULL, '0');
|
||||
INSERT INTO `sys_menu` VALUES (10002, '表单管理', '', '/gen/form', 10006, 'icon-record', 3, '0', '0', '2018-01-20 13:17:19', '2019-08-12 09:36:09', '0');
|
||||
INSERT INTO `sys_menu` VALUES (10003, '表单新增', 'gen_form_add', NULL, 10002, '1', 0, '0', '1', '2018-05-15 21:35:18', '2018-07-29 13:38:59', '0');
|
||||
INSERT INTO `sys_menu` VALUES (10004, '表单修改', 'gen_form_edit', NULL, 10002, '1', 1, '0', '1', '2018-05-15 21:35:18', '2018-07-29 13:38:59', '0');
|
||||
INSERT INTO `sys_menu` VALUES (10005, '表单删除', 'gen_form_del', NULL, 10002, '1', 2, '0', '1', '2018-05-15 21:35:18', '2018-07-29 13:38:59', '0');
|
||||
INSERT INTO `sys_menu` VALUES (10006, '开发平台', NULL, '/gen', -1, 'icon-shejiyukaifa-', 9, '1', '0', '2019-08-12 09:35:16', '2019-08-12 10:28:35', '0');
|
||||
INSERT INTO `sys_menu` VALUES (10007, '数据源管理', NULL, '/gen/datasource', 10006, 'icon-mysql', 0, '1', '0', '2019-08-12 09:42:11', '2019-08-12 10:33:30', '0');
|
||||
INSERT INTO `sys_menu` VALUES (10008, '表单设计', NULL, '/gen/design', 10006, 'icon-biaodanbiaoqian', 2, '1', '0', '2019-08-16 10:08:56', NULL, '0');
|
||||
INSERT INTO `sys_menu` VALUES (1000, '权限管理', NULL, '/user', -1, 'icon-quanxianguanli', 0, '0', '0', '2018-09-28 08:29:53', '2020-03-24 08:56:32', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1100, '用户管理', NULL, '/admin/user/index', 1000, 'icon-yonghuguanli', 1, '1', '0', '2017-11-02 22:24:37', '2020-03-24 08:56:33', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1101, '用户新增', 'sys_user_add', NULL, 1100, NULL, NULL, '0', '1', '2017-11-08 09:52:09', '2020-03-24 08:56:34', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1102, '用户修改', 'sys_user_edit', NULL, 1100, NULL, NULL, '0', '1', '2017-11-08 09:52:48', '2020-03-24 08:56:35', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1103, '用户删除', 'sys_user_del', NULL, 1100, NULL, NULL, '0', '1', '2017-11-08 09:54:01', '2020-03-24 08:56:37', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1200, '菜单管理', NULL, '/admin/menu/index', 1000, 'icon-caidanguanli', 2, '0', '0', '2017-11-08 09:57:27', '2020-03-24 08:56:38', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1201, '菜单新增', 'sys_menu_add', NULL, 1200, NULL, NULL, '0', '1', '2017-11-08 10:15:53', '2020-03-24 08:56:39', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1202, '菜单修改', 'sys_menu_edit', NULL, 1200, NULL, NULL, '0', '1', '2017-11-08 10:16:23', '2020-03-24 08:56:40', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1203, '菜单删除', 'sys_menu_del', NULL, 1200, NULL, NULL, '0', '1', '2017-11-08 10:16:43', '2020-03-24 08:56:41', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1300, '角色管理', NULL, '/admin/role/index', 1000, 'icon-jiaoseguanli', 3, '0', '0', '2017-11-08 10:13:37', '2020-03-24 08:56:42', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1301, '角色新增', 'sys_role_add', NULL, 1300, NULL, NULL, '0', '1', '2017-11-08 10:14:18', '2020-03-24 08:56:43', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1302, '角色修改', 'sys_role_edit', NULL, 1300, NULL, NULL, '0', '1', '2017-11-08 10:14:41', '2020-03-24 08:56:43', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1303, '角色删除', 'sys_role_del', NULL, 1300, NULL, NULL, '0', '1', '2017-11-08 10:14:59', '2020-03-24 08:56:45', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1304, '分配权限', 'sys_role_perm', NULL, 1300, NULL, NULL, '0', '1', '2018-04-20 07:22:55', '2020-03-24 08:56:46', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1400, '部门管理', NULL, '/admin/dept/index', 1000, 'icon-web-icon-', 4, '0', '0', '2018-01-20 13:17:19', '2020-03-24 08:56:47', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1401, '部门新增', 'sys_dept_add', NULL, 1400, NULL, NULL, '0', '1', '2018-01-20 14:56:16', '2020-03-24 08:56:48', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1402, '部门修改', 'sys_dept_edit', NULL, 1400, NULL, NULL, '0', '1', '2018-01-20 14:56:59', '2020-03-24 08:56:48', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1403, '部门删除', 'sys_dept_del', NULL, 1400, NULL, NULL, '0', '1', '2018-01-20 14:57:28', '2020-03-24 08:56:51', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1500, '租户管理', '', '/admin/tenant/index', 1000, 'icon-erji-zuhushouye', 5, '0', '0', '2018-01-20 13:17:19', '2020-03-24 08:56:49', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1501, '租户新增', 'admin_systenant_add', NULL, 1500, '1', 0, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:56:52', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1502, '租户修改', 'admin_systenant_edit', NULL, 1500, '1', 1, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:56:53', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (1503, '租户删除', 'admin_systenant_del', NULL, 1500, '1', 2, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:56:54', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2000, '系统管理', NULL, '/admin', -1, 'icon-xitongguanli', 1, '0', '0', '2017-11-07 20:56:00', '2020-03-24 08:56:55', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2100, '日志管理', NULL, '/admin/log/index', 2000, 'icon-rizhiguanli', 5, '0', '0', '2017-11-20 14:06:22', '2020-03-24 08:56:56', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2101, '日志删除', 'sys_log_del', NULL, 2100, NULL, NULL, '0', '1', '2017-11-20 20:37:37', '2020-03-24 08:56:58', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2200, '字典管理', NULL, '/admin/dict/index', 2000, 'icon-navicon-zdgl', 6, '0', '0', '2017-11-29 11:30:52', '2020-03-24 08:56:58', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2201, '字典删除', 'sys_dict_del', NULL, 2200, NULL, NULL, '0', '1', '2017-11-29 11:30:11', '2020-03-24 08:56:59', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2202, '字典新增', 'sys_dict_add', NULL, 2200, NULL, NULL, '0', '1', '2018-05-11 22:34:55', '2020-03-24 08:57:01', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2203, '字典修改', 'sys_dict_edit', NULL, 2200, NULL, NULL, '0', '1', '2018-05-11 22:36:03', '2020-03-24 08:57:09', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2210, '参数管理', NULL, '/admin/param/index', 2000, 'icon-canshu', 7, '1', '0', '2019-04-29 22:16:50', '2020-03-24 08:57:10', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2211, '参数新增', 'admin_syspublicparam_add', NULL, 2210, NULL, 1, '0', '1', '2019-04-29 22:17:36', '2020-03-24 08:57:11', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2212, '参数删除', 'admin_syspublicparam_del', NULL, 2210, NULL, 1, '0', '1', '2019-04-29 22:17:55', '2020-03-24 08:57:12', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2213, '参数编辑', 'admin_syspublicparam_edit', NULL, 2210, NULL, 1, '0', '1', '2019-04-29 22:18:14', '2020-03-24 08:57:13', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2300, '代码生成', '', '/gen/index', 10006, 'icon-weibiaoti46', 1, '0', '0', '2018-01-20 13:17:19', '2020-03-24 08:57:14', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2400, '终端管理', '', '/admin/client/index', 2000, 'icon-shouji', 9, '0', '0', '2018-01-20 13:17:19', '2020-03-24 08:57:15', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2401, '客户端新增', 'sys_client_add', NULL, 2400, '1', NULL, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:57:16', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2402, '客户端修改', 'sys_client_edit', NULL, 2400, NULL, NULL, '0', '1', '2018-05-15 21:37:06', '2020-03-24 08:57:16', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2403, '客户端删除', 'sys_client_del', NULL, 2400, NULL, NULL, '0', '1', '2018-05-15 21:39:16', '2020-03-24 08:57:17', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2500, '密钥管理', '', '/admin/social/index', 2000, 'icon-miyue', 10, '0', '0', '2018-01-20 13:17:19', '2020-03-24 08:57:18', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2501, '密钥新增', 'sys_social_details_add', NULL, 2500, '1', 0, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:57:19', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2502, '密钥修改', 'sys_social_details_edit', NULL, 2500, '1', 1, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:57:19', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2503, '密钥删除', 'sys_social_details_del', NULL, 2500, '1', 2, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:57:23', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2600, '令牌管理', NULL, '/admin/token/index', 2000, 'icon-denglvlingpai', 11, '0', '0', '2018-09-04 05:58:41', '2020-03-24 08:57:24', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2601, '令牌删除', 'sys_token_del', NULL, 2600, NULL, 1, '0', '1', '2018-09-04 05:59:50', '2020-03-24 08:57:24', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2700, '动态路由', NULL, '/admin/route/index', 2000, 'icon-luyou', 12, '0', '0', '2018-09-04 05:58:41', '2020-03-24 08:57:25', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2800, 'Quartz管理', '', '/daemon/job-manage/index', 2000, 'icon-guanwangfangwen', 8, '0', '0', '2018-01-20 13:17:19', '2020-03-24 08:57:26', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2810, '任务新增', 'job_sys_job_add', NULL, 2800, '1', 0, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:57:26', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2820, '任务修改', 'job_sys_job_edit', NULL, 2800, '1', 0, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:57:27', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2830, '任务删除', 'job_sys_job_del', NULL, 2800, '1', 0, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:57:28', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2840, '任务暂停', 'job_sys_job_shutdown_job', NULL, 2800, '1', 0, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:57:28', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2850, '任务开始', 'job_sys_job_start_job', NULL, 2800, '1', 0, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:57:29', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2860, '任务刷新', 'job_sys_job_refresh_job', NULL, 2800, '1', 0, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:57:30', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (2870, '执行任务', 'job_sys_job_run_job', NULL, 2800, '1', 0, '0', '1', '2019-08-08 15:35:18', '2020-03-24 08:57:31', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (3000, '系统监控', NULL, '/daemon', -1, 'icon-msnui-supervise', 2, '0', '0', '2018-07-27 01:13:21', '2020-03-24 08:57:31', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (3100, '服务监控', NULL, 'http://127.0.0.1:5001', 3000, 'icon-server', 0, '0', '0', '2018-06-26 10:50:32', '2020-03-24 08:57:32', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (3110, '缓存监控', NULL, '/monitor/redis/index', 3000, 'icon-qingchuhuancun', 1, '1', '0', '2019-05-08 23:51:27', '2020-03-24 08:57:33', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (3200, '接口文档', NULL, 'http://127.0.0.1:9999/swagger-ui.html', 3000, 'icon-wendang', 1, '0', '0', '2018-06-26 10:50:32', '2020-03-24 08:57:34', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (3300, '事务监控', NULL, '/tx/index', 3000, 'icon-gtsquanjushiwufuwuGTS', 5, '0', '0', '2018-08-19 11:02:39', '2020-03-24 08:57:34', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (3400, '在线事务', NULL, '/tx/model', 3000, 'icon-online', 6, '0', '0', '2018-08-19 11:32:04', '2020-03-24 08:57:35', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (3500, '文档扩展', NULL, 'http://127.0.0.1:9999/doc.html', 3000, 'icon-wendang', 2, '0', '0', '2018-06-26 10:50:32', '2020-03-24 08:57:36', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (3600, 'Quartz日志', '', '/daemon/job-log/index', 3000, 'icon-gtsquanjushiwufuwuGTS', 8, '0', '0', '2018-01-20 13:17:19', '2020-03-24 08:57:37', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (3700, '注册配置', NULL, '', 3000, 'icon-line', 10, '0', '0', '2018-01-25 11:08:52', '2020-03-24 08:57:37', '1', 1);
|
||||
INSERT INTO `sys_menu` VALUES (4000, '协同管理', NULL, '/activti', -1, 'icon-kuaisugongzuoliu_o', 3, '0', '0', '2018-09-26 01:38:13', '2020-03-24 08:57:39', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (4100, '模型管理', NULL, '/activiti/index', 4000, 'icon-weibiaoti13', 1, '0', '0', '2018-09-26 01:39:07', '2020-03-24 08:57:40', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (4101, '模型管理', 'act_model_manage', NULL, 4100, '1', 0, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:57:41', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (4200, '流程管理', '/activiti/process', '/activiti/process', 4000, 'icon-liucheng', 2, '0', '0', '2018-09-26 06:41:05', '2020-03-24 08:57:42', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (4201, '流程管理', 'act_process_manage', NULL, 4200, '1', 0, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:57:42', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (4300, '请假管理', '/activiti/leave', '/activiti/leave', 4000, 'icon-qingjia', 3, '0', '0', '2018-01-20 13:17:19', '2020-03-24 08:57:43', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (4301, '请假新增', 'act_leavebill_add', NULL, 4300, '1', 0, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:57:44', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (4302, '请假修改', 'act_leavebill_edit', NULL, 4300, '1', 1, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:57:45', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (4303, '请假删除', 'act_leavebill_del', NULL, 4300, '1', 2, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:57:46', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (4400, '待办任务', '/activiti/task', '/activiti/task', 4000, 'icon-renwu', 4, '0', '0', '2018-09-27 09:52:31', '2020-03-24 08:57:48', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (4401, '流程管理', 'act_task_manage', NULL, 4400, '1', 0, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:57:50', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (5000, '支付管理', NULL, '/pay', -1, 'icon-pay6zhifu', 4, '1', '0', '2019-05-30 15:28:03', '2020-03-24 08:57:51', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (5100, '渠道管理', NULL, '/pay/paychannel/index', 5000, 'icon-zhifuqudaoguanli', 1, '1', '0', '2019-05-30 15:32:17', '2020-03-24 08:57:52', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (5110, '增加渠道', 'pay_paychannel_add', NULL, 5100, NULL, 1, '0', '1', '2019-05-30 15:46:14', '2020-03-24 08:58:07', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (5120, '编辑渠道', 'pay_paychannel_edit', NULL, 5100, NULL, 1, '0', '1', '2019-05-30 15:46:35', '2020-03-24 08:58:08', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (5130, '删除渠道', 'pay_paychannel_del', NULL, 5100, NULL, 1, '0', '1', '2019-05-30 15:47:08', '2020-03-24 08:58:09', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (5200, '收银台', NULL, '/pay/cd/index', 5000, 'icon-shouyintai', 0, '1', '0', '2019-05-30 19:44:00', '2020-03-24 08:58:09', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (5300, '商品订单', '', '/pay/goods/index', 5000, 'icon-dingdan', 2, '0', '0', '2018-01-20 13:17:19', '2020-03-24 08:58:10', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (5310, '商品订单新增', 'generator_paygoodsorder_add', NULL, 5300, '1', 0, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:58:11', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (5320, '商品订单修改', 'generator_paygoodsorder_edit', NULL, 5300, '1', 1, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:58:13', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (5330, '商品订单删除', 'generator_paygoodsorder_del', NULL, 5300, '1', 2, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:58:14', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (5400, '支付订单', '', '/pay/orders/index', 5000, 'icon-zhifu', 3, '0', '0', '2018-01-20 13:17:19', '2020-03-24 08:58:14', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (5410, '支付订单新增', 'generator_paytradeorder_add', NULL, 5400, '1', 0, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:58:15', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (5420, '支付订单修改', 'generator_paytradeorder_edit', NULL, 5400, '1', 1, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:58:16', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (5430, '支付订单删除', 'generator_paytradeorder_del', NULL, 5400, '1', 2, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:58:18', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (5500, '回调记录', '', '/pay/notify/index', 5000, 'icon-huitiao', 4, '0', '0', '2018-01-20 13:17:19', '2020-03-24 08:58:19', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (5510, '记录新增', 'generator_paynotifyrecord_add', NULL, 5500, '1', 0, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:58:19', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (5520, '记录修改', 'generator_paynotifyrecord_edit', NULL, 5500, '1', 1, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:58:20', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (5530, '记录删除', 'generator_paynotifyrecord_del', NULL, 5500, '1', 2, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:58:21', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (6000, '微信管理', NULL, '/mp', -1, 'icon-gongzhonghao', 4, '0', '0', '2018-09-26 01:38:13', '2020-03-24 08:58:21', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (6100, '账号管理', '', '/mp/wxaccount/index', 6000, 'icon-weixincaidan', 8, '0', '0', '2018-01-20 13:17:19', '2020-03-24 08:58:22', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (6101, '公众号新增', 'mp_wxaccount_add', '', 6100, '1', 0, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:58:23', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (6102, '公众号修改', 'mp_wxaccount_edit', NULL, 6100, '1', 1, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:58:23', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (6103, '公众号删除', 'mp_wxaccount_del', NULL, 6100, '1', 2, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:58:25', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (6200, '粉丝管理', '', '/mp/wxaccountfans/index', 6000, 'icon-fensiguanli', 8, '0', '0', '2018-01-20 13:17:19', '2020-03-24 08:58:26', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (6201, '粉丝新增', 'mp_wxaccountfans_add', NULL, 6200, '1', 0, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:58:27', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (6202, '粉丝修改', 'mp_wxaccountfans_edit', NULL, 6200, '1', 1, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:58:30', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (6203, '粉丝删除', 'mp_wxaccountfans_del', NULL, 6200, '1', 2, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:58:31', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (6300, '消息管理', '', '/mp/wxfansmsg/index', 6000, 'icon-xiaoxiguanli', 8, '0', '0', '2018-01-20 13:17:19', '2020-03-24 08:58:31', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (6301, '消息新增', 'mp_wxfansmsg_add', NULL, 6300, '1', 0, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:58:32', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (6302, '消息修改', 'mp_wxfansmsg_edit', NULL, 6300, '1', 1, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:58:33', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (6303, '消息删除', 'mp_wxfansmsg_del', NULL, 6300, '1', 2, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:58:33', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (6304, '消息回复', 'mp_wxfansmsgres_add', NULL, 6300, '1', 3, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:58:37', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (6305, '回复删除', 'mp_wxfansmsgres_del', NULL, 6300, NULL, 1, '0', '1', '2019-03-28 22:53:49', '2020-03-24 08:58:35', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (6400, '菜单设置', NULL, '/mp/wxmenu/index', 6000, 'icon-anniu_weixincaidanlianjie', 6, '1', '0', '2019-03-29 15:20:12', '2020-03-24 08:58:38', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (6401, '保存', 'mp_wxmenu_add', NULL, 6400, NULL, 1, '0', '1', '2019-03-29 15:43:22', '2020-03-24 08:58:38', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (6402, '发布', 'mp_wxmenu_push', NULL, 6400, NULL, 1, '0', '1', '2019-03-29 15:43:54', '2020-03-24 08:58:39', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (6500, '运营数据', NULL, '/mp/wxstatistics/index', 6000, 'icon-zhexiantu', 7, '1', '0', '2019-04-14 00:15:35', '2020-03-24 08:58:40', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (10000, '文件管理', NULL, '/admin/file/index', 2000, 'icon-wenjianguanli', 6, '1', '0', '2019-06-25 12:44:46', '2020-03-24 08:58:41', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (10001, '删除文件', 'sys_file_del', NULL, 10000, NULL, 1, '0', '1', '2019-06-25 13:41:41', '2020-03-24 08:58:42', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (10002, '表单管理', '', '/gen/form', 10006, 'icon-record', 3, '0', '0', '2018-01-20 13:17:19', '2020-03-24 08:58:44', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (10003, '表单新增', 'gen_form_add', NULL, 10002, '1', 0, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:58:45', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (10004, '表单修改', 'gen_form_edit', NULL, 10002, '1', 1, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:58:46', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (10005, '表单删除', 'gen_form_del', NULL, 10002, '1', 2, '0', '1', '2018-05-15 21:35:18', '2020-03-24 08:58:47', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (10006, '开发平台', NULL, '/gen', -1, 'icon-shejiyukaifa-', 9, '1', '0', '2019-08-12 09:35:16', '2020-03-24 08:58:48', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (10007, '数据源管理', NULL, '/gen/datasource', 10006, 'icon-mysql', 0, '1', '0', '2019-08-12 09:42:11', '2020-03-24 08:58:49', '0', 1);
|
||||
INSERT INTO `sys_menu` VALUES (10008, '表单设计', NULL, '/gen/design', 10006, 'icon-biaodanbiaoqian', 2, '1', '0', '2019-08-16 10:08:56', '2020-03-24 08:58:53', '0', 1);
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
@@ -451,6 +399,7 @@ COMMIT;
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_oauth_client_details`;
|
||||
CREATE TABLE `sys_oauth_client_details` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`client_id` varchar(32) NOT NULL,
|
||||
`resource_ids` varchar(256) DEFAULT NULL,
|
||||
`client_secret` varchar(256) DEFAULT NULL,
|
||||
@@ -462,21 +411,21 @@ CREATE TABLE `sys_oauth_client_details` (
|
||||
`refresh_token_validity` int(11) DEFAULT NULL,
|
||||
`additional_information` varchar(4096) DEFAULT NULL,
|
||||
`autoapprove` varchar(256) DEFAULT NULL,
|
||||
`del_flag` char(1) DEFAULT '0',
|
||||
`tenant_id` int(11) NOT NULL DEFAULT '0' COMMENT '所属租户',
|
||||
PRIMARY KEY (`client_id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='终端信息表';
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COMMENT='终端信息表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_oauth_client_details
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `sys_oauth_client_details` VALUES ('app', NULL, 'app', 'server', 'password,refresh_token,authorization_code,client_credentials,implicit', NULL, NULL, 43200, 2592001, NULL, 'true', 1);
|
||||
INSERT INTO `sys_oauth_client_details` VALUES ('daemon', NULL, 'daemon', 'server', 'password,refresh_token', NULL, NULL, NULL, NULL, NULL, 'true', 1);
|
||||
INSERT INTO `sys_oauth_client_details` VALUES ('gen', NULL, 'gen', 'server', 'password,refresh_token', NULL, NULL, NULL, NULL, NULL, 'true', 1);
|
||||
INSERT INTO `sys_oauth_client_details` VALUES ('mp', NULL, 'mp', 'server', 'password,refresh_token', NULL, NULL, NULL, NULL, NULL, 'true', 1);
|
||||
INSERT INTO `sys_oauth_client_details` VALUES ('pig', NULL, 'pig', 'server', 'password,refresh_token,authorization_code,client_credentials', '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, NULL, NULL, NULL, 'false', 1);
|
||||
INSERT INTO `sys_oauth_client_details` VALUES ('qwe', NULL, 'qwe', 'qwe', 'implicit', NULL, NULL, NULL, NULL, NULL, 'false', 0);
|
||||
INSERT INTO `sys_oauth_client_details` VALUES ('test', NULL, 'test', 'server', 'password,refresh_token', NULL, NULL, NULL, NULL, NULL, 'true', 1);
|
||||
INSERT INTO `sys_oauth_client_details` VALUES (1, 'app', NULL, 'app', 'server', 'password,refresh_token,authorization_code,client_credentials,implicit', NULL, NULL, 43200, 2592001, NULL, 'true', '0', 1);
|
||||
INSERT INTO `sys_oauth_client_details` VALUES (2, 'daemon', NULL, 'daemon', 'server', 'password,refresh_token', NULL, NULL, NULL, NULL, NULL, 'true', '0', 1);
|
||||
INSERT INTO `sys_oauth_client_details` VALUES (3, 'gen', NULL, 'gen', 'server', 'password,refresh_token', NULL, NULL, NULL, NULL, NULL, 'true', '0', 1);
|
||||
INSERT INTO `sys_oauth_client_details` VALUES (4, 'mp', NULL, 'mp', 'server', 'password,refresh_token', NULL, NULL, NULL, NULL, NULL, 'true', '0', 1);
|
||||
INSERT INTO `sys_oauth_client_details` VALUES (5, 'pig', NULL, 'pig', 'server', 'password,refresh_token,authorization_code,client_credentials', '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, NULL, NULL, NULL, 'false', '0', 1);
|
||||
INSERT INTO `sys_oauth_client_details` VALUES (6, 'test', NULL, 'test', 'server', 'password,refresh_token', NULL, NULL, NULL, NULL, NULL, 'true', '0', 1);
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
@@ -490,8 +439,8 @@ CREATE TABLE `sys_public_param` (
|
||||
`public_value` varchar(128) DEFAULT NULL,
|
||||
`status` char(1) DEFAULT '0',
|
||||
`validate_code` varchar(64) DEFAULT NULL,
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`public_type` char(1) DEFAULT '0',
|
||||
`system` char(1) DEFAULT '0',
|
||||
`del_flag` char(1) DEFAULT '0',
|
||||
@@ -510,8 +459,8 @@ CREATE TABLE `sys_role` (
|
||||
`role_desc` varchar(255) DEFAULT NULL,
|
||||
`ds_type` char(1) DEFAULT '2',
|
||||
`ds_scope` varchar(255) DEFAULT NULL,
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`update_time` datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
|
||||
`del_flag` char(1) DEFAULT '0',
|
||||
`tenant_id` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`role_id`) USING BTREE,
|
||||
@@ -522,7 +471,7 @@ CREATE TABLE `sys_role` (
|
||||
-- Records of sys_role
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `sys_role` VALUES (1, '管理员', 'ROLE_ADMIN', '管理员', '3', '2', '2017-10-29 15:45:51', '2018-12-26 14:09:11', '0', 1);
|
||||
INSERT INTO `sys_role` VALUES (1, '管理员', 'ROLE_ADMIN', '管理员', '0', '2', '2017-10-29 15:45:51', '2018-12-26 14:09:11', '0', 1);
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
@@ -600,9 +549,6 @@ INSERT INTO `sys_role_menu` VALUES (1, 3300);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 3400);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 3500);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 3600);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 3601);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 3620);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 3630);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 4000);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 4100);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 4101);
|
||||
@@ -738,8 +684,8 @@ CREATE TABLE `sys_tenant` (
|
||||
`end_time` timestamp NULL DEFAULT NULL COMMENT '结束时间',
|
||||
`status` char(1) DEFAULT '0',
|
||||
`del_flag` char(1) DEFAULT '0',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建',
|
||||
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='租户表';
|
||||
|
||||
@@ -747,7 +693,7 @@ CREATE TABLE `sys_tenant` (
|
||||
-- Records of sys_tenant
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `sys_tenant` VALUES (1, '北京分公司', '1', '2019-05-15 00:00:00', '2020-05-15 00:00:00', '0', '0', '2019-05-15 15:44:57', '2019-05-18 14:47:30');
|
||||
INSERT INTO `sys_tenant` VALUES (1, '北京分公司', '1', '2019-05-15 00:00:00', '2029-05-15 00:00:00', '0', '0', '2019-05-15 15:44:57', '2019-05-18 14:47:30');
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
@@ -762,8 +708,8 @@ CREATE TABLE `sys_user` (
|
||||
`phone` varchar(20) DEFAULT NULL,
|
||||
`avatar` varchar(255) DEFAULT NULL,
|
||||
`dept_id` int(11) DEFAULT NULL COMMENT '部门ID',
|
||||
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`lock_flag` char(1) DEFAULT '0',
|
||||
`del_flag` char(1) DEFAULT '0',
|
||||
`wx_openid` varchar(32) DEFAULT NULL COMMENT '微信登录openId',
|
||||
|
||||
+13
-61
@@ -7,45 +7,6 @@ USE pigxx_job;
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for job_execution_log
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `job_execution_log`;
|
||||
CREATE TABLE `job_execution_log` (
|
||||
`id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`job_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`task_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`hostname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`sharding_item` int(11) NOT NULL,
|
||||
`execution_source` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`failure_cause` varchar(4000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`is_success` int(11) NOT NULL,
|
||||
`start_time` timestamp NULL DEFAULT NULL,
|
||||
`complete_time` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='任务日志表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for job_status_trace_log
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `job_status_trace_log`;
|
||||
CREATE TABLE `job_status_trace_log` (
|
||||
`id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`job_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`original_task_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`task_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`slave_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`source` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`execution_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`sharding_item` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`state` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`message` varchar(4000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`creation_time` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `TASK_ID_STATE_INDEX` (`task_id`,`state`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='任务轨迹表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for qrtz_blob_triggers
|
||||
-- ----------------------------
|
||||
@@ -267,9 +228,9 @@ CREATE TABLE `sys_job` (
|
||||
`job_status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '状态(1、未发布;2、运行中;3、暂停;4、删除;)',
|
||||
`job_execute_status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '状态(0正常 1异常)',
|
||||
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建者',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '更新者',
|
||||
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP 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 '下次执行时间',
|
||||
@@ -298,7 +259,7 @@ CREATE TABLE `sys_job_log` (
|
||||
`job_log_status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '0' COMMENT '执行状态(0正常 1失败)',
|
||||
`execute_time` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '执行时间',
|
||||
`exception_info` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '' COMMENT '异常信息',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`tenant_id` int(11) NOT NULL DEFAULT '1' COMMENT '租户id',
|
||||
PRIMARY KEY (`job_log_id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='定时任务执行日志表';
|
||||
@@ -315,13 +276,13 @@ CREATE TABLE `xxl_job_group` (
|
||||
`address_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '执行器地址类型:0=自动注册、1=手动录入',
|
||||
`address_list` varchar(512) DEFAULT NULL COMMENT '执行器地址列表,多地址逗号分隔',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of xxl_job_group
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `xxl_job_group` VALUES (1, 'xxl-job-executor-sample', '示例执行器', 1, 0, NULL);
|
||||
INSERT INTO `xxl_job_group` VALUES (1, 'xxl-job-executor', '示例执行器', 1, 0, NULL);
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
@@ -352,13 +313,13 @@ CREATE TABLE `xxl_job_info` (
|
||||
`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 AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of xxl_job_info
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `xxl_job_info` VALUES (1, 1, '0 0 0 * * ? *', '测试任务1', '2018-11-03 22:21:31', '2018-11-03 22:21:31', 'XXL', '', 'FIRST', 'demoJobHandler', '', 'SERIAL_EXECUTION', 0, 0, 'BEAN', '', 'GLUE代码初始化', '2018-11-03 22:21:31', '', 0, 0, 0);
|
||||
INSERT INTO `xxl_job_info`(`id`, `job_group`, `job_cron`, `job_desc`, `add_time`, `update_time`, `author`, `alarm_email`, `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`, `trigger_status`, `trigger_last_time`, `trigger_next_time`) VALUES (1, 1, '0 0 0 * * ? *', '测试任务1', '2018-11-03 22:21:31', '2020-04-15 13:58:35', 'lengleng', '', 'ROUND', 'demoJobHandler', '', 'DISCARD_LATER', 0, 0, 'BEAN', '', 'GLUE代码初始化', '2018-11-03 22:21:31', '', 0, 0, 0);
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
@@ -368,7 +329,7 @@ DROP TABLE IF EXISTS `xxl_job_lock`;
|
||||
CREATE TABLE `xxl_job_lock` (
|
||||
`lock_name` varchar(50) NOT NULL COMMENT '锁名称',
|
||||
PRIMARY KEY (`lock_name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of xxl_job_lock
|
||||
@@ -400,7 +361,7 @@ CREATE TABLE `xxl_job_log` (
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `I_trigger_time` (`trigger_time`),
|
||||
KEY `I_handle_code` (`handle_code`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for xxl_job_log_report
|
||||
@@ -414,16 +375,7 @@ CREATE TABLE `xxl_job_log_report` (
|
||||
`fail_count` int(11) NOT NULL DEFAULT '0' COMMENT '执行失败-日志数量',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `i_trigger_day` (`trigger_day`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of xxl_job_log_report
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `xxl_job_log_report` VALUES (1, '2019-12-09 00:00:00', 0, 0, 0);
|
||||
INSERT INTO `xxl_job_log_report` VALUES (2, '2019-12-08 00:00:00', 0, 0, 0);
|
||||
INSERT INTO `xxl_job_log_report` VALUES (3, '2019-12-07 00:00:00', 0, 0, 0);
|
||||
COMMIT;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for xxl_job_logglue
|
||||
@@ -438,7 +390,7 @@ CREATE TABLE `xxl_job_logglue` (
|
||||
`add_time` datetime DEFAULT NULL,
|
||||
`update_time` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for xxl_job_registry
|
||||
@@ -452,7 +404,7 @@ CREATE TABLE `xxl_job_registry` (
|
||||
`update_time` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `i_g_k_v` (`registry_group`,`registry_key`,`registry_value`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for xxl_job_user
|
||||
@@ -466,7 +418,7 @@ CREATE TABLE `xxl_job_user` (
|
||||
`permission` varchar(255) DEFAULT NULL COMMENT '权限:执行器ID列表,多个逗号分割',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `i_username` (`username`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of xxl_job_user
|
||||
|
||||
+122
-110
@@ -9,41 +9,41 @@ SET FOREIGN_KEY_CHECKS = 0;
|
||||
DROP TABLE IF EXISTS `config_info`;
|
||||
CREATE TABLE `config_info` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`data_id` varchar(255) DEFAULT NULL,
|
||||
`group_id` varchar(255) DEFAULT NULL,
|
||||
`content` longtext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'content',
|
||||
`md5` varchar(32) DEFAULT NULL,
|
||||
`data_id` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'data_id',
|
||||
`group_id` varchar(255) COLLATE utf8_bin DEFAULT NULL,
|
||||
`content` longtext COLLATE utf8_bin NOT NULL COMMENT 'content',
|
||||
`md5` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT 'md5',
|
||||
`gmt_create` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '创建时间',
|
||||
`gmt_modified` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '修改时间',
|
||||
`src_user` mediumtext,
|
||||
`src_ip` varchar(20) DEFAULT NULL,
|
||||
`app_name` varchar(128) DEFAULT NULL,
|
||||
`tenant_id` varchar(128) 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` mediumtext,
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE KEY `uk_configinfo_datagrouptenant` (`data_id`,`group_id`,`tenant_id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=utf8mb4 COMMENT='config_info';
|
||||
`src_user` text COLLATE utf8_bin COMMENT 'source user',
|
||||
`src_ip` varchar(20) COLLATE utf8_bin DEFAULT NULL COMMENT 'source ip',
|
||||
`app_name` varchar(128) COLLATE utf8_bin DEFAULT NULL,
|
||||
`tenant_id` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT '租户字段',
|
||||
`c_desc` varchar(256) COLLATE utf8_bin DEFAULT NULL,
|
||||
`c_use` varchar(64) COLLATE utf8_bin DEFAULT NULL,
|
||||
`effect` varchar(64) COLLATE utf8_bin DEFAULT NULL,
|
||||
`type` varchar(64) COLLATE utf8_bin DEFAULT NULL,
|
||||
`c_schema` text COLLATE utf8_bin,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_configinfo_datagrouptenant` (`data_id`,`group_id`,`tenant_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of config_info
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `config_info` VALUES (1, 'application-dev.yml', 'DEFAULT_GROUP', 'jasypt:\n encryptor:\n password: pigx\n \nspring:\n redis:\n host: pigx-redis\n servlet:\n multipart:\n max-file-size: 100MB\n max-request-size: 100MB\n cloud:\n sentinel:\n transport:\n dashboard: pigx-sentinel:5020\n \nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n\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\nribbon:\n ReadTimeout: 10000\n ConnectTimeout: 10000\n\n\nmybatis-plus:\n tenant-enable: ture\n mapper-locations: classpath:/mapper/*Mapper.xml\n global-config:\n banner: false\n db-config:\n id-type: auto\n field-strategy: NOT_EMPTY\n type-handlers-package: com.pig4cloud.pigx.common.data.handler\n\nswagger:\n title: PigX Swagger API\n license: Powered By PigX\n licenseUrl: https://pig4cloud.com/\n terms-of-service-url: https://pig4cloud.com/\n contact:\n email: wangiegie@gmail.com\n url: https://pig4cloud.com/about.html\n authorization:\n name: pigX OAuth\n auth-regex: ^.*$\n authorization-scope-list:\n - scope: server\n description: server all\n token-url-list:\n - http://${GATEWAY-HOST:pigx-gateway}:${GATEWAY-PORT:9999}/auth/oauth/token\n\nsecurity:\n oauth2:\n client:\n ignore-urls:\n - /actuator/**\n - /v2/api-docs\n resource:\n loadBalanced: true\n token-info-uri: http://pigx-auth/oauth/check_token', '8f6a2d54269c4e0769da90ecaa1d3698', '2019-04-18 02:10:20', '2019-12-31 12:54:53', NULL, '172.17.0.157', '', '', '通用配置文件', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (2, 'pigx-auth-dev.yml', 'DEFAULT_GROUP', '# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL-USER:root}\n password: ${MYSQL-PWD:root}\n url: jdbc:mysql://${MYSQL-HOST:pigx-mysql}:${MYSQL-PORT:3306}/${MYSQL-DB:pigxx}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\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/', 'a6674e6747c1a0bb6c6d78e13706f8f0', '2019-04-18 02:11:32', '2019-08-27 18:24:04', NULL, '127.0.0.1', '', '', '认证中心配置文件', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (3, 'pigx-codegen-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)\n client-secret: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)\n scope: server\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL-USER:root}\n password: ${MYSQL-PWD:root}\n url: jdbc:mysql://${MYSQL-HOST:pigx-mysql}:${MYSQL-PORT:3306}/${MYSQL-DB:pigxx_codegen}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n resources:\n static-locations: classpath:/static/,classpath:/views/\n\npigx:\n tenant:\n column: tenant_id\n tables:\n - sys_datasource_conf', 'b7d132a3ecdfac4252c994adbb65b23a', '2019-04-18 02:12:10', '2019-08-27 18:24:18', NULL, '127.0.0.1', '', '', '代码生成', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (4, 'pigx-daemon-elastic-job-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(tz2NM4GcmnE7sNJTYL8ZSg==)\n client-secret: ENC(tz2NM4GcmnE7sNJTYL8ZSg==)\n scope: server\n## 定时任务\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL-USER:root}\n password: ${MYSQL-PWD:root}\n url: jdbc:mysql://${MYSQL-HOST:pigx-mysql}:${MYSQL-PORT:3306}/${MYSQL-DB:pigxx_job}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n elasticjob:\n # 分布式任务协调依赖zookeeper\n zookeeper:\n server-lists: ${ZOOKEEPER-HOST:pigx-zookeeper}:${ZOOKEEPER-PORT:2181}\n namespace: pigx-daemon\n # 普通任务\n simples:\n spring-simple-job:\n job-class: com.pig4cloud.pigx.daemon.elastic.job.PigxSimpleJob\n cron: 0 0 0/1 * * ?\n sharding-total-count: 3\n sharding-item-parameters: 0=service1,1=service2,2=service3\n eventTraceRdbDataSource: \'dataSource\'\n listener:\n listener-class: com.pig4cloud.pigx.daemon.elastic.listener.PigxElasticJobListener\n spring-simple-job2:\n job-class: com.pig4cloud.pigx.daemon.elastic.job.PigxSimpleJob2\n cron: 0 0 0/1 * * ?\n sharding-total-count: 3\n sharding-item-parameters: 0=service1,1=service2,2=service3\n eventTraceRdbDataSource: \'dataSource\'\n listener:\n listener-class: com.pig4cloud.pigx.daemon.elastic.listener.PigxElasticJobListener\n # 简单任务\n dataflows:\n spring-dataflow-job:\n job-class: com.pig4cloud.pigx.daemon.elastic.job.PigxDataflowJob\n cron: 0 0 0/1 * * ?\n sharding-total-count: 3\n sharding-item-parameters: 0=service1,1=service2,2=service3\n streaming-process: true\n eventTraceRdbDataSource: \'dataSource\'\n listener:\n distributed-listener-class: com.pig4cloud.pigx.daemon.elastic.listener.PigxDistributeElasticJobListener\n started-timeout-milliseconds: 5000\n completed-timeout-milliseconds: 10000\n\nxxl:\n job:\n admin:\n addresses: http://${XXL-HOST:pigx-xxl}:${XXL-HOST:9080}/xxl-job-admin\n executor:\n port: 9988\n appName: test-xxl', '9ce58242d57b57f737dcb59a41ee6e55', '2019-04-18 02:12:57', '2019-10-04 11:22:56', NULL, '127.0.0.1', '', '', '定时任务-elastic-job配置', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (1, 'application-dev.yml', 'DEFAULT_GROUP', 'jasypt:\n encryptor:\n password: pigx\n \nspring:\n redis:\n host: pigx-redis\n servlet:\n multipart:\n max-file-size: 100MB\n max-request-size: 100MB\n cloud:\n sentinel:\n eager: true\n filter:\n url-patterns: /** \n transport:\n dashboard: pigx-sentinel:5020\n \nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n\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\nribbon:\n ReadTimeout: 10000\n ConnectTimeout: 10000\n\n#开启灰度\ngray:\n rule:\n enabled: true\n\nmybatis-plus:\n tenant-enable: ture\n mapper-locations: classpath:/mapper/*Mapper.xml\n global-config:\n banner: false\n db-config:\n id-type: auto\n field-strategy: NOT_EMPTY\n type-handlers-package: com.pig4cloud.pigx.common.data.handler\n\nswagger:\n title: PigX Swagger API\n license: Powered By PigX\n licenseUrl: https://pig4cloud.com/\n terms-of-service-url: https://pig4cloud.com/\n contact:\n email: wangiegie@gmail.com\n url: https://pig4cloud.com/about.html\n authorization:\n name: pigX OAuth\n auth-regex: ^.*$\n authorization-scope-list:\n - scope: server\n description: server all\n token-url-list:\n - http://${GATEWAY_HOST:pigx-gateway}:${GATEWAY_PORT:9999}/auth/oauth/token\n\nsecurity:\n oauth2:\n client:\n ignore-urls:\n - /actuator/**\n - /v2/api-docs\n resource:\n loadBalanced: true\n token-info-uri: http://pigx-auth/oauth/check_token', '954b56ac77f2691529aad5c497591b28', '2019-04-18 02:10:20', '2020-02-24 13:58:21', NULL, '172.17.0.125', '', '', '通用配置文件', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (2, 'pigx-auth-dev.yml', 'DEFAULT_GROUP', '# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\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/', 'a6674e6747c1a0bb6c6d78e13706f8f0', '2019-04-18 02:11:32', '2019-08-27 18:24:04', NULL, '127.0.0.1', '', '', '认证中心配置文件', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (3, 'pigx-codegen-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)\n client-secret: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)\n scope: server\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx_codegen}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n resources:\n static-locations: classpath:/static/,classpath:/views/\n\npigx:\n tenant:\n column: tenant_id\n tables:\n - gen_datasource_conf', 'b7d132a3ecdfac4252c994adbb65b23a', '2019-04-18 02:12:10', '2019-08-27 18:24:18', NULL, '127.0.0.1', '', '', '代码生成', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (4, 'pigx-daemon-elastic-job-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(tz2NM4GcmnE7sNJTYL8ZSg==)\n client-secret: ENC(tz2NM4GcmnE7sNJTYL8ZSg==)\n scope: server\n## 定时任务\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx_job}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n\nxxl:\n job:\n admin:\n addresses: http://${XXL_HOST:pigx-xxl}:${XXL_HOST:9080}/xxl-job-admin', 'af2d24afd75cbd73c3bbc8297ca65bc9', '2019-04-18 02:12:57', '2020-04-15 21:56:37', NULL, '127.0.0.1', '', '', '定时任务-elastic-job配置', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (5, 'pigx-gateway-dev.yml', 'DEFAULT_GROUP', 'security:\n encode:\n key: \'pigxpigxpigxpigx\'\n\nignore:\n clients:\n - test\n swagger-providers:\n - pigx-auth\n - pigx-tx-manager\n\nribbon:\n rule:\n gray-enabled: true', '24403a5b205b1e9d320078e309584bbc', '2019-04-18 02:13:52', '2019-10-20 17:07:42', NULL, '127.0.0.1', '', '', '网关配置文件', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (6, 'pigx-monitor-dev.yml', 'DEFAULT_GROUP', 'spring:\n # 安全配置\n security:\n user:\n name: ENC(rZHA4LW5hHmhLAAzJoFNag==) # pigx\n password: ENC(bjeyh+Aeii3kHXkoo00ZUw==) # pigx\n boot:\n admin:\n ui:\n title: \'pigx 服务状态监控\'\n brand: \'pigx 服务状态监控\'\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n endpoint:\n health:\n show-details: ALWAYS #显示详细信息', '7925a0c734460526262319b6a189e39d', '2019-04-18 02:14:17', '2019-12-31 19:04:00', NULL, '172.17.0.157', '', '', '监控配置文件', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (7, 'pigx-upms-biz-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(ltJPpR50wT0oIY9kfOe1Iw==)\n client-secret: ENC(ltJPpR50wT0oIY9kfOe1Iw==)\n scope: server\n ignore-urls:\n - /druid/**\n - /actuator/**\n - /v2/api-docs\n\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL-USER:root}\n password: ${MYSQL-PWD:root}\n url: jdbc:mysql://${MYSQL-HOST:pigx-mysql}:${MYSQL-PORT:3306}/${MYSQL-DB:pigxx}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n stat-view-servlet:\n enabled: true\n url-pattern: /druid/*\n #login-username: admin\n #login-password: admin\n filter:\n stat:\n enabled: true\n log-slow-sql: true\n slow-sql-millis: 10000\n merge-sql: false\n wall:\n config:\n multi-statement-allow: true\n\n# 文件系统 (提供测试环境,不要乱传)\nminio:\n url: http://minio.pig4cloud.com\n access-key: lengleng\n secret-key: lengleng\n\n# Logger Config\nlogging:\n level:\n com.pig4cloud.pigx.admin.mapper: debug\n\n# 租户表维护\npigx:\n tenant:\n column: tenant_id\n tables:\n - sys_user\n - sys_role\n - sys_dept\n - sys_log\n - sys_social_details\n - sys_dict\n - sys_dict_item\n - sys_public_param\n - sys_log\n - sys_file', 'fab3a6b4cb292954d9841b22a41e3dab', '2019-04-18 02:32:44', '2019-11-01 12:22:38', NULL, '127.0.0.1', '', '', 'admin 服务配置', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (7, 'pigx-upms-biz-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(ltJPpR50wT0oIY9kfOe1Iw==)\n client-secret: ENC(ltJPpR50wT0oIY9kfOe1Iw==)\n scope: server\n ignore-urls:\n - /druid/**\n - /actuator/**\n - /v2/api-docs\n\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n stat-view-servlet:\n enabled: true\n url-pattern: /druid/*\n #login-username: admin\n #login-password: admin\n filter:\n stat:\n enabled: true\n log-slow-sql: true\n slow-sql-millis: 10000\n merge-sql: false\n wall:\n config:\n multi-statement-allow: true\n\n# 文件系统 (提供测试环境,不要乱传)\nminio:\n url: http://minio.pig4cloud.com\n access-key: lengleng\n secret-key: lengleng\n\n# Logger Config\nlogging:\n level:\n com.pig4cloud.pigx.admin.mapper: debug\n\n# 租户表维护\npigx:\n tenant:\n column: tenant_id\n tables:\n - sys_user\n - sys_role\n - sys_menu\n - sys_dept\n - sys_log\n - sys_social_details\n - sys_dict\n - sys_dict_item\n - sys_public_param\n - sys_log\n - sys_file\n - sys_oauth_client_details', 'fab3a6b4cb292954d9841b22a41e3dab', '2019-04-18 02:32:44', '2019-11-01 12:22:38', NULL, '127.0.0.1', '', '', 'admin 服务配置', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (8, 'pigx-tx-manager-dev.yml', 'DEFAULT_GROUP', '# 页面配置\nspring:\n mvc:\n static-path-pattern: /**\n resources:\n static-locations: classpath:/static/\n\n\n# LCN 配置\ntm:\n transaction:\n netty:\n delaytime: 5 # 客户端链接最大通讯时间 (秒)\n hearttime: 15 # 客户端心跳时间 (秒)\n redis:\n savemaxtime: 30 # redis 保存时间 (秒)\n socket:\n port: 9998 # 通讯端口\n maxconnection: 1000 #最大链接数\n compensate:\n auto: false #是否自动补偿\n notifyUrl: http://ip:port/path #补偿结果通知(配消息总线里面)\n tryTime: 30 # z再次重试时间间隔\n maxWaitTime: 5000 # 请求超时的最大时间 (毫秒)', '885f5c125f2df7a08692929ccce154be', '2019-04-18 02:54:03', '2019-04-18 02:54:03', NULL, '127.0.0.1', '', '', '分布式事务协调模块', NULL, NULL, 'yaml', NULL);
|
||||
INSERT INTO `config_info` VALUES (9, 'pigx-daemon-quartz-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(tz2NM4GcmnE7sNJTYL8ZSg==)\n client-secret: ENC(tz2NM4GcmnE7sNJTYL8ZSg==)\n scope: server\n\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL-USER:root}\n password: ${MYSQL-PWD:root}\n url: jdbc:mysql://${MYSQL-HOST:pigx-mysql}:${MYSQL-PORT:3306}/${MYSQL-DB:pigxx_job}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n resources:\n static-locations: classpath:/static/,classpath:/views/\n quartz:\n #相关属性配置\n properties:\n org:\n quartz:\n scheduler:\n instanceName: clusteredScheduler\n instanceId: AUTO\n jobStore:\n class: org.quartz.impl.jdbcjobstore.JobStoreTX\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 #初始化表结构\n #jdbc:\n #initialize-schema: never\n\n', '276cf549fb8b084e35dc07d1eb309932', '2019-04-18 03:08:34', '2019-08-27 18:25:41', NULL, '127.0.0.1', '', '', 'quartz 配置文件', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (10, 'pigx-pay-platform-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)\n client-secret: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)\n scope: server\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL-USER:root}\n password: ${MYSQL-PWD:root}\n url: jdbc:mysql://${MYSQL-HOST:pigx-mysql}:${MYSQL-PORT:3306}/${MYSQL-DB:pigxx_pay}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n\n# 租户表维护\npigx:\n pay:\n test: lengleng\n aliPayConfig:\n expire-time: 30\n return-url: http://pig4cloud.com\n notify-url: https://admin.pig4cloud.com/pay/notify/ali/callbak\n wxPayConfig:\n notify-url: https://admin.pig4cloud.com/pay/notify/wx/callbak\n xsequence: #发号器相关配置\n db:\n retry-times: 3\n table-name: pay_sequence\n tenant:\n column: tenant_id\n tables:\n - pay_channel\n - pay_trade_order\n - pay_goods_order\n - pay_notify_record', 'bf185a74bb9af224bfe7f8f52ae3c9cb', '2019-05-28 11:46:27', '2019-08-27 18:26:01', NULL, '127.0.0.1', '', '', '支付模块配置', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (11, 'pigx-oa-platform-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)\n client-secret: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)\n scope: server\n ignore-urls:\n - \'/actuator/**\'\n - \'/v2/api-docs\'\n - \'/editor-app/**\'\n - \'/modeler.html\'\n - \'/ws/**\'\nspring:\n autoconfigure:\n exclude: org.activiti.spring.boot.SecurityAutoConfiguration\n activiti:\n check-process-definitions: false\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL-USER:root}\n password: ${MYSQL-PWD:root}\n url: jdbc:mysql://${MYSQL-HOST:pigx-mysql}:${MYSQL-PORT:3306}/${MYSQL-DB:pigxx_ac}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n\n# 租户表维护\npigx:\n tenant:\n column: tenant_id\n tables:\n - oa_leave_bill', 'bb2ee29e458875b0334e9f204f958272', '2019-10-16 16:38:52', '2019-10-16 16:38:52', NULL, '127.0.0.1', '', '', NULL, NULL, NULL, 'yaml', NULL);
|
||||
INSERT INTO `config_info` VALUES (12, 'pigx-mp-platform-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(vW+Nup9LaTfIFwgufUBsYg==)\n client-secret: ENC(vW+Nup9LaTfIFwgufUBsYg==)\n scope: server\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL-USER:root}\n password: ${MYSQL-PWD:root}\n url: jdbc:mysql://${MYSQL-HOST:pigx-mysql}:${MYSQL-PORT:3306}/${MYSQL-DB:pigxx_mp}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n resources:\n static-locations: classpath:/static/,classpath:/views/\n\n\n# 租户表维护\npigx:\n tenant:\n column: tenant_id\n tables:\n - wx_mp_menu\n - wx_account\n - wx_account_fans\n - wx_fans_msg_res', 'bf4f6943566ce47a98551923bc4c4f80', '2019-10-21 08:58:24', '2019-10-21 08:58:24', NULL, '127.0.0.1', '', '', NULL, NULL, NULL, 'yaml', NULL);
|
||||
INSERT INTO `config_info` VALUES (9, 'pigx-daemon-quartz-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(tz2NM4GcmnE7sNJTYL8ZSg==)\n client-secret: ENC(tz2NM4GcmnE7sNJTYL8ZSg==)\n scope: server\n\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx_job}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n resources:\n static-locations: classpath:/static/,classpath:/views/\n quartz:\n #相关属性配置\n properties:\n org:\n quartz:\n scheduler:\n instanceName: clusteredScheduler\n instanceId: AUTO\n jobStore:\n class: org.quartz.impl.jdbcjobstore.JobStoreTX\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 #初始化表结构\n #jdbc:\n #initialize-schema: never\n\n', '276cf549fb8b084e35dc07d1eb309932', '2019-04-18 03:08:34', '2019-08-27 18:25:41', NULL, '127.0.0.1', '', '', 'quartz 配置文件', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (10, 'pigx-pay-platform-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)\n client-secret: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)\n scope: server\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx_pay}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n\n# 租户表维护\npigx:\n pay:\n test: lengleng\n aliPayConfig:\n expire-time: 30\n return-url: http://pig4cloud.com\n notify-url: https://admin.pig4cloud.com/pay/notify/ali/callbak\n wxPayConfig:\n notify-url: https://admin.pig4cloud.com/pay/notify/wx/callbak\n xsequence: #发号器相关配置\n db:\n retry-times: 3\n table-name: pay_sequence\n tenant:\n column: tenant_id\n tables:\n - pay_channel\n - pay_trade_order\n - pay_goods_order\n - pay_notify_record', 'bf185a74bb9af224bfe7f8f52ae3c9cb', '2019-05-28 11:46:27', '2019-08-27 18:26:01', NULL, '127.0.0.1', '', '', '支付模块配置', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (11, 'pigx-oa-platform-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)\n client-secret: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)\n scope: server\n ignore-urls:\n - \'/actuator/**\'\n - \'/v2/api-docs\'\n - \'/editor-app/**\'\n - \'/modeler.html\'\n - \'/ws/**\'\nspring:\n autoconfigure:\n exclude: org.activiti.spring.boot.SecurityAutoConfiguration\n activiti:\n check-process-definitions: false\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx_ac}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n\n# 租户表维护\npigx:\n tenant:\n column: tenant_id\n tables:\n - oa_leave_bill', 'bb2ee29e458875b0334e9f204f958272', '2019-10-16 16:38:52', '2019-10-16 16:38:52', NULL, '127.0.0.1', '', '', NULL, NULL, NULL, 'yaml', NULL);
|
||||
INSERT INTO `config_info` VALUES (12, 'pigx-mp-platform-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(vW+Nup9LaTfIFwgufUBsYg==)\n client-secret: ENC(vW+Nup9LaTfIFwgufUBsYg==)\n scope: server\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx_mp}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n resources:\n static-locations: classpath:/static/,classpath:/views/\n\n\n# 租户表维护\npigx:\n tenant:\n column: tenant_id\n tables:\n - wx_mp_menu\n - wx_account\n - wx_account_fans\n - wx_fans_msg_res', 'bf4f6943566ce47a98551923bc4c4f80', '2019-10-21 08:58:24', '2019-10-21 08:58:24', NULL, '127.0.0.1', '', '', NULL, NULL, NULL, 'yaml', NULL);
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
@@ -52,16 +52,16 @@ COMMIT;
|
||||
DROP TABLE IF EXISTS `config_info_aggr`;
|
||||
CREATE TABLE `config_info_aggr` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`data_id` varchar(255) DEFAULT NULL,
|
||||
`group_id` varchar(128) DEFAULT NULL,
|
||||
`datum_id` varchar(255) DEFAULT NULL,
|
||||
`content` longtext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '内容',
|
||||
`data_id` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'data_id',
|
||||
`group_id` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'group_id',
|
||||
`datum_id` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'datum_id',
|
||||
`content` longtext COLLATE utf8_bin NOT NULL COMMENT '内容',
|
||||
`gmt_modified` datetime NOT NULL COMMENT '修改时间',
|
||||
`app_name` varchar(128) DEFAULT NULL,
|
||||
`tenant_id` varchar(128) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE KEY `uk_configinfoaggr_datagrouptenantdatum` (`data_id`,`group_id`,`tenant_id`,`datum_id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='增加租户字段';
|
||||
`app_name` varchar(128) COLLATE utf8_bin DEFAULT NULL,
|
||||
`tenant_id` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT '租户字段',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_configinfoaggr_datagrouptenantdatum` (`data_id`,`group_id`,`tenant_id`,`datum_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='增加租户字段';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for config_info_beta
|
||||
@@ -69,20 +69,20 @@ CREATE TABLE `config_info_aggr` (
|
||||
DROP TABLE IF EXISTS `config_info_beta`;
|
||||
CREATE TABLE `config_info_beta` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`data_id` varchar(255) DEFAULT NULL,
|
||||
`group_id` varchar(128) DEFAULT NULL,
|
||||
`app_name` varchar(128) DEFAULT NULL,
|
||||
`content` longtext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'content',
|
||||
`beta_ips` varchar(1024) DEFAULT NULL,
|
||||
`md5` varchar(32) DEFAULT NULL,
|
||||
`data_id` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'data_id',
|
||||
`group_id` varchar(128) COLLATE utf8_bin NOT NULL COMMENT 'group_id',
|
||||
`app_name` varchar(128) COLLATE utf8_bin DEFAULT NULL COMMENT 'app_name',
|
||||
`content` longtext COLLATE utf8_bin NOT NULL COMMENT 'content',
|
||||
`beta_ips` varchar(1024) COLLATE utf8_bin DEFAULT NULL COMMENT 'betaIps',
|
||||
`md5` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT 'md5',
|
||||
`gmt_create` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '创建时间',
|
||||
`gmt_modified` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '修改时间',
|
||||
`src_user` mediumtext,
|
||||
`src_ip` varchar(20) DEFAULT NULL,
|
||||
`tenant_id` varchar(128) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE KEY `uk_configinfobeta_datagrouptenant` (`data_id`,`group_id`,`tenant_id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='config_info_beta';
|
||||
`src_user` text COLLATE utf8_bin COMMENT 'source user',
|
||||
`src_ip` varchar(20) COLLATE utf8_bin DEFAULT NULL COMMENT 'source ip',
|
||||
`tenant_id` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT '租户字段',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_configinfobeta_datagrouptenant` (`data_id`,`group_id`,`tenant_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info_beta';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for config_info_tag
|
||||
@@ -90,20 +90,20 @@ CREATE TABLE `config_info_beta` (
|
||||
DROP TABLE IF EXISTS `config_info_tag`;
|
||||
CREATE TABLE `config_info_tag` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`data_id` varchar(255) DEFAULT NULL,
|
||||
`group_id` varchar(128) DEFAULT NULL,
|
||||
`tenant_id` varchar(128) DEFAULT NULL,
|
||||
`tag_id` varchar(128) DEFAULT NULL,
|
||||
`app_name` varchar(128) DEFAULT NULL,
|
||||
`content` longtext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'content',
|
||||
`md5` varchar(32) DEFAULT NULL,
|
||||
`data_id` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'data_id',
|
||||
`group_id` varchar(128) COLLATE utf8_bin NOT NULL COMMENT 'group_id',
|
||||
`tenant_id` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT 'tenant_id',
|
||||
`tag_id` varchar(128) COLLATE utf8_bin NOT NULL COMMENT 'tag_id',
|
||||
`app_name` varchar(128) COLLATE utf8_bin DEFAULT NULL COMMENT 'app_name',
|
||||
`content` longtext COLLATE utf8_bin NOT NULL COMMENT 'content',
|
||||
`md5` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT 'md5',
|
||||
`gmt_create` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '创建时间',
|
||||
`gmt_modified` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '修改时间',
|
||||
`src_user` mediumtext,
|
||||
`src_ip` varchar(20) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE KEY `uk_configinfotag_datagrouptenanttag` (`data_id`,`group_id`,`tenant_id`,`tag_id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='config_info_tag';
|
||||
`src_user` text COLLATE utf8_bin COMMENT 'source user',
|
||||
`src_ip` varchar(20) COLLATE utf8_bin DEFAULT NULL COMMENT 'source ip',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_configinfotag_datagrouptenanttag` (`data_id`,`group_id`,`tenant_id`,`tag_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info_tag';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for config_tags_relation
|
||||
@@ -111,16 +111,16 @@ CREATE TABLE `config_info_tag` (
|
||||
DROP TABLE IF EXISTS `config_tags_relation`;
|
||||
CREATE TABLE `config_tags_relation` (
|
||||
`id` bigint(20) NOT NULL COMMENT 'id',
|
||||
`tag_name` varchar(128) DEFAULT NULL,
|
||||
`tag_type` varchar(64) DEFAULT NULL,
|
||||
`data_id` varchar(255) DEFAULT NULL,
|
||||
`group_id` varchar(128) DEFAULT NULL,
|
||||
`tenant_id` varchar(128) DEFAULT NULL,
|
||||
`tag_name` varchar(128) COLLATE utf8_bin NOT NULL COMMENT 'tag_name',
|
||||
`tag_type` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT 'tag_type',
|
||||
`data_id` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'data_id',
|
||||
`group_id` varchar(128) COLLATE utf8_bin NOT NULL COMMENT 'group_id',
|
||||
`tenant_id` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT 'tenant_id',
|
||||
`nid` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`nid`) USING BTREE,
|
||||
UNIQUE KEY `uk_configtagrelation_configidtag` (`id`,`tag_name`,`tag_type`) USING BTREE,
|
||||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='config_tag_relation';
|
||||
PRIMARY KEY (`nid`),
|
||||
UNIQUE KEY `uk_configtagrelation_configidtag` (`id`,`tag_name`,`tag_type`),
|
||||
KEY `idx_tenant_id` (`tenant_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_tag_relation';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for group_capacity
|
||||
@@ -128,7 +128,7 @@ CREATE TABLE `config_tags_relation` (
|
||||
DROP TABLE IF EXISTS `group_capacity`;
|
||||
CREATE TABLE `group_capacity` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`group_id` varchar(128) DEFAULT NULL,
|
||||
`group_id` varchar(128) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'Group ID,空字符表示整个集群',
|
||||
`quota` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配额,0表示使用默认值',
|
||||
`usage` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '使用量',
|
||||
`max_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个配置大小上限,单位为字节,0表示使用默认值',
|
||||
@@ -137,9 +137,9 @@ CREATE TABLE `group_capacity` (
|
||||
`max_history_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最大变更历史数量',
|
||||
`gmt_create` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '创建时间',
|
||||
`gmt_modified` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '修改时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE KEY `uk_group_id` (`group_id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='集群、各Group容量信息表';
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_group_id` (`group_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='集群、各Group容量信息表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for his_config_info
|
||||
@@ -148,39 +148,58 @@ DROP TABLE IF EXISTS `his_config_info`;
|
||||
CREATE TABLE `his_config_info` (
|
||||
`id` bigint(64) unsigned NOT NULL,
|
||||
`nid` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`data_id` varchar(255) DEFAULT NULL,
|
||||
`group_id` varchar(128) DEFAULT NULL,
|
||||
`app_name` varchar(128) DEFAULT NULL,
|
||||
`content` longtext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
|
||||
`md5` varchar(32) DEFAULT NULL,
|
||||
`data_id` varchar(255) COLLATE utf8_bin NOT NULL,
|
||||
`group_id` varchar(128) COLLATE utf8_bin NOT NULL,
|
||||
`app_name` varchar(128) COLLATE utf8_bin DEFAULT NULL COMMENT 'app_name',
|
||||
`content` longtext COLLATE utf8_bin NOT NULL,
|
||||
`md5` varchar(32) COLLATE utf8_bin DEFAULT NULL,
|
||||
`gmt_create` datetime NOT NULL DEFAULT '2010-05-05 00:00:00',
|
||||
`gmt_modified` datetime NOT NULL DEFAULT '2010-05-05 00:00:00',
|
||||
`src_user` mediumtext,
|
||||
`src_ip` varchar(20) DEFAULT NULL,
|
||||
`op_type` char(10) DEFAULT NULL,
|
||||
`tenant_id` varchar(128) DEFAULT NULL,
|
||||
PRIMARY KEY (`nid`) USING BTREE,
|
||||
KEY `idx_gmt_create` (`gmt_create`) USING BTREE,
|
||||
KEY `idx_gmt_modified` (`gmt_modified`) USING BTREE,
|
||||
KEY `idx_did` (`data_id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='多租户改造';
|
||||
`src_user` text COLLATE utf8_bin,
|
||||
`src_ip` varchar(20) COLLATE utf8_bin DEFAULT NULL,
|
||||
`op_type` char(10) COLLATE utf8_bin DEFAULT NULL,
|
||||
`tenant_id` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT '租户字段',
|
||||
PRIMARY KEY (`nid`),
|
||||
KEY `idx_gmt_create` (`gmt_create`),
|
||||
KEY `idx_gmt_modified` (`gmt_modified`),
|
||||
KEY `idx_did` (`data_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='多租户改造';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for permissions
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `permissions`;
|
||||
CREATE TABLE `permissions` (
|
||||
`role` varchar(50) NOT NULL,
|
||||
`resource` varchar(512) NOT NULL,
|
||||
`action` varchar(8) NOT NULL,
|
||||
UNIQUE KEY `uk_role_permission` (`role`,`resource`,`action`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for roles
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `roles`;
|
||||
CREATE TABLE `roles` (
|
||||
`username` varchar(50) DEFAULT NULL,
|
||||
`role` varchar(50) DEFAULT NULL
|
||||
`username` varchar(50) NOT NULL,
|
||||
`role` varchar(50) NOT NULL,
|
||||
UNIQUE KEY `uk_username_role` (`username`,`role`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of roles
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `roles` VALUES ('nacos', 'ROLE_ADMIN');
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for tenant_capacity
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `tenant_capacity`;
|
||||
CREATE TABLE `tenant_capacity` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`tenant_id` varchar(128) DEFAULT NULL,
|
||||
`tenant_id` varchar(128) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'Tenant ID',
|
||||
`quota` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配额,0表示使用默认值',
|
||||
`usage` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '使用量',
|
||||
`max_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个配置大小上限,单位为字节,0表示使用默认值',
|
||||
@@ -189,9 +208,9 @@ CREATE TABLE `tenant_capacity` (
|
||||
`max_history_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最大变更历史数量',
|
||||
`gmt_create` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '创建时间',
|
||||
`gmt_modified` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '修改时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE KEY `uk_tenant_id` (`tenant_id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='租户容量信息表';
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_tenant_id` (`tenant_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='租户容量信息表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for tenant_info
|
||||
@@ -199,24 +218,17 @@ CREATE TABLE `tenant_capacity` (
|
||||
DROP TABLE IF EXISTS `tenant_info`;
|
||||
CREATE TABLE `tenant_info` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`kp` varchar(128) DEFAULT NULL,
|
||||
`tenant_id` varchar(128) DEFAULT NULL,
|
||||
`tenant_name` varchar(128) DEFAULT NULL,
|
||||
`tenant_desc` varchar(256) DEFAULT NULL,
|
||||
`create_source` varchar(32) DEFAULT NULL,
|
||||
`kp` varchar(128) COLLATE utf8_bin NOT NULL COMMENT 'kp',
|
||||
`tenant_id` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT 'tenant_id',
|
||||
`tenant_name` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT 'tenant_name',
|
||||
`tenant_desc` varchar(256) COLLATE utf8_bin DEFAULT NULL COMMENT 'tenant_desc',
|
||||
`create_source` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT 'create_source',
|
||||
`gmt_create` bigint(20) NOT NULL COMMENT '创建时间',
|
||||
`gmt_modified` bigint(20) NOT NULL COMMENT '修改时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE KEY `uk_tenant_info_kptenantid` (`kp`,`tenant_id`) USING BTREE,
|
||||
KEY `idx_tenant_id` (`tenant_id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='tenant_info';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of tenant_info
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `tenant_info` VALUES (1, '1', '3bd14074-1dc5-4afc-ad04-506230b73923', 'SENTINEL_GROUP', 'sentinel 相关', 'nacos', 1570872049054, 1570872049054);
|
||||
COMMIT;
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_tenant_info_kptenantid` (`kp`,`tenant_id`),
|
||||
KEY `idx_tenant_id` (`tenant_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='tenant_info';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for users
|
||||
@@ -224,16 +236,16 @@ COMMIT;
|
||||
DROP TABLE IF EXISTS `users`;
|
||||
CREATE TABLE `users` (
|
||||
`username` varchar(50) NOT NULL,
|
||||
`password` varchar(500) DEFAULT NULL,
|
||||
`password` varchar(500) NOT NULL,
|
||||
`enabled` tinyint(1) NOT NULL,
|
||||
PRIMARY KEY (`username`) USING BTREE
|
||||
PRIMARY KEY (`username`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of users
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `users` VALUES ('nacos', '$2a$10$1fXDf9q5CKAA.Fe4rjTzzONGDI4cXFvMfPx9Yribr9OQC2.JDe/wK', 1);
|
||||
INSERT INTO `users` VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', 1);
|
||||
COMMIT;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
+10
-10
@@ -17,8 +17,8 @@ CREATE TABLE `pay_channel` (
|
||||
`param` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci,
|
||||
`remark` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`tenant_id` int(11) DEFAULT NULL COMMENT '租户ID',
|
||||
`app_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
@@ -45,8 +45,8 @@ CREATE TABLE `pay_goods_order` (
|
||||
`status` tinyint(6) NOT NULL DEFAULT '0' COMMENT '订单状态,订单生成(0),支付成功(1),处理完成(2),处理失败(-1)',
|
||||
`pay_order_id` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`tenant_id` int(11) DEFAULT NULL COMMENT '租户ID',
|
||||
PRIMARY KEY (`goods_order_id`) USING BTREE,
|
||||
UNIQUE KEY `IDX_PayOrderId` (`pay_order_id`) USING BTREE
|
||||
@@ -64,8 +64,8 @@ CREATE TABLE `pay_notify_record` (
|
||||
`order_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`http_status` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`tenant_id` int(11) DEFAULT NULL COMMENT '租户ID',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='通知记录日志表';
|
||||
@@ -102,8 +102,8 @@ CREATE TABLE `pay_refund_order` (
|
||||
`expire_time` datetime DEFAULT NULL COMMENT '订单失效时间',
|
||||
`refund_succ_time` datetime DEFAULT NULL COMMENT '订单退款成功时间',
|
||||
`del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`tenant_id` int(11) DEFAULT NULL COMMENT '租户ID',
|
||||
PRIMARY KEY (`refund_order_id`) USING BTREE,
|
||||
UNIQUE KEY `IDX_MchId_MchOrderNo` (`mch_id`,`mch_refund_no`) USING BTREE
|
||||
@@ -149,8 +149,8 @@ CREATE TABLE `pay_trade_order` (
|
||||
`last_notify_time` bigint(20) DEFAULT NULL COMMENT '最后一次通知时间',
|
||||
`expire_time` bigint(20) DEFAULT NULL COMMENT '订单失效时间',
|
||||
`pay_succ_time` bigint(20) DEFAULT NULL COMMENT '订单支付成功时间',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0',
|
||||
`tenant_id` int(11) DEFAULT NULL COMMENT '租户ID',
|
||||
PRIMARY KEY (`order_id`) USING BTREE
|
||||
|
||||
+2
-13
@@ -20,17 +20,6 @@ CREATE TABLE `gen_datasource_conf` (
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='数据源表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of gen_datasource_conf
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `gen_datasource_conf` VALUES (1, 'pigxx', 'jdbc:mysql://pigx-mysql:3306/pigxx?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true', 'root', 'Cx+ocw0iFCpae4Qo4IoFmQ==', '2019-03-31 16:40:43', '2019-06-13 03:07:24', '0', 1);
|
||||
INSERT INTO `gen_datasource_conf` VALUES (2, 'pigxx_ac', 'jdbc:mysql://pigx-mysql:3306/pigxx_ac?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8', 'root', 'Cx+ocw0iFCpae4Qo4IoFmQ==', '2019-03-31 17:53:25', '2019-06-13 03:07:25', '0', 1);
|
||||
INSERT INTO `gen_datasource_conf` VALUES (3, 'pigxx_job', 'jdbc:mysql://pigx-mysql:3306/pigxx_job?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8', 'root', 'Cx+ocw0iFCpae4Qo4IoFmQ==', '2019-03-31 17:53:25', '2019-06-13 03:07:26', '0', 1);
|
||||
INSERT INTO `gen_datasource_conf` VALUES (4, 'pigxx_mp', 'jdbc:mysql://pigx-mysql:3306/pigxx_mp?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8', 'root', 'Cx+ocw0iFCpae4Qo4IoFmQ==', '2019-03-31 17:53:25', '2019-06-13 03:07:28', '0', 1);
|
||||
INSERT INTO `gen_datasource_conf` VALUES (5, 'pigxx_pay', 'jdbc:mysql://pigx-mysql:3306/pigxx_pay?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8', 'root', 'Cx+ocw0iFCpae4Qo4IoFmQ==', '2019-03-31 17:53:25', '2019-06-13 03:07:30', '0', 1);
|
||||
INSERT INTO `gen_datasource_conf` VALUES (6, 'pigxx_codegen', 'jdbc:mysql://pigx-mysql:3306/pigxx_codegen?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true', 'root', 'hyxlg2iaqpDLOe9qEcv2xQ==', '2019-08-12 15:47:39', '2019-08-12 15:47:39', '0', 1);
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for gen_form_conf
|
||||
@@ -40,8 +29,8 @@ CREATE TABLE `gen_form_conf` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`table_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
|
||||
`form_info` json NOT NULL COMMENT '表单信息',
|
||||
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0',
|
||||
`tenant_id` int(11) DEFAULT NULL COMMENT '所属租户',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
|
||||
+12
-10
@@ -1,21 +1,23 @@
|
||||
FROM mysql:8.0.18
|
||||
FROM mysql:8.0.19
|
||||
|
||||
MAINTAINER lengleng(wangiegie@gmail.com)
|
||||
|
||||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
COPY ./db/1schema.sql /docker-entrypoint-initdb.d
|
||||
RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
COPY ./db/2pigxx.sql /docker-entrypoint-initdb.d
|
||||
COPY ./1schema.sql /docker-entrypoint-initdb.d
|
||||
|
||||
COPY ./db/3pigxx_ac.sql /docker-entrypoint-initdb.d
|
||||
COPY ./2pigxx.sql /docker-entrypoint-initdb.d
|
||||
|
||||
COPY ./db/4pigxx_job.sql /docker-entrypoint-initdb.d
|
||||
COPY ./3pigxx_ac.sql /docker-entrypoint-initdb.d
|
||||
|
||||
COPY ./db/5pigxx_mp.sql /docker-entrypoint-initdb.d
|
||||
COPY ./4pigxx_job.sql /docker-entrypoint-initdb.d
|
||||
|
||||
COPY ./db/6pigxx_config.sql /docker-entrypoint-initdb.d
|
||||
COPY ./5pigxx_mp.sql /docker-entrypoint-initdb.d
|
||||
|
||||
COPY ./db/7pigxx_pay.sql /docker-entrypoint-initdb.d
|
||||
COPY ./6pigxx_config.sql /docker-entrypoint-initdb.d
|
||||
|
||||
COPY ./db/8pigxx_codegen.sql /docker-entrypoint-initdb.d
|
||||
COPY ./7pigxx_pay.sql /docker-entrypoint-initdb.d
|
||||
|
||||
COPY ./8pigxx_codegen.sql /docker-entrypoint-initdb.d
|
||||
@@ -0,0 +1,288 @@
|
||||
USE pigxx_config;
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for config_info
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `config_info`;
|
||||
CREATE TABLE `config_info` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`data_id` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'data_id',
|
||||
`group_id` varchar(255) COLLATE utf8_bin DEFAULT NULL,
|
||||
`content` longtext COLLATE utf8_bin NOT NULL COMMENT 'content',
|
||||
`md5` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT 'md5',
|
||||
`gmt_create` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '创建时间',
|
||||
`gmt_modified` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '修改时间',
|
||||
`src_user` text COLLATE utf8_bin COMMENT 'source user',
|
||||
`src_ip` varchar(20) COLLATE utf8_bin DEFAULT NULL COMMENT 'source ip',
|
||||
`app_name` varchar(128) COLLATE utf8_bin DEFAULT NULL,
|
||||
`tenant_id` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT '租户字段',
|
||||
`c_desc` varchar(256) COLLATE utf8_bin DEFAULT NULL,
|
||||
`c_use` varchar(64) COLLATE utf8_bin DEFAULT NULL,
|
||||
`effect` varchar(64) COLLATE utf8_bin DEFAULT NULL,
|
||||
`type` varchar(64) COLLATE utf8_bin DEFAULT NULL,
|
||||
`c_schema` text COLLATE utf8_bin,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_configinfo_datagrouptenant` (`data_id`,`group_id`,`tenant_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of config_info
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `config_info` VALUES (1, 'application-dev.yml', 'DEFAULT_GROUP', 'jasypt:\n encryptor:\n password: pigx\n \nspring:\n redis:\n host: pigx-redis\n servlet:\n multipart:\n max-file-size: 100MB\n max-request-size: 100MB\n cloud:\n sentinel:\n eager: true\n filter:\n url-patterns: /** \n transport:\n dashboard: pigx-sentinel:5020\n \nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n\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\nribbon:\n ReadTimeout: 10000\n ConnectTimeout: 10000\n\n#开启灰度\ngray:\n rule:\n enabled: true\n\nmybatis-plus:\n tenant-enable: ture\n mapper-locations: classpath:/mapper/*Mapper.xml\n global-config:\n banner: false\n db-config:\n id-type: auto\n field-strategy: NOT_EMPTY\n type-handlers-package: com.pig4cloud.pigx.common.data.handler\n\nswagger:\n title: PigX Swagger API\n license: Powered By PigX\n licenseUrl: https://pig4cloud.com/\n terms-of-service-url: https://pig4cloud.com/\n contact:\n email: wangiegie@gmail.com\n url: https://pig4cloud.com/about.html\n authorization:\n name: pigX OAuth\n auth-regex: ^.*$\n authorization-scope-list:\n - scope: server\n description: server all\n token-url-list:\n - http://${GATEWAY_HOST:pigx-gateway}:${GATEWAY_PORT:9999}/auth/oauth/token\n\nsecurity:\n oauth2:\n client:\n ignore-urls:\n - /actuator/**\n - /v2/api-docs\n resource:\n loadBalanced: true\n token-info-uri: http://pigx-auth/oauth/check_token', '954b56ac77f2691529aad5c497591b28', '2019-04-18 02:10:20', '2020-02-24 13:58:21', NULL, '172.17.0.125', '', '', '通用配置文件', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (2, 'pigx-auth-dev.yml', 'DEFAULT_GROUP', '# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\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/', 'a6674e6747c1a0bb6c6d78e13706f8f0', '2019-04-18 02:11:32', '2019-08-27 18:24:04', NULL, '127.0.0.1', '', '', '认证中心配置文件', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (3, 'pigx-codegen-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)\n client-secret: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)\n scope: server\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx_codegen}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n resources:\n static-locations: classpath:/static/,classpath:/views/\n\npigx:\n tenant:\n column: tenant_id\n tables:\n - gen_datasource_conf', 'b7d132a3ecdfac4252c994adbb65b23a', '2019-04-18 02:12:10', '2019-08-27 18:24:18', NULL, '127.0.0.1', '', '', '代码生成', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (4, 'pigx-daemon-elastic-job-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(tz2NM4GcmnE7sNJTYL8ZSg==)\n client-secret: ENC(tz2NM4GcmnE7sNJTYL8ZSg==)\n scope: server\n## 定时任务\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx_job}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n\nxxl:\n job:\n admin:\n addresses: http://${XXL_HOST:pigx-xxl}:${XXL_HOST:9080}/xxl-job-admin', 'af2d24afd75cbd73c3bbc8297ca65bc9', '2019-04-18 02:12:57', '2020-04-15 21:56:37', NULL, '127.0.0.1', '', '', '定时任务-elastic-job配置', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (5, 'pigx-gateway-dev.yml', 'DEFAULT_GROUP', 'security:\n encode:\n key: \'pigxpigxpigxpigx\'\n\nignore:\n clients:\n - test\n swagger-providers:\n - pigx-auth\n - pigx-tx-manager\n\nribbon:\n rule:\n gray-enabled: true', '24403a5b205b1e9d320078e309584bbc', '2019-04-18 02:13:52', '2019-10-20 17:07:42', NULL, '127.0.0.1', '', '', '网关配置文件', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (6, 'pigx-monitor-dev.yml', 'DEFAULT_GROUP', 'spring:\n # 安全配置\n security:\n user:\n name: ENC(rZHA4LW5hHmhLAAzJoFNag==) # pigx\n password: ENC(bjeyh+Aeii3kHXkoo00ZUw==) # pigx\n boot:\n admin:\n ui:\n title: \'pigx 服务状态监控\'\n brand: \'pigx 服务状态监控\'\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n endpoint:\n health:\n show-details: ALWAYS #显示详细信息', '7925a0c734460526262319b6a189e39d', '2019-04-18 02:14:17', '2019-12-31 19:04:00', NULL, '172.17.0.157', '', '', '监控配置文件', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (7, 'pigx-upms-biz-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(ltJPpR50wT0oIY9kfOe1Iw==)\n client-secret: ENC(ltJPpR50wT0oIY9kfOe1Iw==)\n scope: server\n ignore-urls:\n - /druid/**\n - /actuator/**\n - /v2/api-docs\n\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n stat-view-servlet:\n enabled: true\n url-pattern: /druid/*\n #login-username: admin\n #login-password: admin\n filter:\n stat:\n enabled: true\n log-slow-sql: true\n slow-sql-millis: 10000\n merge-sql: false\n wall:\n config:\n multi-statement-allow: true\n\n# 文件系统 (提供测试环境,不要乱传)\nminio:\n url: http://minio.pig4cloud.com\n access-key: lengleng\n secret-key: lengleng\n\n# Logger Config\nlogging:\n level:\n com.pig4cloud.pigx.admin.mapper: debug\n\n# 租户表维护\npigx:\n tenant:\n column: tenant_id\n tables:\n - sys_user\n - sys_role\n - sys_menu\n - sys_dept\n - sys_log\n - sys_social_details\n - sys_dict\n - sys_dict_item\n - sys_public_param\n - sys_log\n - sys_file\n - sys_oauth_client_details', 'fab3a6b4cb292954d9841b22a41e3dab', '2019-04-18 02:32:44', '2019-11-01 12:22:38', NULL, '127.0.0.1', '', '', 'admin 服务配置', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (8, 'pigx-tx-manager-dev.yml', 'DEFAULT_GROUP', '# 页面配置\nspring:\n mvc:\n static-path-pattern: /**\n resources:\n static-locations: classpath:/static/\n\n\n# LCN 配置\ntm:\n transaction:\n netty:\n delaytime: 5 # 客户端链接最大通讯时间 (秒)\n hearttime: 15 # 客户端心跳时间 (秒)\n redis:\n savemaxtime: 30 # redis 保存时间 (秒)\n socket:\n port: 9998 # 通讯端口\n maxconnection: 1000 #最大链接数\n compensate:\n auto: false #是否自动补偿\n notifyUrl: http://ip:port/path #补偿结果通知(配消息总线里面)\n tryTime: 30 # z再次重试时间间隔\n maxWaitTime: 5000 # 请求超时的最大时间 (毫秒)', '885f5c125f2df7a08692929ccce154be', '2019-04-18 02:54:03', '2019-04-18 02:54:03', NULL, '127.0.0.1', '', '', '分布式事务协调模块', NULL, NULL, 'yaml', NULL);
|
||||
INSERT INTO `config_info` VALUES (9, 'pigx-daemon-quartz-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(tz2NM4GcmnE7sNJTYL8ZSg==)\n client-secret: ENC(tz2NM4GcmnE7sNJTYL8ZSg==)\n scope: server\n\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx_job}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n resources:\n static-locations: classpath:/static/,classpath:/views/\n quartz:\n #相关属性配置\n properties:\n org:\n quartz:\n scheduler:\n instanceName: clusteredScheduler\n instanceId: AUTO\n jobStore:\n class: org.quartz.impl.jdbcjobstore.JobStoreTX\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 #初始化表结构\n #jdbc:\n #initialize-schema: never\n\n', '276cf549fb8b084e35dc07d1eb309932', '2019-04-18 03:08:34', '2019-08-27 18:25:41', NULL, '127.0.0.1', '', '', 'quartz 配置文件', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (10, 'pigx-pay-platform-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)\n client-secret: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)\n scope: server\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx_pay}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n\n# 租户表维护\npigx:\n pay:\n test: lengleng\n aliPayConfig:\n expire-time: 30\n return-url: http://pig4cloud.com\n notify-url: https://admin.pig4cloud.com/pay/notify/ali/callbak\n wxPayConfig:\n notify-url: https://admin.pig4cloud.com/pay/notify/wx/callbak\n xsequence: #发号器相关配置\n db:\n retry-times: 3\n table-name: pay_sequence\n tenant:\n column: tenant_id\n tables:\n - pay_channel\n - pay_trade_order\n - pay_goods_order\n - pay_notify_record', 'bf185a74bb9af224bfe7f8f52ae3c9cb', '2019-05-28 11:46:27', '2019-08-27 18:26:01', NULL, '127.0.0.1', '', '', '支付模块配置', 'null', 'null', 'yaml', 'null');
|
||||
INSERT INTO `config_info` VALUES (11, 'pigx-oa-platform-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)\n client-secret: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)\n scope: server\n ignore-urls:\n - \'/actuator/**\'\n - \'/v2/api-docs\'\n - \'/editor-app/**\'\n - \'/modeler.html\'\n - \'/ws/**\'\nspring:\n autoconfigure:\n exclude: org.activiti.spring.boot.SecurityAutoConfiguration\n activiti:\n check-process-definitions: false\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx_ac}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n\n# 租户表维护\npigx:\n tenant:\n column: tenant_id\n tables:\n - oa_leave_bill', 'bb2ee29e458875b0334e9f204f958272', '2019-10-16 16:38:52', '2019-10-16 16:38:52', NULL, '127.0.0.1', '', '', NULL, NULL, NULL, 'yaml', NULL);
|
||||
INSERT INTO `config_info` VALUES (12, 'pigx-mp-platform-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(vW+Nup9LaTfIFwgufUBsYg==)\n client-secret: ENC(vW+Nup9LaTfIFwgufUBsYg==)\n scope: server\n# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx_mp}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n resources:\n static-locations: classpath:/static/,classpath:/views/\n\n\n# 租户表维护\npigx:\n tenant:\n column: tenant_id\n tables:\n - wx_mp_menu\n - wx_account\n - wx_account_fans\n - wx_fans_msg_res', 'bf4f6943566ce47a98551923bc4c4f80', '2019-10-21 08:58:24', '2019-10-21 08:58:24', NULL, '127.0.0.1', '', '', NULL, NULL, NULL, 'yaml', NULL);
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for config_info_aggr
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `config_info_aggr`;
|
||||
CREATE TABLE `config_info_aggr` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`data_id` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'data_id',
|
||||
`group_id` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'group_id',
|
||||
`datum_id` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'datum_id',
|
||||
`content` longtext COLLATE utf8_bin NOT NULL COMMENT '内容',
|
||||
`gmt_modified` datetime NOT NULL COMMENT '修改时间',
|
||||
`app_name` varchar(128) COLLATE utf8_bin DEFAULT NULL,
|
||||
`tenant_id` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT '租户字段',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_configinfoaggr_datagrouptenantdatum` (`data_id`,`group_id`,`tenant_id`,`datum_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='增加租户字段';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for config_info_beta
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `config_info_beta`;
|
||||
CREATE TABLE `config_info_beta` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`data_id` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'data_id',
|
||||
`group_id` varchar(128) COLLATE utf8_bin NOT NULL COMMENT 'group_id',
|
||||
`app_name` varchar(128) COLLATE utf8_bin DEFAULT NULL COMMENT 'app_name',
|
||||
`content` longtext COLLATE utf8_bin NOT NULL COMMENT 'content',
|
||||
`beta_ips` varchar(1024) COLLATE utf8_bin DEFAULT NULL COMMENT 'betaIps',
|
||||
`md5` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT 'md5',
|
||||
`gmt_create` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '创建时间',
|
||||
`gmt_modified` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '修改时间',
|
||||
`src_user` text COLLATE utf8_bin COMMENT 'source user',
|
||||
`src_ip` varchar(20) COLLATE utf8_bin DEFAULT NULL COMMENT 'source ip',
|
||||
`tenant_id` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT '租户字段',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_configinfobeta_datagrouptenant` (`data_id`,`group_id`,`tenant_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info_beta';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for config_info_tag
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `config_info_tag`;
|
||||
CREATE TABLE `config_info_tag` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`data_id` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'data_id',
|
||||
`group_id` varchar(128) COLLATE utf8_bin NOT NULL COMMENT 'group_id',
|
||||
`tenant_id` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT 'tenant_id',
|
||||
`tag_id` varchar(128) COLLATE utf8_bin NOT NULL COMMENT 'tag_id',
|
||||
`app_name` varchar(128) COLLATE utf8_bin DEFAULT NULL COMMENT 'app_name',
|
||||
`content` longtext COLLATE utf8_bin NOT NULL COMMENT 'content',
|
||||
`md5` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT 'md5',
|
||||
`gmt_create` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '创建时间',
|
||||
`gmt_modified` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '修改时间',
|
||||
`src_user` text COLLATE utf8_bin COMMENT 'source user',
|
||||
`src_ip` varchar(20) COLLATE utf8_bin DEFAULT NULL COMMENT 'source ip',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_configinfotag_datagrouptenanttag` (`data_id`,`group_id`,`tenant_id`,`tag_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info_tag';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for config_tags_relation
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `config_tags_relation`;
|
||||
CREATE TABLE `config_tags_relation` (
|
||||
`id` bigint(20) NOT NULL COMMENT 'id',
|
||||
`tag_name` varchar(128) COLLATE utf8_bin NOT NULL COMMENT 'tag_name',
|
||||
`tag_type` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT 'tag_type',
|
||||
`data_id` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'data_id',
|
||||
`group_id` varchar(128) COLLATE utf8_bin NOT NULL COMMENT 'group_id',
|
||||
`tenant_id` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT 'tenant_id',
|
||||
`nid` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`nid`),
|
||||
UNIQUE KEY `uk_configtagrelation_configidtag` (`id`,`tag_name`,`tag_type`),
|
||||
KEY `idx_tenant_id` (`tenant_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_tag_relation';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for group_capacity
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `group_capacity`;
|
||||
CREATE TABLE `group_capacity` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`group_id` varchar(128) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'Group ID,空字符表示整个集群',
|
||||
`quota` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配额,0表示使用默认值',
|
||||
`usage` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '使用量',
|
||||
`max_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个配置大小上限,单位为字节,0表示使用默认值',
|
||||
`max_aggr_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '聚合子配置最大个数,,0表示使用默认值',
|
||||
`max_aggr_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值',
|
||||
`max_history_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最大变更历史数量',
|
||||
`gmt_create` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '创建时间',
|
||||
`gmt_modified` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '修改时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_group_id` (`group_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='集群、各Group容量信息表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for his_config_info
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `his_config_info`;
|
||||
CREATE TABLE `his_config_info` (
|
||||
`id` bigint(64) unsigned NOT NULL,
|
||||
`nid` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`data_id` varchar(255) COLLATE utf8_bin NOT NULL,
|
||||
`group_id` varchar(128) COLLATE utf8_bin NOT NULL,
|
||||
`app_name` varchar(128) COLLATE utf8_bin DEFAULT NULL COMMENT 'app_name',
|
||||
`content` longtext COLLATE utf8_bin NOT NULL,
|
||||
`md5` varchar(32) COLLATE utf8_bin DEFAULT NULL,
|
||||
`gmt_create` datetime NOT NULL DEFAULT '2010-05-05 00:00:00',
|
||||
`gmt_modified` datetime NOT NULL DEFAULT '2010-05-05 00:00:00',
|
||||
`src_user` text COLLATE utf8_bin,
|
||||
`src_ip` varchar(20) COLLATE utf8_bin DEFAULT NULL,
|
||||
`op_type` char(10) COLLATE utf8_bin DEFAULT NULL,
|
||||
`tenant_id` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT '租户字段',
|
||||
PRIMARY KEY (`nid`),
|
||||
KEY `idx_gmt_create` (`gmt_create`),
|
||||
KEY `idx_gmt_modified` (`gmt_modified`),
|
||||
KEY `idx_did` (`data_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='多租户改造';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for permissions
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `permissions`;
|
||||
CREATE TABLE `permissions` (
|
||||
`role` varchar(50) NOT NULL,
|
||||
`resource` varchar(512) NOT NULL,
|
||||
`action` varchar(8) NOT NULL,
|
||||
UNIQUE KEY `uk_role_permission` (`role`,`resource`,`action`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for roles
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `roles`;
|
||||
CREATE TABLE `roles` (
|
||||
`username` varchar(50) NOT NULL,
|
||||
`role` varchar(50) NOT NULL,
|
||||
UNIQUE KEY `uk_username_role` (`username`,`role`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of roles
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `roles` VALUES ('nacos', 'ROLE_ADMIN');
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for tenant_capacity
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `tenant_capacity`;
|
||||
CREATE TABLE `tenant_capacity` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`tenant_id` varchar(128) COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'Tenant ID',
|
||||
`quota` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配额,0表示使用默认值',
|
||||
`usage` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '使用量',
|
||||
`max_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个配置大小上限,单位为字节,0表示使用默认值',
|
||||
`max_aggr_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '聚合子配置最大个数',
|
||||
`max_aggr_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值',
|
||||
`max_history_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最大变更历史数量',
|
||||
`gmt_create` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '创建时间',
|
||||
`gmt_modified` datetime NOT NULL DEFAULT '2010-05-05 00:00:00' COMMENT '修改时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_tenant_id` (`tenant_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='租户容量信息表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for tenant_info
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `tenant_info`;
|
||||
CREATE TABLE `tenant_info` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`kp` varchar(128) COLLATE utf8_bin NOT NULL COMMENT 'kp',
|
||||
`tenant_id` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT 'tenant_id',
|
||||
`tenant_name` varchar(128) COLLATE utf8_bin DEFAULT '' COMMENT 'tenant_name',
|
||||
`tenant_desc` varchar(256) COLLATE utf8_bin DEFAULT NULL COMMENT 'tenant_desc',
|
||||
`create_source` varchar(32) COLLATE utf8_bin DEFAULT NULL COMMENT 'create_source',
|
||||
`gmt_create` bigint(20) NOT NULL COMMENT '创建时间',
|
||||
`gmt_modified` bigint(20) NOT NULL COMMENT '修改时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_tenant_info_kptenantid` (`kp`,`tenant_id`),
|
||||
KEY `idx_tenant_id` (`tenant_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='tenant_info';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for users
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `users`;
|
||||
CREATE TABLE `users` (
|
||||
`username` varchar(50) NOT NULL,
|
||||
`password` varchar(500) NOT NULL,
|
||||
`enabled` tinyint(1) NOT NULL,
|
||||
PRIMARY KEY (`username`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of users
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `users` VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', 1);
|
||||
COMMIT;
|
||||
|
||||
ALTER TABLE `pigxx`.`sys_menu` ADD COLUMN `tenant_id` int(11) UNSIGNED NULL DEFAULT 1 COMMENT '租户ID' AFTER `del_flag`;
|
||||
|
||||
DROP TABLE IF EXISTS `pigxx`.`sys_oauth_client_details`;
|
||||
CREATE TABLE `pigxx`.`sys_oauth_client_details` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`client_id` varchar(32) NOT NULL,
|
||||
`resource_ids` varchar(256) DEFAULT NULL,
|
||||
`client_secret` varchar(256) DEFAULT NULL,
|
||||
`scope` varchar(256) DEFAULT NULL,
|
||||
`authorized_grant_types` varchar(256) DEFAULT NULL,
|
||||
`web_server_redirect_uri` varchar(256) DEFAULT NULL,
|
||||
`authorities` varchar(256) DEFAULT NULL,
|
||||
`access_token_validity` int(11) DEFAULT NULL,
|
||||
`refresh_token_validity` int(11) DEFAULT NULL,
|
||||
`additional_information` varchar(4096) DEFAULT NULL,
|
||||
`autoapprove` varchar(256) DEFAULT NULL,
|
||||
`del_flag` char(1) DEFAULT '0',
|
||||
`tenant_id` int(11) NOT NULL DEFAULT '0' COMMENT '所属租户',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COMMENT='终端信息表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of sys_oauth_client_details
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `pigxx`.`sys_oauth_client_details` VALUES (1, 'app', NULL, 'app', 'server', 'password,refresh_token,authorization_code,client_credentials,implicit', NULL, NULL, 43200, 2592001, NULL, 'true', '0', 1);
|
||||
INSERT INTO `pigxx`.`sys_oauth_client_details` VALUES (2, 'daemon', NULL, 'daemon', 'server', 'password,refresh_token', NULL, NULL, NULL, NULL, NULL, 'true', '0', 1);
|
||||
INSERT INTO `pigxx`.`sys_oauth_client_details` VALUES (3, 'gen', NULL, 'gen', 'server', 'password,refresh_token', NULL, NULL, NULL, NULL, NULL, 'true', '0', 1);
|
||||
INSERT INTO `pigxx`.`sys_oauth_client_details` VALUES (4, 'mp', NULL, 'mp', 'server', 'password,refresh_token', NULL, NULL, NULL, NULL, NULL, 'true', '0', 1);
|
||||
INSERT INTO `pigxx`.`sys_oauth_client_details` VALUES (5, 'pig', NULL, 'pig', 'server', 'password,refresh_token,authorization_code,client_credentials', '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, NULL, NULL, NULL, 'false', '0', 1);
|
||||
INSERT INTO `pigxx`.`sys_oauth_client_details` VALUES (6, 'test', NULL, 'test', 'server', 'password,refresh_token', NULL, NULL, NULL, NULL, NULL, 'true', '0', 1);
|
||||
COMMIT;
|
||||
|
||||
UPDATE `pigxx_job`.`xxl_job_group` SET `app_name` = 'xxl-job-executor', `title` = '示例执行器', `order` = 1, `address_type` = 0, `address_list` = NULL WHERE `id` = 1;
|
||||
|
||||
DROP TABLE `pigxx_job`.`job_execution_log`;
|
||||
|
||||
DROP TABLE `pigxx_job`.`job_status_trace_log`;
|
||||
+21
-39
@@ -1,4 +1,4 @@
|
||||
# 使用说明 V3.6.0
|
||||
# 使用说明 V3.8.0
|
||||
# 1. 使用docker-compose 宿主机不需要配置host来发现
|
||||
# 2. 无需修改源码,根目录 docker-compose up 即可
|
||||
# 3. 静静等待服务启动
|
||||
@@ -7,8 +7,7 @@ version: '2'
|
||||
services:
|
||||
pigx-mysql:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: ./db/Dockerfile
|
||||
context: ./db
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
restart: always
|
||||
@@ -20,28 +19,24 @@ services:
|
||||
- ./pigx-mysql:/var/lib/mysql
|
||||
command: --lower_case_table_names=1
|
||||
|
||||
pigx-zookeeper:
|
||||
image: zookeeper:3.4.13
|
||||
restart: always
|
||||
|
||||
pigx-xxl:
|
||||
image: pig4cloud/xxl-job-admin:2.1.1
|
||||
container_name: pigx-xxl
|
||||
image: xuxueli/xxl-job-admin:2.2.0
|
||||
restart: always
|
||||
environment:
|
||||
PARAMS: "--spring.datasource.url=jdbc:mysql://pigx-mysql:3306/pigxx_job?Unicode=true&characterEncoding=UTF-8 --spring.datasource.username=root --spring.datasource.password=root"
|
||||
PARAMS: "--server.port=9080 --spring.datasource.url=jdbc:mysql://pigx-mysql:3306/pigxx_job?Unicode=true&characterEncoding=UTF-8 --spring.datasource.username=root --spring.datasource.password=root"
|
||||
ports:
|
||||
- 9080:8080
|
||||
- 9080:9080
|
||||
|
||||
pigx-redis:
|
||||
container_name: pigx-redis
|
||||
image: redis:5.0.7
|
||||
restart: always
|
||||
# 加密
|
||||
#command: redis-server --requirepass lengleng@123
|
||||
container_name: pigx-redis
|
||||
ports:
|
||||
- 6379:6379
|
||||
|
||||
pigx-minio:
|
||||
container_name: pigx-minio
|
||||
image: minio/minio
|
||||
command: server /data
|
||||
ports:
|
||||
@@ -56,8 +51,7 @@ services:
|
||||
|
||||
pigx-register:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: ./pigx-register/Dockerfile
|
||||
context: ./pigx-register
|
||||
restart: always
|
||||
container_name: pigx-register
|
||||
image: pigx-register
|
||||
@@ -66,8 +60,7 @@ services:
|
||||
|
||||
pigx-gateway:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: ./pigx-gateway/Dockerfile
|
||||
context: ./pigx-gateway
|
||||
restart: always
|
||||
container_name: pigx-gateway
|
||||
image: pigx-gateway
|
||||
@@ -76,24 +69,21 @@ services:
|
||||
|
||||
pigx-auth:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: ./pigx-auth/Dockerfile
|
||||
context: ./pigx-auth
|
||||
restart: always
|
||||
container_name: pigx-auth
|
||||
image: pigx-auth
|
||||
|
||||
pigx-upms:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: ./pigx-upms/pigx-upms-biz/Dockerfile
|
||||
context: ./pigx-upms/pigx-upms-biz
|
||||
restart: always
|
||||
container_name: pigx-upms
|
||||
image: pigx-upms
|
||||
|
||||
pigx-monitor:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: ./pigx-visual/pigx-monitor/Dockerfile
|
||||
context: ./pigx-visual/pigx-monitor
|
||||
restart: always
|
||||
image: pigx-monitor
|
||||
container_name: pigx-monitor
|
||||
@@ -102,56 +92,49 @@ services:
|
||||
|
||||
pigx-daemon-quartz:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: ./pigx-visual/pigx-daemon-quartz/Dockerfile
|
||||
context: ./pigx-visual/pigx-daemon-quartz
|
||||
restart: always
|
||||
image: pigx-daemon-quartz
|
||||
container_name: pigx-daemon-quartz
|
||||
|
||||
pigx-daemon-elastic-job:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: ./pigx-visual/pigx-daemon-elastic-job/Dockerfile
|
||||
context: ./pigx-visual/pigx-daemon-elastic-job
|
||||
restart: always
|
||||
image: pigx-daemon-elastic-job
|
||||
container_name: pigx-daemon-elastic-job
|
||||
|
||||
pigx-codegen:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: ./pigx-visual/pigx-codegen/Dockerfile
|
||||
context: ./pigx-visual/pigx-codegen
|
||||
restart: always
|
||||
image: pigx-codegen
|
||||
container_name: pigx-codegen
|
||||
|
||||
pigx-mp-platform:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: ./pigx-visual/pigx-mp-platform/Dockerfile
|
||||
context: ./pigx-visual/pigx-mp-platform
|
||||
restart: always
|
||||
image: pigx-mp-platform
|
||||
container_name: pigx-mp-platform
|
||||
|
||||
pigx-pay-platform:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: ./pigx-visual/pigx-pay-platform/Dockerfile
|
||||
context: ./pigx-visual/pigx-pay-platform
|
||||
restart: always
|
||||
image: pigx-pay-platform
|
||||
container_name: pigx-pay-platform
|
||||
|
||||
pigx-oa-platform:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: ./pigx-visual/pigx-oa-platform/Dockerfile
|
||||
context: ./pigx-visual/pigx-oa-platform
|
||||
restart: always
|
||||
image: pigx-oa-platform
|
||||
container_name: pigx-oa-platform
|
||||
|
||||
pigx-tx-manager:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: ./pigx-visual/pigx-tx-manager/Dockerfile
|
||||
context: ./pigx-visual/pigx-tx-manager
|
||||
restart: always
|
||||
image: pigx-tx-manager
|
||||
container_name: pigx-tx-manager
|
||||
@@ -161,8 +144,7 @@ services:
|
||||
|
||||
pigx-sentinel:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: ./pigx-visual/pigx-sentinel-dashboard/Dockerfile
|
||||
context: ./pigx-visual/pigx-sentinel-dashboard
|
||||
restart: always
|
||||
image: pigx-sentinel
|
||||
container_name: pigx-sentinel
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
FROM java:8-jre
|
||||
FROM pig4cloud/java:8-jre
|
||||
|
||||
MAINTAINER wangiegie@gmail.com
|
||||
|
||||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
RUN mkdir -p /pigx-auth
|
||||
|
||||
@@ -10,6 +12,6 @@ WORKDIR /pigx-auth
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
ADD ./pigx-auth/target/pigx-auth.jar ./
|
||||
ADD ./target/pigx-auth.jar ./
|
||||
|
||||
CMD sleep 120;java -Xms128m -Xmx256m -Djava.security.egd=file:/dev/./urandom -jar pigx-auth.jar
|
||||
+17
-2
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.9.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-auth</artifactId>
|
||||
@@ -48,11 +48,21 @@
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-upms-api</artifactId>
|
||||
</dependency>
|
||||
<!--log-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-log</artifactId>
|
||||
</dependency>
|
||||
<!--security-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-security</artifactId>
|
||||
</dependency>
|
||||
<!--feign 依赖-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-feign</artifactId>
|
||||
</dependency>
|
||||
<!--mysql 驱动-->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
@@ -68,6 +78,11 @@
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-sentinel</artifactId>
|
||||
</dependency>
|
||||
<!--路由控制-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-gray</artifactId>
|
||||
</dependency>
|
||||
<!--JDBC相关-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@@ -102,7 +117,7 @@
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.spotify</groupId>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
package com.pig4cloud.pigx.auth;
|
||||
|
||||
|
||||
import com.pig4cloud.pigx.common.security.annotation.EnablePigxFeignClients;
|
||||
import com.pig4cloud.pigx.common.feign.annotation.EnablePigxFeignClients;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.cloud.client.SpringCloudApplication;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2018年06月21日
|
||||
* @date 2020-02-08
|
||||
* 认证授权中心
|
||||
*/
|
||||
@SpringCloudApplication
|
||||
|
||||
+7
-11
@@ -23,8 +23,6 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
|
||||
import com.pig4cloud.pigx.common.data.tenant.TenantContextHolder;
|
||||
import com.pig4cloud.pigx.common.security.component.PigxWebResponseExceptionTranslator;
|
||||
import com.pig4cloud.pigx.common.security.service.PigxClientDetailsService;
|
||||
import com.pig4cloud.pigx.common.security.service.PigxUserDetailsService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -32,19 +30,19 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer;
|
||||
import org.springframework.security.oauth2.provider.ClientDetailsService;
|
||||
import org.springframework.security.oauth2.provider.OAuth2Authentication;
|
||||
import org.springframework.security.oauth2.provider.token.DefaultAuthenticationKeyGenerator;
|
||||
import org.springframework.security.oauth2.provider.token.TokenEnhancer;
|
||||
import org.springframework.security.oauth2.provider.token.TokenStore;
|
||||
import org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2018/6/22
|
||||
@@ -54,19 +52,16 @@ import javax.sql.DataSource;
|
||||
@AllArgsConstructor
|
||||
@EnableAuthorizationServer
|
||||
public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {
|
||||
private final DataSource dataSource;
|
||||
private final TokenEnhancer pigxTokenEnhancer;
|
||||
private final PigxUserDetailsService pigxUserDetailsService;
|
||||
private final ClientDetailsService pigxClientDetailsServiceImpl;
|
||||
private final AuthenticationManager authenticationManagerBean;
|
||||
private final RedisConnectionFactory redisConnectionFactory;
|
||||
private final UserDetailsService pigxUserDetailsService;
|
||||
private final TokenEnhancer pigxTokenEnhancer;
|
||||
|
||||
@Override
|
||||
@SneakyThrows
|
||||
public void configure(ClientDetailsServiceConfigurer clients) {
|
||||
PigxClientDetailsService clientDetailsService = new PigxClientDetailsService(dataSource);
|
||||
clientDetailsService.setSelectClientDetailsSql(SecurityConstants.DEFAULT_SELECT_STATEMENT);
|
||||
clientDetailsService.setFindClientDetailsSql(SecurityConstants.DEFAULT_FIND_STATEMENT);
|
||||
clients.withClientDetails(clientDetailsService);
|
||||
clients.withClientDetails(pigxClientDetailsServiceImpl);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -103,3 +98,4 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
|
||||
return tokenStore;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.builders.WebSecurity;
|
||||
@@ -54,6 +55,14 @@ public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {
|
||||
.loginProcessingUrl("/token/form")
|
||||
.failureHandler(authenticationFailureHandler())
|
||||
.and()
|
||||
.logout()
|
||||
.logoutSuccessHandler((request, response, authentication) -> {
|
||||
String referer = request.getHeader(HttpHeaders.REFERER);
|
||||
response.sendRedirect(referer);
|
||||
})
|
||||
.deleteCookies("JSESSIONID")
|
||||
.invalidateHttpSession(true)
|
||||
.and()
|
||||
.authorizeRequests()
|
||||
.antMatchers(
|
||||
"/token/**",
|
||||
|
||||
@@ -124,7 +124,19 @@ public class PigxTokenEndpoint {
|
||||
}
|
||||
|
||||
String tokenValue = authHeader.replace(OAuth2AccessToken.BEARER_TYPE, StrUtil.EMPTY).trim();
|
||||
OAuth2AccessToken accessToken = tokenStore.readAccessToken(tokenValue);
|
||||
return delToken(tokenValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 令牌管理调用
|
||||
*
|
||||
* @param token token
|
||||
* @return
|
||||
*/
|
||||
@Inner
|
||||
@DeleteMapping("/{token}")
|
||||
public R<Boolean> delToken(@PathVariable("token") String token) {
|
||||
OAuth2AccessToken accessToken = tokenStore.readAccessToken(token);
|
||||
if (accessToken == null || StrUtil.isBlank(accessToken.getValue())) {
|
||||
return R.ok(Boolean.TRUE, "退出失败,token 无效");
|
||||
}
|
||||
@@ -140,21 +152,7 @@ public class PigxTokenEndpoint {
|
||||
// 清空 refresh token
|
||||
OAuth2RefreshToken refreshToken = accessToken.getRefreshToken();
|
||||
tokenStore.removeRefreshToken(refreshToken);
|
||||
return R.ok(Boolean.TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 令牌管理调用
|
||||
*
|
||||
* @param token token
|
||||
* @return
|
||||
*/
|
||||
@Inner
|
||||
@DeleteMapping("/{token}")
|
||||
public R<Boolean> delToken(@PathVariable("token") String token) {
|
||||
OAuth2AccessToken oAuth2AccessToken = tokenStore.readAccessToken(token);
|
||||
tokenStore.removeAccessToken(oAuth2AccessToken);
|
||||
return new R<>();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@@ -176,7 +174,7 @@ public class PigxTokenEndpoint {
|
||||
redisTemplate.setValueSerializer(new JdkSerializationRedisSerializer());
|
||||
Page result = new Page(MapUtil.getInt(params, PaginationConstants.CURRENT), MapUtil.getInt(params, PaginationConstants.SIZE));
|
||||
result.setRecords(redisTemplate.opsForValue().multiGet(pages));
|
||||
result.setTotal((long) redisTemplate.keys(key).size());
|
||||
result.setTotal(redisTemplate.keys(key).size());
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
|
||||
+32
-4
@@ -17,8 +17,19 @@
|
||||
|
||||
package com.pig4cloud.pigx.auth.handler;
|
||||
|
||||
import com.pig4cloud.pigx.common.security.handler.AbstractAuthenticationFailureEvenHandler;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysLog;
|
||||
import com.pig4cloud.pigx.admin.api.feign.RemoteLogService;
|
||||
import com.pig4cloud.pigx.common.core.constant.CommonConstants;
|
||||
import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
|
||||
import com.pig4cloud.pigx.common.core.util.WebUtils;
|
||||
import com.pig4cloud.pigx.common.log.util.SysLogUtils;
|
||||
import com.pig4cloud.pigx.common.security.handler.AuthenticationFailureHandler;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -32,10 +43,12 @@ import javax.servlet.http.HttpServletResponse;
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class PigxAuthenticationFailureEvenHandler extends AbstractAuthenticationFailureEvenHandler {
|
||||
@AllArgsConstructor
|
||||
public class PigxAuthenticationFailureEventHandler implements AuthenticationFailureHandler {
|
||||
private final RemoteLogService logService;
|
||||
|
||||
/**
|
||||
* 处理登录失败方法
|
||||
* 异步处理,登录失败方法
|
||||
* <p>
|
||||
*
|
||||
* @param authenticationException 登录的authentication 对象
|
||||
@@ -43,8 +56,23 @@ public class PigxAuthenticationFailureEvenHandler extends AbstractAuthentication
|
||||
* @param request 请求
|
||||
* @param response 响应
|
||||
*/
|
||||
@Async
|
||||
@Override
|
||||
@SneakyThrows
|
||||
public void handle(AuthenticationException authenticationException, Authentication authentication, HttpServletRequest request, HttpServletResponse response) {
|
||||
log.info("用户:{} 登录失败,异常:{}", authentication.getPrincipal(), authenticationException.getLocalizedMessage());
|
||||
String username = authentication.getName();
|
||||
SysLog sysLog = SysLogUtils.getSysLog(request, username);
|
||||
sysLog.setTitle(username + "用户登录");
|
||||
sysLog.setType(CommonConstants.STATUS_LOCK);
|
||||
sysLog.setParams(username);
|
||||
sysLog.setException(authenticationException.getLocalizedMessage());
|
||||
String header = request.getHeader(HttpHeaders.AUTHORIZATION);
|
||||
if (StrUtil.isNotBlank(header)) {
|
||||
sysLog.setServiceId(WebUtils.getClientId(header));
|
||||
}
|
||||
|
||||
logService.saveLog(sysLog, SecurityConstants.FROM_IN);
|
||||
|
||||
log.info("用户:{} 登录失败,异常:{}", username, authenticationException.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
+25
-3
@@ -17,8 +17,17 @@
|
||||
|
||||
package com.pig4cloud.pigx.auth.handler;
|
||||
|
||||
import com.pig4cloud.pigx.common.security.handler.AbstractAuthenticationSuccessEventHandler;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysLog;
|
||||
import com.pig4cloud.pigx.admin.api.feign.RemoteLogService;
|
||||
import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
|
||||
import com.pig4cloud.pigx.common.core.util.WebUtils;
|
||||
import com.pig4cloud.pigx.common.log.util.SysLogUtils;
|
||||
import com.pig4cloud.pigx.common.security.handler.AuthenticationSuccessHandler;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -31,7 +40,9 @@ import javax.servlet.http.HttpServletResponse;
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class PigxAuthenticationSuccessEventHandler extends AbstractAuthenticationSuccessEventHandler {
|
||||
@AllArgsConstructor
|
||||
public class PigxAuthenticationSuccessEventHandler implements AuthenticationSuccessHandler {
|
||||
private final RemoteLogService logService;
|
||||
|
||||
/**
|
||||
* 处理登录成功方法
|
||||
@@ -42,8 +53,19 @@ public class PigxAuthenticationSuccessEventHandler extends AbstractAuthenticatio
|
||||
* @param request 请求
|
||||
* @param response 返回
|
||||
*/
|
||||
@Async
|
||||
@Override
|
||||
public void handle(Authentication authentication, HttpServletRequest request, HttpServletResponse response) {
|
||||
log.info("用户:{} 登录成功", authentication.getPrincipal());
|
||||
String username = authentication.getName();
|
||||
SysLog sysLog = SysLogUtils.getSysLog(request, username);
|
||||
sysLog.setTitle(username + "用户登录");
|
||||
sysLog.setParams(username);
|
||||
String header = request.getHeader(HttpHeaders.AUTHORIZATION);
|
||||
if (StrUtil.isNotBlank(header)) {
|
||||
sysLog.setServiceId(WebUtils.getClientId(header));
|
||||
}
|
||||
|
||||
logService.saveLog(sysLog, SecurityConstants.FROM_IN);
|
||||
log.info("用户:{} 登录成功", username);
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package com.pig4cloud.pigx.auth.service;
|
||||
|
||||
import com.pig4cloud.pigx.common.core.constant.CacheConstants;
|
||||
import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
|
||||
import com.pig4cloud.pigx.common.data.tenant.TenantContextHolder;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.security.oauth2.common.exceptions.InvalidClientException;
|
||||
import org.springframework.security.oauth2.provider.ClientDetails;
|
||||
import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020/03/25
|
||||
* <p>
|
||||
* 扩展 JdbcClientDetailsService 支持多租户
|
||||
*/
|
||||
@Service
|
||||
public class PigxClientDetailsServiceImpl extends JdbcClientDetailsService {
|
||||
public PigxClientDetailsServiceImpl(DataSource dataSource) {
|
||||
super(dataSource);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 重写原生方法支持redis缓存
|
||||
*
|
||||
* @param clientId
|
||||
* @return ClientDetails
|
||||
* @throws InvalidClientException
|
||||
*/
|
||||
@Override
|
||||
@Cacheable(value = CacheConstants.CLIENT_DETAILS_KEY, key = "#clientId", unless = "#result == null")
|
||||
public ClientDetails loadClientByClientId(String clientId) {
|
||||
super.setSelectClientDetailsSql(String.format(SecurityConstants.DEFAULT_SELECT_STATEMENT
|
||||
, TenantContextHolder.getTenantId()));
|
||||
return super.loadClientByClientId(clientId);
|
||||
}
|
||||
}
|
||||
+9
-3
@@ -15,7 +15,7 @@
|
||||
* Author: lengleng (wangiegie@gmail.com)
|
||||
*/
|
||||
|
||||
package com.pig4cloud.pigx.common.security.service;
|
||||
package com.pig4cloud.pigx.auth.service;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -26,6 +26,8 @@ import com.pig4cloud.pigx.common.core.constant.CacheConstants;
|
||||
import com.pig4cloud.pigx.common.core.constant.CommonConstants;
|
||||
import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.common.security.service.PigxUser;
|
||||
import com.pig4cloud.pigx.common.security.service.PigxUserDetailsService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -35,6 +37,7 @@ import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.authority.AuthorityUtils;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -47,6 +50,7 @@ import java.util.Set;
|
||||
* @author lengleng
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class PigxUserDetailsServiceImpl implements PigxUserDetailsService {
|
||||
private final RemoteUserService remoteUserService;
|
||||
@@ -113,7 +117,9 @@ public class PigxUserDetailsServiceImpl implements PigxUserDetailsService {
|
||||
boolean enabled = StrUtil.equals(user.getLockFlag(), CommonConstants.STATUS_NORMAL);
|
||||
// 构造security用户
|
||||
|
||||
return new PigxUser(user.getUserId(), user.getDeptId(), user.getTenantId(), user.getUsername(), SecurityConstants.BCRYPT + user.getPassword(), enabled,
|
||||
true, true, !CommonConstants.STATUS_LOCK.equals(user.getLockFlag()), authorities);
|
||||
return new PigxUser(user.getUserId(), user.getDeptId(), user.getPhone(), user.getAvatar(), user.getTenantId()
|
||||
, user.getUsername(), SecurityConstants.BCRYPT + user.getPassword()
|
||||
, enabled, true, true
|
||||
, !CommonConstants.STATUS_LOCK.equals(user.getLockFlag()), authorities);
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,11 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: ${NACOS-HOST:pigx-register}:${NACOS-PORT:8848}
|
||||
server-addr: ${NACOS_HOST:pigx-register}:${NACOS_PORT:8848}
|
||||
config:
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
file-extension: yml
|
||||
shared-dataids: application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
profiles:
|
||||
active: @profiles.active@
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<artifactId>pigx-cloud-dependencies-parent</artifactId>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<version>Hoxton.SR1</version>
|
||||
<version>Hoxton.SR3</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
@@ -17,12 +17,16 @@
|
||||
<description>pigx 公共版本控制</description>
|
||||
|
||||
<properties>
|
||||
<pigx.version>3.6.0</pigx.version>
|
||||
<mybatis-plus.version>3.3.0</mybatis-plus.version>
|
||||
<pigx.version>3.9.0-SNAPSHOT</pigx.version>
|
||||
<mybatis-plus.version>3.3.1</mybatis-plus.version>
|
||||
<dynamic-ds.version>3.0.0</dynamic-ds.version>
|
||||
<druid.version>1.1.21</druid.version>
|
||||
<mysql.connector.version>8.0.18</mysql.connector.version>
|
||||
<mysql.connector.version>8.0.19</mysql.connector.version>
|
||||
<swagger.core.version>1.5.22</swagger.core.version>
|
||||
<mp.weixin.version>3.6.0</mp.weixin.version>
|
||||
<ijpay.version>1.2.0</ijpay.version>
|
||||
<fastjson.version>1.2.67</fastjson.version>
|
||||
<aliyun.version>3.0.52.ALL</aliyun.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
@@ -42,6 +46,11 @@
|
||||
<artifactId>pigx-common-gateway</artifactId>
|
||||
<version>${pigx.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-gray</artifactId>
|
||||
<version>${pigx.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-datasource</artifactId>
|
||||
@@ -72,6 +81,11 @@
|
||||
<artifactId>pigx-common-sentinel</artifactId>
|
||||
<version>${pigx.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-feign</artifactId>
|
||||
<version>${pigx.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-sequence</artifactId>
|
||||
@@ -116,6 +130,12 @@
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>${mysql.connector.version}</version>
|
||||
</dependency>
|
||||
<!--fastjson-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${fastjson.version}</version>
|
||||
</dependency>
|
||||
<!--swagger 最新依赖内置版本-->
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
@@ -138,6 +158,21 @@
|
||||
<artifactId>weixin-java-common</artifactId>
|
||||
<version>${mp.weixin.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.javen205</groupId>
|
||||
<artifactId>IJPay</artifactId>
|
||||
<version>${ijpay.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-sdk-java</artifactId>
|
||||
<version>${aliyun.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||
<version>${dynamic-ds.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
@@ -147,7 +182,7 @@
|
||||
<plugin>
|
||||
<groupId>com.pig4cloud.plugin</groupId>
|
||||
<artifactId>spring-cloud-maven-plugin</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>1.1.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
@@ -159,4 +194,17 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>aliyun-plugin</id>
|
||||
<url>https://maven.aliyun.com/repository/public</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</project>
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.9.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-core</artifactId>
|
||||
|
||||
+1
-2
@@ -10,7 +10,6 @@ import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
@@ -30,7 +29,7 @@ public class JacksonConfig {
|
||||
public Jackson2ObjectMapperBuilderCustomizer customizer() {
|
||||
return builder -> {
|
||||
builder.locale(Locale.CHINA);
|
||||
builder.timeZone(TimeZone.getTimeZone(ZoneId.systemDefault()));
|
||||
builder.timeZone(TimeZone.getTimeZone("Asia/Shanghai"));
|
||||
builder.simpleDateFormat(DatePattern.NORM_DATETIME_PATTERN);
|
||||
builder.modules(new PigxJavaTimeModule());
|
||||
};
|
||||
|
||||
-5
@@ -53,11 +53,6 @@ public interface CommonConstants {
|
||||
*/
|
||||
String STATUS_LOCK = "9";
|
||||
|
||||
/**
|
||||
* 菜单
|
||||
*/
|
||||
String MENU = "0";
|
||||
|
||||
/**
|
||||
* 菜单树根节点
|
||||
*/
|
||||
|
||||
+19
-10
@@ -134,15 +134,10 @@ public interface SecurityConstants {
|
||||
String BASE_FIND_STATEMENT = "select " + CLIENT_FIELDS
|
||||
+ " from sys_oauth_client_details";
|
||||
|
||||
/**
|
||||
* 默认的查询语句
|
||||
*/
|
||||
String DEFAULT_FIND_STATEMENT = BASE_FIND_STATEMENT + " order by client_id";
|
||||
|
||||
/**
|
||||
* 按条件client_id 查询
|
||||
*/
|
||||
String DEFAULT_SELECT_STATEMENT = BASE_FIND_STATEMENT + " where client_id = ?";
|
||||
String DEFAULT_SELECT_STATEMENT = BASE_FIND_STATEMENT + " where client_id = ? and del_flag = 0 and tenant_id = %s";
|
||||
|
||||
/**
|
||||
* 资源服务器默认bean名称
|
||||
@@ -157,22 +152,36 @@ public interface SecurityConstants {
|
||||
/**
|
||||
* 用户ID字段
|
||||
*/
|
||||
String DETAILS_USER_ID = "user_id";
|
||||
String DETAILS_USER_ID = "id";
|
||||
|
||||
/**
|
||||
* 用户名字段
|
||||
* 用户名
|
||||
*/
|
||||
String DETAILS_USERNAME = "username";
|
||||
|
||||
/**
|
||||
* 用户基本信息
|
||||
*/
|
||||
String DETAILS_USER = "user_info";
|
||||
|
||||
/**
|
||||
* 用户名phone
|
||||
*/
|
||||
String DETAILS_PHONE = "phone";
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
String DETAILS_AVATAR = "avatar";
|
||||
/**
|
||||
* 用户部门字段
|
||||
*/
|
||||
String DETAILS_DEPT_ID = "dept_id";
|
||||
String DETAILS_DEPT_ID = "deptId";
|
||||
|
||||
/**
|
||||
* 租户ID 字段
|
||||
*/
|
||||
String DETAILS_TENANT_ID = "tenant_id";
|
||||
String DETAILS_TENANT_ID = "tenantId";
|
||||
|
||||
/**
|
||||
* 协议字段
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.pig4cloud.pigx.common.core.constant.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020-02-17
|
||||
* <p>
|
||||
* 菜单类型
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum MenuTypeEnum {
|
||||
|
||||
/**
|
||||
* 左侧菜单
|
||||
*/
|
||||
LEFT_MENU("0", "left"),
|
||||
|
||||
/**
|
||||
* 顶部菜单
|
||||
*/
|
||||
TOP_MENU("2", "top"),
|
||||
|
||||
/**
|
||||
* 按钮
|
||||
*/
|
||||
BUTTON("1", "button");
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.pig4cloud.pigx.common.core.constant.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020-01-19
|
||||
* <p>
|
||||
* 前端类型类型
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum StyleTypeEnum {
|
||||
/**
|
||||
* 前端类型-avue 风格
|
||||
*/
|
||||
AVUE("0", "avue 风格"),
|
||||
|
||||
/**
|
||||
* 前端类型-element 风格
|
||||
*/
|
||||
ELEMENT("1", "element 风格");
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private String style;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
}
|
||||
+1
-1
@@ -23,7 +23,7 @@ package com.pig4cloud.pigx.common.core.exception;
|
||||
* @author lengleng
|
||||
* @date 2018年06月22日16:22:15
|
||||
*/
|
||||
public class ValidateCodeException extends Exception {
|
||||
public class ValidateCodeException extends RuntimeException {
|
||||
private static final long serialVersionUID = -7285211528095468156L;
|
||||
|
||||
public ValidateCodeException() {
|
||||
|
||||
@@ -33,6 +33,7 @@ import java.io.Serializable;
|
||||
* @param <T>
|
||||
* @author lengleng
|
||||
*/
|
||||
@Builder
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
|
||||
+11
-8
@@ -26,11 +26,10 @@ import com.pig4cloud.pigx.common.core.exception.CheckedException;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
@@ -51,8 +50,8 @@ import java.nio.charset.StandardCharsets;
|
||||
@Slf4j
|
||||
@UtilityClass
|
||||
public class WebUtils extends org.springframework.web.util.WebUtils {
|
||||
private final String BASIC_ = "Basic ";
|
||||
private final String UNKNOWN = "unknown";
|
||||
private final String BASIC_ = "Basic ";
|
||||
private final String UNKNOWN = "unknown";
|
||||
|
||||
/**
|
||||
* 判断是否ajax请求
|
||||
@@ -122,7 +121,12 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
|
||||
* @return {HttpServletRequest}
|
||||
*/
|
||||
public HttpServletRequest getRequest() {
|
||||
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
try {
|
||||
RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
|
||||
return ((ServletRequestAttributes) requestAttributes).getRequest();
|
||||
} catch (IllegalStateException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -206,8 +210,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
|
||||
* @return
|
||||
*/
|
||||
@SneakyThrows
|
||||
public String[] getClientId(ServerHttpRequest request) {
|
||||
String header = request.getHeaders().getFirst(HttpHeaders.AUTHORIZATION);
|
||||
public String getClientId(String header) {
|
||||
|
||||
if (header == null || !header.startsWith(BASIC_)) {
|
||||
throw new CheckedException("请求头中client信息为空");
|
||||
@@ -228,7 +231,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
|
||||
if (delim == -1) {
|
||||
throw new CheckedException("Invalid basic authentication token");
|
||||
}
|
||||
return new String[]{token.substring(0, delim), token.substring(delim + 1)};
|
||||
return token.substring(0, delim);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.9.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-data</artifactId>
|
||||
@@ -49,6 +49,11 @@
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-security</artifactId>
|
||||
</dependency>
|
||||
<!--feign client-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-upms-api</artifactId>
|
||||
</dependency>
|
||||
<!--缓存依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ public class RedisTemplateConfig {
|
||||
|
||||
// https://github.com/lettuce-io/lettuce-core/wiki/ReadFrom-Settings
|
||||
LettuceClientConfiguration lettuceClientConfiguration = LettuceClientConfiguration.builder()
|
||||
.readFrom(ReadFrom.SLAVE_PREFERRED)
|
||||
.readFrom(ReadFrom.REPLICA_PREFERRED)
|
||||
.clientOptions(clusterClientOptions).build();
|
||||
|
||||
return new LettuceConnectionFactory(redisClusterConfiguration, lettuceClientConfiguration);
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.pig4cloud.pigx.common.data.datascope;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020/4/26
|
||||
*/
|
||||
public interface DataScopeMapper<T> extends BaseMapper<T> {
|
||||
|
||||
/**
|
||||
* 根据 entity 条件,查询全部记录
|
||||
*
|
||||
* @param queryWrapper 实体对象封装操作类(可以为 null)
|
||||
* @param scope 数据权限范围
|
||||
* @return List<T>
|
||||
*/
|
||||
List<T> selectListByScope(@Param(Constants.WRAPPER) Wrapper<T> queryWrapper, DataScope scope);
|
||||
|
||||
|
||||
/**
|
||||
* 根据 entity 条件,查询全部记录(并翻页)
|
||||
*
|
||||
* @param page 分页查询条件(可以为 RowBounds.DEFAULT)
|
||||
* @param queryWrapper 实体对象封装操作类(可以为 null)
|
||||
* @param scope 数据权限范围
|
||||
* @return Page
|
||||
*/
|
||||
<E extends IPage<T>> E selectPageByScope(E page, @Param(Constants.WRAPPER) Wrapper<T> queryWrapper, DataScope scope);
|
||||
|
||||
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.pig4cloud.pigx.common.data.datascope;
|
||||
|
||||
import com.baomidou.mybatisplus.core.injector.AbstractMethod;
|
||||
import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020/4/26
|
||||
*/
|
||||
public class DataScopeSqlInjector extends DefaultSqlInjector {
|
||||
|
||||
@Override
|
||||
public List<AbstractMethod> getMethodList(Class<?> mapperClass) {
|
||||
List<AbstractMethod> methodList = super.getMethodList(mapperClass);
|
||||
methodList.add(new SelectListByScope());
|
||||
methodList.add(new SelectPageByScope());
|
||||
return methodList;
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.pig4cloud.pigx.common.data.datascope;
|
||||
|
||||
import com.baomidou.mybatisplus.core.enums.SqlMethod;
|
||||
import com.baomidou.mybatisplus.core.injector.AbstractMethod;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
import org.apache.ibatis.mapping.SqlSource;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020/4/26
|
||||
*/
|
||||
public class SelectListByScope extends AbstractMethod {
|
||||
@Override
|
||||
public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {
|
||||
SqlMethod sqlMethod = SqlMethod.SELECT_LIST;
|
||||
String sql = String.format(sqlMethod.getSql(), sqlFirst(), sqlSelectColumns(tableInfo, true), tableInfo.getTableName(),
|
||||
sqlWhereEntityWrapper(true, tableInfo), sqlComment());
|
||||
SqlSource sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass);
|
||||
return this.addSelectMappedStatementForTable(mapperClass, "selectListByScope", sqlSource, tableInfo);
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.pig4cloud.pigx.common.data.datascope;
|
||||
|
||||
import com.baomidou.mybatisplus.core.enums.SqlMethod;
|
||||
import com.baomidou.mybatisplus.core.injector.AbstractMethod;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
import org.apache.ibatis.mapping.SqlSource;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020/4/26
|
||||
*/
|
||||
public class SelectPageByScope extends AbstractMethod {
|
||||
|
||||
@Override
|
||||
public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {
|
||||
SqlMethod sqlMethod = SqlMethod.SELECT_PAGE;
|
||||
String sql = String.format(sqlMethod.getSql(), sqlFirst(), sqlSelectColumns(tableInfo, true),
|
||||
tableInfo.getTableName(), sqlWhereEntityWrapper(true, tableInfo), sqlComment());
|
||||
SqlSource sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass);
|
||||
return this.addSelectMappedStatementForTable(mapperClass, "selectPageByScope", sqlSource, tableInfo);
|
||||
}
|
||||
|
||||
}
|
||||
+10
-4
@@ -22,9 +22,9 @@ import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.tenant.TenantSqlParser;
|
||||
import com.pig4cloud.pigx.common.data.datascope.DataScopeHandle;
|
||||
import com.pig4cloud.pigx.common.data.datascope.DataScopeInterceptor;
|
||||
import com.pig4cloud.pigx.common.data.datascope.DataScopeSqlInjector;
|
||||
import com.pig4cloud.pigx.common.data.datascope.PigxDefaultDatascopeHandle;
|
||||
import com.pig4cloud.pigx.common.data.tenant.PigxTenantHandler;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
@@ -39,13 +39,12 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2017/10/29
|
||||
* @date 2020-02-08
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnBean(DataSource.class)
|
||||
@AutoConfigureAfter(DataSourceAutoConfiguration.class)
|
||||
@MapperScan("com.pig4cloud.pigx.**.mapper")
|
||||
public class MybatisPlusConfig {
|
||||
public class MybatisPlusConfiguration {
|
||||
|
||||
/**
|
||||
* 创建租户维护处理器对象
|
||||
@@ -95,7 +94,14 @@ public class MybatisPlusConfig {
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnBean(DataScopeHandle.class)
|
||||
public DataScopeInterceptor dataScopeInterceptor() {
|
||||
return new DataScopeInterceptor(dataScopeHandle());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnBean(DataScopeHandle.class)
|
||||
public DataScopeSqlInjector dataScopeSqlInjector() {
|
||||
return new DataScopeSqlInjector();
|
||||
}
|
||||
}
|
||||
+18
-3
@@ -17,7 +17,6 @@
|
||||
|
||||
package com.pig4cloud.pigx.common.data.resolver;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -33,6 +32,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -88,13 +88,28 @@ public class SqlFilterArgumentResolver implements HandlerMethodArgumentResolver
|
||||
|
||||
List<OrderItem> orderItemList = new ArrayList<>();
|
||||
Optional.ofNullable(ascs).ifPresent(s -> orderItemList.addAll(Arrays.stream(s)
|
||||
.filter(s1 -> !ArrayUtil.containsIgnoreCase(KEYWORDS, s1))
|
||||
.filter(sqlInjectPredicate())
|
||||
.map(OrderItem::asc).collect(Collectors.toList())));
|
||||
Optional.ofNullable(descs).ifPresent(s -> orderItemList.addAll(Arrays.stream(s)
|
||||
.filter(s1 -> !ArrayUtil.containsIgnoreCase(KEYWORDS, s1))
|
||||
.filter(sqlInjectPredicate())
|
||||
.map(OrderItem::desc).collect(Collectors.toList())));
|
||||
page.addOrder(orderItemList);
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断用户输入里面有没有关键字
|
||||
* @return Predicate
|
||||
*/
|
||||
private Predicate<String> sqlInjectPredicate() {
|
||||
return sql -> {
|
||||
for (String keyword : KEYWORDS) {
|
||||
if (StrUtil.containsIgnoreCase(sql, keyword)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -5,5 +5,5 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
com.pig4cloud.pigx.common.data.tenant.PigxTenantConfigProperties,\
|
||||
com.pig4cloud.pigx.common.data.tenant.TenantContextHolderFilter,\
|
||||
com.pig4cloud.pigx.common.data.tenant.PigxFeignTenantConfiguration,\
|
||||
com.pig4cloud.pigx.common.data.mybatis.MybatisPlusConfig,\
|
||||
com.pig4cloud.pigx.common.data.mybatis.MybatisPlusConfiguration,\
|
||||
com.pig4cloud.pigx.common.data.resolver.WebMvcConfig
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.9.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -17,72 +17,16 @@
|
||||
<description>pigx 动态切换数据源</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
</dependency>
|
||||
<!--common-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--数据操作-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-data</artifactId>
|
||||
</dependency>
|
||||
<!--mybatis-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<!-- druid 连接池 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<!--swagger-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-swagger</artifactId>
|
||||
</dependency>
|
||||
<!--安全模块-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-log</artifactId>
|
||||
</dependency>
|
||||
<!--代码生成模板引擎-->
|
||||
<dependency>
|
||||
<artifactId>velocity</artifactId>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<version>${velocity.version}</version>
|
||||
</dependency>
|
||||
<!--web 模块-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!--undertow容器-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
package com.pig4cloud.pigx.common.datasource;
|
||||
|
||||
import com.pig4cloud.pigx.common.datasource.config.DruidDataSourceProperties;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
|
||||
/**
|
||||
* @author Lucky
|
||||
* @date 2019-05-18
|
||||
* <p>
|
||||
* 自动配置类
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@EnableConfigurationProperties({DruidDataSourceProperties.class})
|
||||
public class DataSourceAutoConfiguration {
|
||||
}
|
||||
+56
@@ -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.pigx.common.datasource;
|
||||
|
||||
import com.baomidou.dynamic.datasource.processor.DsProcessor;
|
||||
import com.baomidou.dynamic.datasource.provider.DynamicDataSourceProvider;
|
||||
import com.pig4cloud.pigx.common.datasource.config.DruidDataSourceProperties;
|
||||
import com.pig4cloud.pigx.common.datasource.config.JdbcDynamicDataSourceProvider;
|
||||
import com.pig4cloud.pigx.common.datasource.config.LastParamDsProcessor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.jasypt.encryption.StringEncryptor;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020-02-06
|
||||
* <p>
|
||||
* 动态数据源切换配置
|
||||
*/
|
||||
@Configuration
|
||||
@AllArgsConstructor
|
||||
@AutoConfigureAfter(DataSourceAutoConfiguration.class)
|
||||
@EnableConfigurationProperties(DruidDataSourceProperties.class)
|
||||
public class DynamicDataSourceAutoConfiguration {
|
||||
private final StringEncryptor stringEncryptor;
|
||||
private final DruidDataSourceProperties properties;
|
||||
|
||||
@Bean
|
||||
public DynamicDataSourceProvider dynamicDataSourceProvider() {
|
||||
return new JdbcDynamicDataSourceProvider(stringEncryptor, properties);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DsProcessor dsProcessor() {
|
||||
return new LastParamDsProcessor();
|
||||
}
|
||||
}
|
||||
+5
-2
@@ -1,6 +1,8 @@
|
||||
package com.pig4cloud.pigx.common.datasource.annotation;
|
||||
|
||||
import com.pig4cloud.pigx.common.datasource.config.DynamicDataSourceConfig;
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
|
||||
import com.pig4cloud.pigx.common.datasource.DynamicDataSourceAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
@@ -15,6 +17,7 @@ import java.lang.annotation.*;
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Inherited
|
||||
@Import({DynamicDataSourceConfig.class})
|
||||
@EnableAutoConfiguration(exclude = {DruidDataSourceAutoConfigure.class})
|
||||
@Import(DynamicDataSourceAutoConfiguration.class)
|
||||
public @interface EnableDynamicDataSource {
|
||||
}
|
||||
+21
@@ -14,8 +14,29 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
@ConfigurationProperties("spring.datasource.druid")
|
||||
public class DruidDataSourceProperties {
|
||||
|
||||
/**
|
||||
* 数据源用户名
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 数据源密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* jdbcurl
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 数据源驱动
|
||||
*/
|
||||
private String driverClassName;
|
||||
|
||||
/**
|
||||
* 查询数据源的SQL
|
||||
*/
|
||||
private String queryDsSql = "select * from gen_datasource_conf where del_flag = 0";
|
||||
}
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
package com.pig4cloud.pigx.common.datasource.config;
|
||||
|
||||
import com.pig4cloud.pigx.common.datasource.support.DynamicDataSourceContextHolder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2019-03-31
|
||||
* <p>
|
||||
* 动态数据源类
|
||||
*/
|
||||
@Slf4j
|
||||
public class DynamicDataSource extends AbstractRoutingDataSource {
|
||||
|
||||
/**
|
||||
* 指定路由Key
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected Object determineCurrentLookupKey() {
|
||||
return DynamicDataSourceContextHolder.getDataSourceType();
|
||||
}
|
||||
}
|
||||
-104
@@ -1,104 +0,0 @@
|
||||
package com.pig4cloud.pigx.common.datasource.config;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.mysql.cj.jdbc.Driver;
|
||||
import com.pig4cloud.pigx.common.datasource.support.DataSourceConstants;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jasypt.encryption.StringEncryptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.transaction.ChainedTransactionManager;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.annotation.TransactionManagementConfigurer;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2019-03-31
|
||||
* <p>
|
||||
* 动态数据源切换配置
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration
|
||||
@AllArgsConstructor
|
||||
public class DynamicDataSourceConfig implements TransactionManagementConfigurer {
|
||||
private final Map<Object, Object> dataSourceMap = new HashMap<>(8);
|
||||
private final DruidDataSourceProperties dataSourceProperties;
|
||||
private final StringEncryptor stringEncryptor;
|
||||
|
||||
@Bean("dynamicDataSource")
|
||||
public DynamicDataSource dataSource() {
|
||||
DynamicDataSource ds = new DynamicDataSource();
|
||||
DruidDataSource cads = new DruidDataSource();
|
||||
cads.setUrl(dataSourceProperties.getUrl());
|
||||
cads.setDriverClassName(dataSourceProperties.getDriverClassName());
|
||||
cads.setUsername(dataSourceProperties.getUsername());
|
||||
cads.setPassword(dataSourceProperties.getPassword());
|
||||
ds.setDefaultTargetDataSource(cads);
|
||||
dataSourceMap.put(0, cads);
|
||||
ds.setTargetDataSources(dataSourceMap);
|
||||
return ds;
|
||||
}
|
||||
|
||||
/**
|
||||
* 组装默认配置的数据源,查询数据库配置
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
DriverManagerDataSource dds = new DriverManagerDataSource();
|
||||
dds.setUrl(dataSourceProperties.getUrl());
|
||||
dds.setDriverClassName(dataSourceProperties.getDriverClassName());
|
||||
dds.setUsername(dataSourceProperties.getUsername());
|
||||
dds.setPassword(dataSourceProperties.getPassword());
|
||||
|
||||
List<Map<String, Object>> dbList = new JdbcTemplate(dds).queryForList(DataSourceConstants.QUERY_DS_SQL);
|
||||
log.info("开始 -> 初始化动态数据源");
|
||||
Optional.of(dbList).ifPresent(list -> list.forEach(db -> {
|
||||
log.info("数据源:{}", db.get(DataSourceConstants.DS_NAME));
|
||||
DruidDataSource ds = new DruidDataSource();
|
||||
ds.setUrl(String.valueOf(db.get(DataSourceConstants.DS_JDBC_URL)));
|
||||
ds.setDriverClassName(Driver.class.getName());
|
||||
ds.setUsername((String) db.get(DataSourceConstants.DS_USER_NAME));
|
||||
|
||||
String decPwd = stringEncryptor.decrypt((String) db.get(DataSourceConstants.DS_USER_PWD));
|
||||
ds.setPassword(decPwd);
|
||||
dataSourceMap.put(db.get(DataSourceConstants.DS_ROUTE_KEY), ds);
|
||||
}));
|
||||
|
||||
log.info("完毕 -> 初始化动态数据源,共计 {} 条", dataSourceMap.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新加载数据源配置
|
||||
*/
|
||||
public Boolean reload() {
|
||||
init();
|
||||
DynamicDataSource dataSource = dataSource();
|
||||
dataSource.setTargetDataSources(dataSourceMap);
|
||||
dataSource.afterPropertiesSet();
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public PlatformTransactionManager txManager() {
|
||||
DataSourceTransactionManager transactionManager
|
||||
= new DataSourceTransactionManager(dataSource());
|
||||
return new ChainedTransactionManager(transactionManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlatformTransactionManager annotationDrivenTransactionManager() {
|
||||
return txManager();
|
||||
}
|
||||
|
||||
}
|
||||
-44
@@ -1,44 +0,0 @@
|
||||
package com.pig4cloud.pigx.common.datasource.config;
|
||||
|
||||
import com.pig4cloud.pigx.common.datasource.support.DynamicDataSourceContextHolder;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2019-05-18
|
||||
* <p>
|
||||
* 动态数据源拦截器
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class DynamicDatasourceInterceptor implements HandlerInterceptor {
|
||||
|
||||
/**
|
||||
* TODO 根据上下文判断路由哪个数据库
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param handler
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
|
||||
DynamicDataSourceContextHolder.setDataSourceType(1);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler,
|
||||
@Nullable Exception ex) {
|
||||
DynamicDataSourceContextHolder.clearDataSourceType();
|
||||
}
|
||||
|
||||
}
|
||||
+79
@@ -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.pigx.common.datasource.config;
|
||||
|
||||
import com.baomidou.dynamic.datasource.provider.AbstractJdbcDataSourceProvider;
|
||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty;
|
||||
import com.pig4cloud.pigx.common.datasource.support.DataSourceConstants;
|
||||
import org.jasypt.encryption.StringEncryptor;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020/2/6
|
||||
* <p>
|
||||
* 从数据源中获取 配置信息
|
||||
*/
|
||||
public class JdbcDynamicDataSourceProvider extends AbstractJdbcDataSourceProvider {
|
||||
private final DruidDataSourceProperties properties;
|
||||
private final StringEncryptor stringEncryptor;
|
||||
|
||||
public JdbcDynamicDataSourceProvider(StringEncryptor stringEncryptor, DruidDataSourceProperties properties) {
|
||||
super(properties.getDriverClassName(), properties.getUrl(), properties.getUsername(), properties.getPassword());
|
||||
this.stringEncryptor = stringEncryptor;
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行语句获得数据源参数
|
||||
*
|
||||
* @param statement 语句
|
||||
* @return 数据源参数
|
||||
* @throws SQLException sql异常
|
||||
*/
|
||||
@Override
|
||||
protected Map<String, DataSourceProperty> executeStmt(Statement statement) throws SQLException {
|
||||
ResultSet rs = statement.executeQuery(properties.getQueryDsSql());
|
||||
|
||||
Map<String, DataSourceProperty> map = new HashMap<>(8);
|
||||
while (rs.next()) {
|
||||
String name = rs.getString(DataSourceConstants.DS_NAME);
|
||||
String username = rs.getString(DataSourceConstants.DS_USER_NAME);
|
||||
String password = rs.getString(DataSourceConstants.DS_USER_PWD);
|
||||
String url = rs.getString(DataSourceConstants.DS_JDBC_URL);
|
||||
DataSourceProperty property = new DataSourceProperty();
|
||||
property.setUsername(username);
|
||||
property.setPassword(stringEncryptor.decrypt(password));
|
||||
property.setUrl(url);
|
||||
map.put(name, property);
|
||||
}
|
||||
|
||||
// 添加默认主数据源
|
||||
DataSourceProperty property = new DataSourceProperty();
|
||||
property.setUsername(properties.getUsername());
|
||||
property.setPassword(properties.getPassword());
|
||||
property.setUrl(properties.getUrl());
|
||||
map.put(DataSourceConstants.DS_MASTER, property);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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.pigx.common.datasource.config;
|
||||
|
||||
import com.baomidou.dynamic.datasource.processor.DsProcessor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020/2/6
|
||||
* <p>
|
||||
* 参数数据源解析 @DS("#last)
|
||||
*/
|
||||
public class LastParamDsProcessor extends DsProcessor {
|
||||
|
||||
private static final String LAST_PREFIX = "#last";
|
||||
|
||||
|
||||
/**
|
||||
* 抽象匹配条件 匹配才会走当前执行器否则走下一级执行器
|
||||
*
|
||||
* @param key DS注解里的内容
|
||||
* @return 是否匹配
|
||||
*/
|
||||
@Override
|
||||
public boolean matches(String key) {
|
||||
return key.startsWith(LAST_PREFIX);
|
||||
}
|
||||
|
||||
/**
|
||||
* 抽象最终决定数据源
|
||||
*
|
||||
* @param invocation 方法执行信息
|
||||
* @param key DS注解里的内容
|
||||
* @return 数据源名称
|
||||
*/
|
||||
@Override
|
||||
public String doDetermineDatasource(MethodInvocation invocation, String key) {
|
||||
Object[] arguments = invocation.getArguments();
|
||||
return String.valueOf(arguments[arguments.length - 1]);
|
||||
}
|
||||
}
|
||||
+5
-9
@@ -7,21 +7,17 @@ package com.pig4cloud.pigx.common.datasource.support;
|
||||
* 数据源相关常量
|
||||
*/
|
||||
public interface DataSourceConstants {
|
||||
/**
|
||||
* 查询数据源的SQL
|
||||
*/
|
||||
String QUERY_DS_SQL = "select * from gen_datasource_conf where del_flag = 0";
|
||||
|
||||
/**
|
||||
* 动态路由KEY
|
||||
*/
|
||||
String DS_ROUTE_KEY = "id";
|
||||
|
||||
/**
|
||||
* 数据源名称
|
||||
*/
|
||||
String DS_NAME = "name";
|
||||
|
||||
/**
|
||||
* 默认数据源(master)
|
||||
*/
|
||||
String DS_MASTER = "master";
|
||||
|
||||
/**
|
||||
* jdbcurl
|
||||
*/
|
||||
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
package com.pig4cloud.pigx.common.datasource.support;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2019-05-18
|
||||
* <p>
|
||||
* 根据当前线程来选择具体的数据源
|
||||
*/
|
||||
@UtilityClass
|
||||
public class DynamicDataSourceContextHolder {
|
||||
private final ThreadLocal<Integer> CONTEXT_HOLDER = new ThreadLocal<>();
|
||||
|
||||
/**
|
||||
* 提供给AOP去设置当前的线程的数据源的信息
|
||||
*
|
||||
* @param dataSourceType
|
||||
*/
|
||||
public void setDataSourceType(Integer dataSourceType) {
|
||||
CONTEXT_HOLDER.set(dataSourceType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提供给AbstractRoutingDataSource的实现类,通过key选择数据源
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Integer getDataSourceType() {
|
||||
return CONTEXT_HOLDER.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用默认的数据源
|
||||
*
|
||||
*/
|
||||
public void clearDataSourceType() {
|
||||
CONTEXT_HOLDER.remove();
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
com.pig4cloud.pigx.common.datasource.DataSourceAutoConfiguration
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/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">
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>3.9.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>pigx-common-feign</artifactId>
|
||||
<description>feign 通用组件</description>
|
||||
<dependencies>
|
||||
<!--feign 依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.pigx.common.feign;
|
||||
|
||||
import com.pig4cloud.pigx.common.feign.endpoint.FeignClientEndpoint;
|
||||
import feign.Feign;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.cloud.openfeign.PigxFeignClientsRegistrar;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020/2/8
|
||||
* <p>
|
||||
* feign 自动化配置
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnClass(Feign.class)
|
||||
@Import(PigxFeignClientsRegistrar.class)
|
||||
@AutoConfigureAfter(EnableFeignClients.class)
|
||||
public class PigxFeignAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnAvailableEndpoint
|
||||
public FeignClientEndpoint feignClientEndpoint(ApplicationContext context) {
|
||||
return new FeignClientEndpoint(context);
|
||||
}
|
||||
|
||||
}
|
||||
+5
-2
@@ -15,20 +15,23 @@
|
||||
* Author: lengleng (wangiegie@gmail.com)
|
||||
*/
|
||||
|
||||
package com.pig4cloud.pigx.common.security.annotation;
|
||||
package com.pig4cloud.pigx.common.feign.annotation;
|
||||
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.cloud.openfeign.PigxFeignClientsRegistrar;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2018/9/5
|
||||
* @date 2020-02-08
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@EnableFeignClients
|
||||
@Import(PigxFeignClientsRegistrar.class)
|
||||
public @interface EnablePigxFeignClients {
|
||||
/**
|
||||
* Alias for the {@link #basePackages()} attribute. Allows for more concise annotation
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
package com.pig4cloud.pigx.common.feign.endpoint;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.beans.factory.SmartInitializingSingleton;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Feign client 端点
|
||||
*
|
||||
* @author L.cm
|
||||
*/
|
||||
@Endpoint(id = "feign")
|
||||
public class FeignClientEndpoint implements SmartInitializingSingleton {
|
||||
private final ApplicationContext context;
|
||||
private final List<FeignClientInfo> clientList;
|
||||
|
||||
public FeignClientEndpoint(ApplicationContext context) {
|
||||
this.context = context;
|
||||
this.clientList = new ArrayList<>();
|
||||
}
|
||||
|
||||
@ReadOperation
|
||||
public List<FeignClientInfo> invoke() {
|
||||
return clientList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterSingletonsInstantiated() {
|
||||
clientList.addAll(getClientList(context));
|
||||
}
|
||||
|
||||
private static List<FeignClientInfo> getClientList(ApplicationContext context) {
|
||||
Map<String, Object> feignClientMap = context.getBeansWithAnnotation(FeignClient.class);
|
||||
// 1. 解析注解
|
||||
List<FeignClientInfo> feignClientInfoList = new ArrayList<>();
|
||||
Set<Map.Entry<String, Object>> feignClientEntrySet = feignClientMap.entrySet();
|
||||
for (Map.Entry<String, Object> feignClientEntry : feignClientEntrySet) {
|
||||
String beanName = feignClientEntry.getKey();
|
||||
Object feignClientBean = feignClientEntry.getValue();
|
||||
if (feignClientBean == null) {
|
||||
continue;
|
||||
}
|
||||
// 解析注解
|
||||
Class<?> feignClientClass = feignClientBean.getClass();
|
||||
FeignClient feignClientAnn = AnnotationUtils.findAnnotation(feignClientClass, FeignClient.class);
|
||||
if (feignClientAnn == null) {
|
||||
continue;
|
||||
}
|
||||
FeignClientInfo feignClientInfo = new FeignClientInfo();
|
||||
feignClientInfo.setBeanName(beanName);
|
||||
String serviceId = feignClientAnn.value();
|
||||
String contextId = feignClientAnn.contextId();
|
||||
String url = feignClientAnn.url();
|
||||
String path = feignClientAnn.path();
|
||||
feignClientInfo.setServiceId(serviceId);
|
||||
feignClientInfo.setContextId(contextId);
|
||||
feignClientInfo.setUrl(url);
|
||||
feignClientInfo.setPath(path);
|
||||
// 组装客户端信息
|
||||
List<ClientInfo> clientInfoList = new ArrayList<>();
|
||||
Class<?>[] interfaces = feignClientClass.getInterfaces();
|
||||
for (Class<?> clientInterface : interfaces) {
|
||||
Method[] methods = clientInterface.getDeclaredMethods();
|
||||
for (Method method : methods) {
|
||||
if (method.isDefault()) {
|
||||
continue;
|
||||
}
|
||||
RequestMapping requestMapping = AnnotatedElementUtils.getMergedAnnotation(method, RequestMapping.class);
|
||||
if (requestMapping == null) {
|
||||
continue;
|
||||
}
|
||||
clientInfoList.add(new ClientInfo(requestMapping.method(), requestMapping.value()));
|
||||
}
|
||||
}
|
||||
feignClientInfo.setClientList(clientInfoList);
|
||||
feignClientInfoList.add(feignClientInfo);
|
||||
}
|
||||
return feignClientInfoList;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class FeignClientInfo {
|
||||
private String beanName;
|
||||
private String serviceId;
|
||||
private String contextId;
|
||||
private String url;
|
||||
private String path;
|
||||
private List<ClientInfo> clientList;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public static class ClientInfo {
|
||||
private final RequestMethod[] methods;
|
||||
private final String[] mappings;
|
||||
}
|
||||
|
||||
}
|
||||
+231
@@ -0,0 +1,231 @@
|
||||
/*
|
||||
* 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 org.springframework.cloud.openfeign;
|
||||
|
||||
import com.pig4cloud.pigx.common.feign.PigxFeignAutoConfiguration;
|
||||
import lombok.Getter;
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.beans.factory.config.BeanDefinitionHolder;
|
||||
import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.context.EnvironmentAware;
|
||||
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
|
||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||
import org.springframework.core.annotation.AnnotationAttributes;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.io.support.SpringFactoriesLoader;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author L.cm
|
||||
* @date 2020/2/8
|
||||
* <p>
|
||||
* feign 自动配置功能 from mica
|
||||
*/
|
||||
public class PigxFeignClientsRegistrar implements ImportBeanDefinitionRegistrar, BeanClassLoaderAware, EnvironmentAware {
|
||||
@Getter
|
||||
private ClassLoader beanClassLoader;
|
||||
@Getter
|
||||
private Environment environment;
|
||||
|
||||
@Override
|
||||
public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry) {
|
||||
registerFeignClients(registry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
this.beanClassLoader = classLoader;
|
||||
}
|
||||
|
||||
private void registerFeignClients(BeanDefinitionRegistry registry) {
|
||||
List<String> feignClients = SpringFactoriesLoader.loadFactoryNames(getSpringFactoriesLoaderFactoryClass(), getBeanClassLoader());
|
||||
// 如果 spring.factories 里为空
|
||||
if (feignClients.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (String className : feignClients) {
|
||||
try {
|
||||
Class<?> clazz = beanClassLoader.loadClass(className);
|
||||
AnnotationAttributes attributes = AnnotatedElementUtils.getMergedAnnotationAttributes(clazz, FeignClient.class);
|
||||
if (attributes == null) {
|
||||
continue;
|
||||
}
|
||||
// 如果已经存在该 bean,支持原生的 Feign
|
||||
if (registry.containsBeanDefinition(className)) {
|
||||
continue;
|
||||
}
|
||||
registerClientConfiguration(registry, getClientName(attributes), attributes.get("configuration"));
|
||||
|
||||
validate(attributes);
|
||||
BeanDefinitionBuilder definition = BeanDefinitionBuilder.genericBeanDefinition(FeignClientFactoryBean.class);
|
||||
definition.addPropertyValue("url", getUrl(attributes));
|
||||
definition.addPropertyValue("path", getPath(attributes));
|
||||
String name = getName(attributes);
|
||||
definition.addPropertyValue("name", name);
|
||||
|
||||
// 兼容最新版本的 spring-cloud-openfeign,尚未发布
|
||||
StringBuilder aliasBuilder = new StringBuilder(18);
|
||||
if (attributes.containsKey("contextId")) {
|
||||
String contextId = getContextId(attributes);
|
||||
aliasBuilder.append(contextId);
|
||||
definition.addPropertyValue("contextId", contextId);
|
||||
} else {
|
||||
aliasBuilder.append(name);
|
||||
}
|
||||
|
||||
definition.addPropertyValue("type", className);
|
||||
definition.addPropertyValue("decode404", attributes.get("decode404"));
|
||||
definition.addPropertyValue("fallback", attributes.get("fallback"));
|
||||
definition.addPropertyValue("fallbackFactory", attributes.get("fallbackFactory"));
|
||||
definition.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE);
|
||||
|
||||
AbstractBeanDefinition beanDefinition = definition.getBeanDefinition();
|
||||
|
||||
// alias
|
||||
String alias = aliasBuilder.append("FeignClient").toString();
|
||||
|
||||
// has a default, won't be null
|
||||
boolean primary = (Boolean) attributes.get("primary");
|
||||
|
||||
beanDefinition.setPrimary(primary);
|
||||
|
||||
String qualifier = getQualifier(attributes);
|
||||
if (StringUtils.hasText(qualifier)) {
|
||||
alias = qualifier;
|
||||
}
|
||||
|
||||
BeanDefinitionHolder holder = new BeanDefinitionHolder(beanDefinition, className, new String[]{alias});
|
||||
BeanDefinitionReaderUtils.registerBeanDefinition(holder, registry);
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class used by {@link SpringFactoriesLoader} to load configuration
|
||||
* candidates.
|
||||
*
|
||||
* @return the factory class
|
||||
*/
|
||||
private Class<?> getSpringFactoriesLoaderFactoryClass() {
|
||||
return PigxFeignAutoConfiguration.class;
|
||||
}
|
||||
|
||||
private void validate(Map<String, Object> attributes) {
|
||||
AnnotationAttributes annotation = AnnotationAttributes.fromMap(attributes);
|
||||
// This blows up if an aliased property is overspecified
|
||||
FeignClientsRegistrar.validateFallback(annotation.getClass("fallback"));
|
||||
FeignClientsRegistrar.validateFallbackFactory(annotation.getClass("fallbackFactory"));
|
||||
}
|
||||
|
||||
private String getName(Map<String, Object> attributes) {
|
||||
String name = (String) attributes.get("serviceId");
|
||||
if (!StringUtils.hasText(name)) {
|
||||
name = (String) attributes.get("name");
|
||||
}
|
||||
if (!StringUtils.hasText(name)) {
|
||||
name = (String) attributes.get("value");
|
||||
}
|
||||
name = resolve(name);
|
||||
return FeignClientsRegistrar.getName(name);
|
||||
}
|
||||
|
||||
private String getContextId(Map<String, Object> attributes) {
|
||||
String contextId = (String) attributes.get("contextId");
|
||||
if (!StringUtils.hasText(contextId)) {
|
||||
return getName(attributes);
|
||||
}
|
||||
|
||||
contextId = resolve(contextId);
|
||||
return FeignClientsRegistrar.getName(contextId);
|
||||
}
|
||||
|
||||
private String resolve(String value) {
|
||||
if (StringUtils.hasText(value)) {
|
||||
return this.environment.resolvePlaceholders(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private String getUrl(Map<String, Object> attributes) {
|
||||
String url = resolve((String) attributes.get("url"));
|
||||
return FeignClientsRegistrar.getUrl(url);
|
||||
}
|
||||
|
||||
private String getPath(Map<String, Object> attributes) {
|
||||
String path = resolve((String) attributes.get("path"));
|
||||
return FeignClientsRegistrar.getPath(path);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getQualifier(@Nullable Map<String, Object> client) {
|
||||
if (client == null) {
|
||||
return null;
|
||||
}
|
||||
String qualifier = (String) client.get("qualifier");
|
||||
if (StringUtils.hasText(qualifier)) {
|
||||
return qualifier;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getClientName(@Nullable Map<String, Object> client) {
|
||||
if (client == null) {
|
||||
return null;
|
||||
}
|
||||
String value = (String) client.get("contextId");
|
||||
if (!StringUtils.hasText(value)) {
|
||||
value = (String) client.get("value");
|
||||
}
|
||||
if (!StringUtils.hasText(value)) {
|
||||
value = (String) client.get("name");
|
||||
}
|
||||
if (!StringUtils.hasText(value)) {
|
||||
value = (String) client.get("serviceId");
|
||||
}
|
||||
if (StringUtils.hasText(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
throw new IllegalStateException("Either 'name' or 'value' must be provided in @" + FeignClient.class.getSimpleName());
|
||||
}
|
||||
|
||||
private void registerClientConfiguration(BeanDefinitionRegistry registry, Object name, Object configuration) {
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(FeignClientSpecification.class);
|
||||
builder.addConstructorArgValue(name);
|
||||
builder.addConstructorArgValue(configuration);
|
||||
registry.registerBeanDefinition(name + "." + FeignClientSpecification.class.getSimpleName(), builder.getBeanDefinition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnvironment(Environment environment) {
|
||||
this.environment = environment;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
com.pig4cloud.pigx.common.feign.PigxFeignAutoConfiguration
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.9.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-gateway</artifactId>
|
||||
@@ -47,8 +47,12 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-alibaba-nacos-discovery</artifactId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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.pigx.common.gateway.configuration;
|
||||
|
||||
import com.pig4cloud.pigx.common.gateway.filter.GrayReactiveLoadBalancerClientFilter;
|
||||
import com.pig4cloud.pigx.common.gateway.rule.GrayLoadBalancer;
|
||||
import com.pig4cloud.pigx.common.gateway.rule.VersionGrayLoadBalancer;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.client.discovery.DiscoveryClient;
|
||||
import org.springframework.cloud.gateway.config.GatewayReactiveLoadBalancerClientAutoConfiguration;
|
||||
import org.springframework.cloud.gateway.config.LoadBalancerProperties;
|
||||
import org.springframework.cloud.gateway.filter.ReactiveLoadBalancerClientFilter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Mica ribbon rule auto configuration.
|
||||
*
|
||||
* @author L.cm
|
||||
* @link https://github.com/lets-mica/mica
|
||||
*/
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(LoadBalancerProperties.class)
|
||||
@ConditionalOnProperty(value = "gray.rule.enabled", havingValue = "true")
|
||||
@AutoConfigureBefore(GatewayReactiveLoadBalancerClientAutoConfiguration.class)
|
||||
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
|
||||
public class GrayLoadBalancerClientConfiguration {
|
||||
|
||||
@Bean
|
||||
public ReactiveLoadBalancerClientFilter gatewayLoadBalancerClientFilter(GrayLoadBalancer grayLoadBalancer,
|
||||
LoadBalancerProperties properties) {
|
||||
return new GrayReactiveLoadBalancerClientFilter(properties, grayLoadBalancer);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public GrayLoadBalancer grayLoadBalancer(DiscoveryClient discoveryClient) {
|
||||
return new VersionGrayLoadBalancer(discoveryClient);
|
||||
}
|
||||
}
|
||||
-76
@@ -1,76 +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 com.pig4cloud.pigx.common.gateway.configuration;
|
||||
|
||||
import com.alibaba.cloud.nacos.ribbon.NacosServer;
|
||||
import com.pig4cloud.pigx.common.gateway.filter.GrayLoadBalancerClientFilter;
|
||||
import com.pig4cloud.pigx.common.gateway.rule.AbstractDiscoveryEnabledRule;
|
||||
import com.pig4cloud.pigx.common.gateway.rule.MetadataAwareRule;
|
||||
import com.pig4cloud.pigx.common.gateway.support.PigxRibbonRuleProperties;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
|
||||
import org.springframework.cloud.gateway.config.LoadBalancerProperties;
|
||||
import org.springframework.cloud.gateway.filter.LoadBalancerClientFilter;
|
||||
import org.springframework.cloud.netflix.ribbon.RibbonClientConfiguration;
|
||||
import org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient;
|
||||
import org.springframework.cloud.netflix.ribbon.SpringClientFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
|
||||
/**
|
||||
* Mica ribbon rule auto configuration.
|
||||
*
|
||||
* @author L.cm
|
||||
* @link https://github.com/lets-mica/mica
|
||||
*/
|
||||
@Configuration
|
||||
@RequiredArgsConstructor
|
||||
@ConditionalOnClass(NacosServer.class)
|
||||
@AutoConfigureBefore(RibbonClientConfiguration.class)
|
||||
@EnableConfigurationProperties(PigxRibbonRuleProperties.class)
|
||||
@ConditionalOnProperty(value = "ribbon.rule.enabled", matchIfMissing = true)
|
||||
public class PigxRibbonRuleAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public AbstractDiscoveryEnabledRule metadataAwareRule() {
|
||||
return new MetadataAwareRule();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(LoadBalancerClient.class)
|
||||
public LoadBalancerClient loadBalancerClient(SpringClientFactory springClientFactory) {
|
||||
return new RibbonLoadBalancerClient(springClientFactory);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(LoadBalancerClientFilter.class)
|
||||
public LoadBalancerClientFilter loadBalancerClientFilter(RibbonLoadBalancerClient client
|
||||
, LoadBalancerProperties properties) {
|
||||
return new GrayLoadBalancerClientFilter(client, properties);
|
||||
}
|
||||
|
||||
}
|
||||
-49
@@ -1,49 +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 com.pig4cloud.pigx.common.gateway.filter;
|
||||
|
||||
import org.springframework.cloud.client.ServiceInstance;
|
||||
import org.springframework.cloud.gateway.config.LoadBalancerProperties;
|
||||
import org.springframework.cloud.gateway.filter.LoadBalancerClientFilter;
|
||||
import org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.GATEWAY_REQUEST_URL_ATTR;
|
||||
|
||||
/**
|
||||
* @author Spencer Gibb
|
||||
* @author Tim Ysewyn
|
||||
*/
|
||||
public class GrayLoadBalancerClientFilter extends LoadBalancerClientFilter {
|
||||
private final RibbonLoadBalancerClient loadBalancer;
|
||||
|
||||
public GrayLoadBalancerClientFilter(RibbonLoadBalancerClient loadBalancer, LoadBalancerProperties properties) {
|
||||
super(loadBalancer, properties);
|
||||
this.loadBalancer = loadBalancer;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ServiceInstance choose(ServerWebExchange exchange) {
|
||||
HttpHeaders headers = exchange.getRequest().getHeaders();
|
||||
return loadBalancer.choose(((URI) exchange.getAttribute(GATEWAY_REQUEST_URL_ATTR)).getHost(), headers);
|
||||
}
|
||||
|
||||
}
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* 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.pigx.common.gateway.filter;
|
||||
|
||||
import com.pig4cloud.pigx.common.gateway.rule.GrayLoadBalancer;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cloud.client.ServiceInstance;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalancerUriTools;
|
||||
import org.springframework.cloud.client.loadbalancer.reactive.DefaultResponse;
|
||||
import org.springframework.cloud.client.loadbalancer.reactive.Response;
|
||||
import org.springframework.cloud.gateway.config.LoadBalancerProperties;
|
||||
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
|
||||
import org.springframework.cloud.gateway.filter.ReactiveLoadBalancerClientFilter;
|
||||
import org.springframework.cloud.gateway.support.DelegatingServiceInstance;
|
||||
import org.springframework.cloud.gateway.support.NotFoundException;
|
||||
import org.springframework.cloud.gateway.support.ServerWebExchangeUtils;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020/1/11
|
||||
*/
|
||||
@Slf4j
|
||||
public class GrayReactiveLoadBalancerClientFilter extends ReactiveLoadBalancerClientFilter {
|
||||
private static final int LOAD_BALANCER_CLIENT_FILTER_ORDER = 10150;
|
||||
private LoadBalancerProperties properties;
|
||||
|
||||
private GrayLoadBalancer grayLoadBalancer;
|
||||
|
||||
public GrayReactiveLoadBalancerClientFilter(LoadBalancerProperties properties, GrayLoadBalancer grayLoadBalancer) {
|
||||
super(null, properties);
|
||||
this.properties = properties;
|
||||
this.grayLoadBalancer = grayLoadBalancer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return LOAD_BALANCER_CLIENT_FILTER_ORDER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
|
||||
URI url = exchange.getAttribute(ServerWebExchangeUtils.GATEWAY_REQUEST_URL_ATTR);
|
||||
String schemePrefix = exchange.getAttribute(ServerWebExchangeUtils.GATEWAY_SCHEME_PREFIX_ATTR);
|
||||
if (url == null
|
||||
|| (!"lb".equals(url.getScheme()) && !"lb".equals(schemePrefix))) {
|
||||
return chain.filter(exchange);
|
||||
}
|
||||
// preserve the original url
|
||||
ServerWebExchangeUtils.addOriginalRequestUrl(exchange, url);
|
||||
|
||||
if (log.isTraceEnabled()) {
|
||||
log.trace(ReactiveLoadBalancerClientFilter.class.getSimpleName()
|
||||
+ " url before: " + url);
|
||||
}
|
||||
|
||||
return choose(exchange).doOnNext(response -> {
|
||||
|
||||
if (!response.hasServer()) {
|
||||
throw NotFoundException.create(properties.isUse404(),
|
||||
"Unable to find instance for " + url.getHost());
|
||||
}
|
||||
|
||||
URI uri = exchange.getRequest().getURI();
|
||||
|
||||
// if the `lb:<scheme>` mechanism was used, use `<scheme>` as the default,
|
||||
// if the loadbalancer doesn't provide one.
|
||||
String overrideScheme = null;
|
||||
if (schemePrefix != null) {
|
||||
overrideScheme = url.getScheme();
|
||||
}
|
||||
|
||||
DelegatingServiceInstance serviceInstance = new DelegatingServiceInstance(
|
||||
response.getServer(), overrideScheme);
|
||||
|
||||
URI requestUrl = LoadBalancerUriTools.reconstructURI(serviceInstance, uri);
|
||||
|
||||
if (log.isTraceEnabled()) {
|
||||
log.trace("LoadBalancerClientFilter url chosen: " + requestUrl);
|
||||
}
|
||||
exchange.getAttributes().put(ServerWebExchangeUtils.GATEWAY_REQUEST_URL_ATTR, requestUrl);
|
||||
}).then(chain.filter(exchange));
|
||||
}
|
||||
|
||||
private Mono<Response<ServiceInstance>> choose(ServerWebExchange exchange) {
|
||||
URI uri = exchange.getAttribute(ServerWebExchangeUtils.GATEWAY_REQUEST_URL_ATTR);
|
||||
ServiceInstance serviceInstance = grayLoadBalancer.choose(uri.getHost(),exchange.getRequest());
|
||||
return Mono.just(new DefaultResponse(serviceInstance));
|
||||
}
|
||||
}
|
||||
-51
@@ -1,51 +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 com.pig4cloud.pigx.common.gateway.predicate;
|
||||
|
||||
import com.alibaba.cloud.nacos.ribbon.NacosServer;
|
||||
import com.netflix.loadbalancer.AbstractServerPredicate;
|
||||
import com.netflix.loadbalancer.PredicateKey;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* 过滤服务
|
||||
*
|
||||
* @author L.cm
|
||||
*/
|
||||
public abstract class AbstractDiscoveryEnabledPredicate extends AbstractServerPredicate {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(@Nullable PredicateKey input) {
|
||||
return input != null
|
||||
&& input.getServer() instanceof NacosServer
|
||||
&& apply((NacosServer) input.getServer(), (HttpHeaders) input.getLoadBalancerKey());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the specific {@link NacosServer} matches this predicate.
|
||||
*
|
||||
* @param server the discovered server
|
||||
* @param headers 请求头
|
||||
* @return whether the server matches the predicate
|
||||
*/
|
||||
abstract boolean apply(NacosServer server, HttpHeaders headers);
|
||||
}
|
||||
-67
@@ -1,67 +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 com.pig4cloud.pigx.common.gateway.predicate;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.cloud.nacos.ribbon.NacosServer;
|
||||
import com.pig4cloud.pigx.common.core.constant.CommonConstants;
|
||||
import com.pig4cloud.pigx.common.core.util.SpringContextHolder;
|
||||
import com.pig4cloud.pigx.common.gateway.support.PigxRibbonRuleProperties;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 基于 Metadata version 的服务筛选
|
||||
*
|
||||
* @author L.cm
|
||||
* @author lengleng
|
||||
*/
|
||||
@Slf4j
|
||||
public class GrayMetadataAwarePredicate extends AbstractDiscoveryEnabledPredicate {
|
||||
|
||||
@Override
|
||||
protected boolean apply(NacosServer server, HttpHeaders headers) {
|
||||
PigxRibbonRuleProperties ribbonProperties = SpringContextHolder.getBean(PigxRibbonRuleProperties.class);
|
||||
|
||||
if (!ribbonProperties.isGrayEnabled()) {
|
||||
log.debug("gray closed,GrayMetadataAwarePredicate return true");
|
||||
return true;
|
||||
}
|
||||
|
||||
final Map<String, String> metadata = server.getMetadata();
|
||||
String version = metadata.get(CommonConstants.VERSION);
|
||||
// 判断Nacos服务是否有版本标签
|
||||
if (StrUtil.isBlank(version)) {
|
||||
log.debug("nacos server tag is blank ,GrayMetadataAwarePredicate return true");
|
||||
return true;
|
||||
}
|
||||
|
||||
// 判断请求中是否有版本
|
||||
String target = headers.getFirst(CommonConstants.VERSION);
|
||||
if (StrUtil.isBlank(target)) {
|
||||
log.debug("request headers version is blank,GrayMetadataAwarePredicate return true");
|
||||
return true;
|
||||
}
|
||||
|
||||
log.debug("请求版本:{} ,当前服务版本:{}", target, version);
|
||||
return target.equals(version);
|
||||
}
|
||||
|
||||
}
|
||||
-76
@@ -1,76 +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 com.pig4cloud.pigx.common.gateway.rule;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.netflix.loadbalancer.*;
|
||||
import com.pig4cloud.pigx.common.gateway.predicate.AbstractDiscoveryEnabledPredicate;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ribbon 路由规则
|
||||
*
|
||||
* @author L.cm
|
||||
*/
|
||||
public abstract class AbstractDiscoveryEnabledRule extends PredicateBasedRule {
|
||||
private final CompositePredicate predicate;
|
||||
|
||||
public AbstractDiscoveryEnabledRule(AbstractDiscoveryEnabledPredicate discoveryEnabledPredicate) {
|
||||
Assert.notNull(discoveryEnabledPredicate, "Parameter 'discoveryEnabledPredicate' can't be null");
|
||||
this.predicate = createCompositePredicate(discoveryEnabledPredicate, new AvailabilityPredicate(this, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public AbstractServerPredicate getPredicate() {
|
||||
return predicate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Server choose(Object key) {
|
||||
ILoadBalancer lb = getLoadBalancer();
|
||||
|
||||
List<Server> allServers = lb.getAllServers();
|
||||
// 过滤服务列表
|
||||
List<Server> serverList = filterServers(allServers);
|
||||
|
||||
Optional<Server> server = getPredicate().chooseRoundRobinAfterFiltering(serverList, key);
|
||||
if (server.isPresent()) {
|
||||
return server.get();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤服务
|
||||
*
|
||||
* @param serverList 服务列表
|
||||
* @return 服务列表
|
||||
*/
|
||||
public abstract List<Server> filterServers(List<Server> serverList);
|
||||
|
||||
private CompositePredicate createCompositePredicate(AbstractDiscoveryEnabledPredicate discoveryEnabledPredicate, AvailabilityPredicate availabilityPredicate) {
|
||||
return CompositePredicate.withPredicates(discoveryEnabledPredicate, availabilityPredicate)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
+15
-16
@@ -15,26 +15,25 @@
|
||||
* Author: lengleng (wangiegie@gmail.com)
|
||||
*/
|
||||
|
||||
package com.pig4cloud.pigx.daemon.elastic.job;
|
||||
package com.pig4cloud.pigx.common.gateway.rule;
|
||||
|
||||
import com.dangdang.ddframe.job.api.ShardingContext;
|
||||
import com.dangdang.ddframe.job.api.dataflow.DataflowJob;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.cloud.client.ServiceInstance;
|
||||
import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2018/2/8
|
||||
* @date 2020/1/12
|
||||
* <p>
|
||||
* 灰度路由
|
||||
*/
|
||||
public class PigxDataflowJob implements DataflowJob<Integer> {
|
||||
public interface GrayLoadBalancer {
|
||||
|
||||
@Override
|
||||
public List<Integer> fetchData(ShardingContext shardingContext) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processData(ShardingContext shardingContext, List<Integer> list) {
|
||||
|
||||
}
|
||||
/**
|
||||
* 根据serviceId 筛选可用服务
|
||||
*
|
||||
* @param serviceId 服务ID
|
||||
* @param request 当前请求
|
||||
* @return
|
||||
*/
|
||||
ServiceInstance choose(String serviceId, ServerHttpRequest request);
|
||||
}
|
||||
-91
@@ -1,91 +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 com.pig4cloud.pigx.common.gateway.rule;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.system.HostInfo;
|
||||
import cn.hutool.system.SystemUtil;
|
||||
import com.netflix.loadbalancer.Server;
|
||||
import com.pig4cloud.pigx.common.core.util.SpringContextHolder;
|
||||
import com.pig4cloud.pigx.common.gateway.predicate.AbstractDiscoveryEnabledPredicate;
|
||||
import com.pig4cloud.pigx.common.gateway.predicate.GrayMetadataAwarePredicate;
|
||||
import com.pig4cloud.pigx.common.gateway.support.PigxRibbonRuleProperties;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.PatternMatchUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ribbon 路由规则器
|
||||
*
|
||||
* @author dream.lu
|
||||
*/
|
||||
@Slf4j
|
||||
public class MetadataAwareRule extends AbstractDiscoveryEnabledRule {
|
||||
|
||||
public MetadataAwareRule() {
|
||||
this(new GrayMetadataAwarePredicate());
|
||||
}
|
||||
|
||||
public MetadataAwareRule(AbstractDiscoveryEnabledPredicate predicate) {
|
||||
super(predicate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Server> filterServers(List<Server> serverList) {
|
||||
PigxRibbonRuleProperties ribbonProperties = SpringContextHolder.getBean(PigxRibbonRuleProperties.class);
|
||||
List<String> priorIpPattern = ribbonProperties.getPriorIpPattern();
|
||||
|
||||
if (ribbonProperties.isGrayEnabled()) {
|
||||
return serverList;
|
||||
}
|
||||
|
||||
// 1. 查找是否有本机 ip
|
||||
HostInfo hostInfo = SystemUtil.getHostInfo();
|
||||
String hostIp = hostInfo.getAddress();
|
||||
|
||||
// 优先的 ip 规则
|
||||
boolean hasPriorIpPattern = !priorIpPattern.isEmpty();
|
||||
String[] priorIpPatterns = priorIpPattern.toArray(new String[0]);
|
||||
|
||||
List<Server> priorServerList = new ArrayList<>();
|
||||
for (Server server : serverList) {
|
||||
String host = server.getHost();
|
||||
// 2. 优先本地 ip 的服务
|
||||
if (!hasPriorIpPattern && ObjectUtil.equal(hostIp, host)) {
|
||||
log.debug("{} 不存在优先配置,本地路由条件", hostIp);
|
||||
return Collections.singletonList(server);
|
||||
}
|
||||
// 3. 优先的 ip 服务
|
||||
if (hasPriorIpPattern && PatternMatchUtils.simpleMatch(priorIpPatterns, host)) {
|
||||
log.debug("{} 存在优先配置,ribbon 强制路由", priorIpPatterns);
|
||||
priorServerList.add(server);
|
||||
}
|
||||
}
|
||||
|
||||
// 4. 如果优先的有数据直接返回
|
||||
if (!priorServerList.isEmpty()) {
|
||||
return priorServerList;
|
||||
}
|
||||
|
||||
return Collections.unmodifiableList(serverList);
|
||||
}
|
||||
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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.pigx.common.gateway.rule;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.pig4cloud.pigx.common.core.constant.CommonConstants;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cloud.client.ServiceInstance;
|
||||
import org.springframework.cloud.client.discovery.DiscoveryClient;
|
||||
import org.springframework.cloud.gateway.support.NotFoundException;
|
||||
import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020/1/12
|
||||
* <p>
|
||||
* 基于客户端版本号灰度路由
|
||||
*/
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class VersionGrayLoadBalancer implements GrayLoadBalancer {
|
||||
private DiscoveryClient discoveryClient;
|
||||
|
||||
|
||||
/**
|
||||
* 根据serviceId 筛选可用服务
|
||||
*
|
||||
* @param serviceId 服务ID
|
||||
* @param request 当前请求
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ServiceInstance choose(String serviceId, ServerHttpRequest request) {
|
||||
List<ServiceInstance> instances = discoveryClient.getInstances(serviceId);
|
||||
|
||||
//注册中心无实例 抛出异常
|
||||
if (CollUtil.isEmpty(instances)) {
|
||||
log.warn("No instance available for {}", serviceId);
|
||||
throw new NotFoundException("No instance available for " + serviceId);
|
||||
}
|
||||
|
||||
// 获取请求version,无则随机返回可用实例
|
||||
String reqVersion = request.getHeaders().getFirst(CommonConstants.VERSION);
|
||||
if (StrUtil.isBlank(reqVersion)) {
|
||||
return instances.get(RandomUtil.randomInt(instances.size()));
|
||||
}
|
||||
|
||||
// 遍历可以实例元数据,若匹配则返回此实例
|
||||
for (ServiceInstance instance : instances) {
|
||||
Map<String, String> metadata = instance.getMetadata();
|
||||
String targetVersion = MapUtil.getStr(metadata, CommonConstants.VERSION);
|
||||
if (reqVersion.equalsIgnoreCase(targetVersion)) {
|
||||
log.debug("gray requst match success :{} {}", reqVersion, instance);
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
return instances.get(RandomUtil.randomInt(instances.size()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~
|
||||
~ 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)
|
||||
~
|
||||
-->
|
||||
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>3.9.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-gray</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>pigx 灰度路由</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.github.openfeign</groupId>
|
||||
<artifactId>feign-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
+49
@@ -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.pigx.common.gray;
|
||||
|
||||
import com.pig4cloud.pigx.common.gray.feign.GrayFeignRequestInterceptor;
|
||||
import com.pig4cloud.pigx.common.gray.rule.GrayRibbonLoadBalancerRule;
|
||||
import feign.RequestInterceptor;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
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.Configuration;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020/1/12
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnProperty(value = "gray.rule.enabled", havingValue = "true")
|
||||
public class GrayRibbonLoadBalancerConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
public GrayRibbonLoadBalancerRule ribbonLoadBalancerRule() {
|
||||
return new GrayRibbonLoadBalancerRule();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RequestInterceptor grayFeignRequestInterceptor() {
|
||||
return new GrayFeignRequestInterceptor();
|
||||
}
|
||||
}
|
||||
+20
-10
@@ -15,26 +15,36 @@
|
||||
* Author: lengleng (wangiegie@gmail.com)
|
||||
*/
|
||||
|
||||
package com.pig4cloud.pigx.daemon.elastic.job;
|
||||
package com.pig4cloud.pigx.common.gray.feign;
|
||||
|
||||
import com.dangdang.ddframe.job.api.ShardingContext;
|
||||
import com.dangdang.ddframe.job.api.simple.SimpleJob;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.pig4cloud.pigx.common.core.constant.CommonConstants;
|
||||
import com.pig4cloud.pigx.common.core.util.WebUtils;
|
||||
import feign.RequestInterceptor;
|
||||
import feign.RequestTemplate;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2018/2/7
|
||||
* 测试Job
|
||||
* @date 2020/1/12
|
||||
* <p>
|
||||
* feign 请求VERSION 传递
|
||||
*/
|
||||
@Slf4j
|
||||
public class PigxSimpleJob2 implements SimpleJob {
|
||||
public class GrayFeignRequestInterceptor implements RequestInterceptor {
|
||||
/**
|
||||
* 业务执行逻辑
|
||||
* Called for every request. Add data using methods on the supplied {@link RequestTemplate}.
|
||||
*
|
||||
* @param shardingContext 分片信息
|
||||
* @param template
|
||||
*/
|
||||
@Override
|
||||
public void execute(ShardingContext shardingContext) {
|
||||
log.info("第二个执行了:{}", shardingContext);
|
||||
public void apply(RequestTemplate template) {
|
||||
String reqVersion = WebUtils.getRequest() != null
|
||||
? WebUtils.getRequest().getHeader(CommonConstants.VERSION) : null;
|
||||
|
||||
if (StrUtil.isNotBlank(reqVersion)) {
|
||||
log.debug("feign gray add header version :{}", reqVersion);
|
||||
template.header(CommonConstants.VERSION, reqVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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.pigx.common.gray.rule;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.cloud.nacos.ribbon.NacosServer;
|
||||
import com.netflix.client.config.IClientConfig;
|
||||
import com.netflix.loadbalancer.AbstractLoadBalancerRule;
|
||||
import com.netflix.loadbalancer.ILoadBalancer;
|
||||
import com.netflix.loadbalancer.Server;
|
||||
import com.pig4cloud.pigx.common.core.constant.CommonConstants;
|
||||
import com.pig4cloud.pigx.common.core.util.WebUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020/1/12
|
||||
*/
|
||||
@Slf4j
|
||||
public class GrayRibbonLoadBalancerRule extends AbstractLoadBalancerRule {
|
||||
@Override
|
||||
public void initWithNiwsConfig(IClientConfig iClientConfig) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Server choose(Object key) {
|
||||
return choose(getLoadBalancer(), key);
|
||||
}
|
||||
|
||||
|
||||
public Server choose(ILoadBalancer lb, Object key) {
|
||||
List<Server> reachableServers = lb.getReachableServers();
|
||||
|
||||
//注册中心无可用实例 抛出异常
|
||||
if (CollUtil.isEmpty(reachableServers)) {
|
||||
log.warn("No instance available for {}", key);
|
||||
return null;
|
||||
}
|
||||
|
||||
// 获取请求version,无则随机返回可用实例
|
||||
String reqVersion = WebUtils.getRequest() != null
|
||||
? WebUtils.getRequest().getHeader(CommonConstants.VERSION) : null;
|
||||
if (StrUtil.isBlank(reqVersion)) {
|
||||
return reachableServers.get(RandomUtil.randomInt(reachableServers.size()));
|
||||
}
|
||||
|
||||
// 遍历可以实例元数据,若匹配则返回此实例
|
||||
for (Server server : reachableServers) {
|
||||
NacosServer nacosServer = (NacosServer) server;
|
||||
Map<String, String> metadata = nacosServer.getMetadata();
|
||||
String targetVersion = MapUtil.getStr(metadata, CommonConstants.VERSION);
|
||||
if (reqVersion.equalsIgnoreCase(targetVersion)) {
|
||||
log.debug("gray requst match success :{} {}", reqVersion, nacosServer);
|
||||
return nacosServer;
|
||||
}
|
||||
}
|
||||
return reachableServers.get(RandomUtil.randomInt(reachableServers.size()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
com.pig4cloud.pigx.common.gray.GrayRibbonLoadBalancerConfiguration
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.9.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-job</artifactId>
|
||||
@@ -33,24 +33,6 @@
|
||||
<description>pigx 定时任务</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- import elastic-job lite core -->
|
||||
<dependency>
|
||||
<groupId>com.dangdang</groupId>
|
||||
<artifactId>elastic-job-lite-core</artifactId>
|
||||
<version>${elastic-job-lite.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP-java7</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- import other module if need -->
|
||||
<dependency>
|
||||
<groupId>com.dangdang</groupId>
|
||||
<artifactId>elastic-job-lite-spring</artifactId>
|
||||
<version>${elastic-job-lite.version}</version>
|
||||
</dependency>
|
||||
<!--xxl job-->
|
||||
<dependency>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
|
||||
-87
@@ -1,87 +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 com.pig4cloud.pigx.common.job;
|
||||
|
||||
import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperConfiguration;
|
||||
import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter;
|
||||
import com.pig4cloud.pigx.common.job.jobinit.DataflowJobInitialization;
|
||||
import com.pig4cloud.pigx.common.job.jobinit.ScriptJobInitialization;
|
||||
import com.pig4cloud.pigx.common.job.jobinit.SimpleJobInitialization;
|
||||
import com.pig4cloud.pigx.common.job.properties.ElasticJobProperties;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2018/7/24
|
||||
* 任务初配置入口类
|
||||
*/
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@EnableConfigurationProperties(ElasticJobProperties.class)
|
||||
public class ElasticJobAutoConfiguration {
|
||||
|
||||
/**
|
||||
* 默认注册中心
|
||||
*/
|
||||
public static final String DEFAULT_REGISTRY_CENTER_NAME = "elasticJobRegistryCenter";
|
||||
|
||||
@Autowired
|
||||
private ElasticJobProperties elasticJobProperties;
|
||||
|
||||
@Bean(name = DEFAULT_REGISTRY_CENTER_NAME, initMethod = "init")
|
||||
@ConditionalOnMissingBean
|
||||
public ZookeeperRegistryCenter elasticJobRegistryCenter() {
|
||||
ElasticJobProperties.ZkConfiguration regCenterProperties = elasticJobProperties.getZookeeper();
|
||||
ZookeeperConfiguration zookeeperConfiguration = new ZookeeperConfiguration(regCenterProperties.getServerLists(), regCenterProperties.getNamespace());
|
||||
zookeeperConfiguration.setBaseSleepTimeMilliseconds(regCenterProperties.getBaseSleepTimeMilliseconds());
|
||||
zookeeperConfiguration.setConnectionTimeoutMilliseconds(regCenterProperties.getConnectionTimeoutMilliseconds());
|
||||
zookeeperConfiguration.setMaxSleepTimeMilliseconds(regCenterProperties.getMaxSleepTimeMilliseconds());
|
||||
zookeeperConfiguration.setSessionTimeoutMilliseconds(regCenterProperties.getSessionTimeoutMilliseconds());
|
||||
zookeeperConfiguration.setMaxRetries(regCenterProperties.getMaxRetries());
|
||||
zookeeperConfiguration.setDigest(regCenterProperties.getDigest());
|
||||
return new ZookeeperRegistryCenter(zookeeperConfiguration);
|
||||
}
|
||||
|
||||
@Bean(initMethod = "init")
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnBean(ZookeeperRegistryCenter.class)
|
||||
public SimpleJobInitialization simpleJobInitialization() {
|
||||
return new SimpleJobInitialization(elasticJobProperties.getSimples());
|
||||
}
|
||||
|
||||
@Bean(initMethod = "init")
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnBean(ZookeeperRegistryCenter.class)
|
||||
public DataflowJobInitialization dataflowJobInitialization() {
|
||||
return new DataflowJobInitialization(elasticJobProperties.getDataflows());
|
||||
}
|
||||
|
||||
@Bean(initMethod = "init")
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnBean(ZookeeperRegistryCenter.class)
|
||||
public ScriptJobInitialization scriptJobInitialization() {
|
||||
return new ScriptJobInitialization(elasticJobProperties.getScripts());
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -35,11 +35,12 @@ import org.springframework.context.annotation.Configuration;
|
||||
@ComponentScan("com.pig4cloud.pigx.common.job.properties")
|
||||
public class XxlJobAutoConfiguration {
|
||||
|
||||
@Bean(initMethod = "start", destroyMethod = "destroy")
|
||||
@Bean
|
||||
public XxlJobSpringExecutor xxlJobSpringExecutor(XxlJobProperties xxlJobProperties) {
|
||||
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
|
||||
xxlJobSpringExecutor.setAdminAddresses(xxlJobProperties.getAdmin().getAddresses());
|
||||
xxlJobSpringExecutor.setAppName(xxlJobProperties.getExecutor().getAppName());
|
||||
xxlJobSpringExecutor.setAppname(xxlJobProperties.getExecutor().getAppname());
|
||||
xxlJobSpringExecutor.setAddress(xxlJobProperties.getExecutor().getAddress());
|
||||
xxlJobSpringExecutor.setIp(xxlJobProperties.getExecutor().getIp());
|
||||
xxlJobSpringExecutor.setPort(xxlJobProperties.getExecutor().getPort());
|
||||
xxlJobSpringExecutor.setAccessToken(xxlJobProperties.getExecutor().getAccessToken());
|
||||
|
||||
-286
@@ -1,286 +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 com.pig4cloud.pigx.common.job.jobinit;
|
||||
|
||||
import com.dangdang.ddframe.job.api.ElasticJob;
|
||||
import com.dangdang.ddframe.job.api.JobType;
|
||||
import com.dangdang.ddframe.job.api.dataflow.DataflowJob;
|
||||
import com.dangdang.ddframe.job.api.simple.SimpleJob;
|
||||
import com.dangdang.ddframe.job.config.JobCoreConfiguration;
|
||||
import com.dangdang.ddframe.job.config.JobTypeConfiguration;
|
||||
import com.dangdang.ddframe.job.event.rdb.JobEventRdbConfiguration;
|
||||
import com.dangdang.ddframe.job.executor.handler.JobProperties.JobPropertiesEnum;
|
||||
import com.dangdang.ddframe.job.lite.api.listener.AbstractDistributeOnceElasticJobListener;
|
||||
import com.dangdang.ddframe.job.lite.api.listener.ElasticJobListener;
|
||||
import com.dangdang.ddframe.job.lite.config.LiteJobConfiguration;
|
||||
import com.dangdang.ddframe.job.lite.spring.api.SpringJobScheduler;
|
||||
import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter;
|
||||
import com.pig4cloud.pigx.common.job.properties.ElasticJobProperties;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.pig4cloud.pigx.common.job.ElasticJobAutoConfiguration.DEFAULT_REGISTRY_CENTER_NAME;
|
||||
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2018/7/24
|
||||
* 任务初始化基类
|
||||
*/
|
||||
public abstract class AbstractJobInitialization implements ApplicationContextAware {
|
||||
|
||||
protected ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
@SneakyThrows
|
||||
public void setApplicationContext(ApplicationContext applicationContext) {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化任务
|
||||
*
|
||||
* @param jobName 任务名称
|
||||
* @param jobType 任务类型
|
||||
* @param configuration 配置
|
||||
*/
|
||||
protected void initJob(String jobName, JobType jobType, ElasticJobProperties.JobConfiguration configuration) {
|
||||
//向spring容器中注册作业任务
|
||||
ElasticJob elasticJob = registerElasticJob(jobName, configuration.getJobClass(), jobType);
|
||||
//获取注册中心
|
||||
ZookeeperRegistryCenter regCenter = getZookeeperRegistryCenter(configuration.getRegistryCenterRef());
|
||||
//构建核心配置
|
||||
JobCoreConfiguration jobCoreConfiguration = getJobCoreConfiguration(jobName, configuration);
|
||||
//获取作业类型配置
|
||||
JobTypeConfiguration jobTypeConfiguration = getJobTypeConfiguration(jobName, jobCoreConfiguration);
|
||||
//获取Lite作业配置
|
||||
LiteJobConfiguration liteJobConfiguration = getLiteJobConfiguration(jobTypeConfiguration, configuration);
|
||||
//获取作业事件追踪的数据源配置
|
||||
JobEventRdbConfiguration jobEventRdbConfiguration = getJobEventRdbConfiguration(configuration.getEventTraceRdbDataSource());
|
||||
//获取作业监听器
|
||||
ElasticJobListener[] elasticJobListeners = creatElasticJobListeners(configuration.getListener());
|
||||
elasticJobListeners = null == elasticJobListeners ? new ElasticJobListener[0] : elasticJobListeners;
|
||||
//注册作业
|
||||
if (null == jobEventRdbConfiguration) {
|
||||
new SpringJobScheduler(elasticJob, regCenter, liteJobConfiguration, elasticJobListeners).init();
|
||||
} else {
|
||||
new SpringJobScheduler(elasticJob, regCenter, liteJobConfiguration, jobEventRdbConfiguration, elasticJobListeners).init();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取作业类型配置
|
||||
*
|
||||
* @param jobName 任务名称
|
||||
* @param jobCoreConfiguration 任务核心配置
|
||||
* @return JobTypeConfiguration
|
||||
*/
|
||||
public abstract JobTypeConfiguration getJobTypeConfiguration(String jobName, JobCoreConfiguration jobCoreConfiguration);
|
||||
|
||||
/**
|
||||
* 获取作业任务实例
|
||||
*
|
||||
* @param jobName 任务名称
|
||||
* @param jobType 任务类型
|
||||
* @param strClass 任务类全路径
|
||||
* @return ElasticJob
|
||||
*/
|
||||
private ElasticJob registerElasticJob(String jobName, String strClass, JobType jobType) {
|
||||
switch (jobType) {
|
||||
case SIMPLE:
|
||||
return registerBean(jobName, strClass, SimpleJob.class);
|
||||
case DATAFLOW:
|
||||
return registerBean(jobName, strClass, DataflowJob.class);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取注册中心
|
||||
*
|
||||
* @param registryCenterRef 注册中心引用
|
||||
* @return ZookeeperRegistryCenter
|
||||
*/
|
||||
private ZookeeperRegistryCenter getZookeeperRegistryCenter(String registryCenterRef) {
|
||||
if (StringUtils.isBlank(registryCenterRef)) {
|
||||
registryCenterRef = DEFAULT_REGISTRY_CENTER_NAME;
|
||||
}
|
||||
if (!applicationContext.containsBean(registryCenterRef)) {
|
||||
throw new RuntimeException("not exist ZookeeperRegistryCenter [" + registryCenterRef + "] !");
|
||||
}
|
||||
return applicationContext.getBean(registryCenterRef, ZookeeperRegistryCenter.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取作业事件追踪的数据源配置
|
||||
*
|
||||
* @param eventTraceRdbDataSource 作业事件追踪的数据源Bean引用
|
||||
* @return JobEventRdbConfiguration
|
||||
*/
|
||||
private JobEventRdbConfiguration getJobEventRdbConfiguration(String eventTraceRdbDataSource) {
|
||||
if (StringUtils.isBlank(eventTraceRdbDataSource)) {
|
||||
return null;
|
||||
}
|
||||
if (!applicationContext.containsBean(eventTraceRdbDataSource)) {
|
||||
throw new RuntimeException("not exist datasource [" + eventTraceRdbDataSource + "] !");
|
||||
}
|
||||
DataSource dataSource = (DataSource) applicationContext.getBean(eventTraceRdbDataSource);
|
||||
return new JobEventRdbConfiguration(dataSource);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构建Lite作业
|
||||
*
|
||||
* @param jobTypeConfiguration 任务类型
|
||||
* @param jobConfiguration 任务配置
|
||||
* @return LiteJobConfiguration
|
||||
*/
|
||||
private LiteJobConfiguration getLiteJobConfiguration(JobTypeConfiguration jobTypeConfiguration, ElasticJobProperties.JobConfiguration jobConfiguration) {
|
||||
//构建Lite作业
|
||||
return LiteJobConfiguration.newBuilder(Objects.requireNonNull(jobTypeConfiguration))
|
||||
.monitorExecution(jobConfiguration.isMonitorExecution())
|
||||
.monitorPort(jobConfiguration.getMonitorPort())
|
||||
.maxTimeDiffSeconds(jobConfiguration.getMaxTimeDiffSeconds())
|
||||
.jobShardingStrategyClass(jobConfiguration.getJobShardingStrategyClass())
|
||||
.reconcileIntervalMinutes(jobConfiguration.getReconcileIntervalMinutes())
|
||||
.disabled(jobConfiguration.isDisabled())
|
||||
.overwrite(jobConfiguration.isOverwrite()).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建任务核心配置
|
||||
*
|
||||
* @param jobName 任务执行名称
|
||||
* @param jobConfiguration 任务配置
|
||||
* @return JobCoreConfiguration
|
||||
*/
|
||||
protected JobCoreConfiguration getJobCoreConfiguration(String jobName, ElasticJobProperties.JobConfiguration jobConfiguration) {
|
||||
JobCoreConfiguration.Builder builder = JobCoreConfiguration.newBuilder(jobName, jobConfiguration.getCron(), jobConfiguration.getShardingTotalCount())
|
||||
.shardingItemParameters(jobConfiguration.getShardingItemParameters())
|
||||
.jobParameter(jobConfiguration.getJobParameter())
|
||||
.failover(jobConfiguration.isFailover())
|
||||
.misfire(jobConfiguration.isMisfire())
|
||||
.description(jobConfiguration.getDescription());
|
||||
if (StringUtils.isNotBlank(jobConfiguration.getJobExceptionHandler())) {
|
||||
builder.jobProperties(JobPropertiesEnum.JOB_EXCEPTION_HANDLER.getKey(), jobConfiguration.getJobExceptionHandler());
|
||||
}
|
||||
if (StringUtils.isNotBlank(jobConfiguration.getExecutorServiceHandler())) {
|
||||
builder.jobProperties(JobPropertiesEnum.EXECUTOR_SERVICE_HANDLER.getKey(), jobConfiguration.getExecutorServiceHandler());
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取监听器
|
||||
*
|
||||
* @param listener 监听器配置
|
||||
* @return ElasticJobListener[]
|
||||
*/
|
||||
private ElasticJobListener[] creatElasticJobListeners(ElasticJobProperties.JobConfiguration.Listener listener) {
|
||||
|
||||
if (null == listener) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<ElasticJobListener> elasticJobListeners = new ArrayList<>(2);
|
||||
|
||||
//注册每台作业节点均执行的监听
|
||||
ElasticJobListener elasticJobListener = registerBean(listener.getListenerClass(), listener.getListenerClass(), ElasticJobListener.class);
|
||||
if (null != elasticJobListener) {
|
||||
elasticJobListeners.add(elasticJobListener);
|
||||
}
|
||||
|
||||
//注册分布式监听者
|
||||
AbstractDistributeOnceElasticJobListener distributedListener = registerBean(listener.getDistributedListenerClass(), listener.getDistributedListenerClass(),
|
||||
AbstractDistributeOnceElasticJobListener.class, listener.getStartedTimeoutMilliseconds(), listener.getCompletedTimeoutMilliseconds());
|
||||
if (null != distributedListener) {
|
||||
elasticJobListeners.add(distributedListener);
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(elasticJobListeners)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
//集合转数组
|
||||
ElasticJobListener[] elasticJobListenerArray = new ElasticJobListener[elasticJobListeners.size()];
|
||||
for (int i = 0; i < elasticJobListeners.size(); i++) {
|
||||
elasticJobListenerArray[i] = elasticJobListeners.get(i);
|
||||
}
|
||||
return elasticJobListenerArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* 向spring容器中注册bean
|
||||
*
|
||||
* @param beanName bean名字
|
||||
* @param strClass 类全路径
|
||||
* @param tClass 类类型
|
||||
* @param constructorArgValue 构造函数参数
|
||||
* @param <T> 泛型
|
||||
* @return T
|
||||
*/
|
||||
protected <T> T registerBean(String beanName, String strClass, Class<T> tClass, Object... constructorArgValue) {
|
||||
|
||||
//判断是否配置了监听者
|
||||
if (StringUtils.isBlank(strClass)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(beanName)) {
|
||||
beanName = strClass;
|
||||
}
|
||||
|
||||
//判断监听者是否已经在spring容器中存在
|
||||
if (applicationContext.containsBean(beanName)) {
|
||||
return applicationContext.getBean(beanName, tClass);
|
||||
}
|
||||
|
||||
//不存在则创建并注册到Spring容器中
|
||||
BeanDefinitionBuilder beanDefinitionBuilder = BeanDefinitionBuilder.rootBeanDefinition(strClass);
|
||||
beanDefinitionBuilder.setScope(BeanDefinition.SCOPE_PROTOTYPE);
|
||||
//设置参数
|
||||
for (Object argValue : constructorArgValue) {
|
||||
beanDefinitionBuilder.addConstructorArgValue(argValue);
|
||||
}
|
||||
getDefaultListableBeanFactory().registerBeanDefinition(beanName, beanDefinitionBuilder.getBeanDefinition());
|
||||
return applicationContext.getBean(beanName, tClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取beanFactory
|
||||
*
|
||||
* @return DefaultListableBeanFactory
|
||||
*/
|
||||
private DefaultListableBeanFactory getDefaultListableBeanFactory() {
|
||||
return (DefaultListableBeanFactory) ((ConfigurableApplicationContext) applicationContext).getBeanFactory();
|
||||
}
|
||||
}
|
||||
-53
@@ -1,53 +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 com.pig4cloud.pigx.common.job.jobinit;
|
||||
|
||||
import com.dangdang.ddframe.job.config.JobCoreConfiguration;
|
||||
import com.dangdang.ddframe.job.config.JobTypeConfiguration;
|
||||
import com.dangdang.ddframe.job.config.dataflow.DataflowJobConfiguration;
|
||||
import com.pig4cloud.pigx.common.job.properties.ElasticJobProperties;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2018/7/24
|
||||
* 流式任务初始
|
||||
*/
|
||||
public class DataflowJobInitialization extends AbstractJobInitialization {
|
||||
|
||||
private Map<String, ElasticJobProperties.DataflowConfiguration> dataflowConfigurationMap;
|
||||
|
||||
public DataflowJobInitialization(final Map<String, ElasticJobProperties.DataflowConfiguration> dataflowConfigurationMap) {
|
||||
this.dataflowConfigurationMap = dataflowConfigurationMap;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
for (String jobName : dataflowConfigurationMap.keySet()) {
|
||||
ElasticJobProperties.DataflowConfiguration configuration = dataflowConfigurationMap.get(jobName);
|
||||
initJob(jobName, configuration.getJobType(), configuration);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JobTypeConfiguration getJobTypeConfiguration(String jobName, JobCoreConfiguration jobCoreConfiguration) {
|
||||
ElasticJobProperties.DataflowConfiguration configuration = dataflowConfigurationMap.get(jobName);
|
||||
return new DataflowJobConfiguration(jobCoreConfiguration, configuration.getJobClass(), configuration.isStreamingProcess());
|
||||
}
|
||||
}
|
||||
-53
@@ -1,53 +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 com.pig4cloud.pigx.common.job.jobinit;
|
||||
|
||||
import com.dangdang.ddframe.job.config.JobCoreConfiguration;
|
||||
import com.dangdang.ddframe.job.config.JobTypeConfiguration;
|
||||
import com.dangdang.ddframe.job.config.script.ScriptJobConfiguration;
|
||||
import com.pig4cloud.pigx.common.job.properties.ElasticJobProperties;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2018/7/24
|
||||
* 脚本任务初始
|
||||
*/
|
||||
public class ScriptJobInitialization extends AbstractJobInitialization {
|
||||
|
||||
private Map<String, ElasticJobProperties.ScriptConfiguration> scriptConfigurationMap;
|
||||
|
||||
public ScriptJobInitialization(final Map<String, ElasticJobProperties.ScriptConfiguration> scriptConfigurationMap) {
|
||||
this.scriptConfigurationMap = scriptConfigurationMap;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
for (String jobName : scriptConfigurationMap.keySet()) {
|
||||
ElasticJobProperties.ScriptConfiguration configuration = scriptConfigurationMap.get(jobName);
|
||||
initJob(jobName, configuration.getJobType(), configuration);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JobTypeConfiguration getJobTypeConfiguration(String jobName, JobCoreConfiguration jobCoreConfiguration) {
|
||||
ElasticJobProperties.ScriptConfiguration configuration = scriptConfigurationMap.get(jobName);
|
||||
return new ScriptJobConfiguration(jobCoreConfiguration, configuration.getScriptCommandLine());
|
||||
}
|
||||
}
|
||||
-53
@@ -1,53 +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 com.pig4cloud.pigx.common.job.jobinit;
|
||||
|
||||
import com.dangdang.ddframe.job.config.JobCoreConfiguration;
|
||||
import com.dangdang.ddframe.job.config.JobTypeConfiguration;
|
||||
import com.dangdang.ddframe.job.config.simple.SimpleJobConfiguration;
|
||||
import com.pig4cloud.pigx.common.job.properties.ElasticJobProperties;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2018/7/24
|
||||
* 简单任务初始
|
||||
*/
|
||||
public class SimpleJobInitialization extends AbstractJobInitialization {
|
||||
|
||||
private Map<String, ElasticJobProperties.SimpleConfiguration> simpleConfigurationMap;
|
||||
|
||||
public SimpleJobInitialization(final Map<String, ElasticJobProperties.SimpleConfiguration> simpleConfigurationMap) {
|
||||
this.simpleConfigurationMap = simpleConfigurationMap;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
for (String jobName : simpleConfigurationMap.keySet()) {
|
||||
ElasticJobProperties.SimpleConfiguration configuration = simpleConfigurationMap.get(jobName);
|
||||
initJob(jobName, configuration.getJobType(), configuration);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JobTypeConfiguration getJobTypeConfiguration(String jobName, JobCoreConfiguration jobCoreConfiguration) {
|
||||
ElasticJobProperties.SimpleConfiguration configuration = simpleConfigurationMap.get(jobName);
|
||||
return new SimpleJobConfiguration(jobCoreConfiguration, configuration.getJobClass());
|
||||
}
|
||||
}
|
||||
-293
@@ -1,293 +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 com.pig4cloud.pigx.common.job.properties;
|
||||
|
||||
import com.dangdang.ddframe.job.api.JobType;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.pig4cloud.pigx.common.job.ElasticJobAutoConfiguration.DEFAULT_REGISTRY_CENTER_NAME;
|
||||
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2018/7/24
|
||||
* 任务配置类
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ConfigurationProperties(prefix = "spring.elasticjob")
|
||||
public class ElasticJobProperties {
|
||||
|
||||
/**
|
||||
* 注册中心
|
||||
*/
|
||||
private ZkConfiguration zookeeper;
|
||||
|
||||
/**
|
||||
* 简单作业配置
|
||||
*/
|
||||
private Map<String, SimpleConfiguration> simples = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* 流式作业配置
|
||||
*/
|
||||
private Map<String, DataflowConfiguration> dataflows = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* 脚本作业配置
|
||||
*/
|
||||
private Map<String, ScriptConfiguration> scripts = new LinkedHashMap<>();
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class ZkConfiguration {
|
||||
|
||||
/**
|
||||
* 连接Zookeeper服务器的列表
|
||||
* 包括IP地址和端口号
|
||||
* 多个地址用逗号分隔
|
||||
* 如: host1:2181,host2:2181
|
||||
*/
|
||||
private String serverLists;
|
||||
|
||||
/**
|
||||
* Zookeeper的命名空间
|
||||
*/
|
||||
private String namespace;
|
||||
|
||||
/**
|
||||
* 等待重试的间隔时间的初始值
|
||||
* 单位:毫秒
|
||||
*/
|
||||
private int baseSleepTimeMilliseconds = 1000;
|
||||
|
||||
/**
|
||||
* 等待重试的间隔时间的最大值
|
||||
* 单位:毫秒
|
||||
*/
|
||||
private int maxSleepTimeMilliseconds = 3000;
|
||||
|
||||
/**
|
||||
* 最大重试次数
|
||||
*/
|
||||
private int maxRetries = 3;
|
||||
|
||||
/**
|
||||
* 连接超时时间
|
||||
* 单位:毫秒
|
||||
*/
|
||||
private int connectionTimeoutMilliseconds = 15000;
|
||||
|
||||
/**
|
||||
* 会话超时时间
|
||||
* 单位:毫秒
|
||||
*/
|
||||
private int sessionTimeoutMilliseconds = 60000;
|
||||
|
||||
/**
|
||||
* 连接Zookeeper的权限令牌
|
||||
* 缺省为不需要权限验
|
||||
*/
|
||||
private String digest;
|
||||
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class SimpleConfiguration extends JobConfiguration {
|
||||
/**
|
||||
* 作业类型
|
||||
*/
|
||||
private final JobType jobType = JobType.SIMPLE;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class DataflowConfiguration extends JobConfiguration {
|
||||
/**
|
||||
* 作业类型
|
||||
*/
|
||||
private final JobType jobType = JobType.DATAFLOW;
|
||||
/**
|
||||
* 是否流式处理数据
|
||||
* 如果流式处理数据, 则fetchData不返回空结果将持续执行作业
|
||||
* 如果非流式处理数据, 则处理数据完成后作业结束
|
||||
*/
|
||||
private boolean streamingProcess = false;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class ScriptConfiguration extends JobConfiguration {
|
||||
/**
|
||||
* 作业类型
|
||||
*/
|
||||
private final JobType jobType = JobType.SCRIPT;
|
||||
/**
|
||||
* 脚本型作业执行命令行
|
||||
*/
|
||||
private String scriptCommandLine;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class JobConfiguration {
|
||||
|
||||
/**
|
||||
* 作业实现类,需实现ElasticJob接口
|
||||
*/
|
||||
private String jobClass;
|
||||
/**
|
||||
* 注册中心Bean的引用,需引用reg:zookeeper的声明
|
||||
*/
|
||||
private String registryCenterRef = DEFAULT_REGISTRY_CENTER_NAME;
|
||||
/**
|
||||
* cron表达式,用于控制作业触发时间
|
||||
*/
|
||||
private String cron;
|
||||
/**
|
||||
* 作业分片总数
|
||||
*/
|
||||
private int shardingTotalCount = 1;
|
||||
/**
|
||||
* 分片序列号和参数用等号分隔,多个键值对用逗号分隔
|
||||
* 分片序列号从0开始,不可大于或等于作业分片总数
|
||||
* 如:0=a,1=b,2=c
|
||||
*/
|
||||
private String shardingItemParameters = "0=A";
|
||||
/**
|
||||
* 作业实例主键,同IP可运行实例主键不同, 但名称相同的多个作业实例
|
||||
*/
|
||||
private String jobInstanceId;
|
||||
/**
|
||||
* 作业自定义参数
|
||||
* 作业自定义参数,可通过传递该参数为作业调度的业务方法传参,用于实现带参数的作业
|
||||
* 例:每次获取的数据量、作业实例从数据库读取的主键等
|
||||
*/
|
||||
private String jobParameter;
|
||||
/**
|
||||
* 监控作业运行时状态
|
||||
* 每次作业执行时间和间隔时间均非常短的情况,建议不监控作业运行时状态以提升效率。
|
||||
* 因为是瞬时状态,所以无必要监控。请用户自行增加数据堆积监控。并且不能保证数据重复选取,应在作业中实现幂等性。
|
||||
* 每次作业执行时间和间隔时间均较长的情况,建议监控作业运行时状态,可保证数据不会重复选取。
|
||||
*/
|
||||
private boolean monitorExecution = true;
|
||||
/**
|
||||
* 作业监控端口
|
||||
* 建议配置作业监控端口, 方便开发者dump作业信息。
|
||||
* 使用方法: echo “dump” | nc 127.0.0.1 9888
|
||||
*/
|
||||
private int monitorPort = -1;
|
||||
/**
|
||||
* 最大允许的本机与注册中心的时间误差秒数
|
||||
* 如果时间误差超过配置秒数则作业启动时将抛异常
|
||||
* 配置为-1表示不校验时间误差
|
||||
*/
|
||||
private int maxTimeDiffSeconds = -1;
|
||||
/**
|
||||
* 是否开启失效转移
|
||||
*/
|
||||
private boolean failover = false;
|
||||
/**
|
||||
* 是否开启错过任务重新执行
|
||||
*/
|
||||
private boolean misfire = true;
|
||||
/**
|
||||
* 作业分片策略实现类全路径
|
||||
* 默认使用平均分配策略
|
||||
* 详情参见:作业分片策略http://elasticjob.io/docs/elastic-job-lite/02-guide/job-sharding-strategy
|
||||
*/
|
||||
private String jobShardingStrategyClass;
|
||||
/**
|
||||
* 作业描述信息
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 作业是否禁止启动
|
||||
* 可用于部署作业时,先禁止启动,部署结束后统一启动
|
||||
*/
|
||||
private boolean disabled = false;
|
||||
/**
|
||||
* 本地配置是否可覆盖注册中心配置
|
||||
* 如果可覆盖,每次启动作业都以本地配置为准
|
||||
*/
|
||||
private boolean overwrite = true;
|
||||
/**
|
||||
* 扩展异常处理类
|
||||
*/
|
||||
private String jobExceptionHandler;
|
||||
/**
|
||||
* 扩展作业处理线程池类
|
||||
*/
|
||||
private String executorServiceHandler;
|
||||
/**
|
||||
* 修复作业服务器不一致状态服务调度间隔时间,配置为小于1的任意值表示不执行修复
|
||||
* 单位:分钟
|
||||
*/
|
||||
private int reconcileIntervalMinutes = 10;
|
||||
/**
|
||||
* 作业事件追踪的数据源Bean引用
|
||||
*/
|
||||
private String eventTraceRdbDataSource;
|
||||
|
||||
/**
|
||||
* 监听器
|
||||
*/
|
||||
private Listener listener;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class Listener {
|
||||
/**
|
||||
* 每台作业节点均执行的监听
|
||||
* 若作业处理作业服务器的文件,处理完成后删除文件,可考虑使用每个节点均执行清理任务。
|
||||
* 此类型任务实现简单,且无需考虑全局分布式任务是否完成,请尽量使用此类型监听器。
|
||||
*
|
||||
* <p>注意:类必须继承com.dangdang.ddframe.job.lite.api.listener.ElasticJobListener</p>
|
||||
*/
|
||||
String listenerClass;
|
||||
|
||||
/**
|
||||
* 分布式场景中仅单一节点执行的监听
|
||||
* 若作业处理数据库数据,处理完成后只需一个节点完成数据清理任务即可。
|
||||
* 此类型任务处理复杂,需同步分布式环境下作业的状态同步,提供了超时设置来避免作业不同步导致的死锁,请谨慎使用。
|
||||
*
|
||||
* <p>注意:类必须继承com.dangdang.ddframe.job.lite.api.listener.AbstractDistributeOnceElasticJobListener</p>
|
||||
*/
|
||||
String distributedListenerClass;
|
||||
|
||||
/**
|
||||
* 最后一个作业执行前的执行方法的超时时间
|
||||
* 单位:毫秒
|
||||
*/
|
||||
Long startedTimeoutMilliseconds = Long.MAX_VALUE;
|
||||
|
||||
/**
|
||||
* 最后一个作业执行后的执行方法的超时时间
|
||||
* 单位:毫秒
|
||||
*/
|
||||
Long completedTimeoutMilliseconds = Long.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+8
-1
@@ -28,7 +28,14 @@ public class XxlExecutorProperties {
|
||||
/**
|
||||
* 执行器AppName [选填]:执行器心跳注册分组依据;为空则关闭自动注册
|
||||
*/
|
||||
private String appName = "xxl-job-executor";
|
||||
private String appname = "xxl-job-executor";
|
||||
|
||||
/**
|
||||
* 服务注册地址,优先使用该配置作为注册地址
|
||||
* 为空时使用内嵌服务 ”IP:PORT“ 作为注册地址
|
||||
* 从而更灵活的支持容器类型执行器动态IP和动态映射端口问题
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 执行器IP [选填]:默认为空表示自动获取IP,多网卡时可手动设置指定IP
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.9.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-log</artifactId>
|
||||
|
||||
+13
@@ -56,6 +56,19 @@ public class SysLogUtils {
|
||||
return sysLog;
|
||||
}
|
||||
|
||||
public SysLog getSysLog(HttpServletRequest request, String username) {
|
||||
SysLog sysLog = new SysLog();
|
||||
sysLog.setCreateBy(username);
|
||||
sysLog.setType(CommonConstants.STATUS_NORMAL);
|
||||
sysLog.setRemoteAddr(ServletUtil.getClientIP(request));
|
||||
sysLog.setRequestUri(URLUtil.getPath(request.getRequestURI()));
|
||||
sysLog.setMethod(request.getMethod());
|
||||
sysLog.setUserAgent(request.getHeader("user-agent"));
|
||||
sysLog.setParams(HttpUtil.toParams(request.getParameterMap()));
|
||||
sysLog.setServiceId(getClientId());
|
||||
return sysLog;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取客户端
|
||||
*
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.9.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-minio</artifactId>
|
||||
|
||||
-2
@@ -19,7 +19,6 @@ package com.pig4cloud.pigx.common.minio;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* minio 配置信息
|
||||
@@ -27,7 +26,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
* @author lengleng
|
||||
*/
|
||||
@Data
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "minio")
|
||||
public class MinioProperties {
|
||||
/**
|
||||
|
||||
+2
-2
@@ -97,8 +97,8 @@ public class MinioTemplate implements InitializingBean {
|
||||
Iterable<Result<Item>> objectsIterator = client
|
||||
.listObjects(bucketName, prefix, recursive);
|
||||
|
||||
while (objectsIterator.iterator().hasNext()) {
|
||||
objectList.add(new MinioItem(objectsIterator.iterator().next().get()));
|
||||
for (Result<Item> itemResult : objectsIterator) {
|
||||
objectList.add(new MinioItem(itemResult.get()));
|
||||
}
|
||||
return objectList;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.9.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-security</artifactId>
|
||||
@@ -43,10 +43,15 @@
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-oauth2</artifactId>
|
||||
</dependency>
|
||||
<!--UPMS API-->
|
||||
<!--feign-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-upms-api</artifactId>
|
||||
<groupId>io.github.openfeign</groupId>
|
||||
<artifactId>feign-core</artifactId>
|
||||
</dependency>
|
||||
<!--aop-->
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjrt</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
+16
-2
@@ -75,11 +75,25 @@ public class GlobalExceptionHandlerResolver {
|
||||
* @param exception
|
||||
* @return R
|
||||
*/
|
||||
@ExceptionHandler({MethodArgumentNotValidException.class, BindException.class})
|
||||
@ExceptionHandler({MethodArgumentNotValidException.class})
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
public R handleBodyValidException(MethodArgumentNotValidException exception) {
|
||||
List<FieldError> fieldErrors = exception.getBindingResult().getFieldErrors();
|
||||
log.error("参数绑定异常,ex = {}", fieldErrors.get(0).getDefaultMessage());
|
||||
log.warn("参数绑定异常,ex = {}", fieldErrors.get(0).getDefaultMessage());
|
||||
return R.failed(fieldErrors.get(0).getDefaultMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* validation Exception (以form-data形式传参)
|
||||
*
|
||||
* @param exception
|
||||
* @return R
|
||||
*/
|
||||
@ExceptionHandler({BindException.class})
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
public R bindExceptionHandler(BindException exception) {
|
||||
List<FieldError> fieldErrors = exception.getBindingResult().getFieldErrors();
|
||||
log.warn("参数绑定异常,ex = {}", fieldErrors.get(0).getDefaultMessage());
|
||||
return R.failed(fieldErrors.get(0).getDefaultMessage());
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -18,7 +18,6 @@
|
||||
package com.pig4cloud.pigx.common.security.component;
|
||||
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.pig4cloud.pigx.common.security.annotation.Inner;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -71,13 +70,13 @@ public class PermitAllUrlProperties implements InitializingBean {
|
||||
Inner method = AnnotationUtils.findAnnotation(handlerMethod.getMethod(), Inner.class);
|
||||
Optional.ofNullable(method)
|
||||
.ifPresent(inner -> info.getPatternsCondition().getPatterns()
|
||||
.forEach(url -> ignoreUrls.add(ReUtil.replaceAll(url, PATTERN, StringPool.ASTERISK))));
|
||||
.forEach(url -> ignoreUrls.add(ReUtil.replaceAll(url, PATTERN, "*"))));
|
||||
|
||||
// 获取类上边的注解, 替代path variable 为 *
|
||||
Inner controller = AnnotationUtils.findAnnotation(handlerMethod.getBeanType(), Inner.class);
|
||||
Optional.ofNullable(controller)
|
||||
.ifPresent(inner -> info.getPatternsCondition().getPatterns()
|
||||
.forEach(url -> ignoreUrls.add(ReUtil.replaceAll(url, PATTERN, StringPool.ASTERISK))));
|
||||
.forEach(url -> ignoreUrls.add(ReUtil.replaceAll(url, PATTERN, "*"))));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
+7
@@ -21,12 +21,15 @@ import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.client.ClientHttpResponse;
|
||||
import org.springframework.web.client.DefaultResponseErrorHandler;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
@@ -39,6 +42,10 @@ public class PigxResourceServerAutoConfiguration {
|
||||
@LoadBalanced
|
||||
public RestTemplate lbRestTemplate() {
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
restTemplate.setInterceptors(Collections.singletonList((request, body, execution) -> {
|
||||
request.getHeaders().set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE);
|
||||
return execution.execute(request, body);
|
||||
}));
|
||||
restTemplate.setErrorHandler(new DefaultResponseErrorHandler() {
|
||||
@Override
|
||||
public void handleError(ClientHttpResponse response) throws IOException {
|
||||
|
||||
-2
@@ -27,7 +27,6 @@ import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -39,7 +38,6 @@ import javax.servlet.http.HttpServletRequest;
|
||||
*/
|
||||
@Slf4j
|
||||
@Aspect
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class PigxSecurityInnerAspect {
|
||||
private final HttpServletRequest request;
|
||||
|
||||
+1
-4
@@ -51,10 +51,7 @@ public class PigxTokenEnhancer implements TokenEnhancer {
|
||||
|
||||
final Map<String, Object> additionalInfo = new HashMap<>(8);
|
||||
PigxUser pigxUser = (PigxUser) authentication.getUserAuthentication().getPrincipal();
|
||||
additionalInfo.put(SecurityConstants.DETAILS_USER_ID, pigxUser.getId());
|
||||
additionalInfo.put(SecurityConstants.DETAILS_USERNAME, pigxUser.getUsername());
|
||||
additionalInfo.put(SecurityConstants.DETAILS_DEPT_ID, pigxUser.getDeptId());
|
||||
additionalInfo.put(SecurityConstants.DETAILS_TENANT_ID, pigxUser.getTenantId());
|
||||
additionalInfo.put(SecurityConstants.DETAILS_USER, pigxUser);
|
||||
additionalInfo.put(SecurityConstants.DETAILS_LICENSE, SecurityConstants.PIGX_LICENSE);
|
||||
additionalInfo.put(SecurityConstants.ACTIVE, Boolean.TRUE);
|
||||
((DefaultOAuth2AccessToken) accessToken).setAdditionalInformation(additionalInfo);
|
||||
|
||||
+23
-16
@@ -17,6 +17,7 @@
|
||||
|
||||
package com.pig4cloud.pigx.common.security.component;
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.pig4cloud.pigx.common.core.constant.CommonConstants;
|
||||
import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
|
||||
@@ -34,7 +35,10 @@ import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
@@ -65,19 +69,22 @@ public class PigxUserAuthenticationConverter implements UserAuthenticationConver
|
||||
/**
|
||||
* Inverse of {@link #convertUserAuthentication(Authentication)}. Extracts an Authentication from a map.
|
||||
*
|
||||
* @param map a map of user information
|
||||
* @param responseMap a map of user information
|
||||
* @return an Authentication representing the user or null if there is none
|
||||
*/
|
||||
@Override
|
||||
public Authentication extractAuthentication(Map<String, ?> map) {
|
||||
if (map.containsKey(USERNAME)) {
|
||||
public Authentication extractAuthentication(Map<String, ?> responseMap) {
|
||||
if (responseMap.containsKey(USERNAME)) {
|
||||
Collection<? extends GrantedAuthority> authorities = getAuthorities(responseMap);
|
||||
Map<String, ?> map = MapUtil.get(responseMap, SecurityConstants.DETAILS_USER, Map.class);
|
||||
validateTenantId(map);
|
||||
Collection<? extends GrantedAuthority> authorities = getAuthorities(map);
|
||||
String username = (String) map.get(USERNAME);
|
||||
Integer id = (Integer) map.get(SecurityConstants.DETAILS_USER_ID);
|
||||
Integer deptId = (Integer) map.get(SecurityConstants.DETAILS_DEPT_ID);
|
||||
Integer tenantId = (Integer) map.get(SecurityConstants.DETAILS_TENANT_ID);
|
||||
PigxUser user = new PigxUser(id, deptId, tenantId, username, N_A, true
|
||||
String username = MapUtil.getStr(map, SecurityConstants.DETAILS_USERNAME);
|
||||
Integer id = MapUtil.getInt(map, SecurityConstants.DETAILS_USER_ID);
|
||||
Integer deptId = MapUtil.getInt(map, SecurityConstants.DETAILS_DEPT_ID);
|
||||
Integer tenantId = MapUtil.getInt(map, SecurityConstants.DETAILS_TENANT_ID);
|
||||
String phone = MapUtil.getStr(map, SecurityConstants.DETAILS_PHONE);
|
||||
String avatar = MapUtil.getStr(map, SecurityConstants.DETAILS_AVATAR);
|
||||
PigxUser user = new PigxUser(id, deptId, phone, avatar, tenantId, username, N_A, true
|
||||
, true, true, true, authorities);
|
||||
return new UsernamePasswordAuthenticationToken(user, N_A, authorities);
|
||||
}
|
||||
@@ -96,13 +103,13 @@ public class PigxUserAuthenticationConverter implements UserAuthenticationConver
|
||||
throw new IllegalArgumentException("Authorities must be either a String or a Collection");
|
||||
}
|
||||
|
||||
private void validateTenantId(Map<String, ?> map){
|
||||
String headerValue = getCurrentTenantId();
|
||||
Integer userValue = (Integer) map.get(SecurityConstants.DETAILS_TENANT_ID);
|
||||
if(StrUtil.isNotBlank(headerValue) && !userValue.toString().equals(headerValue)){
|
||||
log.warn("请求头中的租户ID({})和用户的租户ID({})不一致",headerValue,userValue);
|
||||
private void validateTenantId(Map<String, ?> map) {
|
||||
String headerValue = getCurrentTenantId();
|
||||
Integer userValue = MapUtil.getInt(map, SecurityConstants.DETAILS_TENANT_ID);
|
||||
if (StrUtil.isNotBlank(headerValue) && !userValue.toString().equals(headerValue)) {
|
||||
log.warn("请求头中的租户ID({})和用户的租户ID({})不一致", headerValue, userValue);
|
||||
// TODO: 不要提示租户ID不对,可能被穷举
|
||||
throw new PigxAuth2Exception(SpringSecurityMessageSource.getAccessor().getMessage("AbstractUserDetailsAuthenticationProvider.badTenantId","Bad tenant ID"));
|
||||
throw new PigxAuth2Exception(SpringSecurityMessageSource.getAccessor().getMessage("AbstractUserDetailsAuthenticationProvider.badTenantId", "Bad tenant ID"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -26,6 +26,7 @@ import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.core.SpringSecurityMessageSource;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -54,7 +55,9 @@ public class ResourceAuthExceptionEntryPoint implements AuthenticationEntryPoint
|
||||
R<String> result = new R<>();
|
||||
result.setCode(CommonConstants.FAIL);
|
||||
if (authException != null) {
|
||||
result.setMsg(authException.getMessage());
|
||||
String msg = SpringSecurityMessageSource.getAccessor().getMessage(
|
||||
"AbstractUserDetailsAuthenticationProvider.credentialsExpired", authException.getMessage());
|
||||
result.setMsg(msg);
|
||||
result.setData(authException.getMessage());
|
||||
}
|
||||
response.setStatus(HttpStatus.HTTP_UNAUTHORIZED);
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.pig4cloud.pigx.common.security.handler;
|
||||
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020/03/25
|
||||
* token 发放失败处理
|
||||
*/
|
||||
public interface AuthenticationFailureHandler {
|
||||
|
||||
/**
|
||||
* 业务处理
|
||||
*
|
||||
* @param authenticationException 错误信息
|
||||
* @param authentication 认证信息
|
||||
* @param request 请求信息
|
||||
* @param response 响应信息
|
||||
*/
|
||||
void handle(AuthenticationException authenticationException, Authentication authentication, HttpServletRequest request, HttpServletResponse response);
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.pig4cloud.pigx.common.security.handler;
|
||||
|
||||
import org.springframework.security.core.Authentication;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020/03/25
|
||||
* token 发放成功处理
|
||||
*/
|
||||
public interface AuthenticationSuccessHandler {
|
||||
|
||||
/**
|
||||
* 业务处理
|
||||
*
|
||||
* @param authentication 认证信息
|
||||
* @param request 请求信息
|
||||
* @param response 响应信息
|
||||
*/
|
||||
void handle(Authentication authentication, HttpServletRequest request, HttpServletResponse response);
|
||||
}
|
||||
+12
-17
@@ -15,8 +15,10 @@
|
||||
* Author: lengleng (wangiegie@gmail.com)
|
||||
*/
|
||||
|
||||
package com.pig4cloud.pigx.common.security.handler;
|
||||
package com.pig4cloud.pigx.common.security.listener;
|
||||
|
||||
import com.pig4cloud.pigx.common.security.handler.AuthenticationFailureHandler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.security.authentication.event.AbstractAuthenticationFailureEvent;
|
||||
import org.springframework.security.core.Authentication;
|
||||
@@ -29,10 +31,12 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2018/10/8
|
||||
* 认证失败事件处理器
|
||||
* @date 2020/03/25
|
||||
* 认证失败事件监听器
|
||||
*/
|
||||
public abstract class AbstractAuthenticationFailureEvenHandler implements ApplicationListener<AbstractAuthenticationFailureEvent> {
|
||||
public class AuthenticationFailureEventListener implements ApplicationListener<AbstractAuthenticationFailureEvent> {
|
||||
@Autowired(required = false)
|
||||
private AuthenticationFailureHandler failureHandler;
|
||||
|
||||
/**
|
||||
* Handle an application event.
|
||||
@@ -49,18 +53,9 @@ public abstract class AbstractAuthenticationFailureEvenHandler implements Applic
|
||||
AuthenticationException authenticationException = event.getException();
|
||||
Authentication authentication = (Authentication) event.getSource();
|
||||
|
||||
handle(authenticationException, authentication, request, response);
|
||||
// 调用自定义业务实现
|
||||
if (failureHandler != null) {
|
||||
failureHandler.handle(authenticationException, authentication, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理登录失败方法
|
||||
* <p>
|
||||
*
|
||||
* @param authenticationException 登录的authentication 对象
|
||||
* @param authentication 登录的authenticationException 对象
|
||||
* @param request 请求
|
||||
* @param response 响应
|
||||
*/
|
||||
public abstract void handle(AuthenticationException authenticationException, Authentication authentication
|
||||
, HttpServletRequest request, HttpServletResponse response);
|
||||
}
|
||||
Loaded 100 of 414 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user