
# 创建任务调度（API名称：createTaskSchedule）
#### 功能介绍
创建任务调度。
#### 相关接口
| **接口名称**                                                             | **调用说明**                                                     |
|:---|:---|
| [获取Token](https://support.huaweicloud.com/api-isdp/api_01_0019.html) | 调用该接口获取到Token，再调用其他接口时，需要在请求消息头中添加"Authorization"，其值即为Token。 |
   
#### URL
| 请求方式 | HTTPS地址                                                              | 服务架构    | 消息体类型            |
|:---|:---|:---|:---|
| POST | https://***isdp+域名***/openapi/v1/openTaskSchedule/createTaskSchedule | OpenAPI | application/json |
   
#### 请求头
| **KEY**       | VALUE                  | 是否必填 | **描述**                                                                                           |
|:---|:---|:---|:---|
| Content-Type  | application/json       | 是    | 无                                                                                                |
| Authorization | bearer ${access_token} | 是    | bearer +" "+[5.2.1](https://support.huaweicloud.com/api-isdp/api_01_0019.html)中获取的access_token的值 |
   
#### 请求参数
| 参数               | 类型     | 是否必填 | 描述                                                                                                                                                                           |
|:---|:---|:---|:---|
| taskScheduleName | String | 是    | 任务调度名称。                                                                                                                                                                      |
| isEnable         | String | 是    | 是否启用。 - 1：启用  - 0：不启用   |
| taskBody         | Object | 是    | 任务详情。                                                                                                                                                                        |
   
taskBody参数
| 参数                         | 类型      | 是否必填  | 描述                                                                                                                                                                                                                                                                                                                                  |
|:---|:---|:---|:---|
| taskName                   | String  | 是     | 任务名称。                                                                                                                                                                                                                                                                                                                               |
| sceneName                  | String  | 是     | 任务场景名称。                                                                                                                                                                                                                                                                                                                             |
| sceneId                    | Long    | 是     | 任务场景ID。                                                                                                                                                                                                                                                                                                                             |
| signSiteId                 | Long    | 否     | 作业对象ID。                                                                                                                                                                                                                                                                                                                             |
| signSiteCode               | String  | 否     | 作业对象编码。                                                                                                                                                                                                                                                                                                                             |
| signSiteName               | String  | 否     | 作业对象名称。                                                                                                                                                                                                                                                                                                                             |
| projectNo                  | String  | 否     | 项目编码。                                                                                                                                                                                                                                                                                                                               |
| projectName                | String  | 否     | 项目名称。                                                                                                                                                                                                                                                                                                                               |
| supplierName               | String  | 否     | 供应商。                                                                                                                                                                                                                                                                                                                                |
| assignedUserId             | String  | 否     | 执行人ID。                                                                                                                                                                                                                                                                                                                              |
| assignedUserName           | String  | 否     | 执行人名称。                                                                                                                                                                                                                                                                                                                              |
| userGroup                  | String  | 否     | 执行人群组ID。                                                                                                                                                                                                                                                                                                                            |
| userGroupName              | String  | 否     | 执行人群组名称。                                                                                                                                                                                                                                                                                                                            |
| assignedUserType           | String  | **否** | 执行人类型。 - 1：用户  - 2：群组                                                                                                                                                    |
| assignedUser               | String  | **否** | 执行人账号。                                                                                                                                                                                                                                                                                                                              |
| beginTimestamp             | Long    | 否     | 计划开始时间。                                                                                                                                                                                                                                                                                                                             |
| endTimestamp               | Long    | 否     | 计划完成时间。                                                                                                                                                                                                                                                                                                                             |
| requiredStartTime          | Long    | 否     | 要求开始时间。                                                                                                                                                                                                                                                                                                                             |
| requiredEndTime            | Long    | 否     | 要求完成时间。                                                                                                                                                                                                                                                                                                                             |
| projectDuration            | String  | 否     | 工期。                                                                                                                                                                                                                                                                                                                                 |
| jobDuration                | String  | 否     | 标准时长。                                                                                                                                                                                                                                                                                                                               |
| adminOrganizationName      | String  | 是     | 管理组织单元名称。                                                                                                                                                                                                                                                                                                                           |
| adminOrganization          | String  | 是     | 管理组织单元编码。                                                                                                                                                                                                                                                                                                                           |
| administrativeDivision     | String  | 否     | 行政区域。                                                                                                                                                                                                                                                                                                                               |
| administrativeDivisionName | String  | 否     | 行政区域。                                                                                                                                                                                                                                                                                                                               |
| regionName                 | String  | 否     | 行政区域名称。                                                                                                                                                                                                                                                                                                                             |
| regionId                   | String  | 否     | 行政区域ID。                                                                                                                                                                                                                                                                                                                             |
| regionPath                 | String  | 否     | 行政区域路径。                                                                                                                                                                                                                                                                                                                             |
| skill                      | String  | **否** | 技能。                                                                                                                                                                                                                                                                                                                                 |
| address                    | String  | **否** | 详细地址。                                                                                                                                                                                                                                                                                                                               |
| templateId                 | Long    | 否     | 模板ID。                                                                                                                                                                                                                                                                                                                               |
| templateCode               | String  | 否     | 模板编码。                                                                                                                                                                                                                                                                                                                               |
| templateName               | String  | 否     | 模板名称。                                                                                                                                                                                                                                                                                                                               |
| version                    | String  | 否     | 版本。                                                                                                                                                                                                                                                                                                                                 |
| reviewRuleId               | Long    | 否     | 任务申请审批流ID。                                                                                                                                                                                                                                                                                                                          |
| reviewRuleName             | String  | 否     | 任务申请审批流名称。                                                                                                                                                                                                                                                                                                                          |
| taskRemark                 | String  | 否     | 任务备注。                                                                                                                                                                                                                                                                                                                               |
| isAppraisal                | String  | 否     | 任务是否需要审批。 - 0：不需要审批  - 1：需要审批                                                                                                                                             |
| collectionReviewId         | Long    | 否     | 采集审批流ID。                                                                                                                                                                                                                                                                                                                            |
| collectionReviewName       | String  | 否     | 采集审批流名称。                                                                                                                                                                                                                                                                                                                            |
| collectionProcessType      | String  | 否     | 采集审批流类型。 - 0：标准审批流  - 1：临时审批流  - 2：自定义审批流                                                                 |
| priority                   | String  | 否     | 优先级。                                                                                                                                                                                                                                                                                                                                |
| schedulingMode             | String  | 否     | 调度模式。                                                                                                                                                                                                                                                                                                                               |
| customerName               | String  | 否     | 客户名称。                                                                                                                                                                                                                                                                                                                               |
| customerId                 | String  | 否     | 客户ID。                                                                                                                                                                                                                                                                                                                               |
| operationGuideList         | List    | 否     | 操作指导。                                                                                                                                                                                                                                                                                                                               |
| attachmentList             | List    | 否     | 附件。                                                                                                                                                                                                                                                                                                                                 |
| taskMode                   | String  | 是     | 任务模式。 - 1：简单任务  - 2：任务下挂检查单                                                                                                                                               |
| saveDraft                  | String  | 是     | 保持草稿、提交。 - 0：保存草稿  - 1：提交                                                                                                                                                 |
| taskExtendList             | List    | **否** | 任务扩展属性。                                                                                                                                                                                                                                                                                                                             |
| scheduleType               | Integer | 否     | 调度类型。 - 1：周  - 2：月  - 3：日期  - 4：本月最后一天   |
| scheduleHour               | String  | 否     | 调度小时。                                                                                                                                                                                                                                                                                                                               |
| scheduleWeek               | String  | 否     | 调度周日期。                                                                                                                                                                                                                                                                                                                              |
| scheduleDay                | String  | 否     | 调度天。                                                                                                                                                                                                                                                                                                                                |
| cronExpr                   | String  | **否** | 调度表达式。                                                                                                                                                                                                                                                                                                                              |
| scheduleDayList            | List    | 否     | 调度日期。                                                                                                                                                                                                                                                                                                                               |
| plannedBeginType           | Integer | 否     | 计划开始时间类型。 - 0：当天  - 1：调度后                                                                                                                                            |
| beginNumberOfHours         | Integer | 否     | 计划开始时间多少小时后。                                                                                                                                                                                                                                                                                                                        |
| plannedCompletionType      | Integer | 否     | 计划结束时间类型。 - 0：当天  - 1：调度后                                                                                                                  |
| endNumberOfHours           | Integer | 否     | 计划完成时间多少小时后。                                                                                                                                                                                                                                                                                                                        |
| url                        | String  | 否     | 待办地址。                                                                                                                                                                                                                                                                                                                               |
| thirdUrl                   | String  | 否     | 第三方待办地址。                                                                                                                                                                                                                                                                                                                            |
| resource                   | String  | 否     | 数据源。                                                                                                                                                                                                                                                                                                                                |
| operUserId                 | Long    | 否     | 操作人ID。                                                                                                                                                                                                                                                                                                                              |
   
#### 响应参数
| 参数           | 类型     | 描述    |
|:---|:---|:---|
| stateCode    | String | 响应编码。 |
| errorMessage | String | 错误信息。 |
| result       | Object | 响应数据。 |
   
#### 请求示例
```
{
    "taskScheduleName": "zhangsan测试22222",
    "isEnable": "1",
    "taskBody": {
        "beginTimeBlur": false,
        "endTimeBlur": false,
        "issueId": 307892,
        "creatorDescribe": "处理人关闭",
        "label": {
            "location": "作业对象修11",
            "administrativeDivision": "行政区域修改11",
            "address": "详细地址11",
            "projectNo": "项目修改11",
            "supplier": "供应商1",
            "customer": "客户1",
            "jobDuration": "标准作业时长1",
            "projectDuration": "工期1",
            "planBeginDate": "计划开始时间1",
            "planEndDate": "计划完成时间1",
            "requiredStartTime": "要求开始时间1",
            "requiredEndTime": "要求完成时间1",
            "priority": "优先级1",
            "skill": "要求技能1",
            "schedulingMode": "调度模式1",
            "operationGuide": "操作指导1",
            "attachment": "附件1",
            "associatedIssues": "关联问题1",
            "taskDescription": "任务描述12",
            "ccPerson": "抄送人1",
            "owner": "责任人1",
            "executor": "执行人"
        },
        "taskName": "ytest0721001_wuXX720003",
        "assignedUserId": "467848",
        "assignedUserName": "呵呵",
        "userGroup": "",
        "userGroupName": "",
        "sceneName": "wuXX720003",
        "sceneId": 108090,
        "sceneCode": "TS20220720171813709",
        "sceneVersion": "1.0",
        "signSiteId": 98990882,
        "signSiteCode": "ytest0721001",
        "signSiteName": "ytest0721001",
        "projectNo": null,
        "projectName": null,
        "supplierName": "",
        "beginTimestamp": "",
        "endTimestamp": null,
        "requiredStartTime": 1658419199000,
        "requiredEndTime": 1668009599000,
        "projectDuration": "111",
        "jobDuration": "111",
        "adminOrganizationName": "XX区11112223333",
        "adminOrganization": "833",
        "administrativeDivisionName": "test0610>DFS>11111111111111111111111111111111111111111111111111",
        "administrativeDivision": "314863,417321,502567",
        "sceneLicense": null,
        "templateId": "263513",
        "templateCode": "QC2022XXXXXXXXXXXXX",
        "templateName": "wuXX720",
        "version": "1.0",
        "reviewRuleId": "",
        "reviewRuleName": "",
        "taskRemark": "测试",
        "procedureList": [],
        "subTaskList": [],
        "isAppraisal": "0",
        "collectionReviewId": "",
        "collectionReviewName": "",
        "collectionProcessType": "",
        "priority": null,
        "schedulingMode": null,
        "address": null,
        "skill": "123",
        "customerName": null,
        "customerId": null,
        "operationGuideList": [],
        "attachmentList": [],
        "taskExtend": [],
        "isApplyApprove": 0,
        "processType": "",
        "signInConfig": null,
        "ccPerson": "",
        "ccPersonName": "",
        "ccPersonGroup": "",
        "ccPersonGroupName": "",
        "owner": "",
        "ownerName": "",
        "ownerGroup": "",
        "ownerGroupName": "",
        "customApproveReviewerList": [],
        "customCollectionReviewerList": [],
        "adminRegion": "314863;417321;502567",
        "adminRegionName": "test0610;DFS;11111111111111111111111111111111111111111111111111",
        "regionId": 502567,
        "regionName": "11111111111111111111111111111111111111111111111111",
        "regionPath": "314863,417321,502567",
        "adminiRegionFlag": true,
        "projectDurationFlag": true,
        "executorFlag": true,
        "templateType": "",
        "taskMode": 2,
        "saveDraft": "1",
        "plannedBeginType": "0",
        "plannedCompletionType": "0",
        "beginNumberOfHours": 0,
        "endNumberOfHours": 0,
        "scheduleDayList": [],
        "scheduleDay": "",
        "scheduleType": "1",
        "scheduleMoon": "",
        "scheduleWeek": "1,2,3,4,5,6,7",
        "scheduleHour": "0",
        "url": "http://www.域名1.com",
        "thirdUrl": "http://www.域名1.com",
        "resource": "appcube",
        "operUserId": 467848
    }
}
```
#### 响应示例
```
{
    "stateCode": "0",
    "errorMessage": null,
    "result": {
        "parentTaskScheduleId": 0,
        "taskScheduleLevel": 1,
        "taskScheduleName": "wuXX测试22222",
        "isEnable": 1,
        "taskBody": "{\"isSubTask\":null,\"issueId\":307892,\"sceneId\":108090,\"sceneTaskId\":null,\"sceneName\":\"wuXX720003\",\"sceneCode\":\"TS20220720171813709\",\"sceneVersion\":\"1.0\",\"signSiteId\":98990882,\"signSiteCode\":\"ytest0721001\",\"signSiteName\":\"ytest0721001\",\"adminRegion\":\"314863;417321;502567\",\"adminRegionName\":\"test0610>DFS>11111111111111111111111111111111111111111111111111\",\"projectNo\":null,\"projectName\":null,\"adminOrganization\":\"833\",\"adminOrganizationName\":\"XX区11112223333\",\"supplierName\":\"\",\"taskName\":\"ytest0721001_wuXX720003\",\"templateId\":263513,\"templateName\":\"zhangsan720\",\"templateCode\":\"QC2022XXXXXXXXXXXXX\",\"version\":\"1.0\",\"beginTimestamp\":1658419200000,\"endTimestamp\":1658505599999,\"taskRemark\":\"测试\",\"taskMode\":2,\"assignedUserId\":\"467848\",\"assignedUserName\":\"呵呵\",\"userGroup\":\"\",\"userGroupName\":\"\",\"signInConfig\":null,\"submitBy\":null,\"submitName\":null,\"operationGuideList\":[],\"attachmentList\":[],\"taskExtend\":[],\"procedureList\":[],\"subTaskList\":[],\"reviewRuleId\":null,\"reviewRuleName\":\"\",\"processType\":null,\"saveDraft\":1,\"isApplyApprove\":0,\"licenseSwitch\":null,\"isAppraisal\":0,\"collectionReviewId\":null,\"collectionReviewName\":\"\",\"collectionProcessType\":null,\"sceneLicense\":null,\"customCollectionReviewerList\":[],\"customApproveReviewerList\":[],\"terminalType\":null,\"priority\":null,\"jobDuration\":111,\"projectDuration\":111,\"schedulingMode\":null,\"administrativeDivision\":\"314863,417321,502567\",\"administrativeDivisionName\":\"test0610>DFS>11111111111111111111111111111111111111111111111111\",\"regionId\":502567,\"regionPath\":\"314863,417321,502567\",\"regionName\":\"11111111111111111111111111111111111111111111111111\",\"address\":null,\"requiredStartTime\":1658419199000,\"requiredEndTime\":1668009599000,\"skill\":\"123\",\"customerId\":null,\"customerName\":null,\"category\":\"\",\"categoryId\":null,\"parentCategory\":\"\",\"parentCategoryId\":null,\"isAssociationIssue\":null,\"associationIssueId\":null,\"ccPerson\":\"\",\"ccPersonName\":\"\",\"owner\":\"\",\"ownerName\":\"\",\"ccPersonGroup\":\"\",\"ccPersonGroupName\":\"\",\"ownerGroup\":\"\",\"ownerGroupName\":\"\",\"url\":\"http://www.${域名1}.com\",\"thirdUrl\":\"http://www.域名1.com\",\"resource\":\"appcube\",\"status\":null,\"positionName\":null,\"cronExpr\":\"0 0 0 ? * 1,2,3,4,5,6,7\",\"scheduleHour\":\"0\",\"scheduleWeek\":\"1,2,3,4,5,6,7\",\"scheduleMoon\":\"\",\"scheduleDay\":\"\",\"scheduleDayList\":[],\"scheduleType\":1,\"beginNumberOfHours\":0,\"endNumberOfHours\":0,\"plannedCompletionType\":0,\"plannedBeginType\":0,\"creatorDescribe\":\"处理人关闭\",\"schedulerBy\":null,\"schedulerName\":null,\"schedulerTimestamp\":null,\"schedulerDate\":null,\"validateFile\":true}",
        "platJobId": 1041998,
        "deleteFlag": 0,
        "tenantId": 886,
        "createdBy": 390841,
        "createName": "zdrun-test",
        "creationTimestamp": 1658479981662,
        "creationDate": "2022-07-22 16:53:01",
        "lastUpdatedBy": 390841,
        "lastUpdateName": "zdrun-test",
        "lastUpdateTimestamp": 1658479981662,
        "lastUpdateDate": "2022-07-22 16:53:01",
        "entityName": "IsdpTaskSchedule",
        "taskScheduleId": 4874,
        "appName": "isdp-task-server",
        "affectedRows": 1
    }
}
```
