Commit 51d054c586a3c9a2c3530095373a4601320ff160

Authored by YunaiV
2 parents cd4813f7 0c9dd349

Merge branch 'master-jdk17' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into feature/ai

Showing 423 changed files with 20609 additions and 2578 deletions

Too many changes.

To preserve performance only 100 of 423 files are displayed.

.gitignore
@@ -51,3 +51,4 @@ rebel.xml @@ -51,3 +51,4 @@ rebel.xml
51 application-my.yaml 51 application-my.yaml
52 52
53 /yudao-ui-app/unpackage/ 53 /yudao-ui-app/unpackage/
  54 +**/.DS_Store
README.md
@@ -149,22 +149,45 @@ @@ -149,22 +149,45 @@
149 149
150 ### 工作流程 150 ### 工作流程
151 151
152 -| | 功能 | 描述 |  
153 -|----|-------|-----------------------------------------|  
154 -| 🚀 | 流程模型 | 配置工作流的流程模型,支持 BPMN 和仿钉钉/飞书设计器 |  
155 -| 🚀 | 流程表单 | 拖动表单元素生成相应的工作流表单,覆盖 Element UI 所有的表单组件 |  
156 -| 🚀 | 用户分组 | 自定义用户分组,可用于工作流的审批分组 |  
157 -| 🚀 | 我的流程 | 查看我发起的工作流程,支持新建、取消流程等操作,高亮流程图、审批时间线 |  
158 -| 🚀 | 待办任务 | 查看自己【未】审批的工作任务,支持通过、不通过、转派、委派、退回、加减签等操作 |  
159 -| 🚀 | 已办任务 | 查看自己【已】审批的工作任务,支持流程预测,展示未来审批人信息 |  
160 -| 🚀 | OA 请假 | 作为业务自定义接入工作流的使用示例,只需创建请求对应的工作流程,即可进行审批 |  
161 -  
162 ![功能图](/.image/common/bpm-feature.png) 152 ![功能图](/.image/common/bpm-feature.png)
163 153
  154 +基于 Flowable 构建,可支持信创(国产)数据库,满足中国特色流程操作:
  155 +
164 | BPMN 设计器 | 钉钉/飞书设计器 | 156 | BPMN 设计器 | 钉钉/飞书设计器 |
165 |------------------------------|--------------------------------| 157 |------------------------------|--------------------------------|
166 | ![](/.image/工作流设计器-bpmn.jpg) | ![](/.image/工作流设计器-simple.jpg) | 158 | ![](/.image/工作流设计器-bpmn.jpg) | ![](/.image/工作流设计器-simple.jpg) |
167 159
  160 +> 历经头部企业生产验证,工作流引擎须标配仿钉钉/飞书 + BPMN 双设计器!!!
  161 +>
  162 +> 前者支持轻量配置简单流程,后者实现复杂场景深度编排
  163 +
  164 +| 功能列表 | 功能描述 | 是否完成 |
  165 +|------------|-------------------------------------------------------------------------------------|------|
  166 +| SIMPLE 设计器 | 仿钉钉/飞书设计器,支持拖拽搭建表单流程,10 分钟快速完成审批流程配置 | ✅ |
  167 +| BPMN 设计器 | 基于 BPMN 标准开发,适配复杂业务场景,满足多层级审批及流程自动化需求 | ✅ |
  168 +| 会签 | 同一个审批节点设置多个人(如 A、B、C 三人,三人会同时收到待办任务),需全部同意之后,审批才可到下一审批节点 | ✅ |
  169 +| 或签 | 同一个审批节点设置多个人,任意一个人处理后,就能进入下一个节点 | ✅ |
  170 +| 依次审批 | (顺序会签)同一个审批节点设置多个人(如 A、B、C 三人),三人按顺序依次收到待办,即 A 先审批,A 提交后 B 才能审批,需全部同意之后,审批才可到下一审批节点 | ✅ |
  171 +| 抄送 | 将审批结果通知给抄送人,同一个审批默认排重,不重复抄送给同一人 | ✅ |
  172 +| 驳回 | (退回)将审批重置发送给某节点,重新审批。可驳回至发起人、上一节点、任意节点 | ✅ |
  173 +| 转办 | A 转给其 B 审批,B 审批后,进入下一节点 | ✅ |
  174 +| 委派 | A 转给其 B 审批,B 审批后,转给 A,A 继续审批后进入下一节点 | ✅ |
  175 +| 加签 | 允许当前审批人根据需要,自行增加当前节点的审批人,支持向前、向后加签 | ✅ |
  176 +| 减签 | (取消加签)在当前审批人操作之前,减少审批人 | ✅ |
  177 +| 撤销 | (取消流程)流程发起人,可以对流程进行撤销处理 | ✅ |
  178 +| 终止 | 系统管理员,在任意节点终止流程实例 | ✅ |
  179 +| 表单权限 | 支持拖拉拽配置表单,每个审批节点可配置只读、编辑、隐藏权限 | ✅ |
  180 +| 超时审批 | 配置超时审批时间,超时后自动触发审批通过、不通过、驳回等操作 | ✅ |
  181 +| 自动提醒 | 配置提醒时间,到达时间后自动触发短信、邮箱、站内信等通知提醒,支持自定义重复提醒频次 | ✅ |
  182 +| 父子流程 | 主流程设置子流程节点,子流程节点会自动触发子流程。子流程结束后,主流程才会执行(继续往下下执行),支持同步子流程、异步子流程 | ✅ |
  183 +| 条件分支 | (排它分支)用于在流程中实现决策,即根据条件选择一个分支执行 | ✅ |
  184 +| 并行分支 | 允许将流程分成多条分支,不进行条件判断,所有分支都会执行 | ✅ |
  185 +| 包容分支 | (条件分支 + 并行分支的结合体)允许基于条件选择多条分支执行,但如果没有任何一个分支满足条件,则可以选择默认分支 | ✅ |
  186 +| 路由分支 | 根据条件选择一个分支执行(重定向到指定配置节点),也可以选择默认分支执行(继续往下执行) | ✅ |
  187 +| 触发节点 | 执行到该节点,触发 HTTP 请求、HTTP 回调、更新数据、删除数据等 | ✅ |
  188 +| 延迟节点 | 执行到该节点,审批等待一段时间再执行,支持固定时长、固定日期等 | ✅ |
  189 +| 拓展设置 | 流程前置/后置通知,节点(任务)前置、后置通知,流程报表,自动审批去重,自定流程编号、标题、摘要,流程报表等 | ✅ |
  190 +
168 ### 支付系统 191 ### 支付系统
169 192
170 | | 功能 | 描述 | 193 | | 功能 | 描述 |
sql/mysql/ruoyi-vue-pro.sql
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 Target Server Version : 80200 (8.2.0) 11 Target Server Version : 80200 (8.2.0)
12 File Encoding : 65001 12 File Encoding : 65001
13 13
14 - Date: 14/03/2025 22:52:31 14 + Date: 17/03/2025 13:14:16
15 */ 15 */
16 16
17 SET NAMES utf8mb4; 17 SET NAMES utf8mb4;
@@ -91,7 +91,7 @@ CREATE TABLE `infra_api_error_log` ( @@ -91,7 +91,7 @@ CREATE TABLE `infra_api_error_log` (
91 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', 91 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
92 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', 92 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
93 PRIMARY KEY (`id`) USING BTREE 93 PRIMARY KEY (`id`) USING BTREE
94 -) ENGINE = InnoDB AUTO_INCREMENT = 21417 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统异常日志'; 94 +) ENGINE = InnoDB AUTO_INCREMENT = 21482 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统异常日志';
95 95
96 -- ---------------------------- 96 -- ----------------------------
97 -- Records of infra_api_error_log 97 -- Records of infra_api_error_log
@@ -250,7 +250,7 @@ CREATE TABLE `infra_file` ( @@ -250,7 +250,7 @@ CREATE TABLE `infra_file` (
250 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', 250 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
251 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', 251 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
252 PRIMARY KEY (`id`) USING BTREE 252 PRIMARY KEY (`id`) USING BTREE
253 -) ENGINE = InnoDB AUTO_INCREMENT = 1655 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '文件表'; 253 +) ENGINE = InnoDB AUTO_INCREMENT = 1657 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '文件表';
254 254
255 -- ---------------------------- 255 -- ----------------------------
256 -- Records of infra_file 256 -- Records of infra_file
@@ -444,7 +444,7 @@ CREATE TABLE `system_dict_data` ( @@ -444,7 +444,7 @@ CREATE TABLE `system_dict_data` (
444 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', 444 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
445 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', 445 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
446 PRIMARY KEY (`id`) USING BTREE 446 PRIMARY KEY (`id`) USING BTREE
447 -) ENGINE = InnoDB AUTO_INCREMENT = 1694 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '字典数据表'; 447 +) ENGINE = InnoDB AUTO_INCREMENT = 3000 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '字典数据表';
448 448
449 -- ---------------------------- 449 -- ----------------------------
450 -- Records of system_dict_data 450 -- Records of system_dict_data
@@ -870,30 +870,6 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st @@ -870,30 +870,6 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st
870 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1591, 4, '七牛云', 'QINIU', 'system_sms_channel_code', 0, '', '', '', '1', '2024-08-31 08:45:03', '1', '2024-08-31 08:45:24', b'0'); 870 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1591, 4, '七牛云', 'QINIU', 'system_sms_channel_code', 0, '', '', '', '1', '2024-08-31 08:45:03', '1', '2024-08-31 08:45:24', b'0');
871 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1592, 3, '新人券', '3', 'promotion_coupon_take_type', 0, 'info', '', '新人注册后,自动发放', '1', '2024-09-03 11:57:16', '1', '2024-09-03 11:57:28', b'0'); 871 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1592, 3, '新人券', '3', 'promotion_coupon_take_type', 0, 'info', '', '新人注册后,自动发放', '1', '2024-09-03 11:57:16', '1', '2024-09-03 11:57:28', b'0');
872 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1593, 5, '微信零钱', '5', 'brokerage_withdraw_type', 0, '', '', '自动打款', '1', '2024-10-13 11:06:48', '1', '2024-10-13 11:06:59', b'0'); 872 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1593, 5, '微信零钱', '5', 'brokerage_withdraw_type', 0, '', '', '自动打款', '1', '2024-10-13 11:06:48', '1', '2024-10-13 11:06:59', b'0');
873 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1655, 0, '标准数据格式(JSON)', '0', 'iot_data_format', 0, 'default', '', '', '1', '2024-08-10 11:53:26', '1', '2024-09-06 14:31:02', b'0');  
874 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1656, 1, '透传/自定义', '1', 'iot_data_format', 0, 'default', '', '', '1', '2024-08-10 11:53:37', '1', '2024-09-06 14:30:54', b'0');  
875 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1657, 0, '直连设备', '0', 'iot_product_device_type', 0, 'default', '', '', '1', '2024-08-10 11:54:58', '1', '2024-09-06 21:57:01', b'0');  
876 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1658, 2, '网关设备', '2', 'iot_product_device_type', 0, 'default', '', '', '1', '2024-08-10 11:55:08', '1', '2024-09-06 21:56:46', b'0');  
877 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1659, 1, '网关子设备', '1', 'iot_product_device_type', 0, 'default', '', '', '1', '2024-08-10 11:55:20', '1', '2024-09-06 21:57:10', b'0');  
878 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1661, 1, '已发布', '1', 'iot_product_status', 0, 'success', '', '', '1', '2024-08-10 12:10:33', '1', '2024-09-06 22:06:22', b'0');  
879 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1663, 0, '开发中', '0', 'iot_product_status', 0, 'default', '', '', '1', '2024-08-10 14:19:18', '1', '2024-09-07 10:58:07', b'0');  
880 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1665, 0, '弱校验', '0', 'iot_validate_type', 0, '', '', '', '1', '2024-09-06 20:05:48', '1', '2024-09-06 22:02:44', b'0');  
881 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1666, 1, '免校验', '1', 'iot_validate_type', 0, '', '', '', '1', '2024-09-06 20:06:03', '1', '2024-09-06 22:02:51', b'0');  
882 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1667, 0, 'Wi-Fi', '0', 'iot_net_type', 0, '', '', '', '1', '2024-09-06 22:04:47', '1', '2024-09-06 22:04:47', b'0');  
883 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1668, 1, '蜂窝(2G / 3G / 4G / 5G)', '1', 'iot_net_type', 0, '', '', '', '1', '2024-09-06 22:05:14', '1', '2024-09-06 22:05:14', b'0');  
884 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1669, 2, '以太网', '2', 'iot_net_type', 0, '', '', '', '1', '2024-09-06 22:05:35', '1', '2024-09-06 22:05:35', b'0');  
885 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1670, 3, '其他', '3', 'iot_net_type', 0, '', '', '', '1', '2024-09-06 22:05:52', '1', '2024-09-06 22:05:52', b'0');  
886 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1671, 0, '自定义', '0', 'iot_protocol_type', 0, '', '', '', '1', '2024-09-06 22:26:10', '1', '2024-09-06 22:26:10', b'0');  
887 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1672, 1, 'Modbus', '1', 'iot_protocol_type', 0, '', '', '', '1', '2024-09-06 22:26:21', '1', '2024-09-06 22:26:21', b'0');  
888 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1673, 2, 'OPC UA', '2', 'iot_protocol_type', 0, '', '', '', '1', '2024-09-06 22:26:31', '1', '2024-09-06 22:26:31', b'0');  
889 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1674, 3, 'ZigBee', '3', 'iot_protocol_type', 0, '', '', '', '1', '2024-09-06 22:26:39', '1', '2024-09-06 22:26:39', b'0');  
890 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1675, 4, 'BLE', '4', 'iot_protocol_type', 0, '', '', '', '1', '2024-09-06 22:26:48', '1', '2024-09-06 22:26:48', b'0');  
891 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1676, 0, '未激活', '0', 'iot_device_state', 0, '', '', '', '1', '2024-09-21 08:13:34', '1', '2025-01-28 16:09:27', b'0');  
892 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1677, 1, '在线', '1', 'iot_device_state', 0, '', '', '', '1', '2024-09-21 08:13:48', '1', '2025-01-28 16:09:26', b'0');  
893 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1678, 2, '离线', '2', 'iot_device_state', 0, '', '', '', '1', '2024-09-21 08:13:59', '1', '2025-01-28 16:09:25', b'0');  
894 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1680, 1, '属性', '1', 'iot_product_function_type', 0, '', '', '', '1', '2024-09-29 20:03:01', '1', '2024-09-29 20:09:41', b'0');  
895 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1681, 2, '服务', '2', 'iot_product_function_type', 0, '', '', '', '1', '2024-09-29 20:03:11', '1', '2024-09-29 20:08:23', b'0');  
896 -INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1682, 3, '事件', '3', 'iot_product_function_type', 0, '', '', '', '1', '2024-09-29 20:03:20', '1', '2024-09-29 20:08:20', b'0');  
897 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1683, 10, '字节豆包', 'DouBao', 'ai_platform', 0, '', '', '', '1', '2025-02-23 19:51:40', '1', '2025-02-23 19:52:02', b'0'); 873 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1683, 10, '字节豆包', 'DouBao', 'ai_platform', 0, '', '', '', '1', '2025-02-23 19:51:40', '1', '2025-02-23 19:52:02', b'0');
898 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1684, 11, '腾讯混元', 'HunYuan', 'ai_platform', 0, '', '', '', '1', '2025-02-23 20:58:04', '1', '2025-02-23 20:58:04', b'0'); 874 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1684, 11, '腾讯混元', 'HunYuan', 'ai_platform', 0, '', '', '', '1', '2025-02-23 20:58:04', '1', '2025-02-23 20:58:04', b'0');
899 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1685, 12, '硅基流动', 'SiliconFlow', 'ai_platform', 0, '', '', '', '1', '2025-02-24 20:19:09', '1', '2025-02-24 20:19:09', b'0'); 875 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1685, 12, '硅基流动', 'SiliconFlow', 'ai_platform', 0, '', '', '', '1', '2025-02-24 20:19:09', '1', '2025-02-24 20:19:09', b'0');
@@ -905,6 +881,179 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st @@ -905,6 +881,179 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st
905 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1691, 6, '重排', '6', 'ai_model_type', 0, '', '', '', '1', '2025-03-03 12:28:26', '1', '2025-03-03 12:28:26', b'0'); 881 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1691, 6, '重排', '6', 'ai_model_type', 0, '', '', '', '1', '2025-03-03 12:28:26', '1', '2025-03-03 12:28:26', b'0');
906 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1692, 14, 'MiniMax', 'MiniMax', 'ai_platform', 0, '', '', '', '1', '2025-03-11 20:04:51', '1', '2025-03-11 20:04:51', b'0'); 882 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1692, 14, 'MiniMax', 'MiniMax', 'ai_platform', 0, '', '', '', '1', '2025-03-11 20:04:51', '1', '2025-03-11 20:04:51', b'0');
907 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1693, 15, '月之暗灭', 'Moonshot', 'ai_platform', 0, '', '', '', '1', '2025-03-11 20:05:08', '1', '2025-03-11 20:05:08', b'0'); 883 INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1693, 15, '月之暗灭', 'Moonshot', 'ai_platform', 0, '', '', '', '1', '2025-03-11 20:05:08', '1', '2025-03-11 20:05:08', b'0');
  884 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2000, 0, '标准数据格式(JSON)', '0', 'iot_data_format', 0, 'default', '', '', '1', '2024-08-10 11:53:26', '1', '2025-03-17 09:28:16', b'0');
  885 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2001, 1, '透传/自定义', '1', 'iot_data_format', 0, 'default', '', '', '1', '2024-08-10 11:53:37', '1', '2025-03-17 09:28:19', b'0');
  886 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2002, 0, '直连设备', '0', 'iot_product_device_type', 0, 'default', '', '', '1', '2024-08-10 11:54:58', '1', '2025-03-17 09:28:22', b'0');
  887 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2003, 2, '网关设备', '2', 'iot_product_device_type', 0, 'default', '', '', '1', '2024-08-10 11:55:08', '1', '2025-03-17 09:28:28', b'0');
  888 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2004, 1, '网关子设备', '1', 'iot_product_device_type', 0, 'default', '', '', '1', '2024-08-10 11:55:20', '1', '2025-03-17 09:28:31', b'0');
  889 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2005, 1, '已发布', '1', 'iot_product_status', 0, 'success', '', '', '1', '2024-08-10 12:10:33', '1', '2025-03-17 09:28:34', b'0');
  890 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2006, 0, '开发中', '0', 'iot_product_status', 0, 'default', '', '', '1', '2024-08-10 14:19:18', '1', '2025-03-17 09:28:39', b'0');
  891 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2007, 0, '弱校验', '0', 'iot_validate_type', 0, '', '', '', '1', '2024-09-06 20:05:48', '1', '2025-03-17 09:28:41', b'0');
  892 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2008, 1, '免校验', '1', 'iot_validate_type', 0, '', '', '', '1', '2024-09-06 20:06:03', '1', '2025-03-17 09:28:44', b'0');
  893 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2009, 0, 'Wi-Fi', '0', 'iot_net_type', 0, '', '', '', '1', '2024-09-06 22:04:47', '1', '2025-03-17 09:28:47', b'0');
  894 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2010, 1, '蜂窝(2G / 3G / 4G / 5G)', '1', 'iot_net_type', 0, '', '', '', '1', '2024-09-06 22:05:14', '1', '2025-03-17 09:28:49', b'0');
  895 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2011, 2, '以太网', '2', 'iot_net_type', 0, '', '', '', '1', '2024-09-06 22:05:35', '1', '2025-03-17 09:28:51', b'0');
  896 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2012, 3, '其他', '3', 'iot_net_type', 0, '', '', '', '1', '2024-09-06 22:05:52', '1', '2025-03-17 09:28:54', b'0');
  897 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2013, 0, '自定义', '0', 'iot_protocol_type', 0, '', '', '', '1', '2024-09-06 22:26:10', '1', '2025-03-17 09:28:56', b'0');
  898 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2014, 1, 'Modbus', '1', 'iot_protocol_type', 0, '', '', '', '1', '2024-09-06 22:26:21', '1', '2025-03-17 09:28:58', b'0');
  899 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2015, 2, 'OPC UA', '2', 'iot_protocol_type', 0, '', '', '', '1', '2024-09-06 22:26:31', '1', '2025-03-17 09:29:00', b'0');
  900 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2016, 3, 'ZigBee', '3', 'iot_protocol_type', 0, '', '', '', '1', '2024-09-06 22:26:39', '1', '2025-03-17 09:29:04', b'0');
  901 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2017, 4, 'BLE', '4', 'iot_protocol_type', 0, '', '', '', '1', '2024-09-06 22:26:48', '1', '2025-03-17 09:29:06', b'0');
  902 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2018, 0, '未激活', '0', 'iot_device_state', 0, '', '', '', '1', '2024-09-21 08:13:34', '1', '2025-03-17 09:29:09', b'0');
  903 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2019, 1, '在线', '1', 'iot_device_state', 0, '', '', '', '1', '2024-09-21 08:13:48', '1', '2025-03-17 09:29:12', b'0');
  904 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2020, 2, '离线', '2', 'iot_device_state', 0, '', '', '', '1', '2024-09-21 08:13:59', '1', '2025-03-17 09:29:14', b'0');
  905 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2021, 1, '属性', '1', 'iot_thing_model_type', 0, '', '', '', '1', '2024-09-29 20:03:01', '1', '2025-03-17 09:29:24', b'0');
  906 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2022, 2, '服务', '2', 'iot_thing_model_type', 0, '', '', '', '1', '2024-09-29 20:03:11', '1', '2025-03-17 09:29:27', b'0');
  907 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2023, 3, '事件', '3', 'iot_thing_model_type', 0, '', '', '', '1', '2024-09-29 20:03:20', '1', '2025-03-17 09:29:29', b'0');
  908 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2024, 1, 'JAR 部署', '0', 'iot_plugin_deploy_type', 0, '', '', '', '1', '2024-12-13 10:55:32', '1', '2025-03-17 09:29:32', b'0');
  909 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2025, 2, '独立部署', '1', 'iot_plugin_deploy_type', 0, '', '', '', '1', '2024-12-13 10:55:43', '1', '2025-03-17 09:29:34', b'0');
  910 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2026, 0, '停止', '0', 'iot_plugin_status', 0, 'danger', '', '', '1', '2024-12-13 11:07:37', '1', '2025-03-17 09:29:37', b'0');
  911 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2027, 1, '运行', '1', 'iot_plugin_status', 0, '', '', '', '1', '2024-12-13 11:07:45', '1', '2025-03-17 09:34:17', b'0');
  912 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2028, 0, '普通插件', '0', 'iot_plugin_type', 0, '', '', '', '1', '2024-12-13 11:08:32', '1', '2025-03-17 09:34:19', b'0');
  913 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2029, 1, '设备插件', '1', 'iot_plugin_type', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:34:22', b'0');
  914 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2030, 1, '升每分钟', 'L/min', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:34:24', b'0');
  915 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2031, 2, '毫克每千克', 'mg/kg', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:34:27', b'0');
  916 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2032, 3, '浊度', 'NTU', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:34:31', b'0');
  917 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2033, 4, 'PH值', 'pH', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:34:36', b'0');
  918 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2034, 5, '土壤EC值', 'dS/m', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:34:43', b'0');
  919 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2035, 6, '太阳总辐射', 'W/㎡', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:36:20', b'0');
  920 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2036, 7, '降雨量', 'mm/hour', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:36:24', b'0');
  921 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2037, 8, '乏', 'var', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:36:27', b'0');
  922 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2038, 9, '厘泊', 'cP', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:36:33', b'0');
  923 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2039, 10, '饱和度', 'aw', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:37:11', b'0');
  924 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2040, 11, '个', 'pcs', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:37:19', b'0');
  925 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2041, 12, '厘斯', 'cst', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:37:22', b'0');
  926 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2042, 13, '巴', 'bar', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:37:24', b'0');
  927 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2043, 14, '纳克每升', 'ppt', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:37:27', b'0');
  928 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2044, 15, '微克每升', 'ppb', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:37:31', b'0');
  929 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2045, 16, '微西每厘米', 'uS/cm', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:37:34', b'0');
  930 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2046, 17, '牛顿每库仑', 'N/C', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:37:38', b'0');
  931 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2047, 18, '伏特每米', 'V/m', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:37:43', b'0');
  932 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2048, 19, '滴速', 'ml/min', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:37:46', b'0');
  933 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2049, 20, '毫米汞柱', 'mmHg', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:37:48', b'0');
  934 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2050, 21, '血糖', 'mmol/L', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:37:54', b'0');
  935 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2051, 22, '毫米每秒', 'mm/s', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:38:02', b'0');
  936 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2052, 23, '转每分钟', 'turn/m', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:38:07', b'0');
  937 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2053, 24, '次', 'count', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:38:09', b'0');
  938 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2054, 25, '档', 'gear', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:38:11', b'0');
  939 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2055, 26, '步', 'stepCount', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:38:13', b'0');
  940 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2056, 27, '标准立方米每小时', 'Nm3/h', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:38:15', b'0');
  941 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2057, 28, '千伏', 'kV', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:38:20', b'0');
  942 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2058, 29, '千伏安', 'kVA', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:38:24', b'0');
  943 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2060, 30, '千乏', 'kVar', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  944 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2061, 31, '微瓦每平方厘米', 'uw/cm2', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  945 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2062, 32, '只', '只', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  946 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2063, 33, '相对湿度', '%RH', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  947 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2064, 34, '立方米每秒', 'm³/s', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  948 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2065, 35, '公斤每秒', 'kg/s', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  949 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2066, 36, '转每分钟', 'r/min', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  950 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2067, 37, '吨每小时', 't/h', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  951 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2068, 38, '千卡每小时', 'KCL/h', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  952 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2069, 39, '升每秒', 'L/s', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  953 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2070, 40, '兆帕', 'Mpa', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  954 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2071, 41, '立方米每小时', 'm³/h', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  955 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2072, 42, '千乏时', 'kvarh', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  956 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2073, 43, '微克每升', 'μg/L', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  957 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2074, 44, '千卡路里', 'kcal', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  958 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2075, 45, '吉字节', 'GB', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  959 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2076, 46, '兆字节', 'MB', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  960 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2077, 47, '千字节', 'KB', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  961 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2078, 48, '字节', 'B', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  962 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2079, 49, '微克每平方分米每天', 'μg/(d㎡·d)', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  963 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2080, 50, '无', '', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  964 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2081, 51, '百万分率', 'ppm', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  965 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2082, 52, '像素', 'pixel', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  966 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2083, 53, '照度', 'Lux', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  967 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2084, 54, '重力加速度', 'grav', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  968 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2085, 55, '分贝', 'dB', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  969 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2086, 56, '百分比', '%', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  970 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2087, 57, '流明', 'lm', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  971 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2088, 58, '比特', 'bit', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  972 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2089, 59, '克每毫升', 'g/mL', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  973 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2090, 60, '克每升', 'g/L', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  974 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2091, 61, '毫克每升', 'mg/L', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  975 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2092, 62, '微克每立方米', 'μg/m³', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  976 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2093, 63, '毫克每立方米', 'mg/m³', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  977 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2094, 64, '克每立方米', 'g/m³', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  978 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2095, 65, '千克每立方米', 'kg/m³', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  979 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2096, 66, '纳法', 'nF', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  980 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2097, 67, '皮法', 'pF', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  981 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2098, 68, '微法', 'μF', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  982 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2099, 69, '法拉', 'F', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  983 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2100, 70, '欧姆', 'Ω', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  984 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2101, 71, '微安', 'μA', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  985 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2102, 72, '毫安', 'mA', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  986 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2103, 73, '千安', 'kA', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  987 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2104, 74, '安培', 'A', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  988 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2105, 75, '毫伏', 'mV', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  989 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2106, 76, '伏特', 'V', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  990 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2107, 77, '毫秒', 'ms', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  991 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2108, 78, '秒', 's', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  992 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2109, 79, '分钟', 'min', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  993 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2110, 80, '小时', 'h', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  994 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2111, 81, '日', 'day', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  995 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2112, 82, '周', 'week', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  996 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2113, 83, '月', 'month', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  997 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2114, 84, '年', 'year', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  998 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2115, 85, '节', 'kn', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  999 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2116, 86, '千米每小时', 'km/h', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1000 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2117, 87, '米每秒', 'm/s', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1001 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2118, 88, '秒', '″', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1002 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2119, 89, '分', '′', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1003 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2120, 90, '度', '°', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1004 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2121, 91, '弧度', 'rad', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1005 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2122, 92, '赫兹', 'Hz', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1006 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2123, 93, '微瓦', 'μW', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1007 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2124, 94, '毫瓦', 'mW', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1008 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2125, 95, '千瓦特', 'kW', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1009 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2126, 96, '瓦特', 'W', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1010 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2127, 97, '卡路里', 'cal', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1011 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2128, 98, '千瓦时', 'kW·h', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1012 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2129, 99, '瓦时', 'Wh', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1013 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2130, 100, '电子伏', 'eV', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1014 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2131, 101, '千焦', 'kJ', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1015 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2132, 102, '焦耳', 'J', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1016 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2133, 103, '华氏度', '℉', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1017 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2134, 104, '开尔文', 'K', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1018 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2135, 105, '吨', 't', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1019 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2136, 106, '摄氏度', '°C', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1020 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2137, 107, '毫帕', 'mPa', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1021 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2138, 108, '百帕', 'hPa', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1022 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2139, 109, '千帕', 'kPa', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1023 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2140, 110, '帕斯卡', 'Pa', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1024 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2141, 111, '毫克', 'mg', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1025 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2142, 112, '克', 'g', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1026 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2143, 113, '千克', 'kg', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1027 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2144, 114, '牛', 'N', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1028 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2145, 115, '毫升', 'mL', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1029 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2146, 116, '升', 'L', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1030 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2147, 117, '立方毫米', 'mm³', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1031 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2148, 118, '立方厘米', 'cm³', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1032 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2149, 119, '立方千米', 'km³', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1033 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2150, 120, '立方米', 'm³', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1034 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2151, 121, '公顷', 'h㎡', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1035 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2152, 122, '平方厘米', 'c㎡', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1036 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2153, 123, '平方毫米', 'm㎡', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1037 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2154, 124, '平方千米', 'k㎡', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1038 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2155, 125, '平方米', '㎡', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1039 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2156, 126, '纳米', 'nm', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1040 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2157, 127, '微米', 'μm', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1041 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2158, 128, '毫米', 'mm', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1042 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2159, 129, '厘米', 'cm', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1043 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2160, 130, '分米', 'dm', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1044 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2161, 131, '千米', 'km', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1045 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2162, 132, '米', 'm', 'iot_thing_model_unit', 0, '', '', '', '1', '2024-12-13 11:08:41', '1', '2025-03-17 09:40:46', b'0');
  1046 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2163, 1, '输入', '1', 'iot_data_bridge_direction_enum', 0, 'primary', '', '', '1', '2025-03-09 12:38:24', '1', '2025-03-17 09:40:46', b'0');
  1047 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2164, 2, '输出', '2', 'iot_data_bridge_direction_enum', 0, 'primary', '', '', '1', '2025-03-09 12:38:36', '1', '2025-03-17 09:40:46', b'0');
  1048 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2165, 1, 'HTTP', '1', 'iot_data_bridge_type_enum', 0, 'primary', '', '', '1', '2025-03-09 12:39:54', '1', '2025-03-17 09:40:46', b'0');
  1049 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2166, 2, 'TCP', '2', 'iot_data_bridge_type_enum', 0, 'primary', '', '', '1', '2025-03-09 12:40:06', '1', '2025-03-17 09:40:46', b'0');
  1050 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2167, 3, 'WEBSOCKET', '3', 'iot_data_bridge_type_enum', 0, 'primary', '', '', '1', '2025-03-09 12:40:24', '1', '2025-03-17 09:40:46', b'0');
  1051 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2168, 10, 'MQTT', '10', 'iot_data_bridge_type_enum', 0, 'primary', '', '', '1', '2025-03-09 12:40:37', '1', '2025-03-17 09:40:46', b'0');
  1052 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2169, 20, 'DATABASE', '20', 'iot_data_bridge_type_enum', 0, 'primary', '', '', '1', '2025-03-09 12:41:05', '1', '2025-03-17 09:40:46', b'0');
  1053 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2170, 21, 'REDIS_STREAM', '21', 'iot_data_bridge_type_enum', 0, 'primary', '', '', '1', '2025-03-09 12:41:18', '1', '2025-03-17 09:40:46', b'0');
  1054 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2171, 30, 'ROCKETMQ', '30', 'iot_data_bridge_type_enum', 0, 'primary', '', '', '1', '2025-03-09 12:41:30', '1', '2025-03-17 09:40:46', b'0');
  1055 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2172, 31, 'RABBITMQ', '31', 'iot_data_bridge_type_enum', 0, 'primary', '', '', '1', '2025-03-09 12:41:47', '1', '2025-03-17 09:40:46', b'0');
  1056 +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2173, 32, 'KAFKA', '32', 'iot_data_bridge_type_enum', 0, 'primary', '', '', '1', '2025-03-09 12:41:59', '1', '2025-03-17 09:40:46', b'0');
908 COMMIT; 1057 COMMIT;
909 1058
910 -- ---------------------------- 1059 -- ----------------------------
@@ -924,7 +1073,7 @@ CREATE TABLE `system_dict_type` ( @@ -924,7 +1073,7 @@ CREATE TABLE `system_dict_type` (
924 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', 1073 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
925 `deleted_time` datetime NULL DEFAULT NULL COMMENT '删除时间', 1074 `deleted_time` datetime NULL DEFAULT NULL COMMENT '删除时间',
926 PRIMARY KEY (`id`) USING BTREE 1075 PRIMARY KEY (`id`) USING BTREE
927 -) ENGINE = InnoDB AUTO_INCREMENT = 641 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '字典类型表'; 1076 +) ENGINE = InnoDB AUTO_INCREMENT = 2000 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '字典类型表';
928 1077
929 -- ---------------------------- 1078 -- ----------------------------
930 -- Records of system_dict_type 1079 -- Records of system_dict_type
@@ -1023,15 +1172,21 @@ INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creat @@ -1023,15 +1172,21 @@ INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creat
1023 INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (627, '写作格式', 'ai_write_format', 0, '', '1', '2024-07-07 15:14:34', '1', '2024-07-07 15:14:34', b'0', '1970-01-01 00:00:00'); 1172 INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (627, '写作格式', 'ai_write_format', 0, '', '1', '2024-07-07 15:14:34', '1', '2024-07-07 15:14:34', b'0', '1970-01-01 00:00:00');
1024 INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (628, 'AI 写作类型', 'ai_write_type', 0, '', '1', '2024-07-10 21:25:29', '1', '2024-07-10 21:25:29', b'0', '1970-01-01 00:00:00'); 1173 INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (628, 'AI 写作类型', 'ai_write_type', 0, '', '1', '2024-07-10 21:25:29', '1', '2024-07-10 21:25:29', b'0', '1970-01-01 00:00:00');
1025 INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (629, 'BPM 流程模型类型', 'bpm_model_type', 0, '', '1', '2024-08-26 15:21:43', '1', '2024-08-26 15:21:43', b'0', '1970-01-01 00:00:00'); 1174 INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (629, 'BPM 流程模型类型', 'bpm_model_type', 0, '', '1', '2024-08-26 15:21:43', '1', '2024-08-26 15:21:43', b'0', '1970-01-01 00:00:00');
1026 -INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (630, 'IOT 接入网关协议', 'iot_protocol_type', 0, '', '1', '2024-09-06 22:20:17', '1', '2024-09-06 22:20:17', b'0', '1970-01-01 00:00:00');  
1027 -INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (631, 'IOT 设备状态', 'iot_device_state', 0, '', '1', '2024-09-21 08:12:55', '1', '2025-01-28 16:09:42', b'0', '1970-01-01 00:00:00');  
1028 -INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (632, 'IOT 物模型功能类型', 'iot_product_function_type', 0, '', '1', '2024-09-29 20:02:36', '1', '2024-09-29 20:09:26', b'0', '1970-01-01 00:00:00');  
1029 -INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (634, 'IOT 数据格式', 'iot_data_format', 0, '', '1', '2024-08-10 11:52:58', '1', '2024-09-06 14:30:14', b'0', '1970-01-01 00:00:00');  
1030 -INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (635, 'IOT 产品设备类型', 'iot_product_device_type', 0, '', '1', '2024-08-10 11:54:30', '1', '2024-08-10 04:06:56', b'0', '1970-01-01 00:00:00');  
1031 -INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (637, 'IOT 产品状态', 'iot_product_status', 0, '', '1', '2024-08-10 12:06:09', '1', '2024-08-10 12:06:09', b'0', '1970-01-01 00:00:00');  
1032 -INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (638, 'IOT 数据校验级别', 'iot_validate_type', 0, '', '1', '2024-09-06 20:05:13', '1', '2024-09-06 20:05:13', b'0', '1970-01-01 00:00:00');  
1033 -INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (639, 'IOT 联网方式', 'iot_net_type', 0, '', '1', '2024-09-06 22:04:13', '1', '2024-09-06 22:04:13', b'0', '1970-01-01 00:00:00');  
1034 INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (640, 'AI 模型类型', 'ai_model_type', 0, '', '1', '2025-03-03 12:24:07', '1', '2025-03-03 12:24:07', b'0', '1970-01-01 00:00:00'); 1175 INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (640, 'AI 模型类型', 'ai_model_type', 0, '', '1', '2025-03-03 12:24:07', '1', '2025-03-03 12:24:07', b'0', '1970-01-01 00:00:00');
  1176 +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (1000, 'IoT 数据格式', 'iot_data_format', 0, '', '1', '2024-08-10 11:52:58', '1', '2025-03-17 09:25:06', b'0', '1970-01-01 00:00:00');
  1177 +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (1001, 'IoT 产品设备类型', 'iot_product_device_type', 0, '', '1', '2024-08-10 11:54:30', '1', '2025-03-17 09:25:08', b'0', '1970-01-01 00:00:00');
  1178 +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (1002, 'IoT 产品状态', 'iot_product_status', 0, '', '1', '2024-08-10 12:06:09', '1', '2025-03-17 09:25:10', b'0', '1970-01-01 00:00:00');
  1179 +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (1003, 'IoT 数据校验级别', 'iot_validate_type', 0, '', '1', '2024-09-06 20:05:13', '1', '2025-03-17 09:25:12', b'0', '1970-01-01 00:00:00');
  1180 +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (1004, 'IoT 联网方式', 'iot_net_type', 0, '', '1', '2024-09-06 22:04:13', '1', '2025-03-17 09:25:14', b'0', '1970-01-01 00:00:00');
  1181 +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (1005, 'IoT 接入网关协议', 'iot_protocol_type', 0, '', '1', '2024-09-06 22:20:17', '1', '2025-03-17 09:25:16', b'0', '1970-01-01 00:00:00');
  1182 +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (1006, 'IoT 设备状态', 'iot_device_state', 0, '', '1', '2024-09-21 08:12:55', '1', '2025-03-17 09:25:19', b'0', '1970-01-01 00:00:00');
  1183 +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (1007, 'IoT 物模型功能类型', 'iot_thing_model_type', 0, '', '1', '2024-09-29 20:02:36', '1', '2025-03-17 09:25:24', b'0', '1970-01-01 00:00:00');
  1184 +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (1008, 'IoT 插件部署方式', 'iot_plugin_deploy_type', 0, '', '1', '2024-12-13 10:55:13', '1', '2025-03-17 09:25:27', b'0', '1970-01-01 00:00:00');
  1185 +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (1009, 'IoT 插件状态', 'iot_plugin_status', 0, '', '1', '2024-12-13 11:05:34', '1', '2025-03-17 09:25:30', b'0', '1970-01-01 00:00:00');
  1186 +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (1010, 'IoT 插件类型', 'iot_plugin_type', 0, '', '1', '2024-12-13 11:08:19', '1', '2025-03-17 09:25:32', b'0', '1970-01-01 00:00:00');
  1187 +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (1011, 'IoT 物模型单位', 'iot_thing_model_unit', 0, '', '1', '2024-12-25 17:36:46', '1', '2025-03-17 09:25:35', b'0', '1970-01-01 00:00:00');
  1188 +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (1012, 'IoT 数据桥接的方向枚举', 'iot_data_bridge_direction_enum', 0, '', '1', '2025-03-09 12:37:40', '1', '2025-03-17 09:25:39', b'0', '1970-01-01 00:00:00');
  1189 +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (1013, 'IoT 数据桥梁的类型枚举', 'iot_data_bridge_type_enum', 0, '', '1', '2025-03-09 12:39:36', '1', '2025-03-17 09:25:43', b'0', '1970-01-01 00:00:00');
1035 COMMIT; 1190 COMMIT;
1036 1191
1037 -- ---------------------------- 1192 -- ----------------------------
@@ -1055,7 +1210,7 @@ CREATE TABLE `system_login_log` ( @@ -1055,7 +1210,7 @@ CREATE TABLE `system_login_log` (
1055 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', 1210 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
1056 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', 1211 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
1057 PRIMARY KEY (`id`) USING BTREE 1212 PRIMARY KEY (`id`) USING BTREE
1058 -) ENGINE = InnoDB AUTO_INCREMENT = 3442 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统访问记录'; 1213 +) ENGINE = InnoDB AUTO_INCREMENT = 3446 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统访问记录';
1059 1214
1060 -- ---------------------------- 1215 -- ----------------------------
1061 -- Records of system_login_log 1216 -- Records of system_login_log
@@ -1186,16 +1341,16 @@ CREATE TABLE `system_menu` ( @@ -1186,16 +1341,16 @@ CREATE TABLE `system_menu` (
1186 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', 1341 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
1187 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', 1342 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
1188 PRIMARY KEY (`id`) USING BTREE 1343 PRIMARY KEY (`id`) USING BTREE
1189 -) ENGINE = InnoDB AUTO_INCREMENT = 2925 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '菜单权限表'; 1344 +) ENGINE = InnoDB AUTO_INCREMENT = 5000 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '菜单权限表';
1190 1345
1191 -- ---------------------------- 1346 -- ----------------------------
1192 -- Records of system_menu 1347 -- Records of system_menu
1193 -- ---------------------------- 1348 -- ----------------------------
1194 BEGIN; 1349 BEGIN;
1195 -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 (1, '系统管理', '', 1, 10, 0, '/system', 'ep:tools', NULL, NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-06-18 01:19:41', b'0'); 1350 +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 (1, '系统管理', '', 1, 10, 0, '/system', 'ep:tools', NULL, NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2025-03-15 21:30:27', b'0');
1196 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 (2, '基础设施', '', 1, 20, 0, '/infra', 'ep:monitor', NULL, NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-03-01 08:28:40', b'0'); 1351 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 (2, '基础设施', '', 1, 20, 0, '/infra', 'ep:monitor', NULL, NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-03-01 08:28:40', b'0');
1197 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 (5, 'OA 示例', '', 1, 40, 1185, 'oa', 'fa:road', NULL, NULL, 0, b'1', b'1', b'1', 'admin', '2021-09-20 16:26:19', '1', '2024-02-29 12:38:13', b'0'); 1352 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 (5, 'OA 示例', '', 1, 40, 1185, 'oa', 'fa:road', NULL, NULL, 0, b'1', b'1', b'1', 'admin', '2021-09-20 16:26:19', '1', '2024-02-29 12:38:13', b'0');
1198 -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 (100, '用户管理', 'system:user:list', 2, 1, 1, 'user', 'ep:avatar', 'system/user/index', 'SystemUser', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 01:02:04', b'0'); 1353 +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 (100, '用户管理', 'system:user:list', 2, 1, 1, 'user', 'ep:avatar', 'system/user/index', 'SystemUser', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2025-03-15 21:30:41', b'0');
1199 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 (101, '角色管理', '', 2, 2, 1, 'role', 'ep:user', 'system/role/index', 'SystemRole', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-05-01 18:35:29', b'0'); 1354 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 (101, '角色管理', '', 2, 2, 1, 'role', 'ep:user', 'system/role/index', 'SystemRole', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-05-01 18:35:29', b'0');
1200 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 (102, '菜单管理', '', 2, 3, 1, 'menu', 'ep:menu', 'system/menu/index', 'SystemMenu', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 01:03:50', b'0'); 1355 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 (102, '菜单管理', '', 2, 3, 1, 'menu', 'ep:menu', 'system/menu/index', 'SystemMenu', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 01:03:50', b'0');
1201 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 (103, '部门管理', '', 2, 4, 1, 'dept', 'fa:address-card', 'system/dept/index', 'SystemDept', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 01:06:28', b'0'); 1356 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 (103, '部门管理', '', 2, 4, 1, 'dept', 'fa:address-card', 'system/dept/index', 'SystemDept', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 01:06:28', b'0');
@@ -1707,7 +1862,7 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i @@ -1707,7 +1862,7 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i
1707 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 (2431, '回款计划更新', 'crm:receivable-plan:update', 3, 3, 2428, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 11:18:09', '', '2023-10-29 11:18:09', b'0'); 1862 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 (2431, '回款计划更新', 'crm:receivable-plan:update', 3, 3, 2428, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 11:18:09', '', '2023-10-29 11:18:09', b'0');
1708 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 (2432, '回款计划删除', 'crm:receivable-plan:delete', 3, 4, 2428, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 11:18:09', '', '2023-10-29 11:18:09', b'0'); 1863 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 (2432, '回款计划删除', 'crm:receivable-plan:delete', 3, 4, 2428, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 11:18:09', '', '2023-10-29 11:18:09', b'0');
1709 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 (2433, '回款计划导出', 'crm:receivable-plan:export', 3, 5, 2428, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 11:18:09', '', '2023-10-29 11:18:09', b'0'); 1864 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 (2433, '回款计划导出', 'crm:receivable-plan:export', 3, 5, 2428, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 11:18:09', '', '2023-10-29 11:18:09', b'0');
1710 -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 (2435, '商城装修', '', 2, 20, 2030, 'diy-template', 'fa6-solid:brush', 'mall/promotion/diy/template/index', 'DiyTemplate', 0, b'1', b'1', b'1', '', '2023-10-29 14:19:25', '', '2023-10-29 14:19:25', b'0'); 1865 +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 (2435, '商城装修', '', 2, 20, 2030, 'diy-template', 'fa6-solid:brush', 'mall/promotion/diy/template/index', '', 0, b'1', b'1', b'1', '', '2023-10-29 14:19:25', '1', '2025-03-15 21:34:33', b'0');
1711 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 (2436, '装修模板', '', 2, 1, 2435, 'diy-template', 'fa6-solid:brush', 'mall/promotion/diy/template/index', 'DiyTemplate', 0, b'1', b'1', b'1', '', '2023-10-29 14:19:25', '', '2023-10-29 14:19:25', b'0'); 1866 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 (2436, '装修模板', '', 2, 1, 2435, 'diy-template', 'fa6-solid:brush', 'mall/promotion/diy/template/index', 'DiyTemplate', 0, b'1', b'1', b'1', '', '2023-10-29 14:19:25', '', '2023-10-29 14:19:25', b'0');
1712 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 (2437, '装修模板查询', 'promotion:diy-template:query', 3, 1, 2436, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 14:19:25', '', '2023-10-29 14:19:25', b'0'); 1867 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 (2437, '装修模板查询', 'promotion:diy-template:query', 3, 1, 2436, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 14:19:25', '', '2023-10-29 14:19:25', b'0');
1713 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 (2438, '装修模板创建', 'promotion:diy-template:create', 3, 2, 2436, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 14:19:25', '', '2023-10-29 14:19:25', b'0'); 1868 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 (2438, '装修模板创建', 'promotion:diy-template:create', 3, 2, 2436, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-29 14:19:25', '', '2023-10-29 14:19:25', b'0');
@@ -2035,26 +2190,6 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i @@ -2035,26 +2190,6 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i
2035 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 (2811, '积分商城活动更新', 'promotion:point-activity:update', 3, 3, 2808, '', '', '', '', 0, b'1', b'1', b'1', '', '2024-09-21 05:36:42', '1', '2024-09-22 14:49:10', 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 (2811, '积分商城活动更新', 'promotion:point-activity:update', 3, 3, 2808, '', '', '', '', 0, b'1', b'1', b'1', '', '2024-09-21 05:36:42', '1', '2024-09-22 14:49:10', b'0');
2036 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 (2812, '积分商城活动删除', 'promotion:point-activity:delete', 3, 4, 2808, '', '', '', '', 0, b'1', b'1', b'1', '', '2024-09-21 05:36:42', '1', '2024-09-22 14:49:12', 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 (2812, '积分商城活动删除', 'promotion:point-activity:delete', 3, 4, 2808, '', '', '', '', 0, b'1', b'1', b'1', '', '2024-09-21 05:36:42', '1', '2024-09-22 14:49:12', b'0');
2037 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 (2813, '积分商城活动导出', 'promotion:point-activity:export', 3, 5, 2808, '', '', '', '', 0, b'1', b'1', b'1', '', '2024-09-21 05:36:42', '1', '2024-09-22 14:49:27', 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 (2813, '积分商城活动导出', 'promotion:point-activity:export', 3, 5, 2808, '', '', '', '', 0, b'1', b'1', b'1', '', '2024-09-21 05:36:42', '1', '2024-09-22 14:49:27', b'0');
2038 -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 (2892, 'IOT 物联网', '', 1, 500, 0, '/iot', 'fa-solid:hdd', '', '', 0, b'1', b'1', b'1', '1', '2024-08-10 09:55:29', '1', '2024-08-10 09:55:29', b'0');  
2039 -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 (2893, '设备接入', '', 1, 1, 2892, 'device', 'ep:platform', '', '', 0, b'1', b'1', b'1', '1', '2024-08-10 09:57:56', '1', '2024-10-20 18:57:43', b'0');  
2040 -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 (2894, '产品管理', '', 2, 0, 2893, 'product', '', 'iot/product/index', 'IoTProduct', 0, b'1', b'1', b'1', '', '2024-08-10 02:38:02', '1', '2024-09-16 19:50:42', b'0');  
2041 -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 (2895, '产品查询', 'iot:product:query', 3, 1, 2894, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-08-10 02:38:02', '', '2024-08-10 02:38:02', b'0');  
2042 -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 (2896, '产品创建', 'iot:product:create', 3, 2, 2894, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-08-10 02:38:02', '', '2024-08-10 02:38:02', b'0');  
2043 -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 (2897, '产品更新', 'iot:product:update', 3, 3, 2894, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-08-10 02:38:02', '', '2024-08-10 02:38:02', b'0');  
2044 -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 (2898, '产品删除', 'iot:product:delete', 3, 4, 2894, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-08-10 02:38:02', '', '2024-08-10 02:38:02', b'0');  
2045 -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 (2899, '产品导出', 'iot:product:export', 3, 5, 2894, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-08-10 02:38:02', '', '2024-08-10 02:38:02', b'0');  
2046 -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 (2900, '设备管理', '', 2, 0, 2893, 'device', '', 'iot/device/index', 'IoTDevice', 0, b'1', b'1', b'1', '', '2024-09-16 18:48:19', '1', '2024-09-16 19:50:53', b'0');  
2047 -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 (2901, '设备查询', 'iot:device:query', 3, 1, 2900, '', '', '', '', 0, b'1', b'1', b'1', '', '2024-09-16 18:48:19', '1', '2024-09-16 19:37:00', b'0');  
2048 -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 (2902, '设备创建', 'iot:device:create', 3, 2, 2900, '', '', '', '', 0, b'1', b'1', b'1', '', '2024-09-16 18:48:19', '1', '2024-09-16 19:37:09', b'0');  
2049 -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 (2903, '设备更新', 'iot:device:update', 3, 3, 2900, '', '', '', '', 0, b'1', b'1', b'1', '', '2024-09-16 18:48:19', '1', '2024-09-16 19:37:18', b'0');  
2050 -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 (2904, '设备删除', 'iot:device:delete', 3, 4, 2900, '', '', '', '', 0, b'1', b'1', b'1', '', '2024-09-16 18:48:19', '1', '2024-09-16 19:37:42', b'0');  
2051 -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 (2905, '设备导出', 'iot:device:export', 3, 5, 2900, '', '', '', '', 0, b'1', b'1', b'1', '', '2024-09-16 18:48:19', '1', '2024-09-16 19:37:49', b'0');  
2052 -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 (2906, 'IoT 产品物模型管理', '', 1, 0, 2893, 'think-model-function', '', '', '', 0, b'0', b'1', b'1', '', '2024-09-25 22:12:09', '1', '2024-09-29 20:52:12', b'0');  
2053 -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 (2907, 'IoT 产品物模型查询', 'iot:think-model-function:query', 3, 1, 2906, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-09-25 22:12:09', '', '2024-09-25 22:12:09', b'0');  
2054 -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 (2908, 'IoT 产品物模型创建', 'iot:think-model-function:create', 3, 2, 2906, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-09-25 22:12:09', '', '2024-09-25 22:12:09', b'0');  
2055 -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 (2909, 'IoT 产品物模型更新', 'iot:think-model-function:update', 3, 3, 2906, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-09-25 22:12:09', '', '2024-09-25 22:12:09', b'0');  
2056 -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 (2910, 'IoT 产品物模型删除', 'iot:think-model-function:delete', 3, 4, 2906, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-09-25 22:12:09', '', '2024-09-25 22:12:09', b'0');  
2057 -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 (2911, 'IoT 产品物模型导出', 'iot:think-model-function:export', 3, 5, 2906, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-09-25 22:12:09', '', '2024-09-25 22:12:09', b'0');  
2058 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 (2912, '创建推广员', 'trade:brokerage-user:create', 3, 7, 2346, '', '', '', '', 0, b'1', b'1', b'1', '1', '2024-12-01 14:32:39', '1', '2024-12-01 14:32:39', 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 (2912, '创建推广员', 'trade:brokerage-user:create', 3, 7, 2346, '', '', '', '', 0, b'1', b'1', b'1', '1', '2024-12-01 14:32:39', '1', '2024-12-01 14:32:39', b'0');
2059 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 (2913, '流程清理', 'bpm:model:clean', 3, 7, 1193, '', '', '', '', 0, b'1', b'1', b'1', '1', '2025-01-17 19:32:06', '1', '2025-01-17 19:32:06', 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 (2913, '流程清理', 'bpm:model:clean', 3, 7, 1193, '', '', '', '', 0, b'1', b'1', b'1', '1', '2025-01-17 19:32:06', '1', '2025-01-17 19:32:06', b'0');
2060 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 (2914, '积分商城活动关闭', 'promotion:point-activity:close', 3, 6, 2808, '', '', '', '', 0, b'1', b'1', b'1', '1', '2025-01-23 20:23:34', '1', '2025-01-23 20:23:34', 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 (2914, '积分商城活动关闭', 'promotion:point-activity:close', 3, 6, 2808, '', '', '', '', 0, b'1', b'1', b'1', '1', '2025-01-23 20:23:34', '1', '2025-01-23 20:23:34', b'0');
@@ -2068,6 +2203,57 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i @@ -2068,6 +2203,57 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i
2068 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 (2922, '工具创建', 'ai:tool:create', 3, 2, 2920, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-03-14 11:19:29', '', '2025-03-14 11:19:29', b'0'); 2203 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 (2922, '工具创建', 'ai:tool:create', 3, 2, 2920, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-03-14 11:19:29', '', '2025-03-14 11:19:29', b'0');
2069 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 (2923, '工具更新', 'ai:tool:update', 3, 3, 2920, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-03-14 11:19:29', '', '2025-03-14 11:19:29', b'0'); 2204 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 (2923, '工具更新', 'ai:tool:update', 3, 3, 2920, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-03-14 11:19:29', '', '2025-03-14 11:19:29', b'0');
2070 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 (2924, '工具删除', 'ai:tool:delete', 3, 4, 2920, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-03-14 11:19:29', '', '2025-03-14 11:19:29', b'0'); 2205 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 (2924, '工具删除', 'ai:tool:delete', 3, 4, 2920, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-03-14 11:19:29', '', '2025-03-14 11:19:29', b'0');
  2206 +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 (4000, 'IoT 物联网', '', 1, 500, 0, '/iot', 'fa-solid:hdd', '', '', 0, b'1', b'1', b'1', '1', '2024-08-10 09:55:28', '1', '2024-12-07 15:58:34', b'0');
  2207 +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 (4001, '设备接入', '', 1, 2, 4000, 'device', 'ep:platform', '', '', 0, b'1', b'1', b'1', '1', '2024-08-10 09:57:56', '1', '2025-02-27 08:39:49', b'0');
  2208 +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 (4002, '产品管理', '', 2, 2, 4001, 'product', 'fa-solid:tools', 'iot/product/product/index', 'IoTProduct', 0, b'1', b'1', b'1', '', '2024-08-10 02:38:02', '1', '2024-12-07 18:47:53', b'0');
  2209 +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 (4003, '产品查询', 'iot:product:query', 3, 1, 4002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-08-10 02:38:02', '', '2024-12-07 15:55:00', b'0');
  2210 +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 (4004, '产品创建', 'iot:product:create', 3, 2, 4002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-08-10 02:38:02', '', '2024-12-07 15:55:03', b'0');
  2211 +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 (4005, '产品更新', 'iot:product:update', 3, 3, 4002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-08-10 02:38:02', '', '2024-12-07 15:55:05', b'0');
  2212 +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 (4006, '产品删除', 'iot:product:delete', 3, 4, 4002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-08-10 02:38:02', '', '2024-12-07 15:55:06', b'0');
  2213 +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 (4007, '产品导出', 'iot:product:export', 3, 5, 4002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-08-10 02:38:02', '', '2024-12-07 15:55:13', b'0');
  2214 +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 (4008, '设备管理', '', 2, 4, 4001, 'device', 'fa:mobile', 'iot/device/device/index', 'IoTDevice', 0, b'1', b'1', b'1', '', '2024-09-16 18:48:19', '1', '2024-12-14 11:39:30', b'0');
  2215 +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 (4009, '设备查询', 'iot:device:query', 3, 1, 4008, '', '', '', '', 0, b'1', b'1', b'1', '', '2024-09-16 18:48:19', '1', '2024-12-07 15:55:40', b'0');
  2216 +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 (4010, '设备创建', 'iot:device:create', 3, 2, 4008, '', '', '', '', 0, b'1', b'1', b'1', '', '2024-09-16 18:48:19', '1', '2024-12-07 15:55:41', b'0');
  2217 +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 (4011, '设备更新', 'iot:device:update', 3, 3, 4008, '', '', '', '', 0, b'1', b'1', b'1', '', '2024-09-16 18:48:19', '1', '2024-12-07 15:55:42', b'0');
  2218 +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 (4012, '设备删除', 'iot:device:delete', 3, 4, 4008, '', '', '', '', 0, b'1', b'1', b'1', '', '2024-09-16 18:48:19', '1', '2024-12-07 15:55:43', b'0');
  2219 +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 (4013, '设备导出', 'iot:device:export', 3, 5, 4008, '', '', '', '', 0, b'1', b'1', b'1', '', '2024-09-16 18:48:19', '1', '2024-12-07 15:55:44', b'0');
  2220 +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 (4014, '产品分类', '', 2, 1, 4001, 'product-category', 'ep:notebook', 'iot/product/category/index', 'IotProductCategory', 0, b'1', b'1', b'1', '', '2024-12-07 16:01:35', '1', '2024-12-07 16:31:52', b'0');
  2221 +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 (4015, '产品分类查询', 'iot:product-category:query', 3, 1, 4014, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-12-07 16:01:35', '', '2024-12-07 16:01:35', b'0');
  2222 +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 (4016, '产品分类创建', 'iot:product-category:create', 3, 2, 4014, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-12-07 16:01:35', '', '2024-12-07 16:01:35', b'0');
  2223 +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 (4017, '产品分类更新', 'iot:product-category:update', 3, 3, 4014, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-12-07 16:01:35', '', '2024-12-07 16:01:35', b'0');
  2224 +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 (4018, '产品分类删除', 'iot:product-category:delete', 3, 4, 4014, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-12-07 16:01:35', '', '2024-12-07 16:01:35', b'0');
  2225 +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 (4025, '插件管理', '', 2, 5, 4047, 'plugin-config', 'ep:folder-opened', 'iot/plugin/index', 'IoTPlugin', 0, b'1', b'1', b'1', '', '2024-12-09 21:25:06', '1', '2025-02-05 22:23:12', b'0');
  2226 +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 (4026, '插件查询', 'iot:plugin-config:query', 3, 1, 4025, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-12-09 21:25:06', '', '2025-02-05 21:23:20', b'0');
  2227 +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 (4027, '插件创建', 'iot:plugin-config:create', 3, 2, 4025, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-12-09 21:25:06', '', '2025-02-05 21:23:16', b'0');
  2228 +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 (4028, '插件更新', 'iot:plugin-config:update', 3, 3, 4025, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-12-09 21:25:06', '', '2025-02-05 21:23:12', b'0');
  2229 +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 (4029, '插件删除', 'iot:plugin-config:delete', 3, 4, 4025, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-12-09 21:25:06', '', '2025-02-05 21:23:09', b'0');
  2230 +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 (4030, '插件导出', 'iot:plugin-config:export', 3, 5, 4025, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-12-09 21:25:06', '', '2025-02-05 21:23:06', b'0');
  2231 +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 (4031, '设备分组', '', 2, 3, 4001, 'device-group', 'fa-solid:layer-group', 'iot/device/group/index', 'IotDeviceGroup', 0, b'1', b'1', b'1', '', '2024-12-14 17:08:29', '1', '2024-12-14 17:09:17', b'0');
  2232 +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 (4032, '设备分组查询', 'iot:device-group:query', 3, 1, 4031, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-12-14 17:08:29', '', '2024-12-14 17:08:29', b'0');
  2233 +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 (4033, '设备分组创建', 'iot:device-group:create', 3, 2, 4031, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-12-14 17:08:29', '', '2024-12-14 17:08:29', b'0');
  2234 +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 (4034, '设备分组更新', 'iot:device-group:update', 3, 3, 4031, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-12-14 17:08:29', '', '2024-12-14 17:08:29', b'0');
  2235 +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 (4035, '设备分组删除', 'iot:device-group:delete', 3, 4, 4031, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-12-14 17:08:29', '', '2024-12-14 17:08:29', b'0');
  2236 +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 (4036, '设备导入', 'iot:device:import', 3, 6, 4008, '', '', '', '', 0, b'1', b'1', b'1', '1', '2024-12-15 10:35:47', '1', '2024-12-15 10:35:47', b'0');
  2237 +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 (4037, '产品物模型', '', 2, 2, 4001, 'thing-model', 'ep:mostly-cloudy', 'iot/thingmodel/index', 'IoTThingModel', 0, b'0', b'0', b'0', '', '2024-12-16 17:17:50', '1', '2024-12-27 11:03:37', b'0');
  2238 +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 (4038, '产品物模型功能查询', 'iot:thing-model:query', 3, 1, 4037, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-12-16 17:17:51', '', '2025-03-17 09:14:54', b'0');
  2239 +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 (4039, '产品物模型功能创建', 'iot:thing-model:create', 3, 2, 4037, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-12-16 17:17:52', '', '2025-03-17 09:14:58', b'0');
  2240 +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 (4040, '产品物模型功能更新', 'iot:thing-model:update', 3, 3, 4037, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-12-16 17:17:52', '', '2025-03-17 09:15:03', b'0');
  2241 +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 (4041, '产品物模型功能删除', 'iot:thing-model:delete', 3, 4, 4037, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-12-16 17:17:52', '', '2025-03-17 09:15:06', b'0');
  2242 +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 (4042, '产品物模型功能导出', 'iot:thing-model:export', 3, 5, 4037, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2024-12-16 17:17:53', '', '2025-03-17 09:15:09', b'0');
  2243 +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 (4043, '设备上行', 'iot:device:upstream', 3, 7, 4008, '', '', '', '', 0, b'1', b'1', b'1', '1', '2025-01-28 04:40:16', '1', '2025-01-31 22:45:53', b'0');
  2244 +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 (4044, '设备属性查询', 'iot:device:property-query', 3, 10, 4008, '', '', '', '', 0, b'1', b'1', b'1', '1', '2025-01-28 11:52:54', '1', '2025-01-28 11:52:54', b'0');
  2245 +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 (4045, '设备日志查询', 'iot:device:log-query', 3, 11, 4008, '', '', '', '', 0, b'1', b'1', b'1', '1', '2025-01-28 11:53:22', '1', '2025-01-28 11:53:22', b'0');
  2246 +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 (4046, '设备下行', 'iot:device:downstream', 3, 8, 4008, '', '', '', '', 0, b'1', b'1', b'1', '1', '2025-01-31 22:46:11', '1', '2025-01-31 22:46:11', b'0');
  2247 +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 (4047, '运维管理', '', 1, 2, 4000, 'operations', 'fa:cog', '', '', 0, b'1', b'1', b'1', '1', '2025-02-05 22:21:37', '1', '2025-02-05 22:22:53', b'0');
  2248 +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 (4048, '规则引擎', '', 1, 3, 4000, 'rule', 'fa-solid:cogs', '', '', 0, b'1', b'1', b'1', '1', '2025-02-11 14:10:54', '1', '2025-02-11 14:10:54', b'0');
  2249 +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 (4049, '场景联动', '', 2, 1, 4048, 'scene', 'ep:link', 'iot/rule/scene/index', 'Scene', 0, b'1', b'1', b'1', '1', '2025-02-11 14:12:44', '1', '2025-02-12 10:15:36', b'0');
  2250 +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 (4050, 'IoT首页', '', 2, 1, 4000, 'home', 'ep:home-filled', 'iot/home/index', 'IotHome', 0, b'1', b'1', b'1', '1', '2025-02-27 08:39:35', '1', '2025-02-27 08:40:28', b'0');
  2251 +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 (4051, '数据桥梁', '', 2, 0, 4048, 'data-bridge', 'ep:guide', 'iot/rule/databridge/index', 'IotDataBridge', 0, b'1', b'1', b'1', '', '2025-03-09 13:47:11', '1', '2025-03-09 13:47:51', b'0');
  2252 +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 (4052, 'IoT 数据桥梁查询', 'iot:data-bridge:query', 3, 1, 4051, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-03-09 13:47:11', '', '2025-03-09 13:47:11', b'0');
  2253 +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 (4053, 'IoT 数据桥梁创建', 'iot:data-bridge:create', 3, 2, 4051, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-03-09 13:47:11', '', '2025-03-09 13:47:11', b'0');
  2254 +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 (4054, 'IoT 数据桥梁更新', 'iot:data-bridge:update', 3, 3, 4051, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-03-09 13:47:11', '', '2025-03-09 13:47:11', b'0');
  2255 +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 (4055, 'IoT 数据桥梁删除', 'iot:data-bridge:delete', 3, 4, 4051, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-03-09 13:47:12', '', '2025-03-09 13:47:12', b'0');
  2256 +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 (4056, 'IoT 数据桥梁导出', 'iot:data-bridge:export', 3, 5, 4051, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-03-09 13:47:12', '', '2025-03-09 13:47:12', b'0');
2071 COMMIT; 2257 COMMIT;
2072 2258
2073 -- ---------------------------- 2259 -- ----------------------------
@@ -2189,7 +2375,7 @@ CREATE TABLE `system_oauth2_access_token` ( @@ -2189,7 +2375,7 @@ CREATE TABLE `system_oauth2_access_token` (
2189 PRIMARY KEY (`id`) USING BTREE, 2375 PRIMARY KEY (`id`) USING BTREE,
2190 INDEX `idx_access_token`(`access_token` ASC) USING BTREE, 2376 INDEX `idx_access_token`(`access_token` ASC) USING BTREE,
2191 INDEX `idx_refresh_token`(`refresh_token` ASC) USING BTREE 2377 INDEX `idx_refresh_token`(`refresh_token` ASC) USING BTREE
2192 -) ENGINE = InnoDB AUTO_INCREMENT = 13666 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 访问令牌'; 2378 +) ENGINE = InnoDB AUTO_INCREMENT = 13787 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 访问令牌';
2193 2379
2194 -- ---------------------------- 2380 -- ----------------------------
2195 -- Records of system_oauth2_access_token 2381 -- Records of system_oauth2_access_token
@@ -2311,7 +2497,7 @@ CREATE TABLE `system_oauth2_refresh_token` ( @@ -2311,7 +2497,7 @@ CREATE TABLE `system_oauth2_refresh_token` (
2311 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', 2497 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
2312 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', 2498 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
2313 PRIMARY KEY (`id`) USING BTREE 2499 PRIMARY KEY (`id`) USING BTREE
2314 -) ENGINE = InnoDB AUTO_INCREMENT = 1732 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 刷新令牌'; 2500 +) ENGINE = InnoDB AUTO_INCREMENT = 1735 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 刷新令牌';
2315 2501
2316 -- ---------------------------- 2502 -- ----------------------------
2317 -- Records of system_oauth2_refresh_token 2503 -- Records of system_oauth2_refresh_token
@@ -3326,7 +3512,7 @@ CREATE TABLE `system_sms_code` ( @@ -3326,7 +3512,7 @@ CREATE TABLE `system_sms_code` (
3326 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', 3512 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
3327 PRIMARY KEY (`id`) USING BTREE, 3513 PRIMARY KEY (`id`) USING BTREE,
3328 INDEX `idx_mobile`(`mobile` ASC) USING BTREE COMMENT '手机号' 3514 INDEX `idx_mobile`(`mobile` ASC) USING BTREE COMMENT '手机号'
3329 -) ENGINE = InnoDB AUTO_INCREMENT = 646 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '手机验证码'; 3515 +) ENGINE = InnoDB AUTO_INCREMENT = 649 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '手机验证码';
3330 3516
3331 -- ---------------------------- 3517 -- ----------------------------
3332 -- Records of system_sms_code 3518 -- Records of system_sms_code
@@ -3367,7 +3553,7 @@ CREATE TABLE `system_sms_log` ( @@ -3367,7 +3553,7 @@ CREATE TABLE `system_sms_log` (
3367 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', 3553 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
3368 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', 3554 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
3369 PRIMARY KEY (`id`) USING BTREE 3555 PRIMARY KEY (`id`) USING BTREE
3370 -) ENGINE = InnoDB AUTO_INCREMENT = 1255 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '短信日志'; 3556 +) ENGINE = InnoDB AUTO_INCREMENT = 1279 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '短信日志';
3371 3557
3372 -- ---------------------------- 3558 -- ----------------------------
3373 -- Records of system_sms_log 3559 -- Records of system_sms_log
@@ -3397,7 +3583,7 @@ CREATE TABLE `system_sms_template` ( @@ -3397,7 +3583,7 @@ CREATE TABLE `system_sms_template` (
3397 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', 3583 `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
3398 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', 3584 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
3399 PRIMARY KEY (`id`) USING BTREE 3585 PRIMARY KEY (`id`) USING BTREE
3400 -) ENGINE = InnoDB AUTO_INCREMENT = 18 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '短信模板'; 3586 +) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '短信模板';
3401 3587
3402 -- ---------------------------- 3588 -- ----------------------------
3403 -- Records of system_sms_template 3589 -- Records of system_sms_template
@@ -3416,6 +3602,7 @@ INSERT INTO `system_sms_template` (`id`, `type`, `status`, `code`, `name`, `cont @@ -3416,6 +3602,7 @@ INSERT INTO `system_sms_template` (`id`, `type`, `status`, `code`, `name`, `cont
3416 INSERT INTO `system_sms_template` (`id`, `type`, `status`, `code`, `name`, `content`, `params`, `remark`, `api_template_id`, `channel_id`, `channel_code`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (15, 1, 0, 'user-update-password', '会员用户 - 修改密码', '您的验证码{code},该验证码 5 分钟内有效,请勿泄漏于他人!', '[\"code\"]', '', 'null', 4, 'DEBUG_DING_TALK', '1', '2023-08-19 18:58:01', '1', '2023-08-19 11:34:18', b'0'); 3602 INSERT INTO `system_sms_template` (`id`, `type`, `status`, `code`, `name`, `content`, `params`, `remark`, `api_template_id`, `channel_id`, `channel_code`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (15, 1, 0, 'user-update-password', '会员用户 - 修改密码', '您的验证码{code},该验证码 5 分钟内有效,请勿泄漏于他人!', '[\"code\"]', '', 'null', 4, 'DEBUG_DING_TALK', '1', '2023-08-19 18:58:01', '1', '2023-08-19 11:34:18', b'0');
3417 INSERT INTO `system_sms_template` (`id`, `type`, `status`, `code`, `name`, `content`, `params`, `remark`, `api_template_id`, `channel_id`, `channel_code`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (16, 1, 0, 'user-reset-password', '会员用户 - 重置密码', '您的验证码{code},该验证码 5 分钟内有效,请勿泄漏于他人!', '[\"code\"]', '', 'null', 4, 'DEBUG_DING_TALK', '1', '2023-08-19 18:58:01', '1', '2023-12-02 22:35:27', b'0'); 3603 INSERT INTO `system_sms_template` (`id`, `type`, `status`, `code`, `name`, `content`, `params`, `remark`, `api_template_id`, `channel_id`, `channel_code`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (16, 1, 0, 'user-reset-password', '会员用户 - 重置密码', '您的验证码{code},该验证码 5 分钟内有效,请勿泄漏于他人!', '[\"code\"]', '', 'null', 4, 'DEBUG_DING_TALK', '1', '2023-08-19 18:58:01', '1', '2023-12-02 22:35:27', b'0');
3418 INSERT INTO `system_sms_template` (`id`, `type`, `status`, `code`, `name`, `content`, `params`, `remark`, `api_template_id`, `channel_id`, `channel_code`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (17, 2, 0, 'bpm_task_timeout', '【工作流】任务审批超时', '您收到了一条超时的待办任务:{processInstanceName}-{taskName},处理链接:{detailUrl}', '[\"processInstanceName\",\"taskName\",\"detailUrl\"]', '', 'X', 4, 'DEBUG_DING_TALK', '1', '2024-08-16 21:59:15', '1', '2024-08-16 21:59:34', b'0'); 3604 INSERT INTO `system_sms_template` (`id`, `type`, `status`, `code`, `name`, `content`, `params`, `remark`, `api_template_id`, `channel_id`, `channel_code`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (17, 2, 0, 'bpm_task_timeout', '【工作流】任务审批超时', '您收到了一条超时的待办任务:{processInstanceName}-{taskName},处理链接:{detailUrl}', '[\"processInstanceName\",\"taskName\",\"detailUrl\"]', '', 'X', 4, 'DEBUG_DING_TALK', '1', '2024-08-16 21:59:15', '1', '2024-08-16 21:59:34', b'0');
  3605 +INSERT INTO `system_sms_template` (`id`, `type`, `status`, `code`, `name`, `content`, `params`, `remark`, `api_template_id`, `channel_id`, `channel_code`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (18, 1, 0, 'admin-reset-password', '后台用户 - 忘记密码', '您的验证码{code},该验证码 5 分钟内有效,请勿泄漏于他人!', '[\"code\"]', '', 'null', 4, 'DEBUG_DING_TALK', '1', '2025-03-16 14:19:34', '1', '2025-03-16 14:19:45', b'0');
3419 COMMIT; 3606 COMMIT;
3420 3607
3421 -- ---------------------------- 3608 -- ----------------------------
@@ -3665,7 +3852,7 @@ CREATE TABLE `system_users` ( @@ -3665,7 +3852,7 @@ CREATE TABLE `system_users` (
3665 -- Records of system_users 3852 -- Records of system_users
3666 -- ---------------------------- 3853 -- ----------------------------
3667 BEGIN; 3854 BEGIN;
3668 -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,2]', 'aoteman@126.com', '18818260277', 2, 'http://test.yudao.iocoder.cn/bf2002b38950c904243be7c825d3f82e29f25a44526583c3fde2ebdff3a87f75.png', 0, '0:0:0:0:0:0:0:1', '2025-03-13 12:44:59', 'admin', '2021-01-05 17:03:47', NULL, '2025-03-13 12:44:59', b'0', 1); 3855 +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$04$Q3WCEQJbSZ0zT/7ryYTb3OgtrhwIZXu4ah5RQ5/YQDQ7DpW7N7oNa', '芋道源码', '管理员', 103, '[1,2]', 'aoteman@126.com', '18818260277', 2, 'http://test.yudao.iocoder.cn/bf2002b38950c904243be7c825d3f82e29f25a44526583c3fde2ebdff3a87f75.png', 0, '0:0:0:0:0:0:0:1', '2025-03-16 14:20:16', 'admin', '2021-01-05 17:03:47', NULL, '2025-03-16 14:20:16', b'0', 1);
3669 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$04$IgUse/ibRzAZ3rngCThmtemJeoh15Ux1TQ2hIMe4iwt/K3LcFHEda', '芋道', '不要吓我', 104, '[1]', 'yudao@iocoder.cn', '15601691300', 1, '', 0, '0:0:0:0:0:0:0:1', '2024-11-02 14:00:46', '', '2021-01-07 09:07:17', NULL, '2024-11-02 14:00:46', b'0', 1); 3856 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$04$IgUse/ibRzAZ3rngCThmtemJeoh15Ux1TQ2hIMe4iwt/K3LcFHEda', '芋道', '不要吓我', 104, '[1]', 'yudao@iocoder.cn', '15601691300', 1, '', 0, '0:0:0:0:0:0:0:1', '2024-11-02 14:00:46', '', '2021-01-07 09:07:17', NULL, '2024-11-02 14:00:46', b'0', 1);
3670 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$04$fUBSmjKCPYAUmnMzOb6qE.eZCGPhHi1JmAKclODbfS/O7fHOl2bH6', '源码', NULL, 106, NULL, 'yuanma@iocoder.cn', '15601701300', 0, '', 0, '0:0:0:0:0:0:0:1', '2024-08-11 17:48:12', '', '2021-01-13 23:50:35', NULL, '2024-08-11 17:48:12', b'0', 1); 3857 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$04$fUBSmjKCPYAUmnMzOb6qE.eZCGPhHi1JmAKclODbfS/O7fHOl2bH6', '源码', NULL, 106, NULL, 'yuanma@iocoder.cn', '15601701300', 0, '', 0, '0:0:0:0:0:0:0:1', '2024-08-11 17:48:12', '', '2021-01-13 23:50:35', NULL, '2024-08-11 17:48:12', b'0', 1);
3671 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$04$BrwaYn303hjA/6TnXqdGoOLhyHOAA0bVrAFu6.1dJKycqKUnIoRz2', '测试号', NULL, 107, '[1,2]', '111@qq.com', '15601691200', 1, '', 0, '0:0:0:0:0:0:0:1', '2025-01-04 10:40:49', '', '2021-01-21 02:13:53', NULL, '2025-01-04 10:40:49', b'0', 1); 3858 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$04$BrwaYn303hjA/6TnXqdGoOLhyHOAA0bVrAFu6.1dJKycqKUnIoRz2', '测试号', NULL, 107, '[1,2]', '111@qq.com', '15601691200', 1, '', 0, '0:0:0:0:0:0:0:1', '2025-01-04 10:40:49', '', '2021-01-21 02:13:53', NULL, '2025-01-04 10:40:49', b'0', 1);
yudao-dependencies/pom.xml
@@ -32,8 +32,9 @@ @@ -32,8 +32,9 @@
32 <dm8.jdbc.version>8.1.3.140</dm8.jdbc.version> 32 <dm8.jdbc.version>8.1.3.140</dm8.jdbc.version>
33 <kingbase.jdbc.version>8.6.0</kingbase.jdbc.version> 33 <kingbase.jdbc.version>8.6.0</kingbase.jdbc.version>
34 <opengauss.jdbc.version>5.1.0</opengauss.jdbc.version> 34 <opengauss.jdbc.version>5.1.0</opengauss.jdbc.version>
  35 + <taos.version>3.3.3</taos.version>
35 <!-- 消息队列 --> 36 <!-- 消息队列 -->
36 - <rocketmq-spring.version>2.3.1</rocketmq-spring.version> 37 + <rocketmq-spring.version>2.3.2</rocketmq-spring.version>
37 <!-- 服务保障相关 --> 38 <!-- 服务保障相关 -->
38 <lock4j.version>2.2.7</lock4j.version> 39 <lock4j.version>2.2.7</lock4j.version>
39 <!-- 监控相关 --> 40 <!-- 监控相关 -->
@@ -53,25 +54,27 @@ @@ -53,25 +54,27 @@
53 <mapstruct.version>1.6.3</mapstruct.version> 54 <mapstruct.version>1.6.3</mapstruct.version>
54 <hutool-5.version>5.8.35</hutool-5.version> 55 <hutool-5.version>5.8.35</hutool-5.version>
55 <hutool-6.version>6.0.0-M19</hutool-6.version> 56 <hutool-6.version>6.0.0-M19</hutool-6.version>
56 - <easyexcel.verion>4.0.3</easyexcel.verion> 57 + <easyexcel.version>4.0.3</easyexcel.version>
57 <velocity.version>2.4.1</velocity.version> 58 <velocity.version>2.4.1</velocity.version>
58 <fastjson.version>1.2.83</fastjson.version> 59 <fastjson.version>1.2.83</fastjson.version>
59 <guava.version>33.4.0-jre</guava.version> 60 <guava.version>33.4.0-jre</guava.version>
60 <transmittable-thread-local.version>2.14.5</transmittable-thread-local.version> 61 <transmittable-thread-local.version>2.14.5</transmittable-thread-local.version>
61 <commons-net.version>3.11.1</commons-net.version> 62 <commons-net.version>3.11.1</commons-net.version>
62 <jsch.version>0.1.55</jsch.version> 63 <jsch.version>0.1.55</jsch.version>
63 - <tika-core.version>3.1.0</tika-core.version> <!-- TODO 芋艿:升级后,需要看看 jdk8 的兼容性;也要同步 cloud --> 64 + <tika-core.version>3.1.0</tika-core.version>
64 <ip2region.version>2.7.0</ip2region.version> 65 <ip2region.version>2.7.0</ip2region.version>
65 <bizlog-sdk.version>3.0.6</bizlog-sdk.version> 66 <bizlog-sdk.version>3.0.6</bizlog-sdk.version>
66 <netty.version>4.1.116.Final</netty.version> 67 <netty.version>4.1.116.Final</netty.version>
67 <mqtt.version>1.2.5</mqtt.version> 68 <mqtt.version>1.2.5</mqtt.version>
  69 + <pf4j-spring.version>0.9.0</pf4j-spring.version>
  70 + <vertx.version>4.5.13</vertx.version>
68 <!-- 三方云服务相关 --> 71 <!-- 三方云服务相关 -->
69 <commons-io.version>2.17.0</commons-io.version> 72 <commons-io.version>2.17.0</commons-io.version>
70 <commons-compress.version>1.27.1</commons-compress.version> 73 <commons-compress.version>1.27.1</commons-compress.version>
71 <aws-java-sdk-s3.version>1.12.777</aws-java-sdk-s3.version> 74 <aws-java-sdk-s3.version>1.12.777</aws-java-sdk-s3.version>
72 <justauth.version>2.0.5</justauth.version> 75 <justauth.version>2.0.5</justauth.version>
73 <jimureport.version>1.8.1</jimureport.version> 76 <jimureport.version>1.8.1</jimureport.version>
74 - <weixin-java.version>4.6.0</weixin-java.version> 77 + <weixin-java.version>4.7.2.B</weixin-java.version>
75 </properties> 78 </properties>
76 79
77 <dependencyManagement> 80 <dependencyManagement>
@@ -263,6 +266,12 @@ @@ -263,6 +266,12 @@
263 <version>${kingbase.jdbc.version}</version> 266 <version>${kingbase.jdbc.version}</version>
264 </dependency> 267 </dependency>
265 268
  269 + <dependency>
  270 + <groupId>com.taosdata.jdbc</groupId>
  271 + <artifactId>taos-jdbcdriver</artifactId>
  272 + <version>${taos.version}</version>
  273 + </dependency>
  274 +
266 <!-- Job 定时任务相关 --> 275 <!-- Job 定时任务相关 -->
267 <dependency> 276 <dependency>
268 <groupId>cn.iocoder.boot</groupId> 277 <groupId>cn.iocoder.boot</groupId>
@@ -276,7 +285,6 @@ @@ -276,7 +285,6 @@
276 <artifactId>yudao-spring-boot-starter-mq</artifactId> 285 <artifactId>yudao-spring-boot-starter-mq</artifactId>
277 <version>${revision}</version> 286 <version>${revision}</version>
278 </dependency> 287 </dependency>
279 -  
280 <dependency> 288 <dependency>
281 <groupId>org.apache.rocketmq</groupId> 289 <groupId>org.apache.rocketmq</groupId>
282 <artifactId>rocketmq-spring-boot-starter</artifactId> 290 <artifactId>rocketmq-spring-boot-starter</artifactId>
@@ -471,7 +479,7 @@ @@ -471,7 +479,7 @@
471 <dependency> 479 <dependency>
472 <groupId>com.alibaba</groupId> 480 <groupId>com.alibaba</groupId>
473 <artifactId>easyexcel</artifactId> 481 <artifactId>easyexcel</artifactId>
474 - <version>${easyexcel.verion}</version> 482 + <version>${easyexcel.version}</version>
475 </dependency> 483 </dependency>
476 <dependency> 484 <dependency>
477 <groupId>commons-io</groupId> 485 <groupId>commons-io</groupId>
@@ -591,6 +599,36 @@ @@ -591,6 +599,36 @@
591 </exclusions> 599 </exclusions>
592 </dependency> 600 </dependency>
593 601
  602 + <!-- PF4J -->
  603 + <dependency>
  604 + <groupId>org.pf4j</groupId>
  605 + <artifactId>pf4j-spring</artifactId>
  606 + <version>${pf4j-spring.version}</version>
  607 + <exclusions>
  608 + <exclusion>
  609 + <groupId>org.slf4j</groupId>
  610 + <artifactId>slf4j-log4j12</artifactId>
  611 + </exclusion>
  612 + </exclusions>
  613 + </dependency>
  614 +
  615 + <!-- Vert.x -->
  616 + <dependency>
  617 + <groupId>io.vertx</groupId>
  618 + <artifactId>vertx-core</artifactId>
  619 + <version>${vertx.version}</version>
  620 + </dependency>
  621 + <dependency>
  622 + <groupId>io.vertx</groupId>
  623 + <artifactId>vertx-web</artifactId>
  624 + <version>${vertx.version}</version>
  625 + </dependency>
  626 + <dependency>
  627 + <groupId>io.vertx</groupId>
  628 + <artifactId>vertx-mqtt</artifactId>
  629 + <version>${vertx.version}</version>
  630 + </dependency>
  631 +
594 <!-- MQTT --> 632 <!-- MQTT -->
595 <dependency> 633 <dependency>
596 <groupId>org.eclipse.paho</groupId> 634 <groupId>org.eclipse.paho</groupId>
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/enums/RpcConstants.java 0 → 100644
  1 +package cn.iocoder.yudao.framework.common.enums;
  2 +
  3 +/**
  4 + * RPC 相关的枚举
  5 + *
  6 + * 虽然放在 yudao-spring-boot-starter-rpc 会相对合适,但是每个 API 模块需要使用到,所以暂时只好放在此处
  7 + *
  8 + * @author 芋道源码
  9 + */
  10 +public class RpcConstants {
  11 +
  12 + /**
  13 + * RPC API 的前缀
  14 + */
  15 + public static final String RPC_API_PREFIX = "/rpc-api";
  16 +
  17 +}
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/http/HttpUtils.java
@@ -7,13 +7,15 @@ import cn.hutool.core.util.ReflectUtil; @@ -7,13 +7,15 @@ import cn.hutool.core.util.ReflectUtil;
7 import cn.hutool.core.util.StrUtil; 7 import cn.hutool.core.util.StrUtil;
8 import cn.hutool.http.HttpRequest; 8 import cn.hutool.http.HttpRequest;
9 import cn.hutool.http.HttpResponse; 9 import cn.hutool.http.HttpResponse;
  10 +import jakarta.servlet.http.HttpServletRequest;
10 import org.springframework.util.StringUtils; 11 import org.springframework.util.StringUtils;
11 import org.springframework.web.util.UriComponents; 12 import org.springframework.web.util.UriComponents;
12 import org.springframework.web.util.UriComponentsBuilder; 13 import org.springframework.web.util.UriComponentsBuilder;
13 14
14 -import jakarta.servlet.http.HttpServletRequest;  
15 import java.net.URI; 15 import java.net.URI;
  16 +import java.net.URLEncoder;
16 import java.nio.charset.Charset; 17 import java.nio.charset.Charset;
  18 +import java.nio.charset.StandardCharsets;
17 import java.util.Map; 19 import java.util.Map;
18 20
19 /** 21 /**
@@ -23,6 +25,16 @@ import java.util.Map; @@ -23,6 +25,16 @@ import java.util.Map;
23 */ 25 */
24 public class HttpUtils { 26 public class HttpUtils {
25 27
  28 + /**
  29 + * 编码 URL 参数
  30 + *
  31 + * @param value 参数
  32 + * @return 编码后的参数
  33 + */
  34 + public static String encodeUtf8(String value) {
  35 + return URLEncoder.encode(value, StandardCharsets.UTF_8);
  36 + }
  37 +
26 @SuppressWarnings("unchecked") 38 @SuppressWarnings("unchecked")
27 public static String replaceUrlQuery(String url, String key, String value) { 39 public static String replaceUrlQuery(String url, String key, String value) {
28 UrlBuilder builder = UrlBuilder.of(url, Charset.defaultCharset()); 40 UrlBuilder builder = UrlBuilder.of(url, Charset.defaultCharset());
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/number/NumberUtils.java
1 package cn.iocoder.yudao.framework.common.util.number; 1 package cn.iocoder.yudao.framework.common.util.number;
2 2
  3 +import cn.hutool.core.collection.CollUtil;
3 import cn.hutool.core.util.NumberUtil; 4 import cn.hutool.core.util.NumberUtil;
4 import cn.hutool.core.util.StrUtil; 5 import cn.hutool.core.util.StrUtil;
5 6
6 import java.math.BigDecimal; 7 import java.math.BigDecimal;
  8 +import java.util.List;
7 9
8 /** 10 /**
9 * 数字的工具类,补全 {@link cn.hutool.core.util.NumberUtil} 的功能 11 * 数字的工具类,补全 {@link cn.hutool.core.util.NumberUtil} 的功能
@@ -20,6 +22,18 @@ public class NumberUtils { @@ -20,6 +22,18 @@ public class NumberUtils {
20 return StrUtil.isNotEmpty(str) ? Integer.valueOf(str) : null; 22 return StrUtil.isNotEmpty(str) ? Integer.valueOf(str) : null;
21 } 23 }
22 24
  25 + public static boolean isAllNumber(List<String> values) {
  26 + if (CollUtil.isEmpty(values)) {
  27 + return false;
  28 + }
  29 + for (String value : values) {
  30 + if (!NumberUtil.isNumber(value)) {
  31 + return false;
  32 + }
  33 + }
  34 + return true;
  35 + }
  36 +
23 /** 37 /**
24 * 通过经纬度获取地球上两点之间的距离 38 * 通过经纬度获取地球上两点之间的距离
25 * 39 *
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/servlet/ServletUtils.java
@@ -98,4 +98,8 @@ public class ServletUtils { @@ -98,4 +98,8 @@ public class ServletUtils {
98 return JakartaServletUtil.getParamMap(request); 98 return JakartaServletUtil.getParamMap(request);
99 } 99 }
100 100
  101 + public static Map<String, String> getHeaderMap(HttpServletRequest request) {
  102 + return JakartaServletUtil.getHeaderMap(request);
  103 + }
  104 +
101 } 105 }
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/spring/SpringExpressionUtils.java
@@ -97,12 +97,26 @@ public class SpringExpressionUtils { @@ -97,12 +97,26 @@ public class SpringExpressionUtils {
97 * @return 执行界面 97 * @return 执行界面
98 */ 98 */
99 public static Object parseExpression(String expressionString) { 99 public static Object parseExpression(String expressionString) {
  100 + return parseExpression(expressionString, null);
  101 + }
  102 +
  103 + /**
  104 + * 从 Bean 工厂,解析 EL 表达式的结果
  105 + *
  106 + * @param expressionString EL 表达式
  107 + * @param variables 变量
  108 + * @return 执行界面
  109 + */
  110 + public static Object parseExpression(String expressionString, Map<String, Object> variables) {
100 if (StrUtil.isBlank(expressionString)) { 111 if (StrUtil.isBlank(expressionString)) {
101 return null; 112 return null;
102 } 113 }
103 Expression expression = EXPRESSION_PARSER.parseExpression(expressionString); 114 Expression expression = EXPRESSION_PARSER.parseExpression(expressionString);
104 StandardEvaluationContext context = new StandardEvaluationContext(); 115 StandardEvaluationContext context = new StandardEvaluationContext();
105 context.setBeanResolver(new BeanFactoryResolver(SpringUtil.getApplicationContext())); 116 context.setBeanResolver(new BeanFactoryResolver(SpringUtil.getApplicationContext()));
  117 + if (MapUtil.isNotEmpty(variables)) {
  118 + context.setVariables(variables);
  119 + }
106 return expression.getValue(context); 120 return expression.getValue(context);
107 } 121 }
108 122
yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/util/TenantUtils.java
@@ -45,6 +45,7 @@ public class TenantUtils { @@ -45,6 +45,7 @@ public class TenantUtils {
45 * 45 *
46 * @param tenantId 租户编号 46 * @param tenantId 租户编号
47 * @param callable 逻辑 47 * @param callable 逻辑
  48 + * @return 结果
48 */ 49 */
49 public static <V> V execute(Long tenantId, Callable<V> callable) { 50 public static <V> V execute(Long tenantId, Callable<V> callable) {
50 Long oldTenantId = TenantContextHolder.getTenantId(); 51 Long oldTenantId = TenantContextHolder.getTenantId();
@@ -79,6 +80,25 @@ public class TenantUtils { @@ -79,6 +80,25 @@ public class TenantUtils {
79 } 80 }
80 81
81 /** 82 /**
  83 + * 忽略租户,执行对应的逻辑
  84 + *
  85 + * @param callable 逻辑
  86 + * @return 结果
  87 + */
  88 + public static <V> V executeIgnore(Callable<V> callable) {
  89 + Boolean oldIgnore = TenantContextHolder.isIgnore();
  90 + try {
  91 + TenantContextHolder.setIgnore(true);
  92 + // 执行逻辑
  93 + return callable.call();
  94 + } catch (Exception e) {
  95 + throw new RuntimeException(e);
  96 + } finally {
  97 + TenantContextHolder.setIgnore(oldIgnore);
  98 + }
  99 + }
  100 +
  101 + /**
82 * 将多租户编号,添加到 header 中 102 * 将多租户编号,添加到 header 中
83 * 103 *
84 * @param headers HTTP 请求 headers 104 * @param headers HTTP 请求 headers
yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/util/ExcelUtils.java
1 package cn.iocoder.yudao.framework.excel.core.util; 1 package cn.iocoder.yudao.framework.excel.core.util;
2 2
  3 +import cn.iocoder.yudao.framework.common.util.http.HttpUtils;
3 import cn.iocoder.yudao.framework.excel.core.handler.SelectSheetWriteHandler; 4 import cn.iocoder.yudao.framework.excel.core.handler.SelectSheetWriteHandler;
4 import com.alibaba.excel.EasyExcel; 5 import com.alibaba.excel.EasyExcel;
5 import com.alibaba.excel.converters.longconverter.LongStringConverter; 6 import com.alibaba.excel.converters.longconverter.LongStringConverter;
@@ -8,8 +9,6 @@ import jakarta.servlet.http.HttpServletResponse; @@ -8,8 +9,6 @@ import jakarta.servlet.http.HttpServletResponse;
8 import org.springframework.web.multipart.MultipartFile; 9 import org.springframework.web.multipart.MultipartFile;
9 10
10 import java.io.IOException; 11 import java.io.IOException;
11 -import java.net.URLEncoder;  
12 -import java.nio.charset.StandardCharsets;  
13 import java.util.List; 12 import java.util.List;
14 13
15 /** 14 /**
@@ -40,7 +39,7 @@ public class ExcelUtils { @@ -40,7 +39,7 @@ public class ExcelUtils {
40 .registerConverter(new LongStringConverter()) // 避免 Long 类型丢失精度 39 .registerConverter(new LongStringConverter()) // 避免 Long 类型丢失精度
41 .sheet(sheetName).doWrite(data); 40 .sheet(sheetName).doWrite(data);
42 // 设置 header 和 contentType。写在最后的原因是,避免报错时,响应 contentType 已经被修改了 41 // 设置 header 和 contentType。写在最后的原因是,避免报错时,响应 contentType 已经被修改了
43 - response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename, StandardCharsets.UTF_8.name())); 42 + response.addHeader("Content-Disposition", "attachment;filename=" + HttpUtils.encodeUtf8(filename));
44 response.setContentType("application/vnd.ms-excel;charset=UTF-8"); 43 response.setContentType("application/vnd.ms-excel;charset=UTF-8");
45 } 44 }
46 45
yudao-framework/yudao-spring-boot-starter-mybatis/pom.xml
@@ -63,6 +63,11 @@ @@ -63,6 +63,11 @@
63 <artifactId>opengauss-jdbc</artifactId> 63 <artifactId>opengauss-jdbc</artifactId>
64 <optional>true</optional> 64 <optional>true</optional>
65 </dependency> 65 </dependency>
  66 + <dependency>
  67 + <groupId>com.taosdata.jdbc</groupId>
  68 + <artifactId>taos-jdbcdriver</artifactId>
  69 + <optional>true</optional>
  70 + </dependency>
66 71
67 <dependency> 72 <dependency>
68 <groupId>com.alibaba</groupId> 73 <groupId>com.alibaba</groupId>
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/mapper/BaseMapperX.java
@@ -92,10 +92,36 @@ public interface BaseMapperX&lt;T&gt; extends MPJBaseMapper&lt;T&gt; { @@ -92,10 +92,36 @@ public interface BaseMapperX&lt;T&gt; extends MPJBaseMapper&lt;T&gt; {
92 92
93 default T selectOne(SFunction<T, ?> field1, Object value1, SFunction<T, ?> field2, Object value2, 93 default T selectOne(SFunction<T, ?> field1, Object value1, SFunction<T, ?> field2, Object value2,
94 SFunction<T, ?> field3, Object value3) { 94 SFunction<T, ?> field3, Object value3) {
95 - return selectOne(new LambdaQueryWrapper<T>().eq(field1, value1).eq(field2, value2)  
96 - .eq(field3, value3)); 95 + return selectOne(new LambdaQueryWrapper<T>().eq(field1, value1).eq(field2, value2).eq(field3, value3));
97 } 96 }
98 97
  98 + /**
  99 + * 获取满足条件的第 1 条记录
  100 + *
  101 + * 目的:解决并发场景下,插入多条记录后,使用 selectOne 会报错的问题
  102 + *
  103 + * @param field 字段名
  104 + * @param value 字段值
  105 + * @return 实体
  106 + */
  107 + default T selectFirstOne(SFunction<T, ?> field, Object value) {
  108 + // 如果明确使用 MySQL 等场景,可以考虑使用 LIMIT 1 进行优化
  109 + List<T> list = selectList(new LambdaQueryWrapper<T>().eq(field, value));
  110 + return CollUtil.getFirst(list);
  111 + }
  112 +
  113 + default T selectFirstOne(SFunction<T, ?> field1, Object value1, SFunction<T, ?> field2, Object value2) {
  114 + List<T> list = selectList(new LambdaQueryWrapper<T>().eq(field1, value1).eq(field2, value2));
  115 + return CollUtil.getFirst(list);
  116 + }
  117 +
  118 + default T selectFirstOne(SFunction<T,?> field1, Object value1, SFunction<T,?> field2, Object value2,
  119 + SFunction<T,?> field3, Object value3) {
  120 + List<T> list = selectList(new LambdaQueryWrapper<T>().eq(field1, value1).eq(field2, value2).eq(field3, value3));
  121 + return CollUtil.getFirst(list);
  122 + }
  123 +
  124 +
99 default Long selectCount() { 125 default Long selectCount() {
100 return selectCount(new QueryWrapper<>()); 126 return selectCount(new QueryWrapper<>());
101 } 127 }
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/type/EncryptTypeHandler.java
@@ -13,7 +13,7 @@ import java.sql.ResultSet; @@ -13,7 +13,7 @@ import java.sql.ResultSet;
13 import java.sql.SQLException; 13 import java.sql.SQLException;
14 14
15 /** 15 /**
16 - * 字段字段的 TypeHandler 实现类,基于 {@link cn.hutool.crypto.symmetric.AES} 实现 16 + * 字段字段的 TypeHandler 实现类,基于 {@link AES} 实现
17 * 可通过 jasypt.encryptor.password 配置项,设置密钥 17 * 可通过 jasypt.encryptor.password 配置项,设置密钥
18 * 18 *
19 * @author 芋道源码 19 * @author 芋道源码
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/type/LongSetTypeHandler.java 0 → 100644
  1 +package cn.iocoder.yudao.framework.mybatis.core.type;
  2 +
  3 +import cn.hutool.core.collection.CollUtil;
  4 +import cn.iocoder.yudao.framework.common.util.string.StrUtils;
  5 +import org.apache.ibatis.type.JdbcType;
  6 +import org.apache.ibatis.type.MappedJdbcTypes;
  7 +import org.apache.ibatis.type.MappedTypes;
  8 +import org.apache.ibatis.type.TypeHandler;
  9 +
  10 +import java.sql.CallableStatement;
  11 +import java.sql.PreparedStatement;
  12 +import java.sql.ResultSet;
  13 +import java.sql.SQLException;
  14 +import java.util.List;
  15 +import java.util.Set;
  16 +
  17 +/**
  18 + * Set<Long> 的类型转换器实现类,对应数据库的 varchar 类型
  19 + *
  20 + * @author 芋道源码
  21 + */
  22 +@MappedJdbcTypes(JdbcType.VARCHAR)
  23 +@MappedTypes(List.class)
  24 +public class LongSetTypeHandler implements TypeHandler<Set<Long>> {
  25 +
  26 + private static final String COMMA = ",";
  27 +
  28 + @Override
  29 + public void setParameter(PreparedStatement ps, int i, Set<Long> strings, JdbcType jdbcType) throws SQLException {
  30 + // 设置占位符
  31 + ps.setString(i, CollUtil.join(strings, COMMA));
  32 + }
  33 +
  34 + @Override
  35 + public Set<Long> getResult(ResultSet rs, String columnName) throws SQLException {
  36 + String value = rs.getString(columnName);
  37 + return getResult(value);
  38 + }
  39 +
  40 + @Override
  41 + public Set<Long> getResult(ResultSet rs, int columnIndex) throws SQLException {
  42 + String value = rs.getString(columnIndex);
  43 + return getResult(value);
  44 + }
  45 +
  46 + @Override
  47 + public Set<Long> getResult(CallableStatement cs, int columnIndex) throws SQLException {
  48 + String value = cs.getString(columnIndex);
  49 + return getResult(value);
  50 + }
  51 +
  52 + private Set<Long> getResult(String value) {
  53 + if (value == null) {
  54 + return null;
  55 + }
  56 + return StrUtils.splitToLongSet(value, COMMA);
  57 + }
  58 +}
yudao-framework/yudao-spring-boot-starter-protection/src/main/java/cn/iocoder/yudao/framework/ratelimiter/core/redis/RateLimiterRedisDAO.java
@@ -44,6 +44,7 @@ public class RateLimiterRedisDAO { @@ -44,6 +44,7 @@ public class RateLimiterRedisDAO {
44 RateLimiterConfig config = rateLimiter.getConfig(); 44 RateLimiterConfig config = rateLimiter.getConfig();
45 if (config == null) { 45 if (config == null) {
46 rateLimiter.trySetRate(RateType.OVERALL, count, rateInterval, RateIntervalUnit.SECONDS); 46 rateLimiter.trySetRate(RateType.OVERALL, count, rateInterval, RateIntervalUnit.SECONDS);
  47 + rateLimiter.expire(rateInterval, TimeUnit.SECONDS); // 原因参见 https://t.zsxq.com/lcR0W
47 return rateLimiter; 48 return rateLimiter;
48 } 49 }
49 // 2. 如果存在,并且配置相同,则直接返回 50 // 2. 如果存在,并且配置相同,则直接返回
@@ -54,6 +55,7 @@ public class RateLimiterRedisDAO { @@ -54,6 +55,7 @@ public class RateLimiterRedisDAO {
54 } 55 }
55 // 3. 如果存在,并且配置不同,则进行新建 56 // 3. 如果存在,并且配置不同,则进行新建
56 rateLimiter.setRate(RateType.OVERALL, count, rateInterval, RateIntervalUnit.SECONDS); 57 rateLimiter.setRate(RateType.OVERALL, count, rateInterval, RateIntervalUnit.SECONDS);
  58 + rateLimiter.expire(rateInterval, TimeUnit.SECONDS); // 原因参见 https://t.zsxq.com/lcR0W
57 return rateLimiter; 59 return rateLimiter;
58 } 60 }
59 61
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/banner/core/BannerApplicationRunner.java
@@ -62,9 +62,9 @@ public class BannerApplicationRunner implements ApplicationRunner { @@ -62,9 +62,9 @@ public class BannerApplicationRunner implements ApplicationRunner {
62 if (isNotPresent("cn.iocoder.yudao.module.ai.framework.web.config.AiWebConfiguration")) { 62 if (isNotPresent("cn.iocoder.yudao.module.ai.framework.web.config.AiWebConfiguration")) {
63 System.out.println("[AI 大模型 yudao-module-ai - 已禁用][参考 https://doc.iocoder.cn/ai/build/ 开启]"); 63 System.out.println("[AI 大模型 yudao-module-ai - 已禁用][参考 https://doc.iocoder.cn/ai/build/ 开启]");
64 } 64 }
65 - // IOT 物联网 65 + // IoT 物联网
66 if (isNotPresent("cn.iocoder.yudao.module.iot.framework.web.config.IotWebConfiguration")) { 66 if (isNotPresent("cn.iocoder.yudao.module.iot.framework.web.config.IotWebConfiguration")) {
67 - System.out.println("[IOT 物联网 yudao-module-iot - 已禁用][参考 https://doc.iocoder.cn/iot/build/ 开启]"); 67 + System.out.println("[IoT 物联网 yudao-module-iot - 已禁用][参考 https://doc.iocoder.cn/iot/build/ 开启]");
68 } 68 }
69 }); 69 });
70 } 70 }
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java
1 package cn.iocoder.yudao.framework.web.core.handler; 1 package cn.iocoder.yudao.framework.web.core.handler;
2 2
  3 +import cn.hutool.core.collection.CollUtil;
3 import cn.hutool.core.exceptions.ExceptionUtil; 4 import cn.hutool.core.exceptions.ExceptionUtil;
4 import cn.hutool.core.map.MapUtil; 5 import cn.hutool.core.map.MapUtil;
5 import cn.hutool.core.util.ObjUtil; 6 import cn.hutool.core.util.ObjUtil;
@@ -27,6 +28,7 @@ import org.springframework.security.access.AccessDeniedException; @@ -27,6 +28,7 @@ import org.springframework.security.access.AccessDeniedException;
27 import org.springframework.util.Assert; 28 import org.springframework.util.Assert;
28 import org.springframework.validation.BindException; 29 import org.springframework.validation.BindException;
29 import org.springframework.validation.FieldError; 30 import org.springframework.validation.FieldError;
  31 +import org.springframework.validation.ObjectError;
30 import org.springframework.web.HttpRequestMethodNotSupportedException; 32 import org.springframework.web.HttpRequestMethodNotSupportedException;
31 import org.springframework.web.bind.MethodArgumentNotValidException; 33 import org.springframework.web.bind.MethodArgumentNotValidException;
32 import org.springframework.web.bind.MissingServletRequestParameterException; 34 import org.springframework.web.bind.MissingServletRequestParameterException;
@@ -37,6 +39,7 @@ import org.springframework.web.servlet.NoHandlerFoundException; @@ -37,6 +39,7 @@ import org.springframework.web.servlet.NoHandlerFoundException;
37 import org.springframework.web.servlet.resource.NoResourceFoundException; 39 import org.springframework.web.servlet.resource.NoResourceFoundException;
38 40
39 import java.time.LocalDateTime; 41 import java.time.LocalDateTime;
  42 +import java.util.List;
40 import java.util.Map; 43 import java.util.Map;
41 import java.util.Set; 44 import java.util.Set;
42 45
@@ -135,9 +138,23 @@ public class GlobalExceptionHandler { @@ -135,9 +138,23 @@ public class GlobalExceptionHandler {
135 @ExceptionHandler(MethodArgumentNotValidException.class) 138 @ExceptionHandler(MethodArgumentNotValidException.class)
136 public CommonResult<?> methodArgumentNotValidExceptionExceptionHandler(MethodArgumentNotValidException ex) { 139 public CommonResult<?> methodArgumentNotValidExceptionExceptionHandler(MethodArgumentNotValidException ex) {
137 log.warn("[methodArgumentNotValidExceptionExceptionHandler]", ex); 140 log.warn("[methodArgumentNotValidExceptionExceptionHandler]", ex);
  141 + // 获取 errorMessage
  142 + String errorMessage = null;
138 FieldError fieldError = ex.getBindingResult().getFieldError(); 143 FieldError fieldError = ex.getBindingResult().getFieldError();
139 - assert fieldError != null; // 断言,避免告警  
140 - return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数不正确:%s", fieldError.getDefaultMessage())); 144 + if (fieldError == null) {
  145 + // 组合校验,参考自 https://t.zsxq.com/3HVTx
  146 + List<ObjectError> allErrors = ex.getBindingResult().getAllErrors();
  147 + if (CollUtil.isNotEmpty(allErrors)) {
  148 + errorMessage = allErrors.get(0).getDefaultMessage();
  149 + }
  150 + } else {
  151 + errorMessage = fieldError.getDefaultMessage();
  152 + }
  153 + // 转换 CommonResult
  154 + if (StrUtil.isEmpty(errorMessage)) {
  155 + return CommonResult.error(BAD_REQUEST);
  156 + }
  157 + return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数不正确:%s", errorMessage));
141 } 158 }
142 159
143 /** 160 /**
@@ -378,11 +395,11 @@ public class GlobalExceptionHandler { @@ -378,11 +395,11 @@ public class GlobalExceptionHandler {
378 return CommonResult.error(NOT_IMPLEMENTED.getCode(), 395 return CommonResult.error(NOT_IMPLEMENTED.getCode(),
379 "[AI 大模型 yudao-module-ai - 表结构未导入][参考 https://cloud.iocoder.cn/ai/build/ 开启]"); 396 "[AI 大模型 yudao-module-ai - 表结构未导入][参考 https://cloud.iocoder.cn/ai/build/ 开启]");
380 } 397 }
381 - // 9. IOT 物联网 398 + // 9. IoT 物联网
382 if (message.contains("iot_")) { 399 if (message.contains("iot_")) {
383 - log.error("[IOT 物联网 yudao-module-iot - 表结构未导入][参考 https://doc.iocoder.cn/iot/build/ 开启]"); 400 + log.error("[IoT 物联网 yudao-module-iot - 表结构未导入][参考 https://doc.iocoder.cn/iot/build/ 开启]");
384 return CommonResult.error(NOT_IMPLEMENTED.getCode(), 401 return CommonResult.error(NOT_IMPLEMENTED.getCode(),
385 - "[IOT 物联网 yudao-module-iot - 表结构未导入][参考 https://doc.iocoder.cn/iot/build/ 开启]"); 402 + "[IoT 物联网 yudao-module-iot - 表结构未导入][参考 https://doc.iocoder.cn/iot/build/ 开启]");
386 } 403 }
387 return null; 404 return null;
388 } 405 }
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/util/AiUtils.java
1 package cn.iocoder.yudao.framework.ai.core.util; 1 package cn.iocoder.yudao.framework.ai.core.util;
2 2
  3 +import cn.hutool.core.util.ObjUtil;
3 import cn.hutool.core.util.StrUtil; 4 import cn.hutool.core.util.StrUtil;
4 import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum; 5 import cn.iocoder.yudao.framework.ai.core.enums.AiPlatformEnum;
5 import com.alibaba.cloud.ai.dashscope.chat.DashScopeChatOptions; 6 import com.alibaba.cloud.ai.dashscope.chat.DashScopeChatOptions;
@@ -13,6 +14,7 @@ import org.springframework.ai.openai.OpenAiChatOptions; @@ -13,6 +14,7 @@ import org.springframework.ai.openai.OpenAiChatOptions;
13 import org.springframework.ai.qianfan.QianFanChatOptions; 14 import org.springframework.ai.qianfan.QianFanChatOptions;
14 import org.springframework.ai.zhipuai.ZhiPuAiChatOptions; 15 import org.springframework.ai.zhipuai.ZhiPuAiChatOptions;
15 16
  17 +import java.util.Collections;
16 import java.util.Set; 18 import java.util.Set;
17 19
18 /** 20 /**
@@ -28,6 +30,7 @@ public class AiUtils { @@ -28,6 +30,7 @@ public class AiUtils {
28 30
29 public static ChatOptions buildChatOptions(AiPlatformEnum platform, String model, Double temperature, Integer maxTokens, 31 public static ChatOptions buildChatOptions(AiPlatformEnum platform, String model, Double temperature, Integer maxTokens,
30 Set<String> toolNames) { 32 Set<String> toolNames) {
  33 + toolNames = ObjUtil.defaultIfNull(toolNames, Collections.emptySet());
31 // noinspection EnhancedSwitchMigration 34 // noinspection EnhancedSwitchMigration
32 switch (platform) { 35 switch (platform) {
33 case TONG_YI: 36 case TONG_YI:
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/api/task/BpmProcessInstanceApi.java
1 package cn.iocoder.yudao.module.bpm.api.task; 1 package cn.iocoder.yudao.module.bpm.api.task;
2 2
3 import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; 3 import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
4 -  
5 import jakarta.validation.Valid; 4 import jakarta.validation.Valid;
6 5
7 /** 6 /**
@@ -20,4 +19,6 @@ public interface BpmProcessInstanceApi { @@ -20,4 +19,6 @@ public interface BpmProcessInstanceApi {
20 */ 19 */
21 String createProcessInstance(Long userId, @Valid BpmProcessInstanceCreateReqDTO reqDTO); 20 String createProcessInstance(Long userId, @Valid BpmProcessInstanceCreateReqDTO reqDTO);
22 21
  22 +
  23 +
23 } 24 }
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/api/task/BpmProcessTaskApi.java 0 → 100644
  1 +package cn.iocoder.yudao.module.bpm.api.task;
  2 +
  3 +import jakarta.validation.constraints.NotEmpty;
  4 +
  5 +/**
  6 + * 流程任务 Api 接口
  7 + *
  8 + * @author jason
  9 + */
  10 +public interface BpmProcessTaskApi {
  11 +
  12 + /**
  13 + * 触发流程任务的执行
  14 + *
  15 + * @param processInstanceId 流程实例编号
  16 + * @param taskDefineKey 任务 Key
  17 + */
  18 + void triggerTask(@NotEmpty(message = "流程实例的编号不能为空") String processInstanceId,
  19 + @NotEmpty(message = "任务 Key 不能为空") String taskDefineKey);
  20 +
  21 +}
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/ErrorCodeConstants.java
@@ -24,6 +24,7 @@ public interface ErrorCodeConstants { @@ -24,6 +24,7 @@ public interface ErrorCodeConstants {
24 ErrorCode MODEL_DEPLOY_FAIL_BPMN_START_EVENT_NOT_EXISTS = new ErrorCode(1_009_002_005, "部署流程失败,原因:BPMN 流程图中,没有开始事件"); 24 ErrorCode MODEL_DEPLOY_FAIL_BPMN_START_EVENT_NOT_EXISTS = new ErrorCode(1_009_002_005, "部署流程失败,原因:BPMN 流程图中,没有开始事件");
25 ErrorCode MODEL_DEPLOY_FAIL_BPMN_USER_TASK_NAME_NOT_EXISTS = new ErrorCode(1_009_002_006, "部署流程失败,原因:BPMN 流程图中,用户任务({})的名字不存在"); 25 ErrorCode MODEL_DEPLOY_FAIL_BPMN_USER_TASK_NAME_NOT_EXISTS = new ErrorCode(1_009_002_006, "部署流程失败,原因:BPMN 流程图中,用户任务({})的名字不存在");
26 ErrorCode MODEL_UPDATE_FAIL_NOT_MANAGER = new ErrorCode(1_009_002_007, "操作流程失败,原因:你不是该流程({})的管理员"); 26 ErrorCode MODEL_UPDATE_FAIL_NOT_MANAGER = new ErrorCode(1_009_002_007, "操作流程失败,原因:你不是该流程({})的管理员");
  27 + ErrorCode MODEL_DEPLOY_FAIL_FIRST_USER_TASK_CANDIDATE_STRATEGY_ERROR = new ErrorCode(1_009_002_008, "部署流程失败,原因:首个任务({})的审批人不能是【审批人自选】");
27 28
28 // ========== 流程定义 1-009-003-000 ========== 29 // ========== 流程定义 1-009-003-000 ==========
29 ErrorCode PROCESS_DEFINITION_KEY_NOT_MATCH = new ErrorCode(1_009_003_000, "流程定义的标识期望是({}),当前是({}),请修改 BPMN 流程图"); 30 ErrorCode PROCESS_DEFINITION_KEY_NOT_MATCH = new ErrorCode(1_009_003_000, "流程定义的标识期望是({}),当前是({}),请修改 BPMN 流程图");
@@ -39,6 +40,8 @@ public interface ErrorCodeConstants { @@ -39,6 +40,8 @@ public interface ErrorCodeConstants {
39 ErrorCode PROCESS_INSTANCE_START_USER_SELECT_ASSIGNEES_NOT_EXISTS = new ErrorCode(1_009_004_004, "任务({})的候选人({})不存在"); 40 ErrorCode PROCESS_INSTANCE_START_USER_SELECT_ASSIGNEES_NOT_EXISTS = new ErrorCode(1_009_004_004, "任务({})的候选人({})不存在");
40 ErrorCode PROCESS_INSTANCE_START_USER_CAN_START = new ErrorCode(1_009_004_005, "发起流程失败,你没有权限发起该流程"); 41 ErrorCode PROCESS_INSTANCE_START_USER_CAN_START = new ErrorCode(1_009_004_005, "发起流程失败,你没有权限发起该流程");
41 ErrorCode PROCESS_INSTANCE_CANCEL_FAIL_NOT_ALLOW = new ErrorCode(1_009_004_005, "流程取消失败,该流程不允许取消"); 42 ErrorCode PROCESS_INSTANCE_CANCEL_FAIL_NOT_ALLOW = new ErrorCode(1_009_004_005, "流程取消失败,该流程不允许取消");
  43 + ErrorCode PROCESS_INSTANCE_HTTP_TRIGGER_CALL_ERROR = new ErrorCode(1_009_004_006, "流程 Http 触发器请求调用失败");
  44 + ErrorCode PROCESS_INSTANCE_APPROVE_USER_SELECT_ASSIGNEES_NOT_CONFIG = new ErrorCode(1_009_004_007, "下一个任务({})的审批人未配置");
42 45
43 // ========== 流程任务 1-009-005-000 ========== 46 // ========== 流程任务 1-009-005-000 ==========
44 ErrorCode TASK_OPERATE_FAIL_ASSIGN_NOT_SELF = new ErrorCode(1_009_005_001, "操作失败,原因:该任务的审批人不是你"); 47 ErrorCode TASK_OPERATE_FAIL_ASSIGN_NOT_SELF = new ErrorCode(1_009_005_001, "操作失败,原因:该任务的审批人不是你");
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmBoundaryEventTypeEnum.java
@@ -14,7 +14,8 @@ import lombok.Getter; @@ -14,7 +14,8 @@ import lombok.Getter;
14 public enum BpmBoundaryEventTypeEnum { 14 public enum BpmBoundaryEventTypeEnum {
15 15
16 USER_TASK_TIMEOUT(1, "用户任务超时"), 16 USER_TASK_TIMEOUT(1, "用户任务超时"),
17 - DELAY_TIMER_TIMEOUT(2, "延迟器超时"); 17 + DELAY_TIMER_TIMEOUT(2, "延迟器超时"),
  18 + CHILD_PROCESS_TIMEOUT(3, "子流程超时");
18 19
19 private final Integer type; 20 private final Integer type;
20 private final String name; 21 private final String name;
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmChildProcessMultiInstanceSourceTypeEnum.java 0 → 100644
  1 +package cn.iocoder.yudao.module.bpm.enums.definition;
  2 +
  3 +import cn.hutool.core.util.ArrayUtil;
  4 +import cn.iocoder.yudao.framework.common.core.ArrayValuable;
  5 +import lombok.AllArgsConstructor;
  6 +import lombok.Getter;
  7 +
  8 +import java.util.Arrays;
  9 +
  10 +/**
  11 + * BPM 子流程多实例来源类型枚举
  12 + *
  13 + * @author Lesan
  14 + */
  15 +@Getter
  16 +@AllArgsConstructor
  17 +public enum BpmChildProcessMultiInstanceSourceTypeEnum implements ArrayValuable<Integer> {
  18 +
  19 + FIXED_QUANTITY(1, "固定数量"),
  20 + NUMBER_FORM(2, "数字表单"),
  21 + MULTIPLE_FORM(3, "多选表单");
  22 +
  23 + private final Integer type;
  24 + private final String name;
  25 +
  26 + public static final Integer[] ARRAYS = Arrays.stream(values()).map(BpmChildProcessMultiInstanceSourceTypeEnum::getType).toArray(Integer[]::new);
  27 +
  28 + public static BpmChildProcessMultiInstanceSourceTypeEnum typeOf(Integer type) {
  29 + return ArrayUtil.firstMatch(item -> item.getType().equals(type), values());
  30 + }
  31 +
  32 + @Override
  33 + public Integer[] array() {
  34 + return ARRAYS;
  35 + }
  36 +
  37 +}
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmChildProcessStartUserEmptyTypeEnum.java 0 → 100644
  1 +package cn.iocoder.yudao.module.bpm.enums.definition;
  2 +
  3 +import cn.hutool.core.util.ArrayUtil;
  4 +import cn.iocoder.yudao.framework.common.core.ArrayValuable;
  5 +import lombok.AllArgsConstructor;
  6 +import lombok.Getter;
  7 +
  8 +import java.util.Arrays;
  9 +
  10 +/**
  11 + * BPM 当子流程发起人为空时类型枚举
  12 + *
  13 + * @author Lesan
  14 + */
  15 +@Getter
  16 +@AllArgsConstructor
  17 +public enum BpmChildProcessStartUserEmptyTypeEnum implements ArrayValuable<Integer> {
  18 +
  19 + MAIN_PROCESS_START_USER(1, "同主流程发起人"),
  20 + CHILD_PROCESS_ADMIN(2, "子流程管理员"),
  21 + MAIN_PROCESS_ADMIN(3, "主流程管理员");
  22 +
  23 + private final Integer type;
  24 + private final String name;
  25 +
  26 + public static final Integer[] ARRAYS = Arrays.stream(values()).map(BpmChildProcessStartUserEmptyTypeEnum::getType).toArray(Integer[]::new);
  27 +
  28 + public static BpmChildProcessStartUserEmptyTypeEnum typeOf(Integer type) {
  29 + return ArrayUtil.firstMatch(item -> item.getType().equals(type), values());
  30 + }
  31 +
  32 + @Override
  33 + public Integer[] array() {
  34 + return ARRAYS;
  35 + }
  36 +}
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmChildProcessStartUserTypeEnum.java 0 → 100644
  1 +package cn.iocoder.yudao.module.bpm.enums.definition;
  2 +
  3 +import cn.hutool.core.util.ArrayUtil;
  4 +import cn.iocoder.yudao.framework.common.core.ArrayValuable;
  5 +import lombok.AllArgsConstructor;
  6 +import lombok.Getter;
  7 +
  8 +import java.util.Arrays;
  9 +
  10 +/**
  11 + * BPM 子流程发起人类型枚举
  12 + *
  13 + * @author Lesan
  14 + */
  15 +@Getter
  16 +@AllArgsConstructor
  17 +public enum BpmChildProcessStartUserTypeEnum implements ArrayValuable<Integer> {
  18 +
  19 + MAIN_PROCESS_START_USER(1, "同主流程发起人"),
  20 + FROM_FORM(2, "表单");
  21 +
  22 + private final Integer type;
  23 + private final String name;
  24 +
  25 + public static final Integer[] ARRAYS = Arrays.stream(values()).map(BpmChildProcessStartUserTypeEnum::getType).toArray(Integer[]::new);
  26 +
  27 + public static BpmChildProcessStartUserTypeEnum typeOf(Integer type) {
  28 + return ArrayUtil.firstMatch(item -> item.getType().equals(type), values());
  29 + }
  30 +
  31 + @Override
  32 + public Integer[] array() {
  33 + return ARRAYS;
  34 + }
  35 +}
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmSimpleModelNodeTypeEnum.java
@@ -25,10 +25,13 @@ public enum BpmSimpleModelNodeTypeEnum implements ArrayValuable&lt;Integer&gt; { @@ -25,10 +25,13 @@ public enum BpmSimpleModelNodeTypeEnum implements ArrayValuable&lt;Integer&gt; {
25 START_USER_NODE(10, "发起人", "userTask"), // 发起人节点。前端的开始节点,Id 固定 25 START_USER_NODE(10, "发起人", "userTask"), // 发起人节点。前端的开始节点,Id 固定
26 APPROVE_NODE(11, "审批人", "userTask"), 26 APPROVE_NODE(11, "审批人", "userTask"),
27 COPY_NODE(12, "抄送人", "serviceTask"), 27 COPY_NODE(12, "抄送人", "serviceTask"),
  28 + TRANSACTOR_NODE(13, "办理人", "userTask"),
28 29
29 DELAY_TIMER_NODE(14, "延迟器", "receiveTask"), 30 DELAY_TIMER_NODE(14, "延迟器", "receiveTask"),
30 TRIGGER_NODE(15, "触发器", "serviceTask"), 31 TRIGGER_NODE(15, "触发器", "serviceTask"),
31 32
  33 + CHILD_PROCESS(20, "子流程", "callActivity"),
  34 +
32 // 50 ~ 条件分支 35 // 50 ~ 条件分支
33 CONDITION_NODE(50, "条件", "sequenceFlow"), // 用于构建流转条件的表达式 36 CONDITION_NODE(50, "条件", "sequenceFlow"), // 用于构建流转条件的表达式
34 CONDITION_BRANCH_NODE(51, "条件分支", "exclusiveGateway"), 37 CONDITION_BRANCH_NODE(51, "条件分支", "exclusiveGateway"),
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmTriggerTypeEnum.java
@@ -16,8 +16,12 @@ import java.util.Arrays; @@ -16,8 +16,12 @@ import java.util.Arrays;
16 @AllArgsConstructor 16 @AllArgsConstructor
17 public enum BpmTriggerTypeEnum implements ArrayValuable<Integer> { 17 public enum BpmTriggerTypeEnum implements ArrayValuable<Integer> {
18 18
19 - HTTP_REQUEST(1, "发起 HTTP 请求"),  
20 - UPDATE_NORMAL_FORM(2, "更新流程表单"); // TODO @jason:FORM_UPDATE 19 + HTTP_REQUEST(1, "发起 HTTP 请求"), // BPM => 业务,流程继续执行,无需等待业务
  20 + HTTP_CALLBACK(2, "接收 HTTP 回调"), // BPM => 业务 => BPM,流程卡主,等待业务回调
  21 +
  22 + FORM_UPDATE(10, "更新流程表单数据"),
  23 + FORM_DELETE(11, "删除流程表单数据"),
  24 + ;
21 25
22 /** 26 /**
23 * 触发器执行动作类型 27 * 触发器执行动作类型
@@ -39,5 +43,4 @@ public enum BpmTriggerTypeEnum implements ArrayValuable&lt;Integer&gt; { @@ -39,5 +43,4 @@ public enum BpmTriggerTypeEnum implements ArrayValuable&lt;Integer&gt; {
39 public static BpmTriggerTypeEnum typeOf(Integer type) { 43 public static BpmTriggerTypeEnum typeOf(Integer type) {
40 return ArrayUtil.firstMatch(item -> item.getType().equals(type), values()); 44 return ArrayUtil.firstMatch(item -> item.getType().equals(type), values());
41 } 45 }
42 -  
43 } 46 }
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmReasonEnum.java
@@ -26,6 +26,7 @@ public enum BpmReasonEnum { @@ -26,6 +26,7 @@ public enum BpmReasonEnum {
26 TIMEOUT_REJECT("审批超时,系统自动不通过"), 26 TIMEOUT_REJECT("审批超时,系统自动不通过"),
27 ASSIGN_START_USER_APPROVE("审批人与提交人为同一人时,自动通过"), 27 ASSIGN_START_USER_APPROVE("审批人与提交人为同一人时,自动通过"),
28 ASSIGN_START_USER_APPROVE_WHEN_SKIP("审批人与提交人为同一人时,自动通过"), 28 ASSIGN_START_USER_APPROVE_WHEN_SKIP("审批人与提交人为同一人时,自动通过"),
  29 + ASSIGN_START_USER_APPROVE_WHEN_SKIP_START_USER_NODE("发起人节点首次自动通过"), // 目前仅“子流程”使用
29 ASSIGN_START_USER_APPROVE_WHEN_DEPT_LEADER_NOT_FOUND("审批人与提交人为同一人时,找不到部门负责人,自动通过"), 30 ASSIGN_START_USER_APPROVE_WHEN_DEPT_LEADER_NOT_FOUND("审批人与提交人为同一人时,找不到部门负责人,自动通过"),
30 ASSIGN_START_USER_TRANSFER_DEPT_LEADER("审批人与提交人为同一人时,转交给部门负责人审批"), 31 ASSIGN_START_USER_TRANSFER_DEPT_LEADER("审批人与提交人为同一人时,转交给部门负责人审批"),
31 ASSIGN_EMPTY_APPROVE("审批人为空,自动通过"), 32 ASSIGN_EMPTY_APPROVE("审批人为空,自动通过"),
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/api/task/BpmProcessInstanceApiImpl.java
@@ -2,11 +2,10 @@ package cn.iocoder.yudao.module.bpm.api.task; @@ -2,11 +2,10 @@ package cn.iocoder.yudao.module.bpm.api.task;
2 2
3 import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; 3 import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
4 import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService; 4 import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
5 -import org.springframework.stereotype.Service;  
6 -import org.springframework.validation.annotation.Validated;  
7 -  
8 import jakarta.annotation.Resource; 5 import jakarta.annotation.Resource;
9 import jakarta.validation.Valid; 6 import jakarta.validation.Valid;
  7 +import org.springframework.stereotype.Service;
  8 +import org.springframework.validation.annotation.Validated;
10 9
11 /** 10 /**
12 * Flowable 流程实例 Api 实现类 11 * Flowable 流程实例 Api 实现类
@@ -25,4 +24,5 @@ public class BpmProcessInstanceApiImpl implements BpmProcessInstanceApi { @@ -25,4 +24,5 @@ public class BpmProcessInstanceApiImpl implements BpmProcessInstanceApi {
25 public String createProcessInstance(Long userId, @Valid BpmProcessInstanceCreateReqDTO reqDTO) { 24 public String createProcessInstance(Long userId, @Valid BpmProcessInstanceCreateReqDTO reqDTO) {
26 return processInstanceService.createProcessInstance(userId, reqDTO); 25 return processInstanceService.createProcessInstance(userId, reqDTO);
27 } 26 }
  27 +
28 } 28 }
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/api/task/BpmProcessTaskApiImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.module.bpm.api.task;
  2 +
  3 +import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService;
  4 +import jakarta.annotation.Resource;
  5 +import org.springframework.stereotype.Service;
  6 +import org.springframework.validation.annotation.Validated;
  7 +
  8 +/**
  9 + * 流程任务 Api 实现类
  10 + *
  11 + * @author jason
  12 + */
  13 +@Service
  14 +@Validated
  15 +public class BpmProcessTaskApiImpl implements BpmProcessTaskApi {
  16 +
  17 + @Resource
  18 + private BpmTaskService bpmTaskService;
  19 +
  20 + @Override
  21 + public void triggerTask(String processInstanceId, String taskDefineKey) {
  22 + bpmTaskService.triggerTask(processInstanceId, taskDefineKey);
  23 + }
  24 +
  25 +}
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmModelController.java
@@ -57,7 +57,7 @@ public class BpmModelController { @@ -57,7 +57,7 @@ public class BpmModelController {
57 @GetMapping("/list") 57 @GetMapping("/list")
58 @Operation(summary = "获得模型分页") 58 @Operation(summary = "获得模型分页")
59 @Parameter(name = "name", description = "模型名称", example = "芋艿") 59 @Parameter(name = "name", description = "模型名称", example = "芋艿")
60 - public CommonResult<List<BpmModelRespVO>> getModelPage(@RequestParam(value = "name", required = false) String name) { 60 + public CommonResult<List<BpmModelRespVO>> getModelList(@RequestParam(value = "name", required = false) String name) {
61 List<Model> list = modelService.getModelList(name); 61 List<Model> list = modelService.getModelList(name);
62 if (CollUtil.isEmpty(list)) { 62 if (CollUtil.isEmpty(list)) {
63 return success(Collections.emptyList()); 63 return success(Collections.emptyList());
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmProcessDefinitionController.java
@@ -17,6 +17,7 @@ import io.swagger.v3.oas.annotations.Parameter; @@ -17,6 +17,7 @@ import io.swagger.v3.oas.annotations.Parameter;
17 import io.swagger.v3.oas.annotations.tags.Tag; 17 import io.swagger.v3.oas.annotations.tags.Tag;
18 import jakarta.annotation.Resource; 18 import jakarta.annotation.Resource;
19 import org.flowable.bpmn.model.BpmnModel; 19 import org.flowable.bpmn.model.BpmnModel;
  20 +import org.flowable.common.engine.impl.db.SuspensionState;
20 import org.flowable.engine.repository.Deployment; 21 import org.flowable.engine.repository.Deployment;
21 import org.flowable.engine.repository.ProcessDefinition; 22 import org.flowable.engine.repository.ProcessDefinition;
22 import org.springframework.security.access.prepost.PreAuthorize; 23 import org.springframework.security.access.prepost.PreAuthorize;
@@ -31,6 +32,7 @@ import java.util.List; @@ -31,6 +32,7 @@ import java.util.List;
31 import java.util.Map; 32 import java.util.Map;
32 33
33 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; 34 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  35 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
34 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; 36 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
35 import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; 37 import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
36 38
@@ -99,6 +101,17 @@ public class BpmProcessDefinitionController { @@ -99,6 +101,17 @@ public class BpmProcessDefinitionController {
99 list, null, processDefinitionMap, null, null)); 101 list, null, processDefinitionMap, null, null));
100 } 102 }
101 103
  104 + @GetMapping("/simple-list")
  105 + @Operation(summary = "获得流程定义精简列表", description = "只包含未挂起的流程,主要用于前端的下拉选项")
  106 + public CommonResult<List<BpmProcessDefinitionRespVO>> getSimpleProcessDefinitionList() {
  107 + // 只查询未挂起的流程
  108 + List<ProcessDefinition> list = processDefinitionService.getProcessDefinitionListBySuspensionState(
  109 + SuspensionState.ACTIVE.getStateCode());
  110 + // 拼接 VO 返回,只返回 id、name、key
  111 + return success(convertList(list, definition -> new BpmProcessDefinitionRespVO()
  112 + .setId(definition.getId()).setName(definition.getName()).setKey(definition.getKey())));
  113 + }
  114 +
102 @GetMapping ("/get") 115 @GetMapping ("/get")
103 @Operation(summary = "获得流程定义") 116 @Operation(summary = "获得流程定义")
104 @Parameter(name = "id", description = "流程编号", required = true, example = "1024") 117 @Parameter(name = "id", description = "流程编号", required = true, example = "1024")
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelMetaInfoVO.java
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model; @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model;
2 2
3 import cn.iocoder.yudao.framework.common.core.KeyValue; 3 import cn.iocoder.yudao.framework.common.core.KeyValue;
4 import cn.iocoder.yudao.framework.common.validation.InEnum; 4 import cn.iocoder.yudao.framework.common.validation.InEnum;
  5 +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO;
5 import cn.iocoder.yudao.module.bpm.enums.definition.BpmAutoApproveTypeEnum; 6 import cn.iocoder.yudao.module.bpm.enums.definition.BpmAutoApproveTypeEnum;
6 import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelFormTypeEnum; 7 import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelFormTypeEnum;
7 import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelTypeEnum; 8 import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelTypeEnum;
@@ -27,8 +28,7 @@ import java.util.List; @@ -27,8 +28,7 @@ import java.util.List;
27 @Data 28 @Data
28 public class BpmModelMetaInfoVO { 29 public class BpmModelMetaInfoVO {
29 30
30 - @Schema(description = "流程图标", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/yudao.jpg")  
31 - @NotEmpty(message = "流程图标不能为空") 31 + @Schema(description = "流程图标", example = "https://www.iocoder.cn/yudao.jpg")
32 @URL(message = "流程图标格式不正确") 32 @URL(message = "流程图标格式不正确")
33 private String icon; 33 private String icon;
34 34
@@ -46,6 +46,7 @@ public class BpmModelMetaInfoVO { @@ -46,6 +46,7 @@ public class BpmModelMetaInfoVO {
46 private Integer formType; 46 private Integer formType;
47 @Schema(description = "表单编号", example = "1024") 47 @Schema(description = "表单编号", example = "1024")
48 private Long formId; // formType 为 NORMAL 使用,必须非空 48 private Long formId; // formType 为 NORMAL 使用,必须非空
  49 +
49 @Schema(description = "自定义表单的提交路径,使用 Vue 的路由地址", example = "/bpm/oa/leave/create") 50 @Schema(description = "自定义表单的提交路径,使用 Vue 的路由地址", example = "/bpm/oa/leave/create")
50 private String formCustomCreatePath; // 表单类型为 CUSTOM 时,必须非空 51 private String formCustomCreatePath; // 表单类型为 CUSTOM 时,必须非空
51 @Schema(description = "自定义表单的查看路径,使用 Vue 的路由地址", example = "/bpm/oa/leave/view") 52 @Schema(description = "自定义表单的查看路径,使用 Vue 的路由地址", example = "/bpm/oa/leave/view")
@@ -81,6 +82,12 @@ public class BpmModelMetaInfoVO { @@ -81,6 +82,12 @@ public class BpmModelMetaInfoVO {
81 @Schema(description = "摘要设置", example = "{}") 82 @Schema(description = "摘要设置", example = "{}")
82 private SummarySetting summarySetting; 83 private SummarySetting summarySetting;
83 84
  85 + @Schema(description = "流程前置通知设置", example = "{}")
  86 + private HttpRequestSetting processBeforeTriggerSetting;
  87 +
  88 + @Schema(description = "流程后置通知设置", example = "{}")
  89 + private HttpRequestSetting processAfterTriggerSetting;
  90 +
84 @Schema(description = "流程 ID 规则") 91 @Schema(description = "流程 ID 规则")
85 @Data 92 @Data
86 @Valid 93 @Valid
@@ -133,4 +140,32 @@ public class BpmModelMetaInfoVO { @@ -133,4 +140,32 @@ public class BpmModelMetaInfoVO {
133 140
134 } 141 }
135 142
  143 + @Schema(description = "http 请求通知设置", example = "{}")
  144 + @Data
  145 + public static class HttpRequestSetting {
  146 +
  147 + @Schema(description = "请求路径", example = "http://127.0.0.1")
  148 + @NotEmpty(message = "请求 URL 不能为空")
  149 + @URL(message = "请求 URL 格式不正确")
  150 + private String url;
  151 +
  152 + @Schema(description = "请求头参数设置", example = "[]")
  153 + @Valid
  154 + private List<BpmSimpleModelNodeVO.HttpRequestParam> header;
  155 +
  156 + @Schema(description = "请求头参数设置", example = "[]")
  157 + @Valid
  158 + private List<BpmSimpleModelNodeVO.HttpRequestParam> body;
  159 +
  160 + /**
  161 + * 请求返回处理设置,用于修改流程表单值
  162 + * <p>
  163 + * key:表示要修改的流程表单字段名(name)
  164 + * value:接口返回的字段名
  165 + */
  166 + @Schema(description = "请求返回处理设置", example = "[]")
  167 + private List<KeyValue<String, String>> response;
  168 +
  169 + }
  170 +
136 } 171 }
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelRespVO.java
@@ -25,7 +25,7 @@ public class BpmModelRespVO extends BpmModelMetaInfoVO { @@ -25,7 +25,7 @@ public class BpmModelRespVO extends BpmModelMetaInfoVO {
25 @Schema(description = "流程图标", example = "https://www.iocoder.cn/yudao.jpg") 25 @Schema(description = "流程图标", example = "https://www.iocoder.cn/yudao.jpg")
26 private String icon; 26 private String icon;
27 27
28 - @Schema(description = "流程分类编码", example = "1") 28 + @Schema(description = "流程分类编号", example = "1")
29 private String category; 29 private String category;
30 @Schema(description = "流程分类名字", example = "请假") 30 @Schema(description = "流程分类名字", example = "请假")
31 private String categoryName; 31 private String categoryName;
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/simple/BpmSimpleModelNodeVO.java
@@ -4,16 +4,19 @@ import cn.iocoder.yudao.framework.common.core.KeyValue; @@ -4,16 +4,19 @@ import cn.iocoder.yudao.framework.common.core.KeyValue;
4 import cn.iocoder.yudao.framework.common.validation.InEnum; 4 import cn.iocoder.yudao.framework.common.validation.InEnum;
5 import cn.iocoder.yudao.module.bpm.enums.definition.*; 5 import cn.iocoder.yudao.module.bpm.enums.definition.*;
6 import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum; 6 import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum;
  7 +import com.fasterxml.jackson.annotation.JsonIgnore;
7 import com.fasterxml.jackson.annotation.JsonInclude; 8 import com.fasterxml.jackson.annotation.JsonInclude;
8 import io.swagger.v3.oas.annotations.media.Schema; 9 import io.swagger.v3.oas.annotations.media.Schema;
9 import jakarta.validation.Valid; 10 import jakarta.validation.Valid;
10 import jakarta.validation.constraints.NotEmpty; 11 import jakarta.validation.constraints.NotEmpty;
11 import jakarta.validation.constraints.NotNull; 12 import jakarta.validation.constraints.NotNull;
12 import lombok.Data; 13 import lombok.Data;
  14 +import org.flowable.bpmn.model.IOParameter;
13 import org.hibernate.validator.constraints.URL; 15 import org.hibernate.validator.constraints.URL;
14 16
15 import java.util.List; 17 import java.util.List;
16 import java.util.Map; 18 import java.util.Map;
  19 +import java.util.Set;
17 20
18 @Schema(description = "管理后台 - 仿钉钉流程设计模型节点 VO") 21 @Schema(description = "管理后台 - 仿钉钉流程设计模型节点 VO")
19 @Data 22 @Data
@@ -114,7 +117,8 @@ public class BpmSimpleModelNodeVO { @@ -114,7 +117,8 @@ public class BpmSimpleModelNodeVO {
114 @Schema(description = "路由分支组", example = "[]") 117 @Schema(description = "路由分支组", example = "[]")
115 private List<RouterSetting> routerGroups; 118 private List<RouterSetting> routerGroups;
116 119
117 - @Schema(description = "路由分支默认分支 ID", example = "Flow_xxx", hidden = true) // 由后端生成,所以 hidden = true 120 + @Schema(description = "路由分支默认分支 ID", example = "Flow_xxx", hidden = true) // 由后端生成(不从前端传递),所以 hidden = true
  121 + @JsonIgnore
118 private String routerDefaultFlowId; // 仅用于路由分支节点 BpmSimpleModelNodeType.ROUTER_BRANCH_NODE 122 private String routerDefaultFlowId; // 仅用于路由分支节点 BpmSimpleModelNodeType.ROUTER_BRANCH_NODE
119 123
120 /** 124 /**
@@ -122,6 +126,15 @@ public class BpmSimpleModelNodeVO { @@ -122,6 +126,15 @@ public class BpmSimpleModelNodeVO {
122 */ 126 */
123 private TriggerSetting triggerSetting; 127 private TriggerSetting triggerSetting;
124 128
  129 + @Schema(description = "附加节点 Id", example = "UserTask_xxx", hidden = true) // 由后端生成(不从前端传递),所以 hidden = true
  130 + @JsonIgnore
  131 + private String attachNodeId; // 目前用于触发器节点(HTTP 回调)。需要 UserTask 和 ReceiveTask(附加节点) 来完成
  132 +
  133 + /**
  134 + * 子流程设置
  135 + */
  136 + private ChildProcessSetting childProcessSetting;
  137 +
125 @Schema(description = "任务监听器") 138 @Schema(description = "任务监听器")
126 @Valid 139 @Valid
127 @Data 140 @Data
@@ -345,12 +358,10 @@ public class BpmSimpleModelNodeVO { @@ -345,12 +358,10 @@ public class BpmSimpleModelNodeVO {
345 @Valid 358 @Valid
346 private HttpRequestTriggerSetting httpRequestSetting; 359 private HttpRequestTriggerSetting httpRequestSetting;
347 360
348 - // TODO @jason:这个要不直接叫 formSetting,更好理解一点哈  
349 - // TODO @jason:如果搞成 List<NormalFormTriggerSetting>,是不是可以做条件组了?微信讨论哈  
350 /** 361 /**
351 * 流程表单触发器设置 362 * 流程表单触发器设置
352 */ 363 */
353 - private NormalFormTriggerSetting normalFormSetting; 364 + private List<FormTriggerSetting> formSettings;
354 365
355 @Schema(description = "http 请求触发器设置", example = "{}") 366 @Schema(description = "http 请求触发器设置", example = "{}")
356 @Data 367 @Data
@@ -369,7 +380,6 @@ public class BpmSimpleModelNodeVO { @@ -369,7 +380,6 @@ public class BpmSimpleModelNodeVO {
369 @Valid 380 @Valid
370 private List<HttpRequestParam> body; 381 private List<HttpRequestParam> body;
371 382
372 - // TODO @json:可能未来看情况,搞个 HttpResponseParam;得看看有没别的业务需要,抽象统一  
373 /** 383 /**
374 * 请求返回处理设置,用于修改流程表单值 384 * 请求返回处理设置,用于修改流程表单值
375 * <p> 385 * <p>
@@ -379,15 +389,137 @@ public class BpmSimpleModelNodeVO { @@ -379,15 +389,137 @@ public class BpmSimpleModelNodeVO {
379 @Schema(description = "请求返回处理设置", example = "[]") 389 @Schema(description = "请求返回处理设置", example = "[]")
380 private List<KeyValue<String, String>> response; 390 private List<KeyValue<String, String>> response;
381 391
  392 + /**
  393 + * Http 回调请求,需要指定回调任务 Key,用于回调执行
  394 + */
  395 + @Schema(description = "回调任务 Key", example = "xxx", hidden = true)
  396 + private String callbackTaskDefineKey;
  397 +
382 } 398 }
383 399
384 @Schema(description = "流程表单触发器设置", example = "{}") 400 @Schema(description = "流程表单触发器设置", example = "{}")
385 @Data 401 @Data
386 - public static class NormalFormTriggerSetting { 402 + public static class FormTriggerSetting {
387 403
388 - @Schema(description = "修改的表单字段", example = "userName") 404 + @Schema(description = "条件类型", example = "1")
  405 + @InEnum(BpmSimpleModeConditionTypeEnum.class)
  406 + private Integer conditionType;
  407 +
  408 + @Schema(description = "条件表达式", example = "${day>3}")
  409 + private String conditionExpression;
  410 +
  411 + @Schema(description = "条件组", example = "{}")
  412 + private ConditionGroups conditionGroups;
  413 +
  414 + @Schema(description = "修改的表单字段", example = "{}")
389 private Map<String, Object> updateFormFields; 415 private Map<String, Object> updateFormFields;
390 416
  417 + @Schema(description = "删除表单字段", example = "[]")
  418 + private Set<String> deleteFields;
  419 + }
  420 + }
  421 +
  422 + @Schema(description = "子流程节点配置")
  423 + @Data
  424 + @Valid
  425 + public static class ChildProcessSetting {
  426 +
  427 + @Schema(description = "被调用流程", requiredMode = Schema.RequiredMode.REQUIRED, example = "xxx")
  428 + @NotEmpty(message = "被调用流程不能为空")
  429 + private String calledProcessDefinitionKey;
  430 +
  431 + @Schema(description = "被调用流程名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "xxx")
  432 + @NotEmpty(message = "被调用流程名称不能为空")
  433 + private String calledProcessDefinitionName;
  434 +
  435 + @Schema(description = "是否异步", requiredMode = Schema.RequiredMode.REQUIRED, example = "false")
  436 + @NotNull(message = "是否异步不能为空")
  437 + private Boolean async;
  438 +
  439 + @Schema(description = "输入参数(主->子)", example = "[]")
  440 + private List<IOParameter> inVariables;
  441 +
  442 + @Schema(description = "输出参数(子->主)", example = "[]")
  443 + private List<IOParameter> outVariables;
  444 +
  445 + @Schema(description = "是否自动跳过子流程发起节点", requiredMode = Schema.RequiredMode.REQUIRED, example = "false")
  446 + @NotNull(message = "是否自动跳过子流程发起节点不能为空")
  447 + private Boolean skipStartUserNode;
  448 +
  449 + @Schema(description = "子流程发起人配置", requiredMode = Schema.RequiredMode.REQUIRED, example = "{}")
  450 + @NotNull(message = "子流程发起人配置不能为空")
  451 + private StartUserSetting startUserSetting;
  452 +
  453 + @Schema(description = "超时设置", requiredMode = Schema.RequiredMode.REQUIRED, example = "{}")
  454 + private TimeoutSetting timeoutSetting;
  455 +
  456 + @Schema(description = "多实例设置", requiredMode = Schema.RequiredMode.REQUIRED, example = "{}")
  457 + private MultiInstanceSetting multiInstanceSetting;
  458 +
  459 + @Schema(description = "子流程发起人配置")
  460 + @Data
  461 + @Valid
  462 + public static class StartUserSetting {
  463 +
  464 + @Schema(description = "子流程发起人类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  465 + @NotNull(message = "子流程发起人类型")
  466 + @InEnum(BpmChildProcessStartUserTypeEnum.class)
  467 + private Integer type;
  468 +
  469 + @Schema(description = "表单", example = "xxx")
  470 + private String formField;
  471 +
  472 + @Schema(description = "当子流程发起人为空时类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  473 + @NotNull(message = "当子流程发起人为空时类型不能为空")
  474 + @InEnum(BpmChildProcessStartUserEmptyTypeEnum.class)
  475 + private Integer emptyType;
  476 +
  477 + }
  478 +
  479 + @Schema(description = "超时设置")
  480 + @Data
  481 + @Valid
  482 + public static class TimeoutSetting {
  483 +
  484 + @Schema(description = "是否开启超时设置", requiredMode = Schema.RequiredMode.REQUIRED, example = "false")
  485 + @NotNull(message = "是否开启超时设置不能为空")
  486 + private Boolean enable;
  487 +
  488 + @Schema(description = "时间类型", example = "1")
  489 + @InEnum(BpmDelayTimerTypeEnum.class)
  490 + private Integer type;
  491 +
  492 + @Schema(description = "时间表达式", example = "PT1H,2025-01-01T00:00:00")
  493 + private String timeExpression;
  494 +
  495 + }
  496 +
  497 + @Schema(description = "多实例设置")
  498 + @Data
  499 + @Valid
  500 + public static class MultiInstanceSetting {
  501 +
  502 + @Schema(description = "是否开启多实例", requiredMode = Schema.RequiredMode.REQUIRED, example = "false")
  503 + @NotNull(message = "是否开启多实例不能为空")
  504 + private Boolean enable;
  505 +
  506 + @Schema(description = "是否串行", requiredMode = Schema.RequiredMode.REQUIRED, example = "false")
  507 + @NotNull(message = "是否串行不能为空")
  508 + private Boolean sequential;
  509 +
  510 + @Schema(description = "完成比例", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
  511 + @NotNull(message = "完成比例不能为空")
  512 + private Integer approveRatio;
  513 +
  514 + @Schema(description = "多实例来源类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  515 + @NotNull(message = "多实例来源类型不能为空")
  516 + @InEnum(BpmChildProcessMultiInstanceSourceTypeEnum.class)
  517 + private Integer sourceType;
  518 +
  519 + @Schema(description = "多实例来源", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  520 + @NotNull(message = "多实例来源不能为空")
  521 + private String source;
  522 +
391 } 523 }
392 524
393 } 525 }
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/process/BpmProcessDefinitionRespVO.java
1 package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process; 1 package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process;
2 2
  3 +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelMetaInfoVO;
3 import io.swagger.v3.oas.annotations.media.Schema; 4 import io.swagger.v3.oas.annotations.media.Schema;
4 import lombok.Data; 5 import lombok.Data;
5 6
@@ -8,7 +9,7 @@ import java.util.List; @@ -8,7 +9,7 @@ import java.util.List;
8 9
9 @Schema(description = "管理后台 - 流程定义 Response VO") 10 @Schema(description = "管理后台 - 流程定义 Response VO")
10 @Data 11 @Data
11 -public class BpmProcessDefinitionRespVO { 12 +public class BpmProcessDefinitionRespVO extends BpmModelMetaInfoVO {
12 13
13 @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") 14 @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
14 private String id; 15 private String id;
@@ -19,15 +20,9 @@ public class BpmProcessDefinitionRespVO { @@ -19,15 +20,9 @@ public class BpmProcessDefinitionRespVO {
19 @Schema(description = "流程名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") 20 @Schema(description = "流程名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
20 private String name; 21 private String name;
21 22
22 - @Schema(description = "流程标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "yudao") 23 + @Schema(description = "流程标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "youdao")
23 private String key; 24 private String key;
24 25
25 - @Schema(description = "流程图标", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/yudao.jpg")  
26 - private String icon;  
27 -  
28 - @Schema(description = "流程描述", example = "我是描述")  
29 - private String description;  
30 -  
31 @Schema(description = "流程分类", example = "1") 26 @Schema(description = "流程分类", example = "1")
32 private String category; 27 private String category;
33 @Schema(description = "流程分类名字", example = "请假") 28 @Schema(description = "流程分类名字", example = "请假")
@@ -36,22 +31,15 @@ public class BpmProcessDefinitionRespVO { @@ -36,22 +31,15 @@ public class BpmProcessDefinitionRespVO {
36 @Schema(description = "流程模型的类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") 31 @Schema(description = "流程模型的类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
37 private Integer modelType; // 参见 BpmModelTypeEnum 枚举类 32 private Integer modelType; // 参见 BpmModelTypeEnum 枚举类
38 33
39 - @Schema(description = "表单类型-参见 bpm_model_form_type 数据字典", example = "1")  
40 - private Integer formType;  
41 - @Schema(description = "表单编号-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", example = "1024")  
42 - private Long formId;  
43 - @Schema(description = "表单名字", example = "请假表单")  
44 - private String formName; 34 + @Schema(description = "流程模型的编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "ABC")
  35 + private String modelId;
  36 +
45 @Schema(description = "表单的配置-JSON 字符串。在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", requiredMode = Schema.RequiredMode.REQUIRED) 37 @Schema(description = "表单的配置-JSON 字符串。在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", requiredMode = Schema.RequiredMode.REQUIRED)
46 private String formConf; 38 private String formConf;
47 @Schema(description = "表单项的数组-JSON 字符串的数组。在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", requiredMode = Schema.RequiredMode.REQUIRED) 39 @Schema(description = "表单项的数组-JSON 字符串的数组。在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空", requiredMode = Schema.RequiredMode.REQUIRED)
48 private List<String> formFields; 40 private List<String> formFields;
49 - @Schema(description = "自定义表单的提交路径,使用 Vue 的路由地址-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空",  
50 - example = "/bpm/oa/leave/create")  
51 - private String formCustomCreatePath;  
52 - @Schema(description = "自定义表单的查看路径,使用 Vue 的路由地址-在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空",  
53 - example = "/bpm/oa/leave/view")  
54 - private String formCustomViewPath; 41 + @Schema(description = "表单名字", example = "请假表单")
  42 + private String formName;
55 43
56 @Schema(description = "中断状态-参见 SuspensionState 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 44 @Schema(description = "中断状态-参见 SuspensionState 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
57 private Integer suspensionState; // 参见 SuspensionState 枚举 45 private Integer suspensionState; // 参见 SuspensionState 枚举
@@ -67,7 +55,7 @@ public class BpmProcessDefinitionRespVO { @@ -67,7 +55,7 @@ public class BpmProcessDefinitionRespVO {
67 55
68 @Schema(description = "流程定义排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") 56 @Schema(description = "流程定义排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
69 private Long sort; 57 private Long sort;
70 - 58 +
71 @Schema(description = "BPMN UserTask 用户任务") 59 @Schema(description = "BPMN UserTask 用户任务")
72 @Data 60 @Data
73 public static class UserTask { 61 public static class UserTask {
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmProcessInstanceController.java
1 package cn.iocoder.yudao.module.bpm.controller.admin.task; 1 package cn.iocoder.yudao.module.bpm.controller.admin.task;
2 2
3 import cn.hutool.core.collection.CollUtil; 3 import cn.hutool.core.collection.CollUtil;
  4 +import cn.hutool.core.util.StrUtil;
4 import cn.iocoder.yudao.framework.common.pojo.CommonResult; 5 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
5 import cn.iocoder.yudao.framework.common.pojo.PageResult; 6 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  7 +import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
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.instance.*; 9 import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.*;
8 import cn.iocoder.yudao.module.bpm.convert.task.BpmProcessInstanceConvert; 10 import cn.iocoder.yudao.module.bpm.convert.task.BpmProcessInstanceConvert;
@@ -30,10 +32,10 @@ import org.springframework.web.bind.annotation.*; @@ -30,10 +32,10 @@ import org.springframework.web.bind.annotation.*;
30 32
31 import java.util.List; 33 import java.util.List;
32 import java.util.Map; 34 import java.util.Map;
  35 +import java.util.Set;
33 36
34 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; 37 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
35 -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;  
36 -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; 38 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
37 import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; 39 import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
38 40
39 @Tag(name = "管理后台 - 流程实例") // 流程实例,通过流程定义创建的一次“申请” 41 @Tag(name = "管理后台 - 流程实例") // 流程实例,通过流程定义创建的一次“申请”
@@ -76,8 +78,14 @@ public class BpmProcessInstanceController { @@ -76,8 +78,14 @@ public class BpmProcessInstanceController {
76 convertSet(processDefinitionMap.values(), ProcessDefinition::getCategory)); 78 convertSet(processDefinitionMap.values(), ProcessDefinition::getCategory));
77 Map<String, BpmProcessDefinitionInfoDO> processDefinitionInfoMap = processDefinitionService.getProcessDefinitionInfoMap( 79 Map<String, BpmProcessDefinitionInfoDO> processDefinitionInfoMap = processDefinitionService.getProcessDefinitionInfoMap(
78 convertSet(pageResult.getList(), HistoricProcessInstance::getProcessDefinitionId)); 80 convertSet(pageResult.getList(), HistoricProcessInstance::getProcessDefinitionId));
  81 + Set<Long> userIds = convertSet(pageResult.getList(), processInstance -> NumberUtils.parseLong(processInstance.getStartUserId()));
  82 + userIds.addAll(convertSetByFlatMap(taskMap.values(),
  83 + tasks -> tasks.stream().map(Task::getAssignee).filter(StrUtil::isNotBlank).map(Long::parseLong)));
  84 + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIds);
  85 + Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(
  86 + convertSet(userMap.values(), AdminUserRespDTO::getDeptId));
79 return success(BpmProcessInstanceConvert.INSTANCE.buildProcessInstancePage(pageResult, 87 return success(BpmProcessInstanceConvert.INSTANCE.buildProcessInstancePage(pageResult,
80 - processDefinitionMap, categoryMap, taskMap, null, null, processDefinitionInfoMap)); 88 + processDefinitionMap, categoryMap, taskMap, userMap, deptMap, processDefinitionInfoMap));
81 } 89 }
82 90
83 @GetMapping("/manager-page") 91 @GetMapping("/manager-page")
@@ -140,6 +148,7 @@ public class BpmProcessInstanceController { @@ -140,6 +148,7 @@ public class BpmProcessInstanceController {
140 processDefinition, processDefinitionInfo, startUser, dept)); 148 processDefinition, processDefinitionInfo, startUser, dept));
141 } 149 }
142 150
  151 + // TODO @lesan:【子流程】子流程如果取消,主流程应该是通过、还是不通过哈?还是禁用掉子流程的取消?
143 @DeleteMapping("/cancel-by-start-user") 152 @DeleteMapping("/cancel-by-start-user")
144 @Operation(summary = "用户取消流程实例", description = "取消发起的流程") 153 @Operation(summary = "用户取消流程实例", description = "取消发起的流程")
145 @PreAuthorize("@ss.hasPermission('bpm:process-instance:cancel')") 154 @PreAuthorize("@ss.hasPermission('bpm:process-instance:cancel')")
@@ -162,10 +171,25 @@ public class BpmProcessInstanceController { @@ -162,10 +171,25 @@ public class BpmProcessInstanceController {
162 @Operation(summary = "获得审批详情") 171 @Operation(summary = "获得审批详情")
163 @Parameter(name = "id", description = "流程实例的编号", required = true) 172 @Parameter(name = "id", description = "流程实例的编号", required = true)
164 @PreAuthorize("@ss.hasPermission('bpm:process-instance:query')") 173 @PreAuthorize("@ss.hasPermission('bpm:process-instance:query')")
  174 + @SuppressWarnings("unchecked")
165 public CommonResult<BpmApprovalDetailRespVO> getApprovalDetail(@Valid BpmApprovalDetailReqVO reqVO) { 175 public CommonResult<BpmApprovalDetailRespVO> getApprovalDetail(@Valid BpmApprovalDetailReqVO reqVO) {
  176 + if (StrUtil.isNotEmpty(reqVO.getProcessVariablesStr())) {
  177 + reqVO.setProcessVariables(JsonUtils.parseObject(reqVO.getProcessVariablesStr(), Map.class));
  178 + }
166 return success(processInstanceService.getApprovalDetail(getLoginUserId(), reqVO)); 179 return success(processInstanceService.getApprovalDetail(getLoginUserId(), reqVO));
167 } 180 }
168 181
  182 + @GetMapping("/get-next-approval-nodes")
  183 + @Operation(summary = "获取下一个执行的流程节点")
  184 + @PreAuthorize("@ss.hasPermission('bpm:process-instance:query')")
  185 + @SuppressWarnings("unchecked")
  186 + public CommonResult<List<BpmApprovalDetailRespVO.ActivityNode>> getNextApprovalNodes(@Valid BpmApprovalDetailReqVO reqVO) {
  187 + if (StrUtil.isNotEmpty(reqVO.getProcessVariablesStr())) {
  188 + reqVO.setProcessVariables(JsonUtils.parseObject(reqVO.getProcessVariablesStr(), Map.class));
  189 + }
  190 + return success(processInstanceService.getNextApprovalNodes(getLoginUserId(), reqVO));
  191 + }
  192 +
169 @GetMapping("/get-bpmn-model-view") 193 @GetMapping("/get-bpmn-model-view")
170 @Operation(summary = "获取流程实例的 BPMN 模型视图", description = "在【流程详细】界面中,进行调用") 194 @Operation(summary = "获取流程实例的 BPMN 模型视图", description = "在【流程详细】界面中,进行调用")
171 @Parameter(name = "id", description = "流程实例的编号", required = true) 195 @Parameter(name = "id", description = "流程实例的编号", required = true)
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmApprovalDetailReqVO.java
@@ -18,6 +18,9 @@ public class BpmApprovalDetailReqVO { @@ -18,6 +18,9 @@ public class BpmApprovalDetailReqVO {
18 @Schema(description = "流程变量") 18 @Schema(description = "流程变量")
19 private Map<String, Object> processVariables; // 使用场景:同 processDefinitionId,用于流程预测 19 private Map<String, Object> processVariables; // 使用场景:同 processDefinitionId,用于流程预测
20 20
  21 + @Schema(description = "流程变量")
  22 + private String processVariablesStr; // 解决 GET 无法传递对象的问题,最终转换成 processVariables 变量
  23 +
21 @Schema(description = "流程实例的编号", example = "1024") 24 @Schema(description = "流程实例的编号", example = "1024")
22 private String processInstanceId; // 使用场景:流程已发起时候传流程实例 ID 25 private String processInstanceId; // 使用场景:流程已发起时候传流程实例 ID
23 26
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceRespVO.java
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance; @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance;
3 import cn.iocoder.yudao.framework.common.core.KeyValue; 3 import cn.iocoder.yudao.framework.common.core.KeyValue;
4 import cn.iocoder.yudao.module.bpm.controller.admin.base.user.UserSimpleBaseVO; 4 import cn.iocoder.yudao.module.bpm.controller.admin.base.user.UserSimpleBaseVO;
5 import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionRespVO; 5 import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionRespVO;
  6 +import com.fasterxml.jackson.annotation.JsonIgnore;
6 import io.swagger.v3.oas.annotations.media.Schema; 7 import io.swagger.v3.oas.annotations.media.Schema;
7 import lombok.Data; 8 import lombok.Data;
8 9
@@ -73,6 +74,13 @@ public class BpmProcessInstanceRespVO { @@ -73,6 +74,13 @@ public class BpmProcessInstanceRespVO {
73 @Schema(description = "任务名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") 74 @Schema(description = "任务名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
74 private String name; 75 private String name;
75 76
  77 + @Schema(description = "任务分配人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "2048")
  78 + @JsonIgnore // 不返回,只是方便后续读取,赋值给 assigneeUser
  79 + private Long assignee;
  80 +
  81 + @Schema(description = "任务分配人", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "2048")
  82 + private UserSimpleBaseVO assigneeUser;
  83 +
76 } 84 }
77 85
78 } 86 }
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskApproveReqVO.java
@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema; @@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
4 import jakarta.validation.constraints.NotEmpty; 4 import jakarta.validation.constraints.NotEmpty;
5 import lombok.Data; 5 import lombok.Data;
6 6
  7 +import java.util.List;
7 import java.util.Map; 8 import java.util.Map;
8 9
9 @Schema(description = "管理后台 - 通过流程任务的 Request VO") 10 @Schema(description = "管理后台 - 通过流程任务的 Request VO")
@@ -23,4 +24,7 @@ public class BpmTaskApproveReqVO { @@ -23,4 +24,7 @@ public class BpmTaskApproveReqVO {
23 @Schema(description = "变量实例(动态表单)", requiredMode = Schema.RequiredMode.REQUIRED) 24 @Schema(description = "变量实例(动态表单)", requiredMode = Schema.RequiredMode.REQUIRED)
24 private Map<String, Object> variables; 25 private Map<String, Object> variables;
25 26
  27 + @Schema(description = "下一个节点审批人", example = "{nodeId:[1, 2]}")
  28 + private Map<String, List<Long>> nextAssignees; // 为什么是 Map,而不是 List 呢?因为下一个节点可能是多个,例如说并行网关的情况
  29 +
26 } 30 }
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskPageReqVO.java
@@ -18,6 +18,9 @@ public class BpmTaskPageReqVO extends PageParam { @@ -18,6 +18,9 @@ public class BpmTaskPageReqVO extends PageParam {
18 @Schema(description = "流程分类", example = "1") 18 @Schema(description = "流程分类", example = "1")
19 private String category; 19 private String category;
20 20
  21 + @Schema(description = "流程定义的标识", example = "2048")
  22 + private String processDefinitionKey; // 精准匹配
  23 +
21 @Schema(description = "创建时间") 24 @Schema(description = "创建时间")
22 @DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) 25 @DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
23 private LocalDateTime[] createTime; 26 private LocalDateTime[] createTime;
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskRespVO.java
@@ -85,6 +85,9 @@ public class BpmTaskRespVO { @@ -85,6 +85,9 @@ public class BpmTaskRespVO {
85 @Schema(description = "是否填写审批意见", example = "false") 85 @Schema(description = "是否填写审批意见", example = "false")
86 private Boolean reasonRequire; 86 private Boolean reasonRequire;
87 87
  88 + @Schema(description = "节点类型", example = "10")
  89 + private Integer nodeType; // 参见 BpmSimpleModelNodeTypeEnum 枚举。
  90 +
88 @Data 91 @Data
89 @Schema(description = "流程实例") 92 @Schema(description = "流程实例")
90 public static class ProcessInstance { 93 public static class ProcessInstance {
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmProcessInstanceConvert.java
@@ -76,6 +76,15 @@ public interface BpmProcessInstanceConvert { @@ -76,6 +76,15 @@ public interface BpmProcessInstanceConvert {
76 respVO.setStartUser(BeanUtils.toBean(startUser, UserSimpleBaseVO.class)); 76 respVO.setStartUser(BeanUtils.toBean(startUser, UserSimpleBaseVO.class));
77 MapUtils.findAndThen(deptMap, startUser.getDeptId(), dept -> respVO.getStartUser().setDeptName(dept.getName())); 77 MapUtils.findAndThen(deptMap, startUser.getDeptId(), dept -> respVO.getStartUser().setDeptName(dept.getName()));
78 } 78 }
  79 + if (CollUtil.isNotEmpty(respVO.getTasks())) {
  80 + respVO.getTasks().forEach(task -> {
  81 + AdminUserRespDTO assigneeUser = userMap.get(task.getAssignee());
  82 + if (assigneeUser!= null) {
  83 + task.setAssigneeUser(BeanUtils.toBean(assigneeUser, UserSimpleBaseVO.class));
  84 + MapUtils.findAndThen(deptMap, assigneeUser.getDeptId(), dept -> task.getAssigneeUser().setDeptName(dept.getName()));
  85 + }
  86 + });
  87 + }
79 } 88 }
80 // 摘要 89 // 摘要
81 respVO.setSummary(FlowableUtils.getSummary(processDefinitionInfoMap.get(respVO.getProcessDefinitionId()), 90 respVO.setSummary(FlowableUtils.getSummary(processDefinitionInfoMap.get(respVO.getProcessDefinitionId()),
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/definition/BpmProcessDefinitionInfoDO.java
@@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.bpm.dal.dataobject.definition; @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.bpm.dal.dataobject.definition;
2 2
3 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; 3 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
4 import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler; 4 import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler;
5 -import cn.iocoder.yudao.framework.mybatis.core.type.StringListTypeHandler;  
6 import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelMetaInfoVO; 5 import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelMetaInfoVO;
7 import cn.iocoder.yudao.module.bpm.enums.definition.BpmAutoApproveTypeEnum; 6 import cn.iocoder.yudao.module.bpm.enums.definition.BpmAutoApproveTypeEnum;
8 import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelFormTypeEnum; 7 import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelFormTypeEnum;
@@ -61,6 +60,14 @@ public class BpmProcessDefinitionInfoDO extends BaseDO { @@ -61,6 +60,14 @@ public class BpmProcessDefinitionInfoDO extends BaseDO {
61 private Integer modelType; 60 private Integer modelType;
62 61
63 /** 62 /**
  63 + * 流程分类的编码
  64 + *
  65 + * 关联 {@link BpmCategoryDO#getCode()}
  66 + *
  67 + * 为什么要存储?原因是,{@link ProcessDefinition#getCategory()} 无法设置
  68 + */
  69 + private String category;
  70 + /**
64 * 图标 71 * 图标
65 */ 72 */
66 private String icon; 73 private String icon;
@@ -149,7 +156,7 @@ public class BpmProcessDefinitionInfoDO extends BaseDO { @@ -149,7 +156,7 @@ public class BpmProcessDefinitionInfoDO extends BaseDO {
149 * 156 *
150 * 关联 {@link AdminUserRespDTO#getId()} 字段的数组 157 * 关联 {@link AdminUserRespDTO#getId()} 字段的数组
151 */ 158 */
152 - @TableField(typeHandler = StringListTypeHandler.class) // 为了可以使用 find_in_set 进行过滤 159 + @TableField(typeHandler = LongListTypeHandler.class) // 为了可以使用 find_in_set 进行过滤
153 private List<Long> managerUserIds; 160 private List<Long> managerUserIds;
154 161
155 /** 162 /**
@@ -175,11 +182,21 @@ public class BpmProcessDefinitionInfoDO extends BaseDO { @@ -175,11 +182,21 @@ public class BpmProcessDefinitionInfoDO extends BaseDO {
175 */ 182 */
176 @TableField(typeHandler = JacksonTypeHandler.class) 183 @TableField(typeHandler = JacksonTypeHandler.class)
177 private BpmModelMetaInfoVO.TitleSetting titleSetting; 184 private BpmModelMetaInfoVO.TitleSetting titleSetting;
178 -  
179 /** 185 /**
180 * 摘要设置 186 * 摘要设置
181 */ 187 */
182 @TableField(typeHandler = JacksonTypeHandler.class) 188 @TableField(typeHandler = JacksonTypeHandler.class)
183 private BpmModelMetaInfoVO.SummarySetting summarySetting; 189 private BpmModelMetaInfoVO.SummarySetting summarySetting;
184 190
  191 + /**
  192 + * 流程前置通知设置
  193 + */
  194 + @TableField(typeHandler = JacksonTypeHandler.class)
  195 + private BpmModelMetaInfoVO.HttpRequestSetting processBeforeTriggerSetting;
  196 + /**
  197 + * 流程后置通知设置
  198 + */
  199 + @TableField(typeHandler = JacksonTypeHandler.class)
  200 + private BpmModelMetaInfoVO.HttpRequestSetting processAfterTriggerSetting;
  201 +
185 } 202 }
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/behavior/BpmParallelMultiInstanceBehavior.java
1 package cn.iocoder.yudao.module.bpm.framework.flowable.core.behavior; 1 package cn.iocoder.yudao.module.bpm.framework.flowable.core.behavior;
2 2
3 import cn.hutool.core.collection.CollUtil; 3 import cn.hutool.core.collection.CollUtil;
  4 +import cn.iocoder.yudao.framework.common.util.collection.SetUtils;
  5 +import cn.iocoder.yudao.module.bpm.enums.definition.BpmChildProcessMultiInstanceSourceTypeEnum;
4 import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateInvoker; 6 import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateInvoker;
  7 +import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils;
5 import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils; 8 import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils;
6 -import cn.iocoder.yudao.framework.common.util.collection.SetUtils;  
7 import lombok.Setter; 9 import lombok.Setter;
8 import org.flowable.bpmn.model.Activity; 10 import org.flowable.bpmn.model.Activity;
  11 +import org.flowable.bpmn.model.CallActivity;
  12 +import org.flowable.bpmn.model.FlowElement;
  13 +import org.flowable.bpmn.model.UserTask;
9 import org.flowable.engine.delegate.DelegateExecution; 14 import org.flowable.engine.delegate.DelegateExecution;
10 import org.flowable.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior; 15 import org.flowable.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior;
11 import org.flowable.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior; 16 import org.flowable.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior;
12 17
  18 +import java.util.List;
13 import java.util.Set; 19 import java.util.Set;
14 20
15 /** 21 /**
@@ -42,27 +48,44 @@ public class BpmParallelMultiInstanceBehavior extends ParallelMultiInstanceBehav @@ -42,27 +48,44 @@ public class BpmParallelMultiInstanceBehavior extends ParallelMultiInstanceBehav
42 */ 48 */
43 @Override 49 @Override
44 protected int resolveNrOfInstances(DelegateExecution execution) { 50 protected int resolveNrOfInstances(DelegateExecution execution) {
45 - // 第一步,设置 collectionVariable 和 CollectionVariable  
46 - // 从 execution.getVariable() 读取所有任务处理人的 key  
47 - super.collectionExpression = null; // collectionExpression 和 collectionVariable 是互斥的  
48 - super.collectionVariable = FlowableUtils.formatExecutionCollectionVariable(execution.getCurrentActivityId());  
49 - // 从 execution.getVariable() 读取当前所有任务处理的人的 key  
50 - super.collectionElementVariable = FlowableUtils.formatExecutionCollectionElementVariable(execution.getCurrentActivityId()); 51 + // 情况一:UserTask 节点
  52 + if (execution.getCurrentFlowElement() instanceof UserTask) {
  53 + // 第一步,设置 collectionVariable 和 CollectionVariable
  54 + // 从 execution.getVariable() 读取所有任务处理人的 key
  55 + super.collectionExpression = null; // collectionExpression 和 collectionVariable 是互斥的
  56 + super.collectionVariable = FlowableUtils.formatExecutionCollectionVariable(execution.getCurrentActivityId());
  57 + // 从 execution.getVariable() 读取当前所有任务处理的人的 key
  58 + super.collectionElementVariable = FlowableUtils.formatExecutionCollectionElementVariable(execution.getCurrentActivityId());
51 59
52 - // 第二步,获取任务的所有处理人  
53 - @SuppressWarnings("unchecked")  
54 - Set<Long> assigneeUserIds = (Set<Long>) execution.getVariable(super.collectionVariable, Set.class);  
55 - if (assigneeUserIds == null) {  
56 - assigneeUserIds = taskCandidateInvoker.calculateUsersByTask(execution);  
57 - if (CollUtil.isEmpty(assigneeUserIds)) {  
58 - // 特殊:如果没有处理人的情况下,至少有一个 null 空元素,避免自动通过!  
59 - // 这样,保证在 BpmUserTaskActivityBehavior 至少创建出一个 Task 任务  
60 - // 用途:1)审批人为空时;2)审批类型为自动通过、自动拒绝时  
61 - assigneeUserIds = SetUtils.asSet((Long) null); 60 + // 第二步,获取任务的所有处理人
  61 + @SuppressWarnings("unchecked")
  62 + Set<Long> assigneeUserIds = (Set<Long>) execution.getVariable(super.collectionVariable, Set.class);
  63 + if (assigneeUserIds == null) {
  64 + assigneeUserIds = taskCandidateInvoker.calculateUsersByTask(execution);
  65 + if (CollUtil.isEmpty(assigneeUserIds)) {
  66 + // 特殊:如果没有处理人的情况下,至少有一个 null 空元素,避免自动通过!
  67 + // 这样,保证在 BpmUserTaskActivityBehavior 至少创建出一个 Task 任务
  68 + // 用途:1)审批人为空时;2)审批类型为自动通过、自动拒绝时
  69 + assigneeUserIds = SetUtils.asSet((Long) null);
  70 + }
  71 + execution.setVariableLocal(super.collectionVariable, assigneeUserIds);
62 } 72 }
63 - execution.setVariableLocal(super.collectionVariable, assigneeUserIds); 73 + return assigneeUserIds.size();
64 } 74 }
65 - return assigneeUserIds.size(); 75 +
  76 + // 情况二:CallActivity 节点
  77 + if (execution.getCurrentFlowElement() instanceof CallActivity) {
  78 + FlowElement flowElement = execution.getCurrentFlowElement();
  79 + Integer sourceType = BpmnModelUtils.parseMultiInstanceSourceType(flowElement);
  80 + if (sourceType.equals(BpmChildProcessMultiInstanceSourceTypeEnum.NUMBER_FORM.getType())) {
  81 + return execution.getVariable(super.collectionExpression.getExpressionText(), Integer.class);
  82 + }
  83 + if (sourceType.equals(BpmChildProcessMultiInstanceSourceTypeEnum.MULTIPLE_FORM.getType())) {
  84 + return execution.getVariable(super.collectionExpression.getExpressionText(), List.class).size();
  85 + }
  86 + }
  87 +
  88 + return super.resolveNrOfInstances(execution);
66 } 89 }
67 90
68 } 91 }
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/behavior/BpmSequentialMultiInstanceBehavior.java
@@ -2,14 +2,20 @@ package cn.iocoder.yudao.module.bpm.framework.flowable.core.behavior; @@ -2,14 +2,20 @@ package cn.iocoder.yudao.module.bpm.framework.flowable.core.behavior;
2 2
3 import cn.hutool.core.collection.CollUtil; 3 import cn.hutool.core.collection.CollUtil;
4 import cn.iocoder.yudao.framework.common.util.collection.SetUtils; 4 import cn.iocoder.yudao.framework.common.util.collection.SetUtils;
  5 +import cn.iocoder.yudao.module.bpm.enums.definition.BpmChildProcessMultiInstanceSourceTypeEnum;
5 import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateInvoker; 6 import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateInvoker;
  7 +import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils;
6 import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils; 8 import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils;
7 import lombok.Setter; 9 import lombok.Setter;
8 import org.flowable.bpmn.model.Activity; 10 import org.flowable.bpmn.model.Activity;
  11 +import org.flowable.bpmn.model.CallActivity;
  12 +import org.flowable.bpmn.model.FlowElement;
  13 +import org.flowable.bpmn.model.UserTask;
9 import org.flowable.engine.delegate.DelegateExecution; 14 import org.flowable.engine.delegate.DelegateExecution;
10 import org.flowable.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior; 15 import org.flowable.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior;
11 import org.flowable.engine.impl.bpmn.behavior.SequentialMultiInstanceBehavior; 16 import org.flowable.engine.impl.bpmn.behavior.SequentialMultiInstanceBehavior;
12 17
  18 +import java.util.List;
13 import java.util.Set; 19 import java.util.Set;
14 20
15 /** 21 /**
@@ -35,28 +41,45 @@ public class BpmSequentialMultiInstanceBehavior extends SequentialMultiInstanceB @@ -35,28 +41,45 @@ public class BpmSequentialMultiInstanceBehavior extends SequentialMultiInstanceB
35 */ 41 */
36 @Override 42 @Override
37 protected int resolveNrOfInstances(DelegateExecution execution) { 43 protected int resolveNrOfInstances(DelegateExecution execution) {
38 - // 第一步,设置 collectionVariable 和 CollectionVariable  
39 - // 从 execution.getVariable() 读取所有任务处理人的 key  
40 - super.collectionExpression = null; // collectionExpression 和 collectionVariable 是互斥的  
41 - super.collectionVariable = FlowableUtils.formatExecutionCollectionVariable(execution.getCurrentActivityId());  
42 - // 从 execution.getVariable() 读取当前所有任务处理的人的 key  
43 - super.collectionElementVariable = FlowableUtils.formatExecutionCollectionElementVariable(execution.getCurrentActivityId());  
44 -  
45 - // 第二步,获取任务的所有处理人  
46 - // 不使用 execution.getVariable 原因:目前依次审批任务回退后 collectionVariable 变量没有清理, 如果重新进入该任务不会重新分配审批人  
47 - @SuppressWarnings("unchecked")  
48 - Set<Long> assigneeUserIds = (Set<Long>) execution.getVariableLocal(super.collectionVariable, Set.class);  
49 - if (assigneeUserIds == null) {  
50 - assigneeUserIds = taskCandidateInvoker.calculateUsersByTask(execution);  
51 - if (CollUtil.isEmpty(assigneeUserIds)) {  
52 - // 特殊:如果没有处理人的情况下,至少有一个 null 空元素,避免自动通过!  
53 - // 这样,保证在 BpmUserTaskActivityBehavior 至少创建出一个 Task 任务  
54 - // 用途:1)审批人为空时;2)审批类型为自动通过、自动拒绝时  
55 - assigneeUserIds = SetUtils.asSet((Long) null); 44 + // 情况一:UserTask 节点
  45 + if (execution.getCurrentFlowElement() instanceof UserTask) {
  46 + // 第一步,设置 collectionVariable 和 CollectionVariable
  47 + // 从 execution.getVariable() 读取所有任务处理人的 key
  48 + super.collectionExpression = null; // collectionExpression 和 collectionVariable 是互斥的
  49 + super.collectionVariable = FlowableUtils.formatExecutionCollectionVariable(execution.getCurrentActivityId());
  50 + // 从 execution.getVariable() 读取当前所有任务处理的人的 key
  51 + super.collectionElementVariable = FlowableUtils.formatExecutionCollectionElementVariable(execution.getCurrentActivityId());
  52 +
  53 + // 第二步,获取任务的所有处理人
  54 + // 不使用 execution.getVariable 原因:目前依次审批任务回退后 collectionVariable 变量没有清理, 如果重新进入该任务不会重新分配审批人
  55 + @SuppressWarnings("unchecked")
  56 + Set<Long> assigneeUserIds = (Set<Long>) execution.getVariableLocal(super.collectionVariable, Set.class);
  57 + if (assigneeUserIds == null) {
  58 + assigneeUserIds = taskCandidateInvoker.calculateUsersByTask(execution);
  59 + if (CollUtil.isEmpty(assigneeUserIds)) {
  60 + // 特殊:如果没有处理人的情况下,至少有一个 null 空元素,避免自动通过!
  61 + // 这样,保证在 BpmUserTaskActivityBehavior 至少创建出一个 Task 任务
  62 + // 用途:1)审批人为空时;2)审批类型为自动通过、自动拒绝时
  63 + assigneeUserIds = SetUtils.asSet((Long) null);
  64 + }
  65 + execution.setVariableLocal(super.collectionVariable, assigneeUserIds);
  66 + }
  67 + return assigneeUserIds.size();
  68 + }
  69 +
  70 + // 情况二:CallActivity 节点
  71 + if (execution.getCurrentFlowElement() instanceof CallActivity) {
  72 + FlowElement flowElement = execution.getCurrentFlowElement();
  73 + Integer sourceType = BpmnModelUtils.parseMultiInstanceSourceType(flowElement);
  74 + if (sourceType.equals(BpmChildProcessMultiInstanceSourceTypeEnum.NUMBER_FORM.getType())) {
  75 + return execution.getVariable(super.collectionExpression.getExpressionText(), Integer.class);
  76 + }
  77 + if (sourceType.equals(BpmChildProcessMultiInstanceSourceTypeEnum.MULTIPLE_FORM.getType())) {
  78 + return execution.getVariable(super.collectionExpression.getExpressionText(), List.class).size();
56 } 79 }
57 - execution.setVariableLocal(super.collectionVariable, assigneeUserIds);  
58 } 80 }
59 - return assigneeUserIds.size(); 81 +
  82 + return super.resolveNrOfInstances(execution);
60 } 83 }
61 84
62 } 85 }
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/behavior/BpmUserTaskActivityBehavior.java
@@ -10,7 +10,10 @@ import org.flowable.common.engine.impl.el.ExpressionManager; @@ -10,7 +10,10 @@ import org.flowable.common.engine.impl.el.ExpressionManager;
10 import org.flowable.engine.delegate.DelegateExecution; 10 import org.flowable.engine.delegate.DelegateExecution;
11 import org.flowable.engine.impl.bpmn.behavior.UserTaskActivityBehavior; 11 import org.flowable.engine.impl.bpmn.behavior.UserTaskActivityBehavior;
12 import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl; 12 import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
  13 +import org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntity;
  14 +import org.flowable.engine.impl.util.CommandContextUtil;
13 import org.flowable.engine.impl.util.TaskHelper; 15 import org.flowable.engine.impl.util.TaskHelper;
  16 +import org.flowable.engine.interceptor.CreateUserTaskBeforeContext;
14 import org.flowable.task.service.TaskService; 17 import org.flowable.task.service.TaskService;
15 import org.flowable.task.service.impl.persistence.entity.TaskEntity; 18 import org.flowable.task.service.impl.persistence.entity.TaskEntity;
16 import org.springframework.transaction.annotation.Transactional; 19 import org.springframework.transaction.annotation.Transactional;
@@ -69,4 +72,15 @@ public class BpmUserTaskActivityBehavior extends UserTaskActivityBehavior { @@ -69,4 +72,15 @@ public class BpmUserTaskActivityBehavior extends UserTaskActivityBehavior {
69 return CollUtil.get(candidateUserIds, index); 72 return CollUtil.get(candidateUserIds, index);
70 } 73 }
71 74
  75 + @Override
  76 + protected void handleCategory(CreateUserTaskBeforeContext beforeContext, ExpressionManager expressionManager,
  77 + TaskEntity task, DelegateExecution execution) {
  78 + ProcessDefinitionEntity processDefinitionEntity = CommandContextUtil.getProcessDefinitionEntityManager().findById(execution.getProcessDefinitionId());
  79 + if (processDefinitionEntity == null) {
  80 + log.warn("[handleCategory][任务编号({}) 找不到流程定义({})]", task.getId(), execution.getProcessDefinitionId());
  81 + return;
  82 + }
  83 + task.setCategory(processDefinitionEntity.getCategory());
  84 + }
  85 +
72 } 86 }
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/BpmTaskCandidateInvoker.java
@@ -19,6 +19,7 @@ import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; @@ -19,6 +19,7 @@ import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
19 import com.google.common.annotations.VisibleForTesting; 19 import com.google.common.annotations.VisibleForTesting;
20 import lombok.extern.slf4j.Slf4j; 20 import lombok.extern.slf4j.Slf4j;
21 import org.flowable.bpmn.model.BpmnModel; 21 import org.flowable.bpmn.model.BpmnModel;
  22 +import org.flowable.bpmn.model.CallActivity;
22 import org.flowable.bpmn.model.FlowElement; 23 import org.flowable.bpmn.model.FlowElement;
23 import org.flowable.bpmn.model.UserTask; 24 import org.flowable.bpmn.model.UserTask;
24 import org.flowable.engine.delegate.DelegateExecution; 25 import org.flowable.engine.delegate.DelegateExecution;
@@ -129,8 +130,12 @@ public class BpmTaskCandidateInvoker { @@ -129,8 +130,12 @@ public class BpmTaskCandidateInvoker {
129 130
130 public Set<Long> calculateUsersByActivity(BpmnModel bpmnModel, String activityId, 131 public Set<Long> calculateUsersByActivity(BpmnModel bpmnModel, String activityId,
131 Long startUserId, String processDefinitionId, Map<String, Object> processVariables) { 132 Long startUserId, String processDefinitionId, Map<String, Object> processVariables) {
132 - // 审批类型非人工审核时,不进行计算候选人。原因是:后续会自动通过、不通过 133 + // 如果是 CallActivity 子流程,不进行计算候选人
133 FlowElement flowElement = BpmnModelUtils.getFlowElementById(bpmnModel, activityId); 134 FlowElement flowElement = BpmnModelUtils.getFlowElementById(bpmnModel, activityId);
  135 + if (flowElement instanceof CallActivity) {
  136 + return new HashSet<>();
  137 + }
  138 + // 审批类型非人工审核时,不进行计算候选人。原因是:后续会自动通过、不通过
134 Integer approveType = BpmnModelUtils.parseApproveType(flowElement); 139 Integer approveType = BpmnModelUtils.parseApproveType(flowElement);
135 if (ObjectUtils.equalsAny(approveType, 140 if (ObjectUtils.equalsAny(approveType,
136 BpmUserTaskApproveTypeEnum.AUTO_APPROVE.getType(), 141 BpmUserTaskApproveTypeEnum.AUTO_APPROVE.getType(),
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/dept/BpmTaskCandidateApproveUserSelectStrategy.java 0 → 100644
  1 +package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.dept;
  2 +
  3 +import cn.hutool.core.collection.CollUtil;
  4 +import cn.hutool.core.lang.Assert;
  5 +import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.user.BpmTaskCandidateUserStrategy;
  6 +import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum;
  7 +import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils;
  8 +import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
  9 +import com.google.common.collect.Sets;
  10 +import jakarta.annotation.Resource;
  11 +import org.flowable.bpmn.model.BpmnModel;
  12 +import org.flowable.engine.delegate.DelegateExecution;
  13 +import org.flowable.engine.runtime.ProcessInstance;
  14 +import org.springframework.context.annotation.Lazy;
  15 +import org.springframework.stereotype.Component;
  16 +
  17 +import java.util.LinkedHashSet;
  18 +import java.util.List;
  19 +import java.util.Map;
  20 +
  21 +/**
  22 + * 审批人自选 {@link BpmTaskCandidateUserStrategy} 实现类
  23 + * 审批人在审批时选择下一个节点的审批人
  24 + *
  25 + * @author smallNorthLee
  26 + */
  27 +@Component
  28 +public class BpmTaskCandidateApproveUserSelectStrategy extends AbstractBpmTaskCandidateDeptLeaderStrategy {
  29 +
  30 + @Resource
  31 + @Lazy // 延迟加载,避免循环依赖
  32 + private BpmProcessInstanceService processInstanceService;
  33 +
  34 + @Override
  35 + public BpmTaskCandidateStrategyEnum getStrategy() {
  36 + return BpmTaskCandidateStrategyEnum.APPROVE_USER_SELECT;
  37 + }
  38 +
  39 + @Override
  40 + public void validateParam(String param) {}
  41 +
  42 + @Override
  43 + public boolean isParamRequired() {
  44 + return false;
  45 + }
  46 +
  47 + @Override
  48 + public LinkedHashSet<Long> calculateUsersByTask(DelegateExecution execution, String param) {
  49 + ProcessInstance processInstance = processInstanceService.getProcessInstance(execution.getProcessInstanceId());
  50 + Assert.notNull(processInstance, "流程实例({})不能为空", execution.getProcessInstanceId());
  51 + Map<String, List<Long>> approveUserSelectAssignees = FlowableUtils.getApproveUserSelectAssignees(processInstance);
  52 + Assert.notNull(approveUserSelectAssignees, "流程实例({}) 的下一个执行节点审批人不能为空",
  53 + execution.getProcessInstanceId());
  54 + if (approveUserSelectAssignees == null) {
  55 + return Sets.newLinkedHashSet();
  56 + }
  57 + // 获得审批人
  58 + List<Long> assignees = approveUserSelectAssignees.get(execution.getCurrentActivityId());
  59 + return CollUtil.isNotEmpty(assignees) ? new LinkedHashSet<>(assignees) : Sets.newLinkedHashSet();
  60 + }
  61 +
  62 + @Override
  63 + public LinkedHashSet<Long> calculateUsersByActivity(BpmnModel bpmnModel, String activityId, String param,
  64 + Long startUserId, String processDefinitionId, Map<String, Object> processVariables) {
  65 + if (processVariables == null) {
  66 + return Sets.newLinkedHashSet();
  67 + }
  68 + // 流程预测时会使用,允许审批人为空,如果为空前端会弹出提示选择下一个节点审批人,避免流程无法进行,审批时会真正校验节点是否配置审批人
  69 + Map<String, List<Long>> approveUserSelectAssignees = FlowableUtils.getApproveUserSelectAssignees(processVariables);
  70 + if (approveUserSelectAssignees == null) {
  71 + return Sets.newLinkedHashSet();
  72 + }
  73 + // 获得审批人
  74 + List<Long> assignees = approveUserSelectAssignees.get(activityId);
  75 + return CollUtil.isNotEmpty(assignees) ? new LinkedHashSet<>(assignees) : Sets.newLinkedHashSet();
  76 + }
  77 +
  78 +}
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/dept/BpmTaskCandidateStartUserSelectStrategy.java
@@ -2,24 +2,21 @@ package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.d @@ -2,24 +2,21 @@ package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.d
2 2
3 import cn.hutool.core.collection.CollUtil; 3 import cn.hutool.core.collection.CollUtil;
4 import cn.hutool.core.lang.Assert; 4 import cn.hutool.core.lang.Assert;
5 -import cn.hutool.core.util.ObjectUtil;  
6 import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.user.BpmTaskCandidateUserStrategy; 5 import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.user.BpmTaskCandidateUserStrategy;
7 import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum; 6 import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum;
8 -import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils;  
9 import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils; 7 import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils;
10 import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService; 8 import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
11 import com.google.common.collect.Sets; 9 import com.google.common.collect.Sets;
12 import jakarta.annotation.Resource; 10 import jakarta.annotation.Resource;
13 import org.flowable.bpmn.model.BpmnModel; 11 import org.flowable.bpmn.model.BpmnModel;
14 -import org.flowable.bpmn.model.ServiceTask;  
15 -import org.flowable.bpmn.model.Task;  
16 -import org.flowable.bpmn.model.UserTask;  
17 import org.flowable.engine.delegate.DelegateExecution; 12 import org.flowable.engine.delegate.DelegateExecution;
18 import org.flowable.engine.runtime.ProcessInstance; 13 import org.flowable.engine.runtime.ProcessInstance;
19 import org.springframework.context.annotation.Lazy; 14 import org.springframework.context.annotation.Lazy;
20 import org.springframework.stereotype.Component; 15 import org.springframework.stereotype.Component;
21 16
22 -import java.util.*; 17 +import java.util.LinkedHashSet;
  18 +import java.util.List;
  19 +import java.util.Map;
23 20
24 /** 21 /**
25 * 发起人自选 {@link BpmTaskCandidateUserStrategy} 实现类 22 * 发起人自选 {@link BpmTaskCandidateUserStrategy} 实现类
@@ -55,7 +52,7 @@ public class BpmTaskCandidateStartUserSelectStrategy extends AbstractBpmTaskCand @@ -55,7 +52,7 @@ public class BpmTaskCandidateStartUserSelectStrategy extends AbstractBpmTaskCand
55 execution.getProcessInstanceId()); 52 execution.getProcessInstanceId());
56 // 获得审批人 53 // 获得审批人
57 List<Long> assignees = startUserSelectAssignees.get(execution.getCurrentActivityId()); 54 List<Long> assignees = startUserSelectAssignees.get(execution.getCurrentActivityId());
58 - return new LinkedHashSet<>(assignees); 55 + return CollUtil.isNotEmpty(assignees) ? new LinkedHashSet<>(assignees) : Sets.newLinkedHashSet();
59 } 56 }
60 57
61 @Override 58 @Override
@@ -70,28 +67,7 @@ public class BpmTaskCandidateStartUserSelectStrategy extends AbstractBpmTaskCand @@ -70,28 +67,7 @@ public class BpmTaskCandidateStartUserSelectStrategy extends AbstractBpmTaskCand
70 } 67 }
71 // 获得审批人 68 // 获得审批人
72 List<Long> assignees = startUserSelectAssignees.get(activityId); 69 List<Long> assignees = startUserSelectAssignees.get(activityId);
73 - return new LinkedHashSet<>(assignees);  
74 - }  
75 -  
76 - /**  
77 - * 获得发起人自选审批人或抄送人的 Task 列表  
78 - *  
79 - * @param bpmnModel BPMN 模型  
80 - * @return Task 列表  
81 - */  
82 - public static List<Task> getStartUserSelectTaskList(BpmnModel bpmnModel) {  
83 - if (bpmnModel == null) {  
84 - return Collections.emptyList();  
85 - }  
86 - List<Task> tasks = new ArrayList<>();  
87 - tasks.addAll(BpmnModelUtils.getBpmnModelElements(bpmnModel, UserTask.class));  
88 - tasks.addAll(BpmnModelUtils.getBpmnModelElements(bpmnModel, ServiceTask.class));  
89 - if (CollUtil.isEmpty(tasks)) {  
90 - return Collections.emptyList();  
91 - }  
92 - tasks.removeIf(task -> ObjectUtil.notEqual(BpmnModelUtils.parseCandidateStrategy(task),  
93 - BpmTaskCandidateStrategyEnum.START_USER_SELECT.getStrategy()));  
94 - return tasks; 70 + return CollUtil.isNotEmpty(assignees) ? new LinkedHashSet<>(assignees) : Sets.newLinkedHashSet();
95 } 71 }
96 72
97 } 73 }
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/enums/BpmTaskCandidateStrategyEnum.java
@@ -24,7 +24,8 @@ public enum BpmTaskCandidateStrategyEnum implements ArrayValuable&lt;Integer&gt; { @@ -24,7 +24,8 @@ public enum BpmTaskCandidateStrategyEnum implements ArrayValuable&lt;Integer&gt; {
24 MULTI_DEPT_LEADER_MULTI(23, "连续多级部门的负责人"), 24 MULTI_DEPT_LEADER_MULTI(23, "连续多级部门的负责人"),
25 POST(22, "岗位"), 25 POST(22, "岗位"),
26 USER(30, "用户"), 26 USER(30, "用户"),
27 - START_USER_SELECT(35, "发起人自选"), // 申请人自己,可在提交申请时选择此节点的审批人 27 + APPROVE_USER_SELECT(34, "审批人自身"), // 当前审批人,可在审批时,选择下一个节点的审批人
  28 + START_USER_SELECT(35, "发起人自选"), // 申请人自己,可在提交申请时,选择此节点的审批人
28 START_USER(36, "发起人自己"), // 申请人自己, 一般紧挨开始节点,常用于发起人信息审核场景 29 START_USER(36, "发起人自己"), // 申请人自己, 一般紧挨开始节点,常用于发起人信息审核场景
29 START_USER_DEPT_LEADER(37, "发起人部门负责人"), 30 START_USER_DEPT_LEADER(37, "发起人部门负责人"),
30 START_USER_DEPT_LEADER_MULTI(38, "发起人连续多级部门的负责人"), 31 START_USER_DEPT_LEADER_MULTI(38, "发起人连续多级部门的负责人"),
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/enums/BpmnModelConstants.java
1 package cn.iocoder.yudao.module.bpm.framework.flowable.core.enums; 1 package cn.iocoder.yudao.module.bpm.framework.flowable.core.enums;
2 2
  3 +import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelTypeEnum;
  4 +
3 /** 5 /**
4 * BPMN XML 常量信息 6 * BPMN XML 常量信息
5 * 7 *
@@ -67,6 +69,11 @@ public interface BpmnModelConstants { @@ -67,6 +69,11 @@ public interface BpmnModelConstants {
67 String USER_TASK_APPROVE_METHOD = "approveMethod"; 69 String USER_TASK_APPROVE_METHOD = "approveMethod";
68 70
69 /** 71 /**
  72 + * BPMN Child Process 的扩展属性,用于标记多实例来源类型
  73 + */
  74 + String CHILD_PROCESS_MULTI_INSTANCE_SOURCE_TYPE = "childProcessMultiInstanceSourceType";
  75 +
  76 + /**
70 * BPMN ExtensionElement 流程表单字段权限元素, 用于标记字段权限 77 * BPMN ExtensionElement 流程表单字段权限元素, 用于标记字段权限
71 */ 78 */
72 String FORM_FIELD_PERMISSION_ELEMENT = "fieldsPermission"; 79 String FORM_FIELD_PERMISSION_ELEMENT = "fieldsPermission";
@@ -129,4 +136,11 @@ public interface BpmnModelConstants { @@ -129,4 +136,11 @@ public interface BpmnModelConstants {
129 */ 136 */
130 String REASON_REQUIRE = "reasonRequire"; 137 String REASON_REQUIRE = "reasonRequire";
131 138
  139 + /**
  140 + * 节点类型
  141 + *
  142 + * 目前只有 {@link BpmModelTypeEnum#SIMPLE} 的 UserTask 节点会设置该属性,用于区分是审批节点、还是办理节点
  143 + */
  144 + String NODE_TYPE = "nodeType";
  145 +
132 } 146 }
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/enums/BpmnVariableConstants.java
@@ -27,9 +27,17 @@ public class BpmnVariableConstants { @@ -27,9 +27,17 @@ public class BpmnVariableConstants {
27 * 流程实例的变量 - 发起用户选择的审批人 Map 27 * 流程实例的变量 - 发起用户选择的审批人 Map
28 * 28 *
29 * @see ProcessInstance#getProcessVariables() 29 * @see ProcessInstance#getProcessVariables()
  30 + * @see BpmTaskCandidateStrategyEnum#START_USER_SELECT
30 */ 31 */
31 public static final String PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES = "PROCESS_START_USER_SELECT_ASSIGNEES"; 32 public static final String PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES = "PROCESS_START_USER_SELECT_ASSIGNEES";
32 /** 33 /**
  34 + * 流程实例的变量 - 审批人选择的审批人 Map
  35 + *
  36 + * @see ProcessInstance#getProcessVariables()
  37 + * @see BpmTaskCandidateStrategyEnum#APPROVE_USER_SELECT
  38 + */
  39 + public static final String PROCESS_INSTANCE_VARIABLE_APPROVE_USER_SELECT_ASSIGNEES = "PROCESS_APPROVE_USER_SELECT_ASSIGNEES";
  40 + /**
33 * 流程实例的变量 - 发起用户 ID 41 * 流程实例的变量 - 发起用户 ID
34 * 42 *
35 * @see ProcessInstance#getProcessVariables() 43 * @see ProcessInstance#getProcessVariables()
@@ -52,6 +60,13 @@ public class BpmnVariableConstants { @@ -52,6 +60,13 @@ public class BpmnVariableConstants {
52 public static final String PROCESS_INSTANCE_SKIP_EXPRESSION_ENABLED = "_FLOWABLE_SKIP_EXPRESSION_ENABLED"; 60 public static final String PROCESS_INSTANCE_SKIP_EXPRESSION_ENABLED = "_FLOWABLE_SKIP_EXPRESSION_ENABLED";
53 61
54 /** 62 /**
  63 + * 流程实例的变量 - 用于判断流程是否需要跳过发起人节点
  64 + *
  65 + * @see ProcessInstance#getProcessVariables()
  66 + */
  67 + public static final String PROCESS_INSTANCE_VARIABLE_SKIP_START_USER_NODE = "PROCESS_SKIP_START_USER_NODE";
  68 +
  69 + /**
55 * 流程实例的变量 - 流程开始时间 70 * 流程实例的变量 - 流程开始时间
56 * 71 *
57 * 【非存储变量】用于部分需要 format 的场景,例如说:流程实例的自定义标题 72 * 【非存储变量】用于部分需要 format 的场景,例如说:流程实例的自定义标题
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/listener/BpmProcessInstanceEventListener.java
@@ -22,6 +22,7 @@ import java.util.Set; @@ -22,6 +22,7 @@ import java.util.Set;
22 public class BpmProcessInstanceEventListener extends AbstractFlowableEngineEventListener { 22 public class BpmProcessInstanceEventListener extends AbstractFlowableEngineEventListener {
23 23
24 public static final Set<FlowableEngineEventType> PROCESS_INSTANCE_EVENTS = ImmutableSet.<FlowableEngineEventType>builder() 24 public static final Set<FlowableEngineEventType> PROCESS_INSTANCE_EVENTS = ImmutableSet.<FlowableEngineEventType>builder()
  25 + .add(FlowableEngineEventType.PROCESS_CREATED)
25 .add(FlowableEngineEventType.PROCESS_COMPLETED) 26 .add(FlowableEngineEventType.PROCESS_COMPLETED)
26 .add(FlowableEngineEventType.PROCESS_CANCELLED) 27 .add(FlowableEngineEventType.PROCESS_CANCELLED)
27 .build(); 28 .build();
@@ -35,6 +36,11 @@ public class BpmProcessInstanceEventListener extends AbstractFlowableEngineEvent @@ -35,6 +36,11 @@ public class BpmProcessInstanceEventListener extends AbstractFlowableEngineEvent
35 } 36 }
36 37
37 @Override 38 @Override
  39 + protected void processCreated(FlowableEngineEntityEvent event) {
  40 + processInstanceService.processProcessInstanceCreated((ProcessInstance)event.getEntity());
  41 + }
  42 +
  43 + @Override
38 protected void processCompleted(FlowableEngineEntityEvent event) { 44 protected void processCompleted(FlowableEngineEntityEvent event) {
39 processInstanceService.processProcessInstanceCompleted((ProcessInstance)event.getEntity()); 45 processInstanceService.processProcessInstanceCompleted((ProcessInstance)event.getEntity());
40 } 46 }
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/listener/BpmTaskEventListener.java
@@ -109,7 +109,11 @@ public class BpmTaskEventListener extends AbstractFlowableEngineEventListener { @@ -109,7 +109,11 @@ public class BpmTaskEventListener extends AbstractFlowableEngineEventListener {
109 // 2.2 延迟器超时处理 109 // 2.2 延迟器超时处理
110 } else if (ObjectUtil.equal(bpmTimerBoundaryEventType, BpmBoundaryEventTypeEnum.DELAY_TIMER_TIMEOUT)) { 110 } else if (ObjectUtil.equal(bpmTimerBoundaryEventType, BpmBoundaryEventTypeEnum.DELAY_TIMER_TIMEOUT)) {
111 String taskKey = boundaryEvent.getAttachedToRefId(); 111 String taskKey = boundaryEvent.getAttachedToRefId();
112 - taskService.processDelayTimerTimeout(event.getProcessInstanceId(), taskKey); 112 + taskService.triggerTask(event.getProcessInstanceId(), taskKey);
  113 + // 2.3 子流程超时处理
  114 + } else if (ObjectUtil.equal(bpmTimerBoundaryEventType, BpmBoundaryEventTypeEnum.CHILD_PROCESS_TIMEOUT)) {
  115 + String taskKey = boundaryEvent.getAttachedToRefId();
  116 + taskService.processChildProcessTimeout(event.getProcessInstanceId(), taskKey);
113 } 117 }
114 } 118 }
115 119
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/BpmHttpRequestUtils.java 0 → 100644
  1 +package cn.iocoder.yudao.module.bpm.framework.flowable.core.util;
  2 +
  3 +import cn.hutool.core.collection.CollUtil;
  4 +import cn.hutool.core.util.StrUtil;
  5 +import cn.iocoder.yudao.framework.common.core.KeyValue;
  6 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  7 +import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
  8 +import cn.iocoder.yudao.framework.common.util.spring.SpringUtils;
  9 +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO;
  10 +import cn.iocoder.yudao.module.bpm.enums.definition.BpmHttpRequestParamTypeEnum;
  11 +import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
  12 +import com.fasterxml.jackson.core.type.TypeReference;
  13 +import lombok.extern.slf4j.Slf4j;
  14 +import org.flowable.engine.runtime.ProcessInstance;
  15 +import org.springframework.http.HttpEntity;
  16 +import org.springframework.http.HttpMethod;
  17 +import org.springframework.http.ResponseEntity;
  18 +import org.springframework.util.LinkedMultiValueMap;
  19 +import org.springframework.util.MultiValueMap;
  20 +import org.springframework.web.client.RestClientException;
  21 +import org.springframework.web.client.RestTemplate;
  22 +
  23 +import java.util.HashMap;
  24 +import java.util.List;
  25 +import java.util.Map;
  26 +
  27 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
  28 +import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.HEADER_TENANT_ID;
  29 +import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.PROCESS_INSTANCE_HTTP_TRIGGER_CALL_ERROR;
  30 +
  31 +/**
  32 + * 工作流发起 HTTP 请求工具类
  33 + *
  34 + * @author 芋道源码
  35 + */
  36 +@Slf4j
  37 +public class BpmHttpRequestUtils {
  38 +
  39 + public static void executeBpmHttpRequest(ProcessInstance processInstance,
  40 + String url,
  41 + List<BpmSimpleModelNodeVO.HttpRequestParam> headerParams,
  42 + List<BpmSimpleModelNodeVO.HttpRequestParam> bodyParams,
  43 + Boolean handleResponse,
  44 + List<KeyValue<String, String>> response) {
  45 + RestTemplate restTemplate = SpringUtils.getBean(RestTemplate.class);
  46 + BpmProcessInstanceService processInstanceService = SpringUtils.getBean(BpmProcessInstanceService.class);
  47 +
  48 + // 1.1 设置请求头
  49 + MultiValueMap<String, String> headers = buildHttpHeaders(processInstance, headerParams);
  50 + // 1.2 设置请求体
  51 + MultiValueMap<String, String> body = buildHttpBody(processInstance, bodyParams);
  52 +
  53 + // 2. 发起请求
  54 + ResponseEntity<String> responseEntity = sendHttpRequest(url, headers, body, restTemplate);
  55 +
  56 + // 3. 处理返回
  57 + if (Boolean.FALSE.equals(handleResponse)) {
  58 + return;
  59 + }
  60 + // 3.1 判断是否需要解析返回值
  61 + if (responseEntity == null
  62 + || StrUtil.isEmpty(responseEntity.getBody())
  63 + || !responseEntity.getStatusCode().is2xxSuccessful()
  64 + || CollUtil.isEmpty(response)) {
  65 + return;
  66 + }
  67 + // 3.2 解析返回值, 返回值必须符合 CommonResult 规范。
  68 + CommonResult<Map<String, Object>> respResult = JsonUtils.parseObjectQuietly(responseEntity.getBody(),
  69 + new TypeReference<>() {});
  70 + if (respResult == null || !respResult.isSuccess()) {
  71 + return;
  72 + }
  73 + // 3.3 获取需要更新的流程变量
  74 + Map<String, Object> updateVariables = getNeedUpdatedVariablesFromResponse(respResult.getData(), response);
  75 + // 3.4 更新流程变量
  76 + if (CollUtil.isNotEmpty(updateVariables)) {
  77 + processInstanceService.updateProcessInstanceVariables(processInstance.getId(), updateVariables);
  78 + }
  79 + }
  80 +
  81 + public static ResponseEntity<String> sendHttpRequest(String url,
  82 + MultiValueMap<String, String> headers,
  83 + MultiValueMap<String, String> body,
  84 + RestTemplate restTemplate) {
  85 + HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(body, headers);
  86 + ResponseEntity<String> responseEntity;
  87 + try {
  88 + responseEntity = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class);
  89 + log.info("[sendHttpRequest][HTTP 触发器,请求头:{},请求体:{},响应结果:{}]", headers, body, responseEntity);
  90 + } catch (RestClientException e) {
  91 + log.error("[sendHttpRequest][HTTP 触发器,请求头:{},请求体:{},请求出错:{}]", headers, body, e.getMessage());
  92 + throw exception(PROCESS_INSTANCE_HTTP_TRIGGER_CALL_ERROR);
  93 + }
  94 + return responseEntity;
  95 + }
  96 +
  97 + public static MultiValueMap<String, String> buildHttpHeaders(ProcessInstance processInstance,
  98 + List<BpmSimpleModelNodeVO.HttpRequestParam> headerSettings) {
  99 + Map<String, Object> processVariables = processInstance.getProcessVariables();
  100 + MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
  101 + headers.add(HEADER_TENANT_ID, processInstance.getTenantId());
  102 + addHttpRequestParam(headers, headerSettings, processVariables);
  103 + return headers;
  104 + }
  105 +
  106 + public static MultiValueMap<String, String> buildHttpBody(ProcessInstance processInstance,
  107 + List<BpmSimpleModelNodeVO.HttpRequestParam> bodySettings) {
  108 + Map<String, Object> processVariables = processInstance.getProcessVariables();
  109 + MultiValueMap<String, String> body = new LinkedMultiValueMap<>();
  110 + addHttpRequestParam(body, bodySettings, processVariables);
  111 + body.add("processInstanceId", processInstance.getId());
  112 + return body;
  113 + }
  114 +
  115 + /**
  116 + * 从请求返回值获取需要更新的流程变量
  117 + *
  118 + * @param result 请求返回结果
  119 + * @param responseSettings 返回设置
  120 + * @return 需要更新的流程变量
  121 + */
  122 + public static Map<String, Object> getNeedUpdatedVariablesFromResponse(Map<String, Object> result,
  123 + List<KeyValue<String, String>> responseSettings) {
  124 + Map<String, Object> updateVariables = new HashMap<>();
  125 + if (CollUtil.isEmpty(result)) {
  126 + return updateVariables;
  127 + }
  128 + responseSettings.forEach(responseSetting -> {
  129 + if (StrUtil.isNotEmpty(responseSetting.getKey()) && result.containsKey(responseSetting.getValue())) {
  130 + updateVariables.put(responseSetting.getKey(), result.get(responseSetting.getValue()));
  131 + }
  132 + });
  133 + return updateVariables;
  134 + }
  135 +
  136 + /**
  137 + * 添加 HTTP 请求参数。请求头或者请求体
  138 + *
  139 + * @param params HTTP 请求参数
  140 + * @param paramSettings HTTP 请求参数设置
  141 + * @param processVariables 流程变量
  142 + */
  143 + public static void addHttpRequestParam(MultiValueMap<String, String> params,
  144 + List<BpmSimpleModelNodeVO.HttpRequestParam> paramSettings,
  145 + Map<String, Object> processVariables) {
  146 + if (CollUtil.isEmpty(paramSettings)) {
  147 + return;
  148 + }
  149 + paramSettings.forEach(item -> {
  150 + if (item.getType().equals(BpmHttpRequestParamTypeEnum.FIXED_VALUE.getType())) {
  151 + params.add(item.getKey(), item.getValue());
  152 + } else if (item.getType().equals(BpmHttpRequestParamTypeEnum.FROM_FORM.getType())) {
  153 + params.add(item.getKey(), processVariables.get(item.getValue()).toString());
  154 + }
  155 + });
  156 + }
  157 +
  158 +}
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/BpmnModelUtils.java
@@ -159,6 +159,17 @@ public class BpmnModelUtils { @@ -159,6 +159,17 @@ public class BpmnModelUtils {
159 } 159 }
160 160
161 /** 161 /**
  162 + * 解析子流程多实例来源类型
  163 + *
  164 + * @see BpmChildProcessMultiInstanceSourceTypeEnum
  165 + * @param element 任务节点
  166 + * @return 多实例来源类型
  167 + */
  168 + public static Integer parseMultiInstanceSourceType(FlowElement element) {
  169 + return NumberUtils.parseInt(parseExtensionElement(element, BpmnModelConstants.CHILD_PROCESS_MULTI_INSTANCE_SOURCE_TYPE));
  170 + }
  171 +
  172 + /**
162 * 添加任务拒绝处理元素 173 * 添加任务拒绝处理元素
163 * 174 *
164 * @param rejectHandler 任务拒绝处理 175 * @param rejectHandler 任务拒绝处理
@@ -410,6 +421,26 @@ public class BpmnModelUtils { @@ -410,6 +421,26 @@ public class BpmnModelUtils {
410 return parseExtensionElement(flowElement, TRIGGER_PARAM); 421 return parseExtensionElement(flowElement, TRIGGER_PARAM);
411 } 422 }
412 423
  424 + /**
  425 + * 给节点添加节点类型
  426 + *
  427 + * @param nodeType 节点类型
  428 + * @param flowElement 节点
  429 + */
  430 + public static void addNodeType(Integer nodeType, FlowElement flowElement) {
  431 + addExtensionElement(flowElement, BpmnModelConstants.NODE_TYPE, nodeType);
  432 + }
  433 +
  434 + /**
  435 + * 解析节点类型
  436 + *
  437 + * @param flowElement 节点
  438 + * @return 节点类型
  439 + */
  440 + public static Integer parseNodeType(FlowElement flowElement) {
  441 + return NumberUtils.parseInt(parseExtensionElement(flowElement, BpmnModelConstants.NODE_TYPE));
  442 + }
  443 +
413 // ========== BPM 简单查找相关的方法 ========== 444 // ========== BPM 简单查找相关的方法 ==========
414 445
415 /** 446 /**
@@ -777,71 +808,206 @@ public class BpmnModelUtils { @@ -777,71 +808,206 @@ public class BpmnModelUtils {
777 // 情况:ExclusiveGateway 排它,只有一个满足条件的。如果没有,就走默认的 808 // 情况:ExclusiveGateway 排它,只有一个满足条件的。如果没有,就走默认的
778 if (currentElement instanceof ExclusiveGateway) { 809 if (currentElement instanceof ExclusiveGateway) {
779 // 查找满足条件的 SequenceFlow 路径 810 // 查找满足条件的 SequenceFlow 路径
780 - Gateway gateway = (Gateway) currentElement;  
781 - SequenceFlow matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(),  
782 - flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId())  
783 - && evalConditionExpress(variables, flow.getConditionExpression()));  
784 - if (matchSequenceFlow == null) {  
785 - matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(),  
786 - flow -> ObjUtil.equal(gateway.getDefaultFlow(), flow.getId()));  
787 - // 特殊:没有默认的情况下,并且只有 1 个条件,则认为它是默认的  
788 - if (matchSequenceFlow == null && gateway.getOutgoingFlows().size() == 1) {  
789 - matchSequenceFlow = gateway.getOutgoingFlows().get(0);  
790 - }  
791 - } 811 + SequenceFlow matchSequenceFlow = findMatchSequenceFlowByExclusiveGateway((Gateway) currentElement, variables);
792 // 遍历满足条件的 SequenceFlow 路径 812 // 遍历满足条件的 SequenceFlow 路径
793 if (matchSequenceFlow != null) { 813 if (matchSequenceFlow != null) {
794 simulateNextFlowElements(matchSequenceFlow.getTargetFlowElement(), variables, resultElements, visitElements); 814 simulateNextFlowElements(matchSequenceFlow.getTargetFlowElement(), variables, resultElements, visitElements);
795 } 815 }
796 - return;  
797 } 816 }
798 -  
799 // 情况:InclusiveGateway 包容,多个满足条件的。如果没有,就走默认的 817 // 情况:InclusiveGateway 包容,多个满足条件的。如果没有,就走默认的
800 - if (currentElement instanceof InclusiveGateway) { 818 + else if (currentElement instanceof InclusiveGateway) {
801 // 查找满足条件的 SequenceFlow 路径 819 // 查找满足条件的 SequenceFlow 路径
802 - Gateway gateway = (Gateway) currentElement;  
803 - Collection<SequenceFlow> matchSequenceFlows = CollUtil.filterNew(gateway.getOutgoingFlows(),  
804 - flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId())  
805 - && evalConditionExpress(variables, flow.getConditionExpression()));  
806 - if (CollUtil.isEmpty(matchSequenceFlows)) {  
807 - matchSequenceFlows = CollUtil.filterNew(gateway.getOutgoingFlows(),  
808 - flow -> ObjUtil.equal(gateway.getDefaultFlow(), flow.getId()));  
809 - // 特殊:没有默认的情况下,并且只有 1 个条件,则认为它是默认的  
810 - if (CollUtil.isEmpty(matchSequenceFlows) && gateway.getOutgoingFlows().size() == 1) {  
811 - matchSequenceFlows = gateway.getOutgoingFlows();  
812 - }  
813 - } 820 + Collection<SequenceFlow> matchSequenceFlows = findMatchSequenceFlowsByInclusiveGateway((Gateway) currentElement, variables);
814 // 遍历满足条件的 SequenceFlow 路径 821 // 遍历满足条件的 SequenceFlow 路径
815 matchSequenceFlows.forEach( 822 matchSequenceFlows.forEach(
816 flow -> simulateNextFlowElements(flow.getTargetFlowElement(), variables, resultElements, visitElements)); 823 flow -> simulateNextFlowElements(flow.getTargetFlowElement(), variables, resultElements, visitElements));
817 } 824 }
818 -  
819 // 情况:ParallelGateway 并行,都满足,都走 825 // 情况:ParallelGateway 并行,都满足,都走
820 - if (currentElement instanceof ParallelGateway) { 826 + else if (currentElement instanceof ParallelGateway) {
821 Gateway gateway = (Gateway) currentElement; 827 Gateway gateway = (Gateway) currentElement;
822 // 遍历子节点 828 // 遍历子节点
823 gateway.getOutgoingFlows().forEach( 829 gateway.getOutgoingFlows().forEach(
824 nextElement -> simulateNextFlowElements(nextElement.getTargetFlowElement(), variables, resultElements, visitElements)); 830 nextElement -> simulateNextFlowElements(nextElement.getTargetFlowElement(), variables, resultElements, visitElements));
825 - return;  
826 } 831 }
827 } 832 }
828 833
829 /** 834 /**
  835 + * 根据当前节点,获取下一个节点
  836 + *
  837 + * @param currentElement 当前节点
  838 + * @param bpmnModel BPMN模型
  839 + * @param variables 流程变量
  840 + */
  841 + @SuppressWarnings("PatternVariableCanBeUsed")
  842 + public static List<FlowNode> getNextFlowNodes(FlowElement currentElement, BpmnModel bpmnModel,
  843 + Map<String, Object> variables){
  844 + List<FlowNode> nextFlowNodes = new ArrayList<>(); // 下一个执行的流程节点集合
  845 + FlowNode currentNode = (FlowNode) currentElement; // 当前执行节点的基本属性
  846 + List<SequenceFlow> outgoingFlows = currentNode.getOutgoingFlows(); // 当前节点的关联节点
  847 + if (CollUtil.isEmpty(outgoingFlows)) {
  848 + log.warn("[getNextFlowNodes][当前节点({}) 的 outgoingFlows 为空]", currentNode.getId());
  849 + return nextFlowNodes;
  850 + }
  851 +
  852 + // 遍历每个出口流
  853 + for (SequenceFlow outgoingFlow : outgoingFlows) {
  854 + // 获取目标节点的基本属性
  855 + FlowElement targetElement = bpmnModel.getFlowElement(outgoingFlow.getTargetRef());
  856 + if (targetElement == null) {
  857 + continue;
  858 + }
  859 + // 如果是结束节点,直接返回
  860 + if (targetElement instanceof EndEvent) {
  861 + break;
  862 + }
  863 + // 情况一:处理不同类型的网关
  864 + if (targetElement instanceof Gateway) {
  865 + Gateway gateway = (Gateway) targetElement;
  866 + if (gateway instanceof ExclusiveGateway) {
  867 + handleExclusiveGateway(gateway, bpmnModel, variables, nextFlowNodes);
  868 + } else if (gateway instanceof InclusiveGateway) {
  869 + handleInclusiveGateway(gateway, bpmnModel, variables, nextFlowNodes);
  870 + } else if (gateway instanceof ParallelGateway) {
  871 + handleParallelGateway(gateway, bpmnModel, variables, nextFlowNodes);
  872 + }
  873 + } else {
  874 + // 情况二:如果不是网关,直接添加到下一个节点列表
  875 + nextFlowNodes.add((FlowNode) targetElement);
  876 + }
  877 + }
  878 + return nextFlowNodes;
  879 + }
  880 +
  881 + /**
  882 + * 处理排它网关
  883 + *
  884 + * @param gateway 排他网关
  885 + * @param bpmnModel BPMN模型
  886 + * @param variables 流程变量
  887 + * @param nextFlowNodes 下一个执行的流程节点集合
  888 + */
  889 + private static void handleExclusiveGateway(Gateway gateway, BpmnModel bpmnModel,
  890 + Map<String, Object> variables, List<FlowNode> nextFlowNodes) {
  891 + // 查找满足条件的 SequenceFlow 路径
  892 + SequenceFlow matchSequenceFlow = findMatchSequenceFlowByExclusiveGateway(gateway, variables);
  893 + // 遍历满足条件的 SequenceFlow 路径
  894 + if (matchSequenceFlow != null) {
  895 + FlowElement targetElement = bpmnModel.getFlowElement(matchSequenceFlow.getTargetRef());
  896 + if (targetElement instanceof FlowNode) {
  897 + nextFlowNodes.add((FlowNode) targetElement);
  898 + }
  899 + }
  900 + }
  901 +
  902 + /**
  903 + * 处理排它网关(Exclusive Gateway),选择符合条件的路径
  904 + *
  905 + * @param gateway 排他网关
  906 + * @param variables 流程变量
  907 + * @return 符合条件的路径
  908 + */
  909 + private static SequenceFlow findMatchSequenceFlowByExclusiveGateway(Gateway gateway, Map<String, Object> variables) {
  910 + SequenceFlow matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(),
  911 + flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId())
  912 + && (evalConditionExpress(variables, flow.getConditionExpression())));
  913 + if (matchSequenceFlow == null) {
  914 + matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(),
  915 + flow -> ObjUtil.equal(gateway.getDefaultFlow(), flow.getId()));
  916 + // 特殊:没有默认的情况下,并且只有 1 个条件,则认为它是默认的
  917 + if (matchSequenceFlow == null && gateway.getOutgoingFlows().size() == 1) {
  918 + matchSequenceFlow = gateway.getOutgoingFlows().get(0);
  919 + }
  920 + }
  921 + return matchSequenceFlow;
  922 + }
  923 +
  924 + /**
  925 + * 处理包容网关
  926 + *
  927 + * @param gateway 排他网关
  928 + * @param bpmnModel BPMN模型
  929 + * @param variables 流程变量
  930 + * @param nextFlowNodes 下一个执行的流程节点集合
  931 + */
  932 + private static void handleInclusiveGateway(Gateway gateway, BpmnModel bpmnModel,
  933 + Map<String, Object> variables, List<FlowNode> nextFlowNodes) {
  934 + // 查找满足条件的 SequenceFlow 路径集合
  935 + Collection<SequenceFlow> matchSequenceFlows = findMatchSequenceFlowsByInclusiveGateway(gateway, variables);
  936 + // 遍历满足条件的 SequenceFlow 路径,获取目标节点
  937 + matchSequenceFlows.forEach(flow -> {
  938 + FlowElement targetElement = bpmnModel.getFlowElement(flow.getTargetRef());
  939 + if (targetElement instanceof FlowNode) {
  940 + nextFlowNodes.add((FlowNode) targetElement);
  941 + }
  942 + });
  943 + }
  944 +
  945 + /**
  946 + * 处理排它网关(Inclusive Gateway),选择符合条件的路径
  947 + *
  948 + * @param gateway 排他网关
  949 + * @param variables 流程变量
  950 + * @return 符合条件的路径
  951 + */
  952 + private static Collection<SequenceFlow> findMatchSequenceFlowsByInclusiveGateway(Gateway gateway, Map<String, Object> variables) {
  953 + // 查找满足条件的 SequenceFlow 路径
  954 + Collection<SequenceFlow> matchSequenceFlows = CollUtil.filterNew(gateway.getOutgoingFlows(),
  955 + flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId())
  956 + && evalConditionExpress(variables, flow.getConditionExpression()));
  957 + if (CollUtil.isEmpty(matchSequenceFlows)) {
  958 + matchSequenceFlows = CollUtil.filterNew(gateway.getOutgoingFlows(),
  959 + flow -> ObjUtil.equal(gateway.getDefaultFlow(), flow.getId()));
  960 + // 特殊:没有默认的情况下,并且只有 1 个条件,则认为它是默认的
  961 + if (CollUtil.isEmpty(matchSequenceFlows) && gateway.getOutgoingFlows().size() == 1) {
  962 + matchSequenceFlows = gateway.getOutgoingFlows();
  963 + }
  964 + }
  965 + return matchSequenceFlows;
  966 + }
  967 +
  968 +
  969 + /**
  970 + * 处理并行网关
  971 + *
  972 + * @param gateway 排他网关
  973 + * @param bpmnModel BPMN模型
  974 + * @param variables 流程变量
  975 + * @param nextFlowNodes 下一个执行的流程节点集合
  976 + */
  977 + private static void handleParallelGateway(Gateway gateway, BpmnModel bpmnModel,
  978 + Map<String, Object> variables, List<FlowNode> nextFlowNodes) {
  979 + // 并行网关,遍历所有出口路径,获取目标节点
  980 + gateway.getOutgoingFlows().forEach(flow -> {
  981 + FlowElement targetElement = bpmnModel.getFlowElement(flow.getTargetRef());
  982 + if (targetElement instanceof FlowNode) {
  983 + nextFlowNodes.add((FlowNode) targetElement);
  984 + }
  985 + });
  986 + }
  987 +
  988 + /**
830 * 计算条件表达式是否为 true 满足条件 989 * 计算条件表达式是否为 true 满足条件
831 * 990 *
832 * @param variables 流程实例 991 * @param variables 流程实例
833 - * @param express 条件表达式 992 + * @param expression 条件表达式
834 * @return 是否满足条件 993 * @return 是否满足条件
835 */ 994 */
836 - public static boolean evalConditionExpress(Map<String, Object> variables, String express) {  
837 - if (express == null) { 995 + public static boolean evalConditionExpress(Map<String, Object> variables, String expression) {
  996 + if (expression == null) {
838 return Boolean.FALSE; 997 return Boolean.FALSE;
839 } 998 }
  999 + // 如果 variables 为空,则创建一个的原因?可能 expression 的计算,不依赖于 variables
  1000 + if (variables == null) {
  1001 + variables = new HashMap<>();
  1002 + }
  1003 +
  1004 + // 执行计算
840 try { 1005 try {
841 - Object result = FlowableUtils.getExpressionValue(variables, express); 1006 + Object result = FlowableUtils.getExpressionValue(variables, expression);
842 return Boolean.TRUE.equals(result); 1007 return Boolean.TRUE.equals(result);
843 } catch (FlowableException ex) { 1008 } catch (FlowableException ex) {
844 - log.error("[evalConditionExpress][条件表达式({}) 变量({}) 解析报错]", express, variables, ex); 1009 + // 为什么使用 info 日志?原因是,expression 如果从 variables 取不到值,会报错。实际这种情况下,可以忽略
  1010 + log.info("[evalConditionExpress][条件表达式({}) 变量({}) 解析报错]", expression, variables, ex);
845 return Boolean.FALSE; 1011 return Boolean.FALSE;
846 } 1012 }
847 } 1013 }
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/FlowableUtils.java
1 package cn.iocoder.yudao.module.bpm.framework.flowable.core.util; 1 package cn.iocoder.yudao.module.bpm.framework.flowable.core.util;
2 2
  3 +import cn.hutool.core.map.MapUtil;
3 import cn.hutool.core.util.ObjectUtil; 4 import cn.hutool.core.util.ObjectUtil;
4 import cn.hutool.extra.spring.SpringUtil; 5 import cn.hutool.extra.spring.SpringUtil;
5 import cn.iocoder.yudao.framework.common.core.KeyValue; 6 import cn.iocoder.yudao.framework.common.core.KeyValue;
@@ -24,7 +25,10 @@ import org.flowable.engine.impl.util.CommandContextUtil; @@ -24,7 +25,10 @@ import org.flowable.engine.impl.util.CommandContextUtil;
24 import org.flowable.engine.runtime.ProcessInstance; 25 import org.flowable.engine.runtime.ProcessInstance;
25 import org.flowable.task.api.TaskInfo; 26 import org.flowable.task.api.TaskInfo;
26 27
27 -import java.util.*; 28 +import java.util.HashMap;
  29 +import java.util.List;
  30 +import java.util.Map;
  31 +import java.util.Objects;
28 import java.util.concurrent.Callable; 32 import java.util.concurrent.Callable;
29 import java.util.stream.Collectors; 33 import java.util.stream.Collectors;
30 34
@@ -190,13 +194,38 @@ public class FlowableUtils { @@ -190,13 +194,38 @@ public class FlowableUtils {
190 @SuppressWarnings("unchecked") 194 @SuppressWarnings("unchecked")
191 public static Map<String, List<Long>> getStartUserSelectAssignees(Map<String, Object> processVariables) { 195 public static Map<String, List<Long>> getStartUserSelectAssignees(Map<String, Object> processVariables) {
192 if (processVariables == null) { 196 if (processVariables == null) {
193 - return null; 197 + return new HashMap<>();
194 } 198 }
195 return (Map<String, List<Long>>) processVariables.get( 199 return (Map<String, List<Long>>) processVariables.get(
196 BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES); 200 BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES);
197 } 201 }
198 202
199 /** 203 /**
  204 + * 获得流程实例的审批用户选择的下一个节点的审批人 Map
  205 + *
  206 + * @param processInstance 流程实例
  207 + * @return 审批用户选择的下一个节点的审批人Map
  208 + */
  209 + public static Map<String, List<Long>> getApproveUserSelectAssignees(ProcessInstance processInstance) {
  210 + return processInstance != null ? getApproveUserSelectAssignees(processInstance.getProcessVariables()) : null;
  211 + }
  212 +
  213 + /**
  214 + * 获得流程实例的审批用户选择的下一个节点的审批人 Map
  215 + *
  216 + * @param processVariables 流程变量
  217 + * @return 审批用户选择的下一个节点的审批人Map Map
  218 + */
  219 + @SuppressWarnings("unchecked")
  220 + public static Map<String, List<Long>> getApproveUserSelectAssignees(Map<String, Object> processVariables) {
  221 + if (processVariables == null) {
  222 + return new HashMap<>();
  223 + }
  224 + return (Map<String, List<Long>>) processVariables.get(
  225 + BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_APPROVE_USER_SELECT_ASSIGNEES);
  226 + }
  227 +
  228 + /**
200 * 获得流程实例的摘要 229 * 获得流程实例的摘要
201 * 230 *
202 * 仅有 {@link BpmModelFormTypeEnum#getType()} 表单,才有摘要。 231 * 仅有 {@link BpmModelFormTypeEnum#getType()} 表单,才有摘要。
@@ -240,7 +269,7 @@ public class FlowableUtils { @@ -240,7 +269,7 @@ public class FlowableUtils {
240 return formFieldsMap.entrySet().stream() 269 return formFieldsMap.entrySet().stream()
241 .limit(3) 270 .limit(3)
242 .map(entry -> new KeyValue<>(entry.getValue().getTitle(), 271 .map(entry -> new KeyValue<>(entry.getValue().getTitle(),
243 - processVariables.getOrDefault(entry.getValue().getField(), "").toString())) 272 + MapUtil.getStr(processVariables, entry.getValue().getField(), "")))
244 .collect(Collectors.toList()); 273 .collect(Collectors.toList());
245 } 274 }
246 275
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java
@@ -5,25 +5,27 @@ import cn.hutool.core.lang.Assert; @@ -5,25 +5,27 @@ import cn.hutool.core.lang.Assert;
5 import cn.hutool.core.map.MapUtil; 5 import cn.hutool.core.map.MapUtil;
6 import cn.hutool.core.util.*; 6 import cn.hutool.core.util.*;
7 import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; 7 import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
  8 +import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
8 import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO; 9 import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO;
9 import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO.ConditionGroups; 10 import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO.ConditionGroups;
10 import cn.iocoder.yudao.module.bpm.enums.definition.*; 11 import cn.iocoder.yudao.module.bpm.enums.definition.*;
11 import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum; 12 import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum;
12 -import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants; 13 +import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants;
13 import cn.iocoder.yudao.module.bpm.framework.flowable.core.listener.BpmCopyTaskDelegate; 14 import cn.iocoder.yudao.module.bpm.framework.flowable.core.listener.BpmCopyTaskDelegate;
14 import cn.iocoder.yudao.module.bpm.framework.flowable.core.listener.BpmTriggerTaskDelegate; 15 import cn.iocoder.yudao.module.bpm.framework.flowable.core.listener.BpmTriggerTaskDelegate;
  16 +import cn.iocoder.yudao.module.bpm.service.task.listener.BpmCallActivityListener;
  17 +import cn.iocoder.yudao.module.bpm.service.task.listener.BpmUserTaskListener;
15 import org.flowable.bpmn.BpmnAutoLayout; 18 import org.flowable.bpmn.BpmnAutoLayout;
16 import org.flowable.bpmn.constants.BpmnXMLConstants; 19 import org.flowable.bpmn.constants.BpmnXMLConstants;
17 import org.flowable.bpmn.model.Process; 20 import org.flowable.bpmn.model.Process;
18 import org.flowable.bpmn.model.*; 21 import org.flowable.bpmn.model.*;
  22 +import org.flowable.engine.delegate.ExecutionListener;
19 import org.flowable.engine.delegate.TaskListener; 23 import org.flowable.engine.delegate.TaskListener;
20 -import org.springframework.util.MultiValueMap;  
21 24
22 import java.util.*; 25 import java.util.*;
23 26
24 import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants.*; 27 import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants.*;
25 import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.*; 28 import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.*;
26 -import static cn.iocoder.yudao.module.bpm.service.task.listener.BpmUserTaskListener.DELEGATE_EXPRESSION;  
27 import static java.util.Arrays.asList; 29 import static java.util.Arrays.asList;
28 30
29 /** 31 /**
@@ -40,9 +42,10 @@ public class SimpleModelUtils { @@ -40,9 +42,10 @@ public class SimpleModelUtils {
40 42
41 static { 43 static {
42 List<NodeConvert> converts = asList(new StartNodeConvert(), new EndNodeConvert(), 44 List<NodeConvert> converts = asList(new StartNodeConvert(), new EndNodeConvert(),
43 - new StartUserNodeConvert(), new ApproveNodeConvert(), new CopyNodeConvert(), 45 + new StartUserNodeConvert(), new ApproveNodeConvert(), new CopyNodeConvert(), new TransactorNodeConvert(),
44 new DelayTimerNodeConvert(), new TriggerNodeConvert(), 46 new DelayTimerNodeConvert(), new TriggerNodeConvert(),
45 - new ConditionBranchNodeConvert(), new ParallelBranchNodeConvert(), new InclusiveBranchNodeConvert(), new RouteBranchNodeConvert()); 47 + new ConditionBranchNodeConvert(), new ParallelBranchNodeConvert(), new InclusiveBranchNodeConvert(), new RouteBranchNodeConvert(),
  48 + new ChildProcessConvert());
46 converts.forEach(convert -> NODE_CONVERTS.put(convert.getType(), convert)); 49 converts.forEach(convert -> NODE_CONVERTS.put(convert.getType(), convert));
47 } 50 }
48 51
@@ -78,7 +81,7 @@ public class SimpleModelUtils { @@ -78,7 +81,7 @@ public class SimpleModelUtils {
78 traverseNodeToBuildFlowNode(startNode, process); 81 traverseNodeToBuildFlowNode(startNode, process);
79 82
80 // 3. 构建并添加节点之间的连线 Sequence Flow 83 // 3. 构建并添加节点之间的连线 Sequence Flow
81 - EndEvent endEvent = BpmnModelUtils.getEndEvent(bpmnModel); 84 + EndEvent endEvent = getEndEvent(bpmnModel);
82 traverseNodeToBuildSequenceFlow(process, startNode, endEvent.getId()); 85 traverseNodeToBuildSequenceFlow(process, startNode, endEvent.getId());
83 86
84 // 4. 自动布局 87 // 4. 自动布局
@@ -164,8 +167,16 @@ public class SimpleModelUtils { @@ -164,8 +167,16 @@ public class SimpleModelUtils {
164 // 情况一:有“子”节点,则建立连线 167 // 情况一:有“子”节点,则建立连线
165 // 情况二:没有“子节点”,则直接跟 targetNodeId 建立连线。例如说,结束节点、条件分支(分支节点的孩子节点或聚合节点)的最后一个节点 168 // 情况二:没有“子节点”,则直接跟 targetNodeId 建立连线。例如说,结束节点、条件分支(分支节点的孩子节点或聚合节点)的最后一个节点
166 String finalTargetNodeId = isChildNodeValid ? childNode.getId() : targetNodeId; 169 String finalTargetNodeId = isChildNodeValid ? childNode.getId() : targetNodeId;
167 - SequenceFlow sequenceFlow = buildBpmnSequenceFlow(node.getId(), finalTargetNodeId);  
168 - process.addFlowElement(sequenceFlow); 170 +
  171 + // 如果没有附加节点:则直接建立连线
  172 + if (StrUtil.isEmpty(node.getAttachNodeId())) {
  173 + SequenceFlow sequenceFlow = buildBpmnSequenceFlow(node.getId(), finalTargetNodeId);
  174 + process.addFlowElement(sequenceFlow);
  175 + } else {
  176 + // 如果有附加节点:需要先建立和附加节点的连线,再建立附加节点和目标节点的连线。例如说,触发器节点(HTTP 回调)
  177 + List<SequenceFlow> sequenceFlows = buildAttachNodeSequenceFlow(node.getId(), node.getAttachNodeId(), finalTargetNodeId);
  178 + sequenceFlows.forEach(process::addFlowElement);
  179 + }
169 180
170 // 因为有子节点,递归调用后续子节点 181 // 因为有子节点,递归调用后续子节点
171 if (isChildNodeValid) { 182 if (isChildNodeValid) {
@@ -174,6 +185,19 @@ public class SimpleModelUtils { @@ -174,6 +185,19 @@ public class SimpleModelUtils {
174 } 185 }
175 186
176 /** 187 /**
  188 + * 构建有附加节点的连线
  189 + *
  190 + * @param nodeId 当前节点 ID
  191 + * @param attachNodeId 附属节点 ID
  192 + * @param targetNodeId 目标节点 ID
  193 + */
  194 + private static List<SequenceFlow> buildAttachNodeSequenceFlow(String nodeId, String attachNodeId, String targetNodeId) {
  195 + SequenceFlow sequenceFlow = buildBpmnSequenceFlow(nodeId, attachNodeId, null, null, null);
  196 + SequenceFlow attachSequenceFlow = buildBpmnSequenceFlow(attachNodeId, targetNodeId, null, null, null);
  197 + return CollUtil.newArrayList(sequenceFlow, attachSequenceFlow);
  198 + }
  199 +
  200 + /**
177 * 遍历条件节点,构建 SequenceFlow 元素 201 * 遍历条件节点,构建 SequenceFlow 元素
178 * 202 *
179 * @param process Bpmn 流程 203 * @param process Bpmn 流程
@@ -337,7 +361,7 @@ public class SimpleModelUtils { @@ -337,7 +361,7 @@ public class SimpleModelUtils {
337 userTask.setName(node.getName()); 361 userTask.setName(node.getName());
338 362
339 // 人工审批 363 // 人工审批
340 - addExtensionElement(userTask, BpmnModelConstants.USER_TASK_APPROVE_TYPE, BpmUserTaskApproveTypeEnum.USER.getType()); 364 + addExtensionElement(userTask, USER_TASK_APPROVE_TYPE, BpmUserTaskApproveTypeEnum.USER.getType());
341 // 候选人策略为发起人自己 365 // 候选人策略为发起人自己
342 addCandidateElements(BpmTaskCandidateStrategyEnum.START_USER.getStrategy(), null, userTask); 366 addCandidateElements(BpmTaskCandidateStrategyEnum.START_USER.getStrategy(), null, userTask);
343 // 添加表单字段权限属性元素 367 // 添加表单字段权限属性元素
@@ -388,24 +412,17 @@ public class SimpleModelUtils { @@ -388,24 +412,17 @@ public class SimpleModelUtils {
388 */ 412 */
389 private BoundaryEvent buildUserTaskTimeoutBoundaryEvent(UserTask userTask, 413 private BoundaryEvent buildUserTaskTimeoutBoundaryEvent(UserTask userTask,
390 BpmSimpleModelNodeVO.TimeoutHandler timeoutHandler) { 414 BpmSimpleModelNodeVO.TimeoutHandler timeoutHandler) {
391 - // 1.1 定时器边界事件  
392 - BoundaryEvent boundaryEvent = new BoundaryEvent();  
393 - boundaryEvent.setId("Event-" + IdUtil.fastUUID());  
394 - boundaryEvent.setCancelActivity(false); // 设置关联的任务为不会被中断  
395 - boundaryEvent.setAttachedToRef(userTask);  
396 - // 1.2 定义超时时间、最大提醒次数  
397 - TimerEventDefinition eventDefinition = new TimerEventDefinition();  
398 - eventDefinition.setTimeDuration(timeoutHandler.getTimeDuration()); 415 + // 1. 创建 Timeout Boundary Event
  416 + String timeCycle = null;
399 if (Objects.equals(BpmUserTaskTimeoutHandlerTypeEnum.REMINDER.getType(), timeoutHandler.getType()) && 417 if (Objects.equals(BpmUserTaskTimeoutHandlerTypeEnum.REMINDER.getType(), timeoutHandler.getType()) &&
400 timeoutHandler.getMaxRemindCount() != null && timeoutHandler.getMaxRemindCount() > 1) { 418 timeoutHandler.getMaxRemindCount() != null && timeoutHandler.getMaxRemindCount() > 1) {
401 - eventDefinition.setTimeCycle(String.format("R%d/%s",  
402 - timeoutHandler.getMaxRemindCount(), timeoutHandler.getTimeDuration())); 419 + timeCycle = String.format("R%d/%s",
  420 + timeoutHandler.getMaxRemindCount(), timeoutHandler.getTimeDuration());
403 } 421 }
404 - boundaryEvent.addEventDefinition(eventDefinition); 422 + BoundaryEvent boundaryEvent = buildTimeoutBoundaryEvent(userTask, BpmBoundaryEventTypeEnum.USER_TASK_TIMEOUT.getType(),
  423 + timeoutHandler.getTimeDuration(), timeCycle, null);
405 424
406 - // 2.1 添加定时器边界事件类型  
407 - addExtensionElement(boundaryEvent, BOUNDARY_EVENT_TYPE, BpmBoundaryEventTypeEnum.USER_TASK_TIMEOUT.getType());  
408 - // 2.2 添加超时执行动作元素 425 + // 2 添加超时执行动作元素
409 addExtensionElement(boundaryEvent, USER_TASK_TIMEOUT_HANDLER_TYPE, timeoutHandler.getType()); 426 addExtensionElement(boundaryEvent, USER_TASK_TIMEOUT_HANDLER_TYPE, timeoutHandler.getType());
410 return boundaryEvent; 427 return boundaryEvent;
411 } 428 }
@@ -445,6 +462,8 @@ public class SimpleModelUtils { @@ -445,6 +462,8 @@ public class SimpleModelUtils {
445 addSignEnable(node.getSignEnable(), userTask); 462 addSignEnable(node.getSignEnable(), userTask);
446 // 审批意见 463 // 审批意见
447 addReasonRequire(node.getReasonRequire(), userTask); 464 addReasonRequire(node.getReasonRequire(), userTask);
  465 + // 节点类型
  466 + addNodeType(node.getType(), userTask);
448 return userTask; 467 return userTask;
449 } 468 }
450 469
@@ -455,7 +474,7 @@ public class SimpleModelUtils { @@ -455,7 +474,7 @@ public class SimpleModelUtils {
455 FlowableListener flowableListener = new FlowableListener(); 474 FlowableListener flowableListener = new FlowableListener();
456 flowableListener.setEvent(TaskListener.EVENTNAME_CREATE); 475 flowableListener.setEvent(TaskListener.EVENTNAME_CREATE);
457 flowableListener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION); 476 flowableListener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
458 - flowableListener.setImplementation(DELEGATE_EXPRESSION); 477 + flowableListener.setImplementation(BpmUserTaskListener.DELEGATE_EXPRESSION);
459 addListenerConfig(flowableListener, node.getTaskCreateListener()); 478 addListenerConfig(flowableListener, node.getTaskCreateListener());
460 flowableListeners.add(flowableListener); 479 flowableListeners.add(flowableListener);
461 } 480 }
@@ -464,7 +483,7 @@ public class SimpleModelUtils { @@ -464,7 +483,7 @@ public class SimpleModelUtils {
464 FlowableListener flowableListener = new FlowableListener(); 483 FlowableListener flowableListener = new FlowableListener();
465 flowableListener.setEvent(TaskListener.EVENTNAME_ASSIGNMENT); 484 flowableListener.setEvent(TaskListener.EVENTNAME_ASSIGNMENT);
466 flowableListener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION); 485 flowableListener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
467 - flowableListener.setImplementation(DELEGATE_EXPRESSION); 486 + flowableListener.setImplementation(BpmUserTaskListener.DELEGATE_EXPRESSION);
468 addListenerConfig(flowableListener, node.getTaskAssignListener()); 487 addListenerConfig(flowableListener, node.getTaskAssignListener());
469 flowableListeners.add(flowableListener); 488 flowableListeners.add(flowableListener);
470 } 489 }
@@ -473,7 +492,7 @@ public class SimpleModelUtils { @@ -473,7 +492,7 @@ public class SimpleModelUtils {
473 FlowableListener flowableListener = new FlowableListener(); 492 FlowableListener flowableListener = new FlowableListener();
474 flowableListener.setEvent(TaskListener.EVENTNAME_COMPLETE); 493 flowableListener.setEvent(TaskListener.EVENTNAME_COMPLETE);
475 flowableListener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION); 494 flowableListener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
476 - flowableListener.setImplementation(DELEGATE_EXPRESSION); 495 + flowableListener.setImplementation(BpmUserTaskListener.DELEGATE_EXPRESSION);
477 addListenerConfig(flowableListener, node.getTaskCompleteListener()); 496 addListenerConfig(flowableListener, node.getTaskCompleteListener());
478 flowableListeners.add(flowableListener); 497 flowableListeners.add(flowableListener);
479 } 498 }
@@ -486,7 +505,7 @@ public class SimpleModelUtils { @@ -486,7 +505,7 @@ public class SimpleModelUtils {
486 BpmUserTaskApproveMethodEnum approveMethodEnum = BpmUserTaskApproveMethodEnum.valueOf(approveMethod); 505 BpmUserTaskApproveMethodEnum approveMethodEnum = BpmUserTaskApproveMethodEnum.valueOf(approveMethod);
487 Assert.notNull(approveMethodEnum, "审批方式({})不能为空", approveMethodEnum); 506 Assert.notNull(approveMethodEnum, "审批方式({})不能为空", approveMethodEnum);
488 // 添加审批方式的扩展属性 507 // 添加审批方式的扩展属性
489 - addExtensionElement(userTask, BpmnModelConstants.USER_TASK_APPROVE_METHOD, approveMethod); 508 + addExtensionElement(userTask, USER_TASK_APPROVE_METHOD, approveMethod);
490 if (approveMethodEnum == BpmUserTaskApproveMethodEnum.RANDOM) { 509 if (approveMethodEnum == BpmUserTaskApproveMethodEnum.RANDOM) {
491 // 随机审批,不需要设置多实例属性 510 // 随机审批,不需要设置多实例属性
492 return; 511 return;
@@ -514,6 +533,15 @@ public class SimpleModelUtils { @@ -514,6 +533,15 @@ public class SimpleModelUtils {
514 533
515 } 534 }
516 535
  536 + private static class TransactorNodeConvert extends ApproveNodeConvert {
  537 +
  538 + @Override
  539 + public BpmSimpleModelNodeTypeEnum getType() {
  540 + return BpmSimpleModelNodeTypeEnum.TRANSACTOR_NODE;
  541 + }
  542 +
  543 + }
  544 +
517 private static class CopyNodeConvert implements NodeConvert { 545 private static class CopyNodeConvert implements NodeConvert {
518 546
519 @Override 547 @Override
@@ -684,20 +712,16 @@ public class SimpleModelUtils { @@ -684,20 +712,16 @@ public class SimpleModelUtils {
684 712
685 // 2. 添加接收任务的 Timer Boundary Event 713 // 2. 添加接收任务的 Timer Boundary Event
686 if (node.getDelaySetting() != null) { 714 if (node.getDelaySetting() != null) {
687 - // 2.1 定时器边界事件  
688 - BoundaryEvent boundaryEvent = new BoundaryEvent();  
689 - boundaryEvent.setId("Event-" + IdUtil.fastUUID());  
690 - boundaryEvent.setCancelActivity(false);  
691 - boundaryEvent.setAttachedToRef(receiveTask);  
692 - // 2.2 定义超时时间  
693 - TimerEventDefinition eventDefinition = new TimerEventDefinition(); 715 + BoundaryEvent boundaryEvent = null;
694 if (node.getDelaySetting().getDelayType().equals(BpmDelayTimerTypeEnum.FIXED_DATE_TIME.getType())) { 716 if (node.getDelaySetting().getDelayType().equals(BpmDelayTimerTypeEnum.FIXED_DATE_TIME.getType())) {
695 - eventDefinition.setTimeDuration(node.getDelaySetting().getDelayTime()); 717 + boundaryEvent = buildTimeoutBoundaryEvent(receiveTask, BpmBoundaryEventTypeEnum.DELAY_TIMER_TIMEOUT.getType(),
  718 + node.getDelaySetting().getDelayTime(), null, null);
696 } else if (node.getDelaySetting().getDelayType().equals(BpmDelayTimerTypeEnum.FIXED_TIME_DURATION.getType())) { 719 } else if (node.getDelaySetting().getDelayType().equals(BpmDelayTimerTypeEnum.FIXED_TIME_DURATION.getType())) {
697 - eventDefinition.setTimeDate(node.getDelaySetting().getDelayTime()); 720 + boundaryEvent = buildTimeoutBoundaryEvent(receiveTask, BpmBoundaryEventTypeEnum.DELAY_TIMER_TIMEOUT.getType(),
  721 + null, null, node.getDelaySetting().getDelayTime());
  722 + } else {
  723 + throw new UnsupportedOperationException("不支持的延迟类型:" + node.getDelaySetting());
698 } 724 }
699 - boundaryEvent.addEventDefinition(eventDefinition);  
700 - addExtensionElement(boundaryEvent, BOUNDARY_EVENT_TYPE, BpmBoundaryEventTypeEnum.DELAY_TIMER_TIMEOUT.getType());  
701 flowElements.add(boundaryEvent); 725 flowElements.add(boundaryEvent);
702 } 726 }
703 return flowElements; 727 return flowElements;
@@ -712,23 +736,36 @@ public class SimpleModelUtils { @@ -712,23 +736,36 @@ public class SimpleModelUtils {
712 public static class TriggerNodeConvert implements NodeConvert { 736 public static class TriggerNodeConvert implements NodeConvert {
713 737
714 @Override 738 @Override
715 - public ServiceTask convert(BpmSimpleModelNodeVO node) { 739 + public List<? extends FlowElement> convertList(BpmSimpleModelNodeVO node) {
  740 + Assert.notNull(node.getTriggerSetting(), "触发器节点设置不能为空");
  741 + List<FlowElement> flowElements = new ArrayList<>(2);
  742 + // HTTP 回调请求。需要附加一个 ReceiveTask、发起请求后、等待回调执行
  743 + if (BpmTriggerTypeEnum.HTTP_CALLBACK.getType().equals(node.getTriggerSetting().getType())) {
  744 + Assert.notNull(node.getTriggerSetting().getHttpRequestSetting(), "触发器 HTTP 回调请求设置不能为空");
  745 + ReceiveTask receiveTask = new ReceiveTask();
  746 + receiveTask.setId("Activity_" + IdUtil.fastUUID());
  747 + receiveTask.setName("HTTP 回调");
  748 + node.setAttachNodeId(receiveTask.getId());
  749 + flowElements.add(receiveTask);
  750 + // 重要:设置 callbackTaskDefineKey,用于 HTTP 回调
  751 + node.getTriggerSetting().getHttpRequestSetting().setCallbackTaskDefineKey(receiveTask.getId());
  752 + }
  753 +
716 // 触发器使用 ServiceTask 来实现 754 // 触发器使用 ServiceTask 来实现
717 ServiceTask serviceTask = new ServiceTask(); 755 ServiceTask serviceTask = new ServiceTask();
718 serviceTask.setId(node.getId()); 756 serviceTask.setId(node.getId());
719 serviceTask.setName(node.getName()); 757 serviceTask.setName(node.getName());
720 serviceTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION); 758 serviceTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
721 serviceTask.setImplementation("${" + BpmTriggerTaskDelegate.BEAN_NAME + "}"); 759 serviceTask.setImplementation("${" + BpmTriggerTaskDelegate.BEAN_NAME + "}");
722 - if (node.getTriggerSetting() != null) {  
723 - addExtensionElement(serviceTask, TRIGGER_TYPE, node.getTriggerSetting().getType());  
724 - if (node.getTriggerSetting().getHttpRequestSetting() != null) {  
725 - addExtensionElementJson(serviceTask, TRIGGER_PARAM, node.getTriggerSetting().getHttpRequestSetting());  
726 - }  
727 - if (node.getTriggerSetting().getNormalFormSetting() != null) {  
728 - addExtensionElementJson(serviceTask, TRIGGER_PARAM, node.getTriggerSetting().getNormalFormSetting());  
729 - } 760 + addExtensionElement(serviceTask, TRIGGER_TYPE, node.getTriggerSetting().getType());
  761 + if (node.getTriggerSetting().getHttpRequestSetting() != null) {
  762 + addExtensionElementJson(serviceTask, TRIGGER_PARAM, node.getTriggerSetting().getHttpRequestSetting());
730 } 763 }
731 - return serviceTask; 764 + if (node.getTriggerSetting().getFormSettings() != null) {
  765 + addExtensionElementJson(serviceTask, TRIGGER_PARAM, node.getTriggerSetting().getFormSettings());
  766 + }
  767 + flowElements.add(serviceTask);
  768 + return flowElements;
732 } 769 }
733 770
734 @Override 771 @Override
@@ -762,10 +799,131 @@ public class SimpleModelUtils { @@ -762,10 +799,131 @@ public class SimpleModelUtils {
762 799
763 } 800 }
764 801
  802 + private static class ChildProcessConvert implements NodeConvert {
  803 +
  804 + @Override
  805 + public List<FlowElement> convertList(BpmSimpleModelNodeVO node) {
  806 + List<FlowElement> flowElements = new ArrayList<>(2);
  807 + BpmSimpleModelNodeVO.ChildProcessSetting childProcessSetting = node.getChildProcessSetting();
  808 + List<IOParameter> inVariables = childProcessSetting.getInVariables() == null ?
  809 + new ArrayList<>() : new ArrayList<>(childProcessSetting.getInVariables());
  810 + CallActivity callActivity = new CallActivity();
  811 + callActivity.setId(node.getId());
  812 + callActivity.setName(node.getName());
  813 + callActivity.setCalledElementType("key");
  814 + // 1. 是否异步
  815 + if (node.getChildProcessSetting().getAsync()) {
  816 + // TODO @lesan: 这里目前测试没有跳过执行call activity 后面的节点
  817 + callActivity.setAsynchronous(true);
  818 + }
  819 +
  820 + // 2. 调用的子流程
  821 + callActivity.setCalledElement(childProcessSetting.getCalledProcessDefinitionKey());
  822 + callActivity.setProcessInstanceName(childProcessSetting.getCalledProcessDefinitionName());
  823 +
  824 + // 3. 是否自动跳过子流程发起节点
  825 + IOParameter ioParameter = new IOParameter();
  826 + ioParameter.setSourceExpression(childProcessSetting.getSkipStartUserNode().toString());
  827 + ioParameter.setTarget(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_SKIP_START_USER_NODE);
  828 + inVariables.add(ioParameter);
  829 +
  830 + // 4. 【默认需要传递的一些变量】流程状态
  831 + ioParameter = new IOParameter();
  832 + ioParameter.setSource(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_STATUS);
  833 + ioParameter.setTarget(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_STATUS);
  834 + inVariables.add(ioParameter);
  835 +
  836 + // 5. 主→子变量传递、子->主变量传递
  837 + callActivity.setInParameters(inVariables);
  838 + if (ArrayUtil.isNotEmpty(childProcessSetting.getOutVariables()) && ObjUtil.notEqual(childProcessSetting.getAsync(), Boolean.TRUE)) {
  839 + callActivity.setOutParameters(childProcessSetting.getOutVariables());
  840 + }
  841 +
  842 + // 6. 子流程发起人配置
  843 + List<FlowableListener> executionListeners = new ArrayList<>();
  844 + FlowableListener flowableListener = new FlowableListener();
  845 + flowableListener.setEvent(ExecutionListener.EVENTNAME_START);
  846 + flowableListener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
  847 + flowableListener.setImplementation(BpmCallActivityListener.DELEGATE_EXPRESSION);
  848 + FieldExtension fieldExtension = new FieldExtension();
  849 + fieldExtension.setFieldName("listenerConfig");
  850 + fieldExtension.setStringValue(JsonUtils.toJsonString(childProcessSetting.getStartUserSetting()));
  851 + flowableListener.getFieldExtensions().add(fieldExtension);
  852 + executionListeners.add(flowableListener);
  853 + callActivity.setExecutionListeners(executionListeners);
  854 +
  855 + // 7. 超时设置
  856 + if (childProcessSetting.getTimeoutSetting() != null && Boolean.TRUE.equals(childProcessSetting.getTimeoutSetting().getEnable())) {
  857 + BoundaryEvent boundaryEvent = null;
  858 + if (childProcessSetting.getTimeoutSetting().getType().equals(BpmDelayTimerTypeEnum.FIXED_DATE_TIME.getType())) {
  859 + boundaryEvent = buildTimeoutBoundaryEvent(callActivity, BpmBoundaryEventTypeEnum.DELAY_TIMER_TIMEOUT.getType(),
  860 + childProcessSetting.getTimeoutSetting().getTimeExpression(), null, null);
  861 + } else if (childProcessSetting.getTimeoutSetting().getType().equals(BpmDelayTimerTypeEnum.FIXED_TIME_DURATION.getType())) {
  862 + boundaryEvent = buildTimeoutBoundaryEvent(callActivity, BpmBoundaryEventTypeEnum.CHILD_PROCESS_TIMEOUT.getType(),
  863 + null, null, childProcessSetting.getTimeoutSetting().getTimeExpression());
  864 + }
  865 + flowElements.add(boundaryEvent);
  866 + }
  867 +
  868 + // 8. 多实例
  869 + if (childProcessSetting.getMultiInstanceSetting() != null && Boolean.TRUE.equals(childProcessSetting.getMultiInstanceSetting().getEnable())) {
  870 + MultiInstanceLoopCharacteristics multiInstanceCharacteristics = new MultiInstanceLoopCharacteristics();
  871 + multiInstanceCharacteristics.setSequential(childProcessSetting.getMultiInstanceSetting().getSequential());
  872 + if (childProcessSetting.getMultiInstanceSetting().getSourceType().equals(BpmChildProcessMultiInstanceSourceTypeEnum.FIXED_QUANTITY.getType())) {
  873 + multiInstanceCharacteristics.setLoopCardinality(childProcessSetting.getMultiInstanceSetting().getSource());
  874 + }
  875 + if (childProcessSetting.getMultiInstanceSetting().getSourceType().equals(BpmChildProcessMultiInstanceSourceTypeEnum.NUMBER_FORM.getType()) ||
  876 + childProcessSetting.getMultiInstanceSetting().getSourceType().equals(BpmChildProcessMultiInstanceSourceTypeEnum.MULTIPLE_FORM.getType())) {
  877 + multiInstanceCharacteristics.setInputDataItem(childProcessSetting.getMultiInstanceSetting().getSource());
  878 + }
  879 + multiInstanceCharacteristics.setCompletionCondition(String.format(BpmUserTaskApproveMethodEnum.RATIO.getCompletionCondition(),
  880 + String.format("%.2f", childProcessSetting.getMultiInstanceSetting().getApproveRatio() / 100D)));
  881 + callActivity.setLoopCharacteristics(multiInstanceCharacteristics);
  882 + addExtensionElement(callActivity, CHILD_PROCESS_MULTI_INSTANCE_SOURCE_TYPE, childProcessSetting.getMultiInstanceSetting().getSourceType());
  883 + }
  884 +
  885 + // 添加节点类型
  886 + addNodeType(node.getType(), callActivity);
  887 + flowElements.add(callActivity);
  888 + return flowElements;
  889 + }
  890 +
  891 + @Override
  892 + public BpmSimpleModelNodeTypeEnum getType() {
  893 + return BpmSimpleModelNodeTypeEnum.CHILD_PROCESS;
  894 + }
  895 +
  896 + }
  897 +
765 private static String buildGatewayJoinId(String id) { 898 private static String buildGatewayJoinId(String id) {
766 return id + "_join"; 899 return id + "_join";
767 } 900 }
768 901
  902 + private static BoundaryEvent buildTimeoutBoundaryEvent(Activity attachedToRef, Integer type,
  903 + String timeDuration, String timeCycle, String timeDate) {
  904 + // 1.1 定时器边界事件
  905 + BoundaryEvent boundaryEvent = new BoundaryEvent();
  906 + boundaryEvent.setId("Event-" + IdUtil.fastUUID());
  907 + boundaryEvent.setCancelActivity(false); // 设置关联的任务为不会被中断
  908 + boundaryEvent.setAttachedToRef(attachedToRef);
  909 + // 1.2 定义超时时间表达式
  910 + TimerEventDefinition eventDefinition = new TimerEventDefinition();
  911 + if (ObjUtil.isNotNull(timeDuration)) {
  912 + eventDefinition.setTimeDuration(timeDuration);
  913 + }
  914 + if (ObjUtil.isNotNull(timeDuration)) {
  915 + eventDefinition.setTimeCycle(timeCycle);
  916 + }
  917 + if (ObjUtil.isNotNull(timeDate)) {
  918 + eventDefinition.setTimeDate(timeDate);
  919 + }
  920 + boundaryEvent.addEventDefinition(eventDefinition);
  921 +
  922 + // 2. 添加定时器边界事件类型
  923 + addExtensionElement(boundaryEvent, BOUNDARY_EVENT_TYPE, type);
  924 + return boundaryEvent;
  925 + }
  926 +
769 // ========== SIMPLE 流程预测相关的方法 ========== 927 // ========== SIMPLE 流程预测相关的方法 ==========
770 928
771 public static List<BpmSimpleModelNodeVO> simulateProcess(BpmSimpleModelNodeVO rootNode, Map<String, Object> variables) { 929 public static List<BpmSimpleModelNodeVO> simulateProcess(BpmSimpleModelNodeVO rootNode, Map<String, Object> variables) {
@@ -785,11 +943,13 @@ public class SimpleModelUtils { @@ -785,11 +943,13 @@ public class SimpleModelUtils {
785 BpmSimpleModelNodeTypeEnum nodeType = BpmSimpleModelNodeTypeEnum.valueOf(currentNode.getType()); 943 BpmSimpleModelNodeTypeEnum nodeType = BpmSimpleModelNodeTypeEnum.valueOf(currentNode.getType());
786 Assert.notNull(nodeType, "模型节点类型不支持"); 944 Assert.notNull(nodeType, "模型节点类型不支持");
787 945
788 - // 情况:START_NODE/START_USER_NODE/APPROVE_NODE/COPY_NODE/END_NODE 946 + // 情况:START_NODE/START_USER_NODE/APPROVE_NODE/COPY_NODE/END_NODE/TRANSACTOR_NODE
789 if (nodeType == BpmSimpleModelNodeTypeEnum.START_NODE 947 if (nodeType == BpmSimpleModelNodeTypeEnum.START_NODE
790 || nodeType == BpmSimpleModelNodeTypeEnum.START_USER_NODE 948 || nodeType == BpmSimpleModelNodeTypeEnum.START_USER_NODE
791 || nodeType == BpmSimpleModelNodeTypeEnum.APPROVE_NODE 949 || nodeType == BpmSimpleModelNodeTypeEnum.APPROVE_NODE
  950 + || nodeType == BpmSimpleModelNodeTypeEnum.TRANSACTOR_NODE
792 || nodeType == BpmSimpleModelNodeTypeEnum.COPY_NODE 951 || nodeType == BpmSimpleModelNodeTypeEnum.COPY_NODE
  952 + || nodeType == BpmSimpleModelNodeTypeEnum.CHILD_PROCESS
793 || nodeType == BpmSimpleModelNodeTypeEnum.END_NODE) { 953 || nodeType == BpmSimpleModelNodeTypeEnum.END_NODE) {
794 // 添加元素 954 // 添加元素
795 resultNodes.add(currentNode); 955 resultNodes.add(currentNode);
@@ -799,8 +959,8 @@ public class SimpleModelUtils { @@ -799,8 +959,8 @@ public class SimpleModelUtils {
799 if (nodeType == BpmSimpleModelNodeTypeEnum.CONDITION_BRANCH_NODE) { 959 if (nodeType == BpmSimpleModelNodeTypeEnum.CONDITION_BRANCH_NODE) {
800 // 查找满足条件的 BpmSimpleModelNodeVO 节点 960 // 查找满足条件的 BpmSimpleModelNodeVO 节点
801 BpmSimpleModelNodeVO matchConditionNode = CollUtil.findOne(currentNode.getConditionNodes(), 961 BpmSimpleModelNodeVO matchConditionNode = CollUtil.findOne(currentNode.getConditionNodes(),
802 - conditionNode -> !BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow())  
803 - && evalConditionExpress(variables, conditionNode.getConditionSetting())); 962 + conditionNode -> !BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow())
  963 + && evalConditionExpress(variables, conditionNode.getConditionSetting()));
804 if (matchConditionNode == null) { 964 if (matchConditionNode == null) {
805 matchConditionNode = CollUtil.findOne(currentNode.getConditionNodes(), 965 matchConditionNode = CollUtil.findOne(currentNode.getConditionNodes(),
806 conditionNode -> BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow())); 966 conditionNode -> BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow()));
@@ -814,8 +974,8 @@ public class SimpleModelUtils { @@ -814,8 +974,8 @@ public class SimpleModelUtils {
814 if (nodeType == BpmSimpleModelNodeTypeEnum.INCLUSIVE_BRANCH_NODE) { 974 if (nodeType == BpmSimpleModelNodeTypeEnum.INCLUSIVE_BRANCH_NODE) {
815 // 查找满足条件的 BpmSimpleModelNodeVO 节点 975 // 查找满足条件的 BpmSimpleModelNodeVO 节点
816 Collection<BpmSimpleModelNodeVO> matchConditionNodes = CollUtil.filterNew(currentNode.getConditionNodes(), 976 Collection<BpmSimpleModelNodeVO> matchConditionNodes = CollUtil.filterNew(currentNode.getConditionNodes(),
817 - conditionNode -> !BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow())  
818 - && evalConditionExpress(variables, conditionNode.getConditionSetting())); 977 + conditionNode -> !BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow())
  978 + && evalConditionExpress(variables, conditionNode.getConditionSetting()));
819 if (CollUtil.isEmpty(matchConditionNodes)) { 979 if (CollUtil.isEmpty(matchConditionNodes)) {
820 matchConditionNodes = CollUtil.filterNew(currentNode.getConditionNodes(), 980 matchConditionNodes = CollUtil.filterNew(currentNode.getConditionNodes(),
821 conditionNode -> BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow())); 981 conditionNode -> BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow()));
@@ -841,27 +1001,4 @@ public class SimpleModelUtils { @@ -841,27 +1001,4 @@ public class SimpleModelUtils {
841 return BpmnModelUtils.evalConditionExpress(variables, buildConditionExpression(conditionSetting)); 1001 return BpmnModelUtils.evalConditionExpress(variables, buildConditionExpression(conditionSetting));
842 } 1002 }
843 1003
844 - // TODO @芋艿:【高】要不要优化下,抽个 HttpUtils  
845 -  
846 - /**  
847 - * 添加 HTTP 请求参数。请求头或者请求体  
848 - *  
849 - * @param params HTTP 请求参数  
850 - * @param paramSettings HTTP 请求参数设置  
851 - * @param processVariables 流程变量  
852 - */  
853 - public static void addHttpRequestParam(MultiValueMap<String, String> params,  
854 - List<BpmSimpleModelNodeVO.HttpRequestParam> paramSettings,  
855 - Map<String, Object> processVariables) {  
856 - if (CollUtil.isEmpty(paramSettings)) {  
857 - return;  
858 - }  
859 - paramSettings.forEach(item -> {  
860 - if (item.getType().equals(BpmHttpRequestParamTypeEnum.FIXED_VALUE.getType())) {  
861 - params.add(item.getKey(), item.getValue());  
862 - } else if (item.getType().equals(BpmHttpRequestParamTypeEnum.FROM_FORM.getType())) {  
863 - params.add(item.getKey(), processVariables.get(item.getValue()).toString());  
864 - }  
865 - });  
866 - }  
867 } 1004 }
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmModelServiceImpl.java
@@ -16,6 +16,7 @@ import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelFormTypeEnum; @@ -16,6 +16,7 @@ import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelFormTypeEnum;
16 import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelTypeEnum; 16 import cn.iocoder.yudao.module.bpm.enums.definition.BpmModelTypeEnum;
17 import cn.iocoder.yudao.module.bpm.enums.task.BpmReasonEnum; 17 import cn.iocoder.yudao.module.bpm.enums.task.BpmReasonEnum;
18 import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateInvoker; 18 import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateInvoker;
  19 +import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum;
19 import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils; 20 import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils;
20 import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils; 21 import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils;
21 import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.SimpleModelUtils; 22 import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.SimpleModelUtils;
@@ -23,9 +24,7 @@ import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceCopyService; @@ -23,9 +24,7 @@ import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceCopyService;
23 import jakarta.annotation.Resource; 24 import jakarta.annotation.Resource;
24 import jakarta.validation.Valid; 25 import jakarta.validation.Valid;
25 import lombok.extern.slf4j.Slf4j; 26 import lombok.extern.slf4j.Slf4j;
26 -import org.flowable.bpmn.model.BpmnModel;  
27 -import org.flowable.bpmn.model.StartEvent;  
28 -import org.flowable.bpmn.model.UserTask; 27 +import org.flowable.bpmn.model.*;
29 import org.flowable.common.engine.impl.db.SuspensionState; 28 import org.flowable.common.engine.impl.db.SuspensionState;
30 import org.flowable.engine.HistoryService; 29 import org.flowable.engine.HistoryService;
31 import org.flowable.engine.RepositoryService; 30 import org.flowable.engine.RepositoryService;
@@ -41,13 +40,12 @@ import org.springframework.stereotype.Service; @@ -41,13 +40,12 @@ import org.springframework.stereotype.Service;
41 import org.springframework.transaction.annotation.Transactional; 40 import org.springframework.transaction.annotation.Transactional;
42 import org.springframework.validation.annotation.Validated; 41 import org.springframework.validation.annotation.Validated;
43 42
44 -import java.util.List;  
45 -import java.util.Map;  
46 -import java.util.Objects; 43 +import java.util.*;
47 44
48 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; 45 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
49 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; 46 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
50 import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; 47 import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
  48 +import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.parseCandidateStrategy;
51 49
52 /** 50 /**
53 * 流程模型实现:主要进行 Flowable {@link Model} 的维护 51 * 流程模型实现:主要进行 Flowable {@link Model} 的维护
@@ -209,11 +207,11 @@ public class BpmModelServiceImpl implements BpmModelService { @@ -209,11 +207,11 @@ public class BpmModelServiceImpl implements BpmModelService {
209 public void deployModel(Long userId, String id) { 207 public void deployModel(Long userId, String id) {
210 // 1.1 校验流程模型存在 208 // 1.1 校验流程模型存在
211 Model model = validateModelManager(id, userId); 209 Model model = validateModelManager(id, userId);
  210 + BpmModelMetaInfoVO metaInfo = BpmModelConvert.INSTANCE.parseMetaInfo(model);
212 // 1.2 校验流程图 211 // 1.2 校验流程图
213 byte[] bpmnBytes = getModelBpmnXML(model.getId()); 212 byte[] bpmnBytes = getModelBpmnXML(model.getId());
214 - validateBpmnXml(bpmnBytes); 213 + validateBpmnXml(bpmnBytes, metaInfo.getType());
215 // 1.3 校验表单已配 214 // 1.3 校验表单已配
216 - BpmModelMetaInfoVO metaInfo = BpmModelConvert.INSTANCE.parseMetaInfo(model);  
217 BpmFormDO form = validateFormConfig(metaInfo); 215 BpmFormDO form = validateFormConfig(metaInfo);
218 // 1.4 校验任务分配规则已配置 216 // 1.4 校验任务分配规则已配置
219 taskCandidateInvoker.validateBpmnConfig(bpmnBytes); 217 taskCandidateInvoker.validateBpmnConfig(bpmnBytes);
@@ -233,7 +231,7 @@ public class BpmModelServiceImpl implements BpmModelService { @@ -233,7 +231,7 @@ public class BpmModelServiceImpl implements BpmModelService {
233 repositoryService.saveModel(model); 231 repositoryService.saveModel(model);
234 } 232 }
235 233
236 - private void validateBpmnXml(byte[] bpmnBytes) { 234 + private void validateBpmnXml(byte[] bpmnBytes, Integer type) {
237 BpmnModel bpmnModel = BpmnModelUtils.getBpmnModel(bpmnBytes); 235 BpmnModel bpmnModel = BpmnModelUtils.getBpmnModel(bpmnBytes);
238 if (bpmnModel == null) { 236 if (bpmnModel == null) {
239 throw exception(MODEL_NOT_EXISTS); 237 throw exception(MODEL_NOT_EXISTS);
@@ -250,6 +248,15 @@ public class BpmModelServiceImpl implements BpmModelService { @@ -250,6 +248,15 @@ public class BpmModelServiceImpl implements BpmModelService {
250 throw exception(MODEL_DEPLOY_FAIL_BPMN_USER_TASK_NAME_NOT_EXISTS, userTask.getId()); 248 throw exception(MODEL_DEPLOY_FAIL_BPMN_USER_TASK_NAME_NOT_EXISTS, userTask.getId());
251 } 249 }
252 }); 250 });
  251 + // 3. 校验第一个用户任务节点的规则类型是否为“审批人自选”,BPMN 设计器,校验第一个用户任务节点,SIMPLE 设计器,第一个节点固定为发起人所以校验第二个用户任务节点
  252 + UserTask firUserTask = CollUtil.get(userTasks, BpmModelTypeEnum.BPMN.getType().equals(type) ? 0 : 1);
  253 + if (firUserTask == null) {
  254 + return;
  255 + }
  256 + Integer candidateStrategy = parseCandidateStrategy(firUserTask);
  257 + if (Objects.equals(candidateStrategy, BpmTaskCandidateStrategyEnum.APPROVE_USER_SELECT.getStrategy())) {
  258 + throw exception(MODEL_DEPLOY_FAIL_FIRST_USER_TASK_CANDIDATE_STRATEGY_ERROR, firUserTask.getName());
  259 + }
253 } 260 }
254 261
255 @Override 262 @Override
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmProcessDefinitionServiceImpl.java
@@ -28,8 +28,7 @@ import java.util.*; @@ -28,8 +28,7 @@ import java.util.*;
28 28
29 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; 29 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
30 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.addIfNotNull; 30 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.addIfNotNull;
31 -import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.PROCESS_DEFINITION_KEY_NOT_MATCH;  
32 -import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.PROCESS_DEFINITION_NAME_NOT_MATCH; 31 +import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
33 import static java.util.Collections.emptyList; 32 import static java.util.Collections.emptyList;
34 33
35 /** 34 /**
@@ -144,9 +143,8 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ @@ -144,9 +143,8 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
144 143
145 // 插入拓展表 144 // 插入拓展表
146 BpmProcessDefinitionInfoDO definitionDO = BeanUtils.toBean(modelMetaInfo, BpmProcessDefinitionInfoDO.class) 145 BpmProcessDefinitionInfoDO definitionDO = BeanUtils.toBean(modelMetaInfo, BpmProcessDefinitionInfoDO.class)
147 - .setModelId(model.getId()).setProcessDefinitionId(definition.getId()) 146 + .setModelId(model.getId()).setCategory(model.getCategory()).setProcessDefinitionId(definition.getId())
148 .setModelType(modelMetaInfo.getType()).setSimpleModel(simpleJson); 147 .setModelType(modelMetaInfo.getType()).setSimpleModel(simpleJson);
149 -  
150 if (form != null) { 148 if (form != null) {
151 definitionDO.setFormFields(form.getFields()).setFormConf(form.getConf()); 149 definitionDO.setFormFields(form.getFields()).setFormConf(form.getConf());
152 } 150 }
@@ -156,16 +154,25 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ @@ -156,16 +154,25 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
156 154
157 @Override 155 @Override
158 public void updateProcessDefinitionState(String id, Integer state) { 156 public void updateProcessDefinitionState(String id, Integer state) {
  157 + ProcessDefinition processDefinition = repositoryService.getProcessDefinition(id);
  158 + if (processDefinition == null) {
  159 + throw exception(PROCESS_DEFINITION_NOT_EXISTS);
  160 + }
  161 +
159 // 激活 162 // 激活
160 if (Objects.equals(SuspensionState.ACTIVE.getStateCode(), state)) { 163 if (Objects.equals(SuspensionState.ACTIVE.getStateCode(), state)) {
161 - repositoryService.activateProcessDefinitionById(id, false, null); 164 + if (processDefinition.isSuspended()) {
  165 + repositoryService.activateProcessDefinitionById(id, false, null);
  166 + }
162 return; 167 return;
163 } 168 }
164 // 挂起 169 // 挂起
165 if (Objects.equals(SuspensionState.SUSPENDED.getStateCode(), state)) { 170 if (Objects.equals(SuspensionState.SUSPENDED.getStateCode(), state)) {
166 // suspendProcessInstances = false,进行中的任务,不进行挂起。 171 // suspendProcessInstances = false,进行中的任务,不进行挂起。
167 // 原因:只要新的流程不允许发起即可,老流程继续可以执行。 172 // 原因:只要新的流程不允许发起即可,老流程继续可以执行。
168 - repositoryService.suspendProcessDefinitionById(id, false, null); 173 + if (!processDefinition.isSuspended()) {
  174 + repositoryService.suspendProcessDefinitionById(id, false, null);
  175 + }
169 return; 176 return;
170 } 177 }
171 log.error("[updateProcessDefinitionState][流程定义({}) 修改未知状态({})]", id, state); 178 log.error("[updateProcessDefinitionState][流程定义({}) 修改未知状态({})]", id, state);
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceService.java
@@ -7,6 +7,7 @@ import jakarta.validation.Valid; @@ -7,6 +7,7 @@ import jakarta.validation.Valid;
7 import org.flowable.engine.history.HistoricProcessInstance; 7 import org.flowable.engine.history.HistoricProcessInstance;
8 import org.flowable.engine.runtime.ProcessInstance; 8 import org.flowable.engine.runtime.ProcessInstance;
9 9
  10 +import java.util.Collection;
10 import java.util.List; 11 import java.util.List;
11 import java.util.Map; 12 import java.util.Map;
12 import java.util.Set; 13 import java.util.Set;
@@ -84,7 +85,6 @@ public interface BpmProcessInstanceService { @@ -84,7 +85,6 @@ public interface BpmProcessInstanceService {
84 PageResult<HistoricProcessInstance> getProcessInstancePage(Long userId, 85 PageResult<HistoricProcessInstance> getProcessInstancePage(Long userId,
85 @Valid BpmProcessInstancePageReqVO pageReqVO); 86 @Valid BpmProcessInstancePageReqVO pageReqVO);
86 87
87 - // TODO @芋艿:重点在 review 下  
88 /** 88 /**
89 * 获取审批详情。 89 * 获取审批详情。
90 * <p> 90 * <p>
@@ -97,6 +97,15 @@ public interface BpmProcessInstanceService { @@ -97,6 +97,15 @@ public interface BpmProcessInstanceService {
97 BpmApprovalDetailRespVO getApprovalDetail(Long loginUserId, @Valid BpmApprovalDetailReqVO reqVO); 97 BpmApprovalDetailRespVO getApprovalDetail(Long loginUserId, @Valid BpmApprovalDetailReqVO reqVO);
98 98
99 /** 99 /**
  100 + * 获取下一个执行节点信息
  101 + *
  102 + * @param loginUserId 登录人的用户编号
  103 + * @param reqVO 请求信息
  104 + * @return 下一个执行节点信息
  105 + */
  106 + List<BpmApprovalDetailRespVO.ActivityNode> getNextApprovalNodes(Long loginUserId, @Valid BpmApprovalDetailReqVO reqVO);
  107 +
  108 + /**
100 * 获取流程实例的 BPMN 模型视图 109 * 获取流程实例的 BPMN 模型视图
101 * 110 *
102 * @param id 流程实例的编号 111 * @param id 流程实例的编号
@@ -148,6 +157,22 @@ public interface BpmProcessInstanceService { @@ -148,6 +157,22 @@ public interface BpmProcessInstanceService {
148 */ 157 */
149 void updateProcessInstanceReject(ProcessInstance processInstance, String reason); 158 void updateProcessInstanceReject(ProcessInstance processInstance, String reason);
150 159
  160 + /**
  161 + * 更新 ProcessInstance 的变量
  162 + *
  163 + * @param id 流程编号
  164 + * @param variables 流程变量
  165 + */
  166 + void updateProcessInstanceVariables(String id, Map<String, Object> variables);
  167 +
  168 + /**
  169 + * 删除 ProcessInstance 的变量
  170 + *
  171 + * @param id 流程编号
  172 + * @param variableNames 流程变量名
  173 + */
  174 + void removeProcessInstanceVariables(String id, Collection<String> variableNames);
  175 +
151 // ========== Event 事件相关方法 ========== 176 // ========== Event 事件相关方法 ==========
152 177
153 /** 178 /**
@@ -158,11 +183,9 @@ public interface BpmProcessInstanceService { @@ -158,11 +183,9 @@ public interface BpmProcessInstanceService {
158 void processProcessInstanceCompleted(ProcessInstance instance); 183 void processProcessInstanceCompleted(ProcessInstance instance);
159 184
160 /** 185 /**
161 - * 更新 ProcessInstance 的变量 186 + * 处理 ProcessInstance 开始事件,例如说:流程前置通知
162 * 187 *
163 - * @param id 流程编号  
164 - * @param variables 流程变量 188 + * @param instance 流程任务
165 */ 189 */
166 - void updateProcessInstanceVariables(String id, Map<String, Object> variables);  
167 - 190 + void processProcessInstanceCreated(ProcessInstance instance);
168 } 191 }
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceServiceImpl.java
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.ListUtil; @@ -5,6 +5,7 @@ import cn.hutool.core.collection.ListUtil;
5 import cn.hutool.core.date.DateUtil; 5 import cn.hutool.core.date.DateUtil;
6 import cn.hutool.core.lang.Assert; 6 import cn.hutool.core.lang.Assert;
7 import cn.hutool.core.util.ArrayUtil; 7 import cn.hutool.core.util.ArrayUtil;
  8 +import cn.hutool.core.util.ObjUtil;
8 import cn.hutool.core.util.ObjectUtil; 9 import cn.hutool.core.util.ObjectUtil;
9 import cn.hutool.core.util.StrUtil; 10 import cn.hutool.core.util.StrUtil;
10 import cn.iocoder.yudao.framework.common.pojo.PageResult; 11 import cn.iocoder.yudao.framework.common.pojo.PageResult;
@@ -13,6 +14,7 @@ import cn.iocoder.yudao.framework.common.util.json.JsonUtils; @@ -13,6 +14,7 @@ import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
13 import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; 14 import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
14 import cn.iocoder.yudao.framework.common.util.object.PageUtils; 15 import cn.iocoder.yudao.framework.common.util.object.PageUtils;
15 import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; 16 import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
  17 +import cn.iocoder.yudao.module.bpm.controller.admin.base.user.UserSimpleBaseVO;
16 import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelMetaInfoVO; 18 import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelMetaInfoVO;
17 import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO; 19 import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO;
18 import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.*; 20 import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.*;
@@ -28,10 +30,11 @@ import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceStatusEnum; @@ -28,10 +30,11 @@ import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceStatusEnum;
28 import cn.iocoder.yudao.module.bpm.enums.task.BpmReasonEnum; 30 import cn.iocoder.yudao.module.bpm.enums.task.BpmReasonEnum;
29 import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum; 31 import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum;
30 import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateInvoker; 32 import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateInvoker;
31 -import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.dept.BpmTaskCandidateStartUserSelectStrategy; 33 +import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum;
32 import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants; 34 import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants;
33 import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants; 35 import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants;
34 import cn.iocoder.yudao.module.bpm.framework.flowable.core.event.BpmProcessInstanceEventPublisher; 36 import cn.iocoder.yudao.module.bpm.framework.flowable.core.event.BpmProcessInstanceEventPublisher;
  37 +import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmHttpRequestUtils;
35 import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils; 38 import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils;
36 import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils; 39 import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils;
37 import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.SimpleModelUtils; 40 import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.SimpleModelUtils;
@@ -54,11 +57,13 @@ import org.flowable.engine.history.HistoricProcessInstanceQuery; @@ -54,11 +57,13 @@ import org.flowable.engine.history.HistoricProcessInstanceQuery;
54 import org.flowable.engine.repository.ProcessDefinition; 57 import org.flowable.engine.repository.ProcessDefinition;
55 import org.flowable.engine.runtime.ProcessInstance; 58 import org.flowable.engine.runtime.ProcessInstance;
56 import org.flowable.engine.runtime.ProcessInstanceBuilder; 59 import org.flowable.engine.runtime.ProcessInstanceBuilder;
  60 +import org.flowable.task.api.Task;
57 import org.flowable.task.api.history.HistoricTaskInstance; 61 import org.flowable.task.api.history.HistoricTaskInstance;
58 import org.springframework.context.annotation.Lazy; 62 import org.springframework.context.annotation.Lazy;
59 import org.springframework.stereotype.Service; 63 import org.springframework.stereotype.Service;
60 import org.springframework.transaction.annotation.Transactional; 64 import org.springframework.transaction.annotation.Transactional;
61 import org.springframework.validation.annotation.Validated; 65 import org.springframework.validation.annotation.Validated;
  66 +import org.springframework.web.client.RestTemplate;
62 67
63 import java.util.*; 68 import java.util.*;
64 69
@@ -67,6 +72,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils. @@ -67,6 +72,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
67 import static cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmApprovalDetailRespVO.ActivityNode; 72 import static cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmApprovalDetailRespVO.ActivityNode;
68 import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; 73 import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
69 import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants.START_USER_NODE_ID; 74 import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants.START_USER_NODE_ID;
  75 +import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.parseNodeType;
70 import static java.util.Arrays.asList; 76 import static java.util.Arrays.asList;
71 import static java.util.Collections.singletonList; 77 import static java.util.Collections.singletonList;
72 import static org.flowable.bpmn.constants.BpmnXMLConstants.*; 78 import static org.flowable.bpmn.constants.BpmnXMLConstants.*;
@@ -144,7 +150,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService @@ -144,7 +150,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
144 } 150 }
145 151
146 private Map<String, String> getFormFieldsPermission(BpmnModel bpmnModel, 152 private Map<String, String> getFormFieldsPermission(BpmnModel bpmnModel,
147 - String activityId, String taskId) { 153 + String activityId, String taskId) {
148 // 1. 获取流程活动编号。流程活动 Id 为空事,从流程任务中获取流程活动 Id 154 // 1. 获取流程活动编号。流程活动 Id 为空事,从流程任务中获取流程活动 Id
149 if (StrUtil.isEmpty(activityId) && StrUtil.isNotEmpty(taskId)) { 155 if (StrUtil.isEmpty(activityId) && StrUtil.isNotEmpty(taskId)) {
150 activityId = Optional.ofNullable(taskService.getHistoricTask(taskId)) 156 activityId = Optional.ofNullable(taskService.getHistoricTask(taskId))
@@ -164,7 +170,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService @@ -164,7 +170,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
164 Long startUserId = loginUserId; // 流程发起人 170 Long startUserId = loginUserId; // 流程发起人
165 HistoricProcessInstance historicProcessInstance = null; // 流程实例 171 HistoricProcessInstance historicProcessInstance = null; // 流程实例
166 Integer processInstanceStatus = BpmProcessInstanceStatusEnum.NOT_START.getStatus(); // 流程状态 172 Integer processInstanceStatus = BpmProcessInstanceStatusEnum.NOT_START.getStatus(); // 流程状态
167 - Map<String, Object> processVariables = reqVO.getProcessVariables(); // 流程变量 173 + Map<String, Object> processVariables = new HashMap<>(); // 流程变量
168 // 1.2 如果是流程已发起的场景,则使用流程实例的数据 174 // 1.2 如果是流程已发起的场景,则使用流程实例的数据
169 if (reqVO.getProcessInstanceId() != null) { 175 if (reqVO.getProcessInstanceId() != null) {
170 historicProcessInstance = getHistoricProcessInstance(reqVO.getProcessInstanceId()); 176 historicProcessInstance = getHistoricProcessInstance(reqVO.getProcessInstanceId());
@@ -173,7 +179,13 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService @@ -173,7 +179,13 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
173 } 179 }
174 startUserId = Long.valueOf(historicProcessInstance.getStartUserId()); 180 startUserId = Long.valueOf(historicProcessInstance.getStartUserId());
175 processInstanceStatus = FlowableUtils.getProcessInstanceStatus(historicProcessInstance); 181 processInstanceStatus = FlowableUtils.getProcessInstanceStatus(historicProcessInstance);
176 - processVariables = historicProcessInstance.getProcessVariables(); 182 + // 合并 DB 和前端传递的流量变量,以前端的为主
  183 + if (CollUtil.isNotEmpty(historicProcessInstance.getProcessVariables())) {
  184 + processVariables.putAll(historicProcessInstance.getProcessVariables());
  185 + }
  186 + }
  187 + if (CollUtil.isNotEmpty(reqVO.getProcessVariables())) {
  188 + processVariables.putAll(reqVO.getProcessVariables());
177 } 189 }
178 // 1.3 读取其它相关数据 190 // 1.3 读取其它相关数据
179 ProcessDefinition processDefinition = processDefinitionService.getProcessDefinition( 191 ProcessDefinition processDefinition = processDefinitionService.getProcessDefinition(
@@ -205,14 +217,16 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService @@ -205,14 +217,16 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
205 } 217 }
206 218
207 // 3.1 计算当前登录用户的待办任务 219 // 3.1 计算当前登录用户的待办任务
208 - // TODO @jason:有一个极端情况,如果一个用户有 2 个 task A 和 B,A 已经通过,B 需要审核。这个时,通过 A 进来,todo 拿到  
209 - // B,会不会表单权限不一致哈。  
210 - BpmTaskRespVO todoTask = taskService.getFirstTodoTask(loginUserId, reqVO.getProcessInstanceId());  
211 - 220 + BpmTaskRespVO todoTask = taskService.getTodoTask(loginUserId, reqVO.getTaskId(), reqVO.getProcessInstanceId());
212 // 3.2 预测未运行节点的审批信息 221 // 3.2 预测未运行节点的审批信息
213 List<ActivityNode> simulateActivityNodes = getSimulateApproveNodeList(startUserId, bpmnModel, 222 List<ActivityNode> simulateActivityNodes = getSimulateApproveNodeList(startUserId, bpmnModel,
214 processDefinitionInfo, 223 processDefinitionInfo,
215 processVariables, activities); 224 processVariables, activities);
  225 + // 3.3 如果是发起动作,activityId 为开始节点,不校验审批人自选节点
  226 + if (ObjUtil.equals(reqVO.getActivityId(), BpmnModelConstants.START_USER_NODE_ID)) {
  227 + simulateActivityNodes.removeIf(node ->
  228 + BpmTaskCandidateStrategyEnum.APPROVE_USER_SELECT.getStrategy().equals(node.getCandidateStrategy()));
  229 + }
216 230
217 // 4. 拼接最终数据 231 // 4. 拼接最终数据
218 return buildApprovalDetail(reqVO, bpmnModel, processDefinition, processDefinitionInfo, historicProcessInstance, 232 return buildApprovalDetail(reqVO, bpmnModel, processDefinition, processDefinitionInfo, historicProcessInstance,
@@ -220,6 +234,62 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService @@ -220,6 +234,62 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
220 } 234 }
221 235
222 @Override 236 @Override
  237 + public List<ActivityNode> getNextApprovalNodes(Long loginUserId, BpmApprovalDetailReqVO reqVO) {
  238 + // 1.1 校验任务存在,且是当前用户的
  239 + Task task = taskService.validateTask(loginUserId, reqVO.getTaskId());
  240 + // 1.2 校验流程实例存在
  241 + ProcessInstance instance = getProcessInstance(task.getProcessInstanceId());
  242 + if (instance == null) {
  243 + throw exception(PROCESS_INSTANCE_NOT_EXISTS);
  244 + }
  245 + HistoricProcessInstance historicProcessInstance = getHistoricProcessInstance(task.getProcessInstanceId());
  246 + if (historicProcessInstance == null) {
  247 + throw exception(ErrorCodeConstants.PROCESS_INSTANCE_NOT_EXISTS);
  248 + }
  249 + // 1.3 校验BpmnModel
  250 + BpmnModel bpmnModel = processDefinitionService.getProcessDefinitionBpmnModel(task.getProcessDefinitionId());
  251 + if (bpmnModel == null) {
  252 + return null;
  253 + }
  254 +
  255 + // 2. 设置流程变量
  256 + Map<String, Object> processVariables = new HashMap<>();
  257 + // 2.1 获取历史中流程变量
  258 + if (CollUtil.isNotEmpty(historicProcessInstance.getProcessVariables())) {
  259 + processVariables.putAll(historicProcessInstance.getProcessVariables());
  260 + }
  261 + // 2.2 合并前端传递的流程变量,以前端为准
  262 + if (CollUtil.isNotEmpty(reqVO.getProcessVariables())) {
  263 + processVariables.putAll(reqVO.getProcessVariables());
  264 + }
  265 +
  266 + // 3 获取当前任务节点的信息
  267 + // 3.1 获取下一个将要执行的节点集合
  268 + FlowElement flowElement = bpmnModel.getFlowElement(task.getTaskDefinitionKey());
  269 + List<FlowNode> nextFlowNodes = BpmnModelUtils.getNextFlowNodes(flowElement, bpmnModel, processVariables);
  270 + return convertList(nextFlowNodes, node -> {
  271 + List<Long> candidateUserIds = getTaskCandidateUserList(bpmnModel, node.getId(),
  272 + loginUserId, historicProcessInstance.getProcessDefinitionId(), processVariables);
  273 + // 3.2 获取节点的审批人信息
  274 + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(candidateUserIds);
  275 + // 3.3 获取节点的审批人部门信息
  276 + Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId));
  277 + // 3.4 存在一个节点多人审批的情况,组装审批人信息
  278 + List<UserSimpleBaseVO> candidateUsers = new ArrayList<>();
  279 + userMap.forEach((key, value) -> candidateUsers.add(BpmProcessInstanceConvert.INSTANCE.buildUser(key, userMap, deptMap)));
  280 + return new ActivityNode().setNodeType(BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType())
  281 + .setId(node.getId())
  282 + .setName(node.getName())
  283 + .setStatus(BpmTaskStatusEnum.RUNNING.getStatus())
  284 + .setCandidateStrategy(BpmnModelUtils.parseCandidateStrategy(node))
  285 + // TODO @小北:先把 candidateUserIds 设置完,然后最后拼接 candidateUsers 信息。这样,如果有多个节点,就不用重复查询啦;类似 buildApprovalDetail 思路;
  286 + // TODO 先拼接处 List ActivityNode
  287 + // TODO 接着,再起一段,处理 adminUserApi.getUserMap(candidateUserIds)、deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId))
  288 + .setCandidateUsers(candidateUsers);
  289 + });
  290 + }
  291 +
  292 + @Override
223 @SuppressWarnings("unchecked") 293 @SuppressWarnings("unchecked")
224 public PageResult<HistoricProcessInstance> getProcessInstancePage(Long userId, 294 public PageResult<HistoricProcessInstance> getProcessInstancePage(Long userId,
225 BpmProcessInstancePageReqVO pageReqVO) { 295 BpmProcessInstancePageReqVO pageReqVO) {
@@ -283,15 +353,15 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService @@ -283,15 +353,15 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
283 * 主要是,拼接审批人的用户信息、部门信息 353 * 主要是,拼接审批人的用户信息、部门信息
284 */ 354 */
285 private BpmApprovalDetailRespVO buildApprovalDetail(BpmApprovalDetailReqVO reqVO, 355 private BpmApprovalDetailRespVO buildApprovalDetail(BpmApprovalDetailReqVO reqVO,
286 - BpmnModel bpmnModel,  
287 - ProcessDefinition processDefinition,  
288 - BpmProcessDefinitionInfoDO processDefinitionInfo,  
289 - HistoricProcessInstance processInstance,  
290 - Integer processInstanceStatus,  
291 - List<ActivityNode> endApprovalNodeInfos,  
292 - List<ActivityNode> runningApprovalNodeInfos,  
293 - List<ActivityNode> simulateApprovalNodeInfos,  
294 - BpmTaskRespVO todoTask) { 356 + BpmnModel bpmnModel,
  357 + ProcessDefinition processDefinition,
  358 + BpmProcessDefinitionInfoDO processDefinitionInfo,
  359 + HistoricProcessInstance processInstance,
  360 + Integer processInstanceStatus,
  361 + List<ActivityNode> endApprovalNodeInfos,
  362 + List<ActivityNode> runningApprovalNodeInfos,
  363 + List<ActivityNode> simulateApprovalNodeInfos,
  364 + BpmTaskRespVO todoTask) {
295 // 1. 获取所有需要读取用户信息的 userIds 365 // 1. 获取所有需要读取用户信息的 userIds
296 List<ActivityNode> approveNodes = newArrayList( 366 List<ActivityNode> approveNodes = newArrayList(
297 asList(endApprovalNodeInfos, runningApprovalNodeInfos, simulateApprovalNodeInfos)); 367 asList(endApprovalNodeInfos, runningApprovalNodeInfos, simulateApprovalNodeInfos));
@@ -313,19 +383,21 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService @@ -313,19 +383,21 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
313 * 获得【已结束】的活动节点们 383 * 获得【已结束】的活动节点们
314 */ 384 */
315 private List<ActivityNode> getEndActivityNodeList(Long startUserId, BpmnModel bpmnModel, 385 private List<ActivityNode> getEndActivityNodeList(Long startUserId, BpmnModel bpmnModel,
316 - BpmProcessDefinitionInfoDO processDefinitionInfo,  
317 - HistoricProcessInstance historicProcessInstance, Integer processInstanceStatus,  
318 - List<HistoricActivityInstance> activities, List<HistoricTaskInstance> tasks) { 386 + BpmProcessDefinitionInfoDO processDefinitionInfo,
  387 + HistoricProcessInstance historicProcessInstance, Integer processInstanceStatus,
  388 + List<HistoricActivityInstance> activities, List<HistoricTaskInstance> tasks) {
319 // 遍历 tasks 列表,只处理已结束的 UserTask 389 // 遍历 tasks 列表,只处理已结束的 UserTask
320 - // 为什么不通过 activities 呢?因为,加签场景下,它只存在于 tasks,没有 activities,导致如果遍历 activities  
321 - // 的话,它无法成为一个节点 390 + // 为什么不通过 activities 呢?因为,加签场景下,它只存在于 tasks,没有 activities,导致如果遍历 activities 的话,它无法成为一个节点
  391 + // TODO @芋艿:子流程只有activity,这里获取不到已结束的子流程;
  392 + // TODO @lesan:【子流程】基于 activities 查询出 usertask、callactivity,然后拼接?如果是子流程,就是可以点击过去?
322 List<HistoricTaskInstance> endTasks = filterList(tasks, task -> task.getEndTime() != null); 393 List<HistoricTaskInstance> endTasks = filterList(tasks, task -> task.getEndTime() != null);
323 List<ActivityNode> approvalNodes = convertList(endTasks, task -> { 394 List<ActivityNode> approvalNodes = convertList(endTasks, task -> {
324 FlowElement flowNode = BpmnModelUtils.getFlowElementById(bpmnModel, task.getTaskDefinitionKey()); 395 FlowElement flowNode = BpmnModelUtils.getFlowElementById(bpmnModel, task.getTaskDefinitionKey());
325 ActivityNode activityNode = new ActivityNode().setId(task.getTaskDefinitionKey()).setName(task.getName()) 396 ActivityNode activityNode = new ActivityNode().setId(task.getTaskDefinitionKey()).setName(task.getName())
326 .setNodeType(START_USER_NODE_ID.equals(task.getTaskDefinitionKey()) 397 .setNodeType(START_USER_NODE_ID.equals(task.getTaskDefinitionKey())
327 ? BpmSimpleModelNodeTypeEnum.START_USER_NODE.getType() 398 ? BpmSimpleModelNodeTypeEnum.START_USER_NODE.getType()
328 - : BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType()) 399 + : ObjUtil.defaultIfNull(parseNodeType(flowNode), // 目的:解决“办理节点”的识别
  400 + BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType()))
329 .setStatus(FlowableUtils.getTaskStatus(task)) 401 .setStatus(FlowableUtils.getTaskStatus(task))
330 .setCandidateStrategy(BpmnModelUtils.parseCandidateStrategy(flowNode)) 402 .setCandidateStrategy(BpmnModelUtils.parseCandidateStrategy(flowNode))
331 .setStartTime(DateUtils.of(task.getCreateTime())).setEndTime(DateUtils.of(task.getEndTime())) 403 .setStartTime(DateUtils.of(task.getCreateTime())).setEndTime(DateUtils.of(task.getEndTime()))
@@ -381,18 +453,19 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService @@ -381,18 +453,19 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
381 * 获得【进行中】的活动节点们 453 * 获得【进行中】的活动节点们
382 */ 454 */
383 private List<ActivityNode> getRunApproveNodeList(Long startUserId, 455 private List<ActivityNode> getRunApproveNodeList(Long startUserId,
384 - BpmnModel bpmnModel,  
385 - ProcessDefinition processDefinition,  
386 - Map<String, Object> processVariables,  
387 - List<HistoricActivityInstance> activities,  
388 - List<HistoricTaskInstance> tasks) {  
389 - // 构建运行中的任务,基于 activityId 分组 456 + BpmnModel bpmnModel,
  457 + ProcessDefinition processDefinition,
  458 + Map<String, Object> processVariables,
  459 + List<HistoricActivityInstance> activities,
  460 + List<HistoricTaskInstance> tasks) {
  461 + // 构建运行中的任务、子流程,基于 activityId 分组
390 List<HistoricActivityInstance> runActivities = filterList(activities, activity -> activity.getEndTime() == null 462 List<HistoricActivityInstance> runActivities = filterList(activities, activity -> activity.getEndTime() == null
391 - && (StrUtil.equalsAny(activity.getActivityType(), ELEMENT_TASK_USER))); 463 + && (StrUtil.equalsAny(activity.getActivityType(), ELEMENT_TASK_USER, ELEMENT_CALL_ACTIVITY)));
392 Map<String, List<HistoricActivityInstance>> runningTaskMap = convertMultiMap(runActivities, 464 Map<String, List<HistoricActivityInstance>> runningTaskMap = convertMultiMap(runActivities,
393 HistoricActivityInstance::getActivityId); 465 HistoricActivityInstance::getActivityId);
394 466
395 // 按照 activityId 分组,构建 ApprovalNodeInfo 节点 467 // 按照 activityId 分组,构建 ApprovalNodeInfo 节点
  468 + // TODO @lesan:【子流程】在子流程进行审批的时候,HistoricActivityInstance 里面可以拿到 runActivities.get(0).getCalledProcessInstanceId()。要不要支持跳转???
396 Map<String, HistoricTaskInstance> taskMap = convertMap(tasks, HistoricTaskInstance::getId); 469 Map<String, HistoricTaskInstance> taskMap = convertMap(tasks, HistoricTaskInstance::getId);
397 return convertList(runningTaskMap.entrySet(), entry -> { 470 return convertList(runningTaskMap.entrySet(), entry -> {
398 String activityId = entry.getKey(); 471 String activityId = entry.getKey();
@@ -402,7 +475,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService @@ -402,7 +475,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
402 HistoricActivityInstance firstActivity = CollUtil.getFirst(taskActivities); // 取第一个任务,会签/或签的任务,开始时间相同 475 HistoricActivityInstance firstActivity = CollUtil.getFirst(taskActivities); // 取第一个任务,会签/或签的任务,开始时间相同
403 ActivityNode activityNode = new ActivityNode().setId(firstActivity.getActivityId()) 476 ActivityNode activityNode = new ActivityNode().setId(firstActivity.getActivityId())
404 .setName(firstActivity.getActivityName()) 477 .setName(firstActivity.getActivityName())
405 - .setNodeType(BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType()) 478 + .setNodeType(ObjUtil.defaultIfNull(parseNodeType(flowNode), // 目的:解决“办理节点”和"子流程"的识别
  479 + BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType()))
406 .setStatus(BpmTaskStatusEnum.RUNNING.getStatus()) 480 .setStatus(BpmTaskStatusEnum.RUNNING.getStatus())
407 .setCandidateStrategy(BpmnModelUtils.parseCandidateStrategy(flowNode)) 481 .setCandidateStrategy(BpmnModelUtils.parseCandidateStrategy(flowNode))
408 .setStartTime(DateUtils.of(CollUtil.getFirst(taskActivities).getStartTime())) 482 .setStartTime(DateUtils.of(CollUtil.getFirst(taskActivities).getStartTime()))
@@ -410,6 +484,11 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService @@ -410,6 +484,11 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
410 // 处理每个任务的 tasks 属性 484 // 处理每个任务的 tasks 属性
411 for (HistoricActivityInstance activity : taskActivities) { 485 for (HistoricActivityInstance activity : taskActivities) {
412 HistoricTaskInstance task = taskMap.get(activity.getTaskId()); 486 HistoricTaskInstance task = taskMap.get(activity.getTaskId());
  487 + // 特殊情况:子流程节点 ChildProcess 仅存在于 activity 中,并且没有自身的 task,需要跳过执行
  488 + // TODO @芋艿:后续看看怎么优化!
  489 + if (task == null) {
  490 + continue;
  491 + }
413 activityNode.getTasks().add(BpmProcessInstanceConvert.INSTANCE.buildApprovalTaskInfo(task)); 492 activityNode.getTasks().add(BpmProcessInstanceConvert.INSTANCE.buildApprovalTaskInfo(task));
414 // 加签子任务,需要过滤掉已经完成的加签子任务 493 // 加签子任务,需要过滤掉已经完成的加签子任务
415 List<HistoricTaskInstance> childrenTasks = filterList( 494 List<HistoricTaskInstance> childrenTasks = filterList(
@@ -440,9 +519,9 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService @@ -440,9 +519,9 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
440 * 获得【预测(未来)】的活动节点们 519 * 获得【预测(未来)】的活动节点们
441 */ 520 */
442 private List<ActivityNode> getSimulateApproveNodeList(Long startUserId, BpmnModel bpmnModel, 521 private List<ActivityNode> getSimulateApproveNodeList(Long startUserId, BpmnModel bpmnModel,
443 - BpmProcessDefinitionInfoDO processDefinitionInfo,  
444 - Map<String, Object> processVariables,  
445 - List<HistoricActivityInstance> activities) { 522 + BpmProcessDefinitionInfoDO processDefinitionInfo,
  523 + Map<String, Object> processVariables,
  524 + List<HistoricActivityInstance> activities) {
446 // TODO @芋艿:【可优化】在驳回场景下,未来的预测准确性不高。原因是,驳回后,HistoricActivityInstance 525 // TODO @芋艿:【可优化】在驳回场景下,未来的预测准确性不高。原因是,驳回后,HistoricActivityInstance
447 // 包括了历史的操作,不是只有 startEvent 到当前节点的记录 526 // 包括了历史的操作,不是只有 startEvent 到当前节点的记录
448 Set<String> runActivityIds = convertSet(activities, HistoricActivityInstance::getActivityId); 527 Set<String> runActivityIds = convertSet(activities, HistoricActivityInstance::getActivityId);
@@ -464,8 +543,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService @@ -464,8 +543,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
464 } 543 }
465 544
466 private ActivityNode buildNotRunApproveNodeForSimple(Long startUserId, BpmnModel bpmnModel, 545 private ActivityNode buildNotRunApproveNodeForSimple(Long startUserId, BpmnModel bpmnModel,
467 - BpmProcessDefinitionInfoDO processDefinitionInfo, Map<String, Object> processVariables,  
468 - BpmSimpleModelNodeVO node, Set<String> runActivityIds) { 546 + BpmProcessDefinitionInfoDO processDefinitionInfo, Map<String, Object> processVariables,
  547 + BpmSimpleModelNodeVO node, Set<String> runActivityIds) {
469 // TODO @芋艿:【可优化】在驳回场景下,未来的预测准确性不高。原因是,驳回后,HistoricActivityInstance 548 // TODO @芋艿:【可优化】在驳回场景下,未来的预测准确性不高。原因是,驳回后,HistoricActivityInstance
470 // 包括了历史的操作,不是只有 startEvent 到当前节点的记录 549 // 包括了历史的操作,不是只有 startEvent 到当前节点的记录
471 if (runActivityIds.contains(node.getId())) { 550 if (runActivityIds.contains(node.getId())) {
@@ -479,7 +558,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService @@ -479,7 +558,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
479 // 1. 开始节点/审批节点 558 // 1. 开始节点/审批节点
480 if (ObjectUtils.equalsAny(node.getType(), 559 if (ObjectUtils.equalsAny(node.getType(),
481 BpmSimpleModelNodeTypeEnum.START_USER_NODE.getType(), 560 BpmSimpleModelNodeTypeEnum.START_USER_NODE.getType(),
482 - BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType())) { 561 + BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType(),
  562 + BpmSimpleModelNodeTypeEnum.TRANSACTOR_NODE.getType())) {
483 List<Long> candidateUserIds = getTaskCandidateUserList(bpmnModel, node.getId(), 563 List<Long> candidateUserIds = getTaskCandidateUserList(bpmnModel, node.getId(),
484 startUserId, processDefinitionInfo.getProcessDefinitionId(), processVariables); 564 startUserId, processDefinitionInfo.getProcessDefinitionId(), processVariables);
485 activityNode.setCandidateUserIds(candidateUserIds); 565 activityNode.setCandidateUserIds(candidateUserIds);
@@ -494,14 +574,22 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService @@ -494,14 +574,22 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
494 // 3. 抄送节点 574 // 3. 抄送节点
495 if (CollUtil.isEmpty(runActivityIds) && // 流程发起时:需要展示抄送节点,用于选择抄送人 575 if (CollUtil.isEmpty(runActivityIds) && // 流程发起时:需要展示抄送节点,用于选择抄送人
496 BpmSimpleModelNodeTypeEnum.COPY_NODE.getType().equals(node.getType())) { 576 BpmSimpleModelNodeTypeEnum.COPY_NODE.getType().equals(node.getType())) {
  577 + List<Long> candidateUserIds = getTaskCandidateUserList(bpmnModel, node.getId(),
  578 + startUserId, processDefinitionInfo.getProcessDefinitionId(), processVariables);
  579 + activityNode.setCandidateUserIds(candidateUserIds);
  580 + return activityNode;
  581 + }
  582 +
  583 + // 4. 子流程节点
  584 + if (BpmSimpleModelNodeTypeEnum.CHILD_PROCESS.getType().equals(node.getType())) {
497 return activityNode; 585 return activityNode;
498 } 586 }
499 return null; 587 return null;
500 } 588 }
501 589
502 private ActivityNode buildNotRunApproveNodeForBpmn(Long startUserId, BpmnModel bpmnModel, 590 private ActivityNode buildNotRunApproveNodeForBpmn(Long startUserId, BpmnModel bpmnModel,
503 - BpmProcessDefinitionInfoDO processDefinitionInfo, Map<String, Object> processVariables,  
504 - FlowElement node, Set<String> runActivityIds) { 591 + BpmProcessDefinitionInfoDO processDefinitionInfo, Map<String, Object> processVariables,
  592 + FlowElement node, Set<String> runActivityIds) {
505 if (runActivityIds.contains(node.getId())) { 593 if (runActivityIds.contains(node.getId())) {
506 return null; 594 return null;
507 } 595 }
@@ -532,7 +620,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService @@ -532,7 +620,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
532 } 620 }
533 621
534 private List<Long> getTaskCandidateUserList(BpmnModel bpmnModel, String activityId, 622 private List<Long> getTaskCandidateUserList(BpmnModel bpmnModel, String activityId,
535 - Long startUserId, String processDefinitionId, Map<String, Object> processVariables) { 623 + Long startUserId, String processDefinitionId, Map<String, Object> processVariables) {
536 Set<Long> userIds = taskCandidateInvoker.calculateUsersByActivity(bpmnModel, activityId, 624 Set<Long> userIds = taskCandidateInvoker.calculateUsersByActivity(bpmnModel, activityId,
537 startUserId, processDefinitionId, processVariables); 625 startUserId, processDefinitionId, processVariables);
538 return new ArrayList<>(userIds); 626 return new ArrayList<>(userIds);
@@ -568,11 +656,11 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService @@ -568,11 +656,11 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
568 Set<String> finishedTaskActivityIds = convertSet(activities, HistoricActivityInstance::getActivityId, 656 Set<String> finishedTaskActivityIds = convertSet(activities, HistoricActivityInstance::getActivityId,
569 activityInstance -> activityInstance.getEndTime() != null 657 activityInstance -> activityInstance.getEndTime() != null
570 && ObjectUtil.notEqual(activityInstance.getActivityType(), 658 && ObjectUtil.notEqual(activityInstance.getActivityType(),
571 - BpmnXMLConstants.ELEMENT_SEQUENCE_FLOW)); 659 + BpmnXMLConstants.ELEMENT_SEQUENCE_FLOW));
572 Set<String> finishedSequenceFlowActivityIds = convertSet(activities, HistoricActivityInstance::getActivityId, 660 Set<String> finishedSequenceFlowActivityIds = convertSet(activities, HistoricActivityInstance::getActivityId,
573 activityInstance -> activityInstance.getEndTime() != null 661 activityInstance -> activityInstance.getEndTime() != null
574 && ObjectUtil.equals(activityInstance.getActivityType(), 662 && ObjectUtil.equals(activityInstance.getActivityType(),
575 - BpmnXMLConstants.ELEMENT_SEQUENCE_FLOW)); 663 + BpmnXMLConstants.ELEMENT_SEQUENCE_FLOW));
576 // 特殊:会签情况下,会有部分已完成(审批)、部分未完成(待审批),此时需要 finishedTaskActivityIds 移除掉 664 // 特殊:会签情况下,会有部分已完成(审批)、部分未完成(待审批),此时需要 finishedTaskActivityIds 移除掉
577 finishedTaskActivityIds.removeAll(unfinishedTaskActivityIds); 665 finishedTaskActivityIds.removeAll(unfinishedTaskActivityIds);
578 // 特殊:如果流程实例被拒绝,则需要计算是哪个活动节点。 666 // 特殊:如果流程实例被拒绝,则需要计算是哪个活动节点。
@@ -624,8 +712,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService @@ -624,8 +712,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
624 } 712 }
625 713
626 private String createProcessInstance0(Long userId, ProcessDefinition definition, 714 private String createProcessInstance0(Long userId, ProcessDefinition definition,
627 - Map<String, Object> variables, String businessKey,  
628 - Map<String, List<Long>> startUserSelectAssignees) { 715 + Map<String, Object> variables, String businessKey,
  716 + Map<String, List<Long>> startUserSelectAssignees) {
629 // 1.1 校验流程定义 717 // 1.1 校验流程定义
630 if (definition == null) { 718 if (definition == null) {
631 throw exception(PROCESS_DEFINITION_NOT_EXISTS); 719 throw exception(PROCESS_DEFINITION_NOT_EXISTS);
@@ -643,7 +731,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService @@ -643,7 +731,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
643 throw exception(PROCESS_INSTANCE_START_USER_CAN_START); 731 throw exception(PROCESS_INSTANCE_START_USER_CAN_START);
644 } 732 }
645 // 1.3 校验发起人自选审批人 733 // 1.3 校验发起人自选审批人
646 - validateStartUserSelectAssignees(definition, startUserSelectAssignees); 734 + validateStartUserSelectAssignees(userId, definition, startUserSelectAssignees, variables);
647 735
648 // 2. 创建流程实例 736 // 2. 创建流程实例
649 if (variables == null) { 737 if (variables == null) {
@@ -653,10 +741,9 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService @@ -653,10 +741,9 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
653 variables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_START_USER_ID, userId); // 设置流程变量,发起人 ID 741 variables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_START_USER_ID, userId); // 设置流程变量,发起人 ID
654 variables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_STATUS, // 流程实例状态:审批中 742 variables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_STATUS, // 流程实例状态:审批中
655 BpmProcessInstanceStatusEnum.RUNNING.getStatus()); 743 BpmProcessInstanceStatusEnum.RUNNING.getStatus());
656 - variables.put(BpmnVariableConstants.PROCESS_INSTANCE_SKIP_EXPRESSION_ENABLED, true); // 跳过表达式需要添加此变量为  
657 - // true,不影响没配置  
658 - // skipExpression 的节点 744 + variables.put(BpmnVariableConstants.PROCESS_INSTANCE_SKIP_EXPRESSION_ENABLED, true); // 跳过表达式需要添加此变量为 true,不影响没配置 skipExpression 的节点
659 if (CollUtil.isNotEmpty(startUserSelectAssignees)) { 745 if (CollUtil.isNotEmpty(startUserSelectAssignees)) {
  746 + // 设置流程变量,发起人自选审批人
660 variables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES, 747 variables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES,
661 startUserSelectAssignees); 748 startUserSelectAssignees);
662 } 749 }
@@ -688,17 +775,23 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService @@ -688,17 +775,23 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
688 return instance.getId(); 775 return instance.getId();
689 } 776 }
690 777
691 - private void validateStartUserSelectAssignees(ProcessDefinition definition,  
692 - Map<String, List<Long>> startUserSelectAssignees) {  
693 - // 1. 获得发起人自选审批人的 UserTask/ServiceTask 列表  
694 - BpmnModel bpmnModel = processDefinitionService.getProcessDefinitionBpmnModel(definition.getId());  
695 - List<Task> tasks = BpmTaskCandidateStartUserSelectStrategy.getStartUserSelectTaskList(bpmnModel);  
696 - if (CollUtil.isEmpty(tasks)) { 778 + private void validateStartUserSelectAssignees(Long userId, ProcessDefinition definition,
  779 + Map<String, List<Long>> startUserSelectAssignees,
  780 + Map<String, Object> variables) {
  781 + // 1. 获取预测的节点信息
  782 + BpmApprovalDetailRespVO detailRespVO = getApprovalDetail(userId, new BpmApprovalDetailReqVO()
  783 + .setProcessDefinitionId(definition.getId())
  784 + .setProcessVariables(variables));
  785 + List<ActivityNode> activityNodes = detailRespVO.getActivityNodes();
  786 + if (CollUtil.isEmpty(activityNodes)) {
697 return; 787 return;
698 } 788 }
699 789
700 - // 2. 校验发起人自选审批人的审批人和抄送人是否都配置了  
701 - tasks.forEach(task -> { 790 + // 2.1 移除掉不是发起人自选审批人节点
  791 + activityNodes.removeIf(task ->
  792 + ObjectUtil.notEqual(BpmTaskCandidateStrategyEnum.START_USER_SELECT.getStrategy(), task.getCandidateStrategy()));
  793 + // 2.2 流程发起时要先获取当前流程的预测走向节点,发起时只校验预测的节点发起人自选审批人的审批人和抄送人是否都配置了
  794 + activityNodes.forEach(task -> {
702 List<Long> assignees = startUserSelectAssignees != null ? startUserSelectAssignees.get(task.getId()) : null; 795 List<Long> assignees = startUserSelectAssignees != null ? startUserSelectAssignees.get(task.getId()) : null;
703 if (CollUtil.isEmpty(assignees)) { 796 if (CollUtil.isEmpty(assignees)) {
704 throw exception(PROCESS_INSTANCE_START_USER_SELECT_ASSIGNEES_NOT_CONFIG, task.getName()); 797 throw exception(PROCESS_INSTANCE_START_USER_SELECT_ASSIGNEES_NOT_CONFIG, task.getName());
@@ -771,6 +864,16 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService @@ -771,6 +864,16 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
771 BpmReasonEnum.REJECT_TASK.format(reason)); 864 BpmReasonEnum.REJECT_TASK.format(reason));
772 } 865 }
773 866
  867 + @Override
  868 + public void updateProcessInstanceVariables(String id, Map<String, Object> variables) {
  869 + runtimeService.setVariables(id, variables);
  870 + }
  871 +
  872 + @Override
  873 + public void removeProcessInstanceVariables(String id, Collection<String> variableNames) {
  874 + runtimeService.removeVariables(id, variableNames);
  875 + }
  876 +
774 // ========== Event 事件相关方法 ========== 877 // ========== Event 事件相关方法 ==========
775 878
776 @Override 879 @Override
@@ -802,12 +905,43 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService @@ -802,12 +905,43 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
802 // 3. 发送流程实例的状态事件 905 // 3. 发送流程实例的状态事件
803 processInstanceEventPublisher.sendProcessInstanceResultEvent( 906 processInstanceEventPublisher.sendProcessInstanceResultEvent(
804 BpmProcessInstanceConvert.INSTANCE.buildProcessInstanceStatusEvent(this, instance, status)); 907 BpmProcessInstanceConvert.INSTANCE.buildProcessInstanceStatusEvent(this, instance, status));
  908 +
  909 + // 4. 流程后置通知
  910 + if (Objects.equals(status, BpmProcessInstanceStatusEnum.APPROVE.getStatus())) {
  911 + BpmProcessDefinitionInfoDO processDefinitionInfo = processDefinitionService.
  912 + getProcessDefinitionInfo(instance.getProcessDefinitionId());
  913 + if (ObjUtil.isNotNull(processDefinitionInfo) &&
  914 + ObjUtil.isNotNull(processDefinitionInfo.getProcessAfterTriggerSetting())) {
  915 + BpmModelMetaInfoVO.HttpRequestSetting setting = processDefinitionInfo.getProcessAfterTriggerSetting();
  916 +
  917 + BpmHttpRequestUtils.executeBpmHttpRequest(instance,
  918 + setting.getUrl(),
  919 + setting.getHeader(),
  920 + setting.getBody(),
  921 + true, setting.getResponse());
  922 + }
  923 + }
805 }); 924 });
806 } 925 }
807 926
808 @Override 927 @Override
809 - public void updateProcessInstanceVariables(String id, Map<String, Object> variables) {  
810 - runtimeService.setVariables(id, variables); 928 + public void processProcessInstanceCreated(ProcessInstance instance) {
  929 + // 注意:需要基于 instance 设置租户编号,避免 Flowable 内部异步时,丢失租户编号
  930 + FlowableUtils.execute(instance.getTenantId(), () -> {
  931 + // 流程前置通知
  932 + BpmProcessDefinitionInfoDO processDefinitionInfo = processDefinitionService.
  933 + getProcessDefinitionInfo(instance.getProcessDefinitionId());
  934 + if (ObjUtil.isNull(processDefinitionInfo) ||
  935 + ObjUtil.isNull(processDefinitionInfo.getProcessBeforeTriggerSetting())) {
  936 + return;
  937 + }
  938 + BpmModelMetaInfoVO.HttpRequestSetting setting = processDefinitionInfo.getProcessBeforeTriggerSetting();
  939 + BpmHttpRequestUtils.executeBpmHttpRequest(instance,
  940 + setting.getUrl(),
  941 + setting.getHeader(),
  942 + setting.getBody(),
  943 + true, setting.getResponse());
  944 + });
811 } 945 }
812 946
813 } 947 }
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskService.java
@@ -35,13 +35,16 @@ public interface BpmTaskService { @@ -35,13 +35,16 @@ public interface BpmTaskService {
35 PageResult<Task> getTaskTodoPage(Long userId, BpmTaskPageReqVO pageReqVO); 35 PageResult<Task> getTaskTodoPage(Long userId, BpmTaskPageReqVO pageReqVO);
36 36
37 /** 37 /**
38 - * 获得用户在指定流程下,首个需要处理(待办)的任务 38 + * 获得用户(待办)的任务:
  39 + * 1. 根据 taskId 查询待办任务
  40 + * 2. 如果任务不存在(或者已审核),获取指定流程下,首个需要处理任务
39 * 41 *
40 * @param userId 用户编号 42 * @param userId 用户编号
  43 + * @param taskId 任务编号
41 * @param processInstanceId 流程实例编号 44 * @param processInstanceId 流程实例编号
42 * @return 待办任务 45 * @return 待办任务
43 */ 46 */
44 - BpmTaskRespVO getFirstTodoTask(Long userId, String processInstanceId); 47 + BpmTaskRespVO getTodoTask(Long userId, String taskId, String processInstanceId);
45 48
46 /** 49 /**
47 * 获得已办的流程任务分页 50 * 获得已办的流程任务分页
@@ -90,6 +93,14 @@ public interface BpmTaskService { @@ -90,6 +93,14 @@ public interface BpmTaskService {
90 List<HistoricTaskInstance> getTaskListByProcessInstanceId(String processInstanceId, Boolean asc); 93 List<HistoricTaskInstance> getTaskListByProcessInstanceId(String processInstanceId, Boolean asc);
91 94
92 /** 95 /**
  96 + * 校验任务是否存在,并且是否是分配给自己的任务
  97 + *
  98 + * @param userId 用户 id
  99 + * @param taskId task id
  100 + */
  101 + Task validateTask(Long userId, String taskId);
  102 +
  103 + /**
93 * 获取任务 104 * 获取任务
94 * 105 *
95 * @param id 任务编号 106 * @param id 任务编号
@@ -277,11 +288,22 @@ public interface BpmTaskService { @@ -277,11 +288,22 @@ public interface BpmTaskService {
277 void processTaskTimeout(String processInstanceId, String taskDefineKey, Integer handlerType); 288 void processTaskTimeout(String processInstanceId, String taskDefineKey, Integer handlerType);
278 289
279 /** 290 /**
280 - * 处理 延迟器 超时事件 291 + * 处理 ChildProcess 子流程的审批超时事件
  292 + *
  293 + * @param processInstanceId 流程示例编号
  294 + * @param taskDefineKey 任务 Key
  295 + */
  296 + void processChildProcessTimeout(String processInstanceId, String taskDefineKey);
  297 +
  298 + /**
  299 + * 触发流程任务 (ReceiveTask) 的执行
  300 + * <p>
  301 + * 1. Simple 模型 HTTP 回调请求触发器节点的回调,触发流程继续执行
  302 + * 2. Simple 模型延迟器节点,到时触发流程继续执行
281 * 303 *
282 * @param processInstanceId 流程示例编号 304 * @param processInstanceId 流程示例编号
283 * @param taskDefineKey 任务 Key 305 * @param taskDefineKey 任务 Key
284 */ 306 */
285 - void processDelayTimerTimeout(String processInstanceId, String taskDefineKey); 307 + void triggerTask(String processInstanceId, String taskDefineKey);
286 308
287 } 309 }
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java
1 package cn.iocoder.yudao.module.bpm.service.task; 1 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.convert.Convert;
4 import cn.hutool.core.lang.Assert; 5 import cn.hutool.core.lang.Assert;
5 import cn.hutool.core.util.*; 6 import cn.hutool.core.util.*;
6 import cn.hutool.extra.spring.SpringUtil; 7 import cn.hutool.extra.spring.SpringUtil;
@@ -9,6 +10,7 @@ import cn.iocoder.yudao.framework.common.util.date.DateUtils; @@ -9,6 +10,7 @@ import cn.iocoder.yudao.framework.common.util.date.DateUtils;
9 import cn.iocoder.yudao.framework.common.util.number.NumberUtils; 10 import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
10 import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; 11 import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
11 import cn.iocoder.yudao.framework.common.util.object.PageUtils; 12 import cn.iocoder.yudao.framework.common.util.object.PageUtils;
  13 +import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
12 import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils; 14 import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
13 import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.*; 15 import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.*;
14 import cn.iocoder.yudao.module.bpm.convert.task.BpmTaskConvert; 16 import cn.iocoder.yudao.module.bpm.convert.task.BpmTaskConvert;
@@ -19,6 +21,7 @@ import cn.iocoder.yudao.module.bpm.enums.task.BpmCommentTypeEnum; @@ -19,6 +21,7 @@ import cn.iocoder.yudao.module.bpm.enums.task.BpmCommentTypeEnum;
19 import cn.iocoder.yudao.module.bpm.enums.task.BpmReasonEnum; 21 import cn.iocoder.yudao.module.bpm.enums.task.BpmReasonEnum;
20 import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskSignTypeEnum; 22 import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskSignTypeEnum;
21 import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum; 23 import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum;
  24 +import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum;
22 import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants; 25 import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants;
23 import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils; 26 import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils;
24 import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils; 27 import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils;
@@ -40,6 +43,7 @@ import org.flowable.engine.ManagementService; @@ -40,6 +43,7 @@ import org.flowable.engine.ManagementService;
40 import org.flowable.engine.RuntimeService; 43 import org.flowable.engine.RuntimeService;
41 import org.flowable.engine.TaskService; 44 import org.flowable.engine.TaskService;
42 import org.flowable.engine.history.HistoricActivityInstance; 45 import org.flowable.engine.history.HistoricActivityInstance;
  46 +import org.flowable.engine.runtime.ActivityInstance;
43 import org.flowable.engine.runtime.Execution; 47 import org.flowable.engine.runtime.Execution;
44 import org.flowable.engine.runtime.ProcessInstance; 48 import org.flowable.engine.runtime.ProcessInstance;
45 import org.flowable.task.api.DelegationState; 49 import org.flowable.task.api.DelegationState;
@@ -61,7 +65,9 @@ import java.util.stream.Stream; @@ -61,7 +65,9 @@ import java.util.stream.Stream;
61 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; 65 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
62 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; 66 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
63 import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; 67 import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
  68 +import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants.START_USER_NODE_ID;
64 import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_RETURN_FLAG; 69 import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_RETURN_FLAG;
  70 +import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_SKIP_START_USER_NODE;
65 import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.*; 71 import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.*;
66 72
67 /** 73 /**
@@ -116,6 +122,9 @@ public class BpmTaskServiceImpl implements BpmTaskService { @@ -116,6 +122,9 @@ public class BpmTaskServiceImpl implements BpmTaskService {
116 if (StrUtil.isNotEmpty(pageVO.getCategory())) { 122 if (StrUtil.isNotEmpty(pageVO.getCategory())) {
117 taskQuery.taskCategory(pageVO.getCategory()); 123 taskQuery.taskCategory(pageVO.getCategory());
118 } 124 }
  125 + if (StrUtil.isNotEmpty(pageVO.getProcessDefinitionKey())) {
  126 + taskQuery.processDefinitionKey(pageVO.getProcessDefinitionKey());
  127 + }
119 if (ArrayUtil.isNotEmpty(pageVO.getCreateTime())) { 128 if (ArrayUtil.isNotEmpty(pageVO.getCreateTime())) {
120 taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getCreateTime()[0])); 129 taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getCreateTime()[0]));
121 taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getCreateTime()[1])); 130 taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getCreateTime()[1]));
@@ -129,32 +138,19 @@ public class BpmTaskServiceImpl implements BpmTaskService { @@ -129,32 +138,19 @@ public class BpmTaskServiceImpl implements BpmTaskService {
129 } 138 }
130 139
131 @Override 140 @Override
132 - public BpmTaskRespVO getFirstTodoTask(Long userId, String processInstanceId) {  
133 - if (processInstanceId == null) {  
134 - return null;  
135 - }  
136 - // 1. 查询所有任务  
137 - List<Task> tasks = taskService.createTaskQuery()  
138 - .active()  
139 - .processInstanceId(processInstanceId)  
140 - .includeTaskLocalVariables()  
141 - .includeProcessVariables()  
142 - .orderByTaskCreateTime().asc() // 按创建时间升序  
143 - .list();  
144 - if (CollUtil.isEmpty(tasks)) {  
145 - return null; 141 + public BpmTaskRespVO getTodoTask(Long userId, String taskId, String processInstanceId) {
  142 + // 1.1 获取指定的用户待办任务
  143 + Task todoTask = getMyTodoTask(userId, taskId);
  144 + // 1.2 获取不到,则获取该流程实例下,第一个用户的待办任务
  145 + if (todoTask == null) {
  146 + todoTask = getMyFirstTodoTask(userId, processInstanceId);
146 } 147 }
147 -  
148 - // 2.1 查询我的首个任务  
149 - Task todoTask = CollUtil.findOne(tasks, task -> {  
150 - return isAssignUserTask(userId, task) // 当前用户为审批人  
151 - || isAddSignUserTask(userId, task); // 当前用户为加签人(为了减签)  
152 - });  
153 if (todoTask == null) { 148 if (todoTask == null) {
154 return null; 149 return null;
155 } 150 }
156 - // 2.2 查询该任务的子任务  
157 - List<Task> childrenTasks = getAllChildrenTaskListByParentTaskId(todoTask.getId(), tasks); 151 +
  152 + // 2. 查询该任务的子任务
  153 + List<Task> childrenTasks = getAllChildrenTaskListByParentTaskId(todoTask.getId(), CollUtil.newArrayList(todoTask));
158 154
159 // 3. 转换返回 155 // 3. 转换返回
160 BpmnModel bpmnModel = bpmProcessDefinitionService.getProcessDefinitionBpmnModel(todoTask.getProcessDefinitionId()); 156 BpmnModel bpmnModel = bpmProcessDefinitionService.getProcessDefinitionBpmnModel(todoTask.getProcessDefinitionId());
@@ -162,6 +158,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { @@ -162,6 +158,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
162 bpmnModel, todoTask.getTaskDefinitionKey()); 158 bpmnModel, todoTask.getTaskDefinitionKey());
163 Boolean signEnable = parseSignEnable(bpmnModel, todoTask.getTaskDefinitionKey()); 159 Boolean signEnable = parseSignEnable(bpmnModel, todoTask.getTaskDefinitionKey());
164 Boolean reasonRequire = parseReasonRequire(bpmnModel, todoTask.getTaskDefinitionKey()); 160 Boolean reasonRequire = parseReasonRequire(bpmnModel, todoTask.getTaskDefinitionKey());
  161 + Integer nodeType = parseNodeType(BpmnModelUtils.getFlowElementById(bpmnModel, todoTask.getTaskDefinitionKey()));
165 162
166 // 4. 任务表单 163 // 4. 任务表单
167 BpmFormDO taskForm = null; 164 BpmFormDO taskForm = null;
@@ -170,8 +167,55 @@ public class BpmTaskServiceImpl implements BpmTaskService { @@ -170,8 +167,55 @@ public class BpmTaskServiceImpl implements BpmTaskService {
170 } 167 }
171 168
172 return BpmTaskConvert.INSTANCE.buildTodoTask(todoTask, childrenTasks, buttonsSetting, taskForm) 169 return BpmTaskConvert.INSTANCE.buildTodoTask(todoTask, childrenTasks, buttonsSetting, taskForm)
173 - .setSignEnable(signEnable)  
174 - .setReasonRequire(reasonRequire); 170 + .setNodeType(nodeType).setSignEnable(signEnable).setReasonRequire(reasonRequire);
  171 + }
  172 +
  173 + /**
  174 + * 获得用户指定 taskId 任务编号的“待办”(未审批、且可审核)的任务
  175 + *
  176 + * @param userId 用户编号
  177 + * @param taskId 任务编号
  178 + * @return 任务
  179 + */
  180 + private Task getMyTodoTask(Long userId, String taskId) {
  181 + if (StrUtil.isEmpty(taskId)) {
  182 + return null;
  183 + }
  184 + Task task = getTask(taskId);
  185 + if (task == null) {
  186 + return null;
  187 + }
  188 + if (!isAssignUserTask(userId, task) && !isAddSignUserTask(userId, task)) {
  189 + return null;
  190 + }
  191 + return task;
  192 + }
  193 +
  194 + /**
  195 + * 获得用户指定 processInstanceId 流程编号下的首个“待办”(未审批、且可审核)的任务
  196 + *
  197 + * @param userId 用户编号
  198 + * @param processInstanceId 流程编号
  199 + * @return 任务
  200 + */
  201 + private Task getMyFirstTodoTask(Long userId, String processInstanceId) {
  202 + if (processInstanceId == null) {
  203 + return null;
  204 + }
  205 + // 1. 查询所有任务
  206 + List<Task> tasks = taskService.createTaskQuery()
  207 + .active()
  208 + .processInstanceId(processInstanceId)
  209 + .includeTaskLocalVariables()
  210 + .includeProcessVariables()
  211 + .orderByTaskCreateTime().asc() // 按创建时间升序
  212 + .list();
  213 +
  214 + // 2. 查询我的首个任务
  215 + return CollUtil.findOne(tasks, task -> {
  216 + return isAssignUserTask(userId, task) // 当前用户为审批人
  217 + || isAddSignUserTask(userId, task); // 当前用户为加签人(为了减签)
  218 + });
175 } 219 }
176 220
177 @Override 221 @Override
@@ -194,6 +238,10 @@ public class BpmTaskServiceImpl implements BpmTaskService { @@ -194,6 +238,10 @@ public class BpmTaskServiceImpl implements BpmTaskService {
194 return PageResult.empty(); 238 return PageResult.empty();
195 } 239 }
196 List<HistoricTaskInstance> tasks = taskQuery.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize()); 240 List<HistoricTaskInstance> tasks = taskQuery.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize());
  241 +
  242 + // 特殊:强制移除自动完成的“发起人”节点
  243 + // 补充说明:由于 taskQuery 无法方面的过滤,所以暂时通过内存过滤
  244 + tasks.removeIf(task -> task.getTaskDefinitionKey().equals(START_USER_NODE_ID));
197 return new PageResult<>(tasks, count); 245 return new PageResult<>(tasks, count);
198 } 246 }
199 247
@@ -243,13 +291,8 @@ public class BpmTaskServiceImpl implements BpmTaskService { @@ -243,13 +291,8 @@ public class BpmTaskServiceImpl implements BpmTaskService {
243 return query.list(); 291 return query.list();
244 } 292 }
245 293
246 - /**  
247 - * 校验任务是否存在,并且是否是分配给自己的任务  
248 - *  
249 - * @param userId 用户 id  
250 - * @param taskId task id  
251 - */  
252 - private Task validateTask(Long userId, String taskId) { 294 + @Override
  295 + public Task validateTask(Long userId, String taskId) {
253 Task task = validateTaskExist(taskId); 296 Task task = validateTaskExist(taskId);
254 // 为什么判断 assignee 非空的情况下? 297 // 为什么判断 assignee 非空的情况下?
255 // 例如说:在审批人为空时,我们会有“自动审批通过”的策略,此时 userId 为 null,允许通过 298 // 例如说:在审批人为空时,我们会有“自动审批通过”的策略,此时 userId 为 null,允许通过
@@ -515,22 +558,92 @@ public class BpmTaskServiceImpl implements BpmTaskService { @@ -515,22 +558,92 @@ public class BpmTaskServiceImpl implements BpmTaskService {
515 // 2.2 添加评论 558 // 2.2 添加评论
516 taskService.addComment(task.getId(), task.getProcessInstanceId(), BpmCommentTypeEnum.APPROVE.getType(), 559 taskService.addComment(task.getId(), task.getProcessInstanceId(), BpmCommentTypeEnum.APPROVE.getType(),
517 BpmCommentTypeEnum.APPROVE.formatComment(reqVO.getReason())); 560 BpmCommentTypeEnum.APPROVE.formatComment(reqVO.getReason()));
518 - // 2.3 调用 BPM complete 去完成任务  
519 - // 其中,variables 是存储动态表单到 local 任务级别。过滤一下,避免 ProcessInstance 系统级的变量被占用  
520 - if (CollUtil.isNotEmpty(reqVO.getVariables())) {  
521 - Map<String, Object> variables = FlowableUtils.filterTaskFormVariable(reqVO.getVariables());  
522 - // 修改表单的值需要存储到 ProcessInstance 变量  
523 - runtimeService.setVariables(task.getProcessInstanceId(), variables);  
524 - taskService.complete(task.getId(), variables, true);  
525 - } else {  
526 - taskService.complete(task.getId()); 561 +
  562 + // 3. 设置流程变量。如果流程变量前端传空,需要从历史实例中获取,原因:前端表单如果在当前节点无可编辑的字段时 variables 一定会为空
  563 + // 场景一:A 节点发起,B 节点表单无可编辑字段,审批通过时,C 节点需要流程变量获取下一个执行节点,但因为 B 节点无可编辑的字段,variables 为空,流程可能出现问题。
  564 + // 场景二:A 节点发起,B 节点只有某一个字段可编辑(比如 day),但 C 节点需要多个节点。
  565 + // (比如 work + day 变量,在发起时填写,因为 B 节点只有 day 的编辑权限,在审批后,variables 会缺少 work 的值)
  566 + Map<String, Object> processVariables = new HashMap<>();
  567 + if (CollUtil.isNotEmpty(instance.getProcessVariables())) { // 获取历史中流程变量
  568 + processVariables.putAll(instance.getProcessVariables());
  569 + }
  570 + if (CollUtil.isNotEmpty(reqVO.getVariables())) { // 合并前端传递的流程变量,以前端为准
  571 + processVariables.putAll(reqVO.getVariables());
527 } 572 }
528 573
  574 + // 4. 校验并处理 APPROVE_USER_SELECT 当前审批人,选择下一节点审批人的逻辑
  575 + Map<String, Object> variables = validateAndSetNextAssignees(task.getTaskDefinitionKey(), processVariables,
  576 + bpmnModel, reqVO.getNextAssignees(), instance);
  577 + runtimeService.setVariables(task.getProcessInstanceId(), variables);
  578 +
  579 + // 5. 调用 BPM complete 去完成任务
  580 + taskService.complete(task.getId(), variables, true);
  581 +
529 // 【加签专属】处理加签任务 582 // 【加签专属】处理加签任务
530 handleParentTaskIfSign(task.getParentTaskId()); 583 handleParentTaskIfSign(task.getParentTaskId());
531 } 584 }
532 585
533 /** 586 /**
  587 + * 校验选择的下一个节点的审批人,是否合法
  588 + *
  589 + * 1. 是否有漏选:没有选择审批人
  590 + * 2. 是否有多选:非下一个节点
  591 + *
  592 + * @param taskDefinitionKey 当前任务节点标识
  593 + * @param variables 流程变量
  594 + * @param bpmnModel 流程模型
  595 + * @param nextAssignees 下一个节点审批人集合(参数)
  596 + * @param processInstance 流程实例
  597 + */
  598 + private Map<String, Object> validateAndSetNextAssignees(String taskDefinitionKey, Map<String, Object> variables, BpmnModel bpmnModel,
  599 + Map<String, List<Long>> nextAssignees, ProcessInstance processInstance) {
  600 + // 1. 获取下一个将要执行的节点集合
  601 + FlowElement flowElement = bpmnModel.getFlowElement(taskDefinitionKey);
  602 + List<FlowNode> nextFlowNodes = getNextFlowNodes(flowElement, bpmnModel, variables);
  603 +
  604 + // 2. 校验选择的下一个节点的审批人,是否合法
  605 + Map<String, List<Long>> processVariables;
  606 + for (FlowNode nextFlowNode : nextFlowNodes) {
  607 + Integer candidateStrategy = parseCandidateStrategy(nextFlowNode);
  608 + // 2.1 情况一:如果节点中的审批人策略为 发起人自选
  609 + if (ObjUtil.equals(candidateStrategy, BpmTaskCandidateStrategyEnum.START_USER_SELECT.getStrategy())) {
  610 + // 如果节点存在,但未配置审批人
  611 + List<Long> assignees = nextAssignees != null ? nextAssignees.get(nextFlowNode.getId()) : null;
  612 + if (CollUtil.isEmpty(assignees)) {
  613 + throw exception(PROCESS_INSTANCE_START_USER_SELECT_ASSIGNEES_NOT_CONFIG, nextFlowNode.getName());
  614 + }
  615 + processVariables = FlowableUtils.getStartUserSelectAssignees(processInstance.getProcessVariables());
  616 + // 特殊:如果当前节点已经存在审批人,则不允许覆盖
  617 + if (processVariables != null && CollUtil.isNotEmpty(processVariables.get(nextFlowNode.getId()))) {
  618 + continue;
  619 + }
  620 + // 设置 PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES
  621 + if (processVariables == null) {
  622 + processVariables = new HashMap<>();
  623 + }
  624 + processVariables.put(nextFlowNode.getId(), assignees);
  625 + variables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES, processVariables);
  626 + }
  627 + // 2.2 情况二:如果节点中的审批人策略为 审批人,在审批时选择下一个节点的审批人,并且该节点的审批人为空
  628 + if (ObjUtil.equals(candidateStrategy, BpmTaskCandidateStrategyEnum.APPROVE_USER_SELECT.getStrategy())) {
  629 + // 如果节点存在,但未配置审批人
  630 + List<Long> assignees = nextAssignees != null ? nextAssignees.get(nextFlowNode.getId()) : null;
  631 + if (CollUtil.isEmpty(assignees)) {
  632 + throw exception(PROCESS_INSTANCE_APPROVE_USER_SELECT_ASSIGNEES_NOT_CONFIG, nextFlowNode.getName());
  633 + }
  634 + processVariables = FlowableUtils.getApproveUserSelectAssignees(processInstance.getProcessVariables());
  635 + if (processVariables == null) {
  636 + processVariables = new HashMap<>();
  637 + }
  638 + // 设置 PROCESS_INSTANCE_VARIABLE_APPROVE_USER_SELECT_ASSIGNEES
  639 + processVariables.put(nextFlowNode.getId(), assignees);
  640 + variables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_APPROVE_USER_SELECT_ASSIGNEES, processVariables);
  641 + }
  642 + }
  643 + return variables;
  644 + }
  645 +
  646 + /**
534 * 审批通过存在“后加签”的任务。 647 * 审批通过存在“后加签”的任务。
535 * <p> 648 * <p>
536 * 注意:该任务不能马上完成,需要一个中间状态(APPROVING),并激活剩余所有子任务(PROCESS)为可审批处理 649 * 注意:该任务不能马上完成,需要一个中间状态(APPROVING),并激活剩余所有子任务(PROCESS)为可审批处理
@@ -858,7 +971,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { @@ -858,7 +971,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
858 BpmnModel bpmnModel = modelService.getBpmnModelByDefinitionId(taskList.get(0).getProcessDefinitionId()); 971 BpmnModel bpmnModel = modelService.getBpmnModelByDefinitionId(taskList.get(0).getProcessDefinitionId());
859 List<String> activityIds = CollUtil.newArrayList(convertSet(taskList, Task::getTaskDefinitionKey)); 972 List<String> activityIds = CollUtil.newArrayList(convertSet(taskList, Task::getTaskDefinitionKey));
860 EndEvent endEvent = BpmnModelUtils.getEndEvent(bpmnModel); 973 EndEvent endEvent = BpmnModelUtils.getEndEvent(bpmnModel);
861 - Assert.notNull(endEvent, "结束节点不能未空"); 974 + Assert.notNull(endEvent, "结束节点不能为空");
862 runtimeService.createChangeActivityStateBuilder() 975 runtimeService.createChangeActivityStateBuilder()
863 .processInstanceId(processInstanceId) 976 .processInstanceId(processInstanceId)
864 .moveActivityIdsToSingleActivityId(activityIds, endEvent.getId()) 977 .moveActivityIdsToSingleActivityId(activityIds, endEvent.getId())
@@ -991,6 +1104,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { @@ -991,6 +1104,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
991 1104
992 @Override 1105 @Override
993 @Transactional(rollbackFor = Exception.class) 1106 @Transactional(rollbackFor = Exception.class)
  1107 + @SuppressWarnings("DataFlowIssue")
994 public void deleteSignTask(Long userId, BpmTaskSignDeleteReqVO reqVO) { 1108 public void deleteSignTask(Long userId, BpmTaskSignDeleteReqVO reqVO) {
995 // 1.1 校验 task 可以被减签 1109 // 1.1 校验 task 可以被减签
996 Task task = validateTaskCanSignDelete(reqVO.getId()); 1110 Task task = validateTaskCanSignDelete(reqVO.getId());
@@ -1142,6 +1256,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { @@ -1142,6 +1256,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
1142 } 1256 }
1143 1257
1144 @Override 1258 @Override
  1259 + @DataPermission(enable = false) // 忽略数据权限,避免因为过滤,导致找不到候选人
1145 public void processTaskAssigned(Task task) { 1260 public void processTaskAssigned(Task task) {
1146 // 发送通知。在事务提交时,批量执行操作,所以直接查询会无法查询到 ProcessInstance,所以这里是通过监听事务的提交来实现。 1261 // 发送通知。在事务提交时,批量执行操作,所以直接查询会无法查询到 ProcessInstance,所以这里是通过监听事务的提交来实现。
1147 TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() { 1262 TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@@ -1207,19 +1322,31 @@ public class BpmTaskServiceImpl implements BpmTaskService { @@ -1207,19 +1322,31 @@ public class BpmTaskServiceImpl implements BpmTaskService {
1207 } 1322 }
1208 } 1323 }
1209 1324
1210 - // 审批人与提交人为同一人时,根据 BpmUserTaskAssignStartUserHandlerTypeEnum 策略进行处理  
1211 - if (StrUtil.equals(task.getAssignee(), processInstance.getStartUserId())) {  
1212 - // 判断是否为退回或者驳回:如果是退回或者驳回不走这个策略  
1213 - // TODO 芋艿:【优化】未来有没更好的判断方式?!另外,还要考虑清理机制。就是说,下次处理了之后,就移除这个标识  
1214 - Boolean returnTaskFlag = runtimeService.getVariable(processInstance.getProcessInstanceId(),  
1215 - String.format(PROCESS_INSTANCE_VARIABLE_RETURN_FLAG, task.getTaskDefinitionKey()), Boolean.class); 1325 + // 获取发起人节点
  1326 + BpmnModel bpmnModel = modelService.getBpmnModelByDefinitionId(processInstance.getProcessDefinitionId());
  1327 + if (bpmnModel == null) {
  1328 + log.error("[processTaskAssigned][taskId({}) 没有找到流程模型]", task.getId());
  1329 + return;
  1330 + }
  1331 + FlowElement userTaskElement = BpmnModelUtils.getFlowElementById(bpmnModel, task.getTaskDefinitionKey());
  1332 + // 判断是否为退回或者驳回:如果是退回或者驳回不走这个策略
  1333 + // TODO 芋艿:【优化】未来有没更好的判断方式?!另外,还要考虑清理机制。就是说,下次处理了之后,就移除这个标识
  1334 + Boolean returnTaskFlag = runtimeService.getVariable(processInstance.getProcessInstanceId(),
  1335 + String.format(PROCESS_INSTANCE_VARIABLE_RETURN_FLAG, task.getTaskDefinitionKey()), Boolean.class);
  1336 + Boolean skipStartUserNodeFlag = Convert.toBool(runtimeService.getVariable(processInstance.getProcessInstanceId(),
  1337 + PROCESS_INSTANCE_VARIABLE_SKIP_START_USER_NODE, String.class));
  1338 + if (userTaskElement.getId().equals(START_USER_NODE_ID)
  1339 + && (skipStartUserNodeFlag == null // 目的:一般是“主流程”,发起人节点,自动通过审核
  1340 + || Boolean.TRUE.equals(skipStartUserNodeFlag)) // 目的:一般是“子流程”,发起人节点,按配置自动通过审核
  1341 + && ObjUtil.notEqual(returnTaskFlag, Boolean.TRUE)) {
  1342 + getSelf().approveTask(Long.valueOf(task.getAssignee()), new BpmTaskApproveReqVO().setId(task.getId())
  1343 + .setReason(BpmReasonEnum.ASSIGN_START_USER_APPROVE_WHEN_SKIP_START_USER_NODE.getReason()));
  1344 + return;
  1345 + }
  1346 + // 当不为发起人节点时,审批人与提交人为同一人时,根据 BpmUserTaskAssignStartUserHandlerTypeEnum 策略进行处理
  1347 + if (ObjectUtil.notEqual(userTaskElement.getId(), START_USER_NODE_ID)
  1348 + && StrUtil.equals(task.getAssignee(), processInstance.getStartUserId())) {
1216 if (ObjUtil.notEqual(returnTaskFlag, Boolean.TRUE)) { 1349 if (ObjUtil.notEqual(returnTaskFlag, Boolean.TRUE)) {
1217 - BpmnModel bpmnModel = modelService.getBpmnModelByDefinitionId(processInstance.getProcessDefinitionId());  
1218 - if (bpmnModel == null) {  
1219 - log.error("[processTaskAssigned][taskId({}) 没有找到流程模型]", task.getId());  
1220 - return;  
1221 - }  
1222 - FlowElement userTaskElement = BpmnModelUtils.getFlowElementById(bpmnModel, task.getTaskDefinitionKey());  
1223 Integer assignStartUserHandlerType = BpmnModelUtils.parseAssignStartUserHandlerType(userTaskElement); 1350 Integer assignStartUserHandlerType = BpmnModelUtils.parseAssignStartUserHandlerType(userTaskElement);
1224 1351
1225 // 情况一:自动跳过 1352 // 情况一:自动跳过
@@ -1304,14 +1431,23 @@ public class BpmTaskServiceImpl implements BpmTaskService { @@ -1304,14 +1431,23 @@ public class BpmTaskServiceImpl implements BpmTaskService {
1304 } 1431 }
1305 1432
1306 @Override 1433 @Override
1307 - public void processDelayTimerTimeout(String processInstanceId, String taskDefineKey) { 1434 + @Transactional(rollbackFor = Exception.class)
  1435 + public void processChildProcessTimeout(String processInstanceId, String taskDefineKey) {
  1436 + List<ActivityInstance> activityInstances = runtimeService.createActivityInstanceQuery()
  1437 + .processInstanceId(processInstanceId)
  1438 + .activityId(taskDefineKey).list();
  1439 + activityInstances.forEach(activityInstance -> FlowableUtils.execute(activityInstance.getTenantId(),
  1440 + () -> moveTaskToEnd(activityInstance.getCalledProcessInstanceId(), BpmReasonEnum.TIMEOUT_APPROVE.getReason())));
  1441 + }
  1442 +
  1443 + @Override
  1444 + public void triggerTask(String processInstanceId, String taskDefineKey) {
1308 Execution execution = runtimeService.createExecutionQuery() 1445 Execution execution = runtimeService.createExecutionQuery()
1309 .processInstanceId(processInstanceId) 1446 .processInstanceId(processInstanceId)
1310 .activityId(taskDefineKey) 1447 .activityId(taskDefineKey)
1311 .singleResult(); 1448 .singleResult();
1312 if (execution == null) { 1449 if (execution == null) {
1313 - log.error("[processDelayTimerTimeout][processInstanceId({}) activityId({}) 没有找到执行活动]",  
1314 - processInstanceId, taskDefineKey); 1450 + log.error("[triggerTask][processInstanceId({}) activityId({}) 没有找到执行活动]", processInstanceId, taskDefineKey);
1315 return; 1451 return;
1316 } 1452 }
1317 1453
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/listener/BpmCallActivityListener.java 0 → 100644
  1 +package cn.iocoder.yudao.module.bpm.service.task.listener;
  2 +
  3 +import cn.hutool.core.lang.Assert;
  4 +import cn.hutool.core.map.MapUtil;
  5 +import cn.hutool.core.util.StrUtil;
  6 +import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
  7 +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO;
  8 +import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionInfoDO;
  9 +import cn.iocoder.yudao.module.bpm.enums.definition.BpmChildProcessStartUserEmptyTypeEnum;
  10 +import cn.iocoder.yudao.module.bpm.enums.definition.BpmChildProcessStartUserTypeEnum;
  11 +import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils;
  12 +import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessDefinitionService;
  13 +import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
  14 +import jakarta.annotation.Resource;
  15 +import lombok.Setter;
  16 +import lombok.extern.slf4j.Slf4j;
  17 +import org.flowable.engine.delegate.DelegateExecution;
  18 +import org.flowable.engine.delegate.ExecutionListener;
  19 +import org.flowable.engine.impl.el.FixedValue;
  20 +import org.flowable.engine.runtime.ProcessInstance;
  21 +import org.springframework.stereotype.Component;
  22 +
  23 +import java.util.List;
  24 +
  25 +/**
  26 + * BPM 子流程监听器:设置流程的发起人
  27 + *
  28 + * @author Lesan
  29 + */
  30 +@Component
  31 +@Slf4j
  32 +public class BpmCallActivityListener implements ExecutionListener {
  33 +
  34 + public static final String DELEGATE_EXPRESSION = "${bpmCallActivityListener}";
  35 +
  36 + @Setter
  37 + private FixedValue listenerConfig;
  38 +
  39 + @Resource
  40 + private BpmProcessDefinitionService processDefinitionService;
  41 +
  42 + @Resource
  43 + private BpmProcessInstanceService processInstanceService;
  44 +
  45 + @Override
  46 + public void notify(DelegateExecution execution) {
  47 + String expressionText = listenerConfig.getExpressionText();
  48 + Assert.notNull(expressionText, "监听器扩展字段({})不能为空", expressionText);
  49 + BpmSimpleModelNodeVO.ChildProcessSetting.StartUserSetting startUserSetting = JsonUtils.parseObject(
  50 + expressionText, BpmSimpleModelNodeVO.ChildProcessSetting.StartUserSetting.class);
  51 + ProcessInstance processInstance = processInstanceService.getProcessInstance(execution.getRootProcessInstanceId());
  52 +
  53 + // 1. 当发起人来源为主流程发起人时,并兜底 startUserSetting 为空时
  54 + if (startUserSetting == null
  55 + || startUserSetting.getType().equals(BpmChildProcessStartUserTypeEnum.MAIN_PROCESS_START_USER.getType())) {
  56 + FlowableUtils.setAuthenticatedUserId(Long.parseLong(processInstance.getStartUserId()));
  57 + return;
  58 + }
  59 +
  60 + // 2. 当发起人来源为表单时
  61 + if (startUserSetting.getType().equals(BpmChildProcessStartUserTypeEnum.FROM_FORM.getType())) {
  62 + String formFieldValue = MapUtil.getStr(processInstance.getProcessVariables(), startUserSetting.getFormField());
  63 + // 2.1 当表单值为空时
  64 + if (StrUtil.isEmpty(formFieldValue)) {
  65 + // 2.1.1 来自主流程发起人
  66 + if (startUserSetting.getEmptyType().equals(BpmChildProcessStartUserEmptyTypeEnum.MAIN_PROCESS_START_USER.getType())) {
  67 + FlowableUtils.setAuthenticatedUserId(Long.parseLong(processInstance.getStartUserId()));
  68 + return;
  69 + }
  70 + // 2.1.2 来自子流程管理员
  71 + if (startUserSetting.getEmptyType().equals(BpmChildProcessStartUserEmptyTypeEnum.CHILD_PROCESS_ADMIN.getType())) {
  72 + BpmProcessDefinitionInfoDO processDefinition = processDefinitionService.getProcessDefinitionInfo(execution.getProcessDefinitionId());
  73 + List<Long> managerUserIds = processDefinition.getManagerUserIds();
  74 + FlowableUtils.setAuthenticatedUserId(managerUserIds.get(0));
  75 + return;
  76 + }
  77 + // 2.1.3 来自主流程管理员
  78 + if (startUserSetting.getEmptyType().equals(BpmChildProcessStartUserEmptyTypeEnum.MAIN_PROCESS_ADMIN.getType())) {
  79 + BpmProcessDefinitionInfoDO processDefinition = processDefinitionService.getProcessDefinitionInfo(processInstance.getProcessDefinitionId());
  80 + List<Long> managerUserIds = processDefinition.getManagerUserIds();
  81 + FlowableUtils.setAuthenticatedUserId(managerUserIds.get(0));
  82 + return;
  83 + }
  84 + }
  85 + // 2.2 使用表单值,并兜底字符串转 Long 失败时使用主流程发起人
  86 + try {
  87 + FlowableUtils.setAuthenticatedUserId(Long.parseLong(formFieldValue));
  88 + } catch (Exception e) {
  89 + log.error("[notify][监听器:{},子流程监听器设置流程的发起人字符串转 Long 失败,字符串:{}]",
  90 + DELEGATE_EXPRESSION, formFieldValue);
  91 + FlowableUtils.setAuthenticatedUserId(Long.parseLong(processInstance.getStartUserId()));
  92 + }
  93 + }
  94 + }
  95 +
  96 +}
0 \ No newline at end of file 97 \ No newline at end of file
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/listener/BpmUserTaskListener.java
1 package cn.iocoder.yudao.module.bpm.service.task.listener; 1 package cn.iocoder.yudao.module.bpm.service.task.listener;
2 2
3 -import cn.hutool.core.util.StrUtil;  
4 import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO; 3 import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO;
5 -import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.SimpleModelUtils; 4 +import cn.iocoder.yudao.module.bpm.enums.definition.BpmHttpRequestParamTypeEnum;
  5 +import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmHttpRequestUtils;
6 import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService; 6 import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
7 import jakarta.annotation.Resource; 7 import jakarta.annotation.Resource;
8 import lombok.Setter; 8 import lombok.Setter;
9 import lombok.extern.slf4j.Slf4j; 9 import lombok.extern.slf4j.Slf4j;
10 import org.flowable.engine.delegate.TaskListener; 10 import org.flowable.engine.delegate.TaskListener;
11 -import org.flowable.engine.history.HistoricProcessInstance;  
12 import org.flowable.engine.impl.el.FixedValue; 11 import org.flowable.engine.impl.el.FixedValue;
  12 +import org.flowable.engine.runtime.ProcessInstance;
13 import org.flowable.task.service.delegate.DelegateTask; 13 import org.flowable.task.service.delegate.DelegateTask;
14 import org.springframework.context.annotation.Scope; 14 import org.springframework.context.annotation.Scope;
15 -import org.springframework.http.HttpEntity;  
16 -import org.springframework.http.HttpMethod;  
17 -import org.springframework.http.ResponseEntity;  
18 import org.springframework.stereotype.Component; 15 import org.springframework.stereotype.Component;
19 -import org.springframework.util.LinkedMultiValueMap;  
20 -import org.springframework.util.MultiValueMap;  
21 -import org.springframework.web.client.RestClientException;  
22 import org.springframework.web.client.RestTemplate; 16 import org.springframework.web.client.RestTemplate;
23 17
24 -import java.util.Map;  
25 -  
26 -import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.HEADER_TENANT_ID;  
27 import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.parseListenerConfig; 18 import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.parseListenerConfig;
28 19
29 // TODO @芋艿:可能会想换个包地址 20 // TODO @芋艿:可能会想换个包地址
@@ -42,55 +33,31 @@ public class BpmUserTaskListener implements TaskListener { @@ -42,55 +33,31 @@ public class BpmUserTaskListener implements TaskListener {
42 @Resource 33 @Resource
43 private BpmProcessInstanceService processInstanceService; 34 private BpmProcessInstanceService processInstanceService;
44 35
45 - @Resource  
46 - private RestTemplate restTemplate;  
47 -  
48 @Setter 36 @Setter
49 private FixedValue listenerConfig; 37 private FixedValue listenerConfig;
50 38
51 @Override 39 @Override
52 public void notify(DelegateTask delegateTask) { 40 public void notify(DelegateTask delegateTask) {
53 // 1. 获取所需基础信息 41 // 1. 获取所需基础信息
54 - HistoricProcessInstance processInstance = processInstanceService.getHistoricProcessInstance(delegateTask.getProcessInstanceId()); 42 + ProcessInstance processInstance = processInstanceService.getProcessInstance(delegateTask.getProcessInstanceId());
55 BpmSimpleModelNodeVO.ListenerHandler listenerHandler = parseListenerConfig(listenerConfig); 43 BpmSimpleModelNodeVO.ListenerHandler listenerHandler = parseListenerConfig(listenerConfig);
56 44
57 - // 2. 获取请求头和请求体  
58 - Map<String, Object> processVariables = processInstance.getProcessVariables();  
59 - MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();  
60 - MultiValueMap<String, String> body = new LinkedMultiValueMap<>();  
61 - SimpleModelUtils.addHttpRequestParam(headers, listenerHandler.getHeader(), processVariables);  
62 - SimpleModelUtils.addHttpRequestParam(body, listenerHandler.getBody(), processVariables);  
63 - // 2.1 请求头默认参数  
64 - if (StrUtil.isNotEmpty(delegateTask.getTenantId())) {  
65 - headers.add(HEADER_TENANT_ID, delegateTask.getTenantId());  
66 - }  
67 - // 2.2 请求体默认参数 45 + // 2. 发起请求
68 // TODO @芋艿:哪些默认参数,后续再调研下;感觉可以搞个 task 字段,把整个 delegateTask 放进去; 46 // TODO @芋艿:哪些默认参数,后续再调研下;感觉可以搞个 task 字段,把整个 delegateTask 放进去;
69 - body.add("processInstanceId", delegateTask.getProcessInstanceId());  
70 - body.add("assignee", delegateTask.getAssignee());  
71 - body.add("taskDefinitionKey", delegateTask.getTaskDefinitionKey());  
72 - body.add("taskId", delegateTask.getId());  
73 -  
74 - // 3. 异步发起请求  
75 - // TODO @芋艿:确认要同步,还是异步  
76 - HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(body, headers);  
77 - try {  
78 - ResponseEntity<String> responseEntity = restTemplate.exchange(listenerHandler.getPath(), HttpMethod.POST,  
79 - requestEntity, String.class);  
80 - log.info("[notify][监听器:{},事件类型:{},请求头:{},请求体:{},响应结果:{}]",  
81 - DELEGATE_EXPRESSION,  
82 - delegateTask.getEventName(),  
83 - headers,  
84 - body,  
85 - responseEntity);  
86 - } catch (RestClientException e) {  
87 - log.error("[error][监听器:{},事件类型:{},请求头:{},请求体:{},请求出错:{}]",  
88 - DELEGATE_EXPRESSION,  
89 - delegateTask.getEventName(),  
90 - headers,  
91 - body,  
92 - e.getMessage());  
93 - }  
94 - // 4. 是否需要后续操作?TODO 芋艿:待定! 47 + listenerHandler.getBody().add(new BpmSimpleModelNodeVO.HttpRequestParam().setKey("processInstanceId")
  48 + .setType(BpmHttpRequestParamTypeEnum.FIXED_VALUE.getType()).setValue(delegateTask.getProcessInstanceId()));
  49 + listenerHandler.getBody().add(new BpmSimpleModelNodeVO.HttpRequestParam().setKey("assignee")
  50 + .setType(BpmHttpRequestParamTypeEnum.FIXED_VALUE.getType()).setValue(delegateTask.getAssignee()));
  51 + listenerHandler.getBody().add(new BpmSimpleModelNodeVO.HttpRequestParam().setKey("taskDefinitionKey")
  52 + .setType(BpmHttpRequestParamTypeEnum.FIXED_VALUE.getType()).setValue(delegateTask.getTaskDefinitionKey()));
  53 + listenerHandler.getBody().add(new BpmSimpleModelNodeVO.HttpRequestParam().setKey("taskId")
  54 + .setType(BpmHttpRequestParamTypeEnum.FIXED_VALUE.getType()).setValue(delegateTask.getId()));
  55 + BpmHttpRequestUtils.executeBpmHttpRequest(processInstance,
  56 + listenerHandler.getPath(),
  57 + listenerHandler.getHeader(),
  58 + listenerHandler.getBody(),
  59 + false, null);
  60 +
  61 + // 3. 是否需要后续操作?TODO 芋艿:待定!
95 } 62 }
96 } 63 }
97 \ No newline at end of file 64 \ No newline at end of file
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/trigger/BpmHttpRequestTrigger.java deleted
1 -package cn.iocoder.yudao.module.bpm.service.task.trigger;  
2 -  
3 -import cn.hutool.core.collection.CollUtil;  
4 -import cn.hutool.core.util.StrUtil;  
5 -import cn.iocoder.yudao.framework.common.core.KeyValue;  
6 -import cn.iocoder.yudao.framework.common.pojo.CommonResult;  
7 -import cn.iocoder.yudao.framework.common.util.json.JsonUtils;  
8 -import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO.TriggerSetting.HttpRequestTriggerSetting;  
9 -import cn.iocoder.yudao.module.bpm.enums.definition.BpmTriggerTypeEnum;  
10 -import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.SimpleModelUtils;  
11 -import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;  
12 -import com.fasterxml.jackson.core.type.TypeReference;  
13 -import jakarta.annotation.Resource;  
14 -import lombok.extern.slf4j.Slf4j;  
15 -import org.flowable.engine.runtime.ProcessInstance;  
16 -import org.springframework.http.HttpEntity;  
17 -import org.springframework.http.HttpMethod;  
18 -import org.springframework.http.ResponseEntity;  
19 -import org.springframework.stereotype.Component;  
20 -import org.springframework.util.LinkedMultiValueMap;  
21 -import org.springframework.util.MultiValueMap;  
22 -import org.springframework.web.client.RestClientException;  
23 -import org.springframework.web.client.RestTemplate;  
24 -  
25 -import java.util.HashMap;  
26 -import java.util.List;  
27 -import java.util.Map;  
28 -  
29 -import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.HEADER_TENANT_ID;  
30 -  
31 -/**  
32 - * BPM 发送 HTTP 请求触发器  
33 - *  
34 - * @author jason  
35 - */  
36 -@Component  
37 -@Slf4j  
38 -public class BpmHttpRequestTrigger implements BpmTrigger {  
39 -  
40 - @Resource  
41 - private BpmProcessInstanceService processInstanceService;  
42 -  
43 - @Resource  
44 - private RestTemplate restTemplate;  
45 -  
46 - @Override  
47 - public BpmTriggerTypeEnum getType() {  
48 - return BpmTriggerTypeEnum.HTTP_REQUEST;  
49 - }  
50 -  
51 - @Override  
52 - public void execute(String processInstanceId, String param) {  
53 - // 1. 解析 http 请求配置  
54 - HttpRequestTriggerSetting setting = JsonUtils.parseObject(param, HttpRequestTriggerSetting.class);  
55 - if (setting == null) {  
56 - log.error("[execute][流程({}) HTTP 触发器请求配置为空]", processInstanceId);  
57 - return;  
58 - }  
59 - // 2.1 设置请求头  
60 - ProcessInstance processInstance = processInstanceService.getProcessInstance(processInstanceId);  
61 - Map<String, Object> processVariables = processInstance.getProcessVariables();  
62 - MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();  
63 - headers.add(HEADER_TENANT_ID, processInstance.getTenantId());  
64 - SimpleModelUtils.addHttpRequestParam(headers, setting.getHeader(), processVariables);  
65 - // 2.2 设置请求体  
66 - MultiValueMap<String, String> body = new LinkedMultiValueMap<>();  
67 - SimpleModelUtils.addHttpRequestParam(body, setting.getBody(), processVariables);  
68 - body.add("processInstanceId", processInstanceId);  
69 -  
70 - // TODO @芋艿:要不要抽象一个 Http 请求的工具类,方便复用呢?  
71 - // 3. 发起请求  
72 - HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(body, headers);  
73 - ResponseEntity<String> responseEntity;  
74 - try {  
75 - responseEntity = restTemplate.exchange(setting.getUrl(), HttpMethod.POST,  
76 - requestEntity, String.class);  
77 - log.info("[execute][HTTP 触发器,请求头:{},请求体:{},响应结果:{}]", headers, body, responseEntity);  
78 - } catch (RestClientException e) {  
79 - log.error("[execute][HTTP 触发器,请求头:{},请求体:{},请求出错:{}]", headers, body, e.getMessage());  
80 - return;  
81 - }  
82 -  
83 - // 4.1 判断是否需要解析返回值  
84 - if (StrUtil.isEmpty(responseEntity.getBody())  
85 - || !responseEntity.getStatusCode().is2xxSuccessful()  
86 - || CollUtil.isEmpty(setting.getResponse())) {  
87 - return;  
88 - }  
89 - // 4.2 解析返回值, 返回值必须符合 CommonResult 规范。  
90 - CommonResult<Map<String, Object>> respResult = JsonUtils.parseObjectQuietly(  
91 - responseEntity.getBody(), new TypeReference<>() {});  
92 - if (respResult == null || !respResult.isSuccess()){  
93 - return;  
94 - }  
95 - // 4.3 获取需要更新的流程变量  
96 - Map<String, Object> updateVariables = getNeedUpdatedVariablesFromResponse(respResult.getData(), setting.getResponse());  
97 - // 4.4 更新流程变量  
98 - if (CollUtil.isNotEmpty(updateVariables)) {  
99 - processInstanceService.updateProcessInstanceVariables(processInstanceId, updateVariables);  
100 - }  
101 - }  
102 -  
103 - /**  
104 - * 从请求返回值获取需要更新的流程变量  
105 - *  
106 - * @param result 请求返回结果  
107 - * @param responseSettings 返回设置  
108 - * @return 需要更新的流程变量  
109 - */  
110 - private Map<String, Object> getNeedUpdatedVariablesFromResponse(Map<String,Object> result,  
111 - List<KeyValue<String, String>> responseSettings) {  
112 - Map<String, Object> updateVariables = new HashMap<>();  
113 - if (CollUtil.isEmpty(result)) {  
114 - return updateVariables;  
115 - }  
116 - responseSettings.forEach(responseSetting -> {  
117 - if (StrUtil.isNotEmpty(responseSetting.getKey()) && result.containsKey(responseSetting.getValue())) {  
118 - updateVariables.put(responseSetting.getKey(), result.get(responseSetting.getValue()));  
119 - }  
120 - });  
121 - return updateVariables;  
122 - }  
123 -  
124 -}  
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/trigger/form/BpmFormDeleteTrigger.java 0 → 100644
  1 +package cn.iocoder.yudao.module.bpm.service.task.trigger.form;
  2 +
  3 +import cn.hutool.core.collection.CollUtil;
  4 +import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
  5 +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO;
  6 +import cn.iocoder.yudao.module.bpm.enums.definition.BpmTriggerTypeEnum;
  7 +import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils;
  8 +import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.SimpleModelUtils;
  9 +import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
  10 +import cn.iocoder.yudao.module.bpm.service.task.trigger.BpmTrigger;
  11 +import com.fasterxml.jackson.core.type.TypeReference;
  12 +import jakarta.annotation.Resource;
  13 +import lombok.extern.slf4j.Slf4j;
  14 +import org.springframework.stereotype.Component;
  15 +
  16 +import java.util.HashSet;
  17 +import java.util.List;
  18 +import java.util.Map;
  19 +import java.util.Set;
  20 +
  21 +/**
  22 + * BPM 删除流程表单数据触发器
  23 + *
  24 + * @author jason
  25 + */
  26 +@Component
  27 +@Slf4j
  28 +public class BpmFormDeleteTrigger implements BpmTrigger {
  29 +
  30 + @Resource
  31 + private BpmProcessInstanceService processInstanceService;
  32 +
  33 + @Override
  34 + public BpmTriggerTypeEnum getType() {
  35 + return BpmTriggerTypeEnum.FORM_DELETE;
  36 + }
  37 +
  38 + @Override
  39 + public void execute(String processInstanceId, String param) {
  40 + // 1. 解析删除流程表单数据配置
  41 + List<BpmSimpleModelNodeVO.TriggerSetting.FormTriggerSetting> settings = JsonUtils.parseObject(param, new TypeReference<>() {});
  42 + if (CollUtil.isEmpty(settings)) {
  43 + log.error("[execute][流程({}) 删除流程表单数据触发器配置为空]", processInstanceId);
  44 + return;
  45 + }
  46 +
  47 + // 2. 获取流程变量
  48 + Map<String, Object> processVariables = processInstanceService.getProcessInstance(processInstanceId).getProcessVariables();
  49 +
  50 + // 3.1 获取需要删除的表单字段
  51 + Set<String> deleteFields = new HashSet<>();
  52 + settings.forEach(setting -> {
  53 + if (CollUtil.isEmpty(setting.getDeleteFields())) {
  54 + return;
  55 + }
  56 + // 配置了条件,判断条件是否满足
  57 + boolean isFieldDeletedNeeded = true;
  58 + if (setting.getConditionType() != null) {
  59 + String conditionExpression = SimpleModelUtils.buildConditionExpression(
  60 + setting.getConditionType(), setting.getConditionExpression(), setting.getConditionGroups());
  61 + isFieldDeletedNeeded = BpmnModelUtils.evalConditionExpress(processVariables, conditionExpression);
  62 + }
  63 + if (isFieldDeletedNeeded) {
  64 + deleteFields.addAll(setting.getDeleteFields());
  65 + }
  66 + });
  67 +
  68 + // 3.2 删除流程变量
  69 + if (CollUtil.isNotEmpty(deleteFields)) {
  70 + processInstanceService.removeProcessInstanceVariables(processInstanceId, deleteFields);
  71 + }
  72 + }
  73 +}
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/trigger/BpmUpdateNormalFormTrigger.java renamed to yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/trigger/form/BpmFormUpdateTrigger.java
1 -package cn.iocoder.yudao.module.bpm.service.task.trigger; 1 +package cn.iocoder.yudao.module.bpm.service.task.trigger.form;
2 2
3 import cn.hutool.core.collection.CollUtil; 3 import cn.hutool.core.collection.CollUtil;
4 import cn.iocoder.yudao.framework.common.util.json.JsonUtils; 4 import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
5 -import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO.TriggerSetting.NormalFormTriggerSetting; 5 +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO.TriggerSetting.FormTriggerSetting;
6 import cn.iocoder.yudao.module.bpm.enums.definition.BpmTriggerTypeEnum; 6 import cn.iocoder.yudao.module.bpm.enums.definition.BpmTriggerTypeEnum;
  7 +import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils;
  8 +import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.SimpleModelUtils;
7 import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService; 9 import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
  10 +import cn.iocoder.yudao.module.bpm.service.task.trigger.BpmTrigger;
  11 +import com.fasterxml.jackson.core.type.TypeReference;
8 import jakarta.annotation.Resource; 12 import jakarta.annotation.Resource;
9 import lombok.extern.slf4j.Slf4j; 13 import lombok.extern.slf4j.Slf4j;
10 import org.springframework.stereotype.Component; 14 import org.springframework.stereotype.Component;
11 15
12 -// TODO @jason:改成 BpmFormUpdateTrigger 16 +import java.util.List;
  17 +import java.util.Map;
  18 +
13 /** 19 /**
14 * BPM 更新流程表单触发器 20 * BPM 更新流程表单触发器
15 * 21 *
@@ -17,28 +23,44 @@ import org.springframework.stereotype.Component; @@ -17,28 +23,44 @@ import org.springframework.stereotype.Component;
17 */ 23 */
18 @Component 24 @Component
19 @Slf4j 25 @Slf4j
20 -public class BpmUpdateNormalFormTrigger implements BpmTrigger { 26 +public class BpmFormUpdateTrigger implements BpmTrigger {
21 27
22 @Resource 28 @Resource
23 private BpmProcessInstanceService processInstanceService; 29 private BpmProcessInstanceService processInstanceService;
24 30
25 @Override 31 @Override
26 public BpmTriggerTypeEnum getType() { 32 public BpmTriggerTypeEnum getType() {
27 - return BpmTriggerTypeEnum.UPDATE_NORMAL_FORM; 33 + return BpmTriggerTypeEnum.FORM_UPDATE;
28 } 34 }
29 35
30 @Override 36 @Override
31 public void execute(String processInstanceId, String param) { 37 public void execute(String processInstanceId, String param) {
32 // 1. 解析更新流程表单配置 38 // 1. 解析更新流程表单配置
33 - NormalFormTriggerSetting setting = JsonUtils.parseObject(param, NormalFormTriggerSetting.class);  
34 - if (setting == null) { 39 + List<FormTriggerSetting> settings = JsonUtils.parseObject(param, new TypeReference<>() {});
  40 + if (CollUtil.isEmpty(settings)) {
35 log.error("[execute][流程({}) 更新流程表单触发器配置为空]", processInstanceId); 41 log.error("[execute][流程({}) 更新流程表单触发器配置为空]", processInstanceId);
36 return; 42 return;
37 } 43 }
38 - // 2.更新流程变量  
39 - if (CollUtil.isNotEmpty(setting.getUpdateFormFields())) {  
40 - processInstanceService.updateProcessInstanceVariables(processInstanceId, setting.getUpdateFormFields()); 44 +
  45 + // 2. 获取流程变量
  46 + Map<String, Object> processVariables = processInstanceService.getProcessInstance(processInstanceId).getProcessVariables();
  47 +
  48 + // 3. 更新流程变量
  49 + for (FormTriggerSetting setting : settings) {
  50 + if (CollUtil.isEmpty(setting.getUpdateFormFields())) {
  51 + continue;
  52 + }
  53 + // 配置了条件,判断条件是否满足
  54 + boolean isFormUpdateNeeded = true;
  55 + if (setting.getConditionType() != null) {
  56 + String conditionExpression = SimpleModelUtils.buildConditionExpression(
  57 + setting.getConditionType(), setting.getConditionExpression(), setting.getConditionGroups());
  58 + isFormUpdateNeeded = BpmnModelUtils.evalConditionExpress(processVariables, conditionExpression);
  59 + }
  60 + // 更新流程表单
  61 + if (isFormUpdateNeeded) {
  62 + processInstanceService.updateProcessInstanceVariables(processInstanceId, setting.getUpdateFormFields());
  63 + }
41 } 64 }
42 } 65 }
43 -  
44 } 66 }
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/trigger/http/BpmAbstractHttpRequestTrigger.java 0 → 100644
  1 +package cn.iocoder.yudao.module.bpm.service.task.trigger.http;
  2 +
  3 +import cn.iocoder.yudao.module.bpm.service.task.trigger.BpmTrigger;
  4 +import lombok.extern.slf4j.Slf4j;
  5 +
  6 +/**
  7 + * BPM 发送 HTTP 请求触发器抽象类
  8 + *
  9 + * @author jason
  10 + */
  11 +@Slf4j
  12 +public abstract class BpmAbstractHttpRequestTrigger implements BpmTrigger {
  13 +
  14 +}
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/trigger/http/BpmHttpCallbackTrigger.java 0 → 100644
  1 +package cn.iocoder.yudao.module.bpm.service.task.trigger.http;
  2 +
  3 +import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
  4 +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO;
  5 +import cn.iocoder.yudao.module.bpm.enums.definition.BpmHttpRequestParamTypeEnum;
  6 +import cn.iocoder.yudao.module.bpm.enums.definition.BpmTriggerTypeEnum;
  7 +import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmHttpRequestUtils;
  8 +import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
  9 +import jakarta.annotation.Resource;
  10 +import lombok.extern.slf4j.Slf4j;
  11 +import org.flowable.engine.runtime.ProcessInstance;
  12 +import org.springframework.stereotype.Component;
  13 +import org.springframework.web.client.RestTemplate;
  14 +
  15 +/**
  16 + * BPM HTTP 回调触发器
  17 + *
  18 + * @author jason
  19 + */
  20 +@Component
  21 +@Slf4j
  22 +public class BpmHttpCallbackTrigger extends BpmAbstractHttpRequestTrigger {
  23 +
  24 + @Resource
  25 + private BpmProcessInstanceService processInstanceService;
  26 +
  27 + @Override
  28 + public BpmTriggerTypeEnum getType() {
  29 + return BpmTriggerTypeEnum.HTTP_CALLBACK;
  30 + }
  31 +
  32 + @Override
  33 + public void execute(String processInstanceId, String param) {
  34 + // 1. 解析 http 请求配置
  35 + BpmSimpleModelNodeVO.TriggerSetting.HttpRequestTriggerSetting setting = JsonUtils.parseObject(param,
  36 + BpmSimpleModelNodeVO.TriggerSetting.HttpRequestTriggerSetting.class);
  37 + if (setting == null) {
  38 + log.error("[execute][流程({}) HTTP 回调触发器配置为空]", processInstanceId);
  39 + return;
  40 + }
  41 +
  42 + // 2. 发起请求
  43 + ProcessInstance processInstance = processInstanceService.getProcessInstance(processInstanceId);
  44 + setting.getBody().add(new BpmSimpleModelNodeVO.HttpRequestParam()
  45 + .setKey("taskDefineKey") // 重要:回调请求 taskDefineKey 需要传给被调用方,用于回调执行
  46 + .setType(BpmHttpRequestParamTypeEnum.FIXED_VALUE.getType()).setValue(setting.getCallbackTaskDefineKey()));
  47 + BpmHttpRequestUtils.executeBpmHttpRequest(processInstance,
  48 + setting.getUrl(),
  49 + setting.getHeader(),
  50 + setting.getBody(),
  51 + false, null);
  52 + }
  53 +
  54 +}
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/trigger/http/BpmSyncHttpRequestTrigger.java 0 → 100644
  1 +package cn.iocoder.yudao.module.bpm.service.task.trigger.http;
  2 +
  3 +import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
  4 +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO.TriggerSetting.HttpRequestTriggerSetting;
  5 +import cn.iocoder.yudao.module.bpm.enums.definition.BpmTriggerTypeEnum;
  6 +import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmHttpRequestUtils;
  7 +import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
  8 +import jakarta.annotation.Resource;
  9 +import lombok.extern.slf4j.Slf4j;
  10 +import org.flowable.engine.runtime.ProcessInstance;
  11 +import org.springframework.stereotype.Component;
  12 +import org.springframework.web.client.RestTemplate;
  13 +
  14 +/**
  15 + * BPM 发送同步 HTTP 请求触发器
  16 + *
  17 + * @author jason
  18 + */
  19 +@Component
  20 +@Slf4j
  21 +public class BpmSyncHttpRequestTrigger extends BpmAbstractHttpRequestTrigger {
  22 +
  23 + @Resource
  24 + private BpmProcessInstanceService processInstanceService;
  25 +
  26 + @Override
  27 + public BpmTriggerTypeEnum getType() {
  28 + return BpmTriggerTypeEnum.HTTP_REQUEST;
  29 + }
  30 +
  31 + @Override
  32 + public void execute(String processInstanceId, String param) {
  33 + // 1. 解析 http 请求配置
  34 + HttpRequestTriggerSetting setting = JsonUtils.parseObject(param, HttpRequestTriggerSetting.class);
  35 + if (setting == null) {
  36 + log.error("[execute][流程({}) HTTP 触发器请求配置为空]", processInstanceId);
  37 + return;
  38 + }
  39 +
  40 + // 2. 发起请求
  41 + ProcessInstance processInstance = processInstanceService.getProcessInstance(processInstanceId);
  42 + BpmHttpRequestUtils.executeBpmHttpRequest(processInstance,
  43 + setting.getUrl(),
  44 + setting.getHeader(),
  45 + setting.getBody(),
  46 + true, setting.getResponse());
  47 + }
  48 +
  49 +}
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/receivable/CrmReceivableDO.java
@@ -66,7 +66,9 @@ public class CrmReceivableDO extends BaseDO { @@ -66,7 +66,9 @@ public class CrmReceivableDO extends BaseDO {
66 */ 66 */
67 private LocalDateTime returnTime; 67 private LocalDateTime returnTime;
68 /** 68 /**
69 - * 回款方式,关联枚举{@link CrmReceivableReturnTypeEnum} 69 + * 回款方式
  70 + *
  71 + * 枚举 {@link CrmReceivableReturnTypeEnum}
70 */ 72 */
71 private Integer returnType; 73 private Integer returnType;
72 /** 74 /**
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/utils/FileTypeUtils.java
@@ -2,13 +2,13 @@ package cn.iocoder.yudao.module.infra.framework.file.core.utils; @@ -2,13 +2,13 @@ package cn.iocoder.yudao.module.infra.framework.file.core.utils;
2 2
3 import cn.hutool.core.io.IoUtil; 3 import cn.hutool.core.io.IoUtil;
4 import cn.hutool.core.util.StrUtil; 4 import cn.hutool.core.util.StrUtil;
  5 +import cn.iocoder.yudao.framework.common.util.http.HttpUtils;
5 import com.alibaba.ttl.TransmittableThreadLocal; 6 import com.alibaba.ttl.TransmittableThreadLocal;
6 import jakarta.servlet.http.HttpServletResponse; 7 import jakarta.servlet.http.HttpServletResponse;
7 import lombok.SneakyThrows; 8 import lombok.SneakyThrows;
8 import org.apache.tika.Tika; 9 import org.apache.tika.Tika;
9 10
10 import java.io.IOException; 11 import java.io.IOException;
11 -import java.net.URLEncoder;  
12 12
13 /** 13 /**
14 * 文件类型 Utils 14 * 文件类型 Utils
@@ -60,7 +60,7 @@ public class FileTypeUtils { @@ -60,7 +60,7 @@ public class FileTypeUtils {
60 */ 60 */
61 public static void writeAttachment(HttpServletResponse response, String filename, byte[] content) throws IOException { 61 public static void writeAttachment(HttpServletResponse response, String filename, byte[] content) throws IOException {
62 // 设置 header 和 contentType 62 // 设置 header 和 contentType
63 - response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename, "UTF-8")); 63 + response.setHeader("Content-Disposition", "attachment;filename=" + HttpUtils.encodeUtf8(filename));
64 String contentType = getMineType(content, filename); 64 String contentType = getMineType(content, filename);
65 response.setContentType(contentType); 65 response.setContentType(contentType);
66 // 针对 video 的特殊处理,解决视频地址在移动端播放的兼容性问题 66 // 针对 video 的特殊处理,解决视频地址在移动端播放的兼容性问题
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImpl.java
1 package cn.iocoder.yudao.module.infra.service.logger; 1 package cn.iocoder.yudao.module.infra.service.logger;
2 2
3 -import cn.hutool.core.util.StrUtil;  
4 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5 import cn.iocoder.yudao.framework.common.util.object.BeanUtils; 4 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
  5 +import cn.iocoder.yudao.framework.common.util.string.StrUtils;
6 import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; 6 import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
7 import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; 7 import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
8 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO; 8 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO;
@@ -35,8 +35,8 @@ public class ApiAccessLogServiceImpl implements ApiAccessLogService { @@ -35,8 +35,8 @@ public class ApiAccessLogServiceImpl implements ApiAccessLogService {
35 @Override 35 @Override
36 public void createApiAccessLog(ApiAccessLogCreateReqDTO createDTO) { 36 public void createApiAccessLog(ApiAccessLogCreateReqDTO createDTO) {
37 ApiAccessLogDO apiAccessLog = BeanUtils.toBean(createDTO, ApiAccessLogDO.class); 37 ApiAccessLogDO apiAccessLog = BeanUtils.toBean(createDTO, ApiAccessLogDO.class);
38 - apiAccessLog.setRequestParams(StrUtil.maxLength(apiAccessLog.getRequestParams(), REQUEST_PARAMS_MAX_LENGTH));  
39 - apiAccessLog.setResultMsg(StrUtil.maxLength(apiAccessLog.getResultMsg(), RESULT_MSG_MAX_LENGTH)); 38 + apiAccessLog.setRequestParams(StrUtils.maxLength(apiAccessLog.getRequestParams(), REQUEST_PARAMS_MAX_LENGTH));
  39 + apiAccessLog.setResultMsg(StrUtils.maxLength(apiAccessLog.getResultMsg(), RESULT_MSG_MAX_LENGTH));
40 if (TenantContextHolder.getTenantId() != null) { 40 if (TenantContextHolder.getTenantId() != null) {
41 apiAccessLogMapper.insert(apiAccessLog); 41 apiAccessLogMapper.insert(apiAccessLog);
42 } else { 42 } else {
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java
1 package cn.iocoder.yudao.module.infra.service.logger; 1 package cn.iocoder.yudao.module.infra.service.logger;
2 2
3 -import cn.hutool.core.util.StrUtil;  
4 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5 import cn.iocoder.yudao.framework.common.util.object.BeanUtils; 4 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
  5 +import cn.iocoder.yudao.framework.common.util.string.StrUtils;
6 import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; 6 import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
7 import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; 7 import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
8 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO; 8 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;
@@ -39,7 +39,7 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService { @@ -39,7 +39,7 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService {
39 public void createApiErrorLog(ApiErrorLogCreateReqDTO createDTO) { 39 public void createApiErrorLog(ApiErrorLogCreateReqDTO createDTO) {
40 ApiErrorLogDO apiErrorLog = BeanUtils.toBean(createDTO, ApiErrorLogDO.class) 40 ApiErrorLogDO apiErrorLog = BeanUtils.toBean(createDTO, ApiErrorLogDO.class)
41 .setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus()); 41 .setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
42 - apiErrorLog.setRequestParams(StrUtil.maxLength(apiErrorLog.getRequestParams(), REQUEST_PARAMS_MAX_LENGTH)); 42 + apiErrorLog.setRequestParams(StrUtils.maxLength(apiErrorLog.getRequestParams(), REQUEST_PARAMS_MAX_LENGTH));
43 if (TenantContextHolder.getTenantId() != null) { 43 if (TenantContextHolder.getTenantId() != null) {
44 apiErrorLogMapper.insert(apiErrorLog); 44 apiErrorLogMapper.insert(apiErrorLog);
45 } else { 45 } else {
yudao-module-iot/pom.xml
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 <modules> 10 <modules>
11 <module>yudao-module-iot-api</module> 11 <module>yudao-module-iot-api</module>
12 <module>yudao-module-iot-biz</module> 12 <module>yudao-module-iot-biz</module>
  13 + <module>yudao-module-iot-plugins</module>
13 </modules> 14 </modules>
14 <modelVersion>4.0.0</modelVersion> 15 <modelVersion>4.0.0</modelVersion>
15 16
yudao-module-iot/yudao-module-iot-api/pom.xml
@@ -12,6 +12,7 @@ @@ -12,6 +12,7 @@
12 <packaging>jar</packaging> 12 <packaging>jar</packaging>
13 13
14 <name>${project.artifactId}</name> 14 <name>${project.artifactId}</name>
  15 + <!-- TODO 芋艿:需要在整理下,特别是 PF4J -->
15 <description> 16 <description>
16 物联网 模块 API,暴露给其它模块调用 17 物联网 模块 API,暴露给其它模块调用
17 </description> 18 </description>
@@ -21,6 +22,32 @@ @@ -21,6 +22,32 @@
21 <groupId>cn.iocoder.boot</groupId> 22 <groupId>cn.iocoder.boot</groupId>
22 <artifactId>yudao-common</artifactId> 23 <artifactId>yudao-common</artifactId>
23 </dependency> 24 </dependency>
  25 +
  26 + <!-- Web 相关 -->
  27 + <dependency>
  28 + <groupId>org.springframework</groupId>
  29 + <artifactId>spring-web</artifactId>
  30 + <scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
  31 + </dependency>
  32 +
  33 + <!-- 工具类相关 -->
  34 + <dependency>
  35 + <groupId>com.fasterxml.jackson.core</groupId>
  36 + <artifactId>jackson-databind</artifactId>
  37 + <scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
  38 + </dependency>
  39 +
  40 + <dependency>
  41 + <groupId>org.pf4j</groupId> <!-- PF4J:内置插件机制 -->
  42 + <artifactId>pf4j-spring</artifactId>
  43 + </dependency>
  44 +
  45 + <!-- 参数校验 -->
  46 + <dependency>
  47 + <groupId>org.springframework.boot</groupId>
  48 + <artifactId>spring-boot-starter-validation</artifactId>
  49 + <optional>true</optional>
  50 + </dependency>
24 </dependencies> 51 </dependencies>
25 52
26 </project> 53 </project>
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/device/IotDeviceUpstreamApi.java 0 → 100644
  1 +package cn.iocoder.yudao.module.iot.api.device;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  4 +import cn.iocoder.yudao.module.iot.api.device.dto.control.upstream.*;
  5 +import cn.iocoder.yudao.module.iot.enums.ApiConstants;
  6 +import jakarta.validation.Valid;
  7 +import org.springframework.web.bind.annotation.PostMapping;
  8 +import org.springframework.web.bind.annotation.RequestBody;
  9 +
  10 +/**
  11 + * 设备数据 Upstream 上行 API
  12 + *
  13 + * 目的:设备 -> 插件 -> 服务端
  14 + *
  15 + * @author haohao
  16 + */
  17 +public interface IotDeviceUpstreamApi {
  18 +
  19 + String PREFIX = ApiConstants.PREFIX + "/device/upstream";
  20 +
  21 + // ========== 设备相关 ==========
  22 +
  23 + /**
  24 + * 更新设备状态
  25 + *
  26 + * @param updateReqDTO 更新设备状态 DTO
  27 + */
  28 + @PostMapping(PREFIX + "/update-state")
  29 + CommonResult<Boolean> updateDeviceState(@Valid @RequestBody IotDeviceStateUpdateReqDTO updateReqDTO);
  30 +
  31 + /**
  32 + * 上报设备属性数据
  33 + *
  34 + * @param reportReqDTO 上报设备属性数据 DTO
  35 + */
  36 + @PostMapping(PREFIX + "/report-property")
  37 + CommonResult<Boolean> reportDeviceProperty(@Valid @RequestBody IotDevicePropertyReportReqDTO reportReqDTO);
  38 +
  39 + /**
  40 + * 上报设备事件数据
  41 + *
  42 + * @param reportReqDTO 设备事件
  43 + */
  44 + @PostMapping(PREFIX + "/report-event")
  45 + CommonResult<Boolean> reportDeviceEvent(@Valid @RequestBody IotDeviceEventReportReqDTO reportReqDTO);
  46 +
  47 + // TODO @芋艿:这个需要 plugins 接入下
  48 + /**
  49 + * 注册设备
  50 + *
  51 + * @param registerReqDTO 注册设备 DTO
  52 + */
  53 + @PostMapping(PREFIX + "/register")
  54 + CommonResult<Boolean> registerDevice(@Valid @RequestBody IotDeviceRegisterReqDTO registerReqDTO);
  55 +
  56 + // TODO @芋艿:这个需要 plugins 接入下
  57 + /**
  58 + * 注册子设备
  59 + *
  60 + * @param registerReqDTO 注册子设备 DTO
  61 + */
  62 + @PostMapping(PREFIX + "/register-sub")
  63 + CommonResult<Boolean> registerSubDevice(@Valid @RequestBody IotDeviceRegisterSubReqDTO registerReqDTO);
  64 +
  65 + // TODO @芋艿:这个需要 plugins 接入下
  66 + /**
  67 + * 注册设备拓扑
  68 + *
  69 + * @param addReqDTO 注册设备拓扑 DTO
  70 + */
  71 + @PostMapping(PREFIX + "/add-topology")
  72 + CommonResult<Boolean> addDeviceTopology(@Valid @RequestBody IotDeviceTopologyAddReqDTO addReqDTO);
  73 +
  74 + // TODO @芋艿:考虑 http 认证
  75 + /**
  76 + * 认证 Emqx 连接
  77 + *
  78 + * @param authReqDTO 认证 Emqx 连接 DTO
  79 + */
  80 + @PostMapping(PREFIX + "/authenticate-emqx-connection")
  81 + CommonResult<Boolean> authenticateEmqxConnection(@Valid @RequestBody IotDeviceEmqxAuthReqDTO authReqDTO);
  82 +
  83 + // ========== 插件相关 ==========
  84 +
  85 + /**
  86 + * 心跳插件实例
  87 + *
  88 + * @param heartbeatReqDTO 心跳插件实例 DTO
  89 + */
  90 + @PostMapping(PREFIX + "/heartbeat-plugin-instance")
  91 + CommonResult<Boolean> heartbeatPluginInstance(@Valid @RequestBody IotPluginInstanceHeartbeatReqDTO heartbeatReqDTO);
  92 +
  93 +}
0 \ No newline at end of file 94 \ No newline at end of file
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/device/dto/control/downstream/IotDeviceConfigSetReqDTO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.iot.api.device.dto.control.downstream;
  2 +
  3 +import jakarta.validation.constraints.NotNull;
  4 +import lombok.Data;
  5 +
  6 +import java.util.Map;
  7 +
  8 +/**
  9 + * IoT 设备【配置】设置 Request DTO
  10 + *
  11 + * @author 芋道源码
  12 + */
  13 +@Data
  14 +public class IotDeviceConfigSetReqDTO extends IotDeviceDownstreamAbstractReqDTO {
  15 +
  16 + /**
  17 + * 配置
  18 + */
  19 + @NotNull(message = "配置不能为空")
  20 + private Map<String, Object> config;
  21 +
  22 +}
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/device/dto/control/downstream/IotDeviceDownstreamAbstractReqDTO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.iot.api.device.dto.control.downstream;
  2 +
  3 +import jakarta.validation.constraints.NotEmpty;
  4 +import lombok.Data;
  5 +
  6 +/**
  7 + * IoT 设备下行的抽象 Request DTO
  8 + *
  9 + * @author 芋道源码
  10 + */
  11 +@Data
  12 +public abstract class IotDeviceDownstreamAbstractReqDTO {
  13 +
  14 + /**
  15 + * 请求编号
  16 + */
  17 + private String requestId;
  18 +
  19 + /**
  20 + * 产品标识
  21 + */
  22 + @NotEmpty(message = "产品标识不能为空")
  23 + private String productKey;
  24 + /**
  25 + * 设备名称
  26 + */
  27 + @NotEmpty(message = "设备名称不能为空")
  28 + private String deviceName;
  29 +
  30 +}
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/device/dto/control/downstream/IotDeviceOtaUpgradeReqDTO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.iot.api.device.dto.control.downstream;
  2 +
  3 +import cn.hutool.core.map.MapUtil;
  4 +import lombok.Data;
  5 +
  6 +import java.util.Map;
  7 +
  8 +/**
  9 + * IoT 设备【OTA】升级下发 Request DTO(更新固件消息)
  10 + *
  11 + * @author 芋道源码
  12 + */
  13 +@Data
  14 +public class IotDeviceOtaUpgradeReqDTO extends IotDeviceDownstreamAbstractReqDTO {
  15 +
  16 + /**
  17 + * 固件编号
  18 + */
  19 + private Long firmwareId;
  20 + /**
  21 + * 固件版本
  22 + */
  23 + private String version;
  24 +
  25 + /**
  26 + * 签名方式
  27 + *
  28 + * 例如说:MD5、SHA256
  29 + */
  30 + private String signMethod;
  31 + /**
  32 + * 固件文件签名
  33 + */
  34 + private String fileSign;
  35 + /**
  36 + * 固件文件大小
  37 + */
  38 + private Long fileSize;
  39 + /**
  40 + * 固件文件 URL
  41 + */
  42 + private String fileUrl;
  43 +
  44 + /**
  45 + * 自定义信息,建议使用 JSON 格式
  46 + */
  47 + private String information;
  48 +
  49 + public static IotDeviceOtaUpgradeReqDTO build(Map<?, ?> map) {
  50 + return new IotDeviceOtaUpgradeReqDTO()
  51 + .setFirmwareId(MapUtil.getLong(map, "firmwareId")).setVersion((String) map.get("version"))
  52 + .setSignMethod((String) map.get("signMethod")).setFileSign((String) map.get("fileSign"))
  53 + .setFileSize(MapUtil.getLong(map, "fileSize")).setFileUrl((String) map.get("fileUrl"))
  54 + .setInformation((String) map.get("information"));
  55 + }
  56 +
  57 + public static Map<?, ?> build(IotDeviceOtaUpgradeReqDTO dto) {
  58 + return MapUtil.builder()
  59 + .put("firmwareId", dto.getFirmwareId()).put("version", dto.getVersion())
  60 + .put("signMethod", dto.getSignMethod()).put("fileSign", dto.getFileSign())
  61 + .put("fileSize", dto.getFileSize()).put("fileUrl", dto.getFileUrl())
  62 + .put("information", dto.getInformation())
  63 + .build();
  64 + }
  65 +
  66 +}
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/device/dto/control/downstream/IotDevicePropertyGetReqDTO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.iot.api.device.dto.control.downstream;
  2 +
  3 +import jakarta.validation.constraints.NotEmpty;
  4 +import lombok.Data;
  5 +
  6 +import java.util.List;
  7 +
  8 +// TODO @芋艿:从 server => plugin => device 是否有必要?从阿里云 iot 来看,没有这个功能?!
  9 +// TODO @芋艿:是不是改成 read 更好?在看看阿里云的 topic 设计
  10 +/**
  11 + * IoT 设备【属性】获取 Request DTO
  12 + *
  13 + * @author 芋道源码
  14 + */
  15 +@Data
  16 +public class IotDevicePropertyGetReqDTO extends IotDeviceDownstreamAbstractReqDTO {
  17 +
  18 + /**
  19 + * 属性标识数组
  20 + */
  21 + @NotEmpty(message = "属性标识数组不能为空")
  22 + private List<String> identifiers;
  23 +
  24 +}
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/device/dto/control/downstream/IotDevicePropertySetReqDTO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.iot.api.device.dto.control.downstream;
  2 +
  3 +import jakarta.validation.constraints.NotEmpty;
  4 +import lombok.Data;
  5 +
  6 +import java.util.Map;
  7 +
  8 +/**
  9 + * IoT 设备【属性】设置 Request DTO
  10 + *
  11 + * @author 芋道源码
  12 + */
  13 +@Data
  14 +public class IotDevicePropertySetReqDTO extends IotDeviceDownstreamAbstractReqDTO {
  15 +
  16 + /**
  17 + * 属性参数
  18 + */
  19 + @NotEmpty(message = "属性参数不能为空")
  20 + private Map<String, Object> properties;
  21 +
  22 +}
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/device/dto/control/downstream/IotDeviceServiceInvokeReqDTO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.iot.api.device.dto.control.downstream;
  2 +
  3 +import jakarta.validation.constraints.NotEmpty;
  4 +import lombok.Data;
  5 +
  6 +import java.util.Map;
  7 +
  8 +/**
  9 + * IoT 设备【服务】调用 Request DTO
  10 + *
  11 + * @author 芋道源码
  12 + */
  13 +@Data
  14 +public class IotDeviceServiceInvokeReqDTO extends IotDeviceDownstreamAbstractReqDTO {
  15 +
  16 + /**
  17 + * 服务标识
  18 + */
  19 + @NotEmpty(message = "服务标识不能为空")
  20 + private String identifier;
  21 + /**
  22 + * 调用参数
  23 + */
  24 + private Map<String, Object> params;
  25 +
  26 +}
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/device/dto/control/upstream/IotDeviceEmqxAuthReqDTO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.iot.api.device.dto.control.upstream;
  2 +
  3 +import jakarta.validation.constraints.NotEmpty;
  4 +import lombok.Data;
  5 +
  6 +// TODO @芋艿:要不要继承 IotDeviceUpstreamAbstractReqDTO
  7 +// TODO @芋艿:@haohao:后续其它认证的设计
  8 +/**
  9 + * IoT 认证 Emqx 连接 Request DTO
  10 + *
  11 + * @author 芋道源码
  12 + */
  13 +@Data
  14 +public class IotDeviceEmqxAuthReqDTO {
  15 +
  16 + /**
  17 + * 客户端 ID
  18 + */
  19 + @NotEmpty(message = "客户端 ID 不能为空")
  20 + private String clientId;
  21 +
  22 + /**
  23 + * 用户名
  24 + */
  25 + @NotEmpty(message = "用户名不能为空")
  26 + private String username;
  27 +
  28 + /**
  29 + * 密码
  30 + */
  31 + @NotEmpty(message = "密码不能为空")
  32 + private String password;
  33 +
  34 +}
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/device/dto/control/upstream/IotDeviceEventReportReqDTO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.iot.api.device.dto.control.upstream;
  2 +
  3 +import jakarta.validation.constraints.NotEmpty;
  4 +import lombok.Data;
  5 +
  6 +import java.util.Map;
  7 +
  8 +/**
  9 + * IoT 设备【事件】上报 Request DTO
  10 + *
  11 + * @author 芋道源码
  12 + */
  13 +@Data
  14 +public class IotDeviceEventReportReqDTO extends IotDeviceUpstreamAbstractReqDTO {
  15 +
  16 + /**
  17 + * 事件标识
  18 + */
  19 + @NotEmpty(message = "事件标识不能为空")
  20 + private String identifier;
  21 + /**
  22 + * 事件参数
  23 + */
  24 + private Map<String, Object> params;
  25 +
  26 +}
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/device/dto/control/upstream/IotDeviceOtaProgressReqDTO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.iot.api.device.dto.control.upstream;
  2 +
  3 +import lombok.Data;
  4 +
  5 +// TODO @芋艿:待实现:/ota/${productKey}/${deviceName}/progress
  6 +/**
  7 + * IoT 设备【OTA】升级进度 Request DTO(上报更新固件进度)
  8 + *
  9 + * @author 芋道源码
  10 + */
  11 +@Data
  12 +public class IotDeviceOtaProgressReqDTO extends IotDeviceUpstreamAbstractReqDTO {
  13 +
  14 + /**
  15 + * 固件编号
  16 + */
  17 + private Long firmwareId;
  18 +
  19 + /**
  20 + * 升级状态
  21 + *
  22 + * 枚举 {@link cn.iocoder.yudao.module.iot.enums.ota.IotOtaUpgradeRecordStatusEnum}
  23 + */
  24 + private Integer status;
  25 + /**
  26 + * 升级进度,百分比
  27 + */
  28 + private Integer progress;
  29 +
  30 + /**
  31 + * 升级进度描述
  32 + */
  33 + private String description;
  34 +
  35 +}
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/device/dto/control/upstream/IotDeviceOtaPullReqDTO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.iot.api.device.dto.control.upstream;
  2 +
  3 +// TODO @芋艿:待实现:/ota/${productKey}/${deviceName}/pull
  4 +/**
  5 + * IoT 设备【OTA】升级下拉 Request DTO(拉取固件更新)
  6 + *
  7 + * @author 芋道源码
  8 + */
  9 +public class IotDeviceOtaPullReqDTO {
  10 +
  11 + /**
  12 + * 固件编号
  13 + */
  14 + private Long firmwareId;
  15 +
  16 + /**
  17 + * 固件版本
  18 + */
  19 + private String version;
  20 +
  21 +}
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/device/dto/control/upstream/IotDeviceOtaReportReqDTO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.iot.api.device.dto.control.upstream;
  2 +
  3 +// TODO @芋艿:待实现:/ota/${productKey}/${deviceName}/report
  4 +/**
  5 + * IoT 设备【OTA】上报 Request DTO(上报固件版本)
  6 + *
  7 + * @author 芋道源码
  8 + */
  9 +public class IotDeviceOtaReportReqDTO {
  10 +
  11 + /**
  12 + * 固件编号
  13 + */
  14 + private Long firmwareId;
  15 +
  16 + /**
  17 + * 固件版本
  18 + */
  19 + private String version;
  20 +
  21 +}
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/device/dto/control/upstream/IotDevicePropertyReportReqDTO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.iot.api.device.dto.control.upstream;
  2 +
  3 +import jakarta.validation.constraints.NotEmpty;
  4 +import lombok.Data;
  5 +
  6 +import java.util.Map;
  7 +
  8 +/**
  9 + * IoT 设备【属性】上报 Request DTO
  10 + *
  11 + * @author 芋道源码
  12 + */
  13 +@Data
  14 +public class IotDevicePropertyReportReqDTO extends IotDeviceUpstreamAbstractReqDTO {
  15 +
  16 + /**
  17 + * 属性参数
  18 + */
  19 + @NotEmpty(message = "属性参数不能为空")
  20 + private Map<String, Object> properties;
  21 +
  22 +}
0 \ No newline at end of file 23 \ No newline at end of file
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/device/dto/control/upstream/IotDeviceRegisterReqDTO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.iot.api.device.dto.control.upstream;
  2 +
  3 +import lombok.Data;
  4 +
  5 +/**
  6 + * IoT 设备【注册】自己 Request DTO
  7 + *
  8 + * @author 芋道源码
  9 + */
  10 +@Data
  11 +public class IotDeviceRegisterReqDTO extends IotDeviceUpstreamAbstractReqDTO {
  12 +}
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/device/dto/control/upstream/IotDeviceRegisterSubReqDTO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.iot.api.device.dto.control.upstream;
  2 +
  3 +import jakarta.validation.constraints.NotEmpty;
  4 +import lombok.Data;
  5 +
  6 +import java.util.List;
  7 +
  8 +/**
  9 + * IoT 设备【注册】子设备 Request DTO
  10 + *
  11 + * @author 芋道源码
  12 + */
  13 +@Data
  14 +public class IotDeviceRegisterSubReqDTO extends IotDeviceUpstreamAbstractReqDTO {
  15 +
  16 + // TODO @芋艿:看看要不要优化命名
  17 + /**
  18 + * 子设备数组
  19 + */
  20 + @NotEmpty(message = "子设备不能为空")
  21 + private List<Device> params;
  22 +
  23 + /**
  24 + * 设备信息
  25 + */
  26 + @Data
  27 + public static class Device {
  28 +
  29 + /**
  30 + * 产品标识
  31 + */
  32 + @NotEmpty(message = "产品标识不能为空")
  33 + private String productKey;
  34 +
  35 + /**
  36 + * 设备名称
  37 + */
  38 + @NotEmpty(message = "设备名称不能为空")
  39 + private String deviceName;
  40 +
  41 + }
  42 +
  43 +}
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/device/dto/control/upstream/IotDeviceStateUpdateReqDTO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.iot.api.device.dto.control.upstream;
  2 +
  3 +import cn.iocoder.yudao.framework.common.validation.InEnum;
  4 +import cn.iocoder.yudao.module.iot.enums.device.IotDeviceStateEnum;
  5 +import jakarta.validation.constraints.NotNull;
  6 +import lombok.Data;
  7 +
  8 +/**
  9 + * IoT 设备【状态】更新 Request DTO
  10 + *
  11 + * @author 芋道源码
  12 + */
  13 +@Data
  14 +public class IotDeviceStateUpdateReqDTO extends IotDeviceUpstreamAbstractReqDTO {
  15 +
  16 + /**
  17 + * 设备状态
  18 + */
  19 + @NotNull(message = "设备状态不能为空")
  20 + @InEnum(IotDeviceStateEnum.class) // 只使用:在线、离线
  21 + private Integer state;
  22 +
  23 +}
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/device/dto/control/upstream/IotDeviceTopologyAddReqDTO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.iot.api.device.dto.control.upstream;
  2 +
  3 +import jakarta.validation.constraints.NotEmpty;
  4 +import lombok.Data;
  5 +
  6 +import java.util.List;
  7 +
  8 +// TODO @芋艿:要写清楚,是来自设备网关,还是设备。
  9 +/**
  10 + * IoT 设备【拓扑】添加 Request DTO
  11 + */
  12 +@Data
  13 +public class IotDeviceTopologyAddReqDTO extends IotDeviceUpstreamAbstractReqDTO {
  14 +
  15 + // TODO @芋艿:看看要不要优化命名
  16 + /**
  17 + * 子设备数组
  18 + */
  19 + @NotEmpty(message = "子设备不能为空")
  20 + private List<IotDeviceRegisterSubReqDTO.Device> params;
  21 +
  22 + /**
  23 + * 设备信息
  24 + */
  25 + @Data
  26 + public static class Device {
  27 +
  28 + /**
  29 + * 产品标识
  30 + */
  31 + @NotEmpty(message = "产品标识不能为空")
  32 + private String productKey;
  33 +
  34 + /**
  35 + * 设备名称
  36 + */
  37 + @NotEmpty(message = "设备名称不能为空")
  38 + private String deviceName;
  39 +
  40 + // TODO @芋艿:阿里云还有 sign 签名
  41 +
  42 + }
  43 +
  44 +}
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/device/dto/control/upstream/IotDeviceUpstreamAbstractReqDTO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.iot.api.device.dto.control.upstream;
  2 +
  3 +import cn.iocoder.yudao.framework.common.util.json.databind.TimestampLocalDateTimeSerializer;
  4 +import com.fasterxml.jackson.databind.annotation.JsonSerialize;
  5 +import jakarta.validation.constraints.NotEmpty;
  6 +import lombok.Data;
  7 +
  8 +import java.time.LocalDateTime;
  9 +
  10 +/**
  11 + * IoT 设备上行的抽象 Request DTO
  12 + *
  13 + * @author 芋道源码
  14 + */
  15 +@Data
  16 +public abstract class IotDeviceUpstreamAbstractReqDTO {
  17 +
  18 + /**
  19 + * 请求编号
  20 + */
  21 + private String requestId;
  22 +
  23 + /**
  24 + * 插件实例的进程编号
  25 + */
  26 + private String processId;
  27 +
  28 + /**
  29 + * 产品标识
  30 + */
  31 + @NotEmpty(message = "产品标识不能为空")
  32 + private String productKey;
  33 + /**
  34 + * 设备名称
  35 + */
  36 + @NotEmpty(message = "设备名称不能为空")
  37 + private String deviceName;
  38 +
  39 + /**
  40 + * 上报时间
  41 + */
  42 + @JsonSerialize(using = TimestampLocalDateTimeSerializer.class) // 解决 iot plugins 序列化 LocalDateTime 是数组,导致无法解析的问题
  43 + private LocalDateTime reportTime;
  44 +
  45 +}
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/device/dto/control/upstream/IotPluginInstanceHeartbeatReqDTO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.iot.api.device.dto.control.upstream;
  2 +
  3 +import jakarta.validation.constraints.NotEmpty;
  4 +import jakarta.validation.constraints.NotNull;
  5 +import lombok.Data;
  6 +
  7 +/**
  8 + * IoT 插件实例心跳 Request DTO
  9 + *
  10 + * @author 芋道源码
  11 + */
  12 +@Data
  13 +public class IotPluginInstanceHeartbeatReqDTO {
  14 +
  15 + /**
  16 + * 请求编号
  17 + */
  18 + @NotEmpty(message = "请求编号不能为空")
  19 + private String processId;
  20 +
  21 + /**
  22 + * 插件包标识符
  23 + */
  24 + @NotEmpty(message = "插件包标识符不能为空")
  25 + private String pluginKey;
  26 +
  27 + /**
  28 + * 插件实例所在 IP
  29 + */
  30 + @NotEmpty(message = "插件实例所在 IP 不能为空")
  31 + private String hostIp;
  32 + /**
  33 + * 插件实例的进程编号
  34 + */
  35 + @NotNull(message = "插件实例的进程编号不能为空")
  36 + private Integer downstreamPort;
  37 +
  38 + /**
  39 + * 是否在线
  40 + */
  41 + @NotNull(message = "是否在线不能为空")
  42 + private Boolean online;
  43 +
  44 +}
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/device/dto/package-info.java 0 → 100644
  1 +/**
  2 + * TODO 芋艿:占位
  3 + */
  4 +package cn.iocoder.yudao.module.iot.api.device.dto;
0 \ No newline at end of file 5 \ No newline at end of file