
# 保存检查单模板KCP、ITEM信息（API名称：batchSaveTemplateKcp）
#### 功能介绍
用于发布检查单模板KCP信息。
#### 相关接口
| **接口名称**                                                             | **调用说明**                                                     |
|:---|:---|
| [获取Token](https://support.huaweicloud.com/api-isdp/api_01_0019.html) | 调用该接口获取到Token，再调用其他接口时，需要在请求消息头中添加"Authorization"，其值即为Token。 |
   
#### URL
| **请求方式** | **HTTPS地址**                                                    | **服务架构** | **消息体类型**        |
|:---|:---|:---|:---|
| POST     | https://***isdp+域名***/openapi/v1/openTask/batchSaveTemplateKcp | 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的值 |
   
#### 请求参数
| **参数**           | **类型**  | **是否必填** | **描述**                                                                                       |
|:---|:---|:---|:---|
| submitterAccount | String  | 是        | 提交人账号                                                                                        |
| isPublish        | Boolean | 否        | 是否发布(true-发布 false-保存草稿)                                                                     |
| isAdditional     | String  | 是        | 是否升级版本 "Y"-升级版本，"N"-不升级模板版本，修改模板状态                                                           |
| templateModel    | Object  | 是        | 模板头信息（templateId为空则创建新的模板）                                                                   |
| kcpList          | Object  | 否        | KCP列表信息                                                                                      |
| isUpgrade        | String  | 是        | 判断是否升级关联的任务场景 Y:同步升级关联的任务场景，N：不升级 |
   
templateModel模板头信息Object对象模板头说明
| **参数**                 | **类型**  | **是否必填** | **描述**                                                                              |
|:---|:---|:---|:---|
| dataSource             | String  | 是        | 创建来源标识                                                                              |
| templateId             | Long    | 否        | 模板ID                                                                                |
| templateCode           | String  | 是        | 模板编码                                                                                |
| type                   | Integer | 是        | 模板类型（1-采集模板 2-检查模板）                                                                 |
| templateChildType      | Integer | 是        | 模板子类型（1-质检2-巡检 3-作业）                                                                |
| templateName           | String  | 是        | 模板名称                                                                                |
| serviceType            | String  | 是        | 业务类型                                                                                |
| locationType           | String  | 否        | 位置类型                                                                                |
| adminOrganizationCode  | String  | 是        | 组织单元ID                                                                              |
| adminOrganizationName  | String  | 是        | 组织单元名称                                                                              |
| isManualReviewAutoPass | Integer | 否        | AI评审通过则条目的人工评审自动通过（0：否；1：是）                                                         |
| isVideoAcceptance      | Integer | 否        | 是否视频审核(1:是；0:否)                                                                     |
| isDesignItem           | Integer | 否        | 是否按设计生成检查项(0-否 1-是)                                                                 |
| isDefaultTemplate      | Integer | 否        | 是否为默认模板(0-否 1-是)                                                                    |
| validRequired          | Integer | 否        | 必填项全采后才能提交任务评审 (1-是 2-否) |
| isCommandTemplate      | Integer | 否        | 是否指令式采集模板 (1: 是; 0: 否)    |
| remarks                | String  | 否        | 备注                                                                                  |
| version                | String  | 否        | 版本号                                                                                 |
| isNewVersion           | String  | 否        | 是否是最新模板                                                                             |
   
kcpList信息Object对象KCP说明：
| **参数**   | **类型** | **是否必填** | **描述**     |
|:---|:---|:---|:---|
| name     | String | 是        | KCP名称      |
| kcpType  | String | 否        | KCP类型      |
| children | Object | 是        | KCP下条目列表信息 |
   
children条目列表信息Object对象条目说明：
| **参数**      | **类型**  | **是否必填** | **描述**                 |
|:---|:---|:---|:---|
| name        | String  | 是        | 条目名称                   |
| allowedNa   | Integer | 是        | 采集设置是否允许NA(1: 是; 0: 否) |
| isExemption | Integer | 是        | 评审设置是否免审（1: 是; 0: 否）   |
| outputList  | Object  | 是        | 条目下输出项列表信息             |
   
outputList条目下输出项列表信息Object对象输出项说明：
| **参数**       | **类型**  | **是否必填** | **描述**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
|:---|:---|:---|:---|
| collectScene | Integer | 是        | 采集场景 0-普通                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| outputName   | String  | 是        | 输出项名称                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| outputType   | Integer | 是        | 输出项类型： 13:图片 14:视频 3:图片/视频 20:文本 2:长文本 5:整数 6:小数 1:枚举 4:多枚举 11:GPS 17:音频 18:签名 9:条码 7:日期 15:时间(年月日时分) 16:文件 |
| isNecessary  | Integer | 是        | 是否必填 0-否 1-是                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| outputIndex  | Integer | 是        | 输出项索引 0开始                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| defaultValue | String  | 否        | 默认值                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| enumValue    | String  | 否        | 枚举值                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| isStrongWeak | Integer | 否        | 是否强控最大值/最小值范围(1:是强控；0:否弱控)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| maxValue     | String  | 否        | 最大值                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| maxValue     | String  | 否        | 最小值                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| accuracy     | Integer | 否        | 精度                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| maxPhoto     | Integer | 否        | 图片最大数量                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| maxVideo     | Integer | 否        | 视频数量上限                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
   
#### 响应参数
| **参数**       | **类型** | **描述**          |
|:---|:---|:---|
| stateCode    | String | 响应编码：0-成功；其他-失败 |
| errorMessage | String | 错误信息            |
| result       | Object | 响应数据            |
   
result信息Object对象模板头和KCP说明：
| **参数**        | **类型** | **描述**           |
|:---|:---|:---|
| templateModel | String | 模板头信息，对象参数说明见上   |
| kcpList       | Object | KCP列表信息，对象参数说明见上 |
   
#### 请求示例
```
{
"submitterAccount": "18025453735",
  "isAdditional": "Y",
  "templateModel": {
    "dataSource": "appcube",
    "type": 1,
    "templateChildType": 3,
    "templateCode": "QC2022XXXXXXXXXXXXX",
    "templateName": "模板名称017修改2",
    "serviceType": "作业",
    "locationType": "",
    "adminOrganizationCode": "830",
    "adminOrganizationName": "XX作业系统测试1",
    "remarks": "openPAI Test",
    "isNewVersion": "Y",
    "version": "1.0",
    "status": 2,
    "templateId": ""
  },
  "isPublish": true,
  "kcpList": [
    {
      "children": [
        {
          "outputList": [
            {
              "photoList": [
                
              ],
              "outputName": "输出项文本",
              "defaultValue": "默认值输出项文本",
              "outputType": 20,
              "accuracy": "",
              "collectScene": "0",
              "isNecessary": 1,
              "outputIndex": 0,
              "minValue": "",
              "enumValue": "",
              "maxPhoto": "",
              "videoList": [
                
              ],
              "isStrongWeak": "",
              "designValueOrder": "",
              "maxVideo": "",
              "designValue": ""
            }
          ],
          "allowedNa": 1,
          "isExemption": 0,
          "name": "item1"
        }
      ],
      "name": "new kcp1修改"
    }
  ]
}
```
#### 响应示例
```
{
    "stateCode": "0",
    "errorMessage": "execute add success",
    "result": {
        "templateModel": {
            "adminOrganizationCode": "830",
            "adminOrganizationName": "XX作业系统测试1",
            "appName": "isdp-qc-server",
            "createdBy": 699960,
            "createName": "测试",
            "creationDate": "2022-07-14 16:13:54",
            "creationTimestamp": 1657786434813,
            "dataSource": "appcube",
            "deleteFlag": 0,
            "deliveryScene": null,
            "entityName": "qcTemplate",
            "indoor": null,
            "isCommandTemplate": 0,
            "isDefaultTemplate": 0,
            "isDesignItem": 0,
            "isManualReviewAutoPass": 1,
            "isNewVersion": "N",
            "isVideoAcceptance": 0,
            "lastUpdateDate": "2022-07-14 17:03:12",
            "lastUpdatedBy": 699960,
            "lastUpdateName": "测试",
            "lastUpdateTimestamp": 1657789392845,
            "locationType": "",
            "originalTemplateId": 263445,
            "otherRecognitionObjects": null,
            "outdoor": null,
            "personQualification": null,
            "ppeEquipsObject": null,
            "productForm": null,
            "productType": null,
            "projectCode": null,
            "remarks": "openPAI Test",
            "serviceType": "作业",
            "status": 1,
            "templateChildType": 3,
            "templateCode": "QC2022XXXXXXXXXXXXX",
            "templateId": 263445,
            "templateName": "模板名称017修改2",
            "templateParam": null,
            "tenantId": 886,
            "type": 1,
            "validRequired": 0,
            "version": "1.0"
        },
        "kcpList": [
            {
                "appName": "isdp-qc-server",
                "createdBy": 699960,
                "creationDate": "2022-07-14 16:13:54",
                "deleteFlag": 0,
                "demoVideoId": null,
                "entityName": "templateKcp",
                "kcpId": 286587,
                "kcpIndex": 0,
                "lastUpdateDate": "2022-07-14 16:13:54",
                "lastUpdatedBy": 699960,
                "name": "new kcp1修改",
                "score": 0,
                "templateId": 263445,
                "children": [
                    {
                        "collectNa": 0,
                        "allowedNa": 1,
                        "appName": "isdp-qc-server",
                        "createdBy": 699960,
                        "creationDate": "2022-07-14 16:13:54",
                        "deleteFlag": 0,
                        "entityName": "templateItem",
                        "handlerNameInspection": null,
                        "handlerNameQualityInspection": null,
                        "identificationType": null,
                        "intelligentReviewRules": null,
                        "isExemption": 0,
                        "issueHandlerInspection": null,
                        "issueHandlerQualityInspection": null,
                        "issueTypeInspection": null,
                        "issueTypeQualityInspection": null,
                        "itemCode": null,
                        "itemId": 3515751,
                        "itemIndex": 0,
                        "itemType": 0,
                        "kcpId": 286587,
                        "kcpIndex": 0,
                        "kcpName": null,
                        "lastUpdateDate": "2022-07-14 16:13:54",
                        "lastUpdatedBy": 699960,
                        "name": "item1",
                        "objectIndustryTypeId": null,
                        "objectIndustryTypeIdText": null,
                        "operationGuide": null,
                        "qualityStandard": null,
                        "rejectionReason": null,
                        "sceneTypeName": null,
                        "templateId": 263445,
                        "tenantId": 886,
                        "outputList": [
                            {
                                "appName": "isdp-qc-server",
                                "audioIdentifyInfo": null,
                                "collectScene": 0,
                                "compressionRatio": 0,
                                "createdBy": 699960,
                                "creationDate": "2022-07-14 16:13:54",
                                "defaultValue": "默认值输出项文本",
                                "deleteFlag": 0,
                                "demoPictureId": null,
                                "designValue": "",
                                "designValueOrder": "",
                                "deviationValue": null,
                                "entityName": "templateOutput",
                                "enumValue": "",
                                "intelligentObject": null,
                                "isNecessary": 1,
                                "isStrongWeak": null,
                                "itemId": 3515751,
                                "itemType": 0,
                                "lastUpdateDate": "2022-07-14 16:13:54",
                                "lastUpdatedBy": 699960,
                                "maxValue": null,
                                "measurementOrder": 0,
                                "minValue": "",
                                "outputCode": null,
                                "outputId": 43817057,
                                "outputIndex": 0,
                                "outputName": "输出项文本",
                                "outputType": 20,
                                "templateId": 263445
                            }
                        ]
                    }
                ]
            }
        ]
    }
}
```
#### 状态码
状态码请参见[状态码](https://support.huaweicloud.com/api-isdp/api_01_0326.html)。
#### 错误码
错误码请参见[错误码](https://support.huaweicloud.com/api-isdp/api_01_0327.html)。
