Merge branch 'master' of 94636829/pigx into dev

This commit is contained in:
pig666 authored and lengleng committed 2022-05-24 09:07:17 +08:00
commit 58b61b73ac
750 files changed
+36057 -24068

No files matched your search

+1
View File
@@ -49,6 +49,7 @@ target/
*.java~
*.properties~
*.xml~
sessionStore
### system ignore ###
.DS_Store
+3
View File
@@ -24,3 +24,6 @@ create database `pigxx_report` default character set utf8mb4 collate utf8mb4_gen
-- pigx report 演示数据相关库 (可以不初始化)
create database `pigxx_report_init` default character set utf8mb4 collate utf8mb4_general_ci;
-- pigx bi 报表相关的数据库
create database `pigxx_bi` default character set utf8mb4 collate utf8mb4_general_ci;
+71 -12
View File
@@ -73,6 +73,50 @@ INSERT INTO `sys_dept_relation` VALUES (7, 12);
INSERT INTO `sys_dept_relation` VALUES (8, 8);
COMMIT;
-- ----------------------------
-- Table structure for sys_post
-- ----------------------------
DROP TABLE IF EXISTS `sys_post`;
CREATE TABLE `sys_post` (
`post_id` bigint NOT NULL COMMENT '岗位ID',
`post_code` varchar(64) CHARACTER SET utf8mb4 NOT NULL COMMENT '岗位编码',
`post_name` varchar(50) CHARACTER SET utf8mb4 NOT NULL COMMENT '岗位名称',
`post_sort` int(0) NOT NULL COMMENT '岗位排序',
`remark` varchar(500) CHARACTER SET utf8mb4 NULL DEFAULT NULL COMMENT '岗位描述',
`del_flag` char(1) CHARACTER SET utf8mb4 NOT NULL DEFAULT '0' COMMENT '是否删除 -1:已删除 0:正常',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`create_by` varchar(64) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '创建人',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
`update_by` varchar(64) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '更新人',
`tenant_id` bigint(0) NULL DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (`post_id`) USING BTREE
) ENGINE = InnoDB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '岗位信息表';
-- ----------------------------
-- Records of sys_post
-- ----------------------------
BEGIN;
INSERT INTO `sys_post` VALUES (1, 'CTO', 'CTO', 0, 'CTO', '0', '2022-03-26 13:48:17', '', '2022-03-26 13:50:14', '', 1);
INSERT INTO `sys_post` VALUES (2, 'CEO', 'CEO', 1, 'CEO', '0', '2022-03-26 13:48:27', '', '2022-03-26 13:48:38', '', 1);
COMMIT;
-- ----------------------------
-- Table structure for sys_user_post
-- ----------------------------
DROP TABLE IF EXISTS `sys_user_post`;
CREATE TABLE `sys_user_post` (
`user_id` bigint(0) NOT NULL COMMENT '用户ID',
`post_id` bigint(0) NOT NULL COMMENT '岗位ID',
PRIMARY KEY (`user_id`, `post_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT = '用户与岗位关联表';
-- ----------------------------
-- Records of sys_user_post
-- ----------------------------
BEGIN;
INSERT INTO `sys_user_post` VALUES (1, 1);
COMMIT;
-- ----------------------------
-- Table structure for sys_dict
-- ----------------------------
@@ -210,7 +254,10 @@ INSERT INTO `sys_dict_item` VALUES (59, 19, '1', '开', 'captcha_flag_types', '
INSERT INTO `sys_dict_item` VALUES (60, 20, '0', '否', 'enc_flag_types', '不加密', 0, ' ', ' ', '2020-11-18 06:55:31', '2020-11-18 06:55:31', '不加密-0', '0', 1);
INSERT INTO `sys_dict_item` VALUES (61, 20, '1', '是', 'enc_flag_types', '加密', 1, ' ', ' ', '2020-11-18 06:55:51', '2020-11-18 06:55:51', '加密-1', '0', 1);
INSERT INTO `sys_dict_item` VALUES (62, 15, 'MERGE_PAY', '聚合支付', 'channel_id', '聚合支付', 1, ' ', ' ', '2019-05-30 19:08:08', '2019-06-18 13:51:53', '聚合支付', '0', 1);
INSERT INTO `sys_dict_item` VALUES (63, 2, 'CAS', 'CAS登录', 'social_type', 'CAS 单点登录系统', 3, ' ', ' ', '2022-02-18 13:56:25', '2022-02-18 13:56:28', NULL, '0', 0);
INSERT INTO `sys_dict_item` VALUES (63, 2, 'CAS', 'CAS登录', 'social_type', 'CAS 单点登录系统', 3, ' ', ' ', '2022-02-18 13:56:25', '2022-02-18 13:56:28', NULL, '0', 1);
INSERT INTO `sys_dict_item` VALUES (64, 2, 'DINGTALK', '钉钉', 'social_type', '钉钉', 3, ' ', ' ', '2022-02-18 13:56:25', '2022-02-18 13:56:28', NULL, '0', 1);
INSERT INTO `sys_dict_item` VALUES (65, 2, 'WEIXIN_CP', '企业微信', 'social_type', '企业微信', 3, ' ', ' ', '2022-02-18 13:56:25', '2022-02-18 13:56:28', NULL, '0', 1);
INSERT INTO `sys_dict_item` VALUES (66, 18, '2', 'APP', 'style_type', 'uview风格', 1, ' ', ' ', '2020-02-07 03:53:12', '2020-02-07 03:53:12', '', '0', 1);
COMMIT;
-- ----------------------------
@@ -315,14 +362,22 @@ INSERT INTO `sys_menu` VALUES (1301, '角色新增', 'sys_role_add', NULL, 1300,
INSERT INTO `sys_menu` VALUES (1302, '角色修改', 'sys_role_edit', NULL, 1300, NULL, 1, '0', '1', ' ', '2017-11-08 10:14:41', ' ', '2021-05-25 03:12:55', '0', 1);
INSERT INTO `sys_menu` VALUES (1303, '角色删除', 'sys_role_del', NULL, 1300, NULL, 1, '0', '1', ' ', '2017-11-08 10:14:59', ' ', '2021-05-25 03:12:55', '0', 1);
INSERT INTO `sys_menu` VALUES (1304, '分配权限', 'sys_role_perm', NULL, 1300, NULL, 1, '0', '1', ' ', '2018-04-20 07:22:55', ' ', '2021-05-25 03:12:55', '0', 1);
INSERT INTO `sys_menu` VALUES (1305, '角色导入导出', 'sys_role_export', NULL, 1300, NULL, 4, '0', '1', ' ', '2022-03-26 15:54:34', ' ', NULL, '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', ' ', '2022-01-27 11:59:06', '0', 1);
INSERT INTO `sys_menu` VALUES (1401, '部门新增', 'sys_dept_add', NULL, 1400, NULL, 1, '0', '1', ' ', '2018-01-20 14:56:16', ' ', '2021-05-25 03:12:55', '0', 1);
INSERT INTO `sys_menu` VALUES (1402, '部门修改', 'sys_dept_edit', NULL, 1400, NULL, 1, '0', '1', ' ', '2018-01-20 14:56:59', ' ', '2021-05-25 03:12:55', '0', 1);
INSERT INTO `sys_menu` VALUES (1403, '部门删除', 'sys_dept_del', NULL, 1400, NULL, 1, '0', '1', ' ', '2018-01-20 14:57:28', ' ', '2021-05-25 03:12:55', '0', 1);
INSERT INTO `sys_menu` VALUES (1404, '开放互联', 'sys_connect_sync', NULL, 1400, NULL, 1, '0', '1', ' ', '2018-01-20 14:57:28', ' ', '2021-05-25 03:12:55', '0', 1);
INSERT INTO `sys_menu` VALUES (1500, '租户管理', '', '/admin/tenant/index', 1000, 'icon-erji-zuhushouye', 5, '0', '0', ' ', '2018-01-20 13:17:19', ' ', '2022-01-27 11:59:14', '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 (1600, '岗位管理', NULL, '/admin/post/index', 1000, 'icon-record', 6, '0', '0', ' ', '2022-03-26 13:04:14', ' ', NULL, '0', 1);
INSERT INTO `sys_menu` VALUES (1601, '岗位信息查看', 'sys_post_view', NULL, 1600, NULL, 0, '0', '1', ' ', '2022-03-26 13:05:34', ' ', NULL, '0', 1);
INSERT INTO `sys_menu` VALUES (1602, '岗位信息新增', 'sys_post_add', NULL, 1600, NULL, 1, '0', '1', ' ', '2022-03-26 13:06:00', ' ', NULL, '0', 1);
INSERT INTO `sys_menu` VALUES (1603, '岗位信息修改', 'sys_post_edit', NULL, 1600, NULL, 2, '0', '1', ' ', '2022-03-26 13:06:31', ' ', '2022-03-26 13:06:38', '0', 1);
INSERT INTO `sys_menu` VALUES (1604, '岗位信息删除', 'sys_post_del', NULL, 1600, NULL, 3, '0', '1', ' ', '2022-03-26 13:06:31', ' ', NULL, '0', 1);
INSERT INTO `sys_menu` VALUES (1605, '岗位导入导出', 'sys_post_export', NULL, 1600, NULL, 4, '0', '1', ' ', '2022-03-26 13:06:31', ' ', '2022-03-26 06:32:02', '0', 1);
INSERT INTO `sys_menu` VALUES (2000, '系统管理', NULL, '/system', -1, 'icon-xitongpeizhi', 1, '0', '0', ' ', '2017-11-07 20:56:00', ' ', '2022-02-05 16:15:14', '0', 1);
INSERT INTO `sys_menu` VALUES (2100, '日志管理', NULL, '/admin/log/index', 2000, 'icon-rizhi', 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, 1, '0', '1', ' ', '2017-11-20 20:37:37', ' ', '2021-05-25 03:12:55', '0', 1);
@@ -425,7 +480,7 @@ INSERT INTO `sys_menu` VALUES (6801, '新增标签', 'mp_wx_account_tag_add', NU
INSERT INTO `sys_menu` VALUES (6802, '编辑标签', 'mp_wx_account_tag_edit', NULL, 6800, NULL, 1, '0', '1', ' ', '2019-03-29 15:43:54', ' ', '2020-03-24 08:58:39', '0', 1);
INSERT INTO `sys_menu` VALUES (6803, '删除标签', 'mp_wx_account_tag_del', NULL, 6800, NULL, 1, '0', '1', ' ', '2019-03-29 15:43:54', ' ', '2020-03-24 08:58:39', '0', 1);
INSERT INTO `sys_menu` VALUES (6804, '同步标签', 'mp_wx_account_tag_sync', NULL, 6800, NULL, 1, '0', '1', ' ', '2019-03-29 15:43:54', ' ', '2022-02-17 15:44:24', '0', 1);
INSERT INTO `sys_menu` VALUES (7000, '报表设计', NULL, 'http://127.0.0.1:5006/ureport/designer', -1, 'icon-icon-p_mrpbaobiao', 9, '0', '0', ' ', '2019-08-12 09:35:16', ' ', '2020-03-24 08:58:48', '0', 1);
INSERT INTO `sys_menu` VALUES (7000, '报表设计', NULL, '/report/bi/index', -1, 'icon-icon-p_mrpbaobiao', 9, '0', '0', ' ', '2019-08-12 09:35:16', ' ', '2020-03-24 08:58:48', '0', 1);
INSERT INTO `sys_menu` VALUES (8000, '文件管理', NULL, '/admin/file/index', 2000, 'icon-wenjianguanli', 6, '0', '0', ' ', '2019-06-25 12:44:46', ' ', '2020-03-24 08:58:41', '0', 1);
INSERT INTO `sys_menu` VALUES (8001, '删除文件', 'sys_file_del', NULL, 8000, NULL, 1, '0', '1', ' ', '2019-06-25 13:41:41', ' ', '2020-03-24 08:58:42', '0', 1);
INSERT INTO `sys_menu` VALUES (9000, '开发平台', NULL, '/gen', -1, 'icon-shejiyukaifa-', 9, '0', '0', ' ', '2019-08-12 09:35:16', ' ', '2020-03-24 08:58:48', '0', 1);
@@ -511,6 +566,7 @@ INSERT INTO `sys_public_param` VALUES (5, '租户默认角色编码', 'TENANT_DE
INSERT INTO `sys_public_param` VALUES (6, '租户默认角色名称', 'TENANT_DEFAULT_ROLENAME', '租户默认角色', '0', '', ' ', ' ', '2020-05-12 04:06:19', NULL, '2', '1', '0', 1);
INSERT INTO `sys_public_param` VALUES (7, '表前缀', 'GEN_TABLE_PREFIX', 'tb_', '0', '', ' ', ' ', '2020-05-12 04:23:04', NULL, '9', '1', '0', 1);
INSERT INTO `sys_public_param` VALUES (8, '接口文档不显示的字段', 'GEN_HIDDEN_COLUMNS', 'tenant_id', '0', '', ' ', ' ', '2020-05-12 04:25:19', NULL, '9', '1', '0', 1);
INSERT INTO `sys_public_param` VALUES (9, '注册用户默认角色', 'USER_DEFAULT_ROLE', 'GENERAL_USER', '0', NULL, ' ', ' ', '2022-03-31 16:52:24', NULL, '2', '1', '0', 1);
COMMIT;
-- ----------------------------
@@ -539,6 +595,7 @@ CREATE TABLE `sys_role` (
-- ----------------------------
BEGIN;
INSERT INTO `sys_role` VALUES (1, '管理员', 'ROLE_ADMIN', '管理员', '3', '2', ' ', ' ', '2017-10-29 15:45:51', '2022-01-25 18:21:23', '0', 1);
INSERT INTO `sys_role` VALUES (2, '普通用户', 'GENERAL_USER', '普通用户', '3', NULL, ' ', ' ', '2022-03-31 17:03:15', NULL, '0', 1);
COMMIT;
-- ----------------------------
@@ -570,14 +627,22 @@ INSERT INTO `sys_role_menu` VALUES (1, 1301);
INSERT INTO `sys_role_menu` VALUES (1, 1302);
INSERT INTO `sys_role_menu` VALUES (1, 1303);
INSERT INTO `sys_role_menu` VALUES (1, 1304);
INSERT INTO `sys_role_menu` VALUES (1, 1305);
INSERT INTO `sys_role_menu` VALUES (1, 1400);
INSERT INTO `sys_role_menu` VALUES (1, 1401);
INSERT INTO `sys_role_menu` VALUES (1, 1402);
INSERT INTO `sys_role_menu` VALUES (1, 1403);
INSERT INTO `sys_role_menu` VALUES (1, 1404);
INSERT INTO `sys_role_menu` VALUES (1, 1500);
INSERT INTO `sys_role_menu` VALUES (1, 1501);
INSERT INTO `sys_role_menu` VALUES (1, 1502);
INSERT INTO `sys_role_menu` VALUES (1, 1503);
INSERT INTO `sys_role_menu` VALUES (1, 1600);
INSERT INTO `sys_role_menu` VALUES (1, 1601);
INSERT INTO `sys_role_menu` VALUES (1, 1602);
INSERT INTO `sys_role_menu` VALUES (1, 1603);
INSERT INTO `sys_role_menu` VALUES (1, 1604);
INSERT INTO `sys_role_menu` VALUES (1, 1605);
INSERT INTO `sys_role_menu` VALUES (1, 2000);
INSERT INTO `sys_role_menu` VALUES (1, 2100);
INSERT INTO `sys_role_menu` VALUES (1, 2101);
@@ -729,6 +794,7 @@ INSERT INTO `sys_route_conf` VALUES (8, '工作流长链接支持', 'pigx-oa-pla
INSERT INTO `sys_route_conf` VALUES (9, '微信公众号管理', 'pigx-mp-platform', '[{\"args\": {\"_genkey_0\": \"/mp/**\"}, \"name\": \"Path\"}]', '[]', 'lb://pigx-mp-platform', 0, NULL, ' ', ' ', '2019-10-16 16:44:41', '2019-11-05 22:37:12', '0');
INSERT INTO `sys_route_conf` VALUES (10, '支付管理', 'pigx-pay-platform', '[{\"args\": {\"_genkey_0\": \"/pay/**\"}, \"name\": \"Path\"}]', '[]', 'lb://pigx-pay-platform', 0, NULL, ' ', ' ', '2019-10-16 16:44:41', '2019-11-05 22:37:13', '0');
INSERT INTO `sys_route_conf` VALUES (11, '监控管理', 'pigx-monitor', '[{\"args\": {\"_genkey_0\": \"/monitor/**\"}, \"name\": \"Path\"}]', '[]', 'lb://pigx-monitor', 0, NULL, ' ', ' ', '2019-10-16 16:44:41', '2019-11-05 22:37:17', '0');
INSERT INTO `sys_route_conf` VALUES (12, '积木报表', 'pigx-jimu-platform\n', '[{\"args\": {\"_genkey_0\": \"/jimu/**\"}, \"name\": \"Path\"}]', '[]', 'lb://pigx-jimu-platform', 0, NULL, ' ', ' ', '2019-10-16 16:44:41', '2019-11-05 22:37:17', '0');
COMMIT;
-- ----------------------------
@@ -742,6 +808,7 @@ CREATE TABLE `sys_social_details` (
`app_id` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL,
`app_secret` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL,
`redirect_url` varchar(128) CHARACTER SET utf8mb4 DEFAULT NULL,
`ext` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '拓展字段',
`create_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' COMMENT '创建人',
`update_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' COMMENT '修改人',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
@@ -751,15 +818,6 @@ CREATE TABLE `sys_social_details` (
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='系统社交登录账号表';
-- ----------------------------
-- Records of sys_social_details
-- ----------------------------
BEGIN;
INSERT INTO `sys_social_details` VALUES (1, 'WX', '微信互联参数', 'wxd1678d3f83b1d83a', '6ddb043f94da5d2172926abe8533504f', 'daoweicloud.com', ' ', ' ', '2018-08-16 14:24:25', '2019-03-02 09:43:13', '0', 1);
INSERT INTO `sys_social_details` VALUES (2, 'GITEE', '码云登录', '8fc54e0e76e7842cf767c3ae3b9fdc48c03cefed27aa565ff7b2a39d142d9892', 'c544469ce78a67d9fcf9b28cd9f310b73f5cbc46a1b993e0802ad61517deb221', 'http://gitee.huaxiadaowei.com/#/authredirect', ' ', ' ', '2019-06-28 09:59:55', '2019-06-28 09:59:55', '0', 1);
INSERT INTO `sys_social_details` VALUES (3, 'OSC', '开源中国', 'neIIqlwGsjsfsA6uxNqD', 'aOPhRuOOJNXV1x7JrTJ9qIyRCAPXoO0l', 'http://gitee.huaxiadaowei.com/#/authredirect', ' ', ' ', '2019-06-28 10:05:37', '2019-06-28 10:05:37', '0', 1);
INSERT INTO `sys_social_details` VALUES (4, 'MINI', '小程序', 'wx6832be859d0e1cf5', '08036aef810dcb2f8ae31510910ba631', NULL, ' ', ' ', '2019-11-02 22:08:03', '2019-11-02 22:10:53', '0', 1);
COMMIT;
-- ----------------------------
-- Table structure for sys_tenant
@@ -769,6 +827,7 @@ CREATE TABLE `sys_tenant` (
`id` bigint NOT NULL COMMENT '租户id',
`name` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL,
`code` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL,
`tenant_domain` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL,
`start_time` datetime DEFAULT NULL COMMENT '开始时间',
`end_time` datetime DEFAULT NULL COMMENT '结束时间',
`status` char(1) CHARACTER SET utf8mb4 DEFAULT '0',
@@ -784,7 +843,7 @@ CREATE TABLE `sys_tenant` (
-- Records of sys_tenant
-- ----------------------------
BEGIN;
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', '2022-02-10 05:38:48');
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', '2022-02-10 05:38:48');
COMMIT;
-- ----------------------------
+3 -4
View File
@@ -32,21 +32,20 @@ CREATE TABLE `config_info` (
-- Records of config_info
-- ----------------------------
BEGIN;
INSERT INTO `config_info` VALUES (1, 'application-dev.yml', 'DEFAULT_GROUP', '# 配置文件加密根密码\njasypt:\n encryptor:\n password: pigx\n algorithm: PBEWithMD5AndDES\n iv-generator-classname: org.jasypt.iv.NoIvGenerator\n\nspring:\n mvc:\n pathmatch:\n matching-strategy: ant_path_matcher\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 enabled: false\n transport:\n dashboard: pigx-sentinel:5020\n\n# 端点对外暴露\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\' \n endpoint:\n restart:\n enabled: true\n health:\n show-details: ALWAYS\n# feign 相关配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 20000\n readTimeout: 20000\n compression:\n request:\n enabled: true\n response:\n enabled: true\n\n#开启灰度\ngray:\n rule:\n enabled: true\n\n# mybatis-plus 配置\nmybatis-plus:\n tenant-enable: ture\n mapper-locations: classpath:/mapper/*Mapper.xml\n global-config:\n capitalMode: true\n banner: false\n db-config:\n id-type: auto\n select-strategy: not_empty\n insert-strategy: not_empty\n update-strategy: not_empty\n type-handlers-package: com.pig4cloud.pigx.common.data.handler\n configuration:\n jdbc-type-for-null: \'null\'\n call-setters-on-nulls: true\n# swagger 全局配置\nknife4j:\n enable: true\nswagger:\n enabled: true\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: oauth2\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\n# oauth2 资源服务器相关配置\nsecurity:\n oauth2:\n client:\n ignore-urls:\n - /css/**\n - /error\n - /actuator/**\n - /v2/api-docs\n resource:\n loadBalanced: true\n token-info-uri: http://pigx-auth/oauth/check_token', '77d9d4800dc7537704e228f2a04dac55', '2019-04-18 02:10:20', '2022-02-13 21:44:06', 'nacos', '127.0.0.1', '', '', '通用配置文件', 'null', 'null', 'yaml', 'null');
INSERT INTO `config_info` VALUES (1, 'application-dev.yml', 'DEFAULT_GROUP', '# 配置文件加密根密码\njasypt:\n encryptor:\n password: pigx\n algorithm: PBEWithMD5AndDES\n iv-generator-classname: org.jasypt.iv.NoIvGenerator\n\nspring:\n mvc:\n pathmatch:\n matching-strategy: ant_path_matcher\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 transport:\n dashboard: pigx-sentinel:5020\n\n# 端点对外暴露\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\' \n endpoint:\n restart:\n enabled: true\n health:\n show-details: ALWAYS\n# feign 相关配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 20000\n readTimeout: 20000\n compression:\n request:\n enabled: true\n response:\n enabled: true\n\n#开启灰度\ngray:\n rule:\n enabled: true\n\n# mybatis-plus 配置\nmybatis-plus:\n tenant-enable: ture\n mapper-locations: classpath:/mapper/*Mapper.xml\n global-config:\n capitalMode: true\n banner: false\n db-config:\n id-type: auto\n select-strategy: not_empty\n insert-strategy: not_empty\n update-strategy: not_empty\n type-handlers-package: com.pig4cloud.pigx.common.data.handler\n configuration:\n jdbc-type-for-null: \'null\'\n call-setters-on-nulls: true\n# swagger 全局配置\nknife4j:\n enable: true\nswagger:\n enabled: true\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: oauth2\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\n# oauth2 资源服务器相关配置\nsecurity:\n oauth2:\n client:\n ignore-urls:\n - /css/**\n - /error\n - /actuator/**\n - /v2/api-docs\n resource:\n loadBalanced: true\n token-info-uri: http://pigx-auth/oauth/check_token', '77d9d4800dc7537704e228f2a04dac55', '2019-04-18 02:10:20', '2022-02-13 21:44:06', 'nacos', '127.0.0.1', '', '', '通用配置文件', 'null', 'null', 'yaml', 'null');
INSERT INTO `config_info` VALUES (2, 'pigx-auth-dev.yml', 'DEFAULT_GROUP', '# 数据源\nspring:\n freemarker:\n allow-request-override: false\n allow-session-override: false\n cache: true\n charset: UTF-8\n check-template-location: true\n content-type: text/html\n enabled: true\n expose-request-attributes: false\n expose-session-attributes: false\n expose-spring-macro-helpers: true\n prefer-file-system-access: true\n suffix: .ftl\n template-loader-path: classpath:/templates/', '74f53b71c7799aa754da75662378b93c', '2019-04-18 02:11:32', '2021-05-07 23:40:38', NULL, '10.1.1.143', '', '', '认证中心配置文件', '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\n# 租户表维护\npigx:\n tenant:\n column: tenant_id\n tables:\n - gen_datasource_conf\n - gen_form_conf', 'ed93a557f5709d65bb45c14e80c7e9e1', '2019-04-18 02:12:10', '2022-01-27 21:27:50', 'nacos', '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', '4124589805657db024b20772cccf57f5', '2019-04-18 02:12:57', '2020-11-09 16:18:05', NULL, '172.16.1.198', '', '', '定时任务-elastic-job配置', 'null', 'null', 'yaml', 'null');
INSERT INTO `config_info` VALUES (5, 'pigx-gateway-dev.yml', 'DEFAULT_GROUP', 'gateway:\n encode-key: \'pigxpigxpigxpigx\'\n\nswagger:\n ignore-providers:\n - pigx-monitor\n - pigx-auth\n - pigx-tx-manager\n\nribbon:\n rule:\n gray-enabled: true\n\n# 验证码相关配置参考: http://t.cn/A647jEdu\naj:\n captcha:\n cache-type: redis\n water-mark: pig4cloud', 'cd9f8a6a46e2c128f3b172be76ea3221', '2019-04-18 02:13:52', '2021-11-09 12:09:34', '', '127.0.0.1', '', '', '', '', '', 'yaml', '');
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 autoconfigure:\n exclude: com.pig4cloud.pigx.common.core.config.JacksonConfiguration\n boot:\n admin:\n ui:\n title: \'pigx 服务状态监控\'\n brand: \'pigx 服务状态监控\'\n external-views:\n - label: \"SQL监控\"\n url: /druid/sql.html\n order: 2000\n iframe: true\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n endpoint:\n health:\n show-details: ALWAYS #显示详细信息\n\n\n# druid 监控的服务\nmonitor:\n applications:\n - pigx-upms-biz\n - pigx-pay-platform\n', 'cbc0b536fe11eeff0dcf81be11dab6e4', '2019-04-18 02:14:17', '2022-02-18 13:44:07', 'nacos', '127.0.0.1', '', '', '监控配置文件', '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 - /error\n - /druid/**\n - /actuator/**\n - /v2/api-docs\n\n# 数据源\nspring:\n autoconfigure:\n exclude: org.springframework.cloud.gateway.config.GatewayAutoConfiguration,org.springframework.cloud.gateway.config.GatewayClassPathWarningAutoConfiguration\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 allow: \"\"\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# 文件系统 (minio测试环境,不可当生产使用)\noss:\n endpoint: http://minio.pig4cloud.com\n access-key: lengleng\n secret-key: lengleng\n bucket-name: tmp\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 ', '1d1062f04c4b7c0a99984be0e05083c8', '2019-04-18 02:32:44', '2022-02-17 15:33:21', 'nacos', '127.0.0.1', '', '', '', '', '', 'yaml', '');
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 (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 - /error\n - /druid/**\n - /actuator/**\n - /v2/api-docs\n\n# 数据源\nspring:\n autoconfigure:\n exclude: org.springframework.cloud.gateway.config.GatewayAutoConfiguration,org.springframework.cloud.gateway.config.GatewayClassPathWarningAutoConfiguration\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 allow: \"\"\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# 本地文件系统\nfile:\n local:\n enable: true\n basePath: /data/file\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\n - sys_post', '9762403bc4feb48532167e8df21557d4', '2019-04-18 02:32:44', '2022-05-12 17:58:58', 'nacos', '127.0.0.1', '', '', '', '', '', 'yaml', '');
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.springframework.scheduling.quartz.LocalDataSourceJobStore\n driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate\n tablePrefix: QRTZ_\n isClustered: true\n clusterCheckinInterval: 10000\n useProperties: false\n threadPool:\n class: org.quartz.simpl.SimpleThreadPool\n threadCount: 50\n threadPriority: 5\n threadsInheritContextClassLoaderOfInitializingThread: true\n #数据库方式\n job-store-type: jdbc\n #初始化表结构\n #jdbc:\n #initialize-schema: never\n\n', '9ff6e1d6f4d7f8776cb13e31c9dc8ce9', '2019-04-18 03:08:34', '2022-02-18 14:44:22', 'nacos', '127.0.0.1', '', '', '', '', '', 'yaml', '');
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 ignore-urls:\n - /druid/**\n - /error\n - /actuator/**\n - /v2/api-docs\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 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/\n# 租户表维护\npigx:\n pay:\n test: lengleng\n aliPayConfig:\n expire-time: 30\n return-url: http://pig4cloud.com\n notify-url: http://wechat.pigx.top/pay/notify/ali/callbak\n wxPayConfig:\n notify-url: https://admin.pig4cloud.com/pay/notify/wx/callbak\n mergePayConfig:\n return-url: http://pig4cloud.com\n notify-url: http://wechat.pigx.top/pay/notify/merge/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', 'ee15c87a8ec17f7272d0f2f4597ee764', '2019-05-28 11:46:27', '2022-02-18 14:44:43', 'nacos', '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 \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', '60d4303ef8696b3cad851f7cfefa7059', '2019-10-16 16:38:52', '2021-11-05 22:46:22', 'nacos', '127.0.0.1', '', '', '', '', '', 'yaml', '');
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_tag\n - wx_account_fans\n - wx_msg\n - wx_auto_reply', 'd3f9d0ebd82dc5727cf6b3e63b669931', '2019-10-21 08:58:24', '2022-01-05 11:02:19', '', '0:0:0:0:0:0:0:1', '', '', '', '', '', 'yaml', '');
INSERT INTO `config_info` VALUES (13, 'pigx-bi-platform-dev.yml', 'DEFAULT_GROUP', 'spring:\n # 安全配置\n security:\n user:\n name: ENC(rZHA4LW5hHmhLAAzJoFNag==) # pigx\n password: ENC(bjeyh+Aeii3kHXkoo00ZUw==) # pigx\n \n# ureport 报表相关设置\nureport:\n debug: false\n disableFileProvider: true\n disableHttpSessionReportCache: true\n\n# oss 保存报表设计文件\noss:\n bucket-name: lengleng\n access-key: lengleng\n secret-key: lengleng\n endpoint: http://minio.pig4cloud.com', '77e5829593e85d395aafdd88e662c036', '2020-10-15 18:18:13', '2021-02-03 19:12:08', NULL, '172.16.1.92', '', '', '', '', '', 'yaml', '');
INSERT INTO `config_info` VALUES (14, 'pigx-xxl-job-admin-dev.yml', 'DEFAULT_GROUP', '# xxl\nxxl:\n job:\n i18n: zh_CN\n logretentiondays: 30\n triggerpool:\n fast.max: 200\n slow.max: 200\n\n# mybatis\nmybatis:\n mapper-locations: classpath:/mybatis-mapper/*Mapper.xml\n\n# spring\nspring:\n datasource:\n driver-class-name: org.h2.Driver \n url: jdbc:h2:file:~/pigxx_job;MODE=MYSQL;DB_CLOSE_DELAY=-1;AUTO_SERVER=TRUE;\n sql:\n init:\n mode: always\n schema-locations: classpath:db/schema-h2.sql\n data-locations: classpath:db/data-h2.sql\n mvc:\n static-path-pattern: /static/**\n freemarker:\n suffix: .ftl\n request-context-attribute: request\n settings:\n number_format: 0.##########\n mail:\n host: smtp.mxhichina.com\n port: 465\n from: xxxx@gitee.wang\n username: xxxx@gitee.wang\n password: xxxx\n properties:\n mail:\n smtp:\n auth: true\n ssl.enable: true\n starttls.enable: false\n required: false\n# spring boot admin 配置\n\nmanagement:\n health:\n mail:\n enabled: false\n endpoints:\n web:\n exposure:\n include: \'*\'\n endpoint:\n health:\n show-details: ALWAYS', '2a08e1ac7a4f2f079550c394d097b520', '2021-07-21 20:45:02', '2021-12-27 21:53:18', 'nacos', '127.0.0.1', '', '', '', '', '', 'yaml', '');
INSERT INTO `config_info` VALUES (15, 'pigx-report-platform-dev.yml', 'DEFAULT_GROUP', 'spring:\n messages:\n basename: i18n/messages\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_report}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\nmybatis-plus:\n configuration:\n call-setters-on-nulls: true\n mapperLocations:\n - classpath*:/mapper/**/*.xml\n - classpath*:/modeler-mybatis-mappings/**/*.xml\n\n \n# 本应用自定义参数\ncustomer:\n file:\n #上传对应本地全路径\n dist-path: /Users/lengleng/Downloads/file/\n white-list: .png|.jpg|.gif|.icon|.pdf|.xlsx|.xls|.csv|.mp4|.avi\n excelSuffix: .xlsx|.xls|.csv\n downloadPath: http://127.0.0.1:9095/file/download\n', 'da03b3efe2b4ac44745cadc2a23328ab', '2021-11-05 09:13:54', '2022-02-18 14:39:12', 'nacos', '127.0.0.1', '', '', '大屏设计模块配置文件', '', '', 'yaml', '');
INSERT INTO `config_info` VALUES (16, 'pigx-jimu-platform-dev.yml', 'DEFAULT_GROUP', 'spring:\n #配置静态资源\n mvc:\n static-path-pattern: /**\n resource:\n static-locations: classpath:/static/\n #配置数据库\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_bi}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n \n#JimuReport[minidao配置]\nminidao :\n base-package: org.jeecg.modules.jmreport.desreport.dao*\n db-type: mysql\n#JimuReport[上传配置]\njeecg :\n jmreport:\n customPrePath: /jimu\n # 自动保存\n autoSave: true\n # 单位毫秒 默认5*60*1000 \n interval: 10000\n # local|minio|alioss\n uploadType: local\n # local\n path :\n #文件路径A\n upload: ~/jimu/data\n # alioss\n oss:\n endpoint: oss-cn-beijing.aliyuncs.com\n accessKey: ??\n secretKey: ??\n staticDomain: ??\n bucketName: ??\n # minio\n minio:\n minio_url: http://minio.jeecg.com\n minio_name: ??\n minio_pass: ??\n bucketName: ??\n#输出sql日志\nlogging:\n level:\n org.jeecg.modules.jmreport : debug', '423f74383b37d44b24832570ffd54f3c', '2022-04-15 22:45:41', '2022-04-15 22:45:41', NULL, '127.0.0.1', '', '', NULL, NULL, NULL, 'yaml', NULL);
COMMIT;
-- ----------------------------
+1609
View File
File diff suppressed because it is too large. Load diff
+3 -1
View File
@@ -1,4 +1,4 @@
FROM mysql/mysql-server:8.0.27
FROM mysql/mysql-server:8.0.29
MAINTAINER lengleng(wangiegie@gmail.com)
@@ -25,3 +25,5 @@ COPY ./8pigxx_codegen.sql /docker-entrypoint-initdb.d
COPY ./9pigxx_report.sql /docker-entrypoint-initdb.d
COPY ./99pigxx_report_init.sql /docker-entrypoint-initdb.d
COPY ./999pigxx_bi.sql /docker-entrypoint-initdb.d
-299
View File
@@ -1,299 +0,0 @@
USE pigxx_config;
UPDATE `config_info` SET `data_id` = 'application-dev.yml', `group_id` = 'DEFAULT_GROUP', `content` = '# 配置文件加密根密码\njasypt:\n encryptor:\n password: pigx\n algorithm: PBEWithMD5AndDES\n iv-generator-classname: org.jasypt.iv.NoIvGenerator\n\nspring:\n mvc:\n pathmatch:\n matching-strategy: ant_path_matcher\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 enabled: false\n transport:\n dashboard: pigx-sentinel:5020\n\n# 端点对外暴露\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\' \n endpoint:\n restart:\n enabled: true\n health:\n show-details: ALWAYS\n# feign 相关配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 20000\n readTimeout: 20000\n compression:\n request:\n enabled: true\n response:\n enabled: true\n\n#开启灰度\ngray:\n rule:\n enabled: true\n\n# mybatis-plus 配置\nmybatis-plus:\n tenant-enable: ture\n mapper-locations: classpath:/mapper/*Mapper.xml\n global-config:\n capitalMode: true\n banner: false\n db-config:\n id-type: auto\n select-strategy: not_empty\n insert-strategy: not_empty\n update-strategy: not_empty\n type-handlers-package: com.pig4cloud.pigx.common.data.handler\n configuration:\n jdbc-type-for-null: \'null\'\n call-setters-on-nulls: true\n# swagger 全局配置\nknife4j:\n enable: true\nswagger:\n enabled: true\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: oauth2\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\n# oauth2 资源服务器相关配置\nsecurity:\n oauth2:\n client:\n ignore-urls:\n - /css/**\n - /error\n - /actuator/**\n - /v2/api-docs\n resource:\n loadBalanced: true\n token-info-uri: http://pigx-auth/oauth/check_token', `md5` = '77d9d4800dc7537704e228f2a04dac55', `gmt_create` = '2019-04-18 02:10:20', `gmt_modified` = '2022-02-13 21:44:06', `src_user` = 'nacos', `src_ip` = '127.0.0.1', `app_name` = '', `tenant_id` = '', `c_desc` = '通用配置文件', `c_use` = 'null', `effect` = 'null', `type` = 'yaml', `c_schema` = 'null' WHERE `id` = 1;
UPDATE `config_info` SET `data_id` = 'pigx-codegen-dev.yml', `group_id` = 'DEFAULT_GROUP', `content` = '## 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\n# 租户表维护\npigx:\n tenant:\n column: tenant_id\n tables:\n - gen_datasource_conf\n - gen_form_conf', `md5` = 'ed93a557f5709d65bb45c14e80c7e9e1', `gmt_create` = '2019-04-18 02:12:10', `gmt_modified` = '2022-01-27 21:27:50', `src_user` = 'nacos', `src_ip` = '127.0.0.1', `app_name` = '', `tenant_id` = '', `c_desc` = '代码生成', `c_use` = 'null', `effect` = 'null', `type` = 'yaml', `c_schema` = 'null' WHERE `id` = 3;
-- PIGXX 数据源
USE pigxx;
ALTER TABLE `sys_dept`
DROP COLUMN `sort`,
ADD COLUMN `sort_order` int NOT NULL DEFAULT '0' AFTER `name`,
ADD COLUMN `create_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `sort_order`,
ADD COLUMN `update_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `create_by`,
MODIFY COLUMN `dept_id` bigint NOT NULL FIRST,
MODIFY COLUMN `create_time` datetime NULL DEFAULT NULL AFTER `update_by`,
MODIFY COLUMN `update_time` datetime NULL DEFAULT NULL AFTER `create_time`,
MODIFY COLUMN `parent_id` bigint DEFAULT NULL AFTER `del_flag`,
MODIFY COLUMN `tenant_id` bigint DEFAULT NULL AFTER `parent_id`;
ALTER TABLE `sys_dept_relation`
MODIFY COLUMN `ancestor` bigint NOT NULL FIRST,
MODIFY COLUMN `descendant` bigint NOT NULL AFTER `ancestor`;
ALTER TABLE `sys_dict`
DROP COLUMN `type`,
DROP COLUMN `system`,
ADD COLUMN `dict_type` varchar(100) CHARACTER SET utf8mb4 DEFAULT NULL AFTER `id`,
ADD COLUMN `create_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `description`,
ADD COLUMN `update_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `create_by`,
ADD COLUMN `system_flag` char(1) CHARACTER SET utf8mb4 DEFAULT '0' AFTER `remarks`,
MODIFY COLUMN `id` bigint NOT NULL FIRST,
MODIFY COLUMN `create_time` datetime NULL DEFAULT NULL AFTER `update_by`,
MODIFY COLUMN `update_time` datetime NULL DEFAULT NULL AFTER `create_time`,
MODIFY COLUMN `tenant_id` bigint NOT NULL DEFAULT '0' AFTER `del_flag`;
ALTER TABLE `sys_dict_item`
DROP COLUMN `sort`,
DROP COLUMN `value`,
DROP COLUMN `type`,
ADD COLUMN `item_value` varchar(100) CHARACTER SET utf8mb4 DEFAULT NULL AFTER `dict_id`,
ADD COLUMN `dict_type` varchar(100) CHARACTER SET utf8mb4 DEFAULT NULL AFTER `label`,
ADD COLUMN `sort_order` int NOT NULL DEFAULT '0' AFTER `description`,
ADD COLUMN `create_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `sort_order`,
ADD COLUMN `update_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `create_by`,
MODIFY COLUMN `id` bigint NOT NULL FIRST,
MODIFY COLUMN `dict_id` bigint NOT NULL AFTER `id`,
MODIFY COLUMN `create_time` datetime NULL DEFAULT NULL AFTER `update_by`,
MODIFY COLUMN `update_time` datetime NULL DEFAULT NULL AFTER `create_time`,
MODIFY COLUMN `tenant_id` bigint NOT NULL DEFAULT '0' AFTER `del_flag`,
DROP INDEX `sys_dict_del_flag`,
ADD KEY `sys_dict_item_del_flag` (`del_flag`),
DROP INDEX `sys_dict_value`,
ADD KEY `sys_dict_value` (`item_value`);
ALTER TABLE `sys_file`
DROP COLUMN `create_user`,
DROP COLUMN `update_user`,
ADD COLUMN `create_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `file_size`,
ADD COLUMN `update_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `create_by`,
MODIFY COLUMN `id` bigint NOT NULL FIRST,
MODIFY COLUMN `create_time` datetime NULL DEFAULT NULL AFTER `update_by`,
MODIFY COLUMN `update_time` datetime NULL DEFAULT NULL AFTER `create_time`,
MODIFY COLUMN `tenant_id` bigint DEFAULT NULL AFTER `del_flag`;
ALTER TABLE `sys_log`
DROP COLUMN `type`,
ADD COLUMN `log_type` char(1) CHARACTER SET utf8mb4 DEFAULT '0' AFTER `id`,
ADD COLUMN `update_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `create_by`,
MODIFY COLUMN `id` bigint NOT NULL FIRST,
MODIFY COLUMN `create_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `service_id`,
MODIFY COLUMN `create_time` datetime NULL DEFAULT NULL AFTER `update_by`,
MODIFY COLUMN `update_time` datetime NULL DEFAULT NULL AFTER `create_time`,
MODIFY COLUMN `time` bigint DEFAULT NULL AFTER `params`,
MODIFY COLUMN `tenant_id` bigint DEFAULT '0' AFTER `exception`,
DROP INDEX `sys_log_create_by`,
DROP INDEX `sys_log_type`,
ADD KEY `sys_log_type` (`log_type`);
ALTER TABLE `sys_menu`
DROP COLUMN `type`,
DROP COLUMN `sort`,
ADD COLUMN `sort_order` int DEFAULT '1' AFTER `icon`,
ADD COLUMN `menu_type` char(1) CHARACTER SET utf8mb4 DEFAULT '0' AFTER `keep_alive`,
ADD COLUMN `create_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `menu_type`,
ADD COLUMN `update_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `create_time`,
MODIFY COLUMN `menu_id` bigint NOT NULL FIRST,
MODIFY COLUMN `parent_id` bigint DEFAULT NULL AFTER `path`,
MODIFY COLUMN `tenant_id` bigint unsigned DEFAULT NULL AFTER `del_flag`;
ALTER TABLE `sys_oauth_client_details`
ADD COLUMN `create_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `del_flag`,
ADD COLUMN `update_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `create_by`,
ADD COLUMN `create_time` datetime NULL DEFAULT NULL AFTER `update_by`,
ADD COLUMN `update_time` datetime NULL DEFAULT NULL AFTER `create_time`,
MODIFY COLUMN `id` bigint NOT NULL FIRST,
MODIFY COLUMN `tenant_id` bigint NOT NULL DEFAULT '0' AFTER `update_time`;
ALTER TABLE `sys_public_param`
DROP COLUMN `system`,
ADD COLUMN `create_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `validate_code`,
ADD COLUMN `update_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `create_by`,
ADD COLUMN `system_flag` char(1) CHARACTER SET utf8mb4 DEFAULT '0' AFTER `public_type`,
MODIFY COLUMN `public_id` bigint NOT NULL FIRST,
MODIFY COLUMN `tenant_id` bigint DEFAULT NULL AFTER `del_flag`;
ALTER TABLE `sys_role`
ADD COLUMN `create_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `ds_scope`,
ADD COLUMN `update_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `create_by`,
MODIFY COLUMN `role_id` bigint NOT NULL FIRST,
MODIFY COLUMN `tenant_id` bigint DEFAULT NULL AFTER `del_flag`;
ALTER TABLE `sys_role_menu`
MODIFY COLUMN `role_id` bigint NOT NULL FIRST,
MODIFY COLUMN `menu_id` bigint NOT NULL AFTER `role_id`;
ALTER TABLE `sys_route_conf`
DROP COLUMN `order`,
ADD COLUMN `sort_order` int DEFAULT '0' AFTER `uri`,
ADD COLUMN `create_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `metadata`,
ADD COLUMN `update_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `create_by`,
MODIFY COLUMN `id` bigint NOT NULL FIRST;
ALTER TABLE `sys_social_details`
ADD COLUMN `create_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `redirect_url`,
ADD COLUMN `update_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `create_by`,
MODIFY COLUMN `id` bigint NOT NULL FIRST,
MODIFY COLUMN `tenant_id` bigint NOT NULL DEFAULT '0' AFTER `del_flag`;
ALTER TABLE `sys_tenant`
ADD COLUMN `create_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `del_flag`,
ADD COLUMN `update_by` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ' ' AFTER `create_by`,
MODIFY COLUMN `id` bigint NOT NULL FIRST;
ALTER TABLE `sys_user` ADD COLUMN `nickname` VARCHAR (64) CHARACTER
SET utf8mb4 DEFAULT NULL COMMENT '拓展字段:昵称' AFTER `username`,
ADD COLUMN `name` VARCHAR (64) CHARACTER
SET utf8mb4 DEFAULT NULL COMMENT '拓展字段:姓名' AFTER `nickname`,
ADD COLUMN `email` VARCHAR (128) CHARACTER
SET utf8mb4 DEFAULT NULL COMMENT '拓展字段:邮箱' AFTER `name`,
ADD COLUMN `create_by` VARCHAR (64) CHARACTER
SET utf8 NOT NULL DEFAULT ' ' AFTER `dept_id`,
ADD COLUMN `update_by` VARCHAR (64) CHARACTER
SET utf8 NOT NULL DEFAULT ' ' AFTER `create_by`,
MODIFY COLUMN `user_id` BIGINT NOT NULL FIRST,
MODIFY COLUMN `dept_id` BIGINT DEFAULT NULL AFTER `email`,
MODIFY COLUMN `tenant_id` BIGINT NOT NULL DEFAULT '0' AFTER `osc_id`;
ALTER TABLE `sys_user_role`
MODIFY COLUMN `user_id` bigint NOT NULL FIRST,
MODIFY COLUMN `role_id` bigint NOT NULL AFTER `user_id`;
INSERT INTO `sys_menu` VALUES (6800, '标签管理', NULL, '/mp/wx-account-tag/index', 6000, 'icon-huifu', 998, '0', '0', ' ', '2020-04-27 15:25:17', ' ', '2020-05-09 03:16:16', '0', 1);
INSERT INTO `sys_menu` VALUES (6801, '新增标签', 'mp_wx_account_tag_add', NULL, 6800, NULL, 1, '0', '1', ' ', '2019-03-29 15:43:54', ' ', '2020-03-24 08:58:39', '0', 1);
INSERT INTO `sys_menu` VALUES (6802, '编辑标签', 'mp_wx_account_tag_edit', NULL, 6800, NULL, 1, '0', '1', ' ', '2019-03-29 15:43:54', ' ', '2020-03-24 08:58:39', '0', 1);
INSERT INTO `sys_menu` VALUES (6803, '删除标签', 'mp_wx_account_tag_del', NULL, 6800, NULL, 1, '0', '1', ' ', '2019-03-29 15:43:54', ' ', '2020-03-24 08:58:39', '0', 1);
INSERT INTO `sys_menu` VALUES (6804, '同步标签', 'mp_wx_account_tag_sync', NULL, 6800, NULL, 1, '0', '1', ' ', '2019-03-29 15:43:54', ' ', '2022-02-17 15:44:24', '0', 1);
INSERT INTO `sys_oauth_client_details` VALUES (7, 'social', NULL, 'social', 'server', 'password,refresh_token,mobile', NULL, NULL, NULL, NULL, '{ \"enc_flag\":\"1\",\"captcha_flag\":\"0\"}', 'true', '0', ' ', ' ', NULL, NULL, 1);
-- pigxx_ac
USE pigxx_ac;
ALTER TABLE `oa_leave_bill`
MODIFY COLUMN `leave_id` bigint NOT NULL FIRST,
MODIFY COLUMN `tenant_id` bigint DEFAULT NULL AFTER `del_flag`;
-- pigxx_codegen
USE pigxx_codegen;
ALTER TABLE `gen_datasource_conf`
DROP COLUMN `update_date`,
DROP COLUMN `create_date`,
ADD COLUMN `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP AFTER `password`,
ADD COLUMN `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER `create_time`,
MODIFY COLUMN `id` bigint NOT NULL FIRST,
MODIFY COLUMN `tenant_id` bigint DEFAULT NULL AFTER `del_flag`;
ALTER TABLE `gen_form_conf`
MODIFY COLUMN `id` bigint NOT NULL FIRST,
MODIFY COLUMN `tenant_id` bigint DEFAULT NULL AFTER `del_flag`;
-- pigxx_job
USE pigxx_job;
ALTER TABLE `sys_job`
MODIFY COLUMN `job_id` bigint NOT NULL FIRST,
MODIFY COLUMN `tenant_id` bigint DEFAULT '1' AFTER `next_time`;
ALTER TABLE `sys_job_log`
MODIFY COLUMN `job_log_id` bigint NOT NULL FIRST,
MODIFY COLUMN `job_id` bigint NOT NULL AFTER `job_log_id`,
MODIFY COLUMN `tenant_id` bigint NOT NULL DEFAULT '1' AFTER `create_time`;
-- pigxx_mp
USE pigxx_mp;
ALTER TABLE `wx_account`
MODIFY COLUMN `id` bigint NOT NULL FIRST,
MODIFY COLUMN `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP AFTER `qr_url`,
MODIFY COLUMN `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER `create_time`,
MODIFY COLUMN `tenant_id` bigint DEFAULT NULL AFTER `del_flag`;
ALTER TABLE `wx_account_fans`
ADD COLUMN `tag_ids` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL AFTER `city`,
MODIFY COLUMN `id` bigint NOT NULL FIRST,
MODIFY COLUMN `wx_account_id` bigint DEFAULT NULL AFTER `remark`,
MODIFY COLUMN `tenant_id` bigint DEFAULT NULL AFTER `del_flag`;
CREATE TABLE IF NOT EXISTS `wx_account_tag` (
`id` bigint NOT NULL,
`tag` varchar(100) CHARACTER SET utf8mb4 NOT NULL,
`create_by` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
`update_by` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
`create_time` datetime NOT NULL,
`update_time` datetime NOT NULL,
`del_flag` char(1) CHARACTER SET utf8mb4 NOT NULL,
`tenant_id` bigint NOT NULL,
`wx_account_id` bigint NOT NULL,
`wx_account_name` varchar(255) CHARACTER SET utf8mb4 NOT NULL,
`wx_account_appid` varchar(255) CHARACTER SET utf8mb4 NOT NULL,
`tag_id` bigint NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
ALTER TABLE `wx_auto_reply`
MODIFY COLUMN `id` bigint NOT NULL FIRST,
MODIFY COLUMN `tenant_id` bigint DEFAULT NULL AFTER `update_time`;
ALTER TABLE `wx_mp_menu`
MODIFY COLUMN `id` bigint NOT NULL FIRST,
MODIFY COLUMN `wx_account_id` bigint DEFAULT NULL AFTER `menu`,
MODIFY COLUMN `tenant_id` bigint DEFAULT NULL AFTER `pub_flag`;
ALTER TABLE `wx_msg`
MODIFY COLUMN `id` bigint NOT NULL FIRST,
MODIFY COLUMN `tenant_id` bigint DEFAULT NULL AFTER `update_time`;
-- pigxx_pay
USE pigxx_pay;
ALTER TABLE `pay_channel`
MODIFY COLUMN `id` bigint NOT NULL FIRST,
MODIFY COLUMN `tenant_id` bigint DEFAULT NULL AFTER `update_time`;
ALTER TABLE `pay_goods_order`
MODIFY COLUMN `goods_order_id` bigint NOT NULL FIRST,
MODIFY COLUMN `tenant_id` bigint DEFAULT NULL AFTER `update_time`;
ALTER TABLE `pay_notify_record`
MODIFY COLUMN `id` bigint NOT NULL FIRST,
MODIFY COLUMN `tenant_id` bigint DEFAULT NULL AFTER `update_time`;
ALTER TABLE `pay_refund_order`
MODIFY COLUMN `refund_order_id` bigint NOT NULL FIRST,
MODIFY COLUMN `tenant_id` bigint DEFAULT NULL AFTER `update_time`;
ALTER TABLE `pay_sequence`
MODIFY COLUMN `name` varchar(32) NOT NULL AFTER `value`;
ALTER TABLE `pay_trade_order`
MODIFY COLUMN `order_id` bigint NOT NULL FIRST,
MODIFY COLUMN `tenant_id` bigint DEFAULT NULL AFTER `del_flag`;
-- pigxx_report
USE pigxx_report;
ALTER TABLE `gaea_dict`
MODIFY COLUMN `id` bigint NOT NULL FIRST;
ALTER TABLE `gaea_dict_item`
MODIFY COLUMN `id` bigint NOT NULL FIRST;
ALTER TABLE `gaea_file`
MODIFY COLUMN `id` bigint NOT NULL FIRST;
ALTER TABLE `gaea_report`
ADD COLUMN `report_author` varchar(255) CHARACTER SET utf8 DEFAULT NULL AFTER `report_desc`,
ADD COLUMN `download_count` bigint DEFAULT NULL AFTER `report_author`,
MODIFY COLUMN `id` bigint NOT NULL FIRST;
ALTER TABLE `gaea_report_dashboard`
MODIFY COLUMN `id` bigint NOT NULL FIRST,
DROP INDEX `UNIQUE_REPORT_CODE`,
ADD UNIQUE KEY `UNIQUE_DASHBOARD_REPORT_CODE` (`report_code`);
ALTER TABLE `gaea_report_dashboard_widget`
MODIFY COLUMN `id` bigint NOT NULL FIRST;
ALTER TABLE `gaea_report_data_set`
ADD COLUMN `set_type` varchar(10) CHARACTER SET utf8 DEFAULT NULL AFTER `version`,
MODIFY COLUMN `id` bigint NOT NULL FIRST;
ALTER TABLE `gaea_report_data_set_param`
MODIFY COLUMN `id` bigint NOT NULL FIRST;
ALTER TABLE `gaea_report_data_set_transform`
MODIFY COLUMN `id` bigint NOT NULL FIRST;
ALTER TABLE `gaea_report_data_source`
MODIFY COLUMN `id` bigint NOT NULL FIRST;
ALTER TABLE `gaea_report_share`
MODIFY COLUMN `id` bigint NOT NULL FIRST;
+10 -35
View File
@@ -1,4 +1,4 @@
# 使用说明 V4.2.0
# 使用说明 V4.4.0
# 1. 使用docker-compose 宿主机不需要配置host来发现
# 2. 无需修改源码,根目录 docker-compose up 即可
# 3. 静静等待服务启动
@@ -27,21 +27,6 @@ services:
ports:
- 6379:6379
pigx-minio:
container_name: pigx-minio
image: minio/minio:RELEASE.2021-12-27T07-23-18Z.fips
command: server /data --console-address ":9001"
ports:
- 9000:9000
- 9001:9001
volumes:
- ./data:/data
- ./config:/root/.minio
environment:
- MINIO_DOMAIN=pigx-minio
- MINIO_ROOT_USER=lengleng
- MINIO_ROOT_PASSWORD=lengleng
pigx-register:
build:
context: ./pigx-register
@@ -125,15 +110,6 @@ services:
image: pigx-oa-platform
container_name: pigx-oa-platform
pigx-bi-platform:
build:
context: ./pigx-visual/pigx-bi-platform
restart: always
image: pigx-bi-platform
container_name: pigx-bi-platform
ports:
- 5006:5006
pigx-report-platform:
build:
context: ./pigx-visual/pigx-report-platform
@@ -143,6 +119,15 @@ services:
ports:
- 9095:9095
pigx-jimu-platform:
build:
context: ./pigx-visual/pigx-jimu-platform
restart: always
image: pigx-jimu-platform
container_name: pigx-jimu-platform
ports:
- 5008:5008
pigxx-job:
build:
context: ./pigx-visual/pigx-xxl-job-admin
@@ -153,16 +138,6 @@ services:
ports:
- 9080:9080
pigx-tx-manager:
build:
context: ./pigx-visual/pigx-tx-manager
restart: always
image: pigx-tx-manager
container_name: pigx-tx-manager
ports:
- 5004:5004
- 9998:9998
pigx-sentinel:
build:
context: ./pigx-visual/pigx-sentinel-dashboard
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx</artifactId>
<version>4.3.0</version>
<version>4.4.0</version>
</parent>
<artifactId>pigx-auth</artifactId>
@@ -30,9 +30,6 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.ProviderManager;
import org.springframework.security.core.userdetails.UserDetailsByNameServiceWrapper;
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;
@@ -44,11 +41,9 @@ import org.springframework.security.oauth2.provider.TokenGranter;
import org.springframework.security.oauth2.provider.code.AuthorizationCodeServices;
import org.springframework.security.oauth2.provider.token.TokenEnhancer;
import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
/**
* @author lengleng
@@ -63,8 +58,6 @@ public class AuthorizationServerConfiguration extends AuthorizationServerConfigu
private final AuthenticationManager authenticationManagerBean;
private final UserDetailsService pigxUserDetailsService;
private final AuthorizationCodeServices authorizationCodeServices;
private final AuthenticationManager authenticationManager;
@@ -124,16 +117,7 @@ public class AuthorizationServerConfiguration extends AuthorizationServerConfigu
tokenServices.setReuseRefreshToken(false);
tokenServices.setClientDetailsService(pigxClientDetailsServiceImpl);
tokenServices.setTokenEnhancer(tokenEnhancer);
addUserDetailsService(tokenServices, pigxUserDetailsService);
return tokenServices;
}
private void addUserDetailsService(PigxCustomTokenServices tokenServices, UserDetailsService userDetailsService) {
if (userDetailsService != null) {
PreAuthenticatedAuthenticationProvider provider = new PreAuthenticatedAuthenticationProvider();
provider.setPreAuthenticatedUserDetailsService(new UserDetailsByNameServiceWrapper<>(userDetailsService));
tokenServices.setAuthenticationManager(new ProviderManager(Collections.singletonList(provider)));
}
}
}
@@ -140,4 +140,15 @@ public class PigxTokenEndpoint {
return dealService.queryToken(page);
}
/**
* 查询token
* @param token
* @return
*/
@Inner
@GetMapping("/query-token")
public R queryToken(String token) {
return dealService.queryTokenInfo(token);
}
}
@@ -0,0 +1,89 @@
/*
* 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.auth.handler;
import com.pig4cloud.pigx.admin.api.feign.RemoteUserService;
import com.pig4cloud.pigx.common.core.constant.CacheConstants;
import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
import com.pig4cloud.pigx.common.core.util.KeyStrResolver;
import com.pig4cloud.pigx.common.data.resolver.ParamResolver;
import com.pig4cloud.pigx.common.security.handler.AuthenticationFailureHandler;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.concurrent.TimeUnit;
/**
* @author lengleng
* @date 2022-04-11
*
* 登录操作次数锁定功能
*/
@Slf4j
@Component
@AllArgsConstructor
public class PigxAuthenticationFailureLockEventHandler implements AuthenticationFailureHandler {
private final RedisTemplate<String, String> redisTemplate;
private final KeyStrResolver tenantKeyStrResolver;
private final RemoteUserService userService;
/**
* 密码错误超过 5 此自动锁定
* <p>
* @param authenticationException 登录的authentication 对象
* @param authentication 登录的authenticationException 对象
* @param request 请求
* @param response 响应
*/
@Async
@Override
@SneakyThrows
public void handle(AuthenticationException authenticationException, Authentication authentication,
HttpServletRequest request, HttpServletResponse response) {
// 只处理账号密码错误异常
if (!(authenticationException instanceof BadCredentialsException)) {
return;
}
String username = authentication.getName();
String key = String.format("%s:%s:%s", CacheConstants.LOGIN_ERROR_TIMES, tenantKeyStrResolver.key(), username);
Long deltaTimes = ParamResolver.getLong("LOGIN_ERROR_TIMES", 5L);
Long times = redisTemplate.opsForValue().increment(key);
// 自动过期时间
Long deltaTime = ParamResolver.getLong("DELTA_TIME", 1L);
redisTemplate.expire(key, deltaTime, TimeUnit.HOURS);
if (deltaTimes <= times) {
userService.lockUser(username, SecurityConstants.FROM_IN);
}
}
}
@@ -44,7 +44,7 @@ import javax.servlet.http.HttpServletResponse;
@Slf4j
@Component
@AllArgsConstructor
public class PigxAuthenticationFailureEventHandler implements AuthenticationFailureHandler {
public class PigxAuthenticationFailureLogEventHandler implements AuthenticationFailureHandler {
private final RemoteLogService logService;
@@ -0,0 +1,64 @@
/*
* 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.auth.handler;
import com.pig4cloud.pigx.common.core.constant.CacheConstants;
import com.pig4cloud.pigx.common.core.util.KeyStrResolver;
import com.pig4cloud.pigx.common.security.handler.AuthenticationSuccessHandler;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @author lengleng
* @date 2022-04-11
*
* 登录操作次数锁定清楚功能
*/
@Slf4j
@Component
@AllArgsConstructor
public class PigxAuthenticationSuccessLockEventHandler implements AuthenticationSuccessHandler {
private final RedisTemplate<String, String> redisTemplate;
private final KeyStrResolver tenantKeyStrResolver;
/**
* 处理登录成功方法
* <p>
* 获取到登录的authentication 对象
* @param authentication 登录对象
* @param request 请求
* @param response 返回
*/
@Async
@Override
public void handle(Authentication authentication, HttpServletRequest request, HttpServletResponse response) {
String username = authentication.getName();
String key = String.format("%s:%s:%s", CacheConstants.LOGIN_ERROR_TIMES, tenantKeyStrResolver.key(), username);
redisTemplate.delete(key);
}
}
@@ -36,12 +36,14 @@ import javax.servlet.http.HttpServletResponse;
/**
* @author lengleng
* @date 2018/10/8
* @date 2022-04-11
*
* 登录成功日志记录
*/
@Slf4j
@Component
@AllArgsConstructor
public class PigxAuthenticationSuccessEventHandler implements AuthenticationSuccessHandler {
public class PigxAuthenticationSuccessLogEventHandler implements AuthenticationSuccessHandler {
private final RemoteLogService logService;
@@ -8,6 +8,7 @@ import com.pig4cloud.pigx.common.core.constant.CacheConstants;
import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
import com.pig4cloud.pigx.common.core.util.KeyStrResolver;
import com.pig4cloud.pigx.common.core.util.R;
import com.pig4cloud.pigx.common.core.util.RetOps;
import com.pig4cloud.pigx.common.core.util.SpringContextHolder;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -26,6 +27,7 @@ import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@@ -85,10 +87,16 @@ public class PigxTokenDealServiceImpl {
* @return R
*/
public R queryTokenByUsername(Page page, String username) {
List<OAuth2AccessToken> oAuth2AccessTokenList = clientDetailsService
.listClientDetails(SecurityConstants.FROM_IN).getData().stream().map(SysOauthClientDetails::getClientId)
// @formatter:off
List<OAuth2AccessToken> oAuth2AccessTokenList =
RetOps.of(clientDetailsService.listClientDetails(SecurityConstants.FROM_IN))
.getData()
.orElseGet(Collections::emptyList)
.stream().map(SysOauthClientDetails::getClientId)
.flatMap(clientId -> tokenStore.findTokensByClientIdAndUserName(clientId, username).stream()).distinct()
.collect(Collectors.toList());
// @formatter:on
page.setRecords(oAuth2AccessTokenList);
page.setTotal(oAuth2AccessTokenList.size());
return R.ok(page);
@@ -150,4 +158,9 @@ public class PigxTokenDealServiceImpl {
return result;
}
public R queryTokenInfo(String token) {
OAuth2AccessToken oAuth2AccessToken = tokenStore.readAccessToken(token);
return R.ok(oAuth2AccessToken);
}
}
@@ -10,8 +10,7 @@ spring:
server-addr: ${NACOS_HOST:pigx-register}:${NACOS_PORT:8848}
config:
server-addr: ${spring.cloud.nacos.discovery.server-addr}
file-extension: yml
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
profiles:
active: @profiles.active@
config:
import:
- optional:nacos:application-@profiles.active@.yml
- optional:nacos:${spring.application.name}-@profiles.active@.yml
@@ -83,5 +83,6 @@
<root level="INFO">
<appender-ref ref="console"/>
<appender-ref ref="debug"/>
<appender-ref ref="error"/>
</root>
</configuration>
@@ -22,7 +22,7 @@
<#if tenantList??>
<select class="form-control form-margin-top" placeholder="所属租户" name="TENANT-ID">
<#list tenantList as tenant>
<option value="${tenant.code}">${tenant.name}</option>
<option value="${tenant.id}">${tenant.name}</option>
</#list>
</select>
</#if>
@@ -32,7 +32,7 @@
<input type="password" name="password" class="form-control" placeholder="密码" required>
<button class="btn btn-lg btn-primary btn-block" type="submit">sign in</button>
<#if error??>
<span style="color: red; ">${error}</span>
<span style="color: red; ">${error?html}</span>
</#if>
</form>
</div>
+68 -7
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>group.springframework</groupId>
<artifactId>spring-cloud-dependencies-parent</artifactId>
<version>2021.0.1</version>
<version>2021.0.2</version>
<relativePath/>
</parent>
@@ -17,16 +17,17 @@
<description>pigx 公共版本控制</description>
<properties>
<pigx.version>4.3.0</pigx.version>
<pigx.version>4.4.0</pigx.version>
<mybatis-plus.version>3.5.1</mybatis-plus.version>
<dynamic-ds.version>3.4.1</dynamic-ds.version>
<druid.version>1.2.8</druid.version>
<hutool.version>5.7.21</hutool.version>
<mysql.connector.version>8.0.27</mysql.connector.version>
<druid.version>1.2.9</druid.version>
<hutool.version>5.8.0</hutool.version>
<mysql.connector.version>8.0.29</mysql.connector.version>
<oracle.version>21.3.0.0</oracle.version>
<sqlserver.version>8.4.1.jre8</sqlserver.version>
<dm.version>8.1.2.79</dm.version>
<swagger.core.version>1.5.22</swagger.core.version>
<mp.weixin.version>4.2.0</mp.weixin.version>
<mp.weixin.version>4.3.0</mp.weixin.version>
<ijpay.version>2.8.0</ijpay.version>
<groovy.version>3.0.3</groovy.version>
<jsoup.version>1.13.1</jsoup.version>
@@ -35,10 +36,13 @@
<xxl.job.version>2.3.0</xxl.job.version>
<aliyun.version>3.0.52.ALL</aliyun.version>
<aws.version>1.11.543</aws.version>
<seata.version>1.4.2</seata.version>
<asm.version>7.1</asm.version>
<log4j2.version>2.17.1</log4j2.version>
<javaformat.plugin.version>0.0.23</javaformat.plugin.version>
<docker.plugin.version>0.33.0</docker.plugin.version>
<cloud.plugin.version>1.0.0</cloud.plugin.version>
<sentinel.version>1.8.4</sentinel.version>
</properties>
<dependencyManagement>
@@ -115,7 +119,7 @@
</dependency>
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common-transaction</artifactId>
<artifactId>pigx-common-seata</artifactId>
<version>${pigx.version}</version>
</dependency>
<dependency>
@@ -143,6 +147,17 @@
<artifactId>pigx-upms-api</artifactId>
<version>${pigx.version}</version>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>${asm.version}</version>
</dependency>
<!-- seata kryo 序列化-->
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-serializer-kryo</artifactId>
<version>${seata.version}</version>
</dependency>
<!--mybatis plus extension,包含了mybatis plus core-->
<dependency>
<groupId>com.baomidou</groupId>
@@ -189,6 +204,12 @@
<artifactId>mssql-jdbc</artifactId>
<version>${sqlserver.version}</version>
</dependency>
<!--DM8-->
<dependency>
<groupId>com.dameng</groupId>
<artifactId>DmJdbcDriver18</artifactId>
<version>${dm.version}</version>
</dependency>
<!--fastjson-->
<dependency>
<groupId>com.alibaba</groupId>
@@ -212,6 +233,11 @@
<artifactId>weixin-java-mp</artifactId>
<version>${mp.weixin.version}</version>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-cp</artifactId>
<version>${mp.weixin.version}</version>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-common</artifactId>
@@ -267,6 +293,41 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-core</artifactId>
<version>${sentinel.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-web-servlet</artifactId>
<version>${sentinel.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-transport-simple-http</artifactId>
<version>${sentinel.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-parameter-flow-control</artifactId>
<version>${sentinel.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-api-gateway-adapter-common</artifactId>
<version>${sentinel.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>4.3.0</version>
<version>4.4.0</version>
</parent>
<artifactId>pigx-common-core</artifactId>
@@ -95,4 +95,9 @@ public interface CacheConstants {
*/
String CLIENT_FLAG = "client_config_flag";
/**
* 登录错误次数
*/
String LOGIN_ERROR_TIMES = "login_error_times";
}
@@ -70,6 +70,11 @@ public interface CommonConstants {
*/
String FRONT_END_PROJECT = "pigx-ui";
/**
* 移动端工程名
*/
String UNI_END_PROJECT = "pigx-app";
/**
* 后端工程名
*/
@@ -139,6 +139,31 @@ public interface SecurityConstants {
*/
String OSC_USER_INFO_URL = "https://www.oschina.net/action/openapi/user?access_token=%s&dataType=json";
/**
* 钉钉获取 token
*/
String DING_OLD_GET_TOKEN = "https://oapi.dingtalk.com/gettoken";
/**
* 钉钉同步角色列表
*/
String DING_OLD_ROLE_URL = "https://oapi.dingtalk.com/topapi/role/list";
/**
* 钉钉同步部门列表
*/
String DING_OLD_DEPT_URL = "https://oapi.dingtalk.com/topapi/v2/department/listsub";
/**
* 钉钉部门用户id列表
*/
String DING_DEPT_USERIDS_URL = "https://oapi.dingtalk.com/topapi/user/listid";
/**
* 钉钉用户详情
*/
String DING_USER_INFO_URL = "https://oapi.dingtalk.com/topapi/v2/user/get";
/**
* {bcrypt} 加密的特征码
*/
@@ -63,6 +63,15 @@ public enum LoginTypeEnum {
*/
OSC("OSC", "开源中国登录"),
/**
* 钉钉
*/
DINGTALK("DINGTALK", "钉钉"),
/**
* 企业微信
*/
WEIXIN_CP("WEIXIN_CP", "企业微信"),
/**
* CAS 登录
*/
@@ -21,7 +21,12 @@ public enum StyleTypeEnum {
/**
* 前端类型-element 风格
*/
ELEMENT("1", "element 风格");
ELEMENT("1", "element 风格"),
/**
* 前端风格-uview 风格
*/
UVIEW("2", "uview 风格");
/**
* 类型
@@ -0,0 +1,103 @@
package com.pig4cloud.pigx.common.core.exception;
/**
* 错误编码
*
* @author lengleng
* @date 2022/3/30
*/
public interface ErrorCodes {
/**
* 系统编码错误
*/
String SYS_PARAM_CONFIG_ERROR = "sys.param.config.error";
/**
* 系统内置参数不能删除
*/
String SYS_PARAM_DELETE_SYSTEM = "sys.param.delete.system";
/**
* 用户已存在
*/
String SYS_USER_USERNAME_EXISTING = "sys.user.username.existing";
/**
* 用户原密码错误,修改失败
*/
String SYS_USER_UPDATE_PASSWORDERROR = "sys.user.update.passwordError";
/**
* 用户信息为空
*/
String SYS_USER_USERINFO_EMPTY = "sys.user.userInfo.empty";
/**
* 获取当前用户信息失败
*/
String SYS_USER_QUERY_ERROR = "sys.user.query.error";
String SYS_USER_IMPORT_SUCCEED = "sys.user.import.succeed";
/**
* 部门名称不存在
*/
String SYS_DEPT_DEPTNAME_INEXISTENCE = "sys.dept.deptName.inexistence";
/**
* 岗位名称不存在
*/
String SYS_POST_POSTNAME_INEXISTENCE = "sys.post.postName.inexistence";
/**
* 岗位名称或编码已经存在
*/
String SYS_POST_NAMEORCODE_EXISTING = "sys.post.nameOrCode.existing";
/**
* 角色名称不存在
*/
String SYS_ROLE_ROLENAME_INEXISTENCE = "sys.role.roleName.inexistence";
/**
* 角色名或角色编码已经存在
*/
String SYS_ROLE_NAMEORCODE_EXISTING = "sys.role.nameOrCode.existing";
/**
* 菜单存在下级节点 删除失败
*/
String SYS_MENU_DELETE_EXISTING = "sys.menu.delete.existing";
/**
* 系统内置字典不允许删除
*/
String SYS_DICT_DELETE_SYSTEM = "sys.dict.delete.system";
/**
* 系统内置字典不能修改
*/
String SYS_DICT_UPDATE_SYSTEM = "sys.dict.update.system";
/**
* 验证码发送频繁
*/
String SYS_APP_SMS_OFTEN = "sys.app.sms.often";
/**
* 手机号未注册
*/
String SYS_APP_PHONE_UNREGISTERED = "sys.app.phone.unregistered";
/**
* 企微调用接口错误
*/
String SYS_CONNECT_CP_DEPT_SYNC_ERROR = "sys.connect.cp.dept.sync.error";
/**
* 企微调用接口错误
*/
String SYS_CONNECT_CP_USER_SYNC_ERROR = "sys.connect.cp.user.sync.error";
}
@@ -0,0 +1,44 @@
package com.pig4cloud.pigx.common.core.factory;
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
import org.springframework.core.env.PropertiesPropertySource;
import org.springframework.core.env.PropertySource;
import org.springframework.core.io.support.EncodedResource;
import org.springframework.core.io.support.PropertySourceFactory;
import org.springframework.lang.Nullable;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
/**
* @author lengleng
* @date 2022/3/29
* <p>
* 读取自定义 yaml 文件工厂类
*/
public class YamlPropertySourceFactory implements PropertySourceFactory {
@Override
public PropertySource<?> createPropertySource(@Nullable String name, EncodedResource resource) throws IOException {
Properties propertiesFromYaml = loadYamlIntoProperties(resource);
String sourceName = name != null ? name : resource.getResource().getFilename();
return new PropertiesPropertySource(sourceName, propertiesFromYaml);
}
private Properties loadYamlIntoProperties(EncodedResource resource) throws FileNotFoundException {
try {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResources(resource.getResource());
factory.afterPropertiesSet();
return factory.getObject();
}
catch (IllegalStateException e) {
Throwable cause = e.getCause();
if (cause instanceof FileNotFoundException)
throw (FileNotFoundException) e.getCause();
throw e;
}
}
}
@@ -0,0 +1,37 @@
package com.pig4cloud.pigx.common.core.util;
import lombok.experimental.UtilityClass;
import org.springframework.context.MessageSource;
import java.util.Locale;
/**
* i18n 工具类
*
* @author lengleng
* @date 2022/3/30
*/
@UtilityClass
public class MsgUtils {
/**
* 通过code 获取中文错误信息
* @param code
* @return
*/
public String getMessage(String code) {
MessageSource messageSource = SpringContextHolder.getBean("messageSource");
return messageSource.getMessage(code, null, Locale.CHINA);
}
/**
* 通过code 和参数获取中文错误信息
* @param code
* @return
*/
public String getMessage(String code, Object... objects) {
MessageSource messageSource = SpringContextHolder.getBean("messageSource");
return messageSource.getMessage(code, objects, Locale.CHINA);
}
}
@@ -86,7 +86,7 @@ public class R<T> implements Serializable {
return restResult(data, CommonConstants.FAIL, msg);
}
private static <T> R<T> restResult(T data, int code, String msg) {
static <T> R<T> restResult(T data, int code, String msg) {
R<T> apiResult = new R<>();
apiResult.setCode(code);
apiResult.setData(data);
@@ -0,0 +1,289 @@
/*
*
* 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.core.util;
import cn.hutool.core.util.ObjectUtil;
import com.pig4cloud.pigx.common.core.constant.CommonConstants;
import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
/**
* 简化{@code R<T>} 的访问操作,例子 <pre>
* R<Integer> result = R.ok(0);
* // 使用场景1: 链式操作: 断言然后消费
* RetOps.of(result)
* .assertCode(-1,r -> new RuntimeException("error "+r.getCode()))
* .assertDataNotEmpty(r -> new IllegalStateException("oops!"))
* .useData(System.out::println);
*
* // 使用场景2: 读取原始值(data),这里返回的是Optional
* RetOps.of(result).getData().orElse(null);
*
* // 使用场景3: 类型转换
* R<String> s = RetOps.of(result)
* .assertDataNotNull(r -> new IllegalStateException("nani??"))
* .map(i -> Integer.toHexString(i))
* .peek();
* </pre>
*
* @author CJ (power4j@outlook.com)
* @date 2022/5/12
* @since 4.4
*/
public class RetOps<T> {
/** 状态码为成功 */
public static final Predicate<R<?>> CODE_SUCCESS = r -> CommonConstants.SUCCESS == r.getCode();
/** 数据有值 */
public static final Predicate<R<?>> HAS_DATA = r -> ObjectUtil.isNotEmpty(r.getData());
/** 数据有值,并且包含元素 */
public static final Predicate<R<?>> HAS_ELEMENT = r -> ObjectUtil.isNotEmpty(r.getData());
/** 状态码为成功并且有值 */
public static final Predicate<R<?>> DATA_AVAILABLE = CODE_SUCCESS.and(HAS_DATA);
private final R<T> original;
// ~ 初始化
// ===================================================================================================
RetOps(R<T> original) {
this.original = original;
}
public static <T> RetOps<T> of(R<T> original) {
return new RetOps<>(Objects.requireNonNull(original));
}
// ~ 杂项方法
// ===================================================================================================
/**
* 观察原始值
* @return R
*/
public R<T> peek() {
return original;
}
/**
* 读取{@code code}的值
* @return 返回code的值
*/
public int getCode() {
return original.getCode();
}
/**
* 读取{@code data}的值
* @return 返回 Optional 包装的data
*/
public Optional<T> getData() {
return Optional.of(original.getData());
}
/**
* 有条件地读取{@code data}的值
* @param predicate 断言函数
* @return 返回 Optional 包装的data,如果断言失败返回empty
*/
public Optional<T> getDataIf(Predicate<? super R<?>> predicate) {
return predicate.test(original) ? getData() : Optional.empty();
}
/**
* 读取{@code msg}的值
* @return 返回Optional包装的 msg
*/
public Optional<String> getMsg() {
return Optional.of(original.getMsg());
}
/**
* 对{@code code}的值进行相等性测试
* @param value 基准值
* @return 返回ture表示相等
*/
public boolean codeEquals(int value) {
return original.getCode() == value;
}
/**
* 对{@code code}的值进行相等性测试
* @param value 基准值
* @return 返回ture表示不相等
*/
public boolean codeNotEquals(int value) {
return !codeEquals(value);
}
/**
* 是否成功
* @return 返回ture表示成功
* @see CommonConstants#SUCCESS
*/
public boolean isSuccess() {
return codeEquals(CommonConstants.SUCCESS);
}
/**
* 是否失败
* @return 返回ture表示失败
*/
public boolean notSuccess() {
return !isSuccess();
}
// ~ 链式操作
// ===================================================================================================
/**
* 断言{@code code}的值
* @param expect 预期的值
* @param func 用户函数,负责创建异常对象
* @param <Ex> 异常类型
* @return 返回实例,以便于继续进行链式操作
* @throws Ex 断言失败时抛出
*/
public <Ex extends Exception> RetOps<T> assertCode(int expect, Function<? super R<T>, ? extends Ex> func)
throws Ex {
if (codeNotEquals(expect)) {
throw func.apply(original);
}
return this;
}
/**
* 断言成功
* @param func 用户函数,负责创建异常对象
* @param <Ex> 异常类型
* @return 返回实例,以便于继续进行链式操作
* @throws Ex 断言失败时抛出
*/
public <Ex extends Exception> RetOps<T> assertSuccess(Function<? super R<T>, ? extends Ex> func) throws Ex {
return assertCode(CommonConstants.SUCCESS, func);
}
/**
* 断言业务数据有值
* @param func 用户函数,负责创建异常对象
* @param <Ex> 异常类型
* @return 返回实例,以便于继续进行链式操作
* @throws Ex 断言失败时抛出
*/
public <Ex extends Exception> RetOps<T> assertDataNotNull(Function<? super R<T>, ? extends Ex> func) throws Ex {
if (Objects.isNull(original.getData())) {
throw func.apply(original);
}
return this;
}
/**
* 断言业务数据有值,并且包含元素
* @param func 用户函数,负责创建异常对象
* @param <Ex> 异常类型
* @return 返回实例,以便于继续进行链式操作
* @throws Ex 断言失败时抛出
*/
public <Ex extends Exception> RetOps<T> assertDataNotEmpty(Function<? super R<T>, ? extends Ex> func) throws Ex {
if (ObjectUtil.isNotEmpty(original.getData())) {
throw func.apply(original);
}
return this;
}
/**
* 对业务数据(data)转换
* @param mapper 业务数据转换函数
* @param <U> 数据类型
* @return 返回新实例,以便于继续进行链式操作
*/
public <U> RetOps<U> map(Function<? super T, ? extends U> mapper) {
R<U> result = R.restResult(mapper.apply(original.getData()), original.getCode(), original.getMsg());
return of(result);
}
/**
* 对业务数据(data)转换
* @param predicate 断言函数
* @param mapper 业务数据转换函数
* @param <U> 数据类型
* @return 返回新实例,以便于继续进行链式操作
* @see RetOps#CODE_SUCCESS
* @see RetOps#HAS_DATA
* @see RetOps#HAS_ELEMENT
* @see RetOps#DATA_AVAILABLE
*/
public <U> RetOps<U> mapIf(Predicate<? super R<T>> predicate, Function<? super T, ? extends U> mapper) {
R<U> result = R.restResult(mapper.apply(original.getData()), original.getCode(), original.getMsg());
return of(result);
}
// ~ 数据消费
// ===================================================================================================
/**
* 消费数据,注意此方法保证数据可用
* @param consumer 消费函数
*/
public void useData(Consumer<? super T> consumer) {
consumer.accept(original.getData());
}
/**
* 条件消费(错误代码匹配某个值)
* @param consumer 消费函数
* @param codes 错误代码集合,匹配任意一个则调用消费函数
*/
public void useDataOnCode(Consumer<? super T> consumer, int... codes) {
useDataIf(o -> Arrays.stream(codes).filter(c -> original.getCode() == c).findFirst().isPresent(), consumer);
}
/**
* 条件消费(错误代码表示成功)
* @param consumer 消费函数
*/
public void useDataIfSuccess(Consumer<? super T> consumer) {
useDataIf(CODE_SUCCESS, consumer);
}
/**
* 条件消费
* @param predicate 断言函数
* @param consumer 消费函数,断言函数返回{@code true}时被调用
* @see RetOps#CODE_SUCCESS
* @see RetOps#HAS_DATA
* @see RetOps#HAS_ELEMENT
* @see RetOps#DATA_AVAILABLE
*/
public void useDataIf(Predicate<? super R<T>> predicate, Consumer<? super T> consumer) {
if (predicate.test(original)) {
consumer.accept(original.getData());
}
}
}
@@ -0,0 +1,31 @@
package com.pig4cloud.pigx.common.core.util;
/**
* 校验类型
*
* @author lengleng
* @date 2022/4/26
*/
public class ValidGroup {
/**
* 插入组
*
* @author lengleng
* @date 2022/4/26
*/
public static interface Insert {
}
/**
* 编辑组
*
* @author lengleng
* @date 2022/4/26
*/
public static interface Update {
}
}
@@ -0,0 +1,19 @@
sys.user.update.passwordError=\u539F\u5BC6\u7801\u9519\u8BEF\uFF0C\u4FEE\u6539\u5931\u8D25
sys.user.query.error=\u83B7\u53D6\u5F53\u524D\u7528\u6237\u4FE1\u606F\u5931\u8D25
sys.user.import.succeed=\u7528\u6237\u5BFC\u5165\u6210\u529F\uFF0C\u9ED8\u8BA4\u5BC6\u7801\u4E3A\u624B\u673A\u53F7
sys.user.username.existing={0} \u7528\u6237\u540D\u5DF2\u5B58\u5728
sys.user.userInfo.empty={0} \u7528\u6237\u4FE1\u606F\u4E3A\u7A7A
sys.dept.deptName.inexistence={0} \u90E8\u95E8\u540D\u79F0\u4E0D\u5B58\u5728
sys.post.postName.inexistence={0} \u5C97\u4F4D\u540D\u79F0\u4E0D\u5B58\u5728
sys.post.nameOrCode.existing={0} {1} \u5C97\u4F4D\u540D\u6216\u5C97\u4F4D\u7F16\u7801\u5DF2\u7ECF\u5B58\u5728
sys.role.roleName.inexistence={0} \u89D2\u8272\u540D\u79F0\u4E0D\u5B58\u5728
sys.role.nameOrCode.existing={0} {1} \u89D2\u8272\u540D\u6216\u89D2\u8272\u7F16\u7801\u5DF2\u7ECF\u5B58\u5728
sys.param.delete.system=\u7CFB\u7EDF\u5185\u7F6E\u53C2\u6570\u4E0D\u80FD\u5220\u9664
sys.param.config.error={0} \u7CFB\u7EDF\u53C2\u6570\u914D\u7F6E\u9519\u8BEF
sys.menu.delete.existing=\u83DC\u5355\u542B\u6709\u4E0B\u7EA7\u4E0D\u80FD\u5220\u9664
sys.app.sms.often=\u9A8C\u8BC1\u7801\u53D1\u9001\u8FC7\u9891\u7E41
sys.app.phone.unregistered={0} \u624B\u673A\u53F7\u672A\u6CE8\u518C
sys.dict.delete.system=\u7CFB\u7EDF\u5185\u7F6E\u5B57\u5178\u9879\u76EE\u4E0D\u80FD\u5220\u9664
sys.dict.update.system=\u7CFB\u7EDF\u5185\u7F6E\u5B57\u5178\u9879\u76EE\u4E0D\u80FD\u4FEE\u6539
sys.connect.cp.dept.sync.error=\u83B7\u53D6\u4F01\u4E1A\u5FAE\u4FE1\u90E8\u95E8\u5217\u8868\u5931\u8D25
sys.connect.cp.user.sync.error=\u83B7\u53D6\u4F01\u4E1A\u5FAE\u4FE1\u7528\u6237\u5217\u8868\u5931\u8D25
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>4.3.0</version>
<version>4.4.0</version>
</parent>
<artifactId>pigx-common-data</artifactId>
@@ -56,4 +56,31 @@ public class DataScope extends HashMap {
*/
private DataScopeFuncEnum func = DataScopeFuncEnum.ALL;
/**
* of 获取实例
*/
public static DataScope of() {
return new DataScope();
}
public DataScope scopeName(String scopeName) {
this.scopeName = scopeName;
return this;
}
public DataScope deptIds(List<Long> deptIds) {
this.deptIds = deptIds;
return this;
}
public DataScope only(boolean isOnly) {
this.isOnly = isOnly;
return this;
}
public DataScope func(DataScopeFuncEnum func) {
this.func = func;
return this;
}
}
@@ -23,12 +23,14 @@ import com.pig4cloud.pigx.admin.api.entity.SysDeptRelation;
import com.pig4cloud.pigx.admin.api.entity.SysRole;
import com.pig4cloud.pigx.admin.api.feign.RemoteDataScopeService;
import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
import com.pig4cloud.pigx.common.core.util.RetOps;
import com.pig4cloud.pigx.common.security.service.PigxUser;
import com.pig4cloud.pigx.common.security.util.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.GrantedAuthority;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
@@ -59,8 +61,13 @@ public class PigxDefaultDatascopeHandle implements DataScopeHandle {
if (CollectionUtil.isEmpty(roleIdList)) {
return false;
}
SysRole role = dataScopeService.getRoleList(roleIdList).getData().stream()
// @formatter:off
SysRole role = RetOps.of(dataScopeService.getRoleList(roleIdList))
.getData()
.orElseGet(Collections::emptyList)
.stream()
.min(Comparator.comparingInt(SysRole::getDsType)).orElse(null);
// @formatter:on
// 角色有可能已经删除了
if (role == null) {
return false;
@@ -78,8 +85,13 @@ public class PigxDefaultDatascopeHandle implements DataScopeHandle {
}
// 查询本级及其下级
if (DataScopeTypeEnum.OWN_CHILD_LEVEL.getType() == dsType) {
List<Long> deptIdList = dataScopeService.getDescendantList(user.getDeptId()).getData().stream()
// @formatter:off
List<Long> deptIdList = RetOps.of(dataScopeService.getDescendantList(user.getDeptId()))
.getData()
.orElseGet(Collections::emptyList)
.stream()
.map(SysDeptRelation::getDescendant).collect(Collectors.toList());
// @formatter:on
deptList.addAll(deptIdList);
}
// 只查询本级
@@ -14,6 +14,10 @@ import org.apache.ibatis.mapping.SqlSource;
*/
public class SelectCountByScope extends AbstractMethod {
public SelectCountByScope() {
super("selectCountByScope");
}
@Override
public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {
SqlMethod sqlMethod = SqlMethod.SELECT_LIST;
@@ -23,7 +27,7 @@ public class SelectCountByScope extends AbstractMethod {
this.sqlComment());
SqlSource sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass);
return this.addSelectMappedStatementForOther(mapperClass, "selectCountByScope", sqlSource, Integer.class);
return this.addSelectMappedStatementForOther(mapperClass, sqlSource, Long.class);
}
}
@@ -12,6 +12,10 @@ import org.apache.ibatis.mapping.SqlSource;
*/
public class SelectListByScope extends AbstractMethod {
public SelectListByScope() {
super("selectListByScope");
}
@Override
public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {
SqlMethod sqlMethod = SqlMethod.SELECT_LIST;
@@ -19,7 +23,7 @@ public class SelectListByScope extends AbstractMethod {
tableInfo.getTableName(), this.sqlWhereEntityWrapper(true, tableInfo), this.sqlOrderBy(tableInfo),
this.sqlComment());
SqlSource sqlSource = this.languageDriver.createSqlSource(this.configuration, sql, modelClass);
return this.addSelectMappedStatementForTable(mapperClass, "selectListByScope", sqlSource, tableInfo);
return this.addSelectMappedStatementForTable(mapperClass, sqlSource, tableInfo);
}
}
@@ -12,6 +12,10 @@ import org.apache.ibatis.mapping.SqlSource;
*/
public class SelectPageByScope extends AbstractMethod {
public SelectPageByScope() {
super("selectPageByScope");
}
@Override
public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {
SqlMethod sqlMethod = SqlMethod.SELECT_PAGE;
@@ -19,7 +23,7 @@ public class SelectPageByScope extends AbstractMethod {
tableInfo.getTableName(), this.sqlWhereEntityWrapper(true, tableInfo), this.sqlOrderBy(tableInfo),
this.sqlComment());
SqlSource sqlSource = this.languageDriver.createSqlSource(this.configuration, sql, modelClass);
return this.addSelectMappedStatementForTable(mapperClass, "selectPageByScope", sqlSource, tableInfo);
return this.addSelectMappedStatementForTable(mapperClass, sqlSource, tableInfo);
}
}
@@ -29,6 +29,8 @@ import com.pig4cloud.pigx.common.data.datascope.PigxDefaultDatascopeHandle;
import com.pig4cloud.pigx.common.data.resolver.SqlFilterArgumentResolver;
import com.pig4cloud.pigx.common.data.tenant.PigxTenantHandler;
import com.pig4cloud.pigx.common.security.service.PigxUser;
import org.apache.ibatis.mapping.DatabaseIdProvider;
import org.apache.ibatis.mapping.VendorDatabaseIdProvider;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
@@ -42,6 +44,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import javax.sql.DataSource;
import java.util.List;
import java.util.Properties;
/**
* @author lengleng
@@ -133,4 +136,17 @@ public class MybatisPlusConfiguration implements WebMvcConfigurer {
return new MybatisPlusMetaObjectHandler();
}
/**
* 数据库方言配置
* @return
*/
@Bean
public DatabaseIdProvider databaseIdProvider() {
VendorDatabaseIdProvider databaseIdProvider = new VendorDatabaseIdProvider();
Properties properties = new Properties();
properties.setProperty("SQL Server", "mssql");
databaseIdProvider.setProperties(properties);
return databaseIdProvider;
}
}
@@ -0,0 +1,99 @@
package com.pig4cloud.pigx.common.data.resolver;
import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.pig4cloud.pigx.admin.api.entity.SysDictItem;
import com.pig4cloud.pigx.admin.api.feign.RemoteDictService;
import com.pig4cloud.pigx.common.core.util.SpringContextHolder;
import lombok.experimental.UtilityClass;
import java.util.List;
/**
* @author fxz
* @date 2022/3/24 字典解析器
*/
@UtilityClass
public class DictResolver {
/**
* 根据字典类型获取所有字典项
* @param type 字典类型
* @return 字典数据项集合
*/
public List<SysDictItem> getDictItemsByType(String type) {
Assert.isTrue(StringUtils.isNotBlank(type), "参数不合法");
RemoteDictService remoteDictService = SpringContextHolder.getBean(RemoteDictService.class);
return remoteDictService.getDictByType(type).getData();
}
/**
* 根据字典类型以及字典项字典值获取字典标签
* @param type 字典类型
* @param itemValue 字典项字典值
* @return 字典项标签值
*/
public String getDictItemLabel(String type, String itemValue) {
Assert.isTrue(StringUtils.isNotBlank(type) && StringUtils.isNotBlank(itemValue), "参数不合法");
SysDictItem sysDictItem = getDictItemByItemValue(type, itemValue);
return ObjectUtils.isNotEmpty(sysDictItem) ? sysDictItem.getLabel() : StringPool.EMPTY;
}
/**
* 根据字典类型以及字典标签获取字典值
* @param type 字典类型
* @param itemLabel 字典数据标签
* @return 字典数据项值
*/
public String getDictItemValue(String type, String itemLabel) {
Assert.isTrue(StringUtils.isNotBlank(type) && StringUtils.isNotBlank(itemLabel), "参数不合法");
SysDictItem sysDictItem = getDictItemByItemLabel(type, itemLabel);
return ObjectUtils.isNotEmpty(sysDictItem) ? sysDictItem.getItemValue() : StringPool.EMPTY;
}
/**
* 根据字典类型以及字典值获取字典项
* @param type 字典类型
* @param itemValue 字典数据值
* @return 字典数据项
*/
public SysDictItem getDictItemByItemValue(String type, String itemValue) {
Assert.isTrue(StringUtils.isNotBlank(type) && StringUtils.isNotBlank(itemValue), "参数不合法");
List<SysDictItem> dictItemList = getDictItemsByType(type);
if (CollectionUtils.isNotEmpty(dictItemList)) {
return dictItemList.stream().filter(item -> itemValue.equals(item.getItemValue())).findFirst().orElse(null);
}
return null;
}
/**
* 根据字典类型以及字典标签获取字典项
* @param type 字典类型
* @param itemLabel 字典数据项标签
* @return 字典数据项
*/
public SysDictItem getDictItemByItemLabel(String type, String itemLabel) {
Assert.isTrue(StringUtils.isNotBlank(type) && StringUtils.isNotBlank(itemLabel), "参数不合法");
List<SysDictItem> dictItemList = getDictItemsByType(type);
if (CollectionUtils.isNotEmpty(dictItemList)) {
return dictItemList.stream().filter(item -> itemLabel.equals(item.getLabel())).findFirst().orElse(null);
}
return null;
}
}
@@ -107,14 +107,7 @@ public class SqlFilterArgumentResolver implements HandlerMethodArgumentResolver
* @return Predicate
*/
private Predicate<String> sqlInjectPredicate() {
return sql -> {
for (String keyword : KEYWORDS) {
if (StrUtil.containsIgnoreCase(sql, keyword)) {
return false;
}
}
return true;
};
return sql -> Arrays.stream(KEYWORDS).noneMatch(keyword -> StrUtil.containsIgnoreCase(sql, keyword));
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<artifactId>pigx-common</artifactId>
<groupId>com.pig4cloud</groupId>
<version>4.3.0</version>
<version>4.4.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -42,7 +42,12 @@ public enum DsJdbcUrlEnum {
/**
* db2
*/
DB2("db2", "jdbc:db2://%s:%s/%s", "select 1 from sysibm.sysdummy1", "DB2 TYPE4 连接");
DB2("db2", "jdbc:db2://%s:%s/%s", "select 1 from sysibm.sysdummy1", "DB2 TYPE4 连接"),
/**
* 达梦
*/
DM("dm", "jdbc:dm://%s:%s/%s", "select 1 from dual", "达梦连接");
private final String dbName;
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>4.3.0</version>
<version>4.4.0</version>
</parent>
<artifactId>pigx-common-excel</artifactId>
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>4.3.0</version>
<version>4.4.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>4.3.0</version>
<version>4.4.0</version>
</parent>
<artifactId>pigx-common-gateway</artifactId>
@@ -1,2 +0,0 @@
org.springframework.boot.diagnostics.FailureAnalyzer=\
com.pig4cloud.pigx.common.gateway.exception.RouteCheckFailureAnalyzer
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>4.3.0</version>
<version>4.4.0</version>
</parent>
<artifactId>pigx-common-gray</artifactId>
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>4.3.0</version>
<version>4.4.0</version>
</parent>
<artifactId>pigx-common-idempotent</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>4.3.0</version>
<version>4.4.0</version>
</parent>
<artifactId>pigx-common-job</artifactId>
@@ -28,9 +28,9 @@ public class XxlExecutorProperties {
private String ip;
/**
* 执行器端口号 [选填]:小于等于0则自动获取;默认端口为9999,单机部署多个执行器时,注意要配置不同执行器端口;
* 执行器端口号 [选填]:小于等于0则自动获取;默认端口为9099,单机部署多个执行器时,注意要配置不同执行器端口;
*/
private Integer port = 0;
private Integer port = 9099;
/**
* 执行器通讯TOKEN [选填]:非空时启用;
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>4.3.0</version>
<version>4.4.0</version>
</parent>
<artifactId>pigx-common-log</artifactId>
@@ -19,6 +19,7 @@
package com.pig4cloud.pigx.common.log.aspect;
import cn.hutool.core.util.StrUtil;
import com.pig4cloud.pigx.admin.api.dto.SysLogDTO;
import com.pig4cloud.pigx.common.core.util.KeyStrResolver;
import com.pig4cloud.pigx.common.log.annotation.SysLog;
@@ -31,7 +32,9 @@ import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.expression.EvaluationContext;
/**
* 操作日志使用spring event异步入库
@@ -54,8 +57,16 @@ public class SysLogAspect {
String strMethodName = point.getSignature().getName();
log.debug("[类名]:{},[方法]:{}", strClassName, strMethodName);
String value = sysLog.value();
if (StrUtil.contains(value, "#")) {
// 解析SPEL
MethodSignature signature = (MethodSignature) point.getSignature();
EvaluationContext context = SysLogUtils.getContext(point.getArgs(), signature.getMethod());
value = SysLogUtils.getValue(context, value, String.class);
}
SysLogDTO logDTO = SysLogUtils.getSysLog();
logDTO.setTitle(sysLog.value());
logDTO.setTitle(value);
// 发送异步日志事件
Long startTime = System.currentTimeMillis();
Object obj;
@@ -24,6 +24,11 @@ import cn.hutool.extra.servlet.ServletUtil;
import cn.hutool.http.HttpUtil;
import com.pig4cloud.pigx.admin.api.dto.SysLogDTO;
import lombok.experimental.UtilityClass;
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.Expression;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
@@ -31,6 +36,7 @@ import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method;
import java.util.Objects;
/**
@@ -94,4 +100,36 @@ public class SysLogUtils {
return authentication.getName();
}
/**
* 获取spel 定义的参数值
* @param context 参数容器
* @param key key
* @param clazz 需要返回的类型
* @param <T> 返回泛型
* @return 参数值
*/
public <T> T getValue(EvaluationContext context, String key, Class<T> clazz) {
SpelExpressionParser spelExpressionParser = new SpelExpressionParser();
Expression expression = spelExpressionParser.parseExpression(key);
return expression.getValue(context, clazz);
}
/**
* 获取参数容器
* @param arguments 方法的参数列表
* @param signatureMethod 被执行的方法体
* @return 装载参数的容器
*/
public EvaluationContext getContext(Object[] arguments, Method signatureMethod) {
String[] parameterNames = new LocalVariableTableParameterNameDiscoverer().getParameterNames(signatureMethod);
EvaluationContext context = new StandardEvaluationContext();
if (parameterNames == null) {
return context;
}
for (int i = 0; i < arguments.length; i++) {
context.setVariable(parameterNames[i], arguments[i]);
}
return context;
}
}
+22 -18
View File
@@ -1,24 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>4.3.0</version>
</parent>
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>4.4.0</version>
</parent>
<artifactId>pigx-common-oss</artifactId>
<packaging>jar</packaging>
<artifactId>pigx-common-oss</artifactId>
<packaging>jar</packaging>
<description>pigx 文件系统依赖</description>
<description>pigx 文件系统依赖</description>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>${aws.version}</version>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>${aws.version}</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId>
</dependency>
</dependencies>
</project>
@@ -15,43 +15,22 @@
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pigx.manager.model;
package com.pig4cloud.pigx.common.file;
import com.pig4cloud.pigx.common.file.core.FileProperties;
import com.pig4cloud.pigx.common.file.local.LocalFileAutoConfiguration;
import com.pig4cloud.pigx.common.file.oss.OssAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Import;
/**
* 负载均衡模块信息
* aws 自动配置类
*
* @author LCN on 2017/12/5
* @author lengleng
* @author 858695266
*/
public class LoadBalanceInfo {
private String groupId;
private String key;
private String data;
public String getGroupId() {
return groupId;
}
public void setGroupId(String groupId) {
this.groupId = groupId;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
@Import({ LocalFileAutoConfiguration.class, OssAutoConfiguration.class })
@EnableConfigurationProperties({ FileProperties.class })
public class FileAutoConfiguration {
}
@@ -15,21 +15,37 @@
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pigx.manager.manager.service;
package com.pig4cloud.pigx.common.file.core;
import com.pig4cloud.pigx.manager.model.LoadBalanceInfo;
import com.pig4cloud.pigx.common.file.local.LocalFileProperties;
import com.pig4cloud.pigx.common.file.oss.OssProperties;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* @author LCN on 2017/12/5
* 文件 配置信息
*
* @author lengleng
* <p>
* bucket 设置公共读权限
*/
public interface LoadBalanceService {
@Data
@ConfigurationProperties(prefix = "file")
public class FileProperties {
boolean put(LoadBalanceInfo loadBalanceInfo);
/**
* 默认的存储桶名称
*/
private String bucketName = "local";
LoadBalanceInfo get(String groupId, String key);
/**
* 本地文件配置信息
*/
private LocalFileProperties local;
boolean remove(String groupId);
String getLoadBalanceGroupName(String groupId);
/**
* oss 文件配置信息
*/
private OssProperties oss;
}
@@ -0,0 +1,87 @@
package com.pig4cloud.pigx.common.file.core;
import com.amazonaws.services.s3.model.Bucket;
import com.amazonaws.services.s3.model.S3Object;
import com.amazonaws.services.s3.model.S3ObjectSummary;
import org.springframework.beans.factory.InitializingBean;
import java.io.InputStream;
import java.util.List;
/**
* 文件操作模板
*
* @author lengleng
* @date 2022/4/19
*/
public interface FileTemplate extends InitializingBean {
/**
* 创建bucket
* @param bucketName bucket名称
*/
void createBucket(String bucketName);
/**
* 获取全部bucket
* <p>
*
* API Documentation</a>
*/
List<Bucket> getAllBuckets();
/**
* @param bucketName bucket名称
* @see <a href= Documentation</a>
*/
void removeBucket(String bucketName);
/**
* 上传文件
* @param bucketName bucket名称
* @param objectName 文件名称
* @param stream 文件流
* @param contextType 文件类型
* @throws Exception
*/
void putObject(String bucketName, String objectName, InputStream stream, String contextType) throws Exception;
/**
* 上传文件
* @param bucketName bucket名称
* @param objectName 文件名称
* @param stream 文件流
* @param contextType 文件类型
* @throws Exception
*/
void putObject(String bucketName, String objectName, InputStream stream) throws Exception;
/**
* 获取文件
* @param bucketName bucket名称
* @param objectName 文件名称
* @return 二进制流 API Documentation</a>
*/
S3Object getObject(String bucketName, String objectName);
void removeObject(String bucketName, String objectName) throws Exception;
/**
* @throws Exception
*/
@Override
default void afterPropertiesSet() throws Exception {
}
/**
* 根据文件前置查询文件
* @param bucketName bucket名称
* @param prefix 前缀
* @param recursive 是否递归查询
* @return S3ObjectSummary 列表
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjects">AWS
* API Documentation</a>
*/
List<S3ObjectSummary> getAllObjectsByPrefix(String bucketName, String prefix, boolean recursive);
}
@@ -15,25 +15,31 @@
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pigx.manager.config;
package com.pig4cloud.pigx.common.file.local;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import com.pig4cloud.pigx.common.file.core.FileProperties;
import com.pig4cloud.pigx.common.file.core.FileTemplate;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
/**
* @author LCN on 2017/7/5.
* aws 自动配置类
*
* @author lengleng
* @author 858695266
*/
@AllArgsConstructor
public class LocalFileAutoConfiguration {
@Configuration
@EnableAutoConfiguration
public class RestConfig {
private final FileProperties properties;
@Bean
public RestTemplate getRestTemplate() {
RestTemplate restTemplate = new RestTemplate();
return restTemplate;
@ConditionalOnMissingBean(LocalFileTemplate.class)
@ConditionalOnProperty(name = "file.local.enable", havingValue = "true", matchIfMissing = true)
public FileTemplate localFileTemplate() {
return new LocalFileTemplate(properties);
}
}
@@ -15,17 +15,30 @@
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pigx.manager.netty.service.impl;
package com.pig4cloud.pigx.common.file.local;
import com.pig4cloud.pigx.manager.netty.service.IActionService;
import org.springframework.stereotype.Service;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* 补偿回调
* 本地文件 配置信息
*
* @author LCN on 2017/11/11
* @author lengleng
* <p>
* bucket 设置公共读权限
*/
@Service(value = "c")
public class ActionCServiceImpl extends BaseSignalTaskService implements IActionService {
@Data
@ConfigurationProperties(prefix = "local")
public class LocalFileProperties {
/**
* 是否开启
*/
private boolean enable;
/**
* 默认路径
*/
private String basePath;
}
@@ -0,0 +1,137 @@
package com.pig4cloud.pigx.common.file.local;
import cn.hutool.core.io.FileUtil;
import com.amazonaws.services.s3.model.Bucket;
import com.amazonaws.services.s3.model.S3Object;
import com.amazonaws.services.s3.model.S3ObjectSummary;
import com.pig4cloud.pigx.common.file.core.FileProperties;
import com.pig4cloud.pigx.common.file.core.FileTemplate;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import java.io.File;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* 本地文件读取模式
*
* @author lengleng
* @date 2022/4/19
*/
@RequiredArgsConstructor
public class LocalFileTemplate implements FileTemplate {
private final FileProperties properties;
/**
* 创建bucket
* @param bucketName bucket名称
*/
@Override
public void createBucket(String bucketName) {
FileUtil.mkdir(properties.getLocal().getBasePath() + FileUtil.FILE_SEPARATOR + bucketName);
}
/**
* 获取全部bucket
* <p>
* <p>
* API Documentation</a>
*/
@Override
public List<Bucket> getAllBuckets() {
return Arrays.stream(FileUtil.ls(properties.getLocal().getBasePath())).filter(FileUtil::isDirectory)
.map(dir -> new Bucket(dir.getName())).collect(Collectors.toList());
}
/**
* @param bucketName bucket名称
* @see <a href= Documentation</a>
*/
@Override
public void removeBucket(String bucketName) {
FileUtil.del(properties.getLocal().getBasePath() + FileUtil.FILE_SEPARATOR + bucketName);
}
/**
* 上传文件
* @param bucketName bucket名称
* @param objectName 文件名称
* @param stream 文件流
* @param contextType 文件类型
*/
@Override
public void putObject(String bucketName, String objectName, InputStream stream, String contextType) {
// 当 Bucket 不存在时创建
String dir = properties.getLocal().getBasePath() + FileUtil.FILE_SEPARATOR + bucketName;
if (!FileUtil.isDirectory(properties.getLocal().getBasePath() + FileUtil.FILE_SEPARATOR + bucketName)) {
createBucket(bucketName);
}
// 写入文件
File file = FileUtil.file(dir + FileUtil.FILE_SEPARATOR + objectName);
FileUtil.writeFromStream(stream, file);
}
/**
* 获取文件
* @param bucketName bucket名称
* @param objectName 文件名称
* @return 二进制流 API Documentation</a>
*/
@Override
@SneakyThrows
public S3Object getObject(String bucketName, String objectName) {
String dir = properties.getLocal().getBasePath() + FileUtil.FILE_SEPARATOR + bucketName;
S3Object s3Object = new S3Object();
s3Object.setObjectContent(FileUtil.getInputStream(dir + FileUtil.FILE_SEPARATOR + objectName));
return s3Object;
}
/**
* @param bucketName
* @param objectName
* @throws Exception
*/
@Override
public void removeObject(String bucketName, String objectName) throws Exception {
String dir = properties.getLocal().getBasePath() + FileUtil.FILE_SEPARATOR + bucketName;
FileUtil.del(dir + FileUtil.FILE_SEPARATOR + objectName);
}
/**
* 上传文件
* @param bucketName bucket名称
* @param objectName 文件名称
* @param stream 文件流
* @throws Exception
*/
@Override
public void putObject(String bucketName, String objectName, InputStream stream) throws Exception {
putObject(bucketName, objectName, stream, null);
}
/**
* 根据文件前置查询文件
* @param bucketName bucket名称
* @param prefix 前缀
* @param recursive 是否递归查询
* @return S3ObjectSummary 列表
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjects">AWS
* API Documentation</a>
*/
@Override
public List<S3ObjectSummary> getAllObjectsByPrefix(String bucketName, String prefix, boolean recursive) {
String dir = properties.getLocal().getBasePath() + FileUtil.FILE_SEPARATOR + bucketName;
return Arrays.stream(FileUtil.ls(dir)).filter(file -> file.getName().startsWith(prefix)).map(file -> {
S3ObjectSummary summary = new S3ObjectSummary();
summary.setKey(file.getName());
return new S3ObjectSummary();
}).collect(Collectors.toList());
}
}
@@ -15,15 +15,17 @@
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pigx.common.oss;
package com.pig4cloud.pigx.common.file.oss;
import com.pig4cloud.pigx.common.oss.http.OssEndpoint;
import com.pig4cloud.pigx.common.oss.service.OssTemplate;
import com.pig4cloud.pigx.common.file.core.FileProperties;
import com.pig4cloud.pigx.common.file.core.FileTemplate;
import com.pig4cloud.pigx.common.file.oss.http.OssEndpoint;
import com.pig4cloud.pigx.common.file.oss.service.OssTemplate;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
/**
* aws 自动配置类
@@ -32,20 +34,20 @@ import org.springframework.context.annotation.Bean;
* @author 858695266
*/
@AllArgsConstructor
@EnableConfigurationProperties({ OssProperties.class })
public class OssAutoConfiguration {
private final OssProperties properties;
private final FileProperties properties;
@Bean
@Primary
@ConditionalOnMissingBean(OssTemplate.class)
@ConditionalOnProperty(name = "oss.enable", havingValue = "true", matchIfMissing = true)
public OssTemplate ossTemplate() {
@ConditionalOnProperty(name = "file.oss.enable", havingValue = "true")
public FileTemplate ossTemplate() {
return new OssTemplate(properties);
}
@Bean
@ConditionalOnProperty(name = "oss.info", havingValue = "true")
@ConditionalOnProperty(name = "file.oss.info", havingValue = "true")
public OssEndpoint ossEndpoint(OssTemplate template) {
return new OssEndpoint(template);
}
@@ -15,7 +15,7 @@
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pigx.common.oss;
package com.pig4cloud.pigx.common.file.oss;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
@@ -72,11 +72,6 @@ public class OssProperties {
*/
private String secretKey;
/**
* 默认的存储桶名称
*/
private String bucketName = "payerp";
/**
* 最大线程数,默认: 100
*/
@@ -15,18 +15,20 @@
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pigx.common.oss.http;
package com.pig4cloud.pigx.common.file.oss.http;
import com.amazonaws.services.s3.model.Bucket;
import com.amazonaws.services.s3.model.S3Object;
import com.amazonaws.services.s3.model.S3ObjectSummary;
import com.pig4cloud.pigx.common.oss.service.OssTemplate;
import com.pig4cloud.pigx.common.file.oss.service.OssTemplate;
import lombok.AllArgsConstructor;
import lombok.Cleanup;
import lombok.SneakyThrows;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -84,7 +86,9 @@ public class OssEndpoint {
@PostMapping("/object/{bucketName}")
public S3Object createObject(@RequestBody MultipartFile object, @PathVariable String bucketName) {
String name = object.getOriginalFilename();
template.putObject(bucketName, name, object.getInputStream(), object.getSize(), object.getContentType());
@Cleanup
InputStream inputStream = object.getInputStream();
template.putObject(bucketName, name, inputStream, object.getSize(), object.getContentType());
return template.getObjectInfo(bucketName, name);
}
@@ -93,7 +97,9 @@ public class OssEndpoint {
@PostMapping("/object/{bucketName}/{objectName}")
public S3Object createObject(@RequestBody MultipartFile object, @PathVariable String bucketName,
@PathVariable String objectName) {
template.putObject(bucketName, objectName, object.getInputStream(), object.getSize(), object.getContentType());
@Cleanup
InputStream inputStream = object.getInputStream();
template.putObject(bucketName, objectName, inputStream, object.getSize(), object.getContentType());
return template.getObjectInfo(bucketName, objectName);
}
@@ -15,7 +15,7 @@
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pigx.common.oss.service;
package com.pig4cloud.pigx.common.file.oss.service;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.AWSCredentials;
@@ -27,7 +27,8 @@ import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.*;
import com.amazonaws.util.IOUtils;
import com.pig4cloud.pigx.common.oss.OssProperties;
import com.pig4cloud.pigx.common.file.core.FileProperties;
import com.pig4cloud.pigx.common.file.core.FileTemplate;
import lombok.Cleanup;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
@@ -47,9 +48,9 @@ import java.util.*;
* @since 1.0
*/
@RequiredArgsConstructor
public class OssTemplate implements InitializingBean {
public class OssTemplate implements InitializingBean, FileTemplate {
private final OssProperties ossProperties;
private final FileProperties properties;
private AmazonS3 amazonS3;
@@ -220,16 +221,16 @@ public class OssTemplate implements InitializingBean {
@Override
public void afterPropertiesSet() {
ClientConfiguration clientConfiguration = new ClientConfiguration();
clientConfiguration.setMaxConnections(ossProperties.getMaxConnections());
clientConfiguration.setMaxConnections(properties.getOss().getMaxConnections());
AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration(
ossProperties.getEndpoint(), ossProperties.getRegion());
AWSCredentials awsCredentials = new BasicAWSCredentials(ossProperties.getAccessKey(),
ossProperties.getSecretKey());
properties.getOss().getEndpoint(), properties.getOss().getRegion());
AWSCredentials awsCredentials = new BasicAWSCredentials(properties.getOss().getAccessKey(),
properties.getOss().getSecretKey());
AWSCredentialsProvider awsCredentialsProvider = new AWSStaticCredentialsProvider(awsCredentials);
this.amazonS3 = AmazonS3Client.builder().withEndpointConfiguration(endpointConfiguration)
.withClientConfiguration(clientConfiguration).withCredentials(awsCredentialsProvider)
.disableChunkedEncoding().withPathStyleAccessEnabled(ossProperties.getPathStyleAccess()).build();
.disableChunkedEncoding().withPathStyleAccessEnabled(properties.getOss().getPathStyleAccess()).build();
}
}
@@ -1,2 +1,2 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.pig4cloud.pigx.common.oss.OssAutoConfiguration
com.pig4cloud.pigx.common.file.FileAutoConfiguration
+51
View File
@@ -0,0 +1,51 @@
<?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>4.4.0</version>
</parent>
<artifactId>pigx-common-seata</artifactId>
<packaging>jar</packaging>
<description>pigx 分布式事务处理模块</description>
<dependencies>
<!--核心依赖-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common-core</artifactId>
</dependency>
<!-- seata-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-seata</artifactId>
</dependency>
<!-- seata kryo 序列化-->
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-serializer-kryo</artifactId>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,19 @@
package com.pig4cloud.pigx.common.seata.config;
import com.pig4cloud.pigx.common.core.factory.YamlPropertySourceFactory;
import io.seata.spring.annotation.datasource.EnableAutoDataSourceProxy;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
/**
* Seata 配置类
*
* @author lengleng
* @date 2022/3/29
*/
@PropertySource(value = "classpath:seata-config.yml", factory = YamlPropertySourceFactory.class)
@EnableAutoDataSourceProxy
@Configuration(proxyBeanMethods = false)
public class SeataAutoConfiguration {
}
@@ -0,0 +1,177 @@
/**
* @author lengleng
* @date 2022/3/29
*/
package io.seata.spring.util;
import io.seata.common.util.CollectionUtils;
import io.seata.rm.tcc.remoting.parser.DubboUtil;
import org.springframework.aop.TargetSource;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.framework.AdvisedSupport;
import org.springframework.aop.support.AopUtils;
import java.lang.reflect.Field;
import java.lang.reflect.Proxy;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
/**
* Proxy tools base on spring 主要解决 v1.4.2 兼容性问题 https://github.com/seata/seata/issues/3709
*
* @author zhangsen
*/
public class SpringProxyUtils {
private SpringProxyUtils() {
}
/**
* Find target class class.
* @param proxy the proxy
* @return the class
* @throws Exception the exception
*/
public static Class<?> findTargetClass(Object proxy) throws Exception {
if (proxy == null) {
return null;
}
if (AopUtils.isAopProxy(proxy) && proxy instanceof Advised) {
// #issue 3709
final TargetSource targetSource = ((Advised) proxy).getTargetSource();
if (!targetSource.isStatic()) {
return targetSource.getTargetClass();
}
return findTargetClass(targetSource.getTarget());
}
return proxy.getClass();
}
public static Class<?>[] findInterfaces(Object proxy) throws Exception {
if (AopUtils.isJdkDynamicProxy(proxy)) {
AdvisedSupport advised = getAdvisedSupport(proxy);
return getInterfacesByAdvised(advised);
}
else {
return new Class<?>[] {};
}
}
private static Class<?>[] getInterfacesByAdvised(AdvisedSupport advised) {
Class<?>[] interfaces = advised.getProxiedInterfaces();
if (interfaces.length > 0) {
return interfaces;
}
else {
throw new IllegalStateException("Find the jdk dynamic proxy class that does not implement the interface");
}
}
/**
* Gets advised support.
* @param proxy the proxy
* @return the advised support
* @throws Exception the exception
*/
public static AdvisedSupport getAdvisedSupport(Object proxy) throws Exception {
Field h;
if (AopUtils.isJdkDynamicProxy(proxy)) {
h = proxy.getClass().getSuperclass().getDeclaredField("h");
}
else {
h = proxy.getClass().getDeclaredField("CGLIB$CALLBACK_0");
}
h.setAccessible(true);
Object dynamicAdvisedInterceptor = h.get(proxy);
Field advised = dynamicAdvisedInterceptor.getClass().getDeclaredField("advised");
advised.setAccessible(true);
return (AdvisedSupport) advised.get(dynamicAdvisedInterceptor);
}
/**
* Is proxy boolean.
* @param bean the bean
* @return the boolean
*/
public static boolean isProxy(Object bean) {
if (bean == null) {
return false;
}
// check dubbo proxy ?
return DubboUtil.isDubboProxyName(bean.getClass().getName())
|| (Proxy.class.isAssignableFrom(bean.getClass()) || AopUtils.isAopProxy(bean));
}
/**
* Get the target class , get the interface of its agent if it is a Proxy
* @param proxy the proxy
* @return target interface
* @throws Exception the exception
*/
public static Class<?> getTargetInterface(Object proxy) throws Exception {
if (proxy == null) {
throw new IllegalArgumentException("proxy can not be null");
}
// jdk proxy
if (Proxy.class.isAssignableFrom(proxy.getClass())) {
Proxy p = (Proxy) proxy;
return p.getClass().getInterfaces()[0];
}
return getTargetClass(proxy);
}
/**
* Get the class type of the proxy target object, if hadn't a target object, return
* the interface of the proxy
* @param proxy the proxy
* @return target interface
* @throws Exception the exception
*/
protected static Class<?> getTargetClass(Object proxy) throws Exception {
if (proxy == null) {
throw new IllegalArgumentException("proxy can not be null");
}
// not proxy
if (!AopUtils.isAopProxy(proxy)) {
return proxy.getClass();
}
AdvisedSupport advisedSupport = getAdvisedSupport(proxy);
Object target = advisedSupport.getTargetSource().getTarget();
/*
* the Proxy of sofa:reference has no target
*/
if (target == null) {
if (CollectionUtils.isNotEmpty(advisedSupport.getProxiedInterfaces())) {
return advisedSupport.getProxiedInterfaces()[0];
}
else {
return proxy.getClass();
}
}
else {
return getTargetClass(target);
}
}
/**
* get the all interfaces of bean, if the bean is null, then return empty array
* @param bean the bean
* @return target interface
*/
public static Class<?>[] getAllInterfaces(Object bean) {
Set<Class<?>> interfaces = new HashSet<>();
if (bean != null) {
Class<?> clazz = bean.getClass();
while (!Object.class.getName().equalsIgnoreCase(clazz.getName())) {
Class<?>[] clazzInterfaces = clazz.getInterfaces();
interfaces.addAll(Arrays.asList(clazzInterfaces));
clazz = clazz.getSuperclass();
}
}
return interfaces.toArray(new Class[0]);
}
}
@@ -0,0 +1,5 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.pig4cloud.pigx.common.seata.config.SeataAutoConfiguration
@@ -0,0 +1,56 @@
seata:
enabled: true
tx-service-group: pigx_tx_group # 事务群组(可以每个应用独立取名,也可以使用相同的名字)
client:
rm-report-success-enable: true
rm-table-meta-check-enable: false # 自动刷新缓存中的表结构(默认false)
rm-report-retry-count: 5 # 一阶段结果上报TC重试次数(默认5)
rm-async-commit-buffer-limit: 10000 # 异步提交缓存队列长度(默认10000)
rm:
lock:
lock-retry-internal: 10 # 校验或占用全局锁重试间隔(默认10ms)
lock-retry-times: 30 # 校验或占用全局锁重试次数(默认30)
lock-retry-policy-branch-rollback-on-conflict: true # 分支事务与其它全局回滚事务冲突时锁策略(优先释放本地锁让回滚成功)
tm-commit-retry-count: 3 # 一阶段全局提交结果上报TC重试次数(默认1次,建议大于1)
tm-rollback-retry-count: 3 # 一阶段全局回滚结果上报TC重试次数(默认1次,建议大于1)
undo:
data-validation: true # 二阶段回滚镜像校验(默认true开启)
log-serialization: kryo # undo序列化方式(默认jackson 不支持 LocalDateTime)
log-table: undo_log # 自定义undo表名(默认undo_log)
log:
exceptionRate: 100 # 日志异常输出概率(默认100)
support:
spring:
datasource-autoproxy: true
service:
vgroup-mapping:
pigx_tx_group: default # TC 集群(必须与seata-server保持一致)
enable-degrade: false # 降级开关
disable-global-transaction: false # 禁用全局事务(默认false)
grouplist:
default: pig-seata:8091
transport:
shutdown:
wait: 3
thread-factory:
boss-thread-prefix: NettyBoss
worker-thread-prefix: NettyServerNIOWorker
server-executor-thread-prefix: NettyServerBizHandler
share-boss-worker: false
client-selector-thread-prefix: NettyClientSelector
client-selector-thread-size: 1
client-worker-thread-prefix: NettyClientWorkerThread
type: TCP
server: NIO
heartbeat: true
serialization: seata
compressor: none
enable-client-batch-send-request: true # 客户端事务消息请求是否批量合并发送(默认true)
registry:
file:
name: file.conf
type: file
config:
file:
name: file.conf
type: file
+1 -1
View File
@@ -23,7 +23,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>4.3.0</version>
<version>4.4.0</version>
</parent>
<artifactId>pigx-common-security</artifactId>
@@ -4,14 +4,17 @@ import com.pig4cloud.pigx.common.core.util.SpringContextHolder;
import com.pig4cloud.pigx.common.security.exception.UnauthorizedException;
import com.pig4cloud.pigx.common.security.service.PigxUser;
import com.pig4cloud.pigx.common.security.service.PigxUserDetailsService;
import com.pig4cloud.pigx.common.security.util.PigxSecurityMessageSourceUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Primary;
import org.springframework.core.Ordered;
import org.springframework.security.authentication.AccountStatusException;
import org.springframework.security.authentication.InternalAuthenticationServiceException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsChecker;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.security.oauth2.common.exceptions.InvalidTokenException;
@@ -36,6 +39,8 @@ public class PigxLocalResourceServerTokenServices implements ResourceServerToken
private final TokenStore tokenStore;
private final UserDetailsChecker preAuthenticationChecks;
@Override
public OAuth2Authentication loadAuthentication(String accessToken)
throws AuthenticationException, InvalidTokenException {
@@ -68,11 +73,19 @@ public class PigxLocalResourceServerTokenServices implements ResourceServerToken
UserDetails userDetails;
try {
userDetails = optional.get().loadUserByUser(pigUser);
preAuthenticationChecks.check(userDetails);
}
catch (UsernameNotFoundException notFoundException) {
throw new UnauthorizedException(String.format("%s username not found", pigUser.getUsername()),
notFoundException);
}
catch (AccountStatusException accountStatusException) {
throw new UnauthorizedException(
PigxSecurityMessageSourceUtil.getAccessor().getMessage(
"AbstractUserDetailsAuthenticationProvider.locked", accountStatusException.getMessage()),
accountStatusException);
}
Authentication userAuthentication = new UsernamePasswordAuthenticationToken(userDetails, "N/A",
userDetails.getAuthorities());
OAuth2Authentication authentication = new OAuth2Authentication(oAuth2Request, userAuthentication);
@@ -7,19 +7,20 @@ import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.security.core.userdetails.UserDetailsChecker;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.security.oauth2.provider.token.DefaultAuthenticationKeyGenerator;
import org.springframework.security.oauth2.provider.token.TokenStore;
/**
* @author lengleng
* @date 2020/9/29
* @date 2022-04-28
* <p>
* redis token store 自动配置
* 资源服务器 认证服务器 公用配置
*/
@RequiredArgsConstructor
@Configuration(proxyBeanMethods = false)
public class PigxTokenStoreAutoConfiguration {
public class PigxSecurityCommonAutoConfiguration {
private final KeyStrResolver resolver;
@@ -39,4 +40,13 @@ public class PigxTokenStoreAutoConfiguration {
return tokenStore;
}
/**
* 认证状态检查
* @return UserDetailsChecker
*/
@Bean
public UserDetailsChecker preAuthenticationChecks() {
return new PigxPreAuthenticationChecks();
}
}
@@ -18,7 +18,6 @@
package com.pig4cloud.pigx.common.security.component;
import com.pig4cloud.pigx.common.security.exception.*;
import com.pig4cloud.pigx.common.security.util.PigxSecurityMessageSourceUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -33,8 +32,6 @@ import org.springframework.security.oauth2.provider.error.WebResponseExceptionTr
import org.springframework.security.web.util.ThrowableAnalyzer;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import java.util.Locale;
/**
* @author lengleng
* @date 2020-06-20 OAutH Server 异常处理,重写oauth 默认实现
@@ -65,9 +62,7 @@ public class PigxWebResponseExceptionTranslator implements WebResponseExceptionT
ase = (InvalidGrantException) throwableAnalyzer.getFirstThrowableOfType(InvalidGrantException.class,
causeChain);
if (ase != null) {
String msg = PigxSecurityMessageSourceUtil.getAccessor().getMessage(
"AbstractUserDetailsAuthenticationProvider.badCredentials", ase.getMessage(), Locale.CHINA);
return handleOAuth2Exception(new InvalidException(msg, ase));
return handleOAuth2Exception(new InvalidException(ase.getLocalizedMessage(), ase));
}
ase = (HttpRequestMethodNotSupportedException) throwableAnalyzer
@@ -76,7 +71,7 @@ public class PigxWebResponseExceptionTranslator implements WebResponseExceptionT
return handleOAuth2Exception(new MethodNotAllowedException(ase.getMessage(), ase));
}
// 处理不合法的令牌错误 427 返回
// 处理不合法的令牌错误 424 返回
ase = (InvalidTokenException) throwableAnalyzer.getFirstThrowableOfType(InvalidTokenException.class,
causeChain);
if (ase != null) {
@@ -17,6 +17,7 @@
package com.pig4cloud.pigx.common.security.listener;
import cn.hutool.core.collection.CollUtil;
import com.pig4cloud.pigx.common.security.handler.AuthenticationFailureHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
@@ -29,6 +30,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* @author lengleng
@@ -37,7 +39,7 @@ import javax.servlet.http.HttpServletResponse;
public class AuthenticationFailureEventListener implements ApplicationListener<AbstractAuthenticationFailureEvent> {
@Autowired(required = false)
private AuthenticationFailureHandler failureHandler;
private List<AuthenticationFailureHandler> failureHandlerList;
/**
* Handle an application event.
@@ -58,9 +60,10 @@ public class AuthenticationFailureEventListener implements ApplicationListener<A
AuthenticationException authenticationException = event.getException();
Authentication authentication = (Authentication) event.getSource();
// 调用自定义业务实现
if (failureHandler != null) {
failureHandler.handle(authenticationException, authentication, request, response);
// 调用自定义业务链实现
if (CollUtil.isNotEmpty(failureHandlerList)) {
failureHandlerList.forEach(failureHandler -> failureHandler.handle(authenticationException, authentication,
request, response));
}
}
@@ -29,6 +29,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* @author lengleng
@@ -37,7 +38,7 @@ import javax.servlet.http.HttpServletResponse;
public class AuthenticationSuccessEventListener implements ApplicationListener<AuthenticationSuccessEvent> {
@Autowired(required = false)
private AuthenticationSuccessHandler successHandler;
private List<AuthenticationSuccessHandler> successHandlerList;
/**
* Handle an application event.
@@ -46,13 +47,12 @@ public class AuthenticationSuccessEventListener implements ApplicationListener<A
@Override
public void onApplicationEvent(AuthenticationSuccessEvent event) {
Authentication authentication = (Authentication) event.getSource();
if (successHandler != null && isUserAuthentication(authentication)) {
if (CollUtil.isNotEmpty(successHandlerList) && isUserAuthentication(authentication)) {
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder
.getRequestAttributes();
HttpServletRequest request = requestAttributes.getRequest();
HttpServletResponse response = requestAttributes.getResponse();
successHandler.handle(authentication, request, response);
successHandlerList.forEach(successHandler -> successHandler.handle(authentication, request, response));
}
}
@@ -18,14 +18,11 @@ package com.pig4cloud.pigx.common.security.service;
import com.pig4cloud.pigx.admin.api.dto.UserInfo;
import com.pig4cloud.pigx.admin.api.feign.RemoteUserService;
import com.pig4cloud.pigx.common.core.constant.CacheConstants;
import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
import com.pig4cloud.pigx.common.core.util.R;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
@@ -42,8 +39,6 @@ public class PigxAppUserDetailsServiceImpl implements PigxUserDetailsService {
private final RemoteUserService remoteUserService;
private final CacheManager cacheManager;
/**
* 手机号登录
* @param phone 手机号
@@ -52,18 +47,8 @@ public class PigxAppUserDetailsServiceImpl implements PigxUserDetailsService {
@Override
@SneakyThrows
public UserDetails loadUserByUsername(String phone) {
Cache cache = cacheManager.getCache(CacheConstants.USER_DETAILS);
if (cache != null && cache.get(phone) != null) {
return (PigxUser) cache.get(phone).get();
}
R<UserInfo> result = remoteUserService.social(phone, SecurityConstants.FROM_IN);
UserDetails userDetails = getUserDetails(result);
if (cache != null) {
cache.put(phone, userDetails);
}
return userDetails;
return getUserDetails(result);
}
/**
@@ -4,8 +4,6 @@ import cn.hutool.core.map.MapUtil;
import com.pig4cloud.pigx.common.core.constant.CommonConstants;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.oauth2.common.*;
import org.springframework.security.oauth2.common.exceptions.InvalidGrantException;
@@ -13,7 +11,6 @@ import org.springframework.security.oauth2.common.exceptions.InvalidScopeExcepti
import org.springframework.security.oauth2.common.exceptions.InvalidTokenException;
import org.springframework.security.oauth2.provider.*;
import org.springframework.security.oauth2.provider.token.*;
import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
@@ -45,8 +42,6 @@ public class PigxCustomTokenServices implements AuthorizationServerTokenServices
private TokenEnhancer accessTokenEnhancer;
private AuthenticationManager authenticationManager;
/**
* Initialize these token services. If no random generator is set, one will be
* created.
@@ -121,17 +116,6 @@ public class PigxCustomTokenServices implements AuthorizationServerTokenServices
}
OAuth2Authentication authentication = tokenStore.readAuthenticationForRefreshToken(refreshToken);
if (this.authenticationManager != null && !authentication.isClientOnly()) {
// The client has already been authenticated, but the user authentication
// might be old now, so give it a
// chance to re-authenticate.
Authentication user = new PreAuthenticatedAuthenticationToken(authentication.getUserAuthentication(), "",
authentication.getAuthorities());
user = authenticationManager.authenticate(user);
Object details = authentication.getDetails();
authentication = new OAuth2Authentication(authentication.getOAuth2Request(), user);
authentication.setDetails(details);
}
String clientId = authentication.getOAuth2Request().getClientId();
if (clientId == null || !clientId.equals(tokenRequest.getClientId())) {
throw new InvalidGrantException("Wrong client for this refresh token: " + refreshTokenValue);
@@ -394,15 +378,6 @@ public class PigxCustomTokenServices implements AuthorizationServerTokenServices
this.tokenStore = tokenStore;
}
/**
* An authentication manager that will be used (if provided) to check the user
* authentication when a token is refreshed.
* @param authenticationManager the authenticationManager to set
*/
public void setAuthenticationManager(AuthenticationManager authenticationManager) {
this.authenticationManager = authenticationManager;
}
/**
* The client details service to use for looking up clients (if necessary). Optional
* if the access token expiry is set globally via
@@ -22,6 +22,7 @@ import com.pig4cloud.pigx.admin.api.entity.SysUser;
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.core.util.RetOps;
import org.springframework.core.Ordered;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
@@ -62,13 +63,23 @@ public interface PigxUserDetailsService extends UserDetailsService, Ordered {
* 构建userdetails
* @param result 用户信息
* @return UserDetails
* @throws UsernameNotFoundException
*/
default UserDetails getUserDetails(R<UserInfo> result) {
if (result == null || result.getData() == null) {
throw new UsernameNotFoundException("用户不存在");
}
// @formatter:off
return RetOps.of(result)
.getData()
.map(this::convertUserDetails)
.orElseThrow(() -> new UsernameNotFoundException("用户不存在"));
// @formatter:on
}
UserInfo info = result.getData();
/**
* UserInfo 转 UserDetails
* @param info
* @return 返回UserDetails对象
*/
default UserDetails convertUserDetails(UserInfo info) {
Set<String> dbAuthsSet = new HashSet<>();
if (ArrayUtil.isNotEmpty(info.getRoles())) {
// 获取角色
@@ -4,7 +4,7 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.pig4cloud.pigx.common.security.service.PigxDefaultUserDetailsServiceImpl,\
com.pig4cloud.pigx.common.security.service.PigxAppUserDetailsServiceImpl,\
com.pig4cloud.pigx.common.security.service.PigxClientDetailsServiceImpl,\
com.pig4cloud.pigx.common.security.component.PigxTokenStoreAutoConfiguration,\
com.pig4cloud.pigx.common.security.component.PigxSecurityCommonAutoConfiguration,\
com.pig4cloud.pigx.common.security.component.PigxSecurityMessageSourceConfiguration,\
com.pig4cloud.pigx.common.security.component.PigxTokenStoreCleanSchedule,\
com.pig4cloud.pigx.common.security.listener.AuthenticationFailureEventListener,\
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>4.3.0</version>
<version>4.4.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -21,7 +21,6 @@ import com.alibaba.cloud.sentinel.feign.SentinelFeignAutoConfiguration;
import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.BlockExceptionHandler;
import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import com.pig4cloud.pigx.common.sentinel.feign.PigxSentinelFeign;
import com.pig4cloud.pigx.common.sentinel.feign.PigxSentinelFilterConfiguration;
import com.pig4cloud.pigx.common.sentinel.handle.PigxUrlBlockHandler;
import com.pig4cloud.pigx.common.sentinel.parser.PigxHeaderRequestOriginParser;
import feign.Feign;
@@ -30,7 +29,6 @@ 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.Import;
import org.springframework.context.annotation.Scope;
/**
@@ -40,7 +38,6 @@ import org.springframework.context.annotation.Scope;
* sentinel 配置
*/
@Configuration(proxyBeanMethods = false)
@Import(PigxSentinelFilterConfiguration.class)
@AutoConfigureBefore(SentinelFeignAutoConfiguration.class)
public class SentinelAutoConfiguration {
@@ -1,58 +0,0 @@
package com.pig4cloud.pigx.common.sentinel.feign;
import com.alibaba.cloud.sentinel.SentinelProperties;
import com.alibaba.csp.sentinel.adapter.spring.webmvc.SentinelWebInterceptor;
import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.BlockExceptionHandler;
import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.DefaultBlockExceptionHandler;
import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.UrlCleaner;
import com.alibaba.csp.sentinel.adapter.spring.webmvc.config.SentinelWebMvcConfig;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.util.StringUtils;
import java.util.Optional;
/**
* @author lengleng
* @date 2021/12/4
*
* 避免 spring cloud 2021 不兼容 的问题
*/
@RequiredArgsConstructor
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
public class PigxSentinelFilterConfiguration {
@Bean
public SentinelWebInterceptor sentinelWebInterceptor(SentinelWebMvcConfig sentinelWebMvcConfig) {
return new SentinelWebInterceptor(sentinelWebMvcConfig);
}
@Bean
public SentinelWebMvcConfig sentinelWebMvcConfig(SentinelProperties properties,
Optional<UrlCleaner> urlCleanerOptional, Optional<BlockExceptionHandler> blockExceptionHandlerOptional,
Optional<RequestOriginParser> requestOriginParserOptional) {
SentinelWebMvcConfig sentinelWebMvcConfig = new SentinelWebMvcConfig();
sentinelWebMvcConfig.setHttpMethodSpecify(properties.getHttpMethodSpecify());
sentinelWebMvcConfig.setWebContextUnify(properties.getWebContextUnify());
if (blockExceptionHandlerOptional.isPresent()) {
blockExceptionHandlerOptional.ifPresent(sentinelWebMvcConfig::setBlockExceptionHandler);
}
else {
if (StringUtils.hasText(properties.getBlockPage())) {
sentinelWebMvcConfig.setBlockExceptionHandler(
((request, response, e) -> response.sendRedirect(properties.getBlockPage())));
}
else {
sentinelWebMvcConfig.setBlockExceptionHandler(new DefaultBlockExceptionHandler());
}
}
urlCleanerOptional.ifPresent(sentinelWebMvcConfig::setUrlCleaner);
requestOriginParserOptional.ifPresent(sentinelWebMvcConfig::setOriginParser);
return sentinelWebMvcConfig;
}
}
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>4.3.0</version>
<version>4.4.0</version>
</parent>
<artifactId>pigx-common-sequence</artifactId>
@@ -0,0 +1,42 @@
package com.pig4cloud.pigx.common.sequence.range.impl.db.provider;
import com.baomidou.mybatisplus.annotation.DbType;
import org.springframework.stereotype.Component;
/**
* 数据源提供者
*
* @author 达梦数据库支持
* @date 2022-04-27
*
* sql server
*/
@Component
public class DmSqlProvider implements SqlProvider {
/**
* 获取表是否存在
* @return
*/
@Override
public String getExistTableSql() {
return "select count(*) from user_tables where table_name =upper('#tableName')";
}
/**
* 获取建表语句
* @return
*/
@Override
public String getCreateTableSql() {
return "CREATE TABLE #tableName (ID BIGINT IDENTITY (1,1) NOT NULL,VALUE BIGINT NOT NULL"
+ ",NAME VARCHAR (32) NOT NULL,GMT_CREATE TIMESTAMP (0) NOT NULL,GMT_MODIFIED TIMESTAMP (0) NOT NULL"
+ ",NOT CLUSTER PRIMARY KEY (ID),CONSTRAINT UK_NAME UNIQUE (NAME)) STORAGE (ON MAIN,CLUSTERBTR);";
}
@Override
public Boolean support(DbType dbType) {
return DbType.SQL_SERVER.equals(dbType);
}
}
@@ -0,0 +1,34 @@
package com.pig4cloud.pigx.common.sequence.range.impl.db.provider;
import com.baomidou.mybatisplus.annotation.DbType;
import org.springframework.stereotype.Component;
/**
* 数据源提供者
*
* @author hanyichao
* @date 2022-04-27
*
* sql server
*/
@Component
public class MssqlSqlProvider implements SqlProvider {
/**
* 获取建表语句
* @return
*/
@Override
public String getCreateTableSql() {
return "IF NOT EXISTS (\n"
+ "SELECT*FROM sys.all_objects WHERE object_id=OBJECT_ID(N'#tableName') AND type IN ('U')) \n"
+ "CREATE TABLE #tableName (id bigint NOT NULL,VALUE bigint NOT NULL,name nvarchar (32) COLLATE "
+ "Chinese_PRC_CI_AS NOT NULL,gmt_create datetime2 (7) NOT NULL,gmt_modified datetime2 (7) NOT NULL) GO";
}
@Override
public Boolean support(DbType dbType) {
return DbType.SQL_SERVER2005.equals(dbType);
}
}
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>4.3.0</version>
<version>4.4.0</version>
</parent>
<artifactId>pigx-common-swagger</artifactId>
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>4.3.0</version>
<version>4.4.0</version>
</parent>
<artifactId>pigx-common-test</artifactId>
@@ -1,51 +0,0 @@
<?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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common</artifactId>
<version>4.3.0</version>
</parent>
<artifactId>pigx-common-transaction</artifactId>
<packaging>jar</packaging>
<description>pigx lcn transaction</description>
<dependencies>
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common-core</artifactId>
</dependency>
<!--lcn 模块端控制依赖-->
<dependency>
<groupId>com.codingapi</groupId>
<artifactId>tx-client</artifactId>
<version>${lcn.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.codingapi</groupId>
<artifactId>tx-plugins-db</artifactId>
<version>${lcn.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--feign 依赖-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
</dependencies>
</project>
@@ -1,33 +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.transaction;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
/**
* @author LCN on 2017/6/26.
* @author LCN
* @since 4.1.0
*/
@Configuration
@ComponentScan({ "com.codingapi.tx", "com.pig4cloud.pigx.common.transaction" })
public class TransactionConfiguration {
}
@@ -1,6 +0,0 @@
由于LCN 暂未发布适配 2.0 版本
当前包是根据TCN transaction-springcloud 模块修改而来
解决LCN 不兼容 Spring Cloud Finchley 问题
关于LCN
https://github.com/codingapi/tx-lcn
@@ -1,47 +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.transaction.rewrite;
import com.codingapi.tx.netty.service.TxManagerHttpRequestService;
import com.lorne.core.framework.utils.http.HttpUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @author lengleng
* @date 2018/8/19 请求tx-manager接口实现
*/
@Slf4j
@Service
public class TxManagerHttpRequestServiceImpl implements TxManagerHttpRequestService {
@Override
public String httpGet(String url) {
String res = HttpUtils.get(url);
log.debug("请求接口 {},响应报文:{}", url, res);
return res;
}
@Override
public String httpPost(String url, String params) {
String res = HttpUtils.post(url, params);
log.debug("请求接口 {},响应报文:{}", url, res);
return res;
}
}
@@ -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.transaction.rewrite;
import com.codingapi.tx.config.service.TxManagerTxUrlService;
import com.pig4cloud.pigx.common.core.constant.ServiceNameConstants;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.stereotype.Service;
/**
* @author lengleng
* @date 2018/8/19 使用服务发现重写 Txmanager 获取规则
*/
@Slf4j
@Service
@AllArgsConstructor
public class TxManagerTxUrlServiceImpl implements TxManagerTxUrlService {
private final LoadBalancerClient loadBalancerClient;
@Override
public String getTxUrl() {
ServiceInstance serviceInstance = loadBalancerClient.choose(ServiceNameConstants.TX_MANAGER);
String host = serviceInstance.getHost();
Integer port = serviceInstance.getPort();
String url = String.format("http://%s:%s/tx/manager/", host, port);
log.info("tm.manager.url -> {}", url);
return url;
}
}
@@ -1,38 +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.transaction.tx;
import com.pig4cloud.pigx.common.transaction.tx.springcloud.feign.TransactionRestTemplateInterceptor;
import feign.RequestInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author LCN on 2018/1/18
* @author LCN
* @since 4.1.0
*/
@Configuration
public class RequestInterceptorConfiguration {
@Bean
public RequestInterceptor requestInterceptor() {
return new TransactionRestTemplateInterceptor();
}
}
@@ -1,26 +0,0 @@
package com.pig4cloud.pigx.common.transaction.tx.init;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.env.EnvironmentPostProcessor;
import org.springframework.core.Ordered;
import org.springframework.core.env.ConfigurableEnvironment;
/**
* @author lengleng
* @date 22022-02-17
* <p>
* 通过环境变量的形式注入 允许循环依赖
*/
public class ApplicationTxInitializer implements EnvironmentPostProcessor, Ordered {
@Override
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
System.setProperty("spring.main.allow-circular-references", "true");
}
@Override
public int getOrder() {
return Ordered.LOWEST_PRECEDENCE;
}
}
@@ -1,46 +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.transaction.tx.springcloud.feign;
import com.codingapi.tx.aop.bean.TxTransactionLocal;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import lombok.extern.slf4j.Slf4j;
/**
* @author LCN on 2017/6/26.
* @author LCN
* @since 4.1.0
*/
@Slf4j
public class TransactionRestTemplateInterceptor implements RequestInterceptor {
@Override
public void apply(RequestTemplate requestTemplate) {
TxTransactionLocal txTransactionLocal = TxTransactionLocal.current();
String groupId = txTransactionLocal == null ? null : txTransactionLocal.getGroupId();
log.info("LCN-SpringCloud TxGroup info -> groupId:" + groupId);
if (txTransactionLocal != null) {
requestTemplate.header("tx-group", groupId);
}
}
}
@@ -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.transaction.tx.springcloud.http;
import com.codingapi.tx.aop.bean.TxTransactionLocal;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpRequest;
import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.ClientHttpResponse;
/**
* @author LCN on 2017/7/3.
* @author LCN
* @since 4.1.0
*/
@Slf4j
public class TransactionHttpRequestInterceptor implements ClientHttpRequestInterceptor {
@Override
@SneakyThrows
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) {
TxTransactionLocal txTransactionLocal = TxTransactionLocal.current();
String groupId = txTransactionLocal == null ? null : txTransactionLocal.getGroupId();
log.info("LCN-SpringCloud TxGroup info -> groupId:" + groupId);
if (txTransactionLocal != null) {
request.getHeaders().add("tx-group", groupId);
}
return execution.execute(request, body);
}
}
@@ -1,68 +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.transaction.tx.springcloud.interceptor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;
/**
* LCN 事务拦截器
*
* @author LCN on 2018/1/5
* @author LCN
* @since 4.1.0
*/
@Slf4j
@Aspect
@Component
public class TransactionAspect implements Ordered {
@Autowired
private TxManagerInterceptor txManagerInterceptor;
@SneakyThrows
@Around("@annotation(com.codingapi.tx.annotation.TxTransaction)")
public Object transactionRunning(ProceedingJoinPoint point) {
log.debug("annotation-TransactionRunning-start---->");
Object obj = txManagerInterceptor.around(point);
log.debug("annotation-TransactionRunning-end---->");
return obj;
}
@SneakyThrows
@Around("this(com.codingapi.tx.annotation.ITxTransaction) && execution( * *(..))")
public Object around(ProceedingJoinPoint point) {
log.debug("interface-ITransactionRunning-start---->");
Object obj = txManagerInterceptor.around(point);
log.debug("interface-ITransactionRunning-end---->");
return obj;
}
@Override
public int getOrder() {
return HIGHEST_PRECEDENCE;
}
}
Loaded 100 of 750 files, more files were not shown because too many files have changed in this diff. Show more