流程接口
流程接口用于管理流程定义和流程实例。
查询流程列表
请求
bash
GET /api/v1/flows参数
| 参数 | 类型 | 说明 |
|---|---|---|
| page | int | 页码 |
| size | int | 每页数量 |
| name | string | 流程名称 |
响应
json
{
"success": true,
"data": {
"content": [
{
"id": "flow001",
"name": "请假审批流程",
"code": "leave-flow",
"status": "active",
"createTime": "2024-01-15T10:00:00Z"
}
]
}
}获取流程详情
请求
bash
GET /api/v1/flows/{flowId}响应
json
{
"success": true,
"data": {
"id": "flow001",
"name": "请假审批流程",
"code": "leave-flow",
"nodes": [
{"id": "start", "type": "start", "name": "开始"},
{"id": "approve", "type": "userTask", "name": "审批"}
],
"flows": [{"source": "start", "target": "approve"}]
}
}创建流程
请求
bash
POST /api/v1/flows
Content-Type: application/json参数
json
{
"name": "请假审批流程",
"code": "leave-flow",
"formId": "form001",
"nodes": [
{"id": "start", "type": "start", "name": "开始"},
{"id": "approve", "type": "userTask", "name": "审批", "assignee": "manager"},
{"id": "end", "type": "end", "name": "结束"}
],
"flows": [
{"source": "start", "target": "approve"},
{"source": "approve", "target": "end"}
]
}更新流程
请求
bash
PUT /api/v1/flows/{flowId}
Content-Type: application/json删除流程
请求
bash
DELETE /api/v1/flows/{flowId}启动流程实例
请求
bash
POST /api/v1/flow-instances
Content-Type: application/json参数
json
{
"flowId": "flow001",
"formData": {
"applicant": "张三",
"leaveType": "personal",
"days": 3
}
}响应
json
{
"success": true,
"data": {
"id": "instance001",
"flowId": "flow001",
"status": "RUNNING",
"startTime": "2024-01-15T10:30:00Z"
}
}查询流程实例
请求
bash
GET /api/v1/flow-instances参数
| 参数 | 类型 | 说明 |
|---|---|---|
| flowId | string | 流程ID |
| status | string | 状态 |
| page | int | 页码 |
获取流程实例详情
请求
bash
GET /api/v1/flow-instances/{instanceId}完成任务
请求
bash
POST /api/v1/tasks/{taskId}/complete
Content-Type: application/json参数
json
{
"approved": true,
"comment": "同意"
}