模板管理 API

提供合同模板的创建、查询、修改、删除、控件设置及嵌入式管理页面的功能。

模板管理

管理合同模板,包括上传模板文件、定义参与方和控件、管理模板状态和获取嵌入式操作链接。

重要提示: 调用本分类下所有接口时,请务必在 HTTP 请求 Header 中携带有效的 appId, accessToken, userId (操作人ID), 和 source (来源标识) 作为通用认证参数。关于 source 参数的详细说明和取值,请参考快速开始章节。文档中的请求示例将仅展示放入 Body 中的业务参数。

POST /template/uploadContractFile 上传模板合同文件

上传用于创建模板的合同源文件(通常是 PDF 或 Word 文档)。成功后返回文件的基本信息,用于后续创建或更新模板。

注意: 此接口使用 multipart/form-data 格式提交。

请求 Header (通用认证参数)

参数名类型必填描述
appIdstring您的应用ID
accessTokenstring有效访问令牌
userIdinteger (int64)操作人用户ID

请求参数

参数名位置类型必填描述
fileFormDatafile要上传的合同文件(PDF, Word等)

请求示例

CURL
curl -X POST 'https://your-api-host.com/template/uploadContractFile' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-F 'file=@/path/to/your/contract_template.pdf'
									

响应

成功响应 (200 OK)
错误响应
{
  "code": "200",
  "msg": "成功",
  "data": { // 合同文件上传结果
    "fileName": "contract_template.pdf",
    "fileUrl": "group1/M00/00/02/...", // 实际存储路径
    "totalPage": 5, // 文件总页数
    "width": 595, // 文件页宽 (A4)
    "height": 842 // 文件页高 (A4)
  }
}
									
{
  "code": "FILE_UPLOAD_ERROR", // 示例
  "msg": "文件上传失败",
  "data": null
}
									

成功响应参数 (data 字段内 - 合同文件上传结果)

参数名类型描述
fileNamestring上传的源文件名称
fileUrlstring实际保存的文件名/路径
totalPageinteger (int32)文件总页数
widthinteger (int32)文件页宽 (像素)
heightinteger (int32)文件页高 (像素)
POST /template/uploadAttachmentFile 上传模板附件文件

上传模板的附件文件。附件文件不会被签署,仅作为合同的补充材料。

注意: 此接口使用 multipart/form-data 格式提交。

请求 Header (通用认证参数)

参数名类型必填描述
appIdstring您的应用ID
accessTokenstring有效访问令牌
userIdinteger (int64)操作人用户ID

请求参数

参数名位置类型必填描述
fileFormDatafile要上传的附件文件

请求示例

CURL
curl -X POST 'https://your-api-host.com/template/uploadAttachmentFile' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-F 'file=@/path/to/your/attachment.zip'
									

响应

成功响应 (200 OK)
错误响应
{
  "code": "200",
  "msg": "成功",
  "data": { // 附件文件上传结果
    "fileName": "attachment.zip",
    "fileUrl": "group1/M00/00/03/...", // 实际存储路径
    "totalPage": 0 // 附件文件通常不计页数
  }
}
									
{
  "code": "FILE_UPLOAD_ERROR", // 示例
  "msg": "附件上传失败",
  "data": null
}
									

成功响应参数 (data 字段内 - 附件文件上传结果)

参数名类型描述
fileNamestring上传的源文件名称
fileUrlstring实际保存的文件名/路径
totalPageinteger (int32)文件总页数 (附件通常为0)
POST /template/addTemplate 新增模板

创建一个新的合同模板,需要提供模板名称、参与方信息、合同文件信息(来自上传接口)以及可选的抄送方和附件信息。

注意: 参与方和合同文件的信息需要预先通过 上传合同文件 等接口获取。控件信息在此步骤不设置,需后续调用 保存新增模板控件设置

请求 Header (通用认证参数)

参数名类型必填描述
appIdstring您的应用ID
accessTokenstring有效访问令牌
userIdinteger (int64)操作人用户ID

请求参数 (Body - 模板发起合同模板类)

参数名类型必填描述
templateNamestring模板名称
encryptFlaginteger (int32)是否加密 (0:普通, 1:加密)
participantListarray参与方列表 (见下方结构)
contractFileListarray合同文件列表 (见下方结构)
copierListarray抄送方列表 (可选, 见下方结构)
attachmentListarray附件列表 (可选, 见下方结构)

ParticipantList 元素结构 (参与方实体类)

参数名类型必填描述
participantFlagstring参与方标识 (如 "甲方", "乙方", 需唯一)
participantTypeinteger (int32)类型 (1:企业, 2:个人)
participateBizTypearray of string参与方式 ("1":填写, "2":签署)
participantSetModeinteger (int32)取值方式 (0:模板指定, 1:固定成员, 3:发起人)
psnAccountstring经办人手机 (mode=1时)
psnNamestring经办人名称 (mode=1时)
draftSortinteger (int32)填写顺序 (1-255, 唯一)
signOrderinteger (int32)签署顺序 (1-255, 可重复)
participantCorpNamestring企业名称 (type=1时)

ContractFileList 元素结构 (合同文件实体类)

参数名类型必填描述
fileNamestring文件名 (来自上传接口)
fileUrlstring文件路径 (来自上传接口)
totalPageinteger (int32)文件页数 (来自上传接口)
widthinteger (int32)文件页宽 (来自上传接口)
heightinteger (int32)文件页高 (来自上传接口)

CopierList 元素结构 (抄送方实体类)

参数名类型必填描述
copierTypeinteger(int32)类型(1:个人, 2:企业)
psnAccountstring抄送人手机(个人类型)
corpNamestring抄送企业名称(企业类型)

AttachmentList 元素结构 (模板附件实体类)

参数名类型必填描述
fileNamestring文件名 (来自上传接口)
fileUrlstring文件路径 (来自上传接口)

请求示例

CURL
curl -X POST 'https://your-api-host.com/template/addTemplate' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-d '{
  "templateName": "标准租赁合同模板",
  "encryptFlag": 1,
  "participantList": [
    {
      "participantFlag": "出租方(甲方)",
      "participantType": 1,
      "participateBizType": ["2"],
      "participantSetMode": 3, // 发起人本人
      "psnAccount": null,
      "psnName": null,
      "draftSort": 1,
      "signOrder": 1,
      "participantCorpName": "我的公司" // 假设发起方是企业
    },
    {
      "participantFlag": "承租方(乙方)",
      "participantType": 2,
      "participateBizType": ["1", "2"], // 需要填写和签署
      "participantSetMode": 0, // 模板指定 (发起时传入)
      "psnAccount": null,
      "psnName": null,
      "draftSort": 2,
      "signOrder": 2
    }
  ],
  "contractFileList": [
    {
      "fileName": "contract_template.pdf",
      "fileUrl": "group1/M00/00/02/...",
      "totalPage": 5,
      "width": 595,
      "height": 842
    }
  ],
  "attachmentList": [
    {
      "fileName": "attachment.zip",
      "fileUrl": "group1/M00/00/03/..."
    }
  ]
}'
									

响应

成功响应 (200 OK)
错误响应
{
  "code": "200",
  "msg": "成功",
  "data": { // 模板实体类 (返回创建的模板信息)
    "templateId": 1001,
    "corpName": "示例有限公司",
    "templateCode": "TPL20240125001",
    "templateName": "标准租赁合同模板",
    "templateStatus": 1, // 默认启用
    // ... 其他模板信息
    "contractFileList": [ // 包含文件信息
        { "fileId": 2001, "fileName": "contract_template.pdf", ... }
    ],
    "participantList": [ // 包含参与方信息
        { "participantId": 3001, "participantFlag": "出租方(甲方)", ... },
        { "participantId": 3002, "participantFlag": "承租方(乙方)", ... }
    ],
    "componentList": [], // 控件列表此时为空
    "copierList": [],
    "attachmentList": [ // 包含附件信息
        { "attachmentId": 4001, "fileName": "attachment.zip", ... }
    ]
  }
}
									
{
  "code": "TEMPLATE_NAME_EXIST", // 示例
  "msg": "模板名称已存在",
  "data": null
}
									
POST /template/modifyTemplate 更新模板详情

更新现有模板的基本信息,如模板名称、参与方、合同文件、抄送方和附件等。需要提供完整的模板信息进行覆盖更新。

注意: 此接口不用于更新控件信息,控件更新请使用 保存编辑模板控件设置

请求 Header (通用认证参数)

参数名类型必填描述
appIdstring您的应用ID
accessTokenstring有效访问令牌
userIdinteger (int64)操作人用户ID

请求参数 (Body - 模板发起合同模板类)

参数结构同 新增模板 接口,但必须包含要修改的 templateId,并且对应的 participantId, fileId, copierId, attachmentId 等也需要正确传入以标识更新。

参数名类型必填描述
templateIdinteger (int64)要更新的模板ID
templateNamestring模板名称
encryptFlaginteger (int32)是否加密
participantListarray参与方列表 (需包含 participantId)
contractFileListarray合同文件列表 (需包含 fileId)
copierListarray抄送方列表 (需包含 copierId)
attachmentListarray附件列表 (需包含 attachmentId)

请求示例

CURL
curl -X POST 'https://your-api-host.com/template/modifyTemplate' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-d '{
  "templateId": 1001,
  "templateName": "标准租赁合同模板 V2.0", // 修改名称
  "encryptFlag": 1,
  "participantList": [ // 需要传入完整的列表,包含 ID
    {
      "participantId": 3001,
      "participantFlag": "出租方(甲方)",
      "participantType": 1,
      "participateBizType": ["2"],
      "participantSetMode": 3,
      "psnAccount": null,
      "psnName": null,
      "draftSort": 1,
      "signOrder": 1,
      "participantCorpName": "我的公司"
    },
    {
      "participantId": 3002,
      "participantFlag": "承租方(乙方)",
      "participantType": 2,
      "participateBizType": ["1", "2"],
      "participantSetMode": 0,
      "psnAccount": null,
      "psnName": null,
      "draftSort": 2,
      "signOrder": 2
    }
  ],
  "contractFileList": [ // 需要传入完整的列表,包含 ID
    {
      "fileId": 2001,
      "fileName": "contract_template.pdf",
      "fileUrl": "group1/M00/00/02/...",
      "totalPage": 5,
      "width": 595,
      "height": 842
    }
  ],
  "attachmentList": [] // 假设移除了附件
}'
									

响应

成功响应 (200 OK)
错误响应
{
  "code": "200",
  "msg": "成功",
  "data": { // 返回更新后的模板实体类
    "templateId": 1001,
    "templateName": "标准租赁合同模板 V2.0",
    // ... 其他更新后的信息
  }
}
									
{
  "code": "TEMPLATE_NOT_FOUND", // 示例
  "msg": "模板不存在或无权限修改",
  "data": null
}
									
POST /template/addComponent 保存新增模板控件设置

为指定模板添加新的控件(如文本框、签章区等)。需要提供模板ID以及要添加的控件列表信息。

注意: 此接口用于批量添加新的控件,控件 ID (componentId) 不需要传递。

请求 Header (通用认证参数)

参数名类型必填描述
appIdstring您的应用ID
accessTokenstring有效访问令牌
userIdinteger (int64)操作人用户ID

请求参数 (Body - 组件实体类)

参数名类型必填描述
templateIdinteger (int64)要添加控件的模板ID
componentsarray要新增的控件列表 (见下方结构)

Components 元素结构 (组件实体类,新增时)

参数名类型必填描述
participantIdinteger (int64)控件所属的参与方ID
contractFileIdinteger (int64)控件所在的文件ID
componentKeystring控件 Key (建议唯一)
componentNamestring控件名称
componentTypeinteger (int32)控件类型 (1:单行文本, 2:数字, 3:日期, 6:签章区, 8:多行文本, ...)
valuestring控件默认值
requiredinteger (int32)是否必填 (1:必填, 0:非必填)
positionXnumberX 坐标
positionYnumberY 坐标
pageNuminteger (int32)控件所在页码
specialAttributeobject控件特有属性 (见下方结构)

SpecialAttribute 结构 (TemplateCompSpecialAttr)

参数名类型描述
dateFormatstring日期格式 (type=3)
numberFormatstring数字格式 (type=2)
fractionDigitsstring小数位数 (type=2)
maxLengthstring最大长度 (文本类)
fontstring字体 (SimSun, ...)
fontSizeinteger(int32)字体大小
textColorstring字体颜色 (#RRGGBB)
bold, italic, underLine, lineThroughboolean字体样式
alignmentinteger(int32)对齐方式 (0:左, 1:中, 3:右)
width, heightinteger(int32)控件宽高
orderinteger(int32)顺序 (前端用)
sealSpecsinteger(int32)落章规则 (type=6, 1:实际, 2:适应)
showSignDateinteger(int32)显示签署日期 (type=6, 0:否, 1:是)
signStyleinteger(int32)签章区样式 (type=6, 1:单页, 2:骑缝)

请求示例

CURL
curl -X POST 'https://your-api-host.com/template/addComponent' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-d '{
  "templateId": 1001,
  "components": [
    {
      "participantId": 3002, // 承租方
      "contractFileId": 2001, // 合同文件ID
      "componentName": "承租方姓名",
      "componentType": 1, // 单行文本
      "required": 1,
      "positionX": 100.5,
      "positionY": 200.0,
      "pageNum": 1,
      "specialAttribute": { "maxLength": "10", "font": "SimSun", "fontSize": 12 }
    },
    {
      "participantId": 3001, // 出租方
      "contractFileId": 2001,
      "componentName": "出租方签章区",
      "componentType": 6, // 签章区
      "required": 1,
      "positionX": 400.0,
      "positionY": 700.0,
      "pageNum": 5,
      "specialAttribute": { "width": 150, "height": 60, "showSignDate": 1, "signStyle": 1 }
    }
  ]
}'
									

响应

成功响应 (200 OK)
错误响应
{
  "code": "200",
  "msg": "成功",
  "data": {} // 通常不返回特定数据
}
									
{
  "code": "COMPONENT_ADD_FAILED", // 示例
  "msg": "添加控件失败,请检查参数",
  "data": null
}
									
POST /template/modifyComponent 保存编辑模板控件设置

更新指定模板的现有控件信息。需要提供模板ID以及包含 componentId 的控件列表。

注意: 此接口用于批量更新现有控件,需要传入正确的 componentId

请求 Header (通用认证参数)

参数名类型必填描述
appIdstring您的应用ID
accessTokenstring有效访问令牌
userIdinteger (int64)操作人用户ID

请求参数 (Body - 组件实体类)

参数结构同 保存新增模板控件设置,但 components 数组中的每个元素都需要包含正确的 componentId

参数名类型必填描述
templateIdinteger (int64)要更新控件的模板ID
componentsarray要更新的控件列表 (见下方结构)

Components 元素结构 (组件实体类,编辑时)

参数名类型必填描述
componentIdinteger (int64)要编辑的控件ID
participantIdinteger (int64)控件所属的参与方ID
contractFileIdinteger (int64)控件所在的文件ID
componentKeystring控件 Key
componentNamestring控件名称
componentTypeinteger (int32)控件类型
valuestring控件默认值
requiredinteger (int32)是否必填
positionXnumberX 坐标
positionYnumberY 坐标
pageNuminteger (int32)控件所在页码
specialAttributeobject控件特有属性

请求示例

CURL
curl -X POST 'https://your-api-host.com/template/modifyComponent' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-d '{
  "templateId": 1001,
  "components": [
    {
      "componentId": 5001, // 假设这是 "承租方姓名" 控件的 ID
      "participantId": 3002,
      "contractFileId": 2001,
      "componentName": "承租方姓名(必填)", // 修改名称
      "componentType": 1,
      "required": 1,
      "positionX": 100.5,
      "positionY": 200.0, // 假设位置不变
      "pageNum": 1,
      "specialAttribute": { "maxLength": "10", "font": "SimHei", "fontSize": 12 } // 修改字体
    },
    {
      "componentId": 5002, // 假设这是 "出租方签章区" 控件的 ID
      "participantId": 3001,
      "contractFileId": 2001,
      "componentName": "出租方盖章处", // 修改名称
      "componentType": 6,
      "required": 1,
      "positionX": 400.0,
      "positionY": 700.0,
      "pageNum": 5,
      "specialAttribute": { "width": 160, "height": 60, "showSignDate": 0, "signStyle": 1 } // 修改宽度和日期显示
    }
    // 如果有控件要删除,则不在此列表中包含
  ]
}'
									

响应

成功响应 (200 OK)
错误响应
{
  "code": "200",
  "msg": "成功",
  "data": {}
}
									
{
  "code": "COMPONENT_UPDATE_FAILED", // 示例
  "msg": "更新控件失败,请检查控件ID是否存在",
  "data": null
}
									
POST /template/componentInfoList 查询模板控件信息

查询指定模板下的所有控件详细信息,包括控件的位置、类型、属性以及关联的参与方等。

请求 Header (通用认证参数)

参数名类型必填描述
appIdstring您的应用ID
accessTokenstring有效访问令牌
userIdinteger (int64)操作人用户ID

请求参数 (Body - 模板查询实体类)

参数名类型必填描述
templateIdinteger (int64)需要查询控件的模板ID

请求示例

CURL
curl -X POST 'https://your-api-host.com/template/componentInfoList' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-d '{
  "templateId": 1001
}'
									

响应

成功响应 (200 OK)
错误响应
{
  "code": "200",
  "msg": "成功",
  "data": [ // 合同文件查询参数类列表 (每个文件及其控件)
    {
      "corpId": 12345,
      "templateId": 1001,
      "fileId": 2001,
      "fileName": "contract_template.pdf",
      "totalPage": 5,
      "width": 595,
      "height": 842,
      "jpgUrlList": ["url1.jpg", "url2.jpg", ...], // 文件预览图
      "participantList": [ // 模板定义的参与方信息
        { "participantId": 3001, "participantFlag": "出租方(甲方)", ... },
        { "participantId": 3002, "participantFlag": "承租方(乙方)", ... }
      ],
      "componentList": [ // 该文件上的控件列表
        {
          "componentId": 5001,
          "templateId": 1001,
          "participantId": 3002,
          "contractFileId": 2001,
          "componentKey": null,
          "componentName": "承租方姓名(必填)",
          "componentType": 1,
          "value": null, // 默认值
          "required": 1,
          "positionX": 100.5,
          "positionY": 200.0,
          "pageNum": 1,
          "specialAttribute": { "maxLength": "10", "font": "SimHei", "fontSize": 12, ... }
        },
        {
          "componentId": 5002,
          "templateId": 1001,
          "participantId": 3001,
          "contractFileId": 2001,
          "componentKey": null,
          "componentName": "出租方盖章处",
          "componentType": 6,
          "value": null,
          "required": 1,
          "positionX": 400.0,
          "positionY": 700.0,
          "pageNum": 5,
          "specialAttribute": { "width": 160, "height": 60, "showSignDate": 0, "signStyle": 1, ... }
        }
        // ... 其他控件
      ]
    }
    // 如果模板有多个文件,这里会有多个对象
  ]
}
									
{
  "code": "TEMPLATE_NOT_FOUND", // 示例
  "msg": "模板不存在",
  "data": null
}
									

成功响应参数 (data 字段内数组元素的结构 - 合同文件查询参数类)

参数名类型描述
corpIdinteger (int64)企业ID
templateIdinteger (int64)模板ID
fileIdinteger (int64)文件ID
fileNamestring文件名称
totalPageinteger (int32)总页数
width, heightinteger (int32)页宽/高
jpgUrlListarray of string文件预览图URL列表
participantListarray参与方信息列表 (见下方参与方信息结构)
componentListarray控件列表 (见下方控件信息结构)
ParticipantList 元素结构 (参与方信息)
参数名类型描述
participantIdinteger (int64)参与方ID
participantFlagstring参与方标识
participantTypeinteger (int32)类型 (1:企业, 2:个人)
participateBizTypearray of string参与方式 ("1":填写, "2":签署)
psnName, psnAccountstring经办人名称/手机
participantCorpNamestring企业名称
ComponentList 元素结构 (模板组件实体类)
参数名类型描述
componentIdinteger (int64)控件ID
templateId, participantId, contractFileIdinteger (int64)关联的模板/参与方/文件ID
componentKey, componentNamestring控件Key/名称
componentTypeinteger (int32)控件类型 (1, 2, 3, 6, ...)
valuestring默认值
requiredinteger (int32)是否必填 (0/1)
positionX, positionYnumber坐标
pageNuminteger (int32)页码
specialAttributeobject控件特有属性 (结构见addComponent)
POST /template/list 模板列表查询

根据条件查询企业下的模板列表,支持分页。

请求 Header (通用认证参数)

参数名类型必填描述
appIdstring您的应用ID
accessTokenstring有效访问令牌
userIdinteger (int64)操作人用户ID

请求参数 (Body - 模板查询实体类)

参数名类型必填描述
templateIdinteger (int64)模板ID (精确查询)
templateNamestring模板名称 (模糊查询)
templateStatusinteger (int32)模板状态 (0:停用, 1:启用)
listPageNointeger (int32)当前页码 (默认1)
listPageSizeinteger (int32)每页数量 (默认10或20)

请求示例

CURL
curl -X POST 'https://your-api-host.com/template/list' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-d '{
  "templateStatus": 1,
  "listPageNo": 1,
  "listPageSize": 5
}'
									

响应

成功响应 (200 OK)
错误响应
{
  "code": "200",
  "msg": "成功",
  "listPageNo": 1,
  "countInPage": 1,
  "listPageCount": 1,
  "totalCount": 1,
  "data": [ // 模板实体类列表
    {
      "templateId": 1001,
      "templateCode": "TPL20240125001",
      "templateName": "标准租赁合同模板 V2.0",
      "templateStatus": 1,
      "corpName": "示例有限公司",
      "encryptFlag": 1,
      "createTime": "2024-01-25T10:00:00.000+0800",
      "updateTime": "2024-01-25T11:30:00.000+0800",
      "createName": "张三",
      "updateName": "李四"
    }
    // ... 其他模板
  ]
}
									
{
  "code": "QUERY_ERROR", // 示例
  "msg": "查询模板列表失败",
  "data": null
}
									

成功响应参数 (data 字段内数组元素的结构 - 模板实体类)

参数名类型描述
templateIdinteger (int64)模板ID
templateCodestring模板编码
templateNamestring模板名称
templateStatusinteger (int32)状态 (0:停用, 1:启用)
corpNamestring企业名称
encryptFlaginteger (int32)是否加密 (0/1)
createTime, updateTimestring (date-time)创建/更新时间
createName, updateNamestring创建/更新人
POST /template/info 模板详情查询

查询单个模板的详细信息,包括基本信息、参与方、文件、抄送方和附件等。可以通过 `templateType` 参数区分查询目的(编辑时/使用时)。

请求 Header (通用认证参数)

参数名类型必填描述
appIdstring您的应用ID
accessTokenstring有效访问令牌
userIdinteger (int64)操作人用户ID

请求参数 (Body - 模板详情查询实体类)

参数名类型必填描述
templateIdinteger (int64)需要查询详情的模板ID
templateTypestring查询类型 ("1":编辑时, "2":使用时)

请求示例

CURL
curl -X POST 'https://your-api-host.com/template/info' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-d '{
  "templateId": 1001,
  "templateType": "2"
}'
									

响应

成功响应 (200 OK)
错误响应
{
  "code": "200",
  "msg": "成功",
  "data": { // 模板详细信息实体类
    "templateId": 1001,
    "corpName": "示例有限公司",
    "templateCode": "TPL20240125001",
    "templateName": "标准租赁合同模板 V2.0",
    "templateStatus": 1,
    "encryptFlag": 1,
    "createTime": "2024-01-25T10:00:00.000+0800",
    "updateTime": "2024-01-25T11:30:00.000+0800",
    "createName": "张三",
    "updateName": "李四",
    "contractFileList": [ // 合同文件列表
      {
        "fileId": 2001,
        "templateId": 1001,
        "fileName": "contract_template.pdf",
        "fileUrl": "group1/M00/00/02/...",
        "totalPage": 5,
        "width": 595,
        "height": 842
      }
    ],
    "participantList": [ // 参与方列表
      {
        "participantId": 3001,
        "templateId": 1001,
        "participantFlag": "出租方(甲方)",
        "participantType": 1,
        "participateBizType": ["2"],
        "participantSetMode": 3,
        // ... 其他参与方信息
      },
      {
        "participantId": 3002,
        "templateId": 1001,
        "participantFlag": "承租方(乙方)",
        "participantType": 2,
        "participateBizType": ["1", "2"],
        "participantSetMode": 0,
        // ... 其他参与方信息
      }
    ],
    "copierList": [], // 抄送方列表
    "attachmentList": [] // 附件列表
  }
}
									
{
  "code": "TEMPLATE_NOT_FOUND", // 示例
  "msg": "模板不存在",
  "data": null
}
									

成功响应参数 (data 字段内 - 模板详细信息实体类)

参数名类型描述
templateIdinteger (int64)模板ID
corpNamestring企业名称
templateCodestring模板编码
templateNamestring模板名称
templateStatusinteger (int32)状态 (0:停用, 1:启用)
encryptFlaginteger (int32)是否加密 (0/1)
createTime, updateTimestring (date-time)创建/更新时间
createName, updateNamestring创建/更新人
contractFileListarray合同文件列表 (结构见下方)
participantListarray参与方列表 (结构见下方)
copierListarray抄送方列表 (结构见下方)
attachmentListarray附件列表 (结构见下方)
ContractFileList 元素结构 (模板合同文件实体类)
参数名类型描述
fileId, templateIdinteger (int64)文件/模板ID
fileName, fileUrlstring文件名/路径
totalPage, width, heightinteger (int32)页数/宽高
ParticipantList 元素结构 (模板参与方实体类)
参数名类型描述
participantId, templateIdinteger (int64)参与方/模板ID
participantFlagstring参与方标识
participantTypeinteger (int32)类型 (1:企业, 2:个人)
participateBizTypearray of string参与方式 ("1","2")
participantSetModeinteger (int32)取值方式 (0,1,3)
participantCorpId, participantCorpNameinteger(int64)/string企业ID/名称
psnId, psnAccount, psnNameinteger(int64)/string经办人ID/手机/名称
CopierList 元素结构 (模板抄送方实体类)
参数名类型描述
copierId, templateIdinteger (int64)抄送方/模板ID
copierTypeinteger (int32)类型 (1:个人, 2:企业)
psnAccount, corpNamestring抄送个人账号/企业名称
AttachmentList 元素结构 (模板附件实体类)
参数名类型描述
attachmentId, templateIdinteger (int64)附件/模板ID
fileName, fileUrlstring文件名/路径
POST /template/updateStatus 启用/停用模板

修改指定模板的状态(启用或停用)。

请求 Header (通用认证参数)

参数名类型必填描述
appIdstring您的应用ID
accessTokenstring有效访问令牌
userIdinteger (int64)操作人用户ID

请求参数 (Body - 模板状态修改类)

参数名类型必填描述
templateIdinteger (int64)需要修改状态的模板ID
templateStatusinteger (int32)目标状态 (0:停用, 1:启用)

请求示例

CURL
curl -X POST 'https://your-api-host.com/template/updateStatus' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-d '{
  "templateId": 1001,
  "templateStatus": 0 // 停用模板
}'
									

响应

成功响应 (200 OK)
错误响应
{
  "code": "200",
  "msg": "成功",
  "data": {}
}
									
{
  "code": "TEMPLATE_NOT_FOUND", // 示例
  "msg": "模板不存在",
  "data": null
}
									
POST /template/del 模板删除

逻辑删除指定的模板。

请求 Header (通用认证参数)

参数名类型必填描述
appIdstring您的应用ID
accessTokenstring有效访问令牌
userIdinteger (int64)操作人用户ID

请求参数 (Body - 模板删除类)

参数名类型必填描述
templateIdinteger (int64)需要删除的模板ID

请求示例

CURL
curl -X POST 'https://your-api-host.com/template/del' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-d '{
  "templateId": 1001
}'
									

响应

成功响应 (200 OK)
错误响应
{
  "code": "200",
  "msg": "成功",
  "data": {}
}
									
{
  "code": "TEMPLATE_DELETE_FAILED", // 示例
  "msg": "模板正在使用中,无法删除",
  "data": null
}
									
POST /template/getTemplateManageUrl 获取模板管理链接

获取一个用于嵌入或跳转的模板管理页面链接,用户可以在此页面进行模板的查看、筛选等操作。

请求 Header (通用认证参数)

参数名类型必填描述
appIdstring您的应用ID
accessTokenstring有效访问令牌
userIdinteger (int64)操作人用户ID

请求参数 (Body)

此接口请求 Body 为空。

请求示例

CURL
curl -X POST 'https://your-api-host.com/template/getTemplateManageUrl' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-d '{}'
									

响应

成功响应 (200 OK)
错误响应
{
  "code": "200",
  "msg": "成功",
  "data": "https://your-system-url.com/embed/template/manage?session=temp_token" // 返回的管理页面URL
}
									
{
  "code": "URL_GEN_FAILED", // 示例
  "msg": "生成管理链接失败",
  "data": null
}
									
POST /template/getTemplateSettingUrl 获取模板设置链接

获取指定模板的设置页面链接,用于嵌入或跳转,允许用户在此页面配置模板的控件、参与方等。

请求 Header (通用认证参数)

参数名类型必填描述
appIdstring您的应用ID
accessTokenstring有效访问令牌
userIdinteger (int64)操作人用户ID

请求参数 (Body - 模板查询类)

参数名类型必填描述
templateIdinteger (int64)需要获取设置链接的模板ID
templateTypeinteger (int32)模板类型 (可选)

请求示例

CURL
curl -X POST 'https://your-api-host.com/template/getTemplateSettingUrl' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-d '{
  "templateId": 1001
}'
									

响应

成功响应 (200 OK)
错误响应
{
  "code": "200",
  "msg": "成功",
  "data": "https://your-system-url.com/embed/template/setting/1001?session=temp_token" // 返回的设置页面URL
}
									
{
  "code": "TEMPLATE_NOT_FOUND", // 示例
  "msg": "模板不存在",
  "data": null
}
									
POST /template/getTemplateEditeUrl 获取模板编辑链接

获取指定模板的编辑页面链接(区别于设置链接,可能侧重于模板基础信息编辑),用于嵌入或跳转。

请求 Header (通用认证参数)

参数名类型必填描述
appIdstring您的应用ID
accessTokenstring有效访问令牌
userIdinteger (int64)操作人用户ID

请求参数 (Body - 模板查询类)

参数名类型必填描述
templateIdinteger (int64)需要获取编辑链接的模板ID
templateTypeinteger (int32)模板类型 (可选)

请求示例

CURL
curl -X POST 'https://your-api-host.com/template/getTemplateEditeUrl' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-d '{
  "templateId": 1001
}'
									

响应

成功响应 (200 OK)
错误响应
{
  "code": "200",
  "msg": "成功",
  "data": "https://your-system-url.com/embed/template/edit/1001?session=temp_token" // 返回的编辑页面URL
}
									
{
  "code": "TEMPLATE_NOT_FOUND", // 示例
  "msg": "模板不存在",
  "data": null
}