创建、查询、授权和管理企业及个人签章
本模块提供企业电子印章的全生命周期管理功能,包括通过模板或上传图片创建印章、上传印章文件、预览效果、查询印章列表和详情、管理印章授权、修改和删除印章等。
重要提示: 调用本分类下所有接口时,请务必在 HTTP 请求 Header 中携带有效的 appId, accessToken, userId (操作人ID), 和 source (来源标识) 作为通用认证参数。关于 source 参数的详细说明和取值,请参考快速开始章节。文档中的请求示例将仅展示放入 Body 中的业务参数。
根据指定的模板样式、文字和颜色等参数,为当前企业创建一个新的电子印章。
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| appId | string | 是 | 您的应用ID |
| accessToken | string | 是 | 有效访问令牌 |
| userId | integer (int64) | 是 | 操作人用户ID |
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| sealName | string | 是 | 印章名称 |
| sealStyle | integer (int32) | 是 | 印章制作方式: 1 - 模板章, 3 - 图片章 |
| categoryType | string | 是 | 印章类型 (PUBLIC, CONTRACT, FINANCE, HR, LEGAL_PERSON, OTHER) |
| sealTemplateStyle | string | 否 | 印章样式 (默认 round, 可选 oval) |
| sealHorizontalText | string | 否 | 印章横排文字 |
| sealBottomText | string | 否 | 印章下弦文 (防伪码) |
| sealColor | string | 否 | 印章颜色 (默认 Red, 可选 Blue, Black, Purple) |
| sealAlpha | number (float) | 否 | 透明度 (0.0 - 1.0) |
curl -X POST 'https://your-api-host.com/seal/createSealByTemplate' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-d '{
"sealName": "市场部合同专用章",
"sealStyle": 1,
"categoryType": "CONTRACT",
"sealTemplateStyle": "round",
"sealHorizontalText": "市场部",
"sealColor": "Red"
}'
{
"code": "200",
"msg": "成功",
"data": { // 印章创建结果
"sealId": 50001 // 新创建的印章ID
}
}
{
"code": "SEAL_NAME_EXIST", // 示例
"msg": "印章名称已存在",
"data": null
}
根据预先上传的印章图片文件创建电子印章。需要先调用 上传印章图片文件 接口获取图片信息。
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| appId | string | 是 | 您的应用ID |
| accessToken | string | 是 | 有效访问令牌 |
| userId | integer (int64) | 是 | 操作人用户ID |
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| sealName | string | 是 | 印章名称 |
| sealStyle | integer (int32) | 是 | 印章制作方式: 固定为 3 - 图片印章 |
| categoryType | string | 是 | 印章类型 (PUBLIC, CONTRACT, FINANCE, HR, LEGAL_PERSON, OTHER) |
| sealTemplateStyle | string | 是 | 印章样式 (圆形 round, 椭圆 oval) - 即使是图片章也可能需要指定形状用于展示或处理 |
注意: 创建图片印章前,通常需要先调用 上传印章图片文件 接口,该接口的调用可能需要与此接口在同一会话或通过特定机制关联。
# 假设已通过 uploadSealFile 上传图片并获得关联
curl -X POST 'https://your-api-host.com/seal/createSealByImage' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-d '{
"sealName": "手签章-张三",
"sealStyle": 3,
"categoryType": "OTHER",
"sealTemplateStyle": "round"
}'
{
"code": "200",
"msg": "成功",
"data": { // 印章创建结果
"sealId": 50002 // 新创建的印章ID
}
}
{
"code": "SEAL_IMAGE_NOT_FOUND", // 示例
"msg": "未找到关联的上传印章图片",
"data": null
}
上传本地印章图片文件(通常是透明背景的PNG),用于后续创建图片印章。
注意: 此接口使用 multipart/form-data 格式提交。
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| appId | string | 是 | 您的应用ID |
| accessToken | string | 是 | 有效访问令牌 |
| userId | integer (int64) | 是 | 操作人用户ID |
| 参数名 | 位置 | 类型 | 必填 | 描述 |
|---|---|---|---|---|
| file | FormData | file | 是 | 印章图片文件 (PNG格式) |
| color | Query | string | 否 | 印章颜色 (Red, blue, black, purple) - 可能用于处理或预览 |
curl -X POST 'https://your-api-host.com/seal/uploadSealFile?color=Red' \ -H 'appId: YOUR_APP_ID' \ -H 'accessToken: YOUR_ACCESS_TOKEN' \ -H 'userId: OPERATOR_USER_ID' \ -F 'file=@/path/to/your/seal_image.png'
{
"code": "200",
"msg": "成功",
"data": { // 文件上传结果
"fileName": "seal_image.png",
"fileUrl": "group1/M00/00/01/...", // 实际存储路径
"httpUrl": "https://your-resource-host.com/group1/M00/00/01/...", // 可访问URL
"totalPage": 1, // 图片文件通常是1页
"width": 200, // 图片宽度
"height": 200 // 图片高度
}
}
{
"code": "FILE_UPLOAD_ERROR", // 示例
"msg": "文件上传失败",
"data": null
}
| 参数名 | 类型 | 描述 |
|---|---|---|
| fileName | string | 源文件名称 |
| fileUrl | string | 实际保存的文件路径 (相对路径) |
| httpUrl | string | 文件可访问 URL |
| totalPage | integer (int32) | 文件页数 |
| width | integer (int32) | 页宽 (或图片宽度) |
| height | integer (int32) | 页高 (或图片高度) |
根据创建模板印章的参数(同 创建模板印章 接口 Body),动态生成印章图片的预览效果,返回图片的 URL 等信息。
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| appId | string | 是 | 您的应用ID |
| accessToken | string | 是 | 有效访问令牌 |
| userId | integer (int64) | 是 | 操作人用户ID |
参数同 创建模板印章 接口的 Body。
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| sealName | string | 是 | 印章名称 |
| sealStyle | integer (int32) | 是 | 印章制作方式: 1 - 模板章 |
| categoryType | string | 是 | 印章类型 (PUBLIC, ...) |
| sealTemplateStyle | string | 否 | 印章样式 (round, oval) |
| sealHorizontalText | string | 否 | 横排文字 |
| sealBottomText | string | 否 | 下弦文 |
| sealColor | string | 否 | 颜色 (Red, ...) |
| sealAlpha | number (float) | 否 | 透明度 |
curl -X POST 'https://your-api-host.com/seal/corpPreView' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-d '{
"sealName": "预览-合同章",
"sealStyle": 1,
"categoryType": "CONTRACT",
"sealColor": "Blue"
}'
{
"code": "200",
"msg": "成功",
"data": { // 文件上传结果 (此处代表预览图信息)
"fileName": "seal_preview.png", // 预览图文件名
"fileUrl": "temp/preview/...", // 预览图存储路径
"httpUrl": "https://your-resource-host.com/temp/preview/...", // 预览图URL
"totalPage": 1,
"width": 159, // 示例宽度
"height": 159 // 示例高度
}
}
{
"code": "PREVIEW_GEN_ERROR", // 示例
"msg": "生成预览图失败",
"data": null
}
根据已上传的印章图片文件信息(文件名和URL),结合可选的颜色和透明度,生成处理后的印章预览图。
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| appId | string | 是 | 您的应用ID |
| accessToken | string | 是 | 有效访问令牌 |
| userId | integer (int64) | 是 | 操作人用户ID |
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| fileName | string | 是 | 源文件名称 (来自上传接口的响应) |
| httpUrl | string | 是 | 文件路径 URL (来自上传接口的响应) |
| sealColor | string | 否 | 印章颜色 (Red, Blue, Black, Purple) - 应用于预览 |
| sealAlpha | number (float) | 否 | 透明度 (0.0 - 1.0) - 应用于预览 |
curl -X POST 'https://your-api-host.com/seal/uploadSealFilePreView' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-d '{
"fileName": "seal_image.png",
"httpUrl": "https://your-resource-host.com/group1/M00/00/01/...",
"sealColor": "Black"
}'
{
"code": "200",
"msg": "成功",
"data": { // 文件上传结果 (此处代表预览图信息)
"fileName": "seal_preview_from_image.png",
"fileUrl": "temp/preview/...",
"httpUrl": "https://your-resource-host.com/temp/preview/...",
"totalPage": 1,
"width": 200,
"height": 200
}
}
{
"code": "IMAGE_PROCESS_ERROR", // 示例
"msg": "处理图片失败或找不到源文件",
"data": null
}
根据条件查询当前企业下的电子印章列表,支持分页。
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| appId | string | 是 | 您的应用ID |
| accessToken | string | 是 | 有效访问令牌 |
| userId | integer (int64) | 是 | 操作人用户ID |
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| sealId | integer (int64) | 否 | 印章ID (精确查询) |
| sealName | string | 否 | 印章名称 (模糊查询) |
| categoryType | string | 否 | 印章类型 (PUBLIC, ...) (筛选) |
| sealStatus | integer (int32) | 否 | 印章状态 (1:启用, 2:待审, 3:不通过, 4:挂起) (筛选) |
| listPageNo | integer (int32) | 否 | 当前页码 (默认1) |
| listPageSize | integer (int32) | 否 | 每页数量 (默认10或20) |
curl -X POST 'https://your-api-host.com/seal/getSealListByPage' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-d '{
"listPageNo": 1,
"listPageSize": 5,
"sealStatus": 1
}'
{
"code": "200",
"msg": "成功",
"listPageNo": 1,
"countInPage": 2,
"listPageCount": 1,
"totalCount": 2,
"data": [ // 获取印章信息列表
{
"sealId": 50001,
"corpName": "示例有限公司",
"sealCode": "SEAL001",
"sealName": "市场部合同专用章",
"categoryType": "CONTRACT",
"sealStyle": 1,
"sealWidth": 159,
"sealHeight": 159,
"sealImageUrl": "https://your-resource-host.com/seal/50001.png",
"defaultFlag": 0,
"status": 1,
"sealHorizontalText": "市场部",
"sealBottomText": null,
"source": "API",
"authorNum": 3, // 授权数量
"createTime": "2024-01-20T10:00:00.000+0800"
},
{
"sealId": 50002,
"corpName": "示例有限公司",
"sealCode": "SEAL002",
"sealName": "手签章-张三",
"categoryType": "OTHER",
"sealStyle": 3,
"sealWidth": 200,
"sealHeight": 200,
"sealImageUrl": "https://your-resource-host.com/seal/50002.png",
"defaultFlag": 1,
"status": 1,
"sealHorizontalText": null,
"sealBottomText": null,
"source": "API",
"authorNum": 1,
"createTime": "2024-01-21T11:00:00.000+0800"
}
]
}
{
"code": "QUERY_ERROR", // 示例
"msg": "查询印章列表失败",
"data": null
}
| 参数名 | 类型 | 描述 |
|---|---|---|
| sealId | integer (int64) | 印章ID |
| corpName | string | 企业名称 |
| sealCode | string | 印章编号 |
| sealName | string | 印章名称 |
| categoryType | string | 印章类型 |
| sealStyle | integer (int32) | 制作方式 (1:模板, 3:图片) |
| sealWidth | integer (int32) | 印章宽 |
| sealHeight | integer (int32) | 印章高 |
| sealImageUrl | string | 印章图片URL |
| defaultFlag | integer (int32) | 是否默认章 (0:否, 1:是) |
| status | integer (int32) | 印章状态 (1:启用, 2:待审, 3:不通过, 4:挂起) |
| sealHorizontalText | string | 横向文 |
| sealBottomText | string | 下弦文 |
| source | string | 印章来源 |
| authorNum | integer (int32) | 授权数量 |
| createTime | string (date-time) | 创建时间 |
根据印章 ID 查询单个印章的详细信息。
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| appId | string | 是 | 您的应用ID |
| accessToken | string | 是 | 有效访问令牌 |
| userId | integer (int64) | 是 | 操作人用户ID |
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| sealId | integer (int64) | 是 | 需要查询的印章ID |
curl -X POST 'https://your-api-host.com/seal/getSealInfo' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-d '{
"sealId": 50001
}'
{
"code": "200",
"msg": "成功",
"data": { // 获取印章信息 (结构同列表查询)
"sealId": 50001,
"corpName": "示例有限公司",
"sealCode": "SEAL001",
"sealName": "市场部合同专用章",
"categoryType": "CONTRACT",
"sealStyle": 1,
"sealWidth": 159,
"sealHeight": 159,
"sealImageUrl": "https://your-resource-host.com/seal/50001.png",
"defaultFlag": 0,
"status": 1,
"sealHorizontalText": "市场部",
"sealBottomText": null,
"source": "API",
"authorNum": 3,
"createTime": "2024-01-20T10:00:00.000+0800"
}
}
{
"code": "SEAL_NOT_FOUND", // 示例
"msg": "印章不存在",
"data": null
}
为指定的企业印章添加新的授权规则,指定哪些人可以在什么条件下使用该印章。
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| appId | string | 是 | 您的应用ID |
| accessToken | string | 是 | 有效访问令牌 |
| userId | integer (int64) | 是 | 操作人用户ID (需有授权权限) |
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| sealId | integer (int64) | 是 | 要授权的印章ID |
| authorMemberRange | integer (int32) | 是 | 授权对象 (0:全部成员, 1:指定人员)。注:目前仅支持指定人员(1) |
| userIdList | array of objects | 是 | 被授权的用户ID列表 (UserInfo结构: {"userId": long}) |
| authorRole | string | 是 | 授权角色 (SEAL_USER: 使用员, SEAL_EXAMINER: 审批员) |
| authorRange | integer (int32) | 是 | 授权范围 (0:全部合同, 1:指定模板) |
| templatesList | array of objects | 否 | 若authorRange=1, 则需提供模板列表 (TemplateInfo结构: {"templateId": long, "templateName": string}) |
| effectiveTime | string (date-time) | 否 | 授权生效时间 (不传则立即生效) |
| expireTime | string (date-time) | 否 | 授权失效时间 (不传则永不失效) |
curl -X POST 'https://your-api-host.com/seal/addSealAuthor' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: ADMIN_ACCESS_TOKEN' \
-H 'userId: ADMIN_USER_ID' \
-d '{
"sealId": 50001,
"authorMemberRange": 1,
"userIdList": [
{"userId": 20002},
{"userId": 20003}
],
"authorRole": "SEAL_USER",
"authorRange": 0
}'
{
"code": "200",
"msg": "成功",
"data": {} // 成功通常不返回业务数据
}
{
"code": "AUTHOR_RULE_CONFLICT", // 示例
"msg": "授权规则与现有规则冲突",
"data": null
}
根据印章 ID 查询该印章的所有授权记录列表,支持分页。
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| appId | string | 是 | 您的应用ID |
| accessToken | string | 是 | 有效访问令牌 |
| userId | integer (int64) | 是 | 操作人用户ID |
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| sealId | integer (int64) | 是 | 需要查询授权记录的印章ID |
| listPageNo | integer (int32) | 否 | 当前页码 (默认1) |
| listPageSize | integer (int32) | 否 | 每页数量 (默认10或20) |
curl -X POST 'https://your-api-host.com/seal/getSealAuthorList' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-d '{
"sealId": 50001,
"listPageNo": 1,
"listPageSize": 10
}'
{
"code": "200",
"msg": "成功",
"listPageNo": 1,
"countInPage": 2,
"listPageCount": 1,
"totalCount": 2,
"data": [ // 获取印章授权记录信息列表
{
"id": 101,
"sealId": 50001,
"userId": 20002,
"userName": "李四",
"authorRole": "SEAL_USER",
"authorRange": 0, // 全部合同
"autoSign": 0,
"effectiveTime": "2024-01-20T11:00:00.000+0800",
"expireTime": null, // 永不失效
"examinerNotify": 0,
"status": 1, // 状态,具体值含义待确认
"templates": null,
"templateName": null,
"createTime": "2024-01-20T11:00:00.000+0800"
},
{
"id": 102,
"sealId": 50001,
"userId": 20003,
"userName": "王五",
"authorRole": "SEAL_EXAMINER",
"authorRange": 1, // 指定模板
"autoSign": 0,
"effectiveTime": "2024-01-20T11:05:00.000+0800",
"expireTime": "2024-12-31T23:59:59.000+0800",
"examinerNotify": 1,
"status": 1,
"templates": "[{\"templateId\":1001},{\"templateId\":1002}]", // JSON 字符串
"templateName": "报销单模板,请假单模板",
"createTime": "2024-01-20T11:05:00.000+0800"
}
]
}
{
"code": "SEAL_NOT_FOUND", // 示例
"msg": "印章不存在,无法查询授权",
"data": null
}
| 参数名 | 类型 | 描述 |
|---|---|---|
| id | integer (int64) | 授权记录ID |
| sealId | integer (int64) | 印章ID |
| userId | integer (int64) | 用户ID |
| userName | string | 用户名称 |
| authorRole | string | 授权角色 (SEAL_USER, SEAL_EXAMINER) |
| authorRange | integer (int32) | 授权范围 (0:全部, 1:指定模板) |
| autoSign | integer (int32) | 是否自动落章 (0:否, 1:是) |
| effectiveTime | string (date-time) | 生效时间 |
| expireTime | string (date-time) | 失效时间 |
| examinerNotify | integer (int32) | 审批员是否接收通知 (0:否, 1:是) |
| status | integer (int32) | 状态 (具体值待确认) |
| templates | string | 指定模板的ID列表 (JSON字符串) |
| templateName | string | 指定模板的名称列表 (逗号分隔) |
| createTime | string (date-time) | 创建时间 |
修改指定印章的名称。
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| appId | string | 是 | 您的应用ID |
| accessToken | string | 是 | 有效访问令牌 |
| userId | integer (int64) | 是 | 操作人用户ID |
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| sealId | integer (int64) | 是 | 需要修改的印章ID |
| sealName | string | 是 | 新的印章名称 |
curl -X POST 'https://your-api-host.com/seal/modify' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-d '{
"sealId": 50001,
"sealName": "市场部合同章(新)"
}'
{
"code": "200",
"msg": "成功",
"data": {}
}
{
"code": "SEAL_NAME_EXIST", // 示例
"msg": "印章名称已存在",
"data": null
}
逻辑删除指定的企业印章。
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| appId | string | 是 | 您的应用ID |
| accessToken | string | 是 | 有效访问令牌 |
| userId | integer (int64) | 是 | 操作人用户ID (需有删除权限) |
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| sealId | integer (int64) | 是 | 需要删除的印章ID |
curl -X POST 'https://your-api-host.com/seal/delete' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: ADMIN_ACCESS_TOKEN' \
-H 'userId: ADMIN_USER_ID' \
-d '{
"sealId": 50001
}'
{
"code": "200",
"msg": "成功",
"data": {}
}
{
"code": "SEAL_DELETE_FAILED", // 示例
"msg": "印章正在使用或有关联数据,无法删除",
"data": null
}
将指定的印章设置为企业的默认印章。
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| appId | string | 是 | 您的应用ID |
| accessToken | string | 是 | 有效访问令牌 |
| userId | integer (int64) | 是 | 操作人用户ID |
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| sealId | integer (int64) | 是 | 要设置为默认的印章ID |
curl -X POST 'https://your-api-host.com/seal/updDefault' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-d '{
"sealId": 50002
}'
{
"code": "200",
"msg": "成功",
"data": {}
}
{
"code": "SEAL_NOT_FOUND", // 示例
"msg": "印章不存在",
"data": null
}
为当前操作用户生成一个内嵌或跳转的企业印章管理页面的链接。
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| appId | string | 是 | 您的应用ID |
| accessToken | string | 是 | 有效访问令牌 |
| userId | integer (int64) | 是 | 操作人用户ID |
此接口请求 Body 为空。
curl -X POST 'https://your-api-host.com/seal/getSealAuthorUrl' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: ADMIN_ACCESS_TOKEN' \
-H 'userId: ADMIN_USER_ID' \
-d '{}'
{
"code": "200",
"msg": "成功",
"data": "https://your-system-url.com/embed/seal/manage?session=temp_session_token" // 返回管理页面链接
}
{
"code": "PERMISSION_DENIED", // 示例
"msg": "无权限访问印章管理",
"data": null
}