Commit 0c4713b7e05e874a4419d9facdf0fae28945bf48
Merge remote-tracking branch 'origin/feature/mall_product' into feature/mall_product
# Conflicts: # sql/mysql/mall.sql
Showing
24 changed files
with
811 additions
and
84 deletions
sql/mysql/mall.sql
| 1 | INSERT INTO system_menu (name, permission, type, sort, parent_id, path, icon, component, component_name) | 1 | INSERT INTO system_menu (name, permission, type, sort, parent_id, path, icon, component, component_name) |
| 2 | -VALUES ('商城首页', '', 2, 1, 2362, 'home', 'ep:home-filled', 'mall/home/index', 'MallHome'); | ||
| 3 | - | ||
| 4 | -INSERT INTO system_menu (name, permission, type, sort, parent_id, path, icon, component, component_name) | ||
| 5 | VALUES ('核销订单', '', 2, 2, 2166, 'pick-up-order', 'ep:list', 'mall/trade/delivery/pickUpOrder/index', 'PickUpOrder'); | 2 | VALUES ('核销订单', '', 2, 2, 2166, 'pick-up-order', 'ep:list', 'mall/trade/delivery/pickUpOrder/index', 'PickUpOrder'); |
| 6 | \ No newline at end of file | 3 | \ No newline at end of file |
sql/mysql/ruoyi-vue-pro.sql
| @@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
| 11 | Target Server Version : 80034 | 11 | Target Server Version : 80034 |
| 12 | File Encoding : 65001 | 12 | File Encoding : 65001 |
| 13 | 13 | ||
| 14 | - Date: 14/10/2023 20:04:17 | 14 | + Date: 17/10/2023 23:22:59 |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | SET NAMES utf8mb4; | 17 | SET NAMES utf8mb4; |
| @@ -384,7 +384,7 @@ CREATE TABLE `infra_api_error_log` ( | @@ -384,7 +384,7 @@ CREATE TABLE `infra_api_error_log` ( | ||
| 384 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 384 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 385 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | 385 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 386 | PRIMARY KEY (`id`) USING BTREE | 386 | PRIMARY KEY (`id`) USING BTREE |
| 387 | -) ENGINE = InnoDB AUTO_INCREMENT = 1734 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统异常日志'; | 387 | +) ENGINE = InnoDB AUTO_INCREMENT = 1735 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统异常日志'; |
| 388 | 388 | ||
| 389 | -- ---------------------------- | 389 | -- ---------------------------- |
| 390 | -- Records of infra_api_error_log | 390 | -- Records of infra_api_error_log |
| @@ -422,7 +422,7 @@ CREATE TABLE `infra_codegen_column` ( | @@ -422,7 +422,7 @@ CREATE TABLE `infra_codegen_column` ( | ||
| 422 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | 422 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 423 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 423 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 424 | PRIMARY KEY (`id`) USING BTREE | 424 | PRIMARY KEY (`id`) USING BTREE |
| 425 | -) ENGINE = InnoDB AUTO_INCREMENT = 1805 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表字段定义'; | 425 | +) ENGINE = InnoDB AUTO_INCREMENT = 1804 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表字段定义'; |
| 426 | 426 | ||
| 427 | -- ---------------------------- | 427 | -- ---------------------------- |
| 428 | -- Records of infra_codegen_column | 428 | -- Records of infra_codegen_column |
| @@ -455,7 +455,7 @@ CREATE TABLE `infra_codegen_table` ( | @@ -455,7 +455,7 @@ CREATE TABLE `infra_codegen_table` ( | ||
| 455 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | 455 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 456 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 456 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 457 | PRIMARY KEY (`id`) USING BTREE | 457 | PRIMARY KEY (`id`) USING BTREE |
| 458 | -) ENGINE = InnoDB AUTO_INCREMENT = 137 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表定义'; | 458 | +) ENGINE = InnoDB AUTO_INCREMENT = 136 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表定义'; |
| 459 | 459 | ||
| 460 | -- ---------------------------- | 460 | -- ---------------------------- |
| 461 | -- Records of infra_codegen_table | 461 | -- Records of infra_codegen_table |
| @@ -538,7 +538,7 @@ CREATE TABLE `infra_file` ( | @@ -538,7 +538,7 @@ CREATE TABLE `infra_file` ( | ||
| 538 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | 538 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 539 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 539 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 540 | PRIMARY KEY (`id`) USING BTREE | 540 | PRIMARY KEY (`id`) USING BTREE |
| 541 | -) ENGINE = InnoDB AUTO_INCREMENT = 1095 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '文件表'; | 541 | +) ENGINE = InnoDB AUTO_INCREMENT = 1098 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '文件表'; |
| 542 | 542 | ||
| 543 | -- ---------------------------- | 543 | -- ---------------------------- |
| 544 | -- Records of infra_file | 544 | -- Records of infra_file |
| @@ -587,7 +587,7 @@ CREATE TABLE `infra_file_content` ( | @@ -587,7 +587,7 @@ CREATE TABLE `infra_file_content` ( | ||
| 587 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | 587 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 588 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 588 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 589 | PRIMARY KEY (`id`) USING BTREE | 589 | PRIMARY KEY (`id`) USING BTREE |
| 590 | -) ENGINE = InnoDB AUTO_INCREMENT = 188 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '文件表'; | 590 | +) ENGINE = InnoDB AUTO_INCREMENT = 191 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '文件表'; |
| 591 | 591 | ||
| 592 | -- ---------------------------- | 592 | -- ---------------------------- |
| 593 | -- Records of infra_file_content | 593 | -- Records of infra_file_content |
| @@ -615,7 +615,7 @@ CREATE TABLE `infra_job` ( | @@ -615,7 +615,7 @@ CREATE TABLE `infra_job` ( | ||
| 615 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | 615 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 616 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 616 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 617 | PRIMARY KEY (`id`) USING BTREE | 617 | PRIMARY KEY (`id`) USING BTREE |
| 618 | -) ENGINE = InnoDB AUTO_INCREMENT = 28 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '定时任务表'; | 618 | +) ENGINE = InnoDB AUTO_INCREMENT = 27 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '定时任务表'; |
| 619 | 619 | ||
| 620 | -- ---------------------------- | 620 | -- ---------------------------- |
| 621 | -- Records of infra_job | 621 | -- Records of infra_job |
| @@ -656,7 +656,7 @@ CREATE TABLE `infra_job_log` ( | @@ -656,7 +656,7 @@ CREATE TABLE `infra_job_log` ( | ||
| 656 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | 656 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 657 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 657 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 658 | PRIMARY KEY (`id`) USING BTREE | 658 | PRIMARY KEY (`id`) USING BTREE |
| 659 | -) ENGINE = InnoDB AUTO_INCREMENT = 233 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '定时任务日志表'; | 659 | +) ENGINE = InnoDB AUTO_INCREMENT = 232 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '定时任务日志表'; |
| 660 | 660 | ||
| 661 | -- ---------------------------- | 661 | -- ---------------------------- |
| 662 | -- Records of infra_job_log | 662 | -- Records of infra_job_log |
| @@ -709,7 +709,7 @@ CREATE TABLE `member_address` ( | @@ -709,7 +709,7 @@ CREATE TABLE `member_address` ( | ||
| 709 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | 709 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 710 | PRIMARY KEY (`id`) USING BTREE, | 710 | PRIMARY KEY (`id`) USING BTREE, |
| 711 | INDEX `idx_userId`(`user_id` ASC) USING BTREE | 711 | INDEX `idx_userId`(`user_id` ASC) USING BTREE |
| 712 | -) ENGINE = InnoDB AUTO_INCREMENT = 25 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户收件地址'; | 712 | +) ENGINE = InnoDB AUTO_INCREMENT = 24 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户收件地址'; |
| 713 | 713 | ||
| 714 | -- ---------------------------- | 714 | -- ---------------------------- |
| 715 | -- Records of member_address | 715 | -- Records of member_address |
| @@ -768,7 +768,7 @@ CREATE TABLE `member_experience_record` ( | @@ -768,7 +768,7 @@ CREATE TABLE `member_experience_record` ( | ||
| 768 | PRIMARY KEY (`id`) USING BTREE, | 768 | PRIMARY KEY (`id`) USING BTREE, |
| 769 | INDEX `idx_user_id`(`user_id` ASC) USING BTREE COMMENT '会员经验记录-用户编号', | 769 | INDEX `idx_user_id`(`user_id` ASC) USING BTREE COMMENT '会员经验记录-用户编号', |
| 770 | INDEX `idx_user_biz_type`(`user_id` ASC, `biz_type` ASC) USING BTREE COMMENT '会员经验记录-用户业务类型' | 770 | INDEX `idx_user_biz_type`(`user_id` ASC, `biz_type` ASC) USING BTREE COMMENT '会员经验记录-用户业务类型' |
| 771 | -) ENGINE = InnoDB AUTO_INCREMENT = 41 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员经验记录'; | 771 | +) ENGINE = InnoDB AUTO_INCREMENT = 40 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员经验记录'; |
| 772 | 772 | ||
| 773 | -- ---------------------------- | 773 | -- ---------------------------- |
| 774 | -- Records of member_experience_record | 774 | -- Records of member_experience_record |
| @@ -883,7 +883,7 @@ CREATE TABLE `member_level_record` ( | @@ -883,7 +883,7 @@ CREATE TABLE `member_level_record` ( | ||
| 883 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | 883 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 884 | PRIMARY KEY (`id`) USING BTREE, | 884 | PRIMARY KEY (`id`) USING BTREE, |
| 885 | INDEX `idx_user_id`(`user_id` ASC) USING BTREE COMMENT '会员等级记录-用户编号' | 885 | INDEX `idx_user_id`(`user_id` ASC) USING BTREE COMMENT '会员等级记录-用户编号' |
| 886 | -) ENGINE = InnoDB AUTO_INCREMENT = 20 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员等级记录'; | 886 | +) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员等级记录'; |
| 887 | 887 | ||
| 888 | -- ---------------------------- | 888 | -- ---------------------------- |
| 889 | -- Records of member_level_record | 889 | -- Records of member_level_record |
| @@ -913,7 +913,7 @@ CREATE TABLE `member_point_record` ( | @@ -913,7 +913,7 @@ CREATE TABLE `member_point_record` ( | ||
| 913 | PRIMARY KEY (`id`) USING BTREE, | 913 | PRIMARY KEY (`id`) USING BTREE, |
| 914 | INDEX `index_userId`(`user_id` ASC) USING BTREE, | 914 | INDEX `index_userId`(`user_id` ASC) USING BTREE, |
| 915 | INDEX `index_title`(`title` ASC) USING BTREE | 915 | INDEX `index_title`(`title` ASC) USING BTREE |
| 916 | -) ENGINE = InnoDB AUTO_INCREMENT = 60 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户积分记录'; | 916 | +) ENGINE = InnoDB AUTO_INCREMENT = 59 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户积分记录'; |
| 917 | 917 | ||
| 918 | -- ---------------------------- | 918 | -- ---------------------------- |
| 919 | -- Records of member_point_record | 919 | -- Records of member_point_record |
| @@ -1072,6 +1072,7 @@ CREATE TABLE `member_user` ( | @@ -1072,6 +1072,7 @@ CREATE TABLE `member_user` ( | ||
| 1072 | `password` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '密码', | 1072 | `password` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '密码', |
| 1073 | `status` tinyint NOT NULL COMMENT '状态', | 1073 | `status` tinyint NOT NULL COMMENT '状态', |
| 1074 | `register_ip` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '注册 IP', | 1074 | `register_ip` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '注册 IP', |
| 1075 | + `register_terminal` tinyint NULL DEFAULT NULL COMMENT '注册终端', | ||
| 1075 | `login_ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '最后登录IP', | 1076 | `login_ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '最后登录IP', |
| 1076 | `login_date` datetime NULL DEFAULT NULL COMMENT '最后登录时间', | 1077 | `login_date` datetime NULL DEFAULT NULL COMMENT '最后登录时间', |
| 1077 | `nickname` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户昵称', | 1078 | `nickname` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户昵称', |
| @@ -1539,7 +1540,7 @@ CREATE TABLE `system_error_code` ( | @@ -1539,7 +1540,7 @@ CREATE TABLE `system_error_code` ( | ||
| 1539 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | 1540 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 1540 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 1541 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 1541 | PRIMARY KEY (`id`) USING BTREE | 1542 | PRIMARY KEY (`id`) USING BTREE |
| 1542 | -) ENGINE = InnoDB AUTO_INCREMENT = 5933 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '错误码表'; | 1543 | +) ENGINE = InnoDB AUTO_INCREMENT = 5932 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '错误码表'; |
| 1543 | 1544 | ||
| 1544 | -- ---------------------------- | 1545 | -- ---------------------------- |
| 1545 | -- Records of system_error_code | 1546 | -- Records of system_error_code |
| @@ -1568,7 +1569,7 @@ CREATE TABLE `system_login_log` ( | @@ -1568,7 +1569,7 @@ CREATE TABLE `system_login_log` ( | ||
| 1568 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 1569 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 1569 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | 1570 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 1570 | PRIMARY KEY (`id`) USING BTREE | 1571 | PRIMARY KEY (`id`) USING BTREE |
| 1571 | -) ENGINE = InnoDB AUTO_INCREMENT = 2561 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统访问记录'; | 1572 | +) ENGINE = InnoDB AUTO_INCREMENT = 2582 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统访问记录'; |
| 1572 | 1573 | ||
| 1573 | -- ---------------------------- | 1574 | -- ---------------------------- |
| 1574 | -- Records of system_login_log | 1575 | -- Records of system_login_log |
| @@ -1633,7 +1634,7 @@ CREATE TABLE `system_mail_log` ( | @@ -1633,7 +1634,7 @@ CREATE TABLE `system_mail_log` ( | ||
| 1633 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | 1634 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 1634 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 1635 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 1635 | PRIMARY KEY (`id`) USING BTREE | 1636 | PRIMARY KEY (`id`) USING BTREE |
| 1636 | -) ENGINE = InnoDB AUTO_INCREMENT = 355 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '邮件日志表'; | 1637 | +) ENGINE = InnoDB AUTO_INCREMENT = 354 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '邮件日志表'; |
| 1637 | 1638 | ||
| 1638 | -- ---------------------------- | 1639 | -- ---------------------------- |
| 1639 | -- Records of system_mail_log | 1640 | -- Records of system_mail_log |
| @@ -1698,7 +1699,7 @@ CREATE TABLE `system_menu` ( | @@ -1698,7 +1699,7 @@ CREATE TABLE `system_menu` ( | ||
| 1698 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | 1699 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 1699 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 1700 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 1700 | PRIMARY KEY (`id`) USING BTREE | 1701 | PRIMARY KEY (`id`) USING BTREE |
| 1701 | -) ENGINE = InnoDB AUTO_INCREMENT = 2377 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '菜单权限表'; | 1702 | +) ENGINE = InnoDB AUTO_INCREMENT = 2389 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '菜单权限表'; |
| 1702 | 1703 | ||
| 1703 | -- ---------------------------- | 1704 | -- ---------------------------- |
| 1704 | -- Records of system_menu | 1705 | -- Records of system_menu |
| @@ -1950,7 +1951,7 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i | @@ -1950,7 +1951,7 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i | ||
| 1950 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2021, '规格创建', 'product:property:create', 3, 2, 2019, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-12-12 20:26:30', b'0'); | 1951 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2021, '规格创建', 'product:property:create', 3, 2, 2019, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-12-12 20:26:30', b'0'); |
| 1951 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2022, '规格更新', 'product:property:update', 3, 3, 2019, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-12-12 20:26:33', b'0'); | 1952 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2022, '规格更新', 'product:property:update', 3, 3, 2019, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-12-12 20:26:33', b'0'); |
| 1952 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2023, '规格删除', 'product:property:delete', 3, 4, 2019, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-12-12 20:26:37', b'0'); | 1953 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2023, '规格删除', 'product:property:delete', 3, 4, 2019, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-12-12 20:26:37', b'0'); |
| 1953 | -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2025, 'Banner管理', '', 2, 100, 2030, 'banner', '', 'mall/market/banner/index', NULL, 0, b'1', b'1', b'1', '', '2022-08-01 14:56:14', '1', '2023-08-21 10:27:51', b'0'); | 1954 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2025, 'Banner管理', '', 2, 100, 2387, 'banner', 'fa:bandcamp', 'mall/market/banner/index', NULL, 0, b'1', b'1', b'1', '', '2022-08-01 14:56:14', '1', '2023-10-16 09:41:54', b'0'); |
| 1954 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2026, 'Banner查询', 'market:banner:query', 3, 1, 2025, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0'); | 1955 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2026, 'Banner查询', 'market:banner:query', 3, 1, 2025, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0'); |
| 1955 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2027, 'Banner创建', 'market:banner:create', 3, 2, 2025, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0'); | 1956 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2027, 'Banner创建', 'market:banner:create', 3, 2, 2025, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0'); |
| 1956 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2028, 'Banner更新', 'market:banner:update', 3, 3, 2025, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0'); | 1957 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2028, 'Banner更新', 'market:banner:update', 3, 3, 2025, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0'); |
| @@ -2180,6 +2181,18 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i | @@ -2180,6 +2181,18 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i | ||
| 2180 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2374, '会员统计', '', 2, 2, 2358, 'member', 'ep:avatar', 'statistics/member/index', 'MemberStatistics', 0, b'1', b'1', b'1', '', '2023-10-11 04:39:24', '1', '2023-10-11 12:50:22', b'0'); | 2181 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2374, '会员统计', '', 2, 2, 2358, 'member', 'ep:avatar', 'statistics/member/index', 'MemberStatistics', 0, b'1', b'1', b'1', '', '2023-10-11 04:39:24', '1', '2023-10-11 12:50:22', b'0'); |
| 2181 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2375, '会员统计查询', 'statistics:member:query', 3, 1, 2374, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-11 04:39:24', '', '2023-10-11 04:39:24', b'0'); | 2182 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2375, '会员统计查询', 'statistics:member:query', 3, 1, 2374, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-11 04:39:24', '', '2023-10-11 04:39:24', b'0'); |
| 2182 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2376, '订单核销', 'trade:order:pick-up', 3, 10, 2076, '', '', '', '', 0, b'1', b'1', b'1', '1', '2023-10-14 17:11:58', '1', '2023-10-14 17:11:58', b'0'); | 2183 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2376, '订单核销', 'trade:order:pick-up', 3, 10, 2076, '', '', '', '', 0, b'1', b'1', b'1', '1', '2023-10-14 17:11:58', '1', '2023-10-14 17:11:58', b'0'); |
| 2184 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2377, '文章分类', '', 2, 0, 2387, 'article/category', 'fa:certificate', 'mall/promotion/article/category/index', 'ArticleCategory', 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '1', '2023-10-16 09:38:26', b'0'); | ||
| 2185 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2378, '分类查询', 'promotion:article-category:query', 3, 1, 2377, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '', '2023-10-16 01:26:18', b'0'); | ||
| 2186 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2379, '分类创建', 'promotion:article-category:create', 3, 2, 2377, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '', '2023-10-16 01:26:18', b'0'); | ||
| 2187 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2380, '分类更新', 'promotion:article-category:update', 3, 3, 2377, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '', '2023-10-16 01:26:18', b'0'); | ||
| 2188 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2381, '分类删除', 'promotion:article-category:delete', 3, 4, 2377, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '', '2023-10-16 01:26:18', b'0'); | ||
| 2189 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2382, '文章列表', '', 2, 2, 2387, 'article', 'ep:connection', 'mall/promotion/article/index', 'Article', 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '1', '2023-10-16 09:41:19', b'0'); | ||
| 2190 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2383, '文章管理查询', 'promotion:article:query', 3, 1, 2382, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '', '2023-10-16 01:26:18', b'0'); | ||
| 2191 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2384, '文章管理创建', 'promotion:article:create', 3, 2, 2382, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '', '2023-10-16 01:26:18', b'0'); | ||
| 2192 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2385, '文章管理更新', 'promotion:article:update', 3, 3, 2382, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '', '2023-10-16 01:26:18', b'0'); | ||
| 2193 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2386, '文章管理删除', 'promotion:article:delete', 3, 4, 2382, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '', '2023-10-16 01:26:18', b'0'); | ||
| 2194 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2387, '内容管理', '', 1, 1, 2030, 'content', 'ep:collection', '', '', 0, b'1', b'1', b'1', '1', '2023-10-16 09:37:31', '1', '2023-10-16 09:37:31', b'0'); | ||
| 2195 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2388, '商城首页', '', 2, 1, 2362, 'home', 'ep:home-filled', 'mall/home/index', 'MallHome', 0, b'1', b'1', b'1', '', '2023-10-16 12:10:33', '', '2023-10-16 12:10:33', b'0'); | ||
| 2183 | COMMIT; | 2196 | COMMIT; |
| 2184 | 2197 | ||
| 2185 | -- ---------------------------- | 2198 | -- ---------------------------- |
| @@ -2270,7 +2283,7 @@ CREATE TABLE `system_notify_template` ( | @@ -2270,7 +2283,7 @@ CREATE TABLE `system_notify_template` ( | ||
| 2270 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | 2283 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 2271 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 2284 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 2272 | PRIMARY KEY (`id`) USING BTREE | 2285 | PRIMARY KEY (`id`) USING BTREE |
| 2273 | -) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '站内信模板表'; | 2286 | +) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '站内信模板表'; |
| 2274 | 2287 | ||
| 2275 | -- ---------------------------- | 2288 | -- ---------------------------- |
| 2276 | -- Records of system_notify_template | 2289 | -- Records of system_notify_template |
| @@ -2298,7 +2311,7 @@ CREATE TABLE `system_oauth2_access_token` ( | @@ -2298,7 +2311,7 @@ CREATE TABLE `system_oauth2_access_token` ( | ||
| 2298 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 2311 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 2299 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | 2312 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 2300 | PRIMARY KEY (`id`) USING BTREE | 2313 | PRIMARY KEY (`id`) USING BTREE |
| 2301 | -) ENGINE = InnoDB AUTO_INCREMENT = 3022 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 访问令牌'; | 2314 | +) ENGINE = InnoDB AUTO_INCREMENT = 3056 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 访问令牌'; |
| 2302 | 2315 | ||
| 2303 | -- ---------------------------- | 2316 | -- ---------------------------- |
| 2304 | -- Records of system_oauth2_access_token | 2317 | -- Records of system_oauth2_access_token |
| @@ -2420,7 +2433,7 @@ CREATE TABLE `system_oauth2_refresh_token` ( | @@ -2420,7 +2433,7 @@ CREATE TABLE `system_oauth2_refresh_token` ( | ||
| 2420 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 2433 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 2421 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | 2434 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 2422 | PRIMARY KEY (`id`) USING BTREE | 2435 | PRIMARY KEY (`id`) USING BTREE |
| 2423 | -) ENGINE = InnoDB AUTO_INCREMENT = 1049 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 刷新令牌'; | 2436 | +) ENGINE = InnoDB AUTO_INCREMENT = 1063 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 刷新令牌'; |
| 2424 | 2437 | ||
| 2425 | -- ---------------------------- | 2438 | -- ---------------------------- |
| 2426 | -- Records of system_oauth2_refresh_token | 2439 | -- Records of system_oauth2_refresh_token |
| @@ -2460,7 +2473,7 @@ CREATE TABLE `system_operate_log` ( | @@ -2460,7 +2473,7 @@ CREATE TABLE `system_operate_log` ( | ||
| 2460 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 2473 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 2461 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | 2474 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 2462 | PRIMARY KEY (`id`) USING BTREE | 2475 | PRIMARY KEY (`id`) USING BTREE |
| 2463 | -) ENGINE = InnoDB AUTO_INCREMENT = 8718 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '操作日志记录'; | 2476 | +) ENGINE = InnoDB AUTO_INCREMENT = 8738 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '操作日志记录'; |
| 2464 | 2477 | ||
| 2465 | -- ---------------------------- | 2478 | -- ---------------------------- |
| 2466 | -- Records of system_operate_log | 2479 | -- Records of system_operate_log |
| @@ -3468,7 +3481,7 @@ CREATE TABLE `system_sms_code` ( | @@ -3468,7 +3481,7 @@ CREATE TABLE `system_sms_code` ( | ||
| 3468 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | 3481 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 3469 | PRIMARY KEY (`id`) USING BTREE, | 3482 | PRIMARY KEY (`id`) USING BTREE, |
| 3470 | INDEX `idx_mobile`(`mobile` ASC) USING BTREE COMMENT '手机号' | 3483 | INDEX `idx_mobile`(`mobile` ASC) USING BTREE COMMENT '手机号' |
| 3471 | -) ENGINE = InnoDB AUTO_INCREMENT = 531 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '手机验证码'; | 3484 | +) ENGINE = InnoDB AUTO_INCREMENT = 530 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '手机验证码'; |
| 3472 | 3485 | ||
| 3473 | -- ---------------------------- | 3486 | -- ---------------------------- |
| 3474 | -- Records of system_sms_code | 3487 | -- Records of system_sms_code |
| @@ -3511,7 +3524,7 @@ CREATE TABLE `system_sms_log` ( | @@ -3511,7 +3524,7 @@ CREATE TABLE `system_sms_log` ( | ||
| 3511 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | 3524 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 3512 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 3525 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 3513 | PRIMARY KEY (`id`) USING BTREE | 3526 | PRIMARY KEY (`id`) USING BTREE |
| 3514 | -) ENGINE = InnoDB AUTO_INCREMENT = 442 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '短信日志'; | 3527 | +) ENGINE = InnoDB AUTO_INCREMENT = 445 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '短信日志'; |
| 3515 | 3528 | ||
| 3516 | -- ---------------------------- | 3529 | -- ---------------------------- |
| 3517 | -- Records of system_sms_log | 3530 | -- Records of system_sms_log |
| @@ -3583,7 +3596,7 @@ CREATE TABLE `system_social_user` ( | @@ -3583,7 +3596,7 @@ CREATE TABLE `system_social_user` ( | ||
| 3583 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 3596 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 3584 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | 3597 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 3585 | PRIMARY KEY (`id`) USING BTREE | 3598 | PRIMARY KEY (`id`) USING BTREE |
| 3586 | -) ENGINE = InnoDB AUTO_INCREMENT = 22 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '社交用户表'; | 3599 | +) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '社交用户表'; |
| 3587 | 3600 | ||
| 3588 | -- ---------------------------- | 3601 | -- ---------------------------- |
| 3589 | -- Records of system_social_user | 3602 | -- Records of system_social_user |
| @@ -3608,7 +3621,7 @@ CREATE TABLE `system_social_user_bind` ( | @@ -3608,7 +3621,7 @@ CREATE TABLE `system_social_user_bind` ( | ||
| 3608 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 3621 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 3609 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | 3622 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 3610 | PRIMARY KEY (`id`) USING BTREE | 3623 | PRIMARY KEY (`id`) USING BTREE |
| 3611 | -) ENGINE = InnoDB AUTO_INCREMENT = 77 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '社交绑定表'; | 3624 | +) ENGINE = InnoDB AUTO_INCREMENT = 76 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '社交绑定表'; |
| 3612 | 3625 | ||
| 3613 | -- ---------------------------- | 3626 | -- ---------------------------- |
| 3614 | -- Records of system_social_user_bind | 3627 | -- Records of system_social_user_bind |
| @@ -3784,7 +3797,7 @@ CREATE TABLE `system_users` ( | @@ -3784,7 +3797,7 @@ CREATE TABLE `system_users` ( | ||
| 3784 | -- Records of system_users | 3797 | -- Records of system_users |
| 3785 | -- ---------------------------- | 3798 | -- ---------------------------- |
| 3786 | BEGIN; | 3799 | BEGIN; |
| 3787 | -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$mRMIYLDtRHlf6.9ipiqH1.Z.bh/R9dO9d5iHiGYPigi6r5KOoR2Wm', '芋道源码', '管理员', 103, '[1]', 'aoteman@126.com', '15612345678', 1, 'http://test.yudao.iocoder.cn/e1fdd7271685ec143a0900681606406621717a666ad0b2798b096df41422b32f.png', 0, '0:0:0:0:0:0:0:1', '2023-10-14 17:12:19', 'admin', '2021-01-05 17:03:47', NULL, '2023-10-14 17:12:19', b'0', 1); | 3800 | +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$mRMIYLDtRHlf6.9ipiqH1.Z.bh/R9dO9d5iHiGYPigi6r5KOoR2Wm', '芋道源码', '管理员', 103, '[1]', 'aoteman@126.com', '15612345678', 1, 'http://test.yudao.iocoder.cn/e1fdd7271685ec143a0900681606406621717a666ad0b2798b096df41422b32f.png', 0, '0:0:0:0:0:0:0:1', '2023-10-17 21:03:03', 'admin', '2021-01-05 17:03:47', NULL, '2023-10-17 21:03:03', b'0', 1); |
| 3788 | 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-07-09 23:03:33', '', '2021-01-07 09:07:17', NULL, '2022-07-09 23:03:33', b'0', 1); | 3801 | 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-07-09 23:03:33', '', '2021-01-07 09:07:17', NULL, '2022-07-09 23:03:33', b'0', 1); |
| 3789 | 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$YMpimV4T6BtDhIaA8jSW.u8UTGBeGhc/qwXP4oxoMr4mOw9.qttt6', '源码', NULL, 106, NULL, 'yuanma@iocoder.cn', '15601701300', 0, '', 0, '127.0.0.1', '2022-07-08 01:26:27', '', '2021-01-13 23:50:35', NULL, '2022-07-08 01:26:27', b'0', 1); | 3802 | 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$YMpimV4T6BtDhIaA8jSW.u8UTGBeGhc/qwXP4oxoMr4mOw9.qttt6', '源码', NULL, 106, NULL, 'yuanma@iocoder.cn', '15601701300', 0, '', 0, '127.0.0.1', '2022-07-08 01:26:27', '', '2021-01-13 23:50:35', NULL, '2022-07-08 01:26:27', b'0', 1); |
| 3790 | 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,2]', '111@qq.com', '15601691200', 1, '', 0, '0:0:0:0:0:0:0:1', '2023-09-24 18:21:19', '', '2021-01-21 02:13:53', NULL, '2023-09-24 18:21:19', b'0', 1); | 3803 | 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,2]', '111@qq.com', '15601691200', 1, '', 0, '0:0:0:0:0:0:0:1', '2023-09-24 18:21:19', '', '2021-01-21 02:13:53', NULL, '2023-09-24 18:21:19', b'0', 1); |
yudao-dependencies/pom.xml
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | <!-- 统一依赖管理 --> | 19 | <!-- 统一依赖管理 --> |
| 20 | <spring.boot.version>2.7.16</spring.boot.version> | 20 | <spring.boot.version>2.7.16</spring.boot.version> |
| 21 | <!-- Web 相关 --> | 21 | <!-- Web 相关 --> |
| 22 | - <springdoc.version>1.7.0</springdoc.version> | 22 | + <springdoc.version>1.6.15</springdoc.version> |
| 23 | <knife4j.version>4.3.0</knife4j.version> | 23 | <knife4j.version>4.3.0</knife4j.version> |
| 24 | <servlet.versoin>2.5</servlet.versoin> | 24 | <servlet.versoin>2.5</servlet.versoin> |
| 25 | <!-- DB 相关 --> | 25 | <!-- DB 相关 --> |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/servlet/ServletUtils.java
| @@ -88,6 +88,8 @@ public class ServletUtils { | @@ -88,6 +88,8 @@ public class ServletUtils { | ||
| 88 | return ServletUtil.getClientIP(request); | 88 | return ServletUtil.getClientIP(request); |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | + // TODO @疯狂:terminal 还是从 ServletUtils 里拿,更容易全局治理; | ||
| 92 | + | ||
| 91 | public static boolean isJsonRequest(ServletRequest request) { | 93 | public static boolean isJsonRequest(ServletRequest request) { |
| 92 | return StrUtil.startWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE); | 94 | return StrUtil.startWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE); |
| 93 | } | 95 | } |
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/ErrorCodeConstants.java
| @@ -50,6 +50,10 @@ public interface ErrorCodeConstants { | @@ -50,6 +50,10 @@ public interface ErrorCodeConstants { | ||
| 50 | ErrorCode TASK_RETURN_FAIL_SOURCE_TARGET_ERROR = new ErrorCode(1_009_005_006, "回退任务失败,目标节点是在并行网关上或非同一路线上,不可跳转"); | 50 | ErrorCode TASK_RETURN_FAIL_SOURCE_TARGET_ERROR = new ErrorCode(1_009_005_006, "回退任务失败,目标节点是在并行网关上或非同一路线上,不可跳转"); |
| 51 | ErrorCode TASK_DELEGATE_FAIL_USER_REPEAT = new ErrorCode(1_009_005_007, "任务委派失败,委派人和当前审批人为同一人"); | 51 | ErrorCode TASK_DELEGATE_FAIL_USER_REPEAT = new ErrorCode(1_009_005_007, "任务委派失败,委派人和当前审批人为同一人"); |
| 52 | ErrorCode TASK_DELEGATE_FAIL_USER_NOT_EXISTS = new ErrorCode(1_009_005_008, "任务委派失败,被委派人不存在"); | 52 | ErrorCode TASK_DELEGATE_FAIL_USER_NOT_EXISTS = new ErrorCode(1_009_005_008, "任务委派失败,被委派人不存在"); |
| 53 | + ErrorCode TASK_ADD_SIGN_USER_NOT_EXIST = new ErrorCode(1_009_005_009, "任务加签:选择的用户不存在"); | ||
| 54 | + ErrorCode TASK_ADD_SIGN_TYPE_ERROR = new ErrorCode(1_009_005_010, "任务加签:当前任务已经{},不能{}"); | ||
| 55 | + ErrorCode TASK_ADD_SIGN_USER_REPEAT = new ErrorCode(1_009_005_011, "任务加签失败,加签人与现有审批人[{}]重复"); | ||
| 56 | + ErrorCode TASK_SUB_SIGN_NO_PARENT = new ErrorCode(1_009_005_011, "任务减签失败,被减签的任务必须是通过加签生成的任务"); | ||
| 53 | 57 | ||
| 54 | // ========== 流程任务分配规则 1-009-006-000 ========== | 58 | // ========== 流程任务分配规则 1-009-006-000 ========== |
| 55 | ErrorCode TASK_ASSIGN_RULE_EXISTS = new ErrorCode(1_009_006_000, "流程({}) 的任务({}) 已经存在分配规则"); | 59 | ErrorCode TASK_ASSIGN_RULE_EXISTS = new ErrorCode(1_009_006_000, "流程({}) 的任务({}) 已经存在分配规则"); |
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmCommentTypeEnum.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.enums.task; | ||
| 2 | + | ||
| 3 | +import lombok.AllArgsConstructor; | ||
| 4 | +import lombok.Getter; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 流程任务 -- comment类型枚举 | ||
| 8 | + */ | ||
| 9 | +@Getter | ||
| 10 | +@AllArgsConstructor | ||
| 11 | +public enum BpmCommentTypeEnum { | ||
| 12 | + | ||
| 13 | + APPROVE(1, "通过", ""), | ||
| 14 | + REJECT(2, "不通过", ""), | ||
| 15 | + CANCEL(3, "已取消", ""), | ||
| 16 | + BACK(4, "退回", ""), | ||
| 17 | + DELEGATE(5, "委派", ""), | ||
| 18 | + ADD_SIGN(6, "加签", "[{}]{}给了[{}],理由为:{}"), | ||
| 19 | + SUB_SIGN(7, "减签", "[{}]操作了【减签】,审批人[{}]的任务被取消"), | ||
| 20 | + ; | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 结果 | ||
| 24 | + */ | ||
| 25 | + private final Integer type; | ||
| 26 | + /** | ||
| 27 | + * 描述 | ||
| 28 | + */ | ||
| 29 | + private final String desc; | ||
| 30 | + /** | ||
| 31 | + * 模板信息 | ||
| 32 | + */ | ||
| 33 | + private final String templateComment; | ||
| 34 | + | ||
| 35 | +} |
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmProcessInstanceResultEnum.java
| @@ -4,6 +4,9 @@ import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | @@ -4,6 +4,9 @@ import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | ||
| 4 | import lombok.AllArgsConstructor; | 4 | import lombok.AllArgsConstructor; |
| 5 | import lombok.Getter; | 5 | import lombok.Getter; |
| 6 | 6 | ||
| 7 | +import java.util.Arrays; | ||
| 8 | +import java.util.List; | ||
| 9 | + | ||
| 7 | /** | 10 | /** |
| 8 | * 流程实例的结果 | 11 | * 流程实例的结果 |
| 9 | * | 12 | * |
| @@ -21,11 +24,34 @@ public enum BpmProcessInstanceResultEnum { | @@ -21,11 +24,34 @@ public enum BpmProcessInstanceResultEnum { | ||
| 21 | // ========== 流程任务独有的状态 ========== | 24 | // ========== 流程任务独有的状态 ========== |
| 22 | 25 | ||
| 23 | BACK(5, "驳回"), // 退回 | 26 | BACK(5, "驳回"), // 退回 |
| 24 | - DELEGATE(6, "委派"); | 27 | + DELEGATE(6, "委派"), |
| 28 | + /** | ||
| 29 | + * 【加签】源任务已经审批完成,但是它使用了后加签,后加签的任务未完成,源任务就会是这个状态 | ||
| 30 | + * 相当于是 通过 APPROVE 的特殊状态 | ||
| 31 | + * 例如:A审批, A 后加签了 B,并且审批通过了任务,但是 B 还未审批,则当前任务状态为“待后加签任务完成” | ||
| 32 | + */ | ||
| 33 | + ADD_SIGN_AFTER(7, "待后加签任务完成"), | ||
| 34 | + /** | ||
| 35 | + * 【加签】源任务未审批,但是向前加签了,所以源任务状态变为“待前加签任务完成” | ||
| 36 | + * 相当于是 处理中 PROCESS 的特殊状态 | ||
| 37 | + * 例如:A 审批, A 前加签了 B,B 还未审核 | ||
| 38 | + */ | ||
| 39 | + ADD_SIGN_BEFORE(8, "待前加签任务完成"), | ||
| 40 | + /** | ||
| 41 | + * 【加签】后加签任务被创建时的初始状态 | ||
| 42 | + * 相当于是 处理中 PROCESS 的特殊状态 | ||
| 43 | + * 因为需要源任务先完成,才能到后加签的人来审批,所以加了一个状态区分 | ||
| 44 | + */ | ||
| 45 | + WAIT_BEFORE_TASK(9, "待前置任务完成"); | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 能被减签的状态 | ||
| 49 | + */ | ||
| 50 | + public static final List<Integer> CAN_SUB_SIGN_STATUS_LIST = Arrays.asList(PROCESS.result, WAIT_BEFORE_TASK.result); | ||
| 25 | 51 | ||
| 26 | /** | 52 | /** |
| 27 | * 结果 | 53 | * 结果 |
| 28 | - * | 54 | + * <p> |
| 29 | * 如果新增时,注意 {@link #isEndResult(Integer)} 是否需要变更 | 55 | * 如果新增时,注意 {@link #isEndResult(Integer)} 是否需要变更 |
| 30 | */ | 56 | */ |
| 31 | private final Integer result; | 57 | private final Integer result; |
| @@ -36,14 +62,16 @@ public enum BpmProcessInstanceResultEnum { | @@ -36,14 +62,16 @@ public enum BpmProcessInstanceResultEnum { | ||
| 36 | 62 | ||
| 37 | /** | 63 | /** |
| 38 | * 判断该结果是否已经处于 End 最终结果 | 64 | * 判断该结果是否已经处于 End 最终结果 |
| 39 | - * | 65 | + * <p> |
| 40 | * 主要用于一些结果更新的逻辑,如果已经是最终结果,就不再进行更新 | 66 | * 主要用于一些结果更新的逻辑,如果已经是最终结果,就不再进行更新 |
| 41 | * | 67 | * |
| 42 | * @param result 结果 | 68 | * @param result 结果 |
| 43 | * @return 是否 | 69 | * @return 是否 |
| 44 | */ | 70 | */ |
| 45 | public static boolean isEndResult(Integer result) { | 71 | public static boolean isEndResult(Integer result) { |
| 46 | - return ObjectUtils.equalsAny(result, APPROVE.getResult(), REJECT.getResult(), CANCEL.getResult(), BACK.getResult()); | 72 | + return ObjectUtils.equalsAny(result, APPROVE.getResult(), REJECT.getResult(), |
| 73 | + CANCEL.getResult(), BACK.getResult(), | ||
| 74 | + ADD_SIGN_AFTER.getResult()); | ||
| 47 | } | 75 | } |
| 48 | 76 | ||
| 49 | } | 77 | } |
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmTaskAddSignTypeEnum.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.enums.task; | ||
| 2 | + | ||
| 3 | +import lombok.AllArgsConstructor; | ||
| 4 | +import lombok.Getter; | ||
| 5 | + | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * 流程任务 -- 加签类型枚举类型 | ||
| 9 | + */ | ||
| 10 | +@Getter | ||
| 11 | +@AllArgsConstructor | ||
| 12 | +public enum BpmTaskAddSignTypeEnum { | ||
| 13 | + | ||
| 14 | + /** | ||
| 15 | + * 向前加签,需要前置任务审批完成,才回到原审批人 | ||
| 16 | + */ | ||
| 17 | + BEFORE("before", "向前加签"), | ||
| 18 | + /** | ||
| 19 | + * 向后加签,需要后置任务全部审批完,才会通过原审批人节点 | ||
| 20 | + */ | ||
| 21 | + AFTER("after", "向后加签"), | ||
| 22 | + /** | ||
| 23 | + * 创建后置加签时的过度状态,用于控制向后加签生成的任务状态 | ||
| 24 | + */ | ||
| 25 | + AFTER_CHILDREN_TASK("afterChildrenTask", "向后加签生成的子任务"); | ||
| 26 | + | ||
| 27 | + private final String type; | ||
| 28 | + | ||
| 29 | + private final String desc; | ||
| 30 | + | ||
| 31 | + public static String formatDesc(String type) { | ||
| 32 | + for (BpmTaskAddSignTypeEnum value : values()) { | ||
| 33 | + if (value.type.equals(type)) { | ||
| 34 | + return value.desc; | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | + return null; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | +} | ||
| 41 | + | ||
| 0 | \ No newline at end of file | 42 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmTaskController.java
| @@ -4,16 +4,15 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; | @@ -4,16 +4,15 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.*; | 5 | import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.*; |
| 6 | import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService; | 6 | import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService; |
| 7 | -import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 8 | -import io.swagger.v3.oas.annotations.Parameter; | ||
| 9 | import io.swagger.v3.oas.annotations.Operation; | 7 | import io.swagger.v3.oas.annotations.Operation; |
| 8 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 9 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 10 | import org.springframework.security.access.prepost.PreAuthorize; | 10 | import org.springframework.security.access.prepost.PreAuthorize; |
| 11 | import org.springframework.validation.annotation.Validated; | 11 | import org.springframework.validation.annotation.Validated; |
| 12 | import org.springframework.web.bind.annotation.*; | 12 | import org.springframework.web.bind.annotation.*; |
| 13 | 13 | ||
| 14 | import javax.annotation.Resource; | 14 | import javax.annotation.Resource; |
| 15 | import javax.validation.Valid; | 15 | import javax.validation.Valid; |
| 16 | - | ||
| 17 | import java.util.List; | 16 | import java.util.List; |
| 18 | 17 | ||
| 19 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 18 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| @@ -95,9 +94,31 @@ public class BpmTaskController { | @@ -95,9 +94,31 @@ public class BpmTaskController { | ||
| 95 | @Operation(summary = "委派任务", description = "用于【流程详情】的【委派】按钮。和向前【加签】有点像,唯一区别是【委托】没有单独创立任务") | 94 | @Operation(summary = "委派任务", description = "用于【流程详情】的【委派】按钮。和向前【加签】有点像,唯一区别是【委托】没有单独创立任务") |
| 96 | @PreAuthorize("@ss.hasPermission('bpm:task:update')") | 95 | @PreAuthorize("@ss.hasPermission('bpm:task:update')") |
| 97 | public CommonResult<Boolean> delegateTask(@Valid @RequestBody BpmTaskDelegateReqVO reqVO) { | 96 | public CommonResult<Boolean> delegateTask(@Valid @RequestBody BpmTaskDelegateReqVO reqVO) { |
| 98 | - // TODO @海:, 后面要有空格 | ||
| 99 | - taskService.delegateTask(reqVO,getLoginUserId()); | 97 | + taskService.delegateTask(getLoginUserId(), reqVO); |
| 98 | + return success(true); | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + @PutMapping("/add-sign") | ||
| 102 | + @Operation(summary = "加签", description = "before 前加签,after 后加签") | ||
| 103 | + @PreAuthorize("@ss.hasPermission('bpm:task:update')") | ||
| 104 | + public CommonResult<Boolean> addSignTask(@Valid @RequestBody BpmTaskAddSignReqVO reqVO) { | ||
| 105 | + taskService.addSignTask(getLoginUserId(), reqVO); | ||
| 106 | + return success(true); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + @PutMapping("/sub-sign") | ||
| 110 | + @Operation(summary = "减签") | ||
| 111 | + @PreAuthorize("@ss.hasPermission('bpm:task:update')") | ||
| 112 | + public CommonResult<Boolean> subSignTask(@Valid @RequestBody BpmTaskSubSignReqVO reqVO) { | ||
| 113 | + taskService.subSignTask(getLoginUserId(), reqVO); | ||
| 100 | return success(true); | 114 | return success(true); |
| 101 | } | 115 | } |
| 102 | 116 | ||
| 117 | + @GetMapping("/get-children-task-list") | ||
| 118 | + @Operation(summary = "获取能被减签的任务") | ||
| 119 | + @PreAuthorize("@ss.hasPermission('bpm:task:update')") | ||
| 120 | + public CommonResult<List<BpmTaskSubSignRespVO>> getChildrenTaskList(@RequestParam("taskId") String taskId) { | ||
| 121 | + return success(taskService.getChildrenTaskList(taskId)); | ||
| 122 | + } | ||
| 123 | + | ||
| 103 | } | 124 | } |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskAddSignReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import javax.validation.constraints.NotEmpty; | ||
| 7 | +import java.util.Set; | ||
| 8 | + | ||
| 9 | +@Schema(description = "管理后台 - 加签流程任务的 Request VO") | ||
| 10 | +@Data | ||
| 11 | +public class BpmTaskAddSignReqVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "需要加签的任务 ID") | ||
| 14 | + @NotEmpty(message = "任务编号不能为空") | ||
| 15 | + private String id; | ||
| 16 | + | ||
| 17 | + @Schema(description = "加签的用户 ID") | ||
| 18 | + @NotEmpty(message = "加签用户 ID 不能为空") | ||
| 19 | + private Set<Long> userIdList; | ||
| 20 | + | ||
| 21 | + @Schema(description = "加签类型,before 向前加签,after 向后加签") | ||
| 22 | + @NotEmpty(message = "加签类型不能为空") | ||
| 23 | + private String type; | ||
| 24 | + | ||
| 25 | + @Schema(description = "加签原因") | ||
| 26 | + @NotEmpty(message = "加签原因不能为空") | ||
| 27 | + private String reason; | ||
| 28 | + | ||
| 29 | +} | ||
| 0 | \ No newline at end of file | 30 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskRespVO.java
| @@ -5,6 +5,8 @@ import lombok.Data; | @@ -5,6 +5,8 @@ import lombok.Data; | ||
| 5 | import lombok.EqualsAndHashCode; | 5 | import lombok.EqualsAndHashCode; |
| 6 | import lombok.ToString; | 6 | import lombok.ToString; |
| 7 | 7 | ||
| 8 | +import java.util.List; | ||
| 9 | + | ||
| 8 | @Schema(description = "管理后台 - 流程任务的 Response VO") | 10 | @Schema(description = "管理后台 - 流程任务的 Response VO") |
| 9 | @Data | 11 | @Data |
| 10 | @EqualsAndHashCode(callSuper = true) | 12 | @EqualsAndHashCode(callSuper = true) |
| @@ -19,6 +21,14 @@ public class BpmTaskRespVO extends BpmTaskDonePageItemRespVO { | @@ -19,6 +21,14 @@ public class BpmTaskRespVO extends BpmTaskDonePageItemRespVO { | ||
| 19 | */ | 21 | */ |
| 20 | private User assigneeUser; | 22 | private User assigneeUser; |
| 21 | 23 | ||
| 24 | + /** | ||
| 25 | + * 父任务ID | ||
| 26 | + */ | ||
| 27 | + private String parentTaskId; | ||
| 28 | + | ||
| 29 | + @Schema(description = "子任务(由加签生成)", requiredMode = Schema.RequiredMode.REQUIRED, example = "childrenTask") | ||
| 30 | + private List<BpmTaskRespVO> children; | ||
| 31 | + | ||
| 22 | @Schema(description = "用户信息") | 32 | @Schema(description = "用户信息") |
| 23 | @Data | 33 | @Data |
| 24 | public static class User { | 34 | public static class User { |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskSubSignReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import javax.validation.constraints.NotEmpty; | ||
| 7 | + | ||
| 8 | +@Schema(description = "管理后台 - 减签流程任务的 Request VO") | ||
| 9 | +@Data | ||
| 10 | +public class BpmTaskSubSignReqVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "被减签的任务 ID") | ||
| 13 | + @NotEmpty(message = "任务编号不能为空") | ||
| 14 | + private String id; | ||
| 15 | + | ||
| 16 | + @Schema(description = "加签原因") | ||
| 17 | + @NotEmpty(message = "加签原因不能为空") | ||
| 18 | + private String reason; | ||
| 19 | +} |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskSubSignRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +@Schema(description = "管理后台 - 减签流程任务的 Response VO") | ||
| 7 | +@Data | ||
| 8 | +public class BpmTaskSubSignRespVO { | ||
| 9 | + @Schema(description = "审核的用户信息", requiredMode = Schema.RequiredMode.REQUIRED, example = "小李") | ||
| 10 | + private BpmTaskRespVO.User assigneeUser; | ||
| 11 | + @Schema(description = "任务 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "12312") | ||
| 12 | + private String id; | ||
| 13 | + @Schema(description = "任务名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "经理审批") | ||
| 14 | + private String name; | ||
| 15 | +} |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java
| 1 | package cn.iocoder.yudao.module.bpm.convert.task; | 1 | package cn.iocoder.yudao.module.bpm.convert.task; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 3 | import cn.hutool.core.date.LocalDateTimeUtil; | 4 | import cn.hutool.core.date.LocalDateTimeUtil; |
| 5 | +import cn.hutool.core.util.StrUtil; | ||
| 4 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | 6 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 5 | import cn.iocoder.yudao.framework.common.util.date.DateUtils; | 7 | import cn.iocoder.yudao.framework.common.util.date.DateUtils; |
| 6 | import cn.iocoder.yudao.framework.common.util.number.NumberUtils; | 8 | import cn.iocoder.yudao.framework.common.util.number.NumberUtils; |
| 7 | -import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskDonePageItemRespVO; | ||
| 8 | -import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO; | ||
| 9 | -import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskSimpleRespVO; | ||
| 10 | -import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskTodoPageItemRespVO; | 9 | +import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.*; |
| 11 | import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmTaskExtDO; | 10 | import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmTaskExtDO; |
| 12 | import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenTaskCreatedReqDTO; | 11 | import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenTaskCreatedReqDTO; |
| 13 | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; | 12 | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; |
| @@ -18,9 +17,11 @@ import org.flowable.engine.history.HistoricProcessInstance; | @@ -18,9 +17,11 @@ import org.flowable.engine.history.HistoricProcessInstance; | ||
| 18 | import org.flowable.engine.runtime.ProcessInstance; | 17 | import org.flowable.engine.runtime.ProcessInstance; |
| 19 | import org.flowable.task.api.Task; | 18 | import org.flowable.task.api.Task; |
| 20 | import org.flowable.task.api.history.HistoricTaskInstance; | 19 | import org.flowable.task.api.history.HistoricTaskInstance; |
| 20 | +import org.flowable.task.service.impl.persistence.entity.TaskEntityImpl; | ||
| 21 | import org.mapstruct.*; | 21 | import org.mapstruct.*; |
| 22 | import org.mapstruct.factory.Mappers; | 22 | import org.mapstruct.factory.Mappers; |
| 23 | 23 | ||
| 24 | +import java.util.Date; | ||
| 24 | import java.util.List; | 25 | import java.util.List; |
| 25 | import java.util.Map; | 26 | import java.util.Map; |
| 26 | 27 | ||
| @@ -145,4 +146,53 @@ public interface BpmTaskConvert { | @@ -145,4 +146,53 @@ public interface BpmTaskConvert { | ||
| 145 | .setName(element.getName()) | 146 | .setName(element.getName()) |
| 146 | .setDefinitionKey(element.getId())); | 147 | .setDefinitionKey(element.getId())); |
| 147 | } | 148 | } |
| 149 | + | ||
| 150 | + //此处不用 mapstruct 映射,因为 TaskEntityImpl 还有很多其他属性,这里我们只设置我们需要的 | ||
| 151 | + //使用 mapstruct 会将里面嵌套的各个属性值都设置进去,会出现意想不到的问题 | ||
| 152 | + default TaskEntityImpl convert(TaskEntityImpl task,TaskEntityImpl parentTask){ | ||
| 153 | + task.setCategory(parentTask.getCategory()); | ||
| 154 | + task.setDescription(parentTask.getDescription()); | ||
| 155 | + task.setTenantId(parentTask.getTenantId()); | ||
| 156 | + task.setName(parentTask.getName()); | ||
| 157 | + task.setParentTaskId(parentTask.getId()); | ||
| 158 | + task.setProcessDefinitionId(parentTask.getProcessDefinitionId()); | ||
| 159 | + task.setProcessInstanceId(parentTask.getProcessInstanceId()); | ||
| 160 | + task.setTaskDefinitionKey(parentTask.getTaskDefinitionKey()); | ||
| 161 | + task.setTaskDefinitionId(parentTask.getTaskDefinitionId()); | ||
| 162 | + task.setPriority(parentTask.getPriority()); | ||
| 163 | + task.setCreateTime(new Date()); | ||
| 164 | + return task; | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + default List<BpmTaskSubSignRespVO> convertList(List<BpmTaskExtDO> bpmTaskExtDOList, | ||
| 168 | + Map<Long, AdminUserRespDTO> userMap, | ||
| 169 | + Map<String, Task> idTaskMap){ | ||
| 170 | + return CollectionUtils.convertList(bpmTaskExtDOList, task->{ | ||
| 171 | + BpmTaskSubSignRespVO bpmTaskSubSignRespVO = new BpmTaskSubSignRespVO(); | ||
| 172 | + bpmTaskSubSignRespVO.setName(task.getName()); | ||
| 173 | + bpmTaskSubSignRespVO.setId(task.getTaskId()); | ||
| 174 | + Task sourceTask = idTaskMap.get(task.getTaskId()); | ||
| 175 | + // 后加签任务不会直接设置 assignee ,所以不存在 assignee 的情况,则去取 owner | ||
| 176 | + String assignee = StrUtil.isNotEmpty(sourceTask.getAssignee()) ? sourceTask.getAssignee() : sourceTask.getOwner(); | ||
| 177 | + AdminUserRespDTO assignUser = userMap.get(NumberUtils.parseLong(assignee)); | ||
| 178 | + if (assignUser != null) { | ||
| 179 | + bpmTaskSubSignRespVO.setAssigneeUser(convert3(assignUser)); | ||
| 180 | + } | ||
| 181 | + return bpmTaskSubSignRespVO; | ||
| 182 | + }); | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + /** | ||
| 186 | + * 转换任务为父子级 | ||
| 187 | + * @param sourceList 原始数据 | ||
| 188 | + * @return 转换后的父子级数组 | ||
| 189 | + */ | ||
| 190 | + default List<BpmTaskRespVO> convertChildrenList(List<BpmTaskRespVO> sourceList){ | ||
| 191 | + List<BpmTaskRespVO> childrenTaskList = CollectionUtils.filterList(sourceList, r -> StrUtil.isNotEmpty(r.getParentTaskId())); | ||
| 192 | + Map<String, List<BpmTaskRespVO>> parentChildrenTaskListMap = CollectionUtils.convertMultiMap(childrenTaskList, BpmTaskRespVO::getParentTaskId); | ||
| 193 | + for (BpmTaskRespVO bpmTaskRespVO : sourceList) { | ||
| 194 | + bpmTaskRespVO.setChildren(parentChildrenTaskListMap.get(bpmTaskRespVO.getId())); | ||
| 195 | + } | ||
| 196 | + return CollectionUtils.filterList(sourceList, r -> StrUtil.isEmpty(r.getParentTaskId())); | ||
| 197 | + } | ||
| 148 | } | 198 | } |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/mysql/task/BpmTaskExtMapper.java
| 1 | package cn.iocoder.yudao.module.bpm.dal.mysql.task; | 1 | package cn.iocoder.yudao.module.bpm.dal.mysql.task; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 3 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 4 | import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmTaskExtDO; | 5 | import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmTaskExtDO; |
| 6 | +import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum; | ||
| 5 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 7 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 6 | import org.apache.ibatis.annotations.Mapper; | 8 | import org.apache.ibatis.annotations.Mapper; |
| 7 | 9 | ||
| @@ -19,8 +21,19 @@ public interface BpmTaskExtMapper extends BaseMapperX<BpmTaskExtDO> { | @@ -19,8 +21,19 @@ public interface BpmTaskExtMapper extends BaseMapperX<BpmTaskExtDO> { | ||
| 19 | return selectList(BpmTaskExtDO::getTaskId, taskIds); | 21 | return selectList(BpmTaskExtDO::getTaskId, taskIds); |
| 20 | } | 22 | } |
| 21 | 23 | ||
| 24 | + default List<BpmTaskExtDO> selectProcessListByTaskIds(Collection<String> taskIds) { | ||
| 25 | + return selectList(new LambdaQueryWrapperX<BpmTaskExtDO>() | ||
| 26 | + .in(BpmTaskExtDO::getTaskId, taskIds) | ||
| 27 | + .in(BpmTaskExtDO::getResult, BpmProcessInstanceResultEnum.CAN_SUB_SIGN_STATUS_LIST)); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + | ||
| 22 | default BpmTaskExtDO selectByTaskId(String taskId) { | 31 | default BpmTaskExtDO selectByTaskId(String taskId) { |
| 23 | return selectOne(BpmTaskExtDO::getTaskId, taskId); | 32 | return selectOne(BpmTaskExtDO::getTaskId, taskId); |
| 24 | } | 33 | } |
| 25 | 34 | ||
| 35 | + default void updateBatchByTaskIdList(List<String> taskIdList, BpmTaskExtDO updateObj) { | ||
| 36 | + update(updateObj, new LambdaQueryWrapper<BpmTaskExtDO>().in(BpmTaskExtDO::getTaskId, taskIdList)); | ||
| 37 | + } | ||
| 38 | + | ||
| 26 | } | 39 | } |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskService.java
| @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.bpm.service.task; | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.bpm.service.task; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | 4 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 5 | import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.*; | 5 | import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.*; |
| 6 | +import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmTaskExtDO; | ||
| 6 | import org.flowable.task.api.Task; | 7 | import org.flowable.task.api.Task; |
| 7 | 8 | ||
| 8 | import javax.validation.Valid; | 9 | import javax.validation.Valid; |
| @@ -62,6 +63,15 @@ public interface BpmTaskService { | @@ -62,6 +63,15 @@ public interface BpmTaskService { | ||
| 62 | */ | 63 | */ |
| 63 | List<BpmTaskRespVO> getTaskListByProcessInstanceId(String processInstanceId); | 64 | List<BpmTaskRespVO> getTaskListByProcessInstanceId(String processInstanceId); |
| 64 | 65 | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * 通过任务 ID 集合,获取任务扩展表信息集合 | ||
| 69 | + * | ||
| 70 | + * @param taskIdList 任务 ID 集合 | ||
| 71 | + * @return 任务列表 | ||
| 72 | + */ | ||
| 73 | + List<BpmTaskExtDO> getTaskListByTaskIdList(List<String> taskIdList); | ||
| 74 | + | ||
| 65 | /** | 75 | /** |
| 66 | * 通过任务 | 76 | * 通过任务 |
| 67 | * | 77 | * |
| @@ -134,17 +144,41 @@ public interface BpmTaskService { | @@ -134,17 +144,41 @@ public interface BpmTaskService { | ||
| 134 | * 将任务回退到指定的 targetDefinitionKey 位置 | 144 | * 将任务回退到指定的 targetDefinitionKey 位置 |
| 135 | * | 145 | * |
| 136 | * @param userId 用户编号 | 146 | * @param userId 用户编号 |
| 137 | - * @param reqVO 回退的任务key和当前所在的任务ID | 147 | + * @param reqVO 回退的任务key和当前所在的任务ID |
| 138 | */ | 148 | */ |
| 139 | void returnTask(Long userId, BpmTaskReturnReqVO reqVO); | 149 | void returnTask(Long userId, BpmTaskReturnReqVO reqVO); |
| 140 | 150 | ||
| 141 | - // TODO @海:userId 放前面 | 151 | + |
| 142 | /** | 152 | /** |
| 143 | * 将指定任务委派给其他人处理,等接收人处理后再回到原审批人手中审批 | 153 | * 将指定任务委派给其他人处理,等接收人处理后再回到原审批人手中审批 |
| 144 | * | 154 | * |
| 145 | - * @param reqVO 被委派人和被委派的任务编号理由参数 | ||
| 146 | * @param userId 用户编号 | 155 | * @param userId 用户编号 |
| 156 | + * @param reqVO 被委派人和被委派的任务编号理由参数 | ||
| 157 | + */ | ||
| 158 | + void delegateTask(Long userId, BpmTaskDelegateReqVO reqVO); | ||
| 159 | + | ||
| 160 | + /** | ||
| 161 | + * 任务加签 | ||
| 162 | + * | ||
| 163 | + * @param userId 被加签的用户和任务 ID,加签类型 | ||
| 164 | + * @param reqVO 当前用户 ID | ||
| 165 | + */ | ||
| 166 | + void addSignTask(Long userId, BpmTaskAddSignReqVO reqVO); | ||
| 167 | + | ||
| 168 | + /** | ||
| 169 | + * 任务减签名 | ||
| 170 | + * | ||
| 171 | + * @param userId 当前用户ID | ||
| 172 | + * @param reqVO 被减签的任务 ID,理由 | ||
| 173 | + */ | ||
| 174 | + void subSignTask(Long userId, BpmTaskSubSignReqVO reqVO); | ||
| 175 | + | ||
| 176 | + /** | ||
| 177 | + * 获取指定任务的子任务和审批人信息 | ||
| 178 | + * | ||
| 179 | + * @param taskId 指定任务ID | ||
| 180 | + * @return 子任务列表 | ||
| 147 | */ | 181 | */ |
| 148 | - void delegateTask(BpmTaskDelegateReqVO reqVO, Long userId); | 182 | + List<BpmTaskSubSignRespVO> getChildrenTaskList(String taskId); |
| 149 | 183 | ||
| 150 | } | 184 | } |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java
| @@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.bpm.service.task; | @@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.bpm.service.task; | ||
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | import cn.hutool.core.util.ArrayUtil; | 4 | import cn.hutool.core.util.ArrayUtil; |
| 5 | +import cn.hutool.core.util.IdUtil; | ||
| 6 | +import cn.hutool.core.util.ObjectUtil; | ||
| 5 | import cn.hutool.core.util.StrUtil; | 7 | import cn.hutool.core.util.StrUtil; |
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 8 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | import cn.iocoder.yudao.framework.common.util.date.DateUtils; | 9 | import cn.iocoder.yudao.framework.common.util.date.DateUtils; |
| @@ -13,8 +15,10 @@ import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.*; | @@ -13,8 +15,10 @@ import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.*; | ||
| 13 | import cn.iocoder.yudao.module.bpm.convert.task.BpmTaskConvert; | 15 | import cn.iocoder.yudao.module.bpm.convert.task.BpmTaskConvert; |
| 14 | import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmTaskExtDO; | 16 | import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmTaskExtDO; |
| 15 | import cn.iocoder.yudao.module.bpm.dal.mysql.task.BpmTaskExtMapper; | 17 | import cn.iocoder.yudao.module.bpm.dal.mysql.task.BpmTaskExtMapper; |
| 18 | +import cn.iocoder.yudao.module.bpm.enums.task.BpmCommentTypeEnum; | ||
| 16 | import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceDeleteReasonEnum; | 19 | import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceDeleteReasonEnum; |
| 17 | import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum; | 20 | import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum; |
| 21 | +import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskAddSignTypeEnum; | ||
| 18 | import cn.iocoder.yudao.module.bpm.service.definition.BpmModelService; | 22 | import cn.iocoder.yudao.module.bpm.service.definition.BpmModelService; |
| 19 | import cn.iocoder.yudao.module.bpm.service.message.BpmMessageService; | 23 | import cn.iocoder.yudao.module.bpm.service.message.BpmMessageService; |
| 20 | import cn.iocoder.yudao.module.system.api.dept.DeptApi; | 24 | import cn.iocoder.yudao.module.system.api.dept.DeptApi; |
| @@ -26,15 +30,19 @@ import org.flowable.bpmn.model.BpmnModel; | @@ -26,15 +30,19 @@ import org.flowable.bpmn.model.BpmnModel; | ||
| 26 | import org.flowable.bpmn.model.FlowElement; | 30 | import org.flowable.bpmn.model.FlowElement; |
| 27 | import org.flowable.bpmn.model.UserTask; | 31 | import org.flowable.bpmn.model.UserTask; |
| 28 | import org.flowable.engine.HistoryService; | 32 | import org.flowable.engine.HistoryService; |
| 33 | +import org.flowable.engine.ManagementService; | ||
| 29 | import org.flowable.engine.RuntimeService; | 34 | import org.flowable.engine.RuntimeService; |
| 30 | import org.flowable.engine.TaskService; | 35 | import org.flowable.engine.TaskService; |
| 31 | import org.flowable.engine.history.HistoricProcessInstance; | 36 | import org.flowable.engine.history.HistoricProcessInstance; |
| 32 | import org.flowable.engine.runtime.ProcessInstance; | 37 | import org.flowable.engine.runtime.ProcessInstance; |
| 33 | import org.flowable.task.api.DelegationState; | 38 | import org.flowable.task.api.DelegationState; |
| 34 | import org.flowable.task.api.Task; | 39 | import org.flowable.task.api.Task; |
| 40 | +import org.flowable.task.api.TaskInfo; | ||
| 35 | import org.flowable.task.api.TaskQuery; | 41 | import org.flowable.task.api.TaskQuery; |
| 36 | import org.flowable.task.api.history.HistoricTaskInstance; | 42 | import org.flowable.task.api.history.HistoricTaskInstance; |
| 37 | import org.flowable.task.api.history.HistoricTaskInstanceQuery; | 43 | import org.flowable.task.api.history.HistoricTaskInstanceQuery; |
| 44 | +import org.flowable.task.service.impl.persistence.entity.TaskEntity; | ||
| 45 | +import org.flowable.task.service.impl.persistence.entity.TaskEntityImpl; | ||
| 38 | import org.springframework.stereotype.Service; | 46 | import org.springframework.stereotype.Service; |
| 39 | import org.springframework.transaction.annotation.Transactional; | 47 | import org.springframework.transaction.annotation.Transactional; |
| 40 | import org.springframework.transaction.support.TransactionSynchronization; | 48 | import org.springframework.transaction.support.TransactionSynchronization; |
| @@ -45,6 +53,8 @@ import javax.annotation.Resource; | @@ -45,6 +53,8 @@ import javax.annotation.Resource; | ||
| 45 | import javax.validation.Valid; | 53 | import javax.validation.Valid; |
| 46 | import java.time.LocalDateTime; | 54 | import java.time.LocalDateTime; |
| 47 | import java.util.*; | 55 | import java.util.*; |
| 56 | +import java.util.stream.Collectors; | ||
| 57 | +import java.util.stream.Stream; | ||
| 48 | 58 | ||
| 49 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 59 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 50 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; | 60 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; |
| @@ -82,6 +92,9 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -82,6 +92,9 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 82 | @Resource | 92 | @Resource |
| 83 | private BpmTaskExtMapper taskExtMapper; | 93 | private BpmTaskExtMapper taskExtMapper; |
| 84 | 94 | ||
| 95 | + @Resource | ||
| 96 | + private ManagementService managementService; | ||
| 97 | + | ||
| 85 | @Override | 98 | @Override |
| 86 | public PageResult<BpmTaskTodoPageItemRespVO> getTodoTaskPage(Long userId, BpmTaskTodoPageReqVO pageVO) { | 99 | public PageResult<BpmTaskTodoPageItemRespVO> getTodoTaskPage(Long userId, BpmTaskTodoPageReqVO pageVO) { |
| 87 | // 查询待办任务 | 100 | // 查询待办任务 |
| @@ -183,7 +196,13 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -183,7 +196,13 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 183 | Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId)); | 196 | Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId)); |
| 184 | 197 | ||
| 185 | // 拼接数据 | 198 | // 拼接数据 |
| 186 | - return BpmTaskConvert.INSTANCE.convertList3(tasks, bpmTaskExtDOMap, processInstance, userMap, deptMap); | 199 | + List<BpmTaskRespVO> result = BpmTaskConvert.INSTANCE.convertList3(tasks, bpmTaskExtDOMap, processInstance, userMap, deptMap); |
| 200 | + return BpmTaskConvert.INSTANCE.convertChildrenList(result); | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + @Override | ||
| 204 | + public List<BpmTaskExtDO> getTaskListByTaskIdList(List<String> taskIdList) { | ||
| 205 | + return taskExtMapper.selectListByTaskIds(taskIdList); | ||
| 187 | } | 206 | } |
| 188 | 207 | ||
| 189 | @Override | 208 | @Override |
| @@ -203,13 +222,182 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -203,13 +222,182 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 203 | return; | 222 | return; |
| 204 | } | 223 | } |
| 205 | 224 | ||
| 206 | - // 情况二:自己审批的任务,调用 complete 去完成任务 | 225 | + // 情况二:后加签的任务 |
| 226 | + if (BpmTaskAddSignTypeEnum.AFTER.getType().equals(task.getScopeType())) { | ||
| 227 | + // 后加签处理 | ||
| 228 | + approveAfterSignTask(task, reqVO); | ||
| 229 | + return; | ||
| 230 | + } | ||
| 231 | + | ||
| 232 | + // 情况三:自己审批的任务,调用 complete 去完成任务 | ||
| 207 | // 完成任务,审批通过 | 233 | // 完成任务,审批通过 |
| 208 | taskService.complete(task.getId(), instance.getProcessVariables()); | 234 | taskService.complete(task.getId(), instance.getProcessVariables()); |
| 209 | // 更新任务拓展表为通过 | 235 | // 更新任务拓展表为通过 |
| 210 | taskExtMapper.updateByTaskId( | 236 | taskExtMapper.updateByTaskId( |
| 211 | new BpmTaskExtDO().setTaskId(task.getId()).setResult(BpmProcessInstanceResultEnum.APPROVE.getResult()) | 237 | new BpmTaskExtDO().setTaskId(task.getId()).setResult(BpmProcessInstanceResultEnum.APPROVE.getResult()) |
| 212 | .setReason(reqVO.getReason())); | 238 | .setReason(reqVO.getReason())); |
| 239 | + // 处理加签任务 | ||
| 240 | + handleParentTask(task); | ||
| 241 | + } | ||
| 242 | + | ||
| 243 | + /** | ||
| 244 | + * 审批通过存在“后加签”的任务。 | ||
| 245 | + * <p> | ||
| 246 | + * 注意:该任务不能马上完成,需要一个中间状态(ADD_SIGN_AFTER),并激活剩余所有子任务(PROCESS)为可审批处理 | ||
| 247 | + * | ||
| 248 | + * @param task 当前任务 | ||
| 249 | + * @param reqVO 前端请求参数 | ||
| 250 | + */ | ||
| 251 | + private void approveAfterSignTask(Task task, BpmTaskApproveReqVO reqVO) { | ||
| 252 | + // 1. 有向后加签,则该任务状态临时设置为 ADD_SIGN_AFTER 状态 | ||
| 253 | + taskExtMapper.updateByTaskId( | ||
| 254 | + new BpmTaskExtDO().setTaskId(task.getId()).setResult(BpmProcessInstanceResultEnum.ADD_SIGN_AFTER.getResult()) | ||
| 255 | + .setReason(reqVO.getReason()).setEndTime(LocalDateTime.now())); | ||
| 256 | + | ||
| 257 | + // 2. 激活子任务 | ||
| 258 | + List<String> childrenTaskIdList = getChildrenTaskIdList(task.getId()); | ||
| 259 | + for (String childrenTaskId : childrenTaskIdList) { | ||
| 260 | + taskService.resolveTask(childrenTaskId); | ||
| 261 | + } | ||
| 262 | + // 2.1 更新任务扩展表中子任务为进行中 | ||
| 263 | + taskExtMapper.updateBatchByTaskIdList(childrenTaskIdList, | ||
| 264 | + new BpmTaskExtDO().setResult(BpmProcessInstanceResultEnum.PROCESS.getResult())); | ||
| 265 | + } | ||
| 266 | + | ||
| 267 | + /** | ||
| 268 | + * 处理当前任务的父任务 | ||
| 269 | + * | ||
| 270 | + * @param task 当前任务 | ||
| 271 | + */ | ||
| 272 | + private void handleParentTask(Task task) { | ||
| 273 | + String parentTaskId = task.getParentTaskId(); | ||
| 274 | + if (StrUtil.isBlank(parentTaskId)) { | ||
| 275 | + return; | ||
| 276 | + } | ||
| 277 | + if (StrUtil.isNotBlank(parentTaskId)) { | ||
| 278 | + // 1. 判断当前任务的父任务是否还有子任务 | ||
| 279 | + Long childrenTaskCount = getChildrenTaskCount(parentTaskId); | ||
| 280 | + if (childrenTaskCount > 0) { | ||
| 281 | + return; | ||
| 282 | + } | ||
| 283 | + // 2. 获取父任务 | ||
| 284 | + Task parentTask = validateTaskExist(parentTaskId); | ||
| 285 | + | ||
| 286 | + // 3. 情况一:处理向前加签 | ||
| 287 | + String scopeType = parentTask.getScopeType(); | ||
| 288 | + if (BpmTaskAddSignTypeEnum.BEFORE.getType().equals(scopeType)) { | ||
| 289 | + // 3.1 如果是向前加签的任务,则调用 resolveTask 指派父任务,将 owner 重新赋值给父任务的 assignee | ||
| 290 | + taskService.resolveTask(parentTaskId); | ||
| 291 | + // 3.2 更新任务拓展表为处理中 | ||
| 292 | + taskExtMapper.updateByTaskId( | ||
| 293 | + new BpmTaskExtDO().setTaskId(parentTask.getId()).setResult(BpmProcessInstanceResultEnum.PROCESS.getResult())); | ||
| 294 | + } else if (BpmTaskAddSignTypeEnum.AFTER.getType().equals(scopeType)) { | ||
| 295 | + // 3. 情况二:处理向后加签 | ||
| 296 | + handleAfterSign(parentTask); | ||
| 297 | + } | ||
| 298 | + | ||
| 299 | + // 4. 子任务已处理完成,清空 scopeType 字段,修改 parentTask 信息,方便后续可以继续向前后向后加签 | ||
| 300 | + // 再查询一次的原因是避免报错:Task was updated by another transaction concurrently | ||
| 301 | + // 因为前面处理后可能会导致 parentTask rev 字段被修改,需要重新获取最新的 | ||
| 302 | + parentTask = getTask(parentTaskId); | ||
| 303 | + if (parentTask == null) { | ||
| 304 | + // 为空的情况是:已经通过 handleAfterSign 方法将任务完成了,所以 ru_task 表会查不到数据 | ||
| 305 | + return; | ||
| 306 | + } | ||
| 307 | + clearTaskScopeTypeAndSave(parentTask); | ||
| 308 | + } | ||
| 309 | + } | ||
| 310 | + | ||
| 311 | + /** | ||
| 312 | + * 处理后加签任务 | ||
| 313 | + * | ||
| 314 | + * @param parentTask 当前审批任务的父任务 | ||
| 315 | + */ | ||
| 316 | + private void handleAfterSign(Task parentTask) { | ||
| 317 | + String parentTaskId = parentTask.getId(); | ||
| 318 | + //1. 更新 parentTask 的任务拓展表为通过,并调用 complete 完成自己 | ||
| 319 | + BpmTaskExtDO currentTaskExt = taskExtMapper.selectByTaskId(parentTask.getId()); | ||
| 320 | + BpmTaskExtDO currentTaskUpdateEntity = new BpmTaskExtDO().setTaskId(parentTask.getId()) | ||
| 321 | + .setResult(BpmProcessInstanceResultEnum.APPROVE.getResult()); | ||
| 322 | + if (currentTaskExt.getEndTime() == null) { | ||
| 323 | + // 1.1 有这个判断是因为,以前没设置过结束时间,才去设置 | ||
| 324 | + currentTaskUpdateEntity.setEndTime(LocalDateTime.now()); | ||
| 325 | + } | ||
| 326 | + // 1.2 完成自己 | ||
| 327 | + taskExtMapper.updateByTaskId(currentTaskUpdateEntity); | ||
| 328 | + taskService.complete(parentTaskId); | ||
| 329 | + | ||
| 330 | + // 2. 如果有父级,递归查询上级任务是否都已经完成 | ||
| 331 | + if (StrUtil.isEmpty(parentTask.getParentTaskId())) { | ||
| 332 | + return; | ||
| 333 | + } | ||
| 334 | + // TODO @海:这块待讨论,脑子略乱;感觉 handleAfterSign 的后半段,和 handleParentTask 有点重叠??? | ||
| 335 | + // 2.1 判断整条链路的任务是否完成 | ||
| 336 | + // 例如从 A 任务加签了一个 B 任务,B 任务又加签了一个 C 任务,C 任务加签了 D 任务 | ||
| 337 | + // 此时,D 任务完成,要一直往上找到祖先任务 A调用 complete 方法完成 A 任务 | ||
| 338 | + boolean allChildrenTaskFinish = true; | ||
| 339 | + while (StrUtil.isNotBlank(parentTask.getParentTaskId())) { | ||
| 340 | + parentTask = validateTaskExist(parentTask.getParentTaskId()); | ||
| 341 | + BpmTaskExtDO bpmTaskExtDO = taskExtMapper.selectByTaskId(parentTask.getId()); | ||
| 342 | + if (bpmTaskExtDO == null) { | ||
| 343 | + break; | ||
| 344 | + } | ||
| 345 | + boolean currentTaskFinish = BpmProcessInstanceResultEnum.isEndResult(bpmTaskExtDO.getResult()); | ||
| 346 | + // 2.2 如果 allChildrenTaskFinish 已经被赋值为 false ,则不会再赋值为 true,因为整个链路没有完成 | ||
| 347 | + if (allChildrenTaskFinish) { | ||
| 348 | + allChildrenTaskFinish = currentTaskFinish; | ||
| 349 | + } | ||
| 350 | + // 2.3 任务已完成则不处理 | ||
| 351 | + if (currentTaskFinish) { | ||
| 352 | + continue; | ||
| 353 | + } | ||
| 354 | + | ||
| 355 | + // 3 处理非完成状态的任务 | ||
| 356 | + // 3.1 判断当前任务的父任务是否还有子任务 | ||
| 357 | + Long childrenTaskCount = getChildrenTaskCount(bpmTaskExtDO.getTaskId()); | ||
| 358 | + if (childrenTaskCount > 0) { | ||
| 359 | + continue; | ||
| 360 | + } | ||
| 361 | + // 3.2 没有子任务,判断当前任务状态是否为 ADD_SIGN_BEFORE 待前加签任务完成 | ||
| 362 | + if (BpmProcessInstanceResultEnum.ADD_SIGN_BEFORE.getResult().equals(bpmTaskExtDO.getResult())) { | ||
| 363 | + // 3.3 需要修改该任务状态为处理中 | ||
| 364 | + taskService.resolveTask(bpmTaskExtDO.getTaskId()); | ||
| 365 | + bpmTaskExtDO.setResult(BpmProcessInstanceResultEnum.PROCESS.getResult()); | ||
| 366 | + taskExtMapper.updateByTaskId(bpmTaskExtDO); | ||
| 367 | + } | ||
| 368 | + // 3.4 清空 scopeType 字段,用于任务没有子任务时使用该方法,方便任务可以再次被不同的方式加签 | ||
| 369 | + parentTask = validateTaskExist(bpmTaskExtDO.getTaskId()); | ||
| 370 | + clearTaskScopeTypeAndSave(parentTask); | ||
| 371 | + } | ||
| 372 | + | ||
| 373 | + // 4. 完成最后的顶级祖先任务 | ||
| 374 | + if (allChildrenTaskFinish) { | ||
| 375 | + taskService.complete(parentTask.getId()); | ||
| 376 | + } | ||
| 377 | + } | ||
| 378 | + | ||
| 379 | + /** | ||
| 380 | + * 清空 scopeType 字段,用于任务没有子任务时使用该方法,方便任务可以再次被不同的方式加签 | ||
| 381 | + * | ||
| 382 | + * @param task 需要被清空的任务 | ||
| 383 | + */ | ||
| 384 | + private void clearTaskScopeTypeAndSave(Task task) { | ||
| 385 | + TaskEntityImpl taskImpl = (TaskEntityImpl) task; | ||
| 386 | + taskImpl.setScopeType(null); | ||
| 387 | + taskService.saveTask(task); | ||
| 388 | + } | ||
| 389 | + | ||
| 390 | + | ||
| 391 | + /** | ||
| 392 | + * 获取子任务个数 | ||
| 393 | + * | ||
| 394 | + * @param parentTaskId 父任务 ID | ||
| 395 | + * @return 剩余子任务个数 | ||
| 396 | + */ | ||
| 397 | + private Long getChildrenTaskCount(String parentTaskId) { | ||
| 398 | + String tableName = managementService.getTableName(TaskEntity.class); | ||
| 399 | + String sql = "SELECT COUNT(1) from " + tableName + " WHERE PARENT_TASK_ID_=#{parentTaskId}"; | ||
| 400 | + return taskService.createNativeTaskQuery().sql(sql).parameter("parentTaskId", parentTaskId).count(); | ||
| 213 | } | 401 | } |
| 214 | 402 | ||
| 215 | /** | 403 | /** |
| @@ -226,7 +414,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -226,7 +414,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 226 | String comment = StrUtil.format("[{}]完成委派任务,任务重新回到[{}]手中,审批意见为:{}", currentUser.getNickname(), | 414 | String comment = StrUtil.format("[{}]完成委派任务,任务重新回到[{}]手中,审批意见为:{}", currentUser.getNickname(), |
| 227 | sourceApproveUser.getNickname(), reqVO.getReason()); | 415 | sourceApproveUser.getNickname(), reqVO.getReason()); |
| 228 | taskService.addComment(reqVO.getId(), task.getProcessInstanceId(), | 416 | taskService.addComment(reqVO.getId(), task.getProcessInstanceId(), |
| 229 | - BpmProcessInstanceResultEnum.DELEGATE.getResult().toString(), comment); | 417 | + BpmCommentTypeEnum.DELEGATE.getType().toString(), comment); |
| 230 | 418 | ||
| 231 | // 2.1 调用 resolveTask 完成任务。 | 419 | // 2.1 调用 resolveTask 完成任务。 |
| 232 | // 底层调用 TaskHelper.changeTaskAssignee(task, task.getOwner()):将 owner 设置为 assignee | 420 | // 底层调用 TaskHelper.changeTaskAssignee(task, task.getOwner()):将 owner 设置为 assignee |
| @@ -276,10 +464,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -276,10 +464,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 276 | * @param taskId task id | 464 | * @param taskId task id |
| 277 | */ | 465 | */ |
| 278 | private Task validateTask(Long userId, String taskId) { | 466 | private Task validateTask(Long userId, String taskId) { |
| 279 | - Task task = getTask(taskId); | ||
| 280 | - if (task == null) { | ||
| 281 | - throw exception(TASK_NOT_EXISTS); | ||
| 282 | - } | 467 | + Task task = validateTaskExist(taskId); |
| 283 | if (!Objects.equals(userId, NumberUtils.parseLong(task.getAssignee()))) { | 468 | if (!Objects.equals(userId, NumberUtils.parseLong(task.getAssignee()))) { |
| 284 | throw exception(TASK_OPERATE_FAIL_ASSIGN_NOT_SELF); | 469 | throw exception(TASK_OPERATE_FAIL_ASSIGN_NOT_SELF); |
| 285 | } | 470 | } |
| @@ -288,8 +473,12 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -288,8 +473,12 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 288 | 473 | ||
| 289 | @Override | 474 | @Override |
| 290 | public void createTaskExt(Task task) { | 475 | public void createTaskExt(Task task) { |
| 291 | - BpmTaskExtDO taskExtDO = | ||
| 292 | - BpmTaskConvert.INSTANCE.convert2TaskExt(task).setResult(BpmProcessInstanceResultEnum.PROCESS.getResult()); | 476 | + BpmTaskExtDO taskExtDO = BpmTaskConvert.INSTANCE.convert2TaskExt(task) |
| 477 | + .setResult(BpmProcessInstanceResultEnum.PROCESS.getResult()); | ||
| 478 | + // 向后加签生成的任务,状态不能为进行中,需要等前面父任务完成 | ||
| 479 | + if (BpmTaskAddSignTypeEnum.AFTER_CHILDREN_TASK.getType().equals(task.getScopeType())) { | ||
| 480 | + taskExtDO.setResult(BpmProcessInstanceResultEnum.WAIT_BEFORE_TASK.getResult()); | ||
| 481 | + } | ||
| 293 | taskExtMapper.insert(taskExtDO); | 482 | taskExtMapper.insert(taskExtDO); |
| 294 | } | 483 | } |
| 295 | 484 | ||
| @@ -343,23 +532,29 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -343,23 +532,29 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 343 | TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() { | 532 | TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() { |
| 344 | @Override | 533 | @Override |
| 345 | public void afterCommit() { | 534 | public void afterCommit() { |
| 346 | - ProcessInstance processInstance = | ||
| 347 | - processInstanceService.getProcessInstance(task.getProcessInstanceId()); | ||
| 348 | - AdminUserRespDTO startUser = adminUserApi.getUser(Long.valueOf(processInstance.getStartUserId())); | ||
| 349 | - messageService.sendMessageWhenTaskAssigned( | ||
| 350 | - BpmTaskConvert.INSTANCE.convert(processInstance, startUser, task)); | 535 | + if (StrUtil.isNotEmpty(task.getAssignee())) { |
| 536 | + ProcessInstance processInstance = | ||
| 537 | + processInstanceService.getProcessInstance(task.getProcessInstanceId()); | ||
| 538 | + AdminUserRespDTO startUser = adminUserApi.getUser(Long.valueOf(processInstance.getStartUserId())); | ||
| 539 | + messageService.sendMessageWhenTaskAssigned( | ||
| 540 | + BpmTaskConvert.INSTANCE.convert(processInstance, startUser, task)); | ||
| 541 | + } | ||
| 351 | } | 542 | } |
| 352 | }); | 543 | }); |
| 353 | } | 544 | } |
| 354 | 545 | ||
| 355 | - private Task getTask(String id) { | ||
| 356 | - Task task = taskService.createTaskQuery().taskId(id).singleResult(); | ||
| 357 | - if (null == task) { | 546 | + private Task validateTaskExist(String id) { |
| 547 | + Task task = getTask(id); | ||
| 548 | + if (task == null) { | ||
| 358 | throw exception(TASK_NOT_EXISTS); | 549 | throw exception(TASK_NOT_EXISTS); |
| 359 | } | 550 | } |
| 360 | return task; | 551 | return task; |
| 361 | } | 552 | } |
| 362 | 553 | ||
| 554 | + private Task getTask(String id) { | ||
| 555 | + return taskService.createTaskQuery().taskId(id).singleResult(); | ||
| 556 | + } | ||
| 557 | + | ||
| 363 | private HistoricTaskInstance getHistoricTask(String id) { | 558 | private HistoricTaskInstance getHistoricTask(String id) { |
| 364 | return historyService.createHistoricTaskInstanceQuery().taskId(id).singleResult(); | 559 | return historyService.createHistoricTaskInstanceQuery().taskId(id).singleResult(); |
| 365 | } | 560 | } |
| @@ -367,10 +562,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -367,10 +562,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 367 | @Override | 562 | @Override |
| 368 | public List<BpmTaskSimpleRespVO> getReturnTaskList(String taskId) { | 563 | public List<BpmTaskSimpleRespVO> getReturnTaskList(String taskId) { |
| 369 | // 1. 校验当前任务 task 存在 | 564 | // 1. 校验当前任务 task 存在 |
| 370 | - Task task = getTask(taskId); | ||
| 371 | - if (task == null) { | ||
| 372 | - throw exception(TASK_NOT_EXISTS); | ||
| 373 | - } | 565 | + Task task = validateTaskExist(taskId); |
| 374 | // 根据流程定义获取流程模型信息 | 566 | // 根据流程定义获取流程模型信息 |
| 375 | BpmnModel bpmnModel = bpmModelService.getBpmnModelByDefinitionId(task.getProcessDefinitionId()); | 567 | BpmnModel bpmnModel = bpmModelService.getBpmnModelByDefinitionId(task.getProcessDefinitionId()); |
| 376 | FlowElement source = BpmnModelUtils.getFlowElementById(bpmnModel, task.getTaskDefinitionKey()); | 568 | FlowElement source = BpmnModelUtils.getFlowElementById(bpmnModel, task.getTaskDefinitionKey()); |
| @@ -437,7 +629,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -437,7 +629,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 437 | /** | 629 | /** |
| 438 | * 执行回退逻辑 | 630 | * 执行回退逻辑 |
| 439 | * | 631 | * |
| 440 | - * @param currentTask 当前回退的任务 | 632 | + * @param currentTask 当前回退的任务 |
| 441 | * @param targetElement 需要回退到的目标任务 | 633 | * @param targetElement 需要回退到的目标任务 |
| 442 | * @param reqVO 前端参数封装 | 634 | * @param reqVO 前端参数封装 |
| 443 | */ | 635 | */ |
| @@ -458,7 +650,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -458,7 +650,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 458 | return; | 650 | return; |
| 459 | } | 651 | } |
| 460 | taskService.addComment(task.getId(), currentTask.getProcessInstanceId(), | 652 | taskService.addComment(task.getId(), currentTask.getProcessInstanceId(), |
| 461 | - BpmProcessInstanceResultEnum.BACK.getResult().toString(), reqVO.getReason()); | 653 | + BpmCommentTypeEnum.BACK.getType().toString(), reqVO.getReason()); |
| 462 | }); | 654 | }); |
| 463 | 655 | ||
| 464 | // 3. 执行驳回 | 656 | // 3. 执行驳回 |
| @@ -471,7 +663,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -471,7 +663,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 471 | 663 | ||
| 472 | @Override | 664 | @Override |
| 473 | @Transactional(rollbackFor = Exception.class) | 665 | @Transactional(rollbackFor = Exception.class) |
| 474 | - public void delegateTask(BpmTaskDelegateReqVO reqVO, Long userId) { | 666 | + public void delegateTask(Long userId, BpmTaskDelegateReqVO reqVO) { |
| 475 | // 1.1 校验任务 | 667 | // 1.1 校验任务 |
| 476 | Task task = validateTaskCanDelegate(userId, reqVO); | 668 | Task task = validateTaskCanDelegate(userId, reqVO); |
| 477 | // 1.2 校验目标用户存在 | 669 | // 1.2 校验目标用户存在 |
| @@ -485,9 +677,8 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -485,9 +677,8 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 485 | String comment = StrUtil.format("[{}]将任务委派给[{}],委派理由为:{}", currentUser.getNickname(), | 677 | String comment = StrUtil.format("[{}]将任务委派给[{}],委派理由为:{}", currentUser.getNickname(), |
| 486 | delegateUser.getNickname(), reqVO.getReason()); | 678 | delegateUser.getNickname(), reqVO.getReason()); |
| 487 | String taskId = reqVO.getId(); | 679 | String taskId = reqVO.getId(); |
| 488 | - // TODO 海:后面改;感觉 comment 应该 type 做个枚举;不和 result 耦合在一起; | ||
| 489 | taskService.addComment(taskId, task.getProcessInstanceId(), | 680 | taskService.addComment(taskId, task.getProcessInstanceId(), |
| 490 | - BpmProcessInstanceResultEnum.DELEGATE.getResult().toString(), comment); | 681 | + BpmCommentTypeEnum.DELEGATE.getType().toString(), comment); |
| 491 | 682 | ||
| 492 | // 3.1 设置任务所有人 (owner) 为原任务的处理人 (assignee) | 683 | // 3.1 设置任务所有人 (owner) 为原任务的处理人 (assignee) |
| 493 | taskService.setOwner(taskId, task.getAssignee()); | 684 | taskService.setOwner(taskId, task.getAssignee()); |
| @@ -503,7 +694,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -503,7 +694,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 503 | * 校验任务委派参数 | 694 | * 校验任务委派参数 |
| 504 | * | 695 | * |
| 505 | * @param userId 用户编号 | 696 | * @param userId 用户编号 |
| 506 | - * @param reqVO 任务编号,接收人ID | 697 | + * @param reqVO 任务编号,接收人ID |
| 507 | * @return 当前任务信息 | 698 | * @return 当前任务信息 |
| 508 | */ | 699 | */ |
| 509 | private Task validateTaskCanDelegate(Long userId, BpmTaskDelegateReqVO reqVO) { | 700 | private Task validateTaskCanDelegate(Long userId, BpmTaskDelegateReqVO reqVO) { |
| @@ -516,4 +707,228 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -516,4 +707,228 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 516 | return task; | 707 | return task; |
| 517 | } | 708 | } |
| 518 | 709 | ||
| 710 | + @Override | ||
| 711 | + @Transactional(rollbackFor = Exception.class) | ||
| 712 | + public void addSignTask(Long userId, BpmTaskAddSignReqVO reqVO) { | ||
| 713 | + // 1. 获取和校验任务 | ||
| 714 | + TaskEntityImpl taskEntity = validateAddSign(userId, reqVO); | ||
| 715 | + List<AdminUserRespDTO> userList = adminUserApi.getUserList(reqVO.getUserIdList()); | ||
| 716 | + if (CollUtil.isEmpty(userList)) { | ||
| 717 | + throw exception(TASK_ADD_SIGN_USER_NOT_EXIST); | ||
| 718 | + } | ||
| 719 | + | ||
| 720 | + // 2. 处理当前任务 | ||
| 721 | + // 2.1 开启计数功能,主要用于为了让表 ACT_RU_TASK 中的 SUB_TASK_COUNT_ 字段记录下总共有多少子任务,后续可能有用 | ||
| 722 | + taskEntity.setCountEnabled(true); | ||
| 723 | + if (reqVO.getType().equals(BpmTaskAddSignTypeEnum.BEFORE.getType())) { | ||
| 724 | + // 2.2 向前加签,设置 owner,置空 assign。等子任务都完成后,再调用 resolveTask 重新将 owner 设置为 assign | ||
| 725 | + // 原因是:不能和向前加签的子任务一起审批,需要等前面的子任务都完成才能审批 | ||
| 726 | + taskEntity.setOwner(taskEntity.getAssignee()); | ||
| 727 | + taskEntity.setAssignee(null); | ||
| 728 | + // 2.3 更新扩展表状态 | ||
| 729 | + taskExtMapper.updateByTaskId( | ||
| 730 | + new BpmTaskExtDO().setTaskId(taskEntity.getId()) | ||
| 731 | + .setResult(BpmProcessInstanceResultEnum.ADD_SIGN_BEFORE.getResult()) | ||
| 732 | + .setReason(reqVO.getReason())); | ||
| 733 | + } | ||
| 734 | + // 2.4 记录加签方式,完成任务时需要用到判断 | ||
| 735 | + taskEntity.setScopeType(reqVO.getType()); | ||
| 736 | + // 2.5 保存当前任务修改后的值 | ||
| 737 | + taskService.saveTask(taskEntity); | ||
| 738 | + | ||
| 739 | + // 3. 创建加签任务 | ||
| 740 | + createAddSignChildrenTasks(convertList(reqVO.getUserIdList(), String::valueOf), taskEntity); | ||
| 741 | + | ||
| 742 | + // 4. 记录加签 comment,拼接结果为: [当前用户]向前加签/向后加签给了[多个用户],理由为:reason | ||
| 743 | + AdminUserRespDTO currentUser = adminUserApi.getUser(userId); | ||
| 744 | + String comment = StrUtil.format(BpmCommentTypeEnum.ADD_SIGN.getTemplateComment(), currentUser.getNickname(), BpmTaskAddSignTypeEnum.formatDesc(reqVO.getType()), | ||
| 745 | + String.join(",", convertList(userList, AdminUserRespDTO::getNickname)), reqVO.getReason()); | ||
| 746 | + taskService.addComment(reqVO.getId(), taskEntity.getProcessInstanceId(), | ||
| 747 | + BpmCommentTypeEnum.ADD_SIGN.getType().toString(), comment); | ||
| 748 | + } | ||
| 749 | + | ||
| 750 | + | ||
| 751 | + /** | ||
| 752 | + * 校验任务的加签是否一致 | ||
| 753 | + * <p> | ||
| 754 | + * 1. 如果存在“向前加签”的任务,则不能“向后加签” | ||
| 755 | + * 2. 如果存在“向后加签”的任务,则不能“向前加签” | ||
| 756 | + * | ||
| 757 | + * @param userId 当前用户 ID | ||
| 758 | + * @param reqVO 请求参数,包含任务 ID 和加签类型 | ||
| 759 | + * @return 当前任务 | ||
| 760 | + */ | ||
| 761 | + private TaskEntityImpl validateAddSign(Long userId, BpmTaskAddSignReqVO reqVO) { | ||
| 762 | + TaskEntityImpl taskEntity = (TaskEntityImpl) validateTask(userId, reqVO.getId()); | ||
| 763 | + // 向前加签和向后加签不能同时存在 | ||
| 764 | + if (StrUtil.isNotBlank(taskEntity.getScopeType()) | ||
| 765 | + && ObjectUtil.notEqual(BpmTaskAddSignTypeEnum.AFTER_CHILDREN_TASK.getType(), taskEntity.getScopeType()) | ||
| 766 | + && ObjectUtil.notEqual(taskEntity.getScopeType(), reqVO.getType())) { | ||
| 767 | + throw exception(TASK_ADD_SIGN_TYPE_ERROR, | ||
| 768 | + BpmTaskAddSignTypeEnum.formatDesc(taskEntity.getScopeType()), BpmTaskAddSignTypeEnum.formatDesc(reqVO.getType())); | ||
| 769 | + } | ||
| 770 | + // 同一个 key 的任务,审批人不重复 | ||
| 771 | + List<Task> taskList = taskService.createTaskQuery().processInstanceId(taskEntity.getProcessInstanceId()) | ||
| 772 | + .taskDefinitionKey(taskEntity.getTaskDefinitionKey()).list(); | ||
| 773 | + List<Long> currentAssigneeList = convertList(taskList, task -> NumberUtils.parseLong(task.getAssignee())); | ||
| 774 | + // 保留交集在 currentAssigneeList 中 | ||
| 775 | + currentAssigneeList.retainAll(reqVO.getUserIdList()); | ||
| 776 | + if (CollUtil.isNotEmpty(currentAssigneeList)) { | ||
| 777 | + List<AdminUserRespDTO> userList = adminUserApi.getUserList(currentAssigneeList); | ||
| 778 | + throw exception(TASK_ADD_SIGN_USER_REPEAT, String.join(",", convertList(userList, AdminUserRespDTO::getNickname))); | ||
| 779 | + } | ||
| 780 | + return taskEntity; | ||
| 781 | + } | ||
| 782 | + | ||
| 783 | + /** | ||
| 784 | + * 创建加签子任务 | ||
| 785 | + * | ||
| 786 | + * @param addSingUserIdList 被加签的用户 ID | ||
| 787 | + * @param taskEntity 被加签的任务 | ||
| 788 | + */ | ||
| 789 | + private void createAddSignChildrenTasks(List<String> addSingUserIdList, TaskEntityImpl taskEntity) { | ||
| 790 | + if (CollUtil.isEmpty(addSingUserIdList)) { | ||
| 791 | + return; | ||
| 792 | + } | ||
| 793 | + // 创建加签人的新任务,全部基于 taskEntity 为父任务来创建 | ||
| 794 | + for (String addSignId : addSingUserIdList) { | ||
| 795 | + if (StrUtil.isBlank(addSignId)) { | ||
| 796 | + continue; | ||
| 797 | + } | ||
| 798 | + createChildrenTask(taskEntity, addSignId); | ||
| 799 | + } | ||
| 800 | + } | ||
| 801 | + | ||
| 802 | + /** | ||
| 803 | + * 创建子任务 | ||
| 804 | + * | ||
| 805 | + * @param parentTask 父任务 | ||
| 806 | + * @param assignee 子任务的执行人 | ||
| 807 | + * @return | ||
| 808 | + */ | ||
| 809 | + private void createChildrenTask(TaskEntityImpl parentTask, String assignee) { | ||
| 810 | + // 1. 生成子任务 | ||
| 811 | + TaskEntityImpl task = (TaskEntityImpl) taskService.newTask(IdUtil.fastSimpleUUID()); | ||
| 812 | + task = BpmTaskConvert.INSTANCE.convert(task, parentTask); | ||
| 813 | + if (BpmTaskAddSignTypeEnum.BEFORE.getType().equals(parentTask.getScopeType())) { | ||
| 814 | + // 2.1 前加签,才设置审批人,否则设置 owner | ||
| 815 | + task.setAssignee(assignee); | ||
| 816 | + } else { | ||
| 817 | + // 2.2.1 设置 owner 不设置 assignee 是因为不能同时审批,需要等父任务完成 | ||
| 818 | + task.setOwner(assignee); | ||
| 819 | + // 2.2.2 设置向后加签任务的 scopeType 为 afterChildrenTask,用于设置任务扩展表的状态 | ||
| 820 | + task.setScopeType(BpmTaskAddSignTypeEnum.AFTER_CHILDREN_TASK.getType()); | ||
| 821 | + } | ||
| 822 | + // 2. 保存子任务 | ||
| 823 | + taskService.saveTask(task); | ||
| 824 | + } | ||
| 825 | + | ||
| 826 | + @Override | ||
| 827 | + @Transactional(rollbackFor = Exception.class) | ||
| 828 | + public void subSignTask(Long userId, BpmTaskSubSignReqVO reqVO) { | ||
| 829 | + Task task = validateSubSign(reqVO.getId()); | ||
| 830 | + AdminUserRespDTO user = adminUserApi.getUser(userId); | ||
| 831 | + AdminUserRespDTO cancelUser = null; | ||
| 832 | + if (StrUtil.isNotBlank(task.getAssignee())) { | ||
| 833 | + cancelUser = adminUserApi.getUser(NumberUtils.parseLong(task.getAssignee())); | ||
| 834 | + } | ||
| 835 | + if (cancelUser == null && StrUtil.isNotBlank(task.getOwner())) { | ||
| 836 | + cancelUser = adminUserApi.getUser(NumberUtils.parseLong(task.getOwner())); | ||
| 837 | + } | ||
| 838 | + Assert.notNull(cancelUser, "任务中没有所有者和审批人,数据错误"); | ||
| 839 | + //1. 获取所有需要删除的任务 ID ,包含当前任务和所有子任务 | ||
| 840 | + List<String> allTaskIdList = getAllChildTaskIds(task.getId()); | ||
| 841 | + //2. 删除任务和所有子任务 | ||
| 842 | + taskService.deleteTasks(allTaskIdList); | ||
| 843 | + //3. 修改扩展表状态为取消 | ||
| 844 | + taskExtMapper.updateBatchByTaskIdList(allTaskIdList, new BpmTaskExtDO().setResult(BpmProcessInstanceResultEnum.CANCEL.getResult()) | ||
| 845 | + .setReason(StrUtil.format("由于{}操作[减签],任务被取消", user.getNickname()))); | ||
| 846 | + //4.记录日志到父任务中 先记录日志是因为,通过 handleParentTask 方法之后,任务可能被完成了,并且不存在了,会报异常,所以先记录 | ||
| 847 | + String comment = StrUtil.format(BpmCommentTypeEnum.SUB_SIGN.getTemplateComment(), user.getNickname(), cancelUser.getNickname()); | ||
| 848 | + taskService.addComment(task.getParentTaskId(), task.getProcessInstanceId(), | ||
| 849 | + BpmCommentTypeEnum.SUB_SIGN.getType().toString(), comment); | ||
| 850 | + //5. 处理当前任务的父任务 | ||
| 851 | + this.handleParentTask(task); | ||
| 852 | + | ||
| 853 | + } | ||
| 854 | + | ||
| 855 | + /** | ||
| 856 | + * 校验任务是否能被减签 | ||
| 857 | + * | ||
| 858 | + * @param id 任务ID | ||
| 859 | + * @return 任务信息 | ||
| 860 | + */ | ||
| 861 | + private Task validateSubSign(String id) { | ||
| 862 | + Task task = validateTaskExist(id); | ||
| 863 | + //必须有parentId | ||
| 864 | + if (StrUtil.isEmpty(task.getParentTaskId())) { | ||
| 865 | + throw exception(TASK_SUB_SIGN_NO_PARENT); | ||
| 866 | + } | ||
| 867 | + return task; | ||
| 868 | + } | ||
| 869 | + | ||
| 870 | + /** | ||
| 871 | + * 获取所有要被取消的删除的任务 ID 集合 | ||
| 872 | + * | ||
| 873 | + * @param parentTaskId 父级任务ID | ||
| 874 | + * @return 所有任务ID | ||
| 875 | + */ | ||
| 876 | + public List<String> getAllChildTaskIds(String parentTaskId) { | ||
| 877 | + List<String> allChildTaskIds = new ArrayList<>(); | ||
| 878 | + //1. 先将自己放入 | ||
| 879 | + allChildTaskIds.add(parentTaskId); | ||
| 880 | + //2. 递归获取子级 | ||
| 881 | + recursiveGetChildTaskIds(parentTaskId, allChildTaskIds); | ||
| 882 | + return allChildTaskIds; | ||
| 883 | + } | ||
| 884 | + | ||
| 885 | + /** | ||
| 886 | + * 递归处理子级任务 | ||
| 887 | + * | ||
| 888 | + * @param taskId 当前任务ID | ||
| 889 | + * @param taskIds 结果 | ||
| 890 | + */ | ||
| 891 | + private void recursiveGetChildTaskIds(String taskId, List<String> taskIds) { | ||
| 892 | + List<String> childrenTaskIdList = getChildrenTaskIdList(taskId); | ||
| 893 | + for (String childTaskId : childrenTaskIdList) { | ||
| 894 | + taskIds.add(childTaskId); // 将子任务的ID添加到集合中 | ||
| 895 | + recursiveGetChildTaskIds(childTaskId, taskIds); // 递归获取子任务的子任务 | ||
| 896 | + } | ||
| 897 | + } | ||
| 898 | + | ||
| 899 | + /** | ||
| 900 | + * 获取指定父级任务的所有子任务 ID 集合 | ||
| 901 | + * | ||
| 902 | + * @param parentTaskId 父任务 ID | ||
| 903 | + * @return 所有子任务的 ID 集合 | ||
| 904 | + */ | ||
| 905 | + private List<String> getChildrenTaskIdList(String parentTaskId) { | ||
| 906 | + String tableName = managementService.getTableName(TaskEntity.class); | ||
| 907 | + String sql = "select ID_ from " + tableName + " where PARENT_TASK_ID_=#{parentTaskId}"; | ||
| 908 | + List<Task> childrenTaskList = taskService.createNativeTaskQuery().sql(sql).parameter("parentTaskId", parentTaskId).list(); | ||
| 909 | + return convertList(childrenTaskList, Task::getId); | ||
| 910 | + } | ||
| 911 | + | ||
| 912 | + @Override | ||
| 913 | + public List<BpmTaskSubSignRespVO> getChildrenTaskList(String taskId) { | ||
| 914 | + List<String> childrenTaskIdList = getChildrenTaskIdList(taskId); | ||
| 915 | + if (CollUtil.isEmpty(childrenTaskIdList)) { | ||
| 916 | + return Collections.emptyList(); | ||
| 917 | + } | ||
| 918 | + //1. 只查询进行中的任务 | ||
| 919 | + List<BpmTaskExtDO> bpmTaskExtDOList = taskExtMapper.selectProcessListByTaskIds(childrenTaskIdList); | ||
| 920 | + //2. 后加签的任务,可能不存在 assignee,所以还需要查询 owner | ||
| 921 | + List<Task> taskList = taskService.createTaskQuery().taskIds(childrenTaskIdList).list(); | ||
| 922 | + Map<String, Task> idTaskMap = convertMap(taskList, TaskInfo::getId); | ||
| 923 | + //3. 将 owner 和 assignee 统一到一个集合中 | ||
| 924 | + List<Long> userIds = taskList.stream() | ||
| 925 | + .flatMap(control -> | ||
| 926 | + Stream.of(control.getAssignee(), control.getOwner()) | ||
| 927 | + .filter(Objects::nonNull)) | ||
| 928 | + .distinct() | ||
| 929 | + .map(NumberUtils::parseLong) | ||
| 930 | + .collect(Collectors.toList()); | ||
| 931 | + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIds); | ||
| 932 | + return BpmTaskConvert.INSTANCE.convertList(bpmTaskExtDOList, userMap, idTaskMap); | ||
| 933 | + } | ||
| 519 | } | 934 | } |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/trade/TradeStatisticsController.java
| @@ -108,6 +108,7 @@ public class TradeStatisticsController { | @@ -108,6 +108,7 @@ public class TradeStatisticsController { | ||
| 108 | // 订单统计 | 108 | // 订单统计 |
| 109 | Long undeliveredCount = tradeOrderStatisticsService.getCountByStatusAndDeliveryType( | 109 | Long undeliveredCount = tradeOrderStatisticsService.getCountByStatusAndDeliveryType( |
| 110 | TradeOrderStatusEnum.UNDELIVERED.getStatus(), DeliveryTypeEnum.EXPRESS.getType()); | 110 | TradeOrderStatusEnum.UNDELIVERED.getStatus(), DeliveryTypeEnum.EXPRESS.getType()); |
| 111 | + // TODO @疯狂:订单支付后,如果是门店自提的,需要 update 成 DELIVERED;;目前还没搞~~突然反应过来 | ||
| 111 | Long pickUpCount = tradeOrderStatisticsService.getCountByStatusAndDeliveryType( | 112 | Long pickUpCount = tradeOrderStatisticsService.getCountByStatusAndDeliveryType( |
| 112 | TradeOrderStatusEnum.DELIVERED.getStatus(), DeliveryTypeEnum.PICK_UP.getType()); | 113 | TradeOrderStatusEnum.DELIVERED.getStatus(), DeliveryTypeEnum.PICK_UP.getType()); |
| 113 | // 售后统计 | 114 | // 售后统计 |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/job/trade/TradeStatisticsJob.java
| @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.statistics.job.trade; | @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.statistics.job.trade; | ||
| 2 | 2 | ||
| 3 | import cn.hutool.core.convert.Convert; | 3 | import cn.hutool.core.convert.Convert; |
| 4 | import cn.hutool.core.util.NumberUtil; | 4 | import cn.hutool.core.util.NumberUtil; |
| 5 | +import cn.hutool.core.util.ObjUtil; | ||
| 5 | import cn.hutool.core.util.StrUtil; | 6 | import cn.hutool.core.util.StrUtil; |
| 6 | import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler; | 7 | import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler; |
| 7 | import cn.iocoder.yudao.framework.tenant.core.job.TenantJob; | 8 | import cn.iocoder.yudao.framework.tenant.core.job.TenantJob; |
| @@ -10,6 +11,7 @@ import org.springframework.stereotype.Component; | @@ -10,6 +11,7 @@ import org.springframework.stereotype.Component; | ||
| 10 | 11 | ||
| 11 | import javax.annotation.Resource; | 12 | import javax.annotation.Resource; |
| 12 | 13 | ||
| 14 | +// TODO 芋艿:缺个 Job 的配置;等和 Product 一起配置 | ||
| 13 | /** | 15 | /** |
| 14 | * 交易统计 Job | 16 | * 交易统计 Job |
| 15 | * | 17 | * |
| @@ -30,10 +32,10 @@ public class TradeStatisticsJob implements JobHandler { | @@ -30,10 +32,10 @@ public class TradeStatisticsJob implements JobHandler { | ||
| 30 | @Override | 32 | @Override |
| 31 | @TenantJob | 33 | @TenantJob |
| 32 | public String execute(String param) { | 34 | public String execute(String param) { |
| 33 | - // 默认 昨日 | ||
| 34 | - if (StrUtil.isBlank(param)) { | ||
| 35 | - param = "1"; | ||
| 36 | - } else if (!NumberUtil.isInteger(param)) { | 35 | + // 默认昨日 |
| 36 | + param = ObjUtil.defaultIfBlank(param, "1"); | ||
| 37 | + // 校验参数的合理性 | ||
| 38 | + if (!NumberUtil.isInteger(param)) { | ||
| 37 | throw new RuntimeException("交易统计任务的参数只能为是正整数"); | 39 | throw new RuntimeException("交易统计任务的参数只能为是正整数"); |
| 38 | } | 40 | } |
| 39 | Integer days = Convert.toInt(param, 0); | 41 | Integer days = Convert.toInt(param, 0); |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/trade/TradeStatisticsServiceImpl.java
| @@ -129,7 +129,6 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService { | @@ -129,7 +129,6 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService { | ||
| 129 | entity = TradeStatisticsConvert.INSTANCE.convert(date, orderSummary, afterSaleSummary, brokerageSettlementPrice, | 129 | entity = TradeStatisticsConvert.INSTANCE.convert(date, orderSummary, afterSaleSummary, brokerageSettlementPrice, |
| 130 | walletSummary); | 130 | walletSummary); |
| 131 | tradeStatisticsMapper.insert(entity); | 131 | tradeStatisticsMapper.insert(entity); |
| 132 | - // TODO @疯狂:这里是不是也要把日期带上?类似 108 那边; 110 已经带上了 | ||
| 133 | return stopWatch.prettyPrint(); | 132 | return stopWatch.prettyPrint(); |
| 134 | } | 133 | } |
| 135 | 134 |
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/order/TradeOrderOperateTypeEnum.java
| @@ -21,7 +21,6 @@ public enum TradeOrderOperateTypeEnum { | @@ -21,7 +21,6 @@ public enum TradeOrderOperateTypeEnum { | ||
| 21 | MEMBER_RECEIVE(30, "用户已收货"), | 21 | MEMBER_RECEIVE(30, "用户已收货"), |
| 22 | SYSTEM_RECEIVE(31, "到期未收货,系统自动确认收货"), | 22 | SYSTEM_RECEIVE(31, "到期未收货,系统自动确认收货"), |
| 23 | ADMIN_PICK_UP_RECEIVE(32, "管理员自提收货"), | 23 | ADMIN_PICK_UP_RECEIVE(32, "管理员自提收货"), |
| 24 | - MEMBER_PICK_UP_RECEIVE(32, "用户自提收货"), | ||
| 25 | MEMBER_COMMENT(33, "用户评价"), | 24 | MEMBER_COMMENT(33, "用户评价"), |
| 26 | SYSTEM_COMMENT(34, "到期未评价,系统自动评价"), | 25 | SYSTEM_COMMENT(34, "到期未评价,系统自动评价"), |
| 27 | MEMBER_CANCEL(40, "取消订单"), | 26 | MEMBER_CANCEL(40, "取消订单"), |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/TradeOrderController.java
| @@ -143,7 +143,7 @@ public class TradeOrderController { | @@ -143,7 +143,7 @@ public class TradeOrderController { | ||
| 143 | @Parameter(name = "id", description = "交易订单编号") | 143 | @Parameter(name = "id", description = "交易订单编号") |
| 144 | @PreAuthorize("@ss.hasPermission('trade:order:pick-up')") | 144 | @PreAuthorize("@ss.hasPermission('trade:order:pick-up')") |
| 145 | public CommonResult<Boolean> pickUpOrderById(@RequestParam("id") Long id) { | 145 | public CommonResult<Boolean> pickUpOrderById(@RequestParam("id") Long id) { |
| 146 | - tradeOrderUpdateService.pickUpOrderByMember(id); | 146 | + tradeOrderUpdateService.pickUpOrderByAdmin(id); |
| 147 | return success(true); | 147 | return success(true); |
| 148 | } | 148 | } |
| 149 | 149 |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateService.java
| @@ -122,7 +122,7 @@ public interface TradeOrderUpdateService { | @@ -122,7 +122,7 @@ public interface TradeOrderUpdateService { | ||
| 122 | * | 122 | * |
| 123 | * @param id 订单编号 | 123 | * @param id 订单编号 |
| 124 | */ | 124 | */ |
| 125 | - void pickUpOrderByMember(Long id); | 125 | + void pickUpOrderByAdmin(Long id); |
| 126 | 126 | ||
| 127 | /** | 127 | /** |
| 128 | * 【管理员】核销订单 | 128 | * 【管理员】核销订单 |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java
| @@ -669,8 +669,8 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | @@ -669,8 +669,8 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | ||
| 669 | } | 669 | } |
| 670 | 670 | ||
| 671 | @Override | 671 | @Override |
| 672 | - @TradeOrderLog(operateType = TradeOrderOperateTypeEnum.MEMBER_PICK_UP_RECEIVE) | ||
| 673 | - public void pickUpOrderByMember(Long id) { | 672 | + @TradeOrderLog(operateType = TradeOrderOperateTypeEnum.ADMIN_PICK_UP_RECEIVE) |
| 673 | + public void pickUpOrderByAdmin(Long id) { | ||
| 674 | getSelf().pickUpOrder(tradeOrderMapper.selectById(id)); | 674 | getSelf().pickUpOrder(tradeOrderMapper.selectById(id)); |
| 675 | } | 675 | } |
| 676 | 676 |