跳到主要内容

POST 合同统计(富参)

参数位置:body:ownerScope、ownerIds、allData、includeCreators。 POST 合同统计(只读)。body 为 JSON 对象,均可选:ownerScope(ALL/MINE/TEAM/FOLLOWED)、ownerIds(负责人ID数组,非空时优先于 ownerScope)、allData(ownerIds 分支下 true=不按负责人过滤)、includeCreators(true=同时按创建人匹配 ownerIds)。

接口编码所需范围后端接口
sales.contract.statistics-querysales:readPOST /v1/sales-contract/statistics(comap-sales)

请求体字段(body)

字段类型必填说明
ownerScopestring—范围:ALL-全部 MINE-我负责 TEAM-下属 FOLLOWED/WATCHED-我关注(历史入参,nullable)
ownerIdsinteger(int64)[]—负责人 ID IN 列表,nullable。非空时绕过 ownerScope 走 ownerIds 分支。
allDataboolean—是否查询全量数据,nullable。仅在 ownerIds 分支生效;true 表示不再按 ownerId 过滤。
includeCreatorsboolean—是否把创建人(create_by)纳入 ownerIds 分支的过滤范围,nullable。

「必填」仅反映接口规格声明的部分。服务内还有未体现在规格里的校验, 标「—」不等于可以不传;租户在主站配置的字段必填不约束本接口。 详见必填字段的判定与字段清单与自定义字段。

请求示例

curl -X POST https://open.risemap.cn/v1/api/invoke \
-H "Authorization: Bearer <访问令牌>" \
-H "Content-Type: application/json" \
-d '{
"apiCode": "sales.contract.statistics-query",
"body": {}
}'

响应 data 字段

字段类型必填说明
totalCountinteger(int64)—合同总数
draftCountinteger(int64)—草稿数量
pendingCountinteger(int64)—待审批数量
rejectedCountinteger(int64)—已驳回数量
executingCountinteger(int64)—执行中数量(已审批且业务状态执行中)
completedCountinteger(int64)—已完成数量
terminatedCountinteger(int64)—已终止数量
closedCountinteger(int64)—已关闭数量(已审批且手动完结)
materialCountinteger(int64)—物料合同数量(合同构成 MATERIAL)
serviceCountinteger(int64)—服务合同数量(合同构成 SERVICE)
mixedCountinteger(int64)—混合合同数量(合同构成 MIXED)
totalAmountnumber—合同总金额(范围内全部合同)
executingAmountnumber—执行中合同金额合计
paidAmountnumber—已回款金额
invoicedAmountnumber—已开票金额
paymentRatenumber—回款率(已回款/合同总额,%)
invoiceRatenumber—开票占总额比例(%)

错误处理​

响应统一信封 { code, message, data },code == 200 为成功。以下是本接口可能返回的开放平台层错误:

错误码说明可重试
92101访问凭证无效否
92201接口未登记或已停用否
92202超出凭证授权范围——本接口需 sales:read否
92204绑定员工无此接口的功能权限否
92203上游服务调用失败是
92301请求过于频繁是

除此之外,comap-sales 自身的业务校验失败会原样透传其业务码与提示 (如字段校验、状态不允许、数据不存在),这类码不在开放平台的号段内, 以响应里的 message 为准。完整的平台层错误码见错误码说明。

← 返回销售合同管理