Commit 9309ef2fdc15a7f08fc62a4542c5175e51dcfc12

Authored by leoxxx
2 parents 0913b82a 58e4f11c

Merge remote-tracking branch 'upstream/master'

Showing 87 changed files with 976 additions and 1569 deletions
sql/mysql/ruoyi-vue-pro.sql
... ... @@ -11,7 +11,7 @@
11 11 Target Server Version : 80026
12 12 File Encoding : 65001
13 13  
14   - Date: 25/05/2022 23:28:25
  14 + Date: 15/06/2022 08:11:25
15 15 */
16 16  
17 17 SET NAMES utf8mb4;
... ... @@ -300,7 +300,7 @@ CREATE TABLE `bpm_form` (
300 300 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
301 301 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
302 302 PRIMARY KEY (`id`) USING BTREE
303   -) ENGINE = InnoDB AUTO_INCREMENT = 17 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '工作流的表单定义';
  303 +) ENGINE = InnoDB AUTO_INCREMENT = 18 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '工作流的表单定义';
304 304  
305 305 -- ----------------------------
306 306 -- Records of bpm_form
... ... @@ -359,7 +359,7 @@ CREATE TABLE `bpm_process_definition_ext` (
359 359 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
360 360 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
361 361 PRIMARY KEY (`id`) USING BTREE
362   -) ENGINE = InnoDB AUTO_INCREMENT = 104 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'Bpm 流程定义的拓展表\n';
  362 +) ENGINE = InnoDB AUTO_INCREMENT = 119 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'Bpm 流程定义的拓展表\n';
363 363  
364 364 -- ----------------------------
365 365 -- Records of bpm_process_definition_ext
... ... @@ -389,7 +389,7 @@ CREATE TABLE `bpm_process_instance_ext` (
389 389 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
390 390 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
391 391 PRIMARY KEY (`id`) USING BTREE
392   -) ENGINE = InnoDB AUTO_INCREMENT = 204 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '工作流的流程实例的拓展';
  392 +) ENGINE = InnoDB AUTO_INCREMENT = 256 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '工作流的流程实例的拓展';
393 393  
394 394 -- ----------------------------
395 395 -- Records of bpm_process_instance_ext
... ... @@ -415,7 +415,7 @@ CREATE TABLE `bpm_task_assign_rule` (
415 415 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
416 416 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
417 417 PRIMARY KEY (`id`) USING BTREE
418   -) ENGINE = InnoDB AUTO_INCREMENT = 201 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'Bpm 任务规则表';
  418 +) ENGINE = InnoDB AUTO_INCREMENT = 225 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'Bpm 任务规则表';
419 419  
420 420 -- ----------------------------
421 421 -- Records of bpm_task_assign_rule
... ... @@ -431,6 +431,7 @@ CREATE TABLE `bpm_task_ext` (
431 431 `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
432 432 `assignee_user_id` bigint NULL DEFAULT NULL COMMENT '任务的审批人',
433 433 `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '任务的名字',
  434 + `task_def_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '流程任务key',
434 435 `task_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '任务的编号',
435 436 `result` tinyint NOT NULL COMMENT '任务的结果',
436 437 `reason` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '审批建议',
... ... @@ -444,7 +445,7 @@ CREATE TABLE `bpm_task_ext` (
444 445 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
445 446 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
446 447 PRIMARY KEY (`id`) USING BTREE
447   -) ENGINE = InnoDB AUTO_INCREMENT = 217 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '工作流的流程任务的拓展表';
  448 +) ENGINE = InnoDB AUTO_INCREMENT = 295 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '工作流的流程任务的拓展表';
448 449  
449 450 -- ----------------------------
450 451 -- Records of bpm_task_ext
... ... @@ -504,7 +505,7 @@ CREATE TABLE `infra_api_access_log` (
504 505 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
505 506 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
506 507 PRIMARY KEY (`id`) USING BTREE
507   -) ENGINE = InnoDB AUTO_INCREMENT = 33232 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'API 访问日志表';
  508 +) ENGINE = InnoDB AUTO_INCREMENT = 35150 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'API 访问日志表';
508 509  
509 510 -- ----------------------------
510 511 -- Records of infra_api_access_log
... ... @@ -546,7 +547,7 @@ CREATE TABLE `infra_api_error_log` (
546 547 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
547 548 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
548 549 PRIMARY KEY (`id`) USING BTREE
549   -) ENGINE = InnoDB AUTO_INCREMENT = 454 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统异常日志';
  550 +) ENGINE = InnoDB AUTO_INCREMENT = 627 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统异常日志';
550 551  
551 552 -- ----------------------------
552 553 -- Records of infra_api_error_log
... ... @@ -688,6 +689,7 @@ DROP TABLE IF EXISTS `infra_file`;
688 689 CREATE TABLE `infra_file` (
689 690 `id` bigint NOT NULL AUTO_INCREMENT COMMENT '文件编号',
690 691 `config_id` bigint NULL DEFAULT NULL COMMENT '配置编号',
  692 + `name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '文件名',
691 693 `path` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '文件路径',
692 694 `url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '文件 URL',
693 695 `type` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '文件类型',
... ... @@ -698,7 +700,7 @@ CREATE TABLE `infra_file` (
698 700 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
699 701 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
700 702 PRIMARY KEY (`id`) USING BTREE
701   -) ENGINE = InnoDB AUTO_INCREMENT = 83 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '文件表';
  703 +) ENGINE = InnoDB AUTO_INCREMENT = 85 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '文件表';
702 704  
703 705 -- ----------------------------
704 706 -- Records of infra_file
... ... @@ -723,7 +725,7 @@ CREATE TABLE `infra_file_config` (
723 725 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
724 726 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
725 727 PRIMARY KEY (`id`) USING BTREE
726   -) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '文件配置表';
  728 +) ENGINE = InnoDB AUTO_INCREMENT = 18 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '文件配置表';
727 729  
728 730 -- ----------------------------
729 731 -- Records of infra_file_config
... ... @@ -732,6 +734,9 @@ BEGIN;
732 734 INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (4, '数据库', 1, '我是数据库', b'0', '{\"@class\":\"cn.iocoder.yudao.framework.file.core.client.db.DBFileClientConfig\",\"domain\":\"http://127.0.0.1:48080\"}', '1', '2022-03-15 23:56:24', '1', '2022-03-26 21:39:26', b'0');
733 735 INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5, '本地磁盘', 10, '测试下本地存储', b'0', '{\"@class\":\"cn.iocoder.yudao.framework.file.core.client.local.LocalFileClientConfig\",\"basePath\":\"/Users/yunai/file_test\",\"domain\":\"http://127.0.0.1:48080\"}', '1', '2022-03-15 23:57:00', '1', '2022-03-26 21:39:26', b'0');
734 736 INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (11, 'S3 - 七牛云', 20, NULL, b'1', '{\"@class\":\"cn.iocoder.yudao.framework.file.core.client.s3.S3FileClientConfig\",\"endpoint\":\"s3-cn-south-1.qiniucs.com\",\"domain\":\"http://test.yudao.iocoder.cn\",\"bucket\":\"ruoyi-vue-pro\",\"accessKey\":\"b7yvuhBSAGjmtPhMFcn9iMOxUOY_I06cA_p0ZUx8\",\"accessSecret\":\"kXM1l5ia1RvSX3QaOEcwI3RLz3Y2rmNszWonKZtP\"}', '1', '2022-03-19 18:00:03', '1', '2022-03-26 21:39:26', b'0');
  737 +INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (15, 'S3 - 七牛云', 20, '', b'0', '{\"@class\":\"cn.iocoder.yudao.framework.file.core.client.s3.S3FileClientConfig\",\"endpoint\":\"s3-cn-south-1.qiniucs.com\",\"domain\":\"http://test.yudao.iocoder.cn\",\"bucket\":\"ruoyi-vue-pro\",\"accessKey\":\"b7yvuhBSAGjmtPhMFcn9iMOxUOY_I06cA_p0ZUx8\",\"accessSecret\":\"kXM1l5ia1RvSX3QaOEcwI3RLz3Y2rmNszWonKZtP\"}', '1', '2022-06-10 20:50:41', '1', '2022-06-10 20:50:41', b'0');
  738 +INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (16, 'S3 - 七牛云', 20, '', b'0', '{\"@class\":\"cn.iocoder.yudao.framework.file.core.client.s3.S3FileClientConfig\",\"endpoint\":\"s3-cn-south-1.qiniucs.com\",\"domain\":\"http://test.yudao.iocoder.cn\",\"bucket\":\"ruoyi-vue-pro\",\"accessKey\":\"b7yvuhBSAGjmtPhMFcn9iMOxUOY_I06cA_p0ZUx8\",\"accessSecret\":\"kXM1l5ia1RvSX3QaOEcwI3RLz3Y2rmNszWonKZtP\"}', '1', '2022-06-11 20:32:08', '1', '2022-06-11 20:32:08', b'0');
  739 +INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (17, 'S3 - 七牛云', 20, '', b'0', '{\"@class\":\"cn.iocoder.yudao.framework.file.core.client.s3.S3FileClientConfig\",\"endpoint\":\"s3-cn-south-1.qiniucs.com\",\"domain\":\"http://test.yudao.iocoder.cn\",\"bucket\":\"ruoyi-vue-pro\",\"accessKey\":\"b7yvuhBSAGjmtPhMFcn9iMOxUOY_I06cA_p0ZUx8\",\"accessSecret\":\"kXM1l5ia1RvSX3QaOEcwI3RLz3Y2rmNszWonKZtP\"}', '1', '2022-06-11 20:32:47', '1', '2022-06-11 20:32:47', b'0');
735 740 COMMIT;
736 741  
737 742 -- ----------------------------
... ... @@ -862,7 +867,7 @@ CREATE TABLE `member_user` (
862 867 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
863 868 PRIMARY KEY (`id`) USING BTREE,
864 869 UNIQUE INDEX `uk_mobile`(`mobile` ASC) USING BTREE COMMENT '手机号'
865   -) ENGINE = InnoDB AUTO_INCREMENT = 247 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户';
  870 +) ENGINE = InnoDB AUTO_INCREMENT = 248 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户';
866 871  
867 872 -- ----------------------------
868 873 -- Records of member_user
... ... @@ -1258,7 +1263,6 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st
1258 1263 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (79, 2, '手动编辑', '2', 'system_error_code_type', 0, 'primary', '', NULL, '1', '2021-04-21 00:07:14', '1', '2022-02-16 13:57:24', b'0');
1259 1264 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (80, 100, '账号登录', '100', 'system_login_type', 0, 'primary', '', '账号登录', '1', '2021-10-06 00:52:02', '1', '2022-02-16 13:11:34', b'0');
1260 1265 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (81, 101, '社交登录', '101', 'system_login_type', 0, 'info', '', '社交登录', '1', '2021-10-06 00:52:17', '1', '2022-02-16 13:11:40', b'0');
1261   -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (82, 102, 'Mock 登录', '102', 'system_login_type', 0, 'danger', '', 'Mock 登录', '1', '2021-10-06 00:52:32', '1', '2022-02-16 13:11:44', b'0');
1262 1266 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (83, 200, '主动登出', '200', 'system_login_type', 0, 'primary', '', '主动登出', '1', '2021-10-06 00:52:58', '1', '2022-02-16 13:11:49', b'0');
1263 1267 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (85, 202, '强制登出', '202', 'system_login_type', 0, 'danger', '', '强制退出', '1', '2021-10-06 00:53:41', '1', '2022-02-16 13:11:57', b'0');
1264 1268 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (86, 0, '病假', '1', 'bpm_oa_leave_type', 0, 'primary', '', NULL, '1', '2021-09-21 22:35:28', '1', '2022-02-16 10:00:41', b'0');
... ... @@ -1411,7 +1415,7 @@ CREATE TABLE `system_error_code` (
1411 1415 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
1412 1416 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
1413 1417 PRIMARY KEY (`id`) USING BTREE
1414   -) ENGINE = InnoDB AUTO_INCREMENT = 5829 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '错误码表';
  1418 +) ENGINE = InnoDB AUTO_INCREMENT = 5832 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '错误码表';
1415 1419  
1416 1420 -- ----------------------------
1417 1421 -- Records of system_error_code
... ... @@ -1440,7 +1444,7 @@ CREATE TABLE `system_login_log` (
1440 1444 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
1441 1445 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
1442 1446 PRIMARY KEY (`id`) USING BTREE
1443   -) ENGINE = InnoDB AUTO_INCREMENT = 1416 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统访问记录';
  1447 +) ENGINE = InnoDB AUTO_INCREMENT = 1489 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统访问记录';
1444 1448  
1445 1449 -- ----------------------------
1446 1450 -- Records of system_login_log
... ... @@ -1757,7 +1761,7 @@ CREATE TABLE `system_oauth2_access_token` (
1757 1761 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
1758 1762 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
1759 1763 PRIMARY KEY (`id`) USING BTREE
1760   -) ENGINE = InnoDB AUTO_INCREMENT = 172 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 访问令牌';
  1764 +) ENGINE = InnoDB AUTO_INCREMENT = 231 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 访问令牌';
1761 1765  
1762 1766 -- ----------------------------
1763 1767 -- Records of system_oauth2_access_token
... ... @@ -1877,7 +1881,7 @@ CREATE TABLE `system_oauth2_refresh_token` (
1877 1881 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
1878 1882 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
1879 1883 PRIMARY KEY (`id`) USING BTREE
1880   -) ENGINE = InnoDB AUTO_INCREMENT = 106 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '刷新令牌';
  1884 +) ENGINE = InnoDB AUTO_INCREMENT = 165 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '刷新令牌';
1881 1885  
1882 1886 -- ----------------------------
1883 1887 -- Records of system_oauth2_refresh_token
... ... @@ -1917,7 +1921,7 @@ CREATE TABLE `system_operate_log` (
1917 1921 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
1918 1922 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
1919 1923 PRIMARY KEY (`id`) USING BTREE
1920   -) ENGINE = InnoDB AUTO_INCREMENT = 2214 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '操作日志记录';
  1924 +) ENGINE = InnoDB AUTO_INCREMENT = 2432 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '操作日志记录';
1921 1925  
1922 1926 -- ----------------------------
1923 1927 -- Records of system_operate_log
... ... @@ -1983,7 +1987,7 @@ CREATE TABLE `system_role` (
1983 1987 BEGIN;
1984 1988 INSERT INTO `system_role` (`id`, `name`, `code`, `sort`, `data_scope`, `data_scope_dept_ids`, `status`, `type`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, '超级管理员', 'super_admin', 1, 1, '', 0, 1, '超级管理员', 'admin', '2021-01-05 17:03:48', '', '2022-02-22 05:08:21', b'0', 1);
1985 1989 INSERT INTO `system_role` (`id`, `name`, `code`, `sort`, `data_scope`, `data_scope_dept_ids`, `status`, `type`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2, '普通角色', 'common', 2, 2, '', 0, 1, '普通角色', 'admin', '2021-01-05 17:03:48', '', '2022-02-22 05:08:20', b'0', 1);
1986   -INSERT INTO `system_role` (`id`, `name`, `code`, `sort`, `data_scope`, `data_scope_dept_ids`, `status`, `type`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (101, '测试账号', 'test', 0, 1, '[]', 0, 2, '132', '', '2021-01-06 13:49:35', '1', '2022-04-01 21:37:13', b'0', 1);
  1990 +INSERT INTO `system_role` (`id`, `name`, `code`, `sort`, `data_scope`, `data_scope_dept_ids`, `status`, `type`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (101, '测试账号', 'test', 0, 1, '[]', 0, 2, '132', '', '2021-01-06 13:49:35', '1', '2022-05-28 16:11:05', b'0', 1);
1987 1991 INSERT INTO `system_role` (`id`, `name`, `code`, `sort`, `data_scope`, `data_scope_dept_ids`, `status`, `type`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (109, '租户管理员', 'tenant_admin', 0, 1, '', 0, 1, '系统自动生成', '1', '2022-02-22 00:56:14', '1', '2022-02-22 00:56:14', b'0', 121);
1988 1992 INSERT INTO `system_role` (`id`, `name`, `code`, `sort`, `data_scope`, `data_scope_dept_ids`, `status`, `type`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (110, '测试角色', 'test', 0, 1, '[]', 0, 2, '嘿嘿', '110', '2022-02-23 00:14:34', '110', '2022-02-23 13:14:58', b'0', 121);
1989 1993 INSERT INTO `system_role` (`id`, `name`, `code`, `sort`, `data_scope`, `data_scope_dept_ids`, `status`, `type`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (111, '租户管理员', 'tenant_admin', 0, 1, '', 0, 1, '系统自动生成', '1', '2022-03-07 21:37:58', '1', '2022-03-07 21:37:58', b'0', 122);
... ... @@ -2253,7 +2257,7 @@ COMMIT;
2253 2257 DROP TABLE IF EXISTS `system_sms_channel`;
2254 2258 CREATE TABLE `system_sms_channel` (
2255 2259 `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
2256   - `signature` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '短信签名',
  2260 + `signature` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '短信签名',
2257 2261 `code` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '渠道编码',
2258 2262 `status` tinyint NOT NULL COMMENT '开启状态',
2259 2263 `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注',
... ... @@ -2300,7 +2304,7 @@ CREATE TABLE `system_sms_code` (
2300 2304 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
2301 2305 PRIMARY KEY (`id`) USING BTREE,
2302 2306 INDEX `idx_mobile`(`mobile` ASC) USING BTREE COMMENT '手机号'
2303   -) ENGINE = InnoDB AUTO_INCREMENT = 468 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '手机验证码';
  2307 +) ENGINE = InnoDB AUTO_INCREMENT = 469 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '手机验证码';
2304 2308  
2305 2309 -- ----------------------------
2306 2310 -- Records of system_sms_code
... ... @@ -2343,7 +2347,7 @@ CREATE TABLE `system_sms_log` (
2343 2347 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
2344 2348 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
2345 2349 PRIMARY KEY (`id`) USING BTREE
2346   -) ENGINE = InnoDB AUTO_INCREMENT = 144 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '短信日志';
  2350 +) ENGINE = InnoDB AUTO_INCREMENT = 242 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '短信日志';
2347 2351  
2348 2352 -- ----------------------------
2349 2353 -- Records of system_sms_log
... ... @@ -2413,7 +2417,7 @@ CREATE TABLE `system_social_user` (
2413 2417 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
2414 2418 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
2415 2419 PRIMARY KEY (`id`) USING BTREE
2416   -) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '社交用户表';
  2420 +) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '社交用户表';
2417 2421  
2418 2422 -- ----------------------------
2419 2423 -- Records of system_social_user
... ... @@ -2438,7 +2442,7 @@ CREATE TABLE `system_social_user_bind` (
2438 2442 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
2439 2443 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
2440 2444 PRIMARY KEY (`id`) USING BTREE
2441   -) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '社交绑定表';
  2445 +) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '社交绑定表';
2442 2446  
2443 2447 -- ----------------------------
2444 2448 -- Records of system_social_user_bind
... ... @@ -2545,7 +2549,7 @@ CREATE TABLE `system_user_role` (
2545 2549 `deleted` bit(1) NULL DEFAULT b'0' COMMENT '是否删除',
2546 2550 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
2547 2551 PRIMARY KEY (`id`) USING BTREE
2548   -) ENGINE = InnoDB AUTO_INCREMENT = 20 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户和角色关联表';
  2552 +) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户和角色关联表';
2549 2553  
2550 2554 -- ----------------------------
2551 2555 -- Records of system_user_role
... ... @@ -2556,7 +2560,6 @@ INSERT INTO `system_user_role` (`id`, `user_id`, `role_id`, `creator`, `create_t
2556 2560 INSERT INTO `system_user_role` (`id`, `user_id`, `role_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (4, 100, 101, '', '2022-01-11 13:19:45', '', '2022-05-12 12:35:13', b'0', 1);
2557 2561 INSERT INTO `system_user_role` (`id`, `user_id`, `role_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (5, 100, 1, '', '2022-01-11 13:19:45', '', '2022-05-12 12:35:12', b'0', 1);
2558 2562 INSERT INTO `system_user_role` (`id`, `user_id`, `role_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (6, 100, 2, '', '2022-01-11 13:19:45', '', '2022-05-12 12:35:11', b'0', 1);
2559   -INSERT INTO `system_user_role` (`id`, `user_id`, `role_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (7, 104, 101, '', '2022-01-11 13:19:45', '', '2022-05-12 12:35:11', b'0', 1);
2560 2563 INSERT INTO `system_user_role` (`id`, `user_id`, `role_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (10, 103, 1, '1', '2022-01-11 13:19:45', '1', '2022-01-11 13:19:45', b'0', 1);
2561 2564 INSERT INTO `system_user_role` (`id`, `user_id`, `role_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (11, 107, 106, '1', '2022-02-20 22:59:33', '1', '2022-02-20 22:59:33', b'0', 118);
2562 2565 INSERT INTO `system_user_role` (`id`, `user_id`, `role_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (12, 108, 107, '1', '2022-02-20 23:00:50', '1', '2022-02-20 23:00:50', b'0', 119);
... ... @@ -2567,6 +2570,7 @@ INSERT INTO `system_user_role` (`id`, `user_id`, `role_id`, `creator`, `create_t
2567 2570 INSERT INTO `system_user_role` (`id`, `user_id`, `role_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (17, 114, 101, '1', '2022-03-19 21:51:13', '1', '2022-03-19 21:51:13', b'0', 1);
2568 2571 INSERT INTO `system_user_role` (`id`, `user_id`, `role_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (18, 1, 2, '1', '2022-05-12 20:39:29', '1', '2022-05-12 20:39:29', b'0', 1);
2569 2572 INSERT INTO `system_user_role` (`id`, `user_id`, `role_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (19, 116, 113, '1', '2022-05-17 10:07:10', '1', '2022-05-17 10:07:10', b'0', 124);
  2573 +INSERT INTO `system_user_role` (`id`, `user_id`, `role_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (20, 104, 101, '1', '2022-05-28 15:43:57', '1', '2022-05-28 15:43:57', b'0', 1);
2570 2574 COMMIT;
2571 2575  
2572 2576 -- ----------------------------
... ... @@ -2630,10 +2634,10 @@ CREATE TABLE `system_users` (
2630 2634 -- Records of system_users
2631 2635 -- ----------------------------
2632 2636 BEGIN;
2633   -INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, 'admin', '$2a$10$0acJOIk2D25/oC87nyclE..0lzeu9DtQ/n3geP4fkun/zIVRhHJIO', '芋道源码', '管理员', 103, '[1]', 'aoteman@126.com', '15612345678', 1, 'http://test.yudao.iocoder.cn/48934f2f-92d4-4250-b917-d10d2b262c6a', 0, '127.0.0.1', '2022-05-23 20:27:29', 'admin', '2021-01-05 17:03:47', NULL, '2022-05-23 20:27:29', b'0', 1);
  2637 +INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, 'admin', '$2a$10$0acJOIk2D25/oC87nyclE..0lzeu9DtQ/n3geP4fkun/zIVRhHJIO', '芋道源码', '管理员', 103, '[1]', 'aoteman@126.com', '15612345678', 1, 'http://test.yudao.iocoder.cn/48934f2f-92d4-4250-b917-d10d2b262c6a', 0, '127.0.0.1', '2022-06-15 08:03:23', 'admin', '2021-01-05 17:03:47', NULL, '2022-06-15 08:03:23', b'0', 1);
2634 2638 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (100, 'yudao', '$2a$10$11U48RhyJ5pSBYWSn12AD./ld671.ycSzJHbyrtpeoMeYiw31eo8a', '芋道', '不要吓我', 104, '[1]', 'yudao@iocoder.cn', '15601691300', 1, '', 1, '127.0.0.1', '2022-05-22 19:35:33', '', '2021-01-07 09:07:17', NULL, '2022-05-22 19:35:33', b'0', 1);
2635 2639 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (103, 'yuanma', '$2a$10$wWoPT7sqriM2O1YXRL.je.GiL538OR6ZTN8aQZr9JAGdnpCH2tpYe', '源码', NULL, 106, NULL, 'yuanma@iocoder.cn', '15601701300', 0, '', 0, '127.0.0.1', '2022-01-18 00:33:40', '', '2021-01-13 23:50:35', NULL, '2022-01-18 00:33:40', b'0', 1);
2636   -INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (104, 'test', '$2a$10$e5RpuDCC0GYSt0Hvd2.CjujIXwgGct4SnXi6dVGxdgFsnqgEryk5a', '测试号', NULL, 107, '[1]', '111@qq.com', '15601691200', 1, '', 0, '127.0.0.1', '2022-03-19 21:46:19', '', '2021-01-21 02:13:53', '1', '2022-05-16 19:36:28', b'0', 1);
  2640 +INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (104, 'test', '$2a$10$GP8zvqHB//TekuzYZSBYAuBQJiNq1.fxQVDYJ.uBCOnWCtDVKE4H6', '测试号', NULL, 107, '[1]', '111@qq.com', '15601691200', 1, '', 0, '127.0.0.1', '2022-05-28 15:43:17', '', '2021-01-21 02:13:53', NULL, '2022-05-28 15:43:17', b'0', 1);
2637 2641 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (107, 'admin107', '$2a$10$dYOOBKMO93v/.ReCqzyFg.o67Tqk.bbc2bhrpyBGkIw9aypCtr2pm', '芋艿', NULL, NULL, NULL, '', '15601691300', 0, '', 0, '', NULL, '1', '2022-02-20 22:59:33', '1', '2022-02-27 08:26:51', b'0', 118);
2638 2642 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (108, 'admin108', '$2a$10$y6mfvKoNYL1GXWak8nYwVOH.kCWqjactkzdoIDgiKl93WN3Ejg.Lu', '芋艿', NULL, NULL, NULL, '', '15601691300', 0, '', 0, '', NULL, '1', '2022-02-20 23:00:50', '1', '2022-02-27 08:26:53', b'0', 119);
2639 2643 INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (109, 'admin109', '$2a$10$JAqvH0tEc0I7dfDVBI7zyuB4E3j.uH6daIjV53.vUS6PknFkDJkuK', '芋艿', NULL, NULL, NULL, '', '15601691300', 0, '', 0, '', NULL, '1', '2022-02-20 23:11:50', '1', '2022-02-27 08:26:56', b'0', 120);
... ...
sql/oracle/ruoyi-vue-pro.sql
... ... @@ -11,7 +11,7 @@
11 11 Target Server Version : 110200
12 12 File Encoding : 65001
13 13  
14   - Date: 26/05/2022 00:38:28
  14 + Date: 15/06/2022 08:20:08
15 15 */
16 16  
17 17  
... ... @@ -884,7 +884,8 @@ CREATE TABLE "INFRA_FILE" (
884 884 "CREATE_TIME" DATE NOT NULL,
885 885 "UPDATER" NVARCHAR2(64),
886 886 "UPDATE_TIME" DATE NOT NULL,
887   - "DELETED" NUMBER(1,0) DEFAULT 0
  887 + "DELETED" NUMBER(1,0) DEFAULT 0,
  888 + "NAME" NVARCHAR2(512)
888 889 )
889 890 LOGGING
890 891 NOCOMPRESS
... ... @@ -913,6 +914,7 @@ COMMENT ON COLUMN "INFRA_FILE"."CREATOR" IS '创建者';
913 914 COMMENT ON COLUMN "INFRA_FILE"."CREATE_TIME" IS '创建时间';
914 915 COMMENT ON COLUMN "INFRA_FILE"."UPDATER" IS '更新者';
915 916 COMMENT ON COLUMN "INFRA_FILE"."UPDATE_TIME" IS '更新时间';
  917 +COMMENT ON COLUMN "INFRA_FILE"."NAME" IS '文件名';
916 918 COMMENT ON TABLE "INFRA_FILE" IS '文件表';
917 919  
918 920 -- ----------------------------
... ... @@ -3196,7 +3198,7 @@ COMMENT ON COLUMN "SYSTEM_OAUTH2_CLIENT"."STATUS" IS '状态';
3196 3198 COMMENT ON COLUMN "SYSTEM_OAUTH2_CLIENT"."ACCESS_TOKEN_VALIDITY_SECONDS" IS '访问令牌的有效期';
3197 3199 COMMENT ON COLUMN "SYSTEM_OAUTH2_CLIENT"."REFRESH_TOKEN_VALIDITY_SECONDS" IS '刷新令牌的有效期';
3198 3200 COMMENT ON COLUMN "SYSTEM_OAUTH2_CLIENT"."REDIRECT_URIS" IS '可重定向的 URI 地址';
3199   -COMMENT ON COLUMN "SYSTEM_OAUTH2_CLIENT"."AUTO_APPROVE_SCOPES" IS '是否自动授权';
  3201 +COMMENT ON COLUMN "SYSTEM_OAUTH2_CLIENT"."AUTO_APPROVE_SCOPES" IS '自动通过的授权范围';
3200 3202 COMMENT ON COLUMN "SYSTEM_OAUTH2_CLIENT"."AUTHORIZED_GRANT_TYPES" IS '授权类型';
3201 3203 COMMENT ON COLUMN "SYSTEM_OAUTH2_CLIENT"."SCOPES" IS '授权范围';
3202 3204 COMMENT ON COLUMN "SYSTEM_OAUTH2_CLIENT"."AUTHORITIES" IS '权限';
... ... @@ -3795,7 +3797,7 @@ COMMIT;
3795 3797 DROP TABLE "SYSTEM_SMS_CHANNEL";
3796 3798 CREATE TABLE "SYSTEM_SMS_CHANNEL" (
3797 3799 "ID" NUMBER(20,0) NOT NULL,
3798   - "SIGNATURE" NVARCHAR2(10),
  3800 + "SIGNATURE" NVARCHAR2(12),
3799 3801 "CODE" NVARCHAR2(63),
3800 3802 "STATUS" NUMBER(4,0) NOT NULL,
3801 3803 "REMARK" NVARCHAR2(255),
... ... @@ -5393,10 +5395,8 @@ ALTER TABLE "QRTZ_FIRED_TRIGGERS" ADD CONSTRAINT "SYS_C008671" CHECK ("STATE" IS
5393 5395 -- Indexes structure for table QRTZ_FIRED_TRIGGERS
5394 5396 -- ----------------------------
5395 5397 CREATE INDEX "IDX_QRTZ_FT_INST_JOB_REQ_RCVRY"
5396   - ON "QRTZ_FIRED_TRIGGERS" ("SCHED_NAME" ASC, "INSTANCE_NAME" ASC, "REQUESTS_RECOVERY" ASC) LOCAL
  5398 + ON "QRTZ_FIRED_TRIGGERS" ("SCHED_NAME" ASC, "INSTANCE_NAME" ASC, "REQUESTS_RECOVERY" ASC)
5397 5399 LOGGING
5398   - ONLINE
5399   - NOSORT
5400 5400 VISIBLE
5401 5401 PCTFREE 10
5402 5402 INITRANS 2
... ... @@ -5410,7 +5410,7 @@ STORAGE (
5410 5410 BUFFER_POOL DEFAULT
5411 5411 );
5412 5412 CREATE INDEX "IDX_QRTZ_FT_JG"
5413   - ON "QRTZ_FIRED_TRIGGERS" ("SCHED_NAME" ASC, "JOB_GROUP" ASC) LOCAL
  5413 + ON "QRTZ_FIRED_TRIGGERS" ("SCHED_NAME" ASC, "JOB_GROUP" ASC)
5414 5414 LOGGING
5415 5415 ONLINE
5416 5416 NOSORT
... ... @@ -5427,10 +5427,8 @@ STORAGE (
5427 5427 BUFFER_POOL DEFAULT
5428 5428 );
5429 5429 CREATE INDEX "IDX_QRTZ_FT_J_G"
5430   - ON "QRTZ_FIRED_TRIGGERS" ("SCHED_NAME" ASC, "JOB_NAME" ASC, "JOB_GROUP" ASC) LOCAL
  5430 + ON "QRTZ_FIRED_TRIGGERS" ("SCHED_NAME" ASC, "JOB_NAME" ASC, "JOB_GROUP" ASC)
5431 5431 LOGGING
5432   - ONLINE
5433   - NOSORT
5434 5432 VISIBLE
5435 5433 PCTFREE 10
5436 5434 INITRANS 2
... ... @@ -5446,7 +5444,6 @@ STORAGE (
5446 5444 CREATE INDEX "IDX_QRTZ_FT_TG"
5447 5445 ON "QRTZ_FIRED_TRIGGERS" ("SCHED_NAME" ASC, "TRIGGER_GROUP" ASC) LOCAL
5448 5446 LOGGING
5449   - ONLINE
5450 5447 NOSORT
5451 5448 VISIBLE
5452 5449 PCTFREE 10
... ... @@ -5499,8 +5496,6 @@ STORAGE (
5499 5496 CREATE INDEX "IDX_QRTZ_J_REQ_RECOVERY"
5500 5497 ON "QRTZ_JOB_DETAILS" ("SCHED_NAME" ASC, "REQUESTS_RECOVERY" ASC) LOCAL
5501 5498 LOGGING
5502   - ONLINE
5503   - NOSORT
5504 5499 VISIBLE
5505 5500 PCTFREE 10
5506 5501 INITRANS 2
... ... @@ -5622,8 +5617,10 @@ ALTER TABLE "QRTZ_TRIGGERS" ADD CONSTRAINT "SYS_C008696" CHECK ("START_TIME" IS
5622 5617 -- Indexes structure for table QRTZ_TRIGGERS
5623 5618 -- ----------------------------
5624 5619 CREATE INDEX "IDX_QRTZ_T_C"
5625   - ON "QRTZ_TRIGGERS" ("SCHED_NAME" ASC, "CALENDAR_NAME" ASC)
  5620 + ON "QRTZ_TRIGGERS" ("SCHED_NAME" ASC, "CALENDAR_NAME" ASC) LOCAL
5626 5621 LOGGING
  5622 + ONLINE
  5623 + NOSORT
5627 5624 VISIBLE
5628 5625 PCTFREE 10
5629 5626 INITRANS 2
... ... @@ -5637,10 +5634,8 @@ STORAGE (
5637 5634 BUFFER_POOL DEFAULT
5638 5635 );
5639 5636 CREATE INDEX "IDX_QRTZ_T_J"
5640   - ON "QRTZ_TRIGGERS" ("SCHED_NAME" ASC, "JOB_NAME" ASC, "JOB_GROUP" ASC) LOCAL
  5637 + ON "QRTZ_TRIGGERS" ("SCHED_NAME" ASC, "JOB_NAME" ASC, "JOB_GROUP" ASC)
5641 5638 LOGGING
5642   - ONLINE
5643   - NOSORT
5644 5639 VISIBLE
5645 5640 PCTFREE 10
5646 5641 INITRANS 2
... ... @@ -5654,8 +5649,10 @@ STORAGE (
5654 5649 BUFFER_POOL DEFAULT
5655 5650 );
5656 5651 CREATE INDEX "IDX_QRTZ_T_JG"
5657   - ON "QRTZ_TRIGGERS" ("SCHED_NAME" ASC, "JOB_GROUP" ASC)
  5652 + ON "QRTZ_TRIGGERS" ("SCHED_NAME" ASC, "JOB_GROUP" ASC) LOCAL
5658 5653 LOGGING
  5654 + ONLINE
  5655 + NOSORT
5659 5656 VISIBLE
5660 5657 PCTFREE 10
5661 5658 INITRANS 2
... ... @@ -5669,10 +5666,8 @@ STORAGE (
5669 5666 BUFFER_POOL DEFAULT
5670 5667 );
5671 5668 CREATE INDEX "IDX_QRTZ_T_NEXT_FIRE_TIME"
5672   - ON "QRTZ_TRIGGERS" ("SCHED_NAME" ASC, "NEXT_FIRE_TIME" ASC) LOCAL
  5669 + ON "QRTZ_TRIGGERS" ("SCHED_NAME" ASC, "NEXT_FIRE_TIME" ASC)
5673 5670 LOGGING
5674   - ONLINE
5675   - NOSORT
5676 5671 VISIBLE
5677 5672 PCTFREE 10
5678 5673 INITRANS 2
... ...
sql/postgresql/ruoyi-vue-pro.sql
... ... @@ -12,7 +12,7 @@
12 12 Target Server Version : 140002
13 13 File Encoding : 65001
14 14  
15   - Date: 26/05/2022 00:10:12
  15 + Date: 15/06/2022 08:13:44
16 16 */
17 17  
18 18  
... ... @@ -365,17 +365,6 @@ START 1
365 365 CACHE 1;
366 366  
367 367 -- ----------------------------
368   --- Sequence structure for system_oauth2_approve_seq
369   --- ----------------------------
370   -DROP SEQUENCE IF EXISTS "system_oauth2_approve_seq";
371   -CREATE SEQUENCE "system_oauth2_approve_seq"
372   -INCREMENT 1
373   -MINVALUE 1
374   -MAXVALUE 9223372036854775807
375   -START 1
376   -CACHE 1;
377   -
378   --- ----------------------------
379 368 -- Sequence structure for system_oauth2_client_seq
380 369 -- ----------------------------
381 370 DROP SEQUENCE IF EXISTS "system_oauth2_client_seq";
... ... @@ -387,17 +376,6 @@ START 1
387 376 CACHE 1;
388 377  
389 378 -- ----------------------------
390   --- Sequence structure for system_oauth2_code_seq
391   --- ----------------------------
392   -DROP SEQUENCE IF EXISTS "system_oauth2_code_seq";
393   -CREATE SEQUENCE "system_oauth2_code_seq"
394   -INCREMENT 1
395   -MINVALUE 1
396   -MAXVALUE 9223372036854775807
397   -START 1
398   -CACHE 1;
399   -
400   --- ----------------------------
401 379 -- Sequence structure for system_oauth2_refresh_token_seq
402 380 -- ----------------------------
403 381 DROP SEQUENCE IF EXISTS "system_oauth2_refresh_token_seq";
... ... @@ -1745,7 +1723,8 @@ CREATE TABLE "infra_file" (
1745 1723 "create_time" timestamp(6) NOT NULL,
1746 1724 "updater" varchar(64) COLLATE "pg_catalog"."default",
1747 1725 "update_time" timestamp(6) NOT NULL,
1748   - "deleted" int2 NOT NULL DEFAULT 0
  1726 + "deleted" int2 NOT NULL DEFAULT 0,
  1727 + "name" varchar(255) COLLATE "pg_catalog"."default"
1749 1728 )
1750 1729 ;
1751 1730 COMMENT ON COLUMN "infra_file"."id" IS '文件编号';
... ... @@ -1759,6 +1738,7 @@ COMMENT ON COLUMN "infra_file"."create_time" IS '创建时间';
1759 1738 COMMENT ON COLUMN "infra_file"."updater" IS '更新者';
1760 1739 COMMENT ON COLUMN "infra_file"."update_time" IS '更新时间';
1761 1740 COMMENT ON COLUMN "infra_file"."deleted" IS '是否删除';
  1741 +COMMENT ON COLUMN "infra_file"."name" IS '文件名';
1762 1742 COMMENT ON TABLE "infra_file" IS '文件表';
1763 1743  
1764 1744 -- ----------------------------
... ... @@ -3413,47 +3393,6 @@ BEGIN;
3413 3393 COMMIT;
3414 3394  
3415 3395 -- ----------------------------
3416   --- Table structure for system_oauth2_approve
3417   --- ----------------------------
3418   -DROP TABLE IF EXISTS "system_oauth2_approve";
3419   -CREATE TABLE "system_oauth2_approve" (
3420   - "id" int8 NOT NULL,
3421   - "user_id" int8 NOT NULL,
3422   - "user_type" int2 NOT NULL,
3423   - "client_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
3424   - "scope" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
3425   - "approved" bool NOT NULL,
3426   - "expires_time" timestamp(6) NOT NULL,
3427   - "creator" varchar(64) COLLATE "pg_catalog"."default",
3428   - "create_time" timestamp(6) NOT NULL,
3429   - "updater" varchar(64) COLLATE "pg_catalog"."default",
3430   - "update_time" timestamp(6) NOT NULL,
3431   - "deleted" int2 NOT NULL DEFAULT 0,
3432   - "tenant_id" int8 NOT NULL
3433   -)
3434   -;
3435   -COMMENT ON COLUMN "system_oauth2_approve"."id" IS '编号';
3436   -COMMENT ON COLUMN "system_oauth2_approve"."user_id" IS '用户编号';
3437   -COMMENT ON COLUMN "system_oauth2_approve"."user_type" IS '用户类型';
3438   -COMMENT ON COLUMN "system_oauth2_approve"."client_id" IS '客户端编号';
3439   -COMMENT ON COLUMN "system_oauth2_approve"."scope" IS '授权范围';
3440   -COMMENT ON COLUMN "system_oauth2_approve"."approved" IS '是否接受';
3441   -COMMENT ON COLUMN "system_oauth2_approve"."expires_time" IS '过期时间';
3442   -COMMENT ON COLUMN "system_oauth2_approve"."creator" IS '创建者';
3443   -COMMENT ON COLUMN "system_oauth2_approve"."create_time" IS '创建时间';
3444   -COMMENT ON COLUMN "system_oauth2_approve"."updater" IS '更新者';
3445   -COMMENT ON COLUMN "system_oauth2_approve"."update_time" IS '更新时间';
3446   -COMMENT ON COLUMN "system_oauth2_approve"."deleted" IS '是否删除';
3447   -COMMENT ON COLUMN "system_oauth2_approve"."tenant_id" IS '租户编号';
3448   -COMMENT ON TABLE "system_oauth2_approve" IS 'OAuth2 批准表';
3449   -
3450   --- ----------------------------
3451   --- Records of system_oauth2_approve
3452   --- ----------------------------
3453   -BEGIN;
3454   -COMMIT;
3455   -
3456   --- ----------------------------
3457 3396 -- Table structure for system_oauth2_client
3458 3397 -- ----------------------------
3459 3398 DROP TABLE IF EXISTS "system_oauth2_client";
... ... @@ -3513,51 +3452,6 @@ INSERT INTO "system_oauth2_client" ("id", "client_id", "secret", "name", "logo",
3513 3452 COMMIT;
3514 3453  
3515 3454 -- ----------------------------
3516   --- Table structure for system_oauth2_code
3517   --- ----------------------------
3518   -DROP TABLE IF EXISTS "system_oauth2_code";
3519   -CREATE TABLE "system_oauth2_code" (
3520   - "id" int8 NOT NULL,
3521   - "user_id" int8 NOT NULL,
3522   - "user_type" int2 NOT NULL,
3523   - "code" varchar(32) COLLATE "pg_catalog"."default" NOT NULL,
3524   - "client_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
3525   - "scopes" varchar(255) COLLATE "pg_catalog"."default",
3526   - "expires_time" timestamp(6) NOT NULL,
3527   - "redirect_uri" varchar(255) COLLATE "pg_catalog"."default",
3528   - "state" varchar(255) COLLATE "pg_catalog"."default",
3529   - "creator" varchar(64) COLLATE "pg_catalog"."default",
3530   - "create_time" timestamp(6) NOT NULL,
3531   - "updater" varchar(64) COLLATE "pg_catalog"."default",
3532   - "update_time" timestamp(6) NOT NULL,
3533   - "deleted" int2 NOT NULL DEFAULT 0,
3534   - "tenant_id" int8 NOT NULL
3535   -)
3536   -;
3537   -COMMENT ON COLUMN "system_oauth2_code"."id" IS '编号';
3538   -COMMENT ON COLUMN "system_oauth2_code"."user_id" IS '用户编号';
3539   -COMMENT ON COLUMN "system_oauth2_code"."user_type" IS '用户类型';
3540   -COMMENT ON COLUMN "system_oauth2_code"."code" IS '授权码';
3541   -COMMENT ON COLUMN "system_oauth2_code"."client_id" IS '客户端编号';
3542   -COMMENT ON COLUMN "system_oauth2_code"."scopes" IS '授权范围';
3543   -COMMENT ON COLUMN "system_oauth2_code"."expires_time" IS '过期时间';
3544   -COMMENT ON COLUMN "system_oauth2_code"."redirect_uri" IS '可重定向的 URI 地址';
3545   -COMMENT ON COLUMN "system_oauth2_code"."state" IS '状态';
3546   -COMMENT ON COLUMN "system_oauth2_code"."creator" IS '创建者';
3547   -COMMENT ON COLUMN "system_oauth2_code"."create_time" IS '创建时间';
3548   -COMMENT ON COLUMN "system_oauth2_code"."updater" IS '更新者';
3549   -COMMENT ON COLUMN "system_oauth2_code"."update_time" IS '更新时间';
3550   -COMMENT ON COLUMN "system_oauth2_code"."deleted" IS '是否删除';
3551   -COMMENT ON COLUMN "system_oauth2_code"."tenant_id" IS '租户编号';
3552   -COMMENT ON TABLE "system_oauth2_code" IS 'OAuth2 授权码表';
3553   -
3554   --- ----------------------------
3555   --- Records of system_oauth2_code
3556   --- ----------------------------
3557   -BEGIN;
3558   -COMMIT;
3559   -
3560   --- ----------------------------
3561 3455 -- Table structure for system_oauth2_refresh_token
3562 3456 -- ----------------------------
3563 3457 DROP TABLE IF EXISTS "system_oauth2_refresh_token";
... ... @@ -4025,7 +3919,7 @@ COMMIT;
4025 3919 DROP TABLE IF EXISTS "system_sms_channel";
4026 3920 CREATE TABLE "system_sms_channel" (
4027 3921 "id" int8 NOT NULL,
4028   - "signature" varchar(10) COLLATE "pg_catalog"."default" NOT NULL,
  3922 + "signature" varchar(12) COLLATE "pg_catalog"."default" NOT NULL,
4029 3923 "code" varchar(63) COLLATE "pg_catalog"."default" NOT NULL,
4030 3924 "status" int2 NOT NULL,
4031 3925 "remark" varchar(255) COLLATE "pg_catalog"."default",
... ... @@ -4729,21 +4623,11 @@ SELECT setval('"system_oauth2_access_token_seq"', 11, true);
4729 4623 -- ----------------------------
4730 4624 -- Alter sequences owned by
4731 4625 -- ----------------------------
4732   -SELECT setval('"system_oauth2_approve_seq"', 4, true);
4733   -
4734   --- ----------------------------
4735   --- Alter sequences owned by
4736   --- ----------------------------
4737 4626 SELECT setval('"system_oauth2_client_seq"', 1, false);
4738 4627  
4739 4628 -- ----------------------------
4740 4629 -- Alter sequences owned by
4741 4630 -- ----------------------------
4742   -SELECT setval('"system_oauth2_code_seq"', 4, true);
4743   -
4744   --- ----------------------------
4745   --- Alter sequences owned by
4746   --- ----------------------------
4747 4631 SELECT setval('"system_oauth2_refresh_token_seq"', 1, true);
4748 4632  
4749 4633 -- ----------------------------
... ... @@ -5169,21 +5053,11 @@ ALTER TABLE "system_notice" ADD CONSTRAINT "system_notice_pkey" PRIMARY KEY ("id
5169 5053 ALTER TABLE "system_oauth2_access_token" ADD CONSTRAINT "system_oauth2_access_token_pkey" PRIMARY KEY ("id");
5170 5054  
5171 5055 -- ----------------------------
5172   --- Primary Key structure for table system_oauth2_approve
5173   --- ----------------------------
5174   -ALTER TABLE "system_oauth2_approve" ADD CONSTRAINT "system_oauth2_approve_pkey" PRIMARY KEY ("id");
5175   -
5176   --- ----------------------------
5177 5056 -- Primary Key structure for table system_oauth2_client
5178 5057 -- ----------------------------
5179 5058 ALTER TABLE "system_oauth2_client" ADD CONSTRAINT "system_oauth2_client_pkey" PRIMARY KEY ("id");
5180 5059  
5181 5060 -- ----------------------------
5182   --- Primary Key structure for table system_oauth2_code
5183   --- ----------------------------
5184   -ALTER TABLE "system_oauth2_code" ADD CONSTRAINT "system_oauth2_code_pkey" PRIMARY KEY ("id");
5185   -
5186   --- ----------------------------
5187 5061 -- Primary Key structure for table system_oauth2_refresh_token
5188 5062 -- ----------------------------
5189 5063 ALTER TABLE "system_oauth2_refresh_token" ADD CONSTRAINT "system_oauth2_refresh_token_pkey" PRIMARY KEY ("id");
... ...
sql/sqlserver/ruoyi-vue-pro.sql
... ... @@ -12,7 +12,7 @@
12 12 Target Server Version : 15004198
13 13 File Encoding : 65001
14 14  
15   - Date: 26/05/2022 01:01:02
  15 + Date: 15/06/2022 08:15:45
16 16 */
17 17  
18 18  
... ... @@ -2640,7 +2640,8 @@ CREATE TABLE [dbo].[infra_file] (
2640 2640 [create_time] datetime2(7) NOT NULL,
2641 2641 [updater] nvarchar(64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
2642 2642 [update_time] datetime2(7) NOT NULL,
2643   - [deleted] bit DEFAULT 0 NOT NULL
  2643 + [deleted] bit DEFAULT 0 NOT NULL,
  2644 + [name] nvarchar(256) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
2644 2645 )
2645 2646 GO
2646 2647  
... ... @@ -2725,6 +2726,13 @@ EXEC sp_addextendedproperty
2725 2726 GO
2726 2727  
2727 2728 EXEC sp_addextendedproperty
  2729 +'MS_Description', N'文件路径',
  2730 +'SCHEMA', N'dbo',
  2731 +'TABLE', N'infra_file',
  2732 +'COLUMN', N'name'
  2733 +GO
  2734 +
  2735 +EXEC sp_addextendedproperty
2728 2736 'MS_Description', N'文件表',
2729 2737 'SCHEMA', N'dbo',
2730 2738 'TABLE', N'infra_file'
... ... @@ -9490,7 +9498,7 @@ GO
9490 9498  
9491 9499 CREATE TABLE [dbo].[system_sms_channel] (
9492 9500 [id] bigint IDENTITY(1,1) NOT NULL,
9493   - [signature] nvarchar(10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
  9501 + [signature] nvarchar(12) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
9494 9502 [code] nvarchar(63) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
9495 9503 [status] tinyint NOT NULL,
9496 9504 [remark] nvarchar(255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
... ...
yudao-framework/pom.xml
... ... @@ -25,7 +25,6 @@
25 25  
26 26 <module>yudao-spring-boot-starter-excel</module>
27 27 <module>yudao-spring-boot-starter-test</module>
28   - <module>yudao-spring-boot-starter-extension</module>
29 28  
30 29 <module>yudao-spring-boot-starter-biz-operatelog</module>
31 30 <module>yudao-spring-boot-starter-biz-dict</module>
... ...
yudao-framework/yudao-spring-boot-starter-biz-dict/src/main/java/cn/iocoder/yudao/framework/dict/core/service/DictDataFrameworkService.java
... ... @@ -2,8 +2,6 @@ package cn.iocoder.yudao.framework.dict.core.service;
2 2  
3 3 import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO;
4 4  
5   -import java.util.List;
6   -
7 5 public interface DictDataFrameworkService {
8 6  
9 7 /**
... ... @@ -24,12 +22,4 @@ public interface DictDataFrameworkService {
24 22 */
25 23 DictDataRespDTO parseDictDataFromCache(String type, String label);
26 24  
27   - /**
28   - * 获得指定类型的字典数据,从缓存中
29   - *
30   - * @param type 字典类型
31   - * @return 字典数据列表
32   - */
33   - List<DictDataRespDTO> listDictDatasFromCache(String type);
34   -
35 25 }
... ...
yudao-framework/yudao-spring-boot-starter-biz-operatelog/pom.xml
... ... @@ -34,6 +34,13 @@
34 34 <scope>provided</scope>
35 35 </dependency>
36 36  
  37 + <!-- 业务组件 -->
  38 + <dependency>
  39 + <groupId>cn.iocoder.boot</groupId>
  40 + <artifactId>yudao-module-system-api</artifactId> <!-- 需要使用它,进行操作日志的记录 -->
  41 + <version>${revision}</version>
  42 + </dependency>
  43 +
37 44 <!-- 工具类相关 -->
38 45 <dependency>
39 46 <groupId>com.google.guava</groupId>
... ...
yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/config/YudaoOperateLogAutoConfiguration.java
1 1 package cn.iocoder.yudao.framework.operatelog.config;
2 2  
3 3 import cn.iocoder.yudao.framework.operatelog.core.aop.OperateLogAspect;
  4 +import cn.iocoder.yudao.framework.operatelog.core.service.OperateLogFrameworkService;
  5 +import cn.iocoder.yudao.framework.operatelog.core.service.OperateLogFrameworkServiceImpl;
  6 +import cn.iocoder.yudao.module.system.api.logger.OperateLogApi;
4 7 import org.springframework.context.annotation.Bean;
5 8 import org.springframework.context.annotation.Configuration;
6 9  
... ... @@ -12,4 +15,9 @@ public class YudaoOperateLogAutoConfiguration {
12 15 return new OperateLogAspect();
13 16 }
14 17  
  18 + @Bean
  19 + public OperateLogFrameworkService operateLogFrameworkService(OperateLogApi operateLogApi) {
  20 + return new OperateLogFrameworkServiceImpl(operateLogApi);
  21 + }
  22 +
15 23 }
... ...
yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/aop/OperateLogAspect.java
... ... @@ -9,9 +9,8 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
9 9 import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
10 10 import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils;
11 11 import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
12   -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
13   -import cn.iocoder.yudao.framework.operatelog.core.dto.OperateLogCreateReqDTO;
14 12 import cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum;
  13 +import cn.iocoder.yudao.framework.operatelog.core.service.OperateLog;
15 14 import cn.iocoder.yudao.framework.operatelog.core.service.OperateLogFrameworkService;
16 15 import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
17 16 import com.google.common.collect.Maps;
... ... @@ -57,13 +56,13 @@ public class OperateLogAspect {
57 56 /**
58 57 * 用于记录操作内容的上下文
59 58 *
60   - * @see OperateLogCreateReqDTO#getContent()
  59 + * @see OperateLog#getContent()
61 60 */
62 61 private static final ThreadLocal<String> CONTENT = new ThreadLocal<>();
63 62 /**
64 63 * 用于记录拓展字段的上下文
65 64 *
66   - * @see OperateLogCreateReqDTO#getExts()
  65 + * @see OperateLog#getExts()
67 66 */
68 67 private static final ThreadLocal<Map<String, Object>> EXTS = new ThreadLocal<>();
69 68  
... ... @@ -73,16 +72,20 @@ public class OperateLogAspect {
73 72 @Around("@annotation(apiOperation)")
74 73 public Object around(ProceedingJoinPoint joinPoint, ApiOperation apiOperation) throws Throwable {
75 74 // 可能也添加了 @ApiOperation 注解
76   - OperateLog operateLog = getMethodAnnotation(joinPoint, OperateLog.class);
  75 + cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog operateLog = getMethodAnnotation(joinPoint,
  76 + cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog.class);
77 77 return around0(joinPoint, operateLog, apiOperation);
78 78 }
79 79  
80 80 @Around("!@annotation(io.swagger.annotations.ApiOperation) && @annotation(operateLog)") // 兼容处理,只添加 @OperateLog 注解的情况
81   - public Object around(ProceedingJoinPoint joinPoint, OperateLog operateLog) throws Throwable {
  81 + public Object around(ProceedingJoinPoint joinPoint,
  82 + cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog operateLog) throws Throwable {
82 83 return around0(joinPoint, operateLog, null);
83 84 }
84 85  
85   - private Object around0(ProceedingJoinPoint joinPoint, OperateLog operateLog, ApiOperation apiOperation) throws Throwable {
  86 + private Object around0(ProceedingJoinPoint joinPoint,
  87 + cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog operateLog,
  88 + ApiOperation apiOperation) throws Throwable {
86 89 // 目前,只有管理员,才记录操作日志!所以非管理员,直接调用,不进行记录
87 90 Integer userType = WebFrameworkUtils.getLoginUserType();
88 91 if (!Objects.equals(userType, UserTypeEnum.ADMIN.getValue())) {
... ... @@ -121,7 +124,9 @@ public class OperateLogAspect {
121 124 EXTS.remove();
122 125 }
123 126  
124   - private void log(ProceedingJoinPoint joinPoint, OperateLog operateLog, ApiOperation apiOperation,
  127 + private void log(ProceedingJoinPoint joinPoint,
  128 + cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog operateLog,
  129 + ApiOperation apiOperation,
125 130 Date startTime, Object result, Throwable exception) {
126 131 try {
127 132 // 判断不记录的情况
... ... @@ -136,113 +141,119 @@ public class OperateLogAspect {
136 141 }
137 142 }
138 143  
139   - private void log0(ProceedingJoinPoint joinPoint, OperateLog operateLog, ApiOperation apiOperation,
  144 + private void log0(ProceedingJoinPoint joinPoint,
  145 + cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog operateLog,
  146 + ApiOperation apiOperation,
140 147 Date startTime, Object result, Throwable exception) {
141   - OperateLogCreateReqDTO operateLogDTO = new OperateLogCreateReqDTO();
  148 + OperateLog operateLogObj = new OperateLog();
142 149 // 补全通用字段
143   - operateLogDTO.setTraceId(TracerUtils.getTraceId());
144   - operateLogDTO.setStartTime(startTime);
  150 + operateLogObj.setTraceId(TracerUtils.getTraceId());
  151 + operateLogObj.setStartTime(startTime);
145 152 // 补充用户信息
146   - fillUserFields(operateLogDTO);
  153 + fillUserFields(operateLogObj);
147 154 // 补全模块信息
148   - fillModuleFields(operateLogDTO, joinPoint, operateLog, apiOperation);
  155 + fillModuleFields(operateLogObj, joinPoint, operateLog, apiOperation);
149 156 // 补全请求信息
150   - fillRequestFields(operateLogDTO);
  157 + fillRequestFields(operateLogObj);
151 158 // 补全方法信息
152   - fillMethodFields(operateLogDTO, joinPoint, operateLog, startTime, result, exception);
  159 + fillMethodFields(operateLogObj, joinPoint, operateLog, startTime, result, exception);
153 160  
154 161 // 异步记录日志
155   - operateLogFrameworkService.createOperateLogAsync(operateLogDTO);
  162 + operateLogFrameworkService.createOperateLog(operateLogObj);
156 163 }
157 164  
158   - private static void fillUserFields(OperateLogCreateReqDTO operateLogDTO) {
159   - operateLogDTO.setUserId(WebFrameworkUtils.getLoginUserId());
160   - operateLogDTO.setUserType(WebFrameworkUtils.getLoginUserType());
  165 + private static void fillUserFields(OperateLog operateLogObj) {
  166 + operateLogObj.setUserId(WebFrameworkUtils.getLoginUserId());
  167 + operateLogObj.setUserType(WebFrameworkUtils.getLoginUserType());
161 168 }
162 169  
163   - private static void fillModuleFields(OperateLogCreateReqDTO operateLogDTO,
164   - ProceedingJoinPoint joinPoint, OperateLog operateLog, ApiOperation apiOperation) {
  170 + private static void fillModuleFields(OperateLog operateLogObj,
  171 + ProceedingJoinPoint joinPoint,
  172 + cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog operateLog,
  173 + ApiOperation apiOperation) {
165 174 // module 属性
166 175 if (operateLog != null) {
167   - operateLogDTO.setModule(operateLog.module());
  176 + operateLogObj.setModule(operateLog.module());
168 177 }
169   - if (StrUtil.isEmpty(operateLogDTO.getModule())) {
  178 + if (StrUtil.isEmpty(operateLogObj.getModule())) {
170 179 Api api = getClassAnnotation(joinPoint, Api.class);
171 180 if (api != null) {
172 181 // 优先读取 @API 的 name 属性
173 182 if (StrUtil.isNotEmpty(api.value())) {
174   - operateLogDTO.setModule(api.value());
  183 + operateLogObj.setModule(api.value());
175 184 }
176 185 // 没有的话,读取 @API 的 tags 属性
177   - if (StrUtil.isEmpty(operateLogDTO.getModule()) && ArrayUtil.isNotEmpty(api.tags())) {
178   - operateLogDTO.setModule(api.tags()[0]);
  186 + if (StrUtil.isEmpty(operateLogObj.getModule()) && ArrayUtil.isNotEmpty(api.tags())) {
  187 + operateLogObj.setModule(api.tags()[0]);
179 188 }
180 189 }
181 190 }
182 191 // name 属性
183 192 if (operateLog != null) {
184   - operateLogDTO.setName(operateLog.name());
  193 + operateLogObj.setName(operateLog.name());
185 194 }
186   - if (StrUtil.isEmpty(operateLogDTO.getName()) && apiOperation != null) {
187   - operateLogDTO.setName(apiOperation.value());
  195 + if (StrUtil.isEmpty(operateLogObj.getName()) && apiOperation != null) {
  196 + operateLogObj.setName(apiOperation.value());
188 197 }
189 198 // type 属性
190 199 if (operateLog != null && ArrayUtil.isNotEmpty(operateLog.type())) {
191   - operateLogDTO.setType(operateLog.type()[0].getType());
  200 + operateLogObj.setType(operateLog.type()[0].getType());
192 201 }
193   - if (operateLogDTO.getType() == null) {
  202 + if (operateLogObj.getType() == null) {
194 203 RequestMethod requestMethod = obtainFirstMatchRequestMethod(obtainRequestMethod(joinPoint));
195 204 OperateTypeEnum operateLogType = convertOperateLogType(requestMethod);
196   - operateLogDTO.setType(operateLogType != null ? operateLogType.getType() : null);
  205 + operateLogObj.setType(operateLogType != null ? operateLogType.getType() : null);
197 206 }
198 207 // content 和 exts 属性
199   - operateLogDTO.setContent(CONTENT.get());
200   - operateLogDTO.setExts(EXTS.get());
  208 + operateLogObj.setContent(CONTENT.get());
  209 + operateLogObj.setExts(EXTS.get());
201 210 }
202 211  
203   - private static void fillRequestFields(OperateLogCreateReqDTO operateLogDTO) {
  212 + private static void fillRequestFields(OperateLog operateLogObj) {
204 213 // 获得 Request 对象
205 214 HttpServletRequest request = ServletUtils.getRequest();
206 215 if (request == null) {
207 216 return;
208 217 }
209 218 // 补全请求信息
210   - operateLogDTO.setRequestMethod(request.getMethod());
211   - operateLogDTO.setRequestUrl(request.getRequestURI());
212   - operateLogDTO.setUserIp(ServletUtil.getClientIP(request));
213   - operateLogDTO.setUserAgent(ServletUtils.getUserAgent(request));
  219 + operateLogObj.setRequestMethod(request.getMethod());
  220 + operateLogObj.setRequestUrl(request.getRequestURI());
  221 + operateLogObj.setUserIp(ServletUtil.getClientIP(request));
  222 + operateLogObj.setUserAgent(ServletUtils.getUserAgent(request));
214 223 }
215 224  
216   - private static void fillMethodFields(OperateLogCreateReqDTO operateLogDTO,
217   - ProceedingJoinPoint joinPoint, OperateLog operateLog,
  225 + private static void fillMethodFields(OperateLog operateLogObj,
  226 + ProceedingJoinPoint joinPoint,
  227 + cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog operateLog,
218 228 Date startTime, Object result, Throwable exception) {
219 229 MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
220   - operateLogDTO.setJavaMethod(methodSignature.toString());
  230 + operateLogObj.setJavaMethod(methodSignature.toString());
221 231 if (operateLog == null || operateLog.logArgs()) {
222   - operateLogDTO.setJavaMethodArgs(obtainMethodArgs(joinPoint));
  232 + operateLogObj.setJavaMethodArgs(obtainMethodArgs(joinPoint));
223 233 }
224 234 if (operateLog == null || operateLog.logResultData()) {
225   - operateLogDTO.setResultData(obtainResultData(result));
  235 + operateLogObj.setResultData(obtainResultData(result));
226 236 }
227   - operateLogDTO.setDuration((int) (System.currentTimeMillis() - startTime.getTime()));
  237 + operateLogObj.setDuration((int) (System.currentTimeMillis() - startTime.getTime()));
228 238 // (正常)处理 resultCode 和 resultMsg 字段
229 239 if (result != null) {
230 240 if (result instanceof CommonResult) {
231 241 CommonResult<?> commonResult = (CommonResult<?>) result;
232   - operateLogDTO.setResultCode(commonResult.getCode());
233   - operateLogDTO.setResultMsg(commonResult.getMsg());
  242 + operateLogObj.setResultCode(commonResult.getCode());
  243 + operateLogObj.setResultMsg(commonResult.getMsg());
234 244 } else {
235   - operateLogDTO.setResultCode(SUCCESS.getCode());
  245 + operateLogObj.setResultCode(SUCCESS.getCode());
236 246 }
237 247 }
238 248 // (异常)处理 resultCode 和 resultMsg 字段
239 249 if (exception != null) {
240   - operateLogDTO.setResultCode(INTERNAL_SERVER_ERROR.getCode());
241   - operateLogDTO.setResultMsg(ExceptionUtil.getRootCauseMessage(exception));
  250 + operateLogObj.setResultCode(INTERNAL_SERVER_ERROR.getCode());
  251 + operateLogObj.setResultMsg(ExceptionUtil.getRootCauseMessage(exception));
242 252 }
243 253 }
244 254  
245   - private static boolean isLogEnable(ProceedingJoinPoint joinPoint, OperateLog operateLog) {
  255 + private static boolean isLogEnable(ProceedingJoinPoint joinPoint,
  256 + cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog operateLog) {
246 257 // 有 @OperateLog 注解的情况下
247 258 if (operateLog != null) {
248 259 return operateLog.enable();
... ... @@ -256,9 +267,9 @@ public class OperateLogAspect {
256 267 return null;
257 268 }
258 269 return Arrays.stream(requestMethods).filter(requestMethod ->
259   - requestMethod == RequestMethod.POST
260   - || requestMethod == RequestMethod.PUT
261   - || requestMethod == RequestMethod.DELETE)
  270 + requestMethod == RequestMethod.POST
  271 + || requestMethod == RequestMethod.PUT
  272 + || requestMethod == RequestMethod.DELETE)
262 273 .findFirst().orElse(null);
263 274 }
264 275  
... ...
yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/dto/OperateLogCreateReqDTO.java deleted
1   -package cn.iocoder.yudao.framework.operatelog.core.dto;
2   -
3   -import io.swagger.annotations.ApiModelProperty;
4   -import lombok.Data;
5   -
6   -import javax.validation.constraints.NotEmpty;
7   -import javax.validation.constraints.NotNull;
8   -import java.util.Date;
9   -import java.util.Map;
10   -
11   -/**
12   - * 操作日志创建 Request DTO
13   - */
14   -@Data
15   -public class OperateLogCreateReqDTO {
16   -
17   - @ApiModelProperty(value = "链路追踪编号", required = true, example = "89aca178-a370-411c-ae02-3f0d672be4ab")
18   - @NotEmpty(message = "链路追踪编号不能为空")
19   - private String traceId;
20   -
21   - @ApiModelProperty(value = "用户编号", required = true, example = "1024")
22   - @NotNull(message = "用户编号不能为空")
23   - private Long userId;
24   - @ApiModelProperty(value = "用户类型", required = true, example = "1")
25   - @NotNull(message = "用户类型不能为空")
26   - private Integer userType;
27   -
28   - @ApiModelProperty(value = "操作模块", required = true, example = "订单")
29   - @NotEmpty(message = "操作模块不能为空")
30   - private String module;
31   -
32   - @ApiModelProperty(value = "操作名", required = true, example = "创建订单")
33   - @NotEmpty(message = "操作名")
34   - private String name;
35   -
36   - @ApiModelProperty(value = "操作分类", required = true, example = "1", notes = "参见 SysOperateLogTypeEnum 枚举类")
37   - @NotNull(message = "操作分类不能为空")
38   - private Integer type;
39   -
40   - @ApiModelProperty(value = "操作明细", example = "修改编号为 1 的用户信息,将性别从男改成女,将姓名从芋道改成源码。")
41   - private String content;
42   -
43   - @ApiModelProperty(value = "拓展字段", example = "{'orderId': 1}")
44   - private Map<String, Object> exts;
45   -
46   - @ApiModelProperty(value = "请求方法名", required = true, example = "GET")
47   - @NotEmpty(message = "请求方法名不能为空")
48   - private String requestMethod;
49   -
50   - @ApiModelProperty(value = "请求地址", required = true, example = "/xxx/yyy")
51   - @NotEmpty(message = "请求地址不能为空")
52   - private String requestUrl;
53   -
54   - @ApiModelProperty(value = "用户 IP", required = true, example = "127.0.0.1")
55   - @NotEmpty(message = "用户 IP 不能为空")
56   - private String userIp;
57   -
58   - @ApiModelProperty(value = "浏览器 UserAgent", required = true, example = "Mozilla/5.0")
59   - @NotEmpty(message = "浏览器 UserAgent 不能为空")
60   - private String userAgent;
61   -
62   - @ApiModelProperty(value = "Java 方法名", required = true, example = "cn.iocoder.yudao.UserController.save(...)")
63   - @NotEmpty(message = "Java 方法名不能为空")
64   - private String javaMethod;
65   -
66   - @ApiModelProperty(value = "Java 方法的参数")
67   - private String javaMethodArgs;
68   -
69   - @ApiModelProperty(value = "开始时间", required = true)
70   - @NotNull(message = "开始时间不能为空")
71   - private Date startTime;
72   -
73   - @ApiModelProperty(value = "执行时长,单位:毫秒", required = true)
74   - @NotNull(message = "执行时长不能为空")
75   - private Integer duration;
76   -
77   - @ApiModelProperty(value = "结果码", required = true)
78   - @NotNull(message = "结果码不能为空")
79   - private Integer resultCode;
80   -
81   - @ApiModelProperty(value = "结果提示")
82   - private String resultMsg;
83   -
84   - @ApiModelProperty(value = "结果数据")
85   - private String resultData;
86   -
87   -}
yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/service/OperateLog.java 0 → 100644
  1 +package cn.iocoder.yudao.framework.operatelog.core.service;
  2 +
  3 +import lombok.Data;
  4 +
  5 +import java.util.Date;
  6 +import java.util.Map;
  7 +
  8 +/**
  9 + * 操作日志
  10 + *
  11 + * @author 芋道源码
  12 + */
  13 +@Data
  14 +public class OperateLog {
  15 +
  16 + /**
  17 + * 链路追踪编号
  18 + */
  19 + private String traceId;
  20 +
  21 + /**
  22 + * 用户编号
  23 + */
  24 + private Long userId;
  25 + /**
  26 + * 用户类型
  27 + */
  28 + private Integer userType;
  29 +
  30 + /**
  31 + * 操作模块
  32 + */
  33 + private String module;
  34 +
  35 + /**
  36 + * 操作名
  37 + */
  38 + private String name;
  39 +
  40 + /**
  41 + * 操作分类
  42 + */
  43 + private Integer type;
  44 +
  45 + /**
  46 + * 操作明细
  47 + */
  48 + private String content;
  49 +
  50 + /**
  51 + * 拓展字段
  52 + */
  53 + private Map<String, Object> exts;
  54 +
  55 + /**
  56 + * 请求方法名
  57 + */
  58 + private String requestMethod;
  59 +
  60 + /**
  61 + * 请求地址
  62 + */
  63 + private String requestUrl;
  64 +
  65 + /**
  66 + * 用户 IP
  67 + */
  68 + private String userIp;
  69 +
  70 + /**
  71 + * 浏览器 UserAgent
  72 + */
  73 + private String userAgent;
  74 +
  75 + /**
  76 + * Java 方法名
  77 + */
  78 + private String javaMethod;
  79 +
  80 + /**
  81 + * Java 方法的参数
  82 + */
  83 + private String javaMethodArgs;
  84 +
  85 + /**
  86 + * 开始时间
  87 + */
  88 + private Date startTime;
  89 +
  90 + /**
  91 + * 执行时长,单位:毫秒
  92 + */
  93 + private Integer duration;
  94 +
  95 + /**
  96 + * 结果码
  97 + */
  98 + private Integer resultCode;
  99 +
  100 + /**
  101 + * 结果提示
  102 + */
  103 + private String resultMsg;
  104 +
  105 + /**
  106 + * 结果数据
  107 + */
  108 + private String resultData;
  109 +
  110 +}
... ...
yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/service/OperateLogFrameworkService.java
1 1 package cn.iocoder.yudao.framework.operatelog.core.service;
2 2  
3   -import cn.iocoder.yudao.framework.operatelog.core.dto.OperateLogCreateReqDTO;
4   -
5   -import java.util.concurrent.Future;
6   -
  3 +/**
  4 + * 操作日志 Framework Service 接口
  5 + *
  6 + * @author 芋道源码
  7 + */
7 8 public interface OperateLogFrameworkService {
8 9  
9 10 /**
10   - * 异步记录操作日志
  11 + * 记录操作日志
11 12 *
12   - * @param reqVO 操作日志请求
13   - * @return true: 记录成功,false: 记录失败
  13 + * @param operateLog 操作日志请求
14 14 */
15   - Future<Boolean> createOperateLogAsync(OperateLogCreateReqDTO reqVO);
  15 + void createOperateLog(OperateLog operateLog);
16 16  
17 17 }
... ...
yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/service/OperateLogFrameworkServiceImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.framework.operatelog.core.service;
  2 +
  3 +import cn.hutool.core.bean.BeanUtil;
  4 +import cn.iocoder.yudao.module.system.api.logger.OperateLogApi;
  5 +import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogCreateReqDTO;
  6 +import lombok.RequiredArgsConstructor;
  7 +import org.springframework.scheduling.annotation.Async;
  8 +
  9 +/**
  10 + * 操作日志 Framework Service 实现类
  11 + *
  12 + * 基于 {@link OperateLogApi} 实现,记录操作日志
  13 + *
  14 + * @author 芋道源码
  15 + */
  16 +@RequiredArgsConstructor
  17 +public class OperateLogFrameworkServiceImpl implements OperateLogFrameworkService {
  18 +
  19 + private final OperateLogApi operateLogApi;
  20 +
  21 + @Override
  22 + @Async
  23 + public void createOperateLog(OperateLog operateLog) {
  24 + OperateLogCreateReqDTO reqDTO = BeanUtil.copyProperties(operateLog, OperateLogCreateReqDTO.class);
  25 + operateLogApi.createOperateLog(reqDTO);
  26 + }
  27 +
  28 +}
... ...
yudao-framework/yudao-spring-boot-starter-extension/pom.xml deleted
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<project xmlns="http://maven.apache.org/POM/4.0.0"
3   - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4   - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5   - <parent>
6   - <artifactId>yudao-framework</artifactId>
7   - <groupId>cn.iocoder.boot</groupId>
8   - <version>${revision}</version>
9   - </parent>
10   - <modelVersion>4.0.0</modelVersion>
11   -
12   - <artifactId>yudao-spring-boot-starter-extension</artifactId>
13   - <packaging>jar</packaging>
14   -
15   - <name>${project.artifactId}</name>
16   - <description>扩展点组件</description>
17   - <url>https://github.com/YunaiV/ruoyi-vue-pro</url>
18   -
19   - <properties>
20   -
21   - </properties>
22   -
23   - <dependencies>
24   - <dependency>
25   - <groupId>cn.iocoder.boot</groupId>
26   - <artifactId>yudao-common</artifactId>
27   - </dependency>
28   -
29   - <!-- Spring 核心 -->
30   - <dependency>
31   - <groupId>org.springframework</groupId>
32   - <artifactId>spring-context</artifactId>
33   - <scope>provided</scope>
34   - </dependency>
35   -
36   - <dependency>
37   - <groupId>org.springframework</groupId>
38   - <artifactId>spring-beans</artifactId>
39   - <scope>provided</scope>
40   - </dependency>
41   -
42   - <!-- Spring 核心 -->
43   - <dependency>
44   - <groupId>org.springframework.boot</groupId>
45   - <artifactId>spring-boot-starter-aop</artifactId>
46   - </dependency>
47   -
48   - <!-- 测试包 -->
49   - <dependency>
50   - <groupId>org.springframework.boot</groupId>
51   - <artifactId>spring-boot-starter-test</artifactId>
52   - <scope>test</scope>
53   - </dependency>
54   -
55   - <!-- 测试包 -->
56   - <dependency>
57   - <groupId>junit</groupId>
58   - <artifactId>junit</artifactId>
59   - <scope>test</scope>
60   - </dependency>
61   -
62   - <!-- 工具类相关 -->
63   - <dependency>
64   - <groupId>jakarta.validation</groupId>
65   - <artifactId>jakarta.validation-api</artifactId>
66   - </dependency>
67   - </dependencies>
68   -</project>
69 0 \ No newline at end of file
yudao-framework/yudao-spring-boot-starter-extension/src/main/java/cn/iocoder/yudao/framework/extension/config/YudaoExtensionAutoConfiguration.java deleted
1   -package cn.iocoder.yudao.framework.extension.config;
2   -
3   -import cn.iocoder.yudao.framework.extension.core.ExtensionBootstrap;
4   -import cn.iocoder.yudao.framework.extension.core.context.ExtensionContext;
5   -import cn.iocoder.yudao.framework.extension.core.context.ExtensionContextHolder;
6   -import cn.iocoder.yudao.framework.extension.core.context.ExtensionExecutor;
7   -import cn.iocoder.yudao.framework.extension.core.factory.ExtensionFactory;
8   -import cn.iocoder.yudao.framework.extension.core.factory.ExtensionRegisterFactory;
9   -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
10   -import org.springframework.context.annotation.Bean;
11   -import org.springframework.context.annotation.Configuration;
12   -
13   -/**
14   - * @description 扩展点组件自动装配
15   - * @author Qingchen
16   - * @version 1.0.0
17   - * @date 2021-08-28 21:50
18   - * @class cn.iocoder.yudao.framework.extension.config.YudaoExtensionAutoConfiguration.java
19   - */
20   -@Configuration
21   -public class YudaoExtensionAutoConfiguration {
22   -
23   - /**
24   - * 组件初始化
25   - * @return
26   - */
27   - @Bean(initMethod = "init")
28   - @ConditionalOnMissingBean(ExtensionBootstrap.class)
29   - public ExtensionBootstrap bootstrap() {
30   - return new ExtensionBootstrap();
31   - }
32   -
33   - /**
34   - * 扩展点工厂
35   - * @return
36   - */
37   - @Bean
38   - @ConditionalOnMissingBean({ExtensionRegisterFactory.class, ExtensionFactory.class})
39   - public ExtensionRegisterFactory registerFactory() {
40   - return new ExtensionRegisterFactory();
41   - }
42   -
43   - /**
44   - * 扩展组件上下文对象
45   - * @return
46   - */
47   - @Bean
48   - @ConditionalOnMissingBean({ExtensionContextHolder.class, ExtensionContext.class})
49   - public ExtensionContextHolder context() {
50   - return new ExtensionContextHolder();
51   - }
52   -
53   - /**
54   - * 扩展组件执行器
55   - * @return
56   - */
57   - @Bean
58   - @ConditionalOnMissingBean(ExtensionExecutor.class)
59   - public ExtensionExecutor executor() {
60   - return new ExtensionExecutor();
61   - }
62   -}
yudao-framework/yudao-spring-boot-starter-extension/src/main/java/cn/iocoder/yudao/framework/extension/core/BusinessScenario.java deleted
1   -package cn.iocoder.yudao.framework.extension.core;
2   -
3   -import javax.validation.constraints.NotNull;
4   -import java.io.Serializable;
5   -import java.util.StringJoiner;
6   -
7   -/**
8   - * @description 业务场景 = businessId + useCase + scenario, 用来标识系统中唯一的一个场景<br/>
9   - * @author Qingchen
10   - * @version 1.0.0
11   - * @date 2021-08-28 22:19
12   - * @class cn.iocoder.yudao.framework.extension.core.BusinessScenario.java
13   - */
14   -public class BusinessScenario implements Serializable {
15   -
16   - /**
17   - * 默认业务id
18   - */
19   - public final static String DEFAULT_BUSINESS_ID = "#defaultBusinessId#";
20   -
21   - /**
22   - * 默认用例
23   - */
24   - public final static String DEFAULT_USECASE = "#defaultUseCase#";
25   -
26   - /**
27   - * 默认场景
28   - */
29   - public final static String DEFAULT_SCENARIO = "#defaultScenario#";
30   -
31   - /**
32   - * 分隔符
33   - */
34   - private final static String DOT_SEPARATOR = ".";
35   -
36   - /**
37   - * 业务Id
38   - */
39   - private String businessId;
40   -
41   - /**
42   - * 用例
43   - */
44   - private String useCase;
45   -
46   - /**
47   - * 场景
48   - */
49   - private String scenario;
50   -
51   - public BusinessScenario() {
52   - this.businessId = DEFAULT_BUSINESS_ID;
53   - this.useCase = DEFAULT_USECASE;
54   - this.scenario = DEFAULT_SCENARIO;
55   - }
56   -
57   - public BusinessScenario(@NotNull String businessId, @NotNull String useCase, @NotNull String scenario) {
58   - this.businessId = businessId;
59   - this.useCase = useCase;
60   - this.scenario = scenario;
61   - }
62   -
63   - public BusinessScenario(@NotNull String scenario) {
64   - this();
65   - this.scenario = scenario;
66   - }
67   -
68   - public BusinessScenario(@NotNull String useCase, @NotNull String scenario) {
69   - this(DEFAULT_BUSINESS_ID, useCase, scenario);
70   - }
71   -
72   - public String getBusinessId() {
73   - return businessId;
74   - }
75   -
76   - public void setBusinessId(String businessId) {
77   - this.businessId = businessId;
78   - }
79   -
80   - public String getUseCase() {
81   - return useCase;
82   - }
83   -
84   - public void setUseCase(String useCase) {
85   - this.useCase = useCase;
86   - }
87   -
88   - public String getScenario() {
89   - return scenario;
90   - }
91   -
92   - public void setScenario(String scenario) {
93   - this.scenario = scenario;
94   - }
95   -
96   - /**
97   - * 构建业务场景
98   - * @param businessId
99   - * @param useCase
100   - * @param scenario
101   - * @return
102   - */
103   - public static BusinessScenario valueOf(@NotNull String businessId, @NotNull String useCase, @NotNull String scenario) {
104   - return new BusinessScenario(businessId, useCase, scenario);
105   - }
106   -
107   - /**
108   - * 构建业务场景
109   - * @param useCase
110   - * @param scenario
111   - * @return
112   - */
113   - public static BusinessScenario valueOf(@NotNull String useCase, @NotNull String scenario) {
114   - return new BusinessScenario(useCase, scenario);
115   - }
116   -
117   - /**
118   - * 构建业务场景
119   - * @param scenario
120   - * @return
121   - */
122   - public static BusinessScenario valueOf(@NotNull String scenario) {
123   - return new BusinessScenario(scenario);
124   - }
125   -
126   - /**
127   - * 业务场景唯一标识
128   - * @return
129   - */
130   - public String getUniqueIdentity(){
131   - return new StringJoiner(DOT_SEPARATOR).add(businessId).add(useCase).add(scenario).toString();
132   - }
133   -
134   - @Override
135   - public String toString() {
136   - return "BusinessScenario{" +
137   - "businessId='" + businessId + '\'' +
138   - ", useCase='" + useCase + '\'' +
139   - ", scenario='" + scenario + '\'' +
140   - '}';
141   - }
142   -}
yudao-framework/yudao-spring-boot-starter-extension/src/main/java/cn/iocoder/yudao/framework/extension/core/ExtensionBootstrap.java deleted
1   -package cn.iocoder.yudao.framework.extension.core;
2   -
3   -import cn.iocoder.yudao.framework.extension.core.factory.ExtensionRegisterFactory;
4   -import org.springframework.beans.BeansException;
5   -import org.springframework.beans.factory.annotation.Autowired;
6   -import org.springframework.context.ApplicationContext;
7   -import org.springframework.context.ApplicationContextAware;
8   -
9   -import javax.annotation.PostConstruct;
10   -
11   -/**
12   - * @description
13   - * @author Qingchen
14   - * @version 1.0.0
15   - * @date 2021-08-29 00:18
16   - * @class cn.iocoder.yudao.framework.extension.core.ExtensionBootstrap.java
17   - */
18   -public class ExtensionBootstrap implements ApplicationContextAware {
19   -
20   - /**
21   - * spring 容器
22   - */
23   - private ApplicationContext applicationContext;
24   -
25   - @Autowired
26   - private ExtensionRegisterFactory registerFactory;
27   -
28   - /**
29   - * 初始化
30   - */
31   - @PostConstruct
32   - public void init() {
33   - registerFactory.setApplicationContext(applicationContext);
34   - registerFactory.register(null);
35   - }
36   -
37   - @Override
38   - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
39   - this.applicationContext = applicationContext;
40   - }
41   -}
yudao-framework/yudao-spring-boot-starter-extension/src/main/java/cn/iocoder/yudao/framework/extension/core/context/AbstractComponentExecutor.java deleted
1   -package cn.iocoder.yudao.framework.extension.core.context;
2   -
3   -import cn.iocoder.yudao.framework.extension.core.BusinessScenario;
4   -import cn.iocoder.yudao.framework.extension.core.point.ExtensionPoint;
5   -
6   -import java.util.function.Consumer;
7   -import java.util.function.Function;
8   -
9   -/**
10   - * @description 执行器通用方法
11   - * @author Qingchen
12   - * @version 1.0.0
13   - * @date 2021-08-29 00:38
14   - * @class cn.iocoder.yudao.framework.extension.core.context.AbstractComponentExecutor.java
15   - */
16   -public abstract class AbstractComponentExecutor {
17   -
18   - /**
19   - * ("业务" + "用例" + "场景")执行扩展组件,并返回执行结果
20   - * @param targetClazz
21   - * @param businessId
22   - * @param useCase
23   - * @param scenario
24   - * @param function
25   - * @param <R>
26   - * @param <T>
27   - * @return
28   - */
29   - public <R, T extends ExtensionPoint> R execute(Class<T> targetClazz, String businessId, String useCase, String scenario, Function<T, R> function) {
30   - return execute(targetClazz, BusinessScenario.valueOf(businessId, useCase, scenario), function);
31   - }
32   -
33   -
34   - /**
35   - * ("用例" + "场景")执行扩展组件,并返回执行结果
36   - * @param targetClazz
37   - * @param useCase
38   - * @param scenario
39   - * @param function
40   - * @param <R>
41   - * @param <T>
42   - * @return
43   - */
44   - public <R, T extends ExtensionPoint> R execute(Class<T> targetClazz, String useCase, String scenario, Function<T, R> function) {
45   - return execute(targetClazz, BusinessScenario.valueOf(useCase, scenario), function);
46   - }
47   -
48   - /**
49   - * ("场景")执行扩展组件,并返回执行结果
50   - * @param targetClazz
51   - * @param scenario
52   - * @param function
53   - * @param <R>
54   - * @param <T>
55   - * @return
56   - */
57   - public <R, T extends ExtensionPoint> R execute(Class<T> targetClazz, String scenario, Function<T, R> function) {
58   - return execute(targetClazz, BusinessScenario.valueOf(scenario), function);
59   - }
60   -
61   - /**
62   - * 执行扩展组件,并返回执行结果
63   - * @param targetClazz
64   - * @param businessScenario
65   - * @param function
66   - * @param <R> Response Type
67   - * @param <T> Parameter Type
68   - * @return
69   - */
70   - public <R, T extends ExtensionPoint> R execute(Class<T> targetClazz, BusinessScenario businessScenario, Function<T, R> function) {
71   - T component = locateComponent(targetClazz, businessScenario);
72   - return function.apply(component);
73   - }
74   -
75   - /**
76   - * ("业务" + "用例" + "场景")执行扩展组件,适用于无返回值的业务
77   - * @param targetClazz
78   - * @param businessId
79   - * @param useCase
80   - * @param scenario
81   - * @param consumer
82   - * @param <T>
83   - */
84   - public <T extends ExtensionPoint> void accept(Class<T> targetClazz, String businessId, String useCase, String scenario, Consumer<T> consumer) {
85   - accept(targetClazz, BusinessScenario.valueOf(businessId, useCase, scenario), consumer);
86   - }
87   -
88   - /**
89   - * ("场景")执行扩展组件,适用于无返回值的业务
90   - * @param targetClazz
91   - * @param useCase
92   - * @param scenario
93   - * @param consumer
94   - * @param <T>
95   - */
96   - public <T extends ExtensionPoint> void accept(Class<T> targetClazz, String useCase, String scenario, Consumer<T> consumer) {
97   - accept(targetClazz, BusinessScenario.valueOf(useCase, scenario), consumer);
98   - }
99   -
100   - /**
101   - * ("场景")执行扩展组件,适用于无返回值的业务
102   - * @param targetClazz
103   - * @param scenario
104   - * @param consumer
105   - * @param <T>
106   - */
107   - public <T extends ExtensionPoint> void accept(Class<T> targetClazz, String scenario, Consumer<T> consumer) {
108   - accept(targetClazz, BusinessScenario.valueOf(scenario), consumer);
109   - }
110   -
111   - /**
112   - * 执行扩展组件,适用于无返回值的业务
113   - * @param targetClazz
114   - * @param businessScenario
115   - * @param consumer
116   - * @param <T> Parameter Type
117   - */
118   - public <T extends ExtensionPoint> void accept(Class<T> targetClazz, BusinessScenario businessScenario, Consumer<T> consumer) {
119   - T component = locateComponent(targetClazz, businessScenario);
120   - consumer.accept(component);
121   - }
122   -
123   - /**
124   - * 获取/定位扩展点组件
125   - * @param targetClazz
126   - * @param businessScenario
127   - * @param <C>
128   - * @return
129   - */
130   - protected abstract <C extends ExtensionPoint> C locateComponent(Class<C> targetClazz, BusinessScenario businessScenario);
131   -}
yudao-framework/yudao-spring-boot-starter-extension/src/main/java/cn/iocoder/yudao/framework/extension/core/context/ExtensionContext.java deleted
1   -package cn.iocoder.yudao.framework.extension.core.context;
2   -
3   -import cn.iocoder.yudao.framework.extension.core.BusinessScenario;
4   -import cn.iocoder.yudao.framework.extension.core.point.ExtensionPoint;
5   -
6   -/**
7   - * @description 上下文,包含各个扩展点的相关操作
8   - * @author Qingchen
9   - * @version 1.0.0
10   - * @date 2021-08-28 22:15
11   - * @class cn.iocoder.yudao.framework.extension.core.context.ExtensionContext.java
12   - */
13   -public interface ExtensionContext {
14   -
15   - /**
16   - * 根据业务场景唯一标识获取扩展点组件实现类
17   - * @param businessId
18   - * @param useCase
19   - * @param scenario
20   - * @param clazz
21   - * @param <T>
22   - * @return
23   - */
24   - <T extends ExtensionPoint> T getPoint(String businessId, String useCase, String scenario, Class<T> clazz);
25   -
26   - /**
27   - * 根据("实例" + "场景")获取扩展点组件实现类,其中:业务id(businessId)= {@linkplain cn.iocoder.yudao.framework.extension.core.BusinessScenario.DEFAULT_BUSINESS_ID}
28   - * @param useCase
29   - * @param scenario
30   - * @param clazz
31   - * @param <T>
32   - * @return
33   - */
34   - <T extends ExtensionPoint> T getPoint(String useCase, String scenario, Class<T> clazz);
35   -
36   - /**
37   - * 根据("场景")获取扩展点组件实现类 <br/>
38   - * 其中:
39   - * 业务id(businessId)= {@linkplain cn.iocoder.yudao.framework.extension.core.BusinessScenario.DEFAULT_BUSINESS_ID}
40   - * 实例(useCase)= {@linkplain cn.iocoder.yudao.framework.extension.core.BusinessScenario.DEFAULT_USECASE}
41   - * @param scenario
42   - * @param clazz
43   - * @param <T>
44   - * @return
45   - */
46   - <T extends ExtensionPoint> T getPoint(String scenario, Class<T> clazz);
47   -
48   - /**
49   - * 根据业务场景唯一标识获取扩展点组件实现类
50   - * @param businessScenario
51   - * @param clazz
52   - * @param <T>
53   - * @return
54   - */
55   - <T extends ExtensionPoint> T getPoint(BusinessScenario businessScenario, Class<T> clazz);
56   -}
yudao-framework/yudao-spring-boot-starter-extension/src/main/java/cn/iocoder/yudao/framework/extension/core/context/ExtensionContextHolder.java deleted
1   -package cn.iocoder.yudao.framework.extension.core.context;
2   -
3   -import cn.iocoder.yudao.framework.extension.core.BusinessScenario;
4   -import cn.iocoder.yudao.framework.extension.core.factory.ExtensionFactory;
5   -import cn.iocoder.yudao.framework.extension.core.point.ExtensionPoint;
6   -import lombok.extern.slf4j.Slf4j;
7   -import org.springframework.beans.factory.annotation.Autowired;
8   -import org.springframework.stereotype.Component;
9   -
10   -import javax.validation.constraints.NotNull;
11   -
12   -/**
13   - * @description 上下文及扩展点组件工厂的持有类
14   - * @author Qingchen
15   - * @version 1.0.0
16   - * @date 2021-08-29 00:29
17   - * @class cn.iocoder.yudao.framework.extension.core.context.ExtensionContextHolder.java
18   - */
19   -@Component
20   -@Slf4j
21   -public class ExtensionContextHolder implements ExtensionContext{
22   -
23   - @Autowired
24   - private ExtensionFactory factory;
25   -
26   - @Override
27   - public <T extends ExtensionPoint> T getPoint(@NotNull String businessId, @NotNull String useCase, @NotNull String scenario, Class<T> clazz) {
28   - return getPoint(BusinessScenario.valueOf(businessId, useCase, scenario), clazz);
29   - }
30   -
31   - @Override
32   - public <T extends ExtensionPoint> T getPoint(@NotNull String useCase, String scenario, Class<T> clazz) {
33   - return getPoint(BusinessScenario.valueOf(useCase, scenario), clazz);
34   - }
35   -
36   - @Override
37   - public <T extends ExtensionPoint> T getPoint(@NotNull String scenario, Class<T> clazz) {
38   - return getPoint(BusinessScenario.valueOf(scenario), clazz);
39   - }
40   -
41   - @Override
42   - public <T extends ExtensionPoint> T getPoint(@NotNull BusinessScenario businessScenario, Class<T> clazz) {
43   - return factory.get(businessScenario, clazz);
44   - }
45   -}
yudao-framework/yudao-spring-boot-starter-extension/src/main/java/cn/iocoder/yudao/framework/extension/core/context/ExtensionExecutor.java deleted
1   -package cn.iocoder.yudao.framework.extension.core.context;
2   -
3   -import cn.iocoder.yudao.framework.extension.core.BusinessScenario;
4   -import cn.iocoder.yudao.framework.extension.core.point.ExtensionPoint;
5   -import lombok.extern.slf4j.Slf4j;
6   -import org.springframework.beans.factory.annotation.Autowired;
7   -import org.springframework.stereotype.Component;
8   -
9   -/**
10   - * @description 扩展组件执行器
11   - * @author Qingchen
12   - * @version 1.0.0
13   - * @date 2021-08-29 00:32
14   - * @class cn.iocoder.yudao.framework.extension.core.context.ExtensionExecutor.java
15   - */
16   -@Component
17   -@Slf4j
18   -public class ExtensionExecutor extends AbstractComponentExecutor{
19   -
20   - @Autowired
21   - private ExtensionContextHolder contextHolder;
22   -
23   -
24   - @Override
25   - protected <C extends ExtensionPoint> C locateComponent(Class<C> targetClazz, BusinessScenario businessScenario) {
26   - return contextHolder.getPoint(businessScenario, targetClazz);
27   - }
28   -}
yudao-framework/yudao-spring-boot-starter-extension/src/main/java/cn/iocoder/yudao/framework/extension/core/factory/ExtensionDefinition.java deleted
1   -package cn.iocoder.yudao.framework.extension.core.factory;
2   -
3   -import cn.iocoder.yudao.framework.extension.core.BusinessScenario;
4   -import cn.iocoder.yudao.framework.extension.core.point.ExtensionPoint;
5   -import lombok.Getter;
6   -import lombok.Setter;
7   -
8   -import javax.validation.constraints.NotNull;
9   -import java.io.Serializable;
10   -import java.util.Objects;
11   -
12   -/**
13   - * @description 扩展定义(扩展坐标),标识唯一一个业务场景实现
14   - * @author Qingchen
15   - * @version 1.0.0
16   - * @date 2021-08-28 23:14
17   - * @class cn.iocoder.yudao.framework.extension.core.factory.ExtensionDefinition.java
18   - */
19   -@Setter
20   -@Getter
21   -public class ExtensionDefinition implements Serializable {
22   -
23   - /**
24   - * 业务场景唯一标识(id)
25   - */
26   - private String uniqueIdentify;
27   -
28   - /**
29   - * 扩展点实现类名称
30   - */
31   - private String extensionPointName;
32   -
33   - /**
34   - * 业务场景
35   - */
36   - private BusinessScenario businessScenario;
37   -
38   - /**
39   - * 扩展点实现类
40   - */
41   - private ExtensionPoint extensionPoint;
42   -
43   - /**
44   - * class
45   - */
46   - private Class extensionPointClass;
47   -
48   - public ExtensionDefinition() {
49   - }
50   -
51   - public ExtensionDefinition(@NotNull BusinessScenario businessScenario, @NotNull ExtensionPoint extensionPoint) {
52   - this.businessScenario = businessScenario;
53   - this.extensionPoint = extensionPoint;
54   - this.uniqueIdentify = this.businessScenario.getUniqueIdentity();
55   - this.extensionPointClass = this.extensionPoint.getClass();
56   - }
57   -
58   - /**
59   - * 构建definition
60   - * @param businessScenario
61   - * @param point
62   - * @return
63   - */
64   - public static ExtensionDefinition valueOf(@NotNull BusinessScenario businessScenario, @NotNull ExtensionPoint point) {
65   - return new ExtensionDefinition(businessScenario, point);
66   - }
67   -
68   - @Override
69   - public boolean equals(Object o) {
70   - if (this == o) {
71   - return true;
72   - }
73   - if (o == null || getClass() != o.getClass()) {
74   - return false;
75   - }
76   - ExtensionDefinition that = (ExtensionDefinition) o;
77   - return Objects.equals(uniqueIdentify, that.uniqueIdentify) && Objects.equals(extensionPointName, that.extensionPointName);
78   - }
79   -
80   - @Override
81   - public int hashCode() {
82   - final int prime = 31;
83   - int result = 1;
84   - result = prime * result + ((uniqueIdentify == null) ? 0 : uniqueIdentify.hashCode());
85   - result = prime * result + ((extensionPointName == null) ? 0 : extensionPointName.hashCode());
86   - return result;
87   - }
88   -
89   - @Override
90   - public String toString() {
91   - return "ExtensionDefinition{" +
92   - "uniqueIdentify='" + uniqueIdentify + '\'' +
93   - ", extensionPointName='" + extensionPointName + '\'' +
94   - '}';
95   - }
96   -}
yudao-framework/yudao-spring-boot-starter-extension/src/main/java/cn/iocoder/yudao/framework/extension/core/factory/ExtensionFactory.java deleted
1   -package cn.iocoder.yudao.framework.extension.core.factory;
2   -
3   -import cn.iocoder.yudao.framework.extension.core.BusinessScenario;
4   -import cn.iocoder.yudao.framework.extension.core.point.ExtensionPoint;
5   -
6   -/**
7   - * @description 扩展点工厂
8   - * @author Qingchen
9   - * @version 1.0.0
10   - * @date 2021-08-28 23:04
11   - * @class cn.iocoder.yudao.framework.extension.core.factory.ExtensionFactory.java
12   - */
13   -public interface ExtensionFactory {
14   -
15   - /**
16   - * 注册所有扩展点实现类
17   - * @param basePackage
18   - */
19   - void register(String basePackage);
20   -
21   - /**
22   - * 根据业务场景获取指定类型的扩展点
23   - * @param businessScenario
24   - * @param clazz
25   - * @param <T>
26   - * @return
27   - */
28   - <T extends ExtensionPoint> T get(BusinessScenario businessScenario, Class<T> clazz);
29   -}
yudao-framework/yudao-spring-boot-starter-extension/src/main/java/cn/iocoder/yudao/framework/extension/core/factory/ExtensionRegisterFactory.java deleted
1   -package cn.iocoder.yudao.framework.extension.core.factory;
2   -
3   -import cn.iocoder.yudao.framework.extension.core.BusinessScenario;
4   -import cn.iocoder.yudao.framework.extension.core.point.ExtensionPoint;
5   -import cn.iocoder.yudao.framework.extension.core.stereotype.Extension;
6   -import lombok.extern.slf4j.Slf4j;
7   -import org.springframework.aop.support.AopUtils;
8   -import org.springframework.context.ApplicationContext;
9   -import org.springframework.core.annotation.AnnotationUtils;
10   -import org.springframework.stereotype.Component;
11   -import org.springframework.util.ClassUtils;
12   -
13   -import javax.validation.constraints.NotNull;
14   -import java.util.Map;
15   -import java.util.concurrent.ConcurrentHashMap;
16   -
17   -/**
18   - * @description 注册工厂
19   - * @author Qingchen
20   - * @version 1.0.0
21   - * @date 2021-08-28 23:07
22   - * @class cn.iocoder.yudao.framework.extension.core.factory.ExtensionRegisterFactory.java
23   - */
24   -@Component
25   -@Slf4j
26   -public class ExtensionRegisterFactory implements ExtensionFactory {
27   -
28   - /**
29   - * spring ApplicationContext
30   - */
31   - private ApplicationContext applicationContext;
32   -
33   - /**
34   - * 扩展点实现类集合
35   - */
36   - private Map<String, ExtensionDefinition> registerExtensionBeans = new ConcurrentHashMap<>();
37   -
38   - @Override
39   - public void register(String basePackage) {
40   - final Map<String, Object> beans = applicationContext.getBeansWithAnnotation(Extension.class);
41   - if(beans == null || beans.isEmpty()) {
42   - return;
43   - }
44   -
45   - beans.values().forEach(point -> doRegister((ExtensionPoint) point));
46   - log.info("业务场景相关扩展点注册完成,注册数量: {}", registerExtensionBeans.size());
47   - }
48   -
49   - @Override
50   - public <T extends ExtensionPoint> T get(BusinessScenario businessScenario, Class<T> clazz) {
51   -
52   - final ExtensionDefinition definition = registerExtensionBeans.get(businessScenario.getUniqueIdentity());
53   - if(definition == null) {
54   - log.error("获取业务场景扩展点实现失败,失败原因:尚未定义该业务场景相关扩展点。{}", businessScenario);
55   - throw new RuntimeException("尚未定义该业务场景相关扩展点 [" + businessScenario + "]");
56   - }
57   -
58   - return (T) definition.getExtensionPoint();
59   - }
60   -
61   - /**
62   - * 注册扩展点
63   - * @param point
64   - */
65   - private void doRegister(@NotNull ExtensionPoint point) {
66   - Class<?> extensionClazz = point.getClass();
67   -
68   - if (AopUtils.isAopProxy(point)) {
69   - extensionClazz = ClassUtils.getUserClass(point);
70   - }
71   -
72   - Extension extension = AnnotationUtils.findAnnotation(extensionClazz, Extension.class);
73   - final BusinessScenario businessScenario = BusinessScenario.valueOf(extension.businessId(), extension.useCase(), extension.scenario());
74   - final ExtensionDefinition definition = ExtensionDefinition.valueOf(businessScenario, point);
75   - final ExtensionDefinition exist = registerExtensionBeans.get(businessScenario.getUniqueIdentity());
76   - if(exist != null && !exist.equals(definition)) {
77   - throw new RuntimeException("相同的业务场景重复注册了不同类型的扩展点实现 :【" + definition + "】【" + exist + "】");
78   - }
79   -
80   - registerExtensionBeans.put(businessScenario.getUniqueIdentity(), definition);
81   - }
82   -
83   - public void setApplicationContext(ApplicationContext applicationContext) {
84   - this.applicationContext = applicationContext;
85   - }
86   -}
yudao-framework/yudao-spring-boot-starter-extension/src/main/java/cn/iocoder/yudao/framework/extension/core/package-info.java deleted
1   -/**
2   - * @description core 核心
3   - * @author Qingchen
4   - * @version 1.0.0
5   - * @date 2021-08-28 21:54
6   - * @class cn.iocoder.yudao.framework.extension.core.package-info.java
7   - */
8   -package cn.iocoder.yudao.framework.extension.core;
9 0 \ No newline at end of file
yudao-framework/yudao-spring-boot-starter-extension/src/main/java/cn/iocoder/yudao/framework/extension/core/point/ExtensionPoint.java deleted
1   -package cn.iocoder.yudao.framework.extension.core.point;
2   -/**
3   - * @description 扩展点 <br/>
4   - * 表示一块逻辑在不同的业务有不同的实现,使用扩展点做接口申明,然后用{@linkplain cn.iocoder.yudao.framework.extension.core.stereotype.Extension}(扩展)去实现扩展点。
5   - * @author Qingchen
6   - * @version 1.0.0
7   - * @date 2021-08-28 22:06
8   - * @class cn.iocoder.yudao.framework.extension.core.point.ExtensionPoint.java
9   - */
10   -public interface ExtensionPoint {
11   -}
yudao-framework/yudao-spring-boot-starter-extension/src/main/java/cn/iocoder/yudao/framework/extension/core/stereotype/Extension.java deleted
1   -package cn.iocoder.yudao.framework.extension.core.stereotype;
2   -
3   -import cn.iocoder.yudao.framework.extension.core.BusinessScenario;
4   -import org.springframework.stereotype.Component;
5   -
6   -import java.lang.annotation.*;
7   -
8   -/**
9   - * @description 表示带注释的类是“扩展组件”
10   - * @author Qingchen
11   - * @version 1.0.0
12   - * @date 2021-08-28 21:59
13   - * @class cn.iocoder.yudao.framework.extension.core.stereotype.Extension.java
14   - */
15   -@Inherited
16   -@Retention(RetentionPolicy.RUNTIME)
17   -@Target({ElementType.TYPE})
18   -@Component
19   -public @interface Extension {
20   -
21   - /**
22   - * 业务 <br/>
23   - * 一个自负盈亏的财务主体,比如tmall、淘宝和零售通就是三个不同的业务
24   - * @return
25   - */
26   - String businessId() default BusinessScenario.DEFAULT_BUSINESS_ID;
27   -
28   - /**
29   - * 用例 <br/>
30   - * 描述了用户和系统之间的互动,每个用例提供了一个或多个场景。比如,支付订单就是一个典型的用例。
31   - * @return
32   - */
33   - String useCase() default BusinessScenario.DEFAULT_USECASE;
34   -
35   - /**
36   - * 场景 <br/>
37   - * 场景也被称为用例的实例(Instance),包括用例所有的可能情况(正常的和异常的)。比如对于"订单支付"这个用例,就有“支付宝支付”、“银行卡支付”、"微信支付"等多个场景
38   - * @return
39   - */
40   - String scenario() default BusinessScenario.DEFAULT_SCENARIO;
41   -}
yudao-framework/yudao-spring-boot-starter-extension/src/main/java/cn/iocoder/yudao/framework/extension/package-info.java deleted
1   -/**
2   - * @description 扩展点组件
3   - * @author Qingchen
4   - * @version 1.0.0
5   - * @date 2021-08-28 14:35
6   - * @class cn.iocoder.yudao.framework.extension.package-info.java
7   - */
8   -package cn.iocoder.yudao.framework.extension;
9 0 \ No newline at end of file
yudao-framework/yudao-spring-boot-starter-extension/src/main/resources/META-INF/spring.factories deleted
1   -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
2   - cn.iocoder.yudao.framework.extension.config.YudaoExtensionAutoConfiguration
yudao-framework/yudao-spring-boot-starter-extension/src/test/java/cn/iocoder/yudao/framework/extension/Application.java deleted
1   -package cn.iocoder.yudao.framework.extension;
2   -
3   -import org.springframework.boot.SpringApplication;
4   -import org.springframework.boot.autoconfigure.SpringBootApplication;
5   -
6   -/**
7   - * @description Application
8   - * @author Qingchen
9   - * @version 1.0.0
10   - * @date 2021-08-30 10:32
11   - * @class cn.iocoder.yudao.framework.extension.Application.java
12   - */
13   -@SpringBootApplication
14   -public class Application {
15   -
16   - public static void main(String[] args) {
17   - SpringApplication.run(Application.class, args);
18   - }
19   -}
yudao-framework/yudao-spring-boot-starter-extension/src/test/java/cn/iocoder/yudao/framework/extension/ExtensionTest.java deleted
1   -package cn.iocoder.yudao.framework.extension;
2   -
3   -import cn.hutool.core.util.IdUtil;
4   -import cn.hutool.json.JSONUtil;
5   -import cn.iocoder.yudao.framework.extension.core.BusinessScenario;
6   -import cn.iocoder.yudao.framework.extension.core.context.ExtensionExecutor;
7   -import cn.iocoder.yudao.framework.extension.pay.PayExtensionPoint;
8   -import cn.iocoder.yudao.framework.extension.pay.command.TransactionsCommand;
9   -import cn.iocoder.yudao.framework.extension.pay.domain.TransactionsResult;
10   -import lombok.extern.slf4j.Slf4j;
11   -import org.junit.Assert;
12   -import org.junit.Test;
13   -import org.junit.runner.RunWith;
14   -import org.springframework.beans.factory.annotation.Autowired;
15   -import org.springframework.boot.test.context.SpringBootTest;
16   -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
17   -
18   -import java.math.BigDecimal;
19   -
20   -/**
21   - * @description
22   - * @author Qingchen
23   - * @version 1.0.0
24   - * @date 2021-08-30 10:30
25   - * @class cn.iocoder.yudao.framework.extension.ExtensionTest.java
26   - */
27   -@RunWith(SpringJUnit4ClassRunner.class)
28   -@SpringBootTest(classes = Application.class)
29   -@Slf4j
30   -public class ExtensionTest {
31   -
32   - @Autowired
33   - private ExtensionExecutor extensionExecutor;
34   -
35   - @Test
36   - public void unifiedOrder() {
37   - final BusinessScenario scenario = BusinessScenario.valueOf("pay", "jsapi", "wechat");
38   - final TransactionsCommand command = new TransactionsCommand(IdUtil.objectId(), new BigDecimal(105), "Image形象店-深圳腾大-QQ公仔", "https://www.weixin.qq.com/wxpay/pay.php");
39   - final TransactionsResult result = extensionExecutor.execute(PayExtensionPoint.class, scenario, extension -> extension.unifiedOrder(command));
40   - log.info("result is: {}", JSONUtil.toJsonStr(result));
41   - Assert.assertSame("wechat", result.getChannel());
42   - }
43   -}
yudao-framework/yudao-spring-boot-starter-extension/src/test/java/cn/iocoder/yudao/framework/extension/package-info.java deleted
1   -/**
2   - * @description
3   - * @author Qingchen
4   - * @version 1.0.0
5   - * @date 2021-08-30 10:25
6   - * @class cn.iocoder.yudao.framework.extension.package-info.java
7   - */
8   -package cn.iocoder.yudao.framework.extension;
9 0 \ No newline at end of file
yudao-framework/yudao-spring-boot-starter-extension/src/test/java/cn/iocoder/yudao/framework/extension/pay/PayExtensionPoint.java deleted
1   -package cn.iocoder.yudao.framework.extension.pay;
2   -
3   -import cn.iocoder.yudao.framework.extension.core.point.ExtensionPoint;
4   -import cn.iocoder.yudao.framework.extension.pay.command.TransactionsCommand;
5   -import cn.iocoder.yudao.framework.extension.pay.domain.TransactionsResult;
6   -
7   -/**
8   - * @description 支付操作接口
9   - * @author Qingchen
10   - * @version 1.0.0
11   - * @date 2021-08-30 10:35
12   - * @class cn.iocoder.yudao.framework.extension.pay.PayExtensionPoint.java
13   - */
14   -public interface PayExtensionPoint extends ExtensionPoint {
15   -
16   - /**
17   - * 统一下单:获取"预支付交易会话标识"
18   - * @param command
19   - * @return
20   - */
21   - TransactionsResult unifiedOrder(TransactionsCommand command);
22   -}
yudao-framework/yudao-spring-boot-starter-extension/src/test/java/cn/iocoder/yudao/framework/extension/pay/command/TransactionsCommand.java deleted
1   -package cn.iocoder.yudao.framework.extension.pay.command;
2   -
3   -import lombok.AllArgsConstructor;
4   -import lombok.Data;
5   -import lombok.NoArgsConstructor;
6   -
7   -import java.io.Serializable;
8   -import java.math.BigDecimal;
9   -
10   -/**
11   - * @description 下单请求
12   - * @author Qingchen
13   - * @version 1.0.0
14   - * @date 2021-08-30 10:48
15   - * @class cn.iocoder.yudao.framework.extension.pay.command.TransactionsCommand.java
16   - */
17   -@Data
18   -@NoArgsConstructor
19   -@AllArgsConstructor
20   -public class TransactionsCommand implements Serializable {
21   - /**
22   - * 订单编号
23   - */
24   - private String orderNo;
25   -
26   - /**
27   - * 支付金额
28   - */
29   - private BigDecimal amount;
30   -
31   - /**
32   - * 商品描述
33   - */
34   - private String productDescription;
35   -
36   - /**
37   - * 通知地址
38   - */
39   - private String notifyUrl;
40   -}
yudao-framework/yudao-spring-boot-starter-extension/src/test/java/cn/iocoder/yudao/framework/extension/pay/domain/TransactionsResult.java deleted
1   -package cn.iocoder.yudao.framework.extension.pay.domain;
2   -
3   -import lombok.*;
4   -
5   -import java.io.Serializable;
6   -
7   -/**
8   - * @description 下单: 预支付交易单返回结果
9   - * @author Qingchen
10   - * @version 1.0.0
11   - * @date 2021-08-30 10:43
12   - * @class cn.iocoder.yudao.framework.extension.pay.domain.TransactionsResult.java
13   - */
14   -@Data
15   -@AllArgsConstructor
16   -public class TransactionsResult implements Serializable {
17   -
18   - /**
19   - * 预支付交易会话标识
20   - */
21   - private String prepayId;
22   -
23   - /**
24   - * 订单编号
25   - */
26   - private String orderNo;
27   -
28   - /**
29   - * 系统内部支付单号
30   - */
31   - private String paymentNo;
32   -
33   - /**
34   - * 支付渠道:微信 or 支付宝
35   - */
36   - private String channel;
37   -
38   -
39   -}
yudao-framework/yudao-spring-boot-starter-extension/src/test/java/cn/iocoder/yudao/framework/extension/pay/impl/AlipayService.java deleted
1   -package cn.iocoder.yudao.framework.extension.pay.impl;
2   -
3   -import cn.hutool.core.util.IdUtil;
4   -import cn.hutool.json.JSONUtil;
5   -import cn.iocoder.yudao.framework.extension.core.stereotype.Extension;
6   -import cn.iocoder.yudao.framework.extension.pay.PayExtensionPoint;
7   -import cn.iocoder.yudao.framework.extension.pay.command.TransactionsCommand;
8   -import cn.iocoder.yudao.framework.extension.pay.domain.TransactionsResult;
9   -import lombok.extern.slf4j.Slf4j;
10   -
11   -/**
12   - * @description 微信 JSAPI 支付
13   - * @author Qingchen
14   - * @version 1.0.0
15   - * @date 2021-08-30 10:38
16   - * @class cn.iocoder.yudao.framework.extension.pay.impl.AlipayService.java
17   - */
18   -@Extension(businessId = "pay", useCase = "jsapi", scenario = "alipay")
19   -@Slf4j
20   -public class AlipayService implements PayExtensionPoint {
21   - @Override
22   - public TransactionsResult unifiedOrder(TransactionsCommand command) {
23   - log.info("微信 JSAPI 支付:{}", JSONUtil.toJsonStr(command));
24   - return new TransactionsResult("alipay26112221580621e9b071c00d9e093b0000", command.getOrderNo(), IdUtil.objectId(), "alipay");
25   - }
26   -}
yudao-framework/yudao-spring-boot-starter-extension/src/test/java/cn/iocoder/yudao/framework/extension/pay/impl/WechatPayService.java deleted
1   -package cn.iocoder.yudao.framework.extension.pay.impl;
2   -
3   -import cn.hutool.core.util.IdUtil;
4   -import cn.hutool.json.JSONUtil;
5   -import cn.iocoder.yudao.framework.extension.core.stereotype.Extension;
6   -import cn.iocoder.yudao.framework.extension.pay.PayExtensionPoint;
7   -import cn.iocoder.yudao.framework.extension.pay.command.TransactionsCommand;
8   -import cn.iocoder.yudao.framework.extension.pay.domain.TransactionsResult;
9   -import lombok.extern.slf4j.Slf4j;
10   -
11   -/**
12   - * @description 微信 JSAPI 支付
13   - * @author Qingchen
14   - * @version 1.0.0
15   - * @date 2021-08-30 10:37
16   - * @class cn.iocoder.yudao.framework.extension.pay.impl.WechatPayService.java
17   - */
18   -@Extension(businessId = "pay", useCase = "jsapi", scenario = "wechat")
19   -@Slf4j
20   -public class WechatPayService implements PayExtensionPoint {
21   - @Override
22   - public TransactionsResult unifiedOrder(TransactionsCommand command) {
23   - log.info("微信 JSAPI 支付:{}", JSONUtil.toJsonStr(command));
24   - return new TransactionsResult("wx26112221580621e9b071c00d9e093b0000", command.getOrderNo(), IdUtil.objectId(), "wechat");
25   - }
26   -}
yudao-framework/yudao-spring-boot-starter-extension/《芋道 Spring Boot 扩展点组件》.md deleted
1   -### 作用
2   -
3   -​ 为了解决同一个流程不同业务有不同处理逻辑而产生,减少代码中 if else 逻辑,降低代码的耦合性,通过统一的扩展形式来支撑业务的变化。
4   -
5   -### 原理
6   -
7   -​ https://blog.csdn.net/significantfrank/article/details/100074716
8   -
9   -
10   -
11   -### 使用介绍
12   -
13   -参考测试代码 `cn.iocoder.yudao.framework.extension.ExtensionTest`
14   -
15   -
16   -
17   -
18   -
19   -
yudao-framework/yudao-spring-boot-starter-web/pom.xml
... ... @@ -53,6 +53,13 @@
53 53 <scope>provided</scope> <!-- 设置为 provided,主要是 GlobalExceptionHandler 使用 -->
54 54 </dependency>
55 55  
  56 + <!-- 业务组件 -->
  57 + <dependency>
  58 + <groupId>cn.iocoder.boot</groupId>
  59 + <artifactId>yudao-module-infra-api</artifactId> <!-- 需要使用它,进行操作日志的记录 -->
  60 + <version>${revision}</version>
  61 + </dependency>
  62 +
56 63 <!-- 服务保障相关 -->
57 64 <dependency>
58 65 <groupId>io.github.resilience4j</groupId>
... ...
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/config/YudaoApiLogAutoConfiguration.java
... ... @@ -2,9 +2,14 @@ package cn.iocoder.yudao.framework.apilog.config;
2 2  
3 3 import cn.iocoder.yudao.framework.apilog.core.filter.ApiAccessLogFilter;
4 4 import cn.iocoder.yudao.framework.apilog.core.service.ApiAccessLogFrameworkService;
  5 +import cn.iocoder.yudao.framework.apilog.core.service.ApiAccessLogFrameworkServiceImpl;
  6 +import cn.iocoder.yudao.framework.apilog.core.service.ApiErrorLogFrameworkService;
  7 +import cn.iocoder.yudao.framework.apilog.core.service.ApiErrorLogFrameworkServiceImpl;
  8 +import cn.iocoder.yudao.framework.common.enums.WebFilterOrderEnum;
5 9 import cn.iocoder.yudao.framework.web.config.WebProperties;
6 10 import cn.iocoder.yudao.framework.web.config.YudaoWebAutoConfiguration;
7   -import cn.iocoder.yudao.framework.common.enums.WebFilterOrderEnum;
  11 +import cn.iocoder.yudao.module.infra.api.logger.ApiAccessLogApi;
  12 +import cn.iocoder.yudao.module.infra.api.logger.ApiErrorLogApi;
8 13 import org.springframework.beans.factory.annotation.Value;
9 14 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
10 15 import org.springframework.boot.web.servlet.FilterRegistrationBean;
... ... @@ -17,6 +22,16 @@ import javax.servlet.Filter;
17 22 @AutoConfigureAfter(YudaoWebAutoConfiguration.class)
18 23 public class YudaoApiLogAutoConfiguration {
19 24  
  25 + @Bean
  26 + public ApiAccessLogFrameworkService apiAccessLogFrameworkService(ApiAccessLogApi apiAccessLogApi) {
  27 + return new ApiAccessLogFrameworkServiceImpl(apiAccessLogApi);
  28 + }
  29 +
  30 + @Bean
  31 + public ApiErrorLogFrameworkService apiErrorLogFrameworkService(ApiErrorLogApi apiErrorLogApi) {
  32 + return new ApiErrorLogFrameworkServiceImpl(apiErrorLogApi);
  33 + }
  34 +
20 35 /**
21 36 * 创建 ApiAccessLogFilter Bean,记录 API 请求日志
22 37 */
... ...
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/filter/ApiAccessLogFilter.java
... ... @@ -3,8 +3,8 @@ package cn.iocoder.yudao.framework.apilog.core.filter;
3 3 import cn.hutool.core.exceptions.ExceptionUtil;
4 4 import cn.hutool.core.map.MapUtil;
5 5 import cn.hutool.extra.servlet.ServletUtil;
  6 +import cn.iocoder.yudao.framework.apilog.core.service.ApiAccessLog;
6 7 import cn.iocoder.yudao.framework.apilog.core.service.ApiAccessLogFrameworkService;
7   -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO;
8 8 import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
9 9 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
10 10 import cn.iocoder.yudao.framework.common.util.date.DateUtils;
... ... @@ -66,16 +66,16 @@ public class ApiAccessLogFilter extends ApiRequestFilter {
66 66  
67 67 private void createApiAccessLog(HttpServletRequest request, Date beginTime,
68 68 Map<String, String> queryString, String requestBody, Exception ex) {
69   - ApiAccessLogCreateReqDTO accessLog = new ApiAccessLogCreateReqDTO();
  69 + ApiAccessLog accessLog = new ApiAccessLog();
70 70 try {
71 71 this.buildApiAccessLogDTO(accessLog, request, beginTime, queryString, requestBody, ex);
72   - apiAccessLogFrameworkService.createApiAccessLogAsync(accessLog);
  72 + apiAccessLogFrameworkService.createApiAccessLog(accessLog);
73 73 } catch (Throwable th) {
74 74 log.error("[createApiAccessLog][url({}) log({}) 发生异常]", request.getRequestURI(), toJsonString(accessLog), th);
75 75 }
76 76 }
77 77  
78   - private void buildApiAccessLogDTO(ApiAccessLogCreateReqDTO accessLog, HttpServletRequest request, Date beginTime,
  78 + private void buildApiAccessLogDTO(ApiAccessLog accessLog, HttpServletRequest request, Date beginTime,
79 79 Map<String, String> queryString, String requestBody, Exception ex) {
80 80 // 处理用户信息
81 81 accessLog.setUserId(WebFrameworkUtils.getLoginUserId(request));
... ...
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiAccessLog.java 0 → 100644
  1 +package cn.iocoder.yudao.framework.apilog.core.service;
  2 +
  3 +import lombok.Data;
  4 +
  5 +import javax.validation.constraints.NotNull;
  6 +import java.util.Date;
  7 +
  8 +/**
  9 + * API 访问日志
  10 + *
  11 + * @author 芋道源码
  12 + */
  13 +@Data
  14 +public class ApiAccessLog {
  15 +
  16 + /**
  17 + * 链路追踪编号
  18 + */
  19 + private String traceId;
  20 + /**
  21 + * 用户编号
  22 + */
  23 + private Long userId;
  24 + /**
  25 + * 用户类型
  26 + */
  27 + private Integer userType;
  28 + /**
  29 + * 应用名
  30 + */
  31 + @NotNull(message = "应用名不能为空")
  32 + private String applicationName;
  33 +
  34 + /**
  35 + * 请求方法名
  36 + */
  37 + @NotNull(message = "http 请求方法不能为空")
  38 + private String requestMethod;
  39 + /**
  40 + * 访问地址
  41 + */
  42 + @NotNull(message = "访问地址不能为空")
  43 + private String requestUrl;
  44 + /**
  45 + * 请求参数
  46 + */
  47 + @NotNull(message = "请求参数不能为空")
  48 + private String requestParams;
  49 + /**
  50 + * 用户 IP
  51 + */
  52 + @NotNull(message = "ip 不能为空")
  53 + private String userIp;
  54 + /**
  55 + * 浏览器 UA
  56 + */
  57 + @NotNull(message = "User-Agent 不能为空")
  58 + private String userAgent;
  59 +
  60 + /**
  61 + * 开始请求时间
  62 + */
  63 + @NotNull(message = "开始请求时间不能为空")
  64 + private Date beginTime;
  65 + /**
  66 + * 结束请求时间
  67 + */
  68 + @NotNull(message = "结束请求时间不能为空")
  69 + private Date endTime;
  70 + /**
  71 + * 执行时长,单位:毫秒
  72 + */
  73 + @NotNull(message = "执行时长不能为空")
  74 + private Integer duration;
  75 + /**
  76 + * 结果码
  77 + */
  78 + @NotNull(message = "错误码不能为空")
  79 + private Integer resultCode;
  80 + /**
  81 + * 结果提示
  82 + */
  83 + private String resultMsg;
  84 +
  85 +}
... ...
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiAccessLogFrameworkService.java
1 1 package cn.iocoder.yudao.framework.apilog.core.service;
2 2  
3   -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO;
4   -
5   -import javax.validation.Valid;
6   -
7 3 /**
8 4 * API 访问日志 Framework Service 接口
9 5 *
... ... @@ -14,8 +10,8 @@ public interface ApiAccessLogFrameworkService {
14 10 /**
15 11 * 创建 API 访问日志
16 12 *
17   - * @param createDTO 创建信息
  13 + * @param apiAccessLog API 访问日志
18 14 */
19   - void createApiAccessLogAsync(@Valid ApiAccessLogCreateReqDTO createDTO);
  15 + void createApiAccessLog(ApiAccessLog apiAccessLog);
20 16  
21 17 }
... ...
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiAccessLogFrameworkServiceImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.framework.apilog.core.service;
  2 +
  3 +import cn.hutool.core.bean.BeanUtil;
  4 +import cn.iocoder.yudao.module.infra.api.logger.ApiAccessLogApi;
  5 +import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO;
  6 +import lombok.RequiredArgsConstructor;
  7 +import org.springframework.scheduling.annotation.Async;
  8 +
  9 +/**
  10 + * API 访问日志 Framework Service 实现类
  11 + *
  12 + * 基于 {@link ApiAccessLogApi} 服务,记录访问日志
  13 + *
  14 + * @author 芋道源码
  15 + */
  16 +@RequiredArgsConstructor
  17 +public class ApiAccessLogFrameworkServiceImpl implements ApiAccessLogFrameworkService {
  18 +
  19 + private final ApiAccessLogApi apiAccessLogApi;
  20 +
  21 + @Override
  22 + @Async
  23 + public void createApiAccessLog(ApiAccessLog apiAccessLog) {
  24 + ApiAccessLogCreateReqDTO reqDTO = BeanUtil.copyProperties(apiAccessLog, ApiAccessLogCreateReqDTO.class);
  25 + apiAccessLogApi.createApiAccessLog(reqDTO);
  26 + }
  27 +
  28 +}
... ...
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiErrorLog.java 0 → 100644
  1 +package cn.iocoder.yudao.framework.apilog.core.service;
  2 +
  3 +import lombok.Data;
  4 +
  5 +import javax.validation.constraints.NotNull;
  6 +import java.util.Date;
  7 +
  8 +/**
  9 + * API 错误日志
  10 + *
  11 + * @author 芋道源码
  12 + */
  13 +@Data
  14 +public class ApiErrorLog {
  15 +
  16 + /**
  17 + * 链路编号
  18 + */
  19 + private String traceId;
  20 + /**
  21 + * 账号编号
  22 + */
  23 + private Long userId;
  24 + /**
  25 + * 用户类型
  26 + */
  27 + private Integer userType;
  28 + /**
  29 + * 应用名
  30 + */
  31 + @NotNull(message = "应用名不能为空")
  32 + private String applicationName;
  33 +
  34 + /**
  35 + * 请求方法名
  36 + */
  37 + @NotNull(message = "http 请求方法不能为空")
  38 + private String requestMethod;
  39 + /**
  40 + * 访问地址
  41 + */
  42 + @NotNull(message = "访问地址不能为空")
  43 + private String requestUrl;
  44 + /**
  45 + * 请求参数
  46 + */
  47 + @NotNull(message = "请求参数不能为空")
  48 + private String requestParams;
  49 + /**
  50 + * 用户 IP
  51 + */
  52 + @NotNull(message = "ip 不能为空")
  53 + private String userIp;
  54 + /**
  55 + * 浏览器 UA
  56 + */
  57 + @NotNull(message = "User-Agent 不能为空")
  58 + private String userAgent;
  59 +
  60 + /**
  61 + * 异常时间
  62 + */
  63 + @NotNull(message = "异常时间不能为空")
  64 + private Date exceptionTime;
  65 + /**
  66 + * 异常名
  67 + */
  68 + @NotNull(message = "异常名不能为空")
  69 + private String exceptionName;
  70 + /**
  71 + * 异常发生的类全名
  72 + */
  73 + @NotNull(message = "异常发生的类全名不能为空")
  74 + private String exceptionClassName;
  75 + /**
  76 + * 异常发生的类文件
  77 + */
  78 + @NotNull(message = "异常发生的类文件不能为空")
  79 + private String exceptionFileName;
  80 + /**
  81 + * 异常发生的方法名
  82 + */
  83 + @NotNull(message = "异常发生的方法名不能为空")
  84 + private String exceptionMethodName;
  85 + /**
  86 + * 异常发生的方法所在行
  87 + */
  88 + @NotNull(message = "异常发生的方法所在行不能为空")
  89 + private Integer exceptionLineNumber;
  90 + /**
  91 + * 异常的栈轨迹异常的栈轨迹
  92 + */
  93 + @NotNull(message = "异常的栈轨迹不能为空")
  94 + private String exceptionStackTrace;
  95 + /**
  96 + * 异常导致的根消息
  97 + */
  98 + @NotNull(message = "异常导致的根消息不能为空")
  99 + private String exceptionRootCauseMessage;
  100 + /**
  101 + * 异常导致的消息
  102 + */
  103 + @NotNull(message = "异常导致的消息不能为空")
  104 + private String exceptionMessage;
  105 +
  106 +
  107 +}
... ...
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiErrorLogFrameworkService.java
1 1 package cn.iocoder.yudao.framework.apilog.core.service;
2 2  
3   -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO;
4   -
5   -import javax.validation.Valid;
6   -
7 3 /**
8 4 * API 错误日志 Framework Service 接口
9 5 *
... ... @@ -14,8 +10,8 @@ public interface ApiErrorLogFrameworkService {
14 10 /**
15 11 * 创建 API 错误日志
16 12 *
17   - * @param createDTO 创建信息
  13 + * @param apiErrorLog API 错误日志
18 14 */
19   - void createApiErrorLogAsync(@Valid ApiErrorLogCreateReqDTO createDTO);
  15 + void createApiErrorLog(ApiErrorLog apiErrorLog);
20 16  
21 17 }
... ...
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiErrorLogFrameworkServiceImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.framework.apilog.core.service;
  2 +
  3 +import cn.hutool.core.bean.BeanUtil;
  4 +import cn.iocoder.yudao.module.infra.api.logger.ApiErrorLogApi;
  5 +import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;
  6 +import lombok.RequiredArgsConstructor;
  7 +import org.springframework.scheduling.annotation.Async;
  8 +
  9 +/**
  10 + * API 错误日志 Framework Service 实现类
  11 + *
  12 + * 基于 {@link ApiErrorLogApi} 服务,记录错误日志
  13 + *
  14 + * @author 芋道源码
  15 + */
  16 +@RequiredArgsConstructor
  17 +public class ApiErrorLogFrameworkServiceImpl implements ApiErrorLogFrameworkService {
  18 +
  19 + private final ApiErrorLogApi apiErrorLogApi;
  20 +
  21 + @Override
  22 + @Async
  23 + public void createApiErrorLog(ApiErrorLog apiErrorLog) {
  24 + ApiErrorLogCreateReqDTO reqDTO = BeanUtil.copyProperties(apiErrorLog, ApiErrorLogCreateReqDTO.class);
  25 + apiErrorLogApi.createApiErrorLog(reqDTO);
  26 + }
  27 +
  28 +}
... ...
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java
... ... @@ -3,14 +3,14 @@ package cn.iocoder.yudao.framework.web.core.handler;
3 3 import cn.hutool.core.exceptions.ExceptionUtil;
4 4 import cn.hutool.core.map.MapUtil;
5 5 import cn.hutool.extra.servlet.ServletUtil;
  6 +import cn.iocoder.yudao.framework.apilog.core.service.ApiErrorLog;
  7 +import cn.iocoder.yudao.framework.apilog.core.service.ApiErrorLogFrameworkService;
6 8 import cn.iocoder.yudao.framework.common.exception.ServiceException;
7 9 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
8   -import cn.iocoder.yudao.framework.apilog.core.service.ApiErrorLogFrameworkService;
9   -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO;
10   -import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils;
11   -import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
12 10 import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
  11 +import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils;
13 12 import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
  13 +import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
14 14 import io.github.resilience4j.ratelimiter.RequestNotPermitted;
15 15 import lombok.AllArgsConstructor;
16 16 import lombok.extern.slf4j.Slf4j;
... ... @@ -229,18 +229,18 @@ public class GlobalExceptionHandler {
229 229  
230 230 private void createExceptionLog(HttpServletRequest req, Throwable e) {
231 231 // 插入错误日志
232   - ApiErrorLogCreateReqDTO errorLog = new ApiErrorLogCreateReqDTO();
  232 + ApiErrorLog errorLog = new ApiErrorLog();
233 233 try {
234 234 // 初始化 errorLog
235 235 initExceptionLog(errorLog, req, e);
236 236 // 执行插入 errorLog
237   - apiErrorLogFrameworkService.createApiErrorLogAsync(errorLog);
  237 + apiErrorLogFrameworkService.createApiErrorLog(errorLog);
238 238 } catch (Throwable th) {
239 239 log.error("[createExceptionLog][url({}) log({}) 发生异常]", req.getRequestURI(), JsonUtils.toJsonString(errorLog), th);
240 240 }
241 241 }
242 242  
243   - private void initExceptionLog(ApiErrorLogCreateReqDTO errorLog, HttpServletRequest request, Throwable e) {
  243 + private void initExceptionLog(ApiErrorLog errorLog, HttpServletRequest request, Throwable e) {
244 244 // 处理用户信息
245 245 errorLog.setUserId(WebFrameworkUtils.getLoginUserId(request));
246 246 errorLog.setUserType(WebFrameworkUtils.getLoginUserType(request));
... ...
yudao-module-infra/yudao-module-infra-api/pom.xml
... ... @@ -21,6 +21,13 @@
21 21 <groupId>cn.iocoder.boot</groupId>
22 22 <artifactId>yudao-common</artifactId>
23 23 </dependency>
  24 +
  25 + <!-- 参数校验 -->
  26 + <dependency>
  27 + <groupId>org.springframework.boot</groupId>
  28 + <artifactId>spring-boot-starter-validation</artifactId>
  29 + <optional>true</optional>
  30 + </dependency>
24 31 </dependencies>
25 32  
26 33 </project>
... ...
yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApi.java
1 1 package cn.iocoder.yudao.module.infra.api.file;
2 2  
3   -import cn.hutool.core.util.IdUtil;
4   -
5 3 /**
6 4 * 文件 API 接口
7 5 *
... ... @@ -15,17 +13,29 @@ public interface FileApi {
15 13 * @param content 文件内容
16 14 * @return 文件路径
17 15 */
18   - default String createFile(byte[] content) throws Exception {
19   - return createFile(IdUtil.fastUUID(), content);
20   - }
  16 + default String createFile(byte[] content) {
  17 + return createFile(null, null, content);
  18 + }
  19 +
  20 + /**
  21 + * 保存文件,并返回文件的访问路径
  22 + *
  23 + * @param path 文件路径
  24 + * @param content 文件内容
  25 + * @return 文件路径
  26 + */
  27 + default String createFile(String path, byte[] content) {
  28 + return createFile(null, path, content);
  29 + }
21 30  
22 31 /**
23 32 * 保存文件,并返回文件的访问路径
24 33 *
  34 + * @param name 文件名称
25 35 * @param path 文件路径
26 36 * @param content 文件内容
27 37 * @return 文件路径
28 38 */
29   - String createFile(String path, byte[] content) throws Exception;
  39 + String createFile(String name, String path, byte[] content);
30 40  
31 41 }
... ...
yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/logger/ApiAccessLogApi.java 0 → 100644
  1 +package cn.iocoder.yudao.module.infra.api.logger;
  2 +
  3 +import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO;
  4 +
  5 +import javax.validation.Valid;
  6 +
  7 +/**
  8 + * API 访问日志的 API 接口
  9 + *
  10 + * @author 芋道源码
  11 + */
  12 +public interface ApiAccessLogApi {
  13 +
  14 + /**
  15 + * 创建 API 访问日志
  16 + *
  17 + * @param createDTO 创建信息
  18 + */
  19 + void createApiAccessLog(@Valid ApiAccessLogCreateReqDTO createDTO);
  20 +
  21 +}
... ...
yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/logger/ApiErrorLogApi.java 0 → 100644
  1 +package cn.iocoder.yudao.module.infra.api.logger;
  2 +
  3 +import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;
  4 +
  5 +import javax.validation.Valid;
  6 +
  7 +/**
  8 + * API 错误日志的 API 接口
  9 + *
  10 + * @author 芋道源码
  11 + */
  12 +public interface ApiErrorLogApi {
  13 +
  14 + /**
  15 + * 创建 API 错误日志
  16 + *
  17 + * @param createDTO 创建信息
  18 + */
  19 + void createApiErrorLog(@Valid ApiErrorLogCreateReqDTO createDTO);
  20 +
  21 +}
... ...
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/dto/ApiAccessLogCreateReqDTO.java renamed to yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/logger/dto/ApiAccessLogCreateReqDTO.java
1   -package cn.iocoder.yudao.framework.apilog.core.service.dto;
  1 +package cn.iocoder.yudao.module.infra.api.logger.dto;
2 2  
3 3 import lombok.Data;
4 4  
... ... @@ -6,7 +6,7 @@ import javax.validation.constraints.NotNull;
6 6 import java.util.Date;
7 7  
8 8 /**
9   - * API 访问日志创建 DTO
  9 + * API 访问日志
10 10 *
11 11 * @author 芋道源码
12 12 */
... ...
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/dto/ApiErrorLogCreateReqDTO.java renamed to yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/logger/dto/ApiErrorLogCreateReqDTO.java
1   -package cn.iocoder.yudao.framework.apilog.core.service.dto;
  1 +package cn.iocoder.yudao.module.infra.api.logger.dto;
2 2  
3 3 import lombok.Data;
4   -import lombok.experimental.Accessors;
5 4  
6 5 import javax.validation.constraints.NotNull;
7 6 import java.util.Date;
8 7  
9 8 /**
10   - * API 错误日志创建 DTO
  9 + * API 错误日志
11 10 *
12 11 * @author 芋道源码
13 12 */
14 13 @Data
15   -@Accessors(chain = true)
16 14 public class ApiErrorLogCreateReqDTO {
17 15  
18 16 /**
... ... @@ -105,4 +103,5 @@ public class ApiErrorLogCreateReqDTO {
105 103 @NotNull(message = "异常导致的消息不能为空")
106 104 private String exceptionMessage;
107 105  
  106 +
108 107 }
... ...
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApiImpl.java
... ... @@ -19,8 +19,8 @@ public class FileApiImpl implements FileApi {
19 19 private FileService fileService;
20 20  
21 21 @Override
22   - public String createFile(String path, byte[] content) throws Exception {
23   - return fileService.createFile(path, content);
  22 + public String createFile(String name, String path, byte[] content) {
  23 + return fileService.createFile(name, path, content);
24 24 }
25 25  
26 26 }
... ...
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/api/logger/ApiAccessLogApiImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.module.infra.api.logger;
  2 +
  3 +import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO;
  4 +import cn.iocoder.yudao.module.infra.service.logger.ApiAccessLogService;
  5 +import org.springframework.stereotype.Service;
  6 +import org.springframework.validation.annotation.Validated;
  7 +
  8 +import javax.annotation.Resource;
  9 +
  10 +/**
  11 + * API 访问日志的 API 实现类
  12 + *
  13 + * @author 芋道源码
  14 + */
  15 +@Service
  16 +@Validated
  17 +public class ApiAccessLogApiImpl implements ApiAccessLogApi {
  18 +
  19 + @Resource
  20 + private ApiAccessLogService apiAccessLogService;
  21 +
  22 + @Override
  23 + public void createApiAccessLog(ApiAccessLogCreateReqDTO createDTO) {
  24 + apiAccessLogService.createApiAccessLog(createDTO);
  25 + }
  26 +
  27 +}
... ...
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/api/logger/ApiErrorLogApiImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.module.infra.api.logger;
  2 +
  3 +import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;
  4 +import cn.iocoder.yudao.module.infra.service.logger.ApiErrorLogService;
  5 +import org.springframework.stereotype.Service;
  6 +import org.springframework.validation.annotation.Validated;
  7 +
  8 +import javax.annotation.Resource;
  9 +
  10 +/**
  11 + * API 访问日志的 API 接口
  12 + *
  13 + * @author 芋道源码
  14 + */
  15 +@Service
  16 +@Validated
  17 +public class ApiErrorLogApiImpl implements ApiErrorLogApi {
  18 +
  19 + @Resource
  20 + private ApiErrorLogService apiErrorLogService;
  21 +
  22 + @Override
  23 + public void createApiErrorLog(ApiErrorLogCreateReqDTO createDTO) {
  24 + apiErrorLogService.createApiErrorLog(createDTO);
  25 + }
  26 +
  27 +}
... ...
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java
... ... @@ -46,7 +46,7 @@ public class FileController {
46 46 @OperateLog(logArgs = false) // 上传文件,没有记录操作日志的必要
47 47 public CommonResult<String> uploadFile(@RequestParam("file") MultipartFile file,
48 48 @RequestParam(value = "path", required = false) String path) throws Exception {
49   - return success(fileService.createFile(path, IoUtil.readBytes(file.getInputStream())));
  49 + return success(fileService.createFile(file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream())));
50 50 }
51 51  
52 52 @DeleteMapping("/delete")
... ...
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FileRespVO.java
... ... @@ -16,6 +16,9 @@ public class FileRespVO {
16 16 @ApiModelProperty(value = "文件路径", required = true, example = "yudao.jpg")
17 17 private String path;
18 18  
  19 + @ApiModelProperty(value = "原文件名", required = true, example = "yudao.jpg")
  20 + private String name;
  21 +
19 22 @ApiModelProperty(value = "文件 URL", required = true, example = "https://www.iocoder.cn/yudao.jpg")
20 23 private String url;
21 24  
... ...
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/ApiAccessLogConvert.java
1 1 package cn.iocoder.yudao.module.infra.convert.logger;
2 2  
3   -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO;
4 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO;
5 5 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExcelVO;
6 6 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogRespVO;
7 7 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO;
... ...
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/ApiErrorLogConvert.java
1 1 package cn.iocoder.yudao.module.infra.convert.logger;
2 2  
3   -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO;
4 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;
5 5 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExcelVO;
6 6 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogRespVO;
7 7 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;
... ...
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/file/FileDO.java
... ... @@ -34,6 +34,10 @@ public class FileDO extends BaseDO {
34 34 */
35 35 private Long configId;
36 36 /**
  37 + * 原文件名
  38 + */
  39 + private String name;
  40 + /**
37 41 * 路径,即文件名
38 42 */
39 43 private String path;
... ...
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileService.java
... ... @@ -22,11 +22,12 @@ public interface FileService {
22 22 /**
23 23 * 保存文件,并返回文件的访问路径
24 24 *
  25 + * @param name 文件名称
25 26 * @param path 文件路径
26 27 * @param content 文件内容
27 28 * @return 文件路径
28 29 */
29   - String createFile(String path, byte[] content) throws Exception;
  30 + String createFile(String name, String path, byte[] content);
30 31  
31 32 /**
32 33 * 删除文件
... ...
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileServiceImpl.java
... ... @@ -9,6 +9,7 @@ import cn.iocoder.yudao.framework.file.core.client.FileClient;
9 9 import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePageReqVO;
10 10 import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
11 11 import cn.iocoder.yudao.module.infra.dal.mysql.file.FileMapper;
  12 +import lombok.SneakyThrows;
12 13 import org.springframework.stereotype.Service;
13 14  
14 15 import javax.annotation.Resource;
... ... @@ -37,12 +38,17 @@ public class FileServiceImpl implements FileService {
37 38 }
38 39  
39 40 @Override
40   - public String createFile(String path, byte[] content) throws Exception {
  41 + @SneakyThrows
  42 + public String createFile(String name, String path, byte[] content) {
41 43 // 计算默认的 path 名
42   - String type = FileTypeUtil.getType(new ByteArrayInputStream(content), path);
  44 + String type = FileTypeUtil.getType(new ByteArrayInputStream(content), name);
43 45 if (StrUtil.isEmpty(path)) {
44 46 path = DigestUtil.md5Hex(content) + '.' + type;
45 47 }
  48 + // 如果 name 为空,则使用 path 填充
  49 + if (StrUtil.isEmpty(name)) {
  50 + name = path;
  51 + }
46 52  
47 53 // 上传到文件存储器
48 54 FileClient client = fileConfigService.getMasterFileClient();
... ... @@ -52,6 +58,7 @@ public class FileServiceImpl implements FileService {
52 58 // 保存到数据库
53 59 FileDO file = new FileDO();
54 60 file.setConfigId(client.getId());
  61 + file.setName(name);
55 62 file.setPath(path);
56 63 file.setUrl(url);
57 64 file.setType(type);
... ...
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogService.java
1 1 package cn.iocoder.yudao.module.infra.service.logger;
2 2  
3   -import cn.iocoder.yudao.framework.apilog.core.service.ApiAccessLogFrameworkService;
  3 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO;
4 5 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO;
5 6 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO;
6   -import cn.iocoder.yudao.framework.common.pojo.PageResult;
7 7 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO;
8 8  
9 9 import java.util.List;
... ... @@ -13,7 +13,14 @@ import java.util.List;
13 13 *
14 14 * @author 芋道源码
15 15 */
16   -public interface ApiAccessLogService extends ApiAccessLogFrameworkService {
  16 +public interface ApiAccessLogService {
  17 +
  18 + /**
  19 + * 创建 API 访问日志
  20 + *
  21 + * @param createReqDTO API 访问日志
  22 + */
  23 + void createApiAccessLog(ApiAccessLogCreateReqDTO createReqDTO);
17 24  
18 25 /**
19 26 * 获得 API 访问日志分页
... ...
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImpl.java
1 1 package cn.iocoder.yudao.module.infra.service.logger;
2 2  
3   -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO;
  3 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO;
4 5 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO;
5 6 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO;
6 7 import cn.iocoder.yudao.module.infra.convert.logger.ApiAccessLogConvert;
7 8 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO;
8 9 import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiAccessLogMapper;
9   -import cn.iocoder.yudao.framework.common.pojo.PageResult;
10   -import org.springframework.scheduling.annotation.Async;
11 10 import org.springframework.stereotype.Service;
12 11 import org.springframework.validation.annotation.Validated;
13 12  
... ... @@ -27,6 +26,12 @@ public class ApiAccessLogServiceImpl implements ApiAccessLogService {
27 26 private ApiAccessLogMapper apiAccessLogMapper;
28 27  
29 28 @Override
  29 + public void createApiAccessLog(ApiAccessLogCreateReqDTO createDTO) {
  30 + ApiAccessLogDO apiAccessLog = ApiAccessLogConvert.INSTANCE.convert(createDTO);
  31 + apiAccessLogMapper.insert(apiAccessLog);
  32 + }
  33 +
  34 + @Override
30 35 public PageResult<ApiAccessLogDO> getApiAccessLogPage(ApiAccessLogPageReqVO pageReqVO) {
31 36 return apiAccessLogMapper.selectPage(pageReqVO);
32 37 }
... ... @@ -36,11 +41,4 @@ public class ApiAccessLogServiceImpl implements ApiAccessLogService {
36 41 return apiAccessLogMapper.selectList(exportReqVO);
37 42 }
38 43  
39   - @Override
40   - @Async
41   - public void createApiAccessLogAsync(ApiAccessLogCreateReqDTO createDTO) {
42   - ApiAccessLogDO apiAccessLog = ApiAccessLogConvert.INSTANCE.convert(createDTO);
43   - apiAccessLogMapper.insert(apiAccessLog);
44   - }
45   -
46 44 }
... ...
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogService.java
1 1 package cn.iocoder.yudao.module.infra.service.logger;
2 2  
3   -import cn.iocoder.yudao.framework.apilog.core.service.ApiErrorLogFrameworkService;
4 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;
5 5 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO;
6 6 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO;
7 7 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;
... ... @@ -13,7 +13,14 @@ import java.util.List;
13 13 *
14 14 * @author 芋道源码
15 15 */
16   -public interface ApiErrorLogService extends ApiErrorLogFrameworkService {
  16 +public interface ApiErrorLogService {
  17 +
  18 + /**
  19 + * 创建 API 错误日志
  20 + *
  21 + * @param createReqDTO API 错误日志
  22 + */
  23 + void createApiErrorLog(ApiErrorLogCreateReqDTO createReqDTO);
17 24  
18 25 /**
19 26 * 获得 API 错误日志分页
... ...
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java
1 1 package cn.iocoder.yudao.module.infra.service.logger;
2 2  
3   -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO;
  3 +import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
  4 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  5 +import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;
4 6 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO;
5 7 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO;
6 8 import cn.iocoder.yudao.module.infra.convert.logger.ApiErrorLogConvert;
7 9 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;
8 10 import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiErrorLogMapper;
9   -import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
10   -import cn.iocoder.yudao.framework.common.pojo.PageResult;
11 11 import cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants;
12 12 import cn.iocoder.yudao.module.infra.enums.logger.ApiErrorLogProcessStatusEnum;
13   -import org.springframework.scheduling.annotation.Async;
14 13 import org.springframework.stereotype.Service;
15 14 import org.springframework.validation.annotation.Validated;
16 15  
... ... @@ -31,6 +30,13 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService {
31 30 private ApiErrorLogMapper apiErrorLogMapper;
32 31  
33 32 @Override
  33 + public void createApiErrorLog(ApiErrorLogCreateReqDTO createDTO) {
  34 + ApiErrorLogDO apiErrorLog = ApiErrorLogConvert.INSTANCE.convert(createDTO);
  35 + apiErrorLog.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
  36 + apiErrorLogMapper.insert(apiErrorLog);
  37 + }
  38 +
  39 + @Override
34 40 public PageResult<ApiErrorLogDO> getApiErrorLogPage(ApiErrorLogPageReqVO pageReqVO) {
35 41 return apiErrorLogMapper.selectPage(pageReqVO);
36 42 }
... ... @@ -54,12 +60,4 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService {
54 60 .processUserId(processUserId).processTime(new Date()).build());
55 61 }
56 62  
57   - @Override
58   - @Async
59   - public void createApiErrorLogAsync(ApiErrorLogCreateReqDTO createDTO) {
60   - ApiErrorLogDO apiErrorLog = ApiErrorLogConvert.INSTANCE.convert(createDTO);
61   - apiErrorLog.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
62   - apiErrorLogMapper.insert(apiErrorLog);
63   - }
64   -
65 63 }
... ...
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileServiceTest.java
... ... @@ -80,9 +80,9 @@ public class FileServiceTest extends BaseDbUnitTest {
80 80 String url = randomString();
81 81 when(client.upload(same(content), same(path))).thenReturn(url);
82 82 when(client.getId()).thenReturn(10L);
83   -
  83 + String name = "单测文件名";
84 84 // 调用
85   - String result = fileService.createFile(path, content);
  85 + String result = fileService.createFile(name, path, content);
86 86 // 断言
87 87 assertEquals(result, url);
88 88 // 校验数据
... ...
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImplTest.java
1 1 package cn.iocoder.yudao.module.infra.service.logger;
2 2  
3 3 import cn.hutool.core.util.RandomUtil;
4   -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO;
5 4 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
6 5 import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
7 6 import cn.iocoder.yudao.framework.common.pojo.PageResult;
8 7 import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
9 8 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
10 9 import cn.iocoder.yudao.framework.test.core.util.RandomUtils;
  10 +import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO;
11 11 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO;
12 12 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO;
13 13 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO;
... ... @@ -155,7 +155,7 @@ public class ApiAccessLogServiceImplTest extends BaseDbUnitTest {
155 155 dto -> dto.setUserType(RandomUtil.randomEle(UserTypeEnum.values()).getValue()));
156 156  
157 157 // 调用
158   - apiAccessLogService.createApiAccessLogAsync(createDTO);
  158 + apiAccessLogService.createApiAccessLog(createDTO);
159 159 // 断言
160 160 ApiAccessLogDO infApiAccessLogDO = apiAccessLogMapper.selectOne(null);
161 161 assertNotNull(infApiAccessLogDO);
... ...
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImplTest.java
1 1 package cn.iocoder.yudao.module.infra.service.logger;
2 2  
3 3 import cn.hutool.core.util.RandomUtil;
4   -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO;
5 4 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
6 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
7 6 import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
8 7 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
9 8 import cn.iocoder.yudao.framework.test.core.util.RandomUtils;
  9 +import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;
10 10 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO;
11 11 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO;
12 12 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;
... ... @@ -187,7 +187,7 @@ public class ApiErrorLogServiceImplTest extends BaseDbUnitTest {
187 187 dto -> dto.setUserType(RandomUtil.randomEle(UserTypeEnum.values()).getValue()));
188 188  
189 189 // 调用
190   - apiErrorLogService.createApiErrorLogAsync(createDTO);
  190 + apiErrorLogService.createApiErrorLog(createDTO);
191 191 // 断言
192 192 ApiErrorLogDO infApiErrorLogDO = infApiErrorLogMapper.selectOne(null);
193 193 assertNotNull(infApiErrorLogDO);
... ...
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dept/DeptApi.java
1 1 package cn.iocoder.yudao.module.system.api.dept;
2 2  
  3 +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
3 4 import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
4 5  
5 6 import java.util.Collection;
... ... @@ -45,6 +46,9 @@ public interface DeptApi {
45 46 * @param ids 部门编号数组
46 47 * @return 部门 Map
47 48 */
48   - Map<Long, DeptRespDTO> getDeptMap(Set<Long> ids);
  49 + default Map<Long, DeptRespDTO> getDeptMap(Set<Long> ids) {
  50 + List<DeptRespDTO> list = getDepts(ids);
  51 + return CollectionUtils.convertMap(list, DeptRespDTO::getId);
  52 + }
49 53  
50 54 }
... ...
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/logger/OperateLogApi.java 0 → 100644
  1 +package cn.iocoder.yudao.module.system.api.logger;
  2 +
  3 +import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogCreateReqDTO;
  4 +
  5 +import javax.validation.Valid;
  6 +
  7 +/**
  8 + * 操作日志 API 接口
  9 + *
  10 + * @author 芋道源码
  11 + */
  12 +public interface OperateLogApi {
  13 +
  14 + /**
  15 + * 创建操作日志
  16 + *
  17 + * @param createReqDTO 请求
  18 + */
  19 + void createOperateLog(@Valid OperateLogCreateReqDTO createReqDTO);
  20 +
  21 +}
... ...
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/logger/dto/OperateLogCreateReqDTO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.system.api.logger.dto;
  2 +
  3 +import lombok.Data;
  4 +
  5 +import javax.validation.constraints.NotEmpty;
  6 +import javax.validation.constraints.NotNull;
  7 +import java.util.Date;
  8 +import java.util.Map;
  9 +
  10 +/**
  11 + * 操作日志创建 Request DTO
  12 + */
  13 +@Data
  14 +public class OperateLogCreateReqDTO {
  15 +
  16 + /**
  17 + * 链路追踪编号
  18 + */
  19 + private String traceId;
  20 +
  21 + /**
  22 + * 用户编号
  23 + */
  24 + @NotNull(message = "用户编号不能为空")
  25 + private Long userId;
  26 + /**
  27 + * 用户类型
  28 + */
  29 + @NotNull(message = "用户类型不能为空")
  30 + private Integer userType;
  31 +
  32 + /**
  33 + * 操作模块
  34 + */
  35 + @NotEmpty(message = "操作模块不能为空")
  36 + private String module;
  37 +
  38 + /**
  39 + * 操作名
  40 + */
  41 + @NotEmpty(message = "操作名")
  42 + private String name;
  43 +
  44 + /**
  45 + * 操作分类
  46 + */
  47 + @NotNull(message = "操作分类不能为空")
  48 + private Integer type;
  49 +
  50 + /**
  51 + * 操作明细
  52 + */
  53 + private String content;
  54 +
  55 + /**
  56 + * 拓展字段
  57 + */
  58 + private Map<String, Object> exts;
  59 +
  60 + /**
  61 + * 请求方法名
  62 + */
  63 + @NotEmpty(message = "请求方法名不能为空")
  64 + private String requestMethod;
  65 +
  66 + /**
  67 + * 请求地址
  68 + */
  69 + @NotEmpty(message = "请求地址不能为空")
  70 + private String requestUrl;
  71 +
  72 + /**
  73 + * 用户 IP
  74 + */
  75 + @NotEmpty(message = "用户 IP 不能为空")
  76 + private String userIp;
  77 +
  78 + /**
  79 + * 浏览器 UserAgent
  80 + */
  81 + @NotEmpty(message = "浏览器 UserAgent 不能为空")
  82 + private String userAgent;
  83 +
  84 + /**
  85 + * Java 方法名
  86 + */
  87 + @NotEmpty(message = "Java 方法名不能为空")
  88 + private String javaMethod;
  89 +
  90 + /**
  91 + * Java 方法的参数
  92 + */
  93 + private String javaMethodArgs;
  94 +
  95 + /**
  96 + * 开始时间
  97 + */
  98 + @NotNull(message = "开始时间不能为空")
  99 + private Date startTime;
  100 +
  101 + /**
  102 + * 执行时长,单位:毫秒
  103 + */
  104 + @NotNull(message = "执行时长不能为空")
  105 + private Integer duration;
  106 +
  107 + /**
  108 + * 结果码
  109 + */
  110 + @NotNull(message = "结果码不能为空")
  111 + private Integer resultCode;
  112 +
  113 + /**
  114 + * 结果提示
  115 + */
  116 + private String resultMsg;
  117 +
  118 + /**
  119 + * 结果数据
  120 + */
  121 + private String resultData;
  122 +
  123 +}
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/dept/DeptApiImpl.java
... ... @@ -9,8 +9,6 @@ import org.springframework.stereotype.Service;
9 9 import javax.annotation.Resource;
10 10 import java.util.Collection;
11 11 import java.util.List;
12   -import java.util.Map;
13   -import java.util.Set;
14 12  
15 13 /**
16 14 * 部门 API 实现类
... ... @@ -40,10 +38,4 @@ public class DeptApiImpl implements DeptApi {
40 38 deptService.validDepts(ids);
41 39 }
42 40  
43   - @Override
44   - public Map<Long, DeptRespDTO> getDeptMap(Set<Long> ids) {
45   - Map<Long, DeptDO> depts = deptService.getDeptMap(ids);
46   - return DeptConvert.INSTANCE.convertMap(depts);
47   - }
48   -
49 41 }
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/logger/OperateLogApiImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.module.system.api.logger;
  2 +
  3 +import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogCreateReqDTO;
  4 +import cn.iocoder.yudao.module.system.service.logger.OperateLogService;
  5 +import org.springframework.stereotype.Service;
  6 +import org.springframework.validation.annotation.Validated;
  7 +
  8 +import javax.annotation.Resource;
  9 +
  10 +/**
  11 + * 操作日志 API 实现类
  12 + *
  13 + * @author 芋道源码
  14 + */
  15 +@Service
  16 +@Validated
  17 +public class OperateLogApiImpl implements OperateLogApi {
  18 +
  19 + @Resource
  20 + private OperateLogService operateLogService;
  21 +
  22 + @Override
  23 + public void createOperateLog(OperateLogCreateReqDTO createReqDTO) {
  24 + operateLogService.createOperateLog(createReqDTO);
  25 + }
  26 +
  27 +}
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/loginlog/LoginLogBaseVO.java
... ... @@ -19,7 +19,7 @@ public class LoginLogBaseVO {
19 19 @NotNull(message = "日志类型不能为空")
20 20 private Integer logType;
21 21  
22   - @ApiModelProperty(value = "链路追踪编号", required = true, example = "89aca178-a370-411c-ae02-3f0d672be4ab")
  22 + @ApiModelProperty(value = "链路追踪编号", example = "89aca178-a370-411c-ae02-3f0d672be4ab")
23 23 @NotEmpty(message = "链路追踪编号不能为空")
24 24 private String traceId;
25 25  
... ... @@ -36,8 +36,7 @@ public class LoginLogBaseVO {
36 36 @NotEmpty(message = "用户 IP 不能为空")
37 37 private String userIp;
38 38  
39   - @ApiModelProperty(value = "浏览器 UserAgent", required = true, example = "Mozilla/5.0")
40   - @NotEmpty(message = "浏览器 UserAgent 不能为空")
  39 + @ApiModelProperty(value = "浏览器 UserAgent", example = "Mozilla/5.0")
41 40 private String userAgent;
42 41  
43 42 }
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/loginlog/LoginLogRespVO.java
... ... @@ -18,8 +18,7 @@ public class LoginLogRespVO extends LoginLogBaseVO {
18 18 @ApiModelProperty(value = "日志编号", required = true, example = "1024")
19 19 private Long id;
20 20  
21   - @ApiModelProperty(value = "用户编号", required = true, example = "666")
22   - @NotNull(message = "用户编号不能为空")
  21 + @ApiModelProperty(value = "用户编号", example = "666")
23 22 private Long userId;
24 23  
25 24 @ApiModelProperty(value = "用户类型", required = true, example = "2", notes = "参见 UserTypeEnum 枚举")
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsTemplateController.http
... ... @@ -5,7 +5,8 @@ Content-Type: application/json
5 5 tenant-id: {{adminTenentId}}
6 6  
7 7 {
8   - "code": "test_01",
  8 + "templateCode": "test_01",
  9 + "mobile": "156016913900",
9 10 "params": {
10 11 "key01": "value01",
11 12 "key02": "value02"
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/dept/DeptConvert.java
... ... @@ -31,6 +31,4 @@ public interface DeptConvert {
31 31  
32 32 DeptRespDTO convert03(DeptDO bean);
33 33  
34   - Map<Long, DeptRespDTO> convertMap(Map<Long, DeptDO> map);
35   -
36 34 }
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/logger/OperateLogConvert.java
... ... @@ -6,7 +6,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.logger.OperateLogDO;
6 6 import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
7 7 import cn.iocoder.yudao.framework.common.pojo.PageResult;
8 8 import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
9   -import cn.iocoder.yudao.framework.operatelog.core.dto.OperateLogCreateReqDTO;
  9 +import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogCreateReqDTO;
10 10 import org.mapstruct.Mapper;
11 11 import org.mapstruct.factory.Mappers;
12 12  
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceImpl.java
... ... @@ -164,11 +164,6 @@ public class DictDataServiceImpl implements DictDataService {
164 164 }
165 165  
166 166 @Override
167   - public List<DictDataRespDTO> listDictDatasFromCache(String type) {
168   - return DictDataConvert.INSTANCE.convertList03(labelDictDataCache.row(type).values());
169   - }
170   -
171   - @Override
172 167 public Long createDictData(DictDataCreateReqVO reqVO) {
173 168 // 校验正确性
174 169 checkCreateOrUpdate(null, reqVO.getValue(), reqVO.getDictType());
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/logger/OperateLogService.java
1 1 package cn.iocoder.yudao.module.system.service.logger;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.framework.operatelog.core.service.OperateLog;
4 5 import cn.iocoder.yudao.framework.operatelog.core.service.OperateLogFrameworkService;
  6 +import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogCreateReqDTO;
5 7 import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogExportReqVO;
6 8 import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogPageReqVO;
7 9 import cn.iocoder.yudao.module.system.dal.dataobject.logger.OperateLogDO;
... ... @@ -10,8 +12,17 @@ import java.util.List;
10 12  
11 13 /**
12 14 * 操作日志 Service 接口
  15 + *
  16 + * @author 芋道源码
13 17 */
14   -public interface OperateLogService extends OperateLogFrameworkService {
  18 +public interface OperateLogService {
  19 +
  20 + /**
  21 + * 记录操作日志
  22 + *
  23 + * @param createReqDTO 操作日志请求
  24 + */
  25 + void createOperateLog(OperateLogCreateReqDTO createReqDTO);
15 26  
16 27 /**
17 28 * 获得操作日志分页列表
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/logger/OperateLogServiceImpl.java
... ... @@ -4,7 +4,7 @@ import cn.hutool.core.collection.CollUtil;
4 4 import cn.hutool.core.util.StrUtil;
5 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
6 6 import cn.iocoder.yudao.framework.common.util.string.StrUtils;
7   -import cn.iocoder.yudao.framework.operatelog.core.dto.OperateLogCreateReqDTO;
  7 +import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogCreateReqDTO;
8 8 import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogExportReqVO;
9 9 import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogPageReqVO;
10 10 import cn.iocoder.yudao.module.system.convert.logger.OperateLogConvert;
... ... @@ -13,8 +13,6 @@ import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
13 13 import cn.iocoder.yudao.module.system.dal.mysql.logger.OperateLogMapper;
14 14 import cn.iocoder.yudao.module.system.service.user.AdminUserService;
15 15 import lombok.extern.slf4j.Slf4j;
16   -import org.springframework.scheduling.annotation.Async;
17   -import org.springframework.scheduling.annotation.AsyncResult;
18 16 import org.springframework.stereotype.Service;
19 17 import org.springframework.validation.annotation.Validated;
20 18  
... ... @@ -22,7 +20,6 @@ import javax.annotation.Resource;
22 20 import java.util.Collection;
23 21 import java.util.Collections;
24 22 import java.util.List;
25   -import java.util.concurrent.Future;
26 23  
27 24 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
28 25 import static cn.iocoder.yudao.module.system.dal.dataobject.logger.OperateLogDO.JAVA_METHOD_ARGS_MAX_LENGTH;
... ... @@ -40,19 +37,11 @@ public class OperateLogServiceImpl implements OperateLogService {
40 37 private AdminUserService userService;
41 38  
42 39 @Override
43   - @Async
44   - public Future<Boolean> createOperateLogAsync(OperateLogCreateReqDTO reqVO) {
45   - boolean success = false;
46   - try {
47   - OperateLogDO logDO = OperateLogConvert.INSTANCE.convert(reqVO);
48   - logDO.setJavaMethodArgs(StrUtils.maxLength(logDO.getJavaMethodArgs(), JAVA_METHOD_ARGS_MAX_LENGTH));
49   - logDO.setResultData(StrUtils.maxLength(logDO.getResultData(), RESULT_MAX_LENGTH));
50   - success = operateLogMapper.insert(logDO) == 1;
51   - } catch (Throwable throwable) {
52   - // 仅仅打印日志,不对外抛出。原因是,还是要保留现场数据。
53   - log.error("[createOperateLogAsync][记录操作日志异常,日志为 ({})]", reqVO, throwable);
54   - }
55   - return new AsyncResult<>(success);
  40 + public void createOperateLog(OperateLogCreateReqDTO createReqDTO) {
  41 + OperateLogDO logDO = OperateLogConvert.INSTANCE.convert(createReqDTO);
  42 + logDO.setJavaMethodArgs(StrUtils.maxLength(logDO.getJavaMethodArgs(), JAVA_METHOD_ARGS_MAX_LENGTH));
  43 + logDO.setResultData(StrUtils.maxLength(logDO.getResultData(), RESULT_MAX_LENGTH));
  44 + operateLogMapper.insert(logDO);
56 45 }
57 46  
58 47 @Override
... ...
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/logger/OperateLogServiceImplTest.java
... ... @@ -7,9 +7,10 @@ import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstant
7 7 import cn.iocoder.yudao.framework.common.pojo.PageResult;
8 8 import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils;
9 9 import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
10   -import cn.iocoder.yudao.framework.operatelog.core.dto.OperateLogCreateReqDTO;
11 10 import cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum;
  11 +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
12 12 import cn.iocoder.yudao.framework.test.core.util.RandomUtils;
  13 +import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogCreateReqDTO;
13 14 import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogExportReqVO;
14 15 import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogPageReqVO;
15 16 import cn.iocoder.yudao.module.system.dal.dataobject.logger.OperateLogDO;
... ... @@ -17,7 +18,6 @@ import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
17 18 import cn.iocoder.yudao.module.system.dal.mysql.logger.OperateLogMapper;
18 19 import cn.iocoder.yudao.module.system.enums.common.SexEnum;
19 20 import cn.iocoder.yudao.module.system.service.user.AdminUserService;
20   -import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
21 21 import org.junit.jupiter.api.Test;
22 22 import org.springframework.boot.test.mock.mockito.MockBean;
23 23 import org.springframework.context.annotation.Import;
... ... @@ -25,8 +25,6 @@ import org.springframework.context.annotation.Import;
25 25 import javax.annotation.Resource;
26 26 import java.util.Collections;
27 27 import java.util.List;
28   -import java.util.concurrent.ExecutionException;
29   -import java.util.concurrent.Future;
30 28  
31 29 import static cn.hutool.core.util.RandomUtil.randomEle;
32 30 import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST;
... ... @@ -49,7 +47,7 @@ public class OperateLogServiceImplTest extends BaseDbUnitTest {
49 47 private AdminUserService userService;
50 48  
51 49 @Test
52   - public void testCreateOperateLogAsync() throws InterruptedException, ExecutionException {
  50 + public void testCreateOperateLogAsync() {
53 51 String traceId = TracerUtils.getTraceId();
54 52 OperateLogCreateReqDTO reqVO = RandomUtils.randomPojo(OperateLogCreateReqDTO.class, o -> {
55 53 o.setTraceId(traceId);
... ... @@ -59,8 +57,7 @@ public class OperateLogServiceImplTest extends BaseDbUnitTest {
59 57 });
60 58  
61 59 // 执行service方法
62   - Future<Boolean> future = operateLogServiceImpl.createOperateLogAsync(reqVO);
63   - future.get();
  60 + operateLogServiceImpl.createOperateLog(reqVO);
64 61 // 断言插入是否正确
65 62 OperateLogDO sysOperateLogDO = operateLogMapper.selectOne("trace_id", traceId);
66 63 assertPojoEquals(reqVO, sysOperateLogDO);
... ...
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImplTest.java
... ... @@ -225,7 +225,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
225 225 ByteArrayInputStream avatarFile = new ByteArrayInputStream(avatarFileBytes);
226 226 // mock 方法
227 227 String avatar = randomString();
228   - when(fileApi.createFile(eq(avatarFileBytes))).thenReturn(avatar);
  228 + when(fileApi.createFile(eq( avatarFileBytes))).thenReturn(avatar);
229 229  
230 230 // 调用
231 231 userService.updateUserAvatar(userId, avatarFile);
... ...
yudao-ui-admin/src/views/infra/file/index.vue
... ... @@ -26,8 +26,9 @@
26 26  
27 27 <!-- 列表 -->
28 28 <el-table v-loading="loading" :data="list">
29   - <el-table-column label="文件名" align="center" prop="path" />
30   - <el-table-column label="URL" align="center" prop="url" />
  29 + <el-table-column label="文件名" align="center" prop="name" />
  30 + <el-table-column label="文件路径" align="center" prop="path" />
  31 + <el-table-column label="文件 URL" align="center" prop="url" />
31 32 <el-table-column label="文件大小" align="center" prop="size" width="120" :formatter="sizeFormat" />
32 33 <el-table-column label="文件类型" align="center" prop="type" width="80" />
33 34 <!-- <el-table-column label="文件内容" align="center" prop="content">-->
... ... @@ -160,7 +161,7 @@ export default {
160 161 },
161 162 /** 处理上传的文件发生变化 */
162 163 handleFileChange(file, fileList) {
163   - this.upload.data.path = file.name;
  164 +
164 165 },
165 166 /** 处理文件上传中 */
166 167 handleFileUploadProgress(event, file, fileList) {
... ...