ai-engineering-init 1.3.4 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/hooks/skill-forced-eval.js +2 -0
- package/.claude/settings.json +3 -3
- package/.claude/skills/add-skill/SKILL.md +79 -32
- package/.claude/skills/api-development/SKILL.md +83 -377
- package/.claude/skills/architecture-design/SKILL.md +138 -632
- package/.claude/skills/backend-annotations/SKILL.md +134 -506
- package/.claude/skills/banana-image/SKILL.md +10 -3
- package/.claude/skills/brainstorm/SKILL.md +103 -535
- package/.claude/skills/bug-detective/SKILL.md +147 -1097
- package/.claude/skills/bug-detective/references/error-patterns.md +242 -0
- package/.claude/skills/code-patterns/SKILL.md +116 -426
- package/.claude/skills/code-patterns/references/leniu-code-patterns.md +87 -0
- package/.claude/skills/crud-development/SKILL.md +64 -304
- package/.claude/skills/data-permission/SKILL.md +105 -412
- package/.claude/skills/data-permission/references/custom-data-scope.md +90 -0
- package/.claude/skills/file-oss-management/SKILL.md +106 -714
- package/.claude/skills/file-oss-management/references/entities.md +105 -0
- package/.claude/skills/file-oss-management/references/service-impl.md +104 -0
- package/.claude/skills/leniu-api-development/SKILL.md +142 -626
- package/.claude/skills/leniu-api-development/references/real-examples.md +273 -0
- package/.claude/skills/leniu-architecture-design/SKILL.md +176 -391
- package/.claude/skills/leniu-backend-annotations/SKILL.md +132 -519
- package/.claude/skills/leniu-brainstorm/SKILL.md +132 -541
- package/.claude/skills/leniu-brainstorm/references/business-scenarios.md +162 -0
- package/.claude/skills/leniu-crud-development/SKILL.md +232 -938
- package/.claude/skills/leniu-crud-development/references/templates.md +597 -0
- package/.claude/skills/leniu-customization-location/SKILL.md +410 -0
- package/.claude/skills/leniu-data-permission/SKILL.md +70 -0
- package/.claude/skills/leniu-java-entity/SKILL.md +76 -590
- package/.claude/skills/leniu-java-entity/references/templates.md +237 -0
- package/.claude/skills/leniu-java-export/SKILL.md +94 -379
- package/.claude/skills/leniu-java-logging/SKILL.md +106 -709
- package/.claude/skills/leniu-java-logging/references/data-mask.md +46 -0
- package/.claude/skills/leniu-java-logging/references/logging-scenarios.md +113 -0
- package/.claude/skills/leniu-java-mybatis/SKILL.md +73 -446
- package/.claude/skills/leniu-java-mybatis/references/report-mapper.md +88 -0
- package/.claude/skills/leniu-report-customization/SKILL.md +111 -365
- package/.claude/skills/leniu-report-customization/references/table-fields.md +93 -0
- package/.claude/skills/leniu-report-standard-customization/SKILL.md +111 -334
- package/.claude/skills/leniu-report-standard-customization/references/analysis-module.md +64 -0
- package/.claude/skills/leniu-report-standard-customization/references/table-fields.md +113 -0
- package/.claude/skills/leniu-security-guard/SKILL.md +133 -347
- package/.claude/skills/mysql-debug/SKILL.md +364 -0
- package/.claude/skills/openspec-apply-change/SKILL.md +10 -1
- package/.claude/skills/openspec-archive-change/SKILL.md +9 -1
- package/.claude/skills/openspec-bulk-archive-change/SKILL.md +9 -1
- package/.claude/skills/openspec-continue-change/SKILL.md +9 -1
- package/.claude/skills/openspec-explore/SKILL.md +10 -1
- package/.claude/skills/openspec-ff-change/SKILL.md +9 -1
- package/.claude/skills/openspec-new-change/SKILL.md +9 -1
- package/.claude/skills/openspec-onboard/SKILL.md +15 -130
- package/.claude/skills/openspec-sync-specs/SKILL.md +9 -1
- package/.claude/skills/openspec-verify-change/SKILL.md +9 -1
- package/.claude/skills/performance-doctor/SKILL.md +110 -434
- package/.claude/skills/redis-cache/SKILL.md +89 -595
- package/.claude/skills/redis-cache/references/listeners.md +23 -0
- package/.claude/skills/scheduled-jobs/SKILL.md +88 -407
- package/.claude/skills/security-guard/SKILL.md +137 -532
- package/.claude/skills/security-guard/references/encrypt-config.md +103 -0
- package/.claude/skills/security-guard/references/sensitive-strategies.md +42 -0
- package/.claude/skills/sms-mail/SKILL.md +116 -574
- package/.claude/skills/sms-mail/references/mail-config.md +88 -0
- package/.claude/skills/sms-mail/references/sms-config.md +74 -0
- package/.claude/skills/social-login/SKILL.md +112 -514
- package/.claude/skills/social-login/references/provider-configs.md +118 -0
- package/.claude/skills/tenant-management/SKILL.md +129 -444
- package/.claude/skills/tenant-management/references/tenant-scenarios.md +91 -0
- package/.claude/skills/test-development/SKILL.md +86 -540
- package/.claude/skills/test-development/references/parameterized-examples.md +119 -0
- package/.claude/skills/utils-toolkit/SKILL.md +52 -305
- package/.claude/skills/utils-toolkit/references/redis-utils-api.md +56 -0
- package/.claude/skills/websocket-sse/SKILL.md +105 -550
- package/.claude/skills/workflow-engine/SKILL.md +147 -502
- package/.codex/skills/add-skill/SKILL.md +79 -32
- package/.codex/skills/api-development/SKILL.md +172 -599
- package/.codex/skills/architecture-design/SKILL.md +138 -504
- package/.codex/skills/backend-annotations/SKILL.md +134 -496
- package/.codex/skills/banana-image/SKILL.md +10 -3
- package/.codex/skills/brainstorm/SKILL.md +103 -535
- package/.codex/skills/bug-detective/SKILL.md +147 -1097
- package/.codex/skills/bug-detective/references/error-patterns.md +242 -0
- package/.codex/skills/code-patterns/SKILL.md +120 -282
- package/.codex/skills/code-patterns/references/leniu-code-patterns.md +87 -0
- package/.codex/skills/crud-development/SKILL.md +64 -292
- package/.codex/skills/data-permission/SKILL.md +108 -407
- package/.codex/skills/data-permission/references/custom-data-scope.md +90 -0
- package/.codex/skills/database-ops/SKILL.md +8 -154
- package/.codex/skills/error-handler/SKILL.md +10 -0
- package/.codex/skills/file-oss-management/SKILL.md +106 -714
- package/.codex/skills/file-oss-management/references/entities.md +105 -0
- package/.codex/skills/file-oss-management/references/service-impl.md +104 -0
- package/.codex/skills/git-workflow/SKILL.md +27 -5
- package/.codex/skills/leniu-api-development/SKILL.md +142 -626
- package/.codex/skills/leniu-api-development/references/real-examples.md +273 -0
- package/.codex/skills/leniu-architecture-design/SKILL.md +176 -391
- package/.codex/skills/leniu-backend-annotations/SKILL.md +132 -519
- package/.codex/skills/leniu-brainstorm/SKILL.md +132 -541
- package/.codex/skills/leniu-brainstorm/references/business-scenarios.md +162 -0
- package/.codex/skills/leniu-crud-development/SKILL.md +232 -938
- package/.codex/skills/leniu-crud-development/references/templates.md +597 -0
- package/.codex/skills/leniu-customization-location/SKILL.md +410 -0
- package/.codex/skills/leniu-data-permission/SKILL.md +70 -0
- package/.codex/skills/leniu-java-code-style/SKILL.md +510 -0
- package/.codex/skills/leniu-java-entity/SKILL.md +76 -590
- package/.codex/skills/leniu-java-entity/references/templates.md +237 -0
- package/.codex/skills/leniu-java-export/SKILL.md +94 -379
- package/.codex/skills/leniu-java-logging/SKILL.md +106 -709
- package/.codex/skills/leniu-java-logging/references/data-mask.md +46 -0
- package/.codex/skills/leniu-java-logging/references/logging-scenarios.md +113 -0
- package/.codex/skills/leniu-java-mybatis/SKILL.md +73 -446
- package/.codex/skills/leniu-java-mybatis/references/report-mapper.md +88 -0
- package/.codex/skills/leniu-report-customization/SKILL.md +111 -365
- package/.codex/skills/leniu-report-customization/references/table-fields.md +93 -0
- package/.codex/skills/leniu-report-standard-customization/SKILL.md +111 -334
- package/.codex/skills/leniu-report-standard-customization/references/analysis-module.md +64 -0
- package/.codex/skills/leniu-report-standard-customization/references/table-fields.md +113 -0
- package/.codex/skills/leniu-security-guard/SKILL.md +133 -347
- package/.codex/skills/mysql-debug/SKILL.md +364 -0
- package/.codex/skills/openspec-apply-change/SKILL.md +10 -1
- package/.codex/skills/openspec-archive-change/SKILL.md +9 -1
- package/.codex/skills/openspec-bulk-archive-change/SKILL.md +9 -1
- package/.codex/skills/openspec-continue-change/SKILL.md +9 -1
- package/.codex/skills/openspec-explore/SKILL.md +10 -1
- package/.codex/skills/openspec-ff-change/SKILL.md +9 -1
- package/.codex/skills/openspec-new-change/SKILL.md +9 -1
- package/.codex/skills/openspec-onboard/SKILL.md +15 -130
- package/.codex/skills/openspec-sync-specs/SKILL.md +9 -1
- package/.codex/skills/openspec-verify-change/SKILL.md +9 -1
- package/.codex/skills/performance-doctor/SKILL.md +110 -434
- package/.codex/skills/project-navigator/SKILL.md +20 -1
- package/.codex/skills/redis-cache/SKILL.md +93 -589
- package/.codex/skills/redis-cache/references/listeners.md +23 -0
- package/.codex/skills/scheduled-jobs/SKILL.md +88 -407
- package/.codex/skills/security-guard/SKILL.md +141 -527
- package/.codex/skills/security-guard/references/encrypt-config.md +103 -0
- package/.codex/skills/security-guard/references/sensitive-strategies.md +42 -0
- package/.codex/skills/sms-mail/SKILL.md +116 -574
- package/.codex/skills/sms-mail/references/mail-config.md +88 -0
- package/.codex/skills/sms-mail/references/sms-config.md +74 -0
- package/.codex/skills/social-login/SKILL.md +112 -514
- package/.codex/skills/social-login/references/provider-configs.md +118 -0
- package/.codex/skills/store-pc/SKILL.md +258 -383
- package/.codex/skills/tenant-management/SKILL.md +129 -444
- package/.codex/skills/tenant-management/references/tenant-scenarios.md +91 -0
- package/.codex/skills/test-development/SKILL.md +86 -540
- package/.codex/skills/test-development/references/parameterized-examples.md +119 -0
- package/.codex/skills/ui-pc/SKILL.md +350 -387
- package/.codex/skills/utils-toolkit/SKILL.md +52 -283
- package/.codex/skills/utils-toolkit/references/redis-utils-api.md +56 -0
- package/.codex/skills/websocket-sse/SKILL.md +105 -550
- package/.codex/skills/workflow-engine/SKILL.md +147 -502
- package/.cursor/hooks.json +3 -3
- package/.cursor/skills/add-skill/SKILL.md +79 -32
- package/.cursor/skills/api-development/SKILL.md +83 -377
- package/.cursor/skills/architecture-design/SKILL.md +138 -632
- package/.cursor/skills/backend-annotations/SKILL.md +134 -506
- package/.cursor/skills/banana-image/SKILL.md +10 -3
- package/.cursor/skills/brainstorm/SKILL.md +103 -535
- package/.cursor/skills/bug-detective/SKILL.md +147 -1097
- package/.cursor/skills/bug-detective/references/error-patterns.md +242 -0
- package/.cursor/skills/code-patterns/SKILL.md +116 -426
- package/.cursor/skills/code-patterns/references/leniu-code-patterns.md +87 -0
- package/.cursor/skills/crud-development/SKILL.md +64 -304
- package/.cursor/skills/data-permission/SKILL.md +105 -412
- package/.cursor/skills/data-permission/references/custom-data-scope.md +90 -0
- package/.cursor/skills/file-oss-management/SKILL.md +106 -714
- package/.cursor/skills/file-oss-management/references/entities.md +105 -0
- package/.cursor/skills/file-oss-management/references/service-impl.md +104 -0
- package/.cursor/skills/git-workflow/SKILL.md +27 -5
- package/.cursor/skills/leniu-api-development/SKILL.md +142 -626
- package/.cursor/skills/leniu-api-development/references/real-examples.md +273 -0
- package/.cursor/skills/leniu-architecture-design/SKILL.md +176 -391
- package/.cursor/skills/leniu-backend-annotations/SKILL.md +132 -519
- package/.cursor/skills/leniu-brainstorm/SKILL.md +132 -541
- package/.cursor/skills/leniu-brainstorm/references/business-scenarios.md +162 -0
- package/.cursor/skills/leniu-crud-development/SKILL.md +232 -938
- package/.cursor/skills/leniu-crud-development/references/templates.md +597 -0
- package/.cursor/skills/leniu-customization-location/SKILL.md +410 -0
- package/.cursor/skills/leniu-data-permission/SKILL.md +70 -0
- package/.cursor/skills/leniu-java-code-style/SKILL.md +510 -0
- package/.cursor/skills/leniu-java-entity/SKILL.md +76 -590
- package/.cursor/skills/leniu-java-entity/references/templates.md +237 -0
- package/.cursor/skills/leniu-java-export/SKILL.md +94 -379
- package/.cursor/skills/leniu-java-logging/SKILL.md +106 -709
- package/.cursor/skills/leniu-java-logging/references/data-mask.md +46 -0
- package/.cursor/skills/leniu-java-logging/references/logging-scenarios.md +113 -0
- package/.cursor/skills/leniu-java-mybatis/SKILL.md +73 -446
- package/.cursor/skills/leniu-java-mybatis/references/report-mapper.md +88 -0
- package/.cursor/skills/leniu-report-customization/SKILL.md +111 -365
- package/.cursor/skills/leniu-report-customization/references/table-fields.md +93 -0
- package/.cursor/skills/leniu-report-standard-customization/SKILL.md +111 -334
- package/.cursor/skills/leniu-report-standard-customization/references/analysis-module.md +64 -0
- package/.cursor/skills/leniu-report-standard-customization/references/table-fields.md +113 -0
- package/.cursor/skills/leniu-security-guard/SKILL.md +133 -347
- package/.cursor/skills/mysql-debug/SKILL.md +364 -0
- package/.cursor/skills/openspec-apply-change/SKILL.md +10 -1
- package/.cursor/skills/openspec-archive-change/SKILL.md +9 -1
- package/.cursor/skills/openspec-bulk-archive-change/SKILL.md +9 -1
- package/.cursor/skills/openspec-continue-change/SKILL.md +9 -1
- package/.cursor/skills/openspec-explore/SKILL.md +10 -1
- package/.cursor/skills/openspec-ff-change/SKILL.md +9 -1
- package/.cursor/skills/openspec-new-change/SKILL.md +9 -1
- package/.cursor/skills/openspec-onboard/SKILL.md +15 -130
- package/.cursor/skills/openspec-sync-specs/SKILL.md +9 -1
- package/.cursor/skills/openspec-verify-change/SKILL.md +9 -1
- package/.cursor/skills/performance-doctor/SKILL.md +110 -434
- package/.cursor/skills/redis-cache/SKILL.md +89 -595
- package/.cursor/skills/redis-cache/references/listeners.md +23 -0
- package/.cursor/skills/scheduled-jobs/SKILL.md +88 -407
- package/.cursor/skills/security-guard/SKILL.md +137 -532
- package/.cursor/skills/security-guard/references/encrypt-config.md +103 -0
- package/.cursor/skills/security-guard/references/sensitive-strategies.md +42 -0
- package/.cursor/skills/sms-mail/SKILL.md +116 -574
- package/.cursor/skills/sms-mail/references/mail-config.md +88 -0
- package/.cursor/skills/sms-mail/references/sms-config.md +74 -0
- package/.cursor/skills/social-login/SKILL.md +112 -514
- package/.cursor/skills/social-login/references/provider-configs.md +118 -0
- package/.cursor/skills/tenant-management/SKILL.md +129 -444
- package/.cursor/skills/tenant-management/references/tenant-scenarios.md +91 -0
- package/.cursor/skills/test-development/SKILL.md +86 -540
- package/.cursor/skills/test-development/references/parameterized-examples.md +119 -0
- package/.cursor/skills/utils-toolkit/SKILL.md +52 -305
- package/.cursor/skills/utils-toolkit/references/redis-utils-api.md +56 -0
- package/.cursor/skills/websocket-sse/SKILL.md +105 -550
- package/.cursor/skills/workflow-engine/SKILL.md +147 -502
- package/package.json +1 -1
|
@@ -14,272 +14,166 @@ description: |
|
|
|
14
14
|
触发词:工作流、流程、审批、WarmFlow、FlowEngine、任务、办理、驳回、转办、委派、加签、减签、抄送、流程实例、流程定义、办理人、GlobalListener、ProcessEvent
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
-
#
|
|
17
|
+
# 工作流引擎开发规范(WarmFlow)
|
|
18
18
|
|
|
19
|
-
>
|
|
19
|
+
> 基于 **WarmFlow** 实现,架构层次:Controller → Service → WarmFlow Core (FlowEngine) → Mapper → Listener/Handler
|
|
20
20
|
|
|
21
|
-
##
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
25
|
-
│ Controller Layer │
|
|
26
|
-
│ FlwTaskController | FlwInstanceController | FlwDefinitionController
|
|
27
|
-
│ FlwCategoryController | FlwSpelController | TestLeaveController │
|
|
28
|
-
└─────────────────────────────┬───────────────────────────────────┘
|
|
29
|
-
│
|
|
30
|
-
┌─────────────────────────────▼───────────────────────────────────┐
|
|
31
|
-
│ Service Layer │
|
|
32
|
-
│ FlwTaskService | FlwInstanceService | FlwDefinitionService │
|
|
33
|
-
│ FlwCategoryService | FlwSpelService | TestLeaveService │
|
|
34
|
-
│ │ │
|
|
35
|
-
│ ┌───────────────────────────▼─────────────────────────────────┐│
|
|
36
|
-
│ │ WarmFlow Core (FlowEngine) ││
|
|
37
|
-
│ │ TaskService | InsService | DefService | NodeService ││
|
|
38
|
-
│ └─────────────────────────────────────────────────────────────┘│
|
|
39
|
-
└─────────────────────────────┬───────────────────────────────────┘
|
|
40
|
-
│
|
|
41
|
-
┌─────────────────────────────▼───────────────────────────────────┐
|
|
42
|
-
│ Mapper Layer │
|
|
43
|
-
│ FlwCategoryMapper | FlwSpelMapper | TestLeaveMapper │
|
|
44
|
-
│ FlwInstanceMapper | FlwTaskMapper | FlwInstanceBizExtMapper │
|
|
45
|
-
└─────────────────────────────┬───────────────────────────────────┘
|
|
46
|
-
│
|
|
47
|
-
┌─────────────────────────────▼───────────────────────────────────┐
|
|
48
|
-
│ Listener & Handler │
|
|
49
|
-
│ WorkflowGlobalListener (任务监听) | FlowProcessEventHandler (事件发布)
|
|
50
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
## 核心组件
|
|
56
|
-
|
|
57
|
-
### 1. FlowEngine 服务访问
|
|
21
|
+
## 一、FlowEngine 核心服务
|
|
58
22
|
|
|
59
23
|
```java
|
|
60
24
|
import org.dromara.warm.flow.core.FlowEngine;
|
|
61
25
|
|
|
62
|
-
// 任务服务
|
|
63
|
-
FlowEngine.
|
|
64
|
-
|
|
65
|
-
//
|
|
66
|
-
FlowEngine.
|
|
67
|
-
|
|
68
|
-
// 流程定义服务
|
|
69
|
-
FlowEngine.defService()
|
|
70
|
-
|
|
71
|
-
// 节点服务
|
|
72
|
-
FlowEngine.nodeService()
|
|
73
|
-
|
|
74
|
-
// 历史任务服务
|
|
75
|
-
FlowEngine.hisTaskService()
|
|
76
|
-
|
|
77
|
-
// 用户服务
|
|
78
|
-
FlowEngine.userService()
|
|
26
|
+
FlowEngine.taskService() // 任务服务
|
|
27
|
+
FlowEngine.insService() // 实例服务
|
|
28
|
+
FlowEngine.defService() // 流程定义服务
|
|
29
|
+
FlowEngine.nodeService() // 节点服务
|
|
30
|
+
FlowEngine.hisTaskService() // 历史任务服务
|
|
31
|
+
FlowEngine.userService() // 用户服务
|
|
79
32
|
```
|
|
80
33
|
|
|
81
|
-
|
|
34
|
+
## 二、关键枚举
|
|
35
|
+
|
|
36
|
+
### 任务状态 TaskStatusEnum
|
|
82
37
|
|
|
83
38
|
```java
|
|
84
39
|
package org.dromara.workflow.common.enums;
|
|
85
40
|
|
|
86
41
|
public enum TaskStatusEnum {
|
|
87
|
-
CANCEL("cancel", "撤销"),
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
SIGN("sign", "加签"),
|
|
97
|
-
SIGN_OFF("sign_off", "减签"),
|
|
98
|
-
TIMEOUT("timeout", "超时");
|
|
99
|
-
|
|
100
|
-
private final String status;
|
|
101
|
-
private final String desc;
|
|
102
|
-
|
|
103
|
-
// 判断状态是否为通过或退回
|
|
104
|
-
public static boolean isPassOrBack(String status) {
|
|
105
|
-
return PASS.getStatus().equals(status) || BACK.getStatus().equals(status);
|
|
106
|
-
}
|
|
42
|
+
CANCEL("cancel", "撤销"), PASS("pass", "通过"),
|
|
43
|
+
WAITING("waiting", "待审核"), INVALID("invalid", "作废"),
|
|
44
|
+
BACK("back", "退回"), TERMINATION("termination", "终止"),
|
|
45
|
+
TRANSFER("transfer", "转办"), DEPUTE("depute", "委托"),
|
|
46
|
+
COPY("copy", "抄送"), SIGN("sign", "加签"),
|
|
47
|
+
SIGN_OFF("sign_off", "减签"), TIMEOUT("timeout", "超时");
|
|
48
|
+
|
|
49
|
+
// 判断是否为通过或退回
|
|
50
|
+
public static boolean isPassOrBack(String status) { ... }
|
|
107
51
|
}
|
|
108
52
|
```
|
|
109
53
|
|
|
110
|
-
###
|
|
54
|
+
### 办理人类型 TaskAssigneeEnum
|
|
111
55
|
|
|
112
|
-
>
|
|
56
|
+
> **注意**:USER 和 SPEL 类型没有前缀!
|
|
113
57
|
|
|
114
58
|
```java
|
|
115
|
-
package org.dromara.workflow.common.enums;
|
|
116
|
-
|
|
117
59
|
public enum TaskAssigneeEnum {
|
|
118
|
-
USER("用户", ""), //
|
|
60
|
+
USER("用户", ""), // 无前缀
|
|
119
61
|
ROLE("角色", "role:"),
|
|
120
62
|
DEPT("部门", "dept:"),
|
|
121
63
|
POST("岗位", "post:"),
|
|
122
|
-
SPEL("SpEL表达式", ""); //
|
|
64
|
+
SPEL("SpEL表达式", ""); // 无前缀,通过 $ 或 # 开头判断
|
|
123
65
|
|
|
124
|
-
private final String desc;
|
|
125
|
-
private final String code;
|
|
126
|
-
|
|
127
|
-
// 判断是否为 SPEL 表达式(以 $ 或 # 开头)
|
|
128
66
|
public static boolean isSpelExpression(String value) {
|
|
129
67
|
return StringUtils.startsWith(value, "$") || StringUtils.startsWith(value, "#");
|
|
130
68
|
}
|
|
131
69
|
}
|
|
132
70
|
```
|
|
133
71
|
|
|
134
|
-
**storageId
|
|
135
|
-
```
|
|
136
|
-
123 → 用户ID 123(无前缀)
|
|
137
|
-
role:456 → 角色ID 456
|
|
138
|
-
dept:789 → 部门ID 789
|
|
139
|
-
post:101 → 岗位ID 101
|
|
140
|
-
#{expression} → SpEL表达式(# 开头)
|
|
141
|
-
${variable} → 默认变量策略($ 开头)
|
|
142
|
-
```
|
|
72
|
+
**storageId 格式**:`123`(用户) | `role:456` | `dept:789` | `post:101` | `#{expr}` | `${var}`
|
|
143
73
|
|
|
144
74
|
---
|
|
145
75
|
|
|
146
|
-
##
|
|
76
|
+
## 三、常用操作
|
|
147
77
|
|
|
148
|
-
### 1
|
|
78
|
+
### 3.1 启动流程
|
|
149
79
|
|
|
150
80
|
```java
|
|
151
81
|
@Autowired
|
|
152
82
|
private IFlwTaskService flwTaskService;
|
|
153
83
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
bo.setVariables(Map.of("amount", 1000)); // 流程变量
|
|
160
|
-
|
|
161
|
-
StartProcessReturnDTO result = flwTaskService.startWorkFlow(bo);
|
|
162
|
-
Long instanceId = result.getProcessInstanceId();
|
|
163
|
-
Long taskId = result.getTaskId();
|
|
164
|
-
}
|
|
84
|
+
StartProcessBo bo = new StartProcessBo();
|
|
85
|
+
bo.setFlowCode("leave_apply");
|
|
86
|
+
bo.setBusinessId("order_123");
|
|
87
|
+
bo.setVariables(Map.of("amount", 1000));
|
|
88
|
+
StartProcessReturnDTO result = flwTaskService.startWorkFlow(bo);
|
|
165
89
|
```
|
|
166
90
|
|
|
167
91
|
```java
|
|
92
|
+
// 供其他模块调用
|
|
168
93
|
@Autowired
|
|
169
94
|
private WorkflowService workflowService;
|
|
170
95
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
dto.setBusinessId("order_123");
|
|
176
|
-
dto.setVariables(Map.of("amount", 1000));
|
|
177
|
-
|
|
178
|
-
StartProcessReturnDTO result = workflowService.startWorkFlow(dto);
|
|
179
|
-
}
|
|
96
|
+
StartProcessDTO dto = new StartProcessDTO();
|
|
97
|
+
dto.setFlowCode("leave_apply");
|
|
98
|
+
dto.setBusinessId("order_123");
|
|
99
|
+
StartProcessReturnDTO result = workflowService.startWorkFlow(dto);
|
|
180
100
|
```
|
|
181
101
|
|
|
182
|
-
### 2
|
|
102
|
+
### 3.2 办理任务
|
|
183
103
|
|
|
184
104
|
```java
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
// 指定下一节点办理人(可选)
|
|
192
|
-
bo.setAssigneeMap(Map.of(
|
|
193
|
-
"pass:nodeCode", "user:1,user:2"
|
|
194
|
-
));
|
|
195
|
-
|
|
196
|
-
flwTaskService.completeTask(bo);
|
|
197
|
-
}
|
|
105
|
+
CompleteTaskBo bo = new CompleteTaskBo();
|
|
106
|
+
bo.setTaskId(taskId);
|
|
107
|
+
bo.setMessage("同意");
|
|
108
|
+
bo.setVariables(Map.of("approved", true));
|
|
109
|
+
bo.setAssigneeMap(Map.of("pass:nodeCode", "user:1,user:2")); // 可选:指定下一节点办理人
|
|
110
|
+
flwTaskService.completeTask(bo);
|
|
198
111
|
```
|
|
199
112
|
|
|
200
|
-
### 3.
|
|
113
|
+
### 3.3 驳回
|
|
201
114
|
|
|
202
115
|
```java
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
flwTaskService.backProcess(bo);
|
|
210
|
-
}
|
|
116
|
+
BackProcessBo bo = new BackProcessBo();
|
|
117
|
+
bo.setTaskId(taskId);
|
|
118
|
+
bo.setNodeCode("apply_node");
|
|
119
|
+
bo.setMessage("资料不完整");
|
|
120
|
+
flwTaskService.backProcess(bo);
|
|
211
121
|
```
|
|
212
122
|
|
|
213
|
-
### 4
|
|
123
|
+
### 3.4 转办 / 委派 / 加签 / 减签
|
|
214
124
|
|
|
215
125
|
```java
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
126
|
+
TaskOperationBo bo = new TaskOperationBo();
|
|
127
|
+
bo.setTaskId(taskId);
|
|
128
|
+
bo.setUserId("targetUserId");
|
|
129
|
+
bo.setMessage("转交处理");
|
|
130
|
+
|
|
131
|
+
// 转办(转给他人,自己不再参与)
|
|
132
|
+
flwTaskService.taskOperation(bo, FlowConstant.TRANSFER_TASK);
|
|
133
|
+
|
|
134
|
+
// 委派(委托代办,最终还需自己确认)
|
|
135
|
+
flwTaskService.taskOperation(bo, FlowConstant.DELEGATE_TASK);
|
|
136
|
+
|
|
137
|
+
// 加签 / 减签
|
|
138
|
+
bo.setUserIds(List.of("user1", "user2"));
|
|
139
|
+
flwTaskService.taskOperation(bo, FlowConstant.ADD_SIGNATURE);
|
|
140
|
+
flwTaskService.taskOperation(bo, FlowConstant.REDUCTION_SIGNATURE);
|
|
229
141
|
```
|
|
230
142
|
|
|
231
|
-
### 5
|
|
143
|
+
### 3.5 查询任务
|
|
232
144
|
|
|
233
145
|
```java
|
|
234
|
-
//
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
flwTaskService.taskOperation(addBo, FlowConstant.ADD_SIGNATURE);
|
|
240
|
-
|
|
241
|
-
// 减签(减少办理人)
|
|
242
|
-
TaskOperationBo reduceBo = new TaskOperationBo();
|
|
243
|
-
reduceBo.setTaskId(taskId);
|
|
244
|
-
reduceBo.setUserIds(List.of("user1"));
|
|
245
|
-
reduceBo.setMessage("减少会签人员");
|
|
246
|
-
flwTaskService.taskOperation(reduceBo, FlowConstant.REDUCTION_SIGNATURE);
|
|
146
|
+
flwTaskService.pageByTaskWait(bo, pageQuery); // 当前用户待办
|
|
147
|
+
flwTaskService.pageByTaskFinish(bo, pageQuery); // 当前用户已办
|
|
148
|
+
flwTaskService.pageByAllTaskWait(bo, pageQuery); // 所有待办(管理员)
|
|
149
|
+
flwTaskService.pageByAllTaskFinish(bo, pageQuery); // 所有已办(管理员)
|
|
150
|
+
flwTaskService.pageByTaskCopy(bo, pageQuery); // 抄送任务
|
|
247
151
|
```
|
|
248
152
|
|
|
249
153
|
---
|
|
250
154
|
|
|
251
|
-
##
|
|
252
|
-
|
|
253
|
-
### 1. 监听流程事件
|
|
155
|
+
## 四、业务集成 - 事件监听
|
|
254
156
|
|
|
255
157
|
> 事件类位于 `org.dromara.common.core.domain.event` 包
|
|
256
158
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
159
|
+
| 事件类 | 触发时机 | 主要字段 |
|
|
160
|
+
|-------|---------|---------|
|
|
161
|
+
| `ProcessEvent` | 流程状态变更 | flowCode, businessId, status, submit |
|
|
162
|
+
| `ProcessTaskEvent` | 任务创建 | flowCode, businessId, taskId, nodeCode |
|
|
163
|
+
| `ProcessDeleteEvent` | 流程删除 | flowCode, businessId |
|
|
262
164
|
|
|
165
|
+
```java
|
|
263
166
|
@Component
|
|
264
167
|
public class OrderWorkflowListener {
|
|
265
168
|
|
|
266
|
-
/**
|
|
267
|
-
* 监听流程状态变更
|
|
268
|
-
*/
|
|
269
169
|
@EventListener(condition = "#event.flowCode == 'order_approve'")
|
|
270
170
|
public void onProcessEvent(ProcessEvent event) {
|
|
271
171
|
String businessId = event.getBusinessId();
|
|
272
|
-
|
|
273
|
-
boolean isSubmit = event.isSubmit();
|
|
274
|
-
|
|
275
|
-
// 申请人提交
|
|
276
|
-
if (isSubmit) {
|
|
172
|
+
if (event.isSubmit()) {
|
|
277
173
|
orderService.updateStatus(businessId, "PENDING");
|
|
278
174
|
return;
|
|
279
175
|
}
|
|
280
|
-
|
|
281
|
-
// 根据流程状态更新业务数据
|
|
282
|
-
switch (status) {
|
|
176
|
+
switch (event.getStatus()) {
|
|
283
177
|
case "finish" -> orderService.updateStatus(businessId, "APPROVED");
|
|
284
178
|
case "back" -> orderService.updateStatus(businessId, "REJECTED");
|
|
285
179
|
case "cancel" -> orderService.updateStatus(businessId, "CANCELLED");
|
|
@@ -288,389 +182,140 @@ public class OrderWorkflowListener {
|
|
|
288
182
|
}
|
|
289
183
|
}
|
|
290
184
|
|
|
291
|
-
/**
|
|
292
|
-
* 监听任务创建(发送通知)
|
|
293
|
-
*/
|
|
294
185
|
@EventListener(condition = "#event.flowCode == 'order_approve'")
|
|
295
186
|
public void onTaskCreated(ProcessTaskEvent event) {
|
|
296
|
-
|
|
297
|
-
String businessId = event.getBusinessId();
|
|
298
|
-
// 获取待办人并发送通知
|
|
299
|
-
sendNotification(taskId);
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* 监听流程删除
|
|
304
|
-
*/
|
|
305
|
-
@EventListener(condition = "#event.flowCode == 'order_approve'")
|
|
306
|
-
public void onProcessDeleted(ProcessDeleteEvent event) {
|
|
307
|
-
String businessId = event.getBusinessId();
|
|
308
|
-
// 清理业务相关数据
|
|
309
|
-
orderService.cleanupWorkflowData(businessId);
|
|
187
|
+
sendNotification(event.getTaskId());
|
|
310
188
|
}
|
|
311
189
|
}
|
|
312
190
|
```
|
|
313
191
|
|
|
314
|
-
### 2. 事件类型说明
|
|
315
|
-
|
|
316
|
-
| 事件类 | 触发时机 | 主要字段 |
|
|
317
|
-
|-------|---------|---------|
|
|
318
|
-
| `ProcessEvent` | 流程状态变更(提交、通过、驳回、撤销、终止、作废、完成) | flowCode, businessId, status, submit |
|
|
319
|
-
| `ProcessTaskEvent` | 任务创建时 | flowCode, businessId, taskId, nodeCode |
|
|
320
|
-
| `ProcessDeleteEvent` | 流程删除时 | flowCode, businessId |
|
|
321
|
-
|
|
322
|
-
### 3. 查询待办/已办任务
|
|
323
|
-
|
|
324
|
-
```java
|
|
325
|
-
@Autowired
|
|
326
|
-
private IFlwTaskService flwTaskService;
|
|
327
|
-
|
|
328
|
-
// 查询当前用户待办任务
|
|
329
|
-
public TableDataInfo<FlowTaskVo> getTodoList(FlowTaskBo bo, PageQuery pageQuery) {
|
|
330
|
-
return flwTaskService.pageByTaskWait(bo, pageQuery);
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
// 查询当前用户已办任务
|
|
334
|
-
public TableDataInfo<FlowHisTaskVo> getDoneList(FlowTaskBo bo, PageQuery pageQuery) {
|
|
335
|
-
return flwTaskService.pageByTaskFinish(bo, pageQuery);
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
// 查询所有待办任务(管理员)
|
|
339
|
-
public TableDataInfo<FlowTaskVo> getAllTodoList(FlowTaskBo bo, PageQuery pageQuery) {
|
|
340
|
-
return flwTaskService.pageByAllTaskWait(bo, pageQuery);
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
// 查询所有已办任务(管理员)
|
|
344
|
-
public TableDataInfo<FlowHisTaskVo> getAllDoneList(FlowTaskBo bo, PageQuery pageQuery) {
|
|
345
|
-
return flwTaskService.pageByAllTaskFinish(bo, pageQuery);
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
// 查询抄送任务
|
|
349
|
-
public TableDataInfo<FlowTaskVo> getCopyList(FlowTaskBo bo, PageQuery pageQuery) {
|
|
350
|
-
return flwTaskService.pageByTaskCopy(bo, pageQuery);
|
|
351
|
-
}
|
|
352
|
-
```
|
|
353
|
-
|
|
354
192
|
---
|
|
355
193
|
|
|
356
|
-
##
|
|
194
|
+
## 五、全局监听器 WorkflowGlobalListener
|
|
357
195
|
|
|
358
|
-
|
|
196
|
+
实现 `GlobalListener` 接口,在任务生命周期关键节点执行:
|
|
359
197
|
|
|
360
198
|
```java
|
|
361
|
-
package org.dromara.workflow.listener;
|
|
362
|
-
|
|
363
|
-
import org.dromara.warm.flow.core.listener.GlobalListener;
|
|
364
|
-
import org.dromara.warm.flow.core.listener.ListenerVariable;
|
|
365
|
-
|
|
366
199
|
@Component
|
|
367
200
|
public class WorkflowGlobalListener implements GlobalListener {
|
|
368
|
-
|
|
369
201
|
@Override
|
|
370
|
-
public void create(ListenerVariable
|
|
371
|
-
// 任务创建时执行
|
|
372
|
-
}
|
|
202
|
+
public void create(ListenerVariable var) { /* 任务创建 */ }
|
|
373
203
|
|
|
374
204
|
@Override
|
|
375
|
-
public void start(ListenerVariable
|
|
376
|
-
//
|
|
377
|
-
|
|
378
|
-
String
|
|
379
|
-
Map<String, Object> variable = listenerVariable.getVariable();
|
|
380
|
-
// 解析节点扩展配置...
|
|
205
|
+
public void start(ListenerVariable var) {
|
|
206
|
+
// 任务开始办理:处理抄送、自定义变量
|
|
207
|
+
String ext = var.getNode().getExt();
|
|
208
|
+
Map<String, Object> variable = var.getVariable();
|
|
381
209
|
}
|
|
382
210
|
|
|
383
211
|
@Override
|
|
384
|
-
public void assignment(ListenerVariable
|
|
385
|
-
//
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
FlowParams flowParams = listenerVariable.getFlowParams();
|
|
389
|
-
// 处理办理人权限...
|
|
212
|
+
public void assignment(ListenerVariable var) {
|
|
213
|
+
// 分派:动态修改待办任务的办理人
|
|
214
|
+
List<Task> nextTasks = var.getNextTasks();
|
|
215
|
+
FlowParams flowParams = var.getFlowParams();
|
|
390
216
|
}
|
|
391
217
|
|
|
392
218
|
@Override
|
|
393
|
-
public void finish(ListenerVariable
|
|
394
|
-
//
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
Definition definition = listenerVariable.getDefinition();
|
|
398
|
-
// 发布流程事件...
|
|
219
|
+
public void finish(ListenerVariable var) {
|
|
220
|
+
// 完成:状态更新、消息通知、事件发布
|
|
221
|
+
Instance instance = var.getInstance();
|
|
222
|
+
Definition definition = var.getDefinition();
|
|
399
223
|
}
|
|
400
224
|
}
|
|
401
225
|
```
|
|
402
226
|
|
|
403
227
|
---
|
|
404
228
|
|
|
405
|
-
##
|
|
229
|
+
## 六、流程常量 FlowConstant
|
|
406
230
|
|
|
407
231
|
```java
|
|
408
232
|
package org.dromara.workflow.common.constant;
|
|
409
233
|
|
|
410
234
|
public interface FlowConstant {
|
|
411
|
-
//
|
|
412
|
-
String
|
|
413
|
-
String
|
|
414
|
-
String
|
|
415
|
-
|
|
416
|
-
String
|
|
417
|
-
|
|
418
|
-
// 任务操作类型
|
|
419
|
-
String DELEGATE_TASK = "delegateTask"; // 委托任务
|
|
420
|
-
String TRANSFER_TASK = "transferTask"; // 转办任务
|
|
235
|
+
String INITIATOR = "initiator"; // 发起人
|
|
236
|
+
String INITIATOR_DEPT_ID = "initiatorDeptId"; // 发起人部门
|
|
237
|
+
String BUSINESS_ID = "businessId";
|
|
238
|
+
String SUBMIT = "submit"; // 提交标识
|
|
239
|
+
|
|
240
|
+
String DELEGATE_TASK = "delegateTask"; // 委托
|
|
241
|
+
String TRANSFER_TASK = "transferTask"; // 转办
|
|
421
242
|
String ADD_SIGNATURE = "addSignature"; // 加签
|
|
422
243
|
String REDUCTION_SIGNATURE = "reductionSignature"; // 减签
|
|
423
244
|
|
|
424
|
-
// 抄送与消息
|
|
425
245
|
String FLOW_COPY_LIST = "flowCopyList"; // 抄送人列表
|
|
426
|
-
String MESSAGE_TYPE = "messageType";
|
|
427
|
-
String MESSAGE_NOTICE = "messageNotice";
|
|
428
|
-
|
|
429
|
-
// 自动化配置
|
|
430
|
-
String AUTO_PASS = "autoPass"; // 自动通过标识
|
|
246
|
+
String MESSAGE_TYPE = "messageType";
|
|
247
|
+
String MESSAGE_NOTICE = "messageNotice";
|
|
248
|
+
String AUTO_PASS = "autoPass"; // 自动通过
|
|
431
249
|
|
|
432
|
-
// 流程分类
|
|
433
|
-
String CATEGORY_ID_TO_NAME = "category_id_to_name";
|
|
434
|
-
String FLOW_CATEGORY_NAME = "flow_category_name#30d";
|
|
435
|
-
Long FLOW_CATEGORY_ID = 100L; // 默认租户OA申请分类id
|
|
436
|
-
|
|
437
|
-
// 任务状态字典
|
|
438
|
-
String WF_TASK_STATUS = "wf_task_status";
|
|
439
|
-
|
|
440
|
-
// 忽略标识(高级配置)
|
|
441
250
|
String VAR_IGNORE = "ignore"; // 忽略办理权限校验
|
|
442
|
-
String VAR_IGNORE_DEPUTE = "ignoreDepute";
|
|
443
|
-
String VAR_IGNORE_COOPERATE = "ignoreCooperate";
|
|
251
|
+
String VAR_IGNORE_DEPUTE = "ignoreDepute";
|
|
252
|
+
String VAR_IGNORE_COOPERATE = "ignoreCooperate";
|
|
444
253
|
}
|
|
445
254
|
```
|
|
446
255
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
## 消息通知
|
|
450
|
-
|
|
451
|
-
### 通知类型
|
|
452
|
-
|
|
453
|
-
```java
|
|
454
|
-
package org.dromara.workflow.common.enums;
|
|
455
|
-
|
|
456
|
-
public enum MessageTypeEnum {
|
|
457
|
-
SYSTEM_MESSAGE("1", "站内信"),
|
|
458
|
-
EMAIL_MESSAGE("2", "邮箱"),
|
|
459
|
-
SMS_MESSAGE("3", "短信");
|
|
460
|
-
|
|
461
|
-
private final String code;
|
|
462
|
-
private final String desc;
|
|
463
|
-
}
|
|
464
|
-
```
|
|
465
|
-
|
|
466
|
-
### 配置消息通知
|
|
467
|
-
|
|
468
|
-
在流程变量中设置:
|
|
256
|
+
### 消息通知
|
|
469
257
|
|
|
470
258
|
```java
|
|
259
|
+
// MessageTypeEnum: "1"=站内信, "2"=邮箱, "3"=短信
|
|
471
260
|
Map<String, Object> variable = new HashMap<>();
|
|
472
|
-
variable.put(FlowConstant.MESSAGE_TYPE, List.of("1", "2"));
|
|
261
|
+
variable.put(FlowConstant.MESSAGE_TYPE, List.of("1", "2"));
|
|
473
262
|
variable.put(FlowConstant.MESSAGE_NOTICE, "您有新的审批任务");
|
|
474
263
|
```
|
|
475
264
|
|
|
476
265
|
---
|
|
477
266
|
|
|
478
|
-
## API
|
|
267
|
+
## 七、API 接口速查
|
|
479
268
|
|
|
480
|
-
###
|
|
269
|
+
### 任务 /workflow/task
|
|
481
270
|
|
|
482
271
|
| 接口 | 方法 | 说明 |
|
|
483
272
|
|------|------|------|
|
|
484
273
|
| `/startWorkFlow` | POST | 启动流程 |
|
|
485
274
|
| `/completeTask` | POST | 办理任务 |
|
|
486
|
-
| `/backProcess` | POST |
|
|
487
|
-
| `/pageByTaskWait` | GET |
|
|
488
|
-
| `/pageByTaskFinish` | GET |
|
|
489
|
-
| `/
|
|
490
|
-
| `/
|
|
491
|
-
| `/pageByTaskCopy` | GET | 当前用户抄送任务 |
|
|
492
|
-
| `/{taskId}` | GET | 根据 taskId 查询任务详情 |
|
|
493
|
-
| `/getNextNodeList` | POST | 获取下一节点信息 |
|
|
494
|
-
| `/{taskId}/{nowNodeCode}` | GET | 获取可驳回的前置节点 |
|
|
275
|
+
| `/backProcess` | POST | 驳回 |
|
|
276
|
+
| `/pageByTaskWait` | GET | 当前用户待办 |
|
|
277
|
+
| `/pageByTaskFinish` | GET | 当前用户已办 |
|
|
278
|
+
| `/pageByTaskCopy` | GET | 抄送任务 |
|
|
279
|
+
| `/getNextNodeList` | POST | 下一节点信息 |
|
|
495
280
|
| `/terminationTask` | POST | 终止流程 |
|
|
496
|
-
| `/{taskOperation}` | POST |
|
|
497
|
-
| `/
|
|
498
|
-
| `/updateAssignee/{userId}` | PUT | 修改任务办理人 |
|
|
499
|
-
| `/urgeTask` | POST | 催办任务 |
|
|
281
|
+
| `/{taskOperation}` | POST | 委派/转办/加签/减签 |
|
|
282
|
+
| `/urgeTask` | POST | 催办 |
|
|
500
283
|
|
|
501
|
-
###
|
|
284
|
+
### 实例 /workflow/instance
|
|
502
285
|
|
|
503
286
|
| 接口 | 方法 | 说明 |
|
|
504
287
|
|------|------|------|
|
|
505
|
-
| `/pageByRunning` | GET |
|
|
506
|
-
| `/pageByFinish` | GET |
|
|
507
|
-
| `/pageByCurrent` | GET |
|
|
508
|
-
| `/
|
|
509
|
-
| `/
|
|
510
|
-
| `/
|
|
511
|
-
| `/invalid` | POST | 作废流程 |
|
|
512
|
-
| `/deleteByBusinessIds/{businessIds}` | DELETE | 按业务ID删除实例 |
|
|
513
|
-
| `/deleteByInstanceIds/{instanceIds}` | DELETE | 按实例ID删除实例 |
|
|
514
|
-
| `/deleteHisByInstanceIds/{instanceIds}` | DELETE | 删除已完成的实例 |
|
|
515
|
-
| `/instanceVariable/{instanceId}` | GET | 获取流程变量 |
|
|
516
|
-
| `/updateVariable` | PUT | 更新流程变量 |
|
|
517
|
-
| `/active/{id}` | PUT | 激活/挂起流程实例 |
|
|
518
|
-
|
|
519
|
-
### 流程定义 (/workflow/definition)
|
|
288
|
+
| `/pageByRunning` | GET | 运行中实例 |
|
|
289
|
+
| `/pageByFinish` | GET | 已完成实例 |
|
|
290
|
+
| `/pageByCurrent` | GET | 当前用户发起 |
|
|
291
|
+
| `/cancelProcessApply` | PUT | 撤销申请 |
|
|
292
|
+
| `/invalid` | POST | 作废 |
|
|
293
|
+
| `/flowHisTaskList/{businessId}` | GET | 流程图+审批记录 |
|
|
520
294
|
|
|
521
|
-
|
|
522
|
-
|------|------|------|
|
|
523
|
-
| `/list` | GET | 查询已发布的流程定义 |
|
|
524
|
-
| `/unPublishList` | GET | 查询未发布的流程定义 |
|
|
525
|
-
| `/{id}` | GET | 获取流程定义详情 |
|
|
526
|
-
| `/` | POST | 新增流程定义 |
|
|
527
|
-
| `/` | PUT | 修改流程定义 |
|
|
528
|
-
| `/publish/{id}` | PUT | 发布流程定义 |
|
|
529
|
-
| `/unPublish/{id}` | PUT | 取消发布流程定义 |
|
|
530
|
-
| `/{ids}` | DELETE | 删除流程定义 |
|
|
531
|
-
| `/copy/{id}` | POST | 复制流程定义 |
|
|
532
|
-
| `/importDef` | POST | 导入流程定义 |
|
|
533
|
-
| `/exportDef/{id}` | POST | 导出流程定义 |
|
|
534
|
-
| `/xmlString/{id}` | GET | 获取定义 JSON 字符串 |
|
|
535
|
-
| `/active/{id}` | PUT | 激活/挂起流程定义 |
|
|
536
|
-
|
|
537
|
-
### 流程分类 (/workflow/category)
|
|
295
|
+
### 定义 /workflow/definition
|
|
538
296
|
|
|
539
297
|
| 接口 | 方法 | 说明 |
|
|
540
298
|
|------|------|------|
|
|
541
|
-
| `/list` | GET |
|
|
542
|
-
| `/
|
|
543
|
-
| `/{
|
|
544
|
-
|
|
|
545
|
-
|
|
|
546
|
-
| `/{
|
|
547
|
-
| `/categoryTree` | GET | 获取分类树列表 |
|
|
299
|
+
| `/list` | GET | 已发布定义 |
|
|
300
|
+
| `/publish/{id}` | PUT | 发布 |
|
|
301
|
+
| `/unPublish/{id}` | PUT | 取消发布 |
|
|
302
|
+
| `/copy/{id}` | POST | 复制 |
|
|
303
|
+
| `/importDef` | POST | 导入 |
|
|
304
|
+
| `/exportDef/{id}` | POST | 导出 |
|
|
548
305
|
|
|
549
306
|
---
|
|
550
307
|
|
|
551
|
-
##
|
|
308
|
+
## 八、核心文件位置
|
|
552
309
|
|
|
553
310
|
```
|
|
554
311
|
ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/
|
|
555
|
-
├── controller/
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
├──
|
|
563
|
-
|
|
564
|
-
│ ├── IFlwInstanceService.java
|
|
565
|
-
│ ├── IFlwDefinitionService.java
|
|
566
|
-
│ ├── IFlwCategoryService.java
|
|
567
|
-
│ ├── IFlwSpelService.java
|
|
568
|
-
│ ├── IFlwTaskAssigneeService.java
|
|
569
|
-
│ ├── IFlwNodeExtService.java
|
|
570
|
-
│ ├── IFlwCommonService.java
|
|
571
|
-
│ ├── ITestLeaveService.java
|
|
572
|
-
│ └── impl/
|
|
573
|
-
│ ├── FlwTaskServiceImpl.java
|
|
574
|
-
│ ├── FlwInstanceServiceImpl.java
|
|
575
|
-
│ ├── FlwDefinitionServiceImpl.java
|
|
576
|
-
│ ├── FlwCategoryServiceImpl.java
|
|
577
|
-
│ ├── FlwSpelServiceImpl.java
|
|
578
|
-
│ ├── FlwTaskAssigneeServiceImpl.java
|
|
579
|
-
│ ├── FlwNodeExtServiceImpl.java
|
|
580
|
-
│ ├── FlwCommonServiceImpl.java
|
|
581
|
-
│ ├── TestLeaveServiceImpl.java
|
|
582
|
-
│ └── WorkflowServiceImpl.java # 通用工作流服务
|
|
583
|
-
├── mapper/ # Mapper 层(非 DAO)
|
|
584
|
-
│ ├── FlwCategoryMapper.java
|
|
585
|
-
│ ├── FlwSpelMapper.java
|
|
586
|
-
│ ├── FlwTaskMapper.java
|
|
587
|
-
│ ├── FlwInstanceMapper.java
|
|
588
|
-
│ ├── FlwInstanceBizExtMapper.java
|
|
589
|
-
│ └── TestLeaveMapper.java
|
|
590
|
-
├── listener/
|
|
591
|
-
│ └── WorkflowGlobalListener.java # 全局监听器
|
|
592
|
-
├── handler/
|
|
593
|
-
│ ├── FlowProcessEventHandler.java # 事件发布
|
|
594
|
-
│ └── WorkflowPermissionHandler.java # 权限处理
|
|
595
|
-
├── rule/
|
|
596
|
-
│ └── SpelRuleComponent.java # SpEL 规则组件
|
|
597
|
-
├── domain/
|
|
598
|
-
│ ├── FlowCategory.java
|
|
599
|
-
│ ├── FlowSpel.java
|
|
600
|
-
│ ├── FlowInstanceBizExt.java
|
|
601
|
-
│ ├── TestLeave.java
|
|
602
|
-
│ ├── bo/ # 业务对象
|
|
603
|
-
│ │ ├── StartProcessBo.java
|
|
604
|
-
│ │ ├── CompleteTaskBo.java
|
|
605
|
-
│ │ ├── BackProcessBo.java
|
|
606
|
-
│ │ ├── TaskOperationBo.java
|
|
607
|
-
│ │ └── ...
|
|
608
|
-
│ └── vo/ # 视图对象
|
|
609
|
-
│ ├── FlowTaskVo.java
|
|
610
|
-
│ ├── FlowHisTaskVo.java
|
|
611
|
-
│ ├── FlowInstanceVo.java
|
|
612
|
-
│ └── ...
|
|
613
|
-
├── config/
|
|
614
|
-
│ └── WarmFlowConfig.java # WarmFlow 配置
|
|
615
|
-
└── common/
|
|
616
|
-
├── ConditionalOnEnable.java # 条件注解
|
|
617
|
-
├── constant/
|
|
618
|
-
│ └── FlowConstant.java # 常量
|
|
619
|
-
└── enums/
|
|
620
|
-
├── TaskStatusEnum.java # 任务状态
|
|
621
|
-
├── TaskAssigneeEnum.java # 办理人类型
|
|
622
|
-
├── TaskAssigneeType.java # 办理人类型扩展
|
|
623
|
-
├── MessageTypeEnum.java # 消息类型
|
|
624
|
-
├── ButtonPermissionEnum.java # 按钮权限
|
|
625
|
-
├── CopySettingEnum.java # 抄送设置
|
|
626
|
-
├── NodeExtEnum.java # 节点扩展
|
|
627
|
-
└── VariablesEnum.java # 变量枚举
|
|
628
|
-
```
|
|
629
|
-
|
|
630
|
-
---
|
|
631
|
-
|
|
632
|
-
## 检查清单
|
|
633
|
-
|
|
634
|
-
- [ ] 是否正确使用 `FlowEngine` 访问核心服务?
|
|
635
|
-
- [ ] 是否使用 `ProcessEvent`/`ProcessTaskEvent` 监听流程状态变更?
|
|
636
|
-
- [ ] 是否正确配置办理人(注意:用户ID无前缀,角色/部门/岗位有前缀)?
|
|
637
|
-
- [ ] 是否在业务模块中正确集成 `WorkflowService`?
|
|
638
|
-
- [ ] 是否处理了流程各状态(通过、驳回、撤销、终止)的业务逻辑?
|
|
639
|
-
- [ ] 是否配置了消息通知(SSE/邮件/短信)?
|
|
640
|
-
- [ ] API 方法名是否使用 pageBy* 命名规范(如 pageByTaskWait)?
|
|
641
|
-
|
|
642
|
-
---
|
|
643
|
-
|
|
644
|
-
## 常见问题
|
|
645
|
-
|
|
646
|
-
### Q1: 用户ID和角色ID在办理人配置中的区别?
|
|
647
|
-
|
|
648
|
-
```java
|
|
649
|
-
// ✅ 用户ID - 无前缀
|
|
650
|
-
"123" // 直接是用户ID
|
|
651
|
-
|
|
652
|
-
// ✅ 角色ID - 有 role: 前缀
|
|
653
|
-
"role:456" // 角色ID
|
|
654
|
-
|
|
655
|
-
// ✅ 部门ID - 有 dept: 前缀
|
|
656
|
-
"dept:789" // 部门ID
|
|
657
|
-
|
|
658
|
-
// ✅ 岗位ID - 有 post: 前缀
|
|
659
|
-
"post:101" // 岗位ID
|
|
660
|
-
```
|
|
661
|
-
|
|
662
|
-
### Q2: 如何判断是否为 SpEL 表达式?
|
|
663
|
-
|
|
664
|
-
```java
|
|
665
|
-
// SpEL 表达式以 # 或 $ 开头
|
|
666
|
-
TaskAssigneeEnum.isSpelExpression("#{initiator}") // true
|
|
667
|
-
TaskAssigneeEnum.isSpelExpression("${deptLeader}") // true
|
|
668
|
-
TaskAssigneeEnum.isSpelExpression("user:123") // false
|
|
669
|
-
```
|
|
670
|
-
|
|
671
|
-
### Q3: 如何忽略办理权限校验?
|
|
672
|
-
|
|
673
|
-
```java
|
|
674
|
-
Map<String, Object> variable = new HashMap<>();
|
|
675
|
-
variable.put(FlowConstant.VAR_IGNORE, true); // 忽略办理权限校验
|
|
312
|
+
├── controller/ # FlwTaskController, FlwInstanceController, FlwDefinitionController
|
|
313
|
+
├── service/impl/ # FlwTaskServiceImpl, WorkflowServiceImpl
|
|
314
|
+
├── mapper/ # FlwTaskMapper, FlwInstanceMapper
|
|
315
|
+
├── listener/ # WorkflowGlobalListener
|
|
316
|
+
├── handler/ # FlowProcessEventHandler, WorkflowPermissionHandler
|
|
317
|
+
├── domain/bo/ # StartProcessBo, CompleteTaskBo, BackProcessBo, TaskOperationBo
|
|
318
|
+
├── domain/vo/ # FlowTaskVo, FlowHisTaskVo, FlowInstanceVo
|
|
319
|
+
├── common/constant/ # FlowConstant
|
|
320
|
+
└── common/enums/ # TaskStatusEnum, TaskAssigneeEnum, MessageTypeEnum
|
|
676
321
|
```
|