<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
</dependency>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
</dependency>
1 发布流程
http://localhost:9020/engine-rest/deployment/create
传递你的bpmn名称,通过file类型选择bpmn文件
2 获取进程定义
http://localhost:9020/engine-rest/process-definition
"
id
"
:
"
Process_1xebez9:1:7929ac88-64ac-11ed-946f-0892043f3120
"
,
"
key
"
:
"
Process_1xebez9
"
,
"
category
"
:
"
http://bpmn.io/schema/bpmn
"
,
"
description
"
:
null
,
"
name
"
:
"
customerAudit
"
,
"
version
"
:
1
,
"
resource
"
:
"
customerAudit.bpmn
"
,
"
deploymentId
"
:
"
7924f196-64ac-11ed-946f-0892043f3120
"
,
"
diagram
"
:
null
,
"
suspended
"
:
false
,
"
tenantId
"
:
null
,
"
versionTag
"
:
null
,
"
historyTimeToLive
"
:
null
,
"
startableInTasklist
"
:
true
"
id
"
:
"
audit_process:1:57b07816-63fa-11ed-ae19-0892043f3120
"
,
"
key
"
:
"
audit_process
"
,
"
category
"
:
"
http://bpmn.io/schema/bpmn
"
,
"
description
"
:
null
,
"
name
"
:
"
Audit Process
"
,
"
version
"
:
1
,
"
resource
"
:
"
audit.bpmn
"
,
"
deploymentId
"
:
"
579a30f3-63fa-11ed-ae19-0892043f3120
"
,
"
diagram
"
:
null
,
"
suspended
"
:
false
,
"
tenantId
"
:
null
,
"
versionTag
"
:
null
,
"
historyTimeToLive
"
:
null
,
"
startableInTasklist
"
:
true
3 启动流程
http://localhost:9020/engine-rest/process-definition/Process_1xebez9:1:7929ac88-64ac-11ed-946f-0892043f3120/start
上面的Id就是来自步骤2的id
这里我传递了审批人(流程界面中,设置了${adminList} ${mpmList})
${adminList}设置:
${mpmList}设置:
并且设置了businessKey
"
variables
"
: {
"
adminList
"
: {
"
value
"
:
"
[\"admin\"]
"
,
"
type
"
:
"
Object
"
,
"
valueInfo
"
:{
"
objectTypeName
"
:
"
java.util.ArrayList
"
,
"
serializationDataFormat
"
:
"
application/json
"
"
mpmList
"
: {
"
value
"
:
"
[\"mpm1\"]
"
,
"
type
"
:
"
Object
"
,
"
valueInfo
"
:{
"
objectTypeName
"
:
"
java.util.ArrayList
"
,
"
serializationDataFormat
"
:
"
application/json
"
"
businessKey
"
:
40
4 获取进程实例
http://localhost:9020/engine-rest/process-instance/1cef6cfa-64b3-11ed-946f-0892043f3120
上面的id,就是步骤3返回的id
5.1 获取待办任务 (某人&进程ID)
http://localhost:9020/engine-rest/task?assignee=mpm1&processInstanceId=1cef6cfa-64b3-11ed-946f-0892043f3120
5.2 获取待办任务 (某人)
http://localhost:9020/engine-rest/task?assignee=admin
5.3 获取待办任务 (BusinessKey)
http://localhost:9020/engine-rest/task?processInstanceBusinessKey=40
http://localhost:9020/engine-rest/task/ae952619-64bd-11ed-946f-0892043f3120/complete
由于taskid已经在url中传递了,所以审批人是可以确定的。
{"variables":
"approve": {"value": true},
"comment": {"value": "hello world112"}
"withVariablesInReturn": true