
# 查询任务列表 - QueryTask
#### 功能介绍
查询任务列表。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-craftartsipdcenter/ipdcenter_06_0034.html)。
#### URI
POST /services/workflow/queryTaskList/{pageSize}/{curPage}
示例接口地址：{域名（有文根需带文根）}/pdmcore/ipdcworkflowservice/services/workflow/queryTaskList/2/1
表1路径参数 
| 参数       | 是否必选 | 参数类型   | 描述   |
|:---|:---|:---|:---|
| pageSize | 是    | String | 分页大小 |
| curPage  | 是    | String | 当前页数 |
   
#### 请求头
使用机机认证调用接口时需传入header：Authorization，其值为机机鉴权token。
#### 请求参数
表2请求body，筛选条件 
| 参数                       | 是否必选 | 参数类型             | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
|:---|:---|:---|:---|
| processInstanceStartTime | 否    | String           | 流程创建开始时间                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| processInstanceEndTime   | 否    | String           | 流程创建结束时间                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| createStartTime          | 否    | String           | 任务启动开始时间                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| createEndTime            | 否    | String           | 任务启动结束时间                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| processDefinitionId      | 否    | String           | 流程模板ID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| businessKeys             | 否    | String           | 业务流水号，多个以逗号隔开                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| processDefinitionName    | 否    | String           | 流程模板名称                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| processDefinitionNameCn  | 否    | String           | 流程模板名称中文                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| processDefinitionNames   | 否    | String           | 流程模板名称                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| taskDefinitionKey        | 否    | String           | 任务定义编码                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| taskDefinitionName       | 否    | String           | 任务定义名称                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| pageSize                 | 否    | Integer          | 每页的条数                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| curPage                  | 否    | Integer          | 当前页数                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| businessKey              | 否    | String           | 业务流水号                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| i18n                     | 否    | Integer          | 国际化标识                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| title                    | 否    | String           | 流程标题                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| titleCn                  | 否    | String           | 流程标题中文                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| titles                   | 否    | Array of strings | 流程标题列表                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| createdBy                | 否    | String           | 创建人                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| category                 | 否    | String           | 流程类型                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| lastUpdateName           | 否    | String           | 最后修改人                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| taskHandler              | 否    | String           | 任务处理人                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| requestSource            | 否    | String           | 请求源                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| startUserId              | 否    | String           | 发起流程的用户                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| lifeCycleState           | 否    | String           | 生命周期状态                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| sites                    | 否    | String           | 站点查询                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| state                    | 否    | String           |  任务状态： - SUSPENDED挂起  - ACTIVE已完成  - COMPLETED取消  - INTERNALLY_TERMINATED取消   |
| userId                   | 否    | String           | 用户                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
   
#### 响应参数
**状态码： 200**
表3响应Body参数 
| 参数       | 参数类型                                                                                                                | 描述               |
|:---|:---|:---|
| orderId  | String                                                                                                              | 请求跟踪流水号          |
| msg      | String                                                                                                              | 接口响应信息           |
| code     | Integer                                                                                                             | 接口返回码            |
| data     | Array of [HistoricProcessInstanceVO] objects | 接口响应数据，JSON对象或数组 |
| pageInfo | [PageVo] object                              | 标准响应体分页信息        |
   
 表4HistoricProcessInstanceVO 
| 参数                       | 参数类型             | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
|:---|:---|:---|
| processInstanceId        | String           | 流程实例ID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| processDefinitionId      | String           | 流程定义ID(拼接字段:流程模板key+版本+流程实例ID)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| processDefinitionName    | String           | 流程模板ID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| processDefinitionNameCn  | String           | 流程模板名称                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| businessKey              | String           | 业务流水号                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| taskDefinitionKey        | String           | 任务节点流水号                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| taskDefinitionName       | String           | 任务节点名称                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| startTime                | String           | 开始时间                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| title                    | String           | 流程标题                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| state                    | String           |  任务状态： - SUSPENDED挂起  - ACTIVE已完成  - COMPLETED取消  - INTERNALLY_TERMINATED取消                                                                                                                                                                                                    |
| lifeCycleState           | String           | 生命周期状态                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| handlers                 | String           | 处理人                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| userIds                  | String           | 用户ID集合                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| lastUpdateDate           | String           | 最后更新时间                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| suspensionState          | String           | 挂起状态： - **1未挂起**  - **2已挂起**                                                                                                                                                                                                                                                                                                                                                                                                                        |
| processInstanceStartTime | String           | 流程实例开始时间                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| processInstanceEndTime   | String           | 流程实例结束时间                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| createdBy                | String           | 创建人ID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| createdByName            | String           | 创建人账号                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| endTime                  | String           | 结束时间                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| tenantId                 | String           | 租户ID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| userId                   | String           | 用户ID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| createStartTime          | String           | 创建开始时间                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| createEndTime            | String           | 创建结束时间                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| createTaskTime           | String           | 任务创建时间                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| completeStartTime        | String           | 审批结束的开始时间                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| category                 | String           | 流程类型                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| completeEndTime          | String           | 审批结束的结束时间                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| transferSign             | String           | 代办标志：0代表全部我的代办，1代表可以转审的                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| taskId                   | String           | 任务ID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| startUserId              | String           | 启动用户ID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| startUserName            | String           | 启动用户名称                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| taskUrl                  | String           | 任务的URL                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| filterResult             | Array of strings | 定制返回结果                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| groupIdList              | Array of strings | group ID集合                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| sequenceCount            | Integer          | 序列数                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| lastUpdateBy             | String           | 最后更新人                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| lastUpdateName           | String           | 最后更新人名称                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| operationState           | String           | 流程操作状态： - **0** **初始化**  - **1** **已处理**  - **2已取消**  - **3已回收**  - **4已转审**  - **5转审给我的**   |
| site                     | String           | 引擎站点标识                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| dueDate                  | String           | 截止日期                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| groupIds                 | String           | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| lookUpId                 | String           | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| processStatus            | String           | 任务状态： - SUSPENDED挂起  - ACTIVE已完成  - COMPLETED取消  - INTERNALLY_TERMINATED取消                                                                                                                                                                                                 |
   
 表5PageVo 
| 参数         | 参数类型    | 描述       |
|:---|:---|:---|
| totalRows  | Integer | 总共有多少条数据 |
| curPage    | Integer | 当前是第几页   |
| pageSize   | Integer | 一页有多少条数据 |
| totalPages | Integer | 总共有多少页   |
   
#### 请求示例
入参包含userId则查对应user的任务，不包含则查当前登录用户的任务
```
{ 
  "userId" : "1008600000065234815" 
}
```
#### 响应示例
```
{
    "msg": null,
    "code": 0,
    "data": [
        {
            "processInstanceId": "f6483177-0a16-11f0-8e03-d24aa7462b46",
            "processDefinitionId": "Test20250326001:1:88c99420548b4f3bb3104329d136c35d",
            "processDefinitionName": "Test20250326001",
            "processDefinitionNameCn": "测试20250326001",
            "businessKey": "P10000031",
            "taskDefinitionKey": "Activity_0sqf3co",
            "taskDefinitionName": "用户任务001",
            "startTime": "2025-03-26T07:50:18.775+0000",
            "title": "Test20250326001_2025-03-26T15:50:18.552+0800",
            "state": "ACTIVE",
            "lifeCycleState": null,
            "handlers": "u.sysadmin",
            "userIds": "1000001",
            "lastUpdateDate": "2025-03-26T07:50:18.775+0000",
            "suspensionState": "1",
            "processInstanceStartTime": "2025-03-26T07:50:18.598+0000",
            "processInstanceEndTime": null,
            "createdBy": "sysadmin",
            "createdByName": "1000001",
            "endTime": null,
            "tenantId": "10000001",
            "userId": null,
            "createStartTime": null,
            "createEndTime": null,
            "createTaskTime": "2025-03-26T07:50:18.775+0000",
            "completeStartTime": null,
            "category": "http://bpmn.io/schema/bpmn",
            "completeEndTime": null,
            "transferSign": null,
            "taskId": "f6635aac-0a16-11f0-8e03-d24aa7462b46",
            "startUserId": "1000001",
            "startUserName": "1000001",
            "taskUrl": null,
            "groupIds": "",
            "lookUpId": null,
            "filterResult": null,
            "groupIdList": null,
            "sequenceCount": 1,
            "lastUpdateBy": "1000001",
            "lastUpdateName": "sysadmin",
            "operationState": null,
            "site": null,
            "dueDate": null,
            "processStatus": null
        },
        {
            "processInstanceId": "1a63945f-0a15-11f0-8e03-d24aa7462b46",
            "processDefinitionId": "Test20250326001:1:88c99420548b4f3bb3104329d136c35d",
            "processDefinitionName": "Test20250326001",
            "processDefinitionNameCn": "测试20250326001",
            "businessKey": "P10000030",
            "taskDefinitionKey": "Activity_0sqf3co",
            "taskDefinitionName": "用户任务001",
            "startTime": "2025-03-26T07:37:00.425+0000",
            "title": "Test20250326001_2025-03-26T15:37:00.131+0800",
            "state": "ACTIVE",
            "lifeCycleState": null,
            "handlers": "u.sysadmin",
            "userIds": "1000001",
            "lastUpdateDate": "2025-03-26T07:37:00.425+0000",
            "suspensionState": "1",
            "processInstanceStartTime": "2025-03-26T07:37:00.181+0000",
            "processInstanceEndTime": null,
            "createdBy": "sysadmin",
            "createdByName": "1000001",
            "endTime": null,
            "tenantId": "10000001",
            "userId": null,
            "createStartTime": null,
            "createEndTime": null,
            "createTaskTime": "2025-03-26T07:37:00.425+0000",
            "completeStartTime": null,
            "category": "http://bpmn.io/schema/bpmn",
            "completeEndTime": null,
            "transferSign": null,
            "taskId": "1a88cfb4-0a15-11f0-8e03-d24aa7462b46",
            "startUserId": "1000001",
            "startUserName": "1000001",
            "taskUrl": null,
            "groupIds": "",
            "lookUpId": null,
            "filterResult": null,
            "groupIdList": null,
            "sequenceCount": 1,
            "lastUpdateBy": "1000001",
            "lastUpdateName": "sysadmin",
            "operationState": null,
            "site": null,
            "dueDate": null,
            "processStatus": null
        }
    ],
    "pageInfo": {
        "totalRows": 12,
        "curPage": 1,
        "pageSize": 2,
        "totalPages": 6
    },
    "orderID": "4243cc3f-9ef6-42ae-a447-cad138df89fe"
}
```
#### 状态码
| 状态码 | 描述        |
|:---|:---|
| 200 | 带分页的标准响应体 |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-craftartsipdcenter/ErrorCode.html)。
