Files
docs/财务管理/openapi/finance-phase1-five-pages-v1.yaml
T

1451 lines
63 KiB
YAML
Raw Normal View History

2026-08-11 18:06:30 +08:00
openapi: 3.0.3
info:
title: Finance Phase 1 Five-page Acceptance API
version: 1.0.0-draft
description: >-
一期领导验收 5 页目标契约:客户账户、客户应收应付、客户对账单、结算单应收、
结算单应付。只支持 CNY。费用分析、利润表、钱包、预收和充值不属于本契约。
2026-08-11 18:43:53 +08:00
本文件只冻结一期目标契约,不记录开发中间态或测试进度。11 个 P0 operation 的实现与
Admin 接入证据单独维护在财务一期P0实现证据矩阵.md,不得因代码文件出现反复修改本契约。
2026-08-11 18:06:30 +08:00
servers:
- url: /api
x-product-scope:
included:
- CUSTOMER_ACCOUNT_DERIVED_VIEW
- CUSTOMER_ARAP_FEE_SOURCE_POOL
- CUSTOMER_RECONCILIATION_STATEMENT
- RECEIVABLE_SETTLEMENT
- PAYABLE_SETTLEMENT
excluded:
- WALLET
- PREPAYMENT
- MANUAL_RECHARGE
- COST_ANALYSIS
- PROFIT_REPORT
- FOREIGN_CURRENCY
- EXCHANGE_RATE
x-source-gate:
eligible: APPROVED + PUBLISHED + settlementIncluded=true + ACTIVE + CNY
currentStatus: Finance 已显式校验非作废事件 PUBLISHED、APPROVED、参与结算、CNY、amount>0、客户/版本/方向/来源归属;Inbox 幂等及 fin_fee_source 写入/替代/作废均已验证。
2026-08-11 18:43:53 +08:00
x-phase1-p0-contract:
status: FROZEN
operationCount: 11
rule: 11 个 operation 均为一期 P0 目标契约;实现状态不得写入本文件。
2026-08-11 18:17:02 +08:00
contract: ../财务一期P0操作契约与验收用例.md
2026-08-11 18:43:53 +08:00
evidenceMatrix: ../财务一期P0实现证据矩阵.md
2026-08-11 18:17:02 +08:00
x-idempotency-contract:
scope: method + normalizedPath + resolvedCustomerId + completeQueryAndBody
sameKeySameRequest: replay original result
sameKeyDifferentRequest: FIN_409
processing: FIN_409;超时后按现有 Finance 抢占恢复规则执行
failed: 按现有 Finance FAILED 恢复规则执行
x-error-contract:
FIN_400: 参数、日期、CNY 或正金额校验失败
FIN_404: 对象不存在或跨客户对象隐藏
FIN_409: 非法状态、乐观锁、重复占用或幂等冲突
FIN_503: File 或内部依赖不可用且 fail-closed
FIN_001: 未分类服务端错误
authentication: HTTP 401
permission: HTTP 403
2026-08-11 18:06:30 +08:00
paths:
/internal/finance/v1/fee-source-events:
post:
servers:
- url: /
operationId: consumeFirstlegFeeSourceEvent
summary: 消费 Firstleg 不可变费用来源事件
description: >-
使用内部服务令牌鉴权;按 eventId 和完整事件请求哈希幂等消费,回查 Firstleg
入库或柜子费用快照,校验客户、版本、审核、参与结算、CNY、方向和来源类型后,
写入 fin_inbox_event 与 fin_fee_source。调整新增版本并替代旧 AVAILABLE 版本,作废只改状态不删除历史。
x-authentication: X-Internal-Service-Token
x-error-codes:
- FIN-EVT-001
- FIN-EVT-002
- FIN-EVT-003
- FIN-EVT-004
- FIN-EVT-005
- FIN-EVT-006
- FIN-EVT-007
- FIN-EVT-008
- FIN-EVT-009
- FIN-EVT-010
- FIN-EVT-011
- FIN-EVT-012
- FIN-EVT-013
- FIN-EVT-014
- FIN-EVT-015
- FIN-EVT-401
parameters:
- $ref: '#/components/parameters/InternalServiceToken'
requestBody:
required: true
content:
application/json:
schema: {$ref: '#/components/schemas/FinanceFeeSourceEvent'}
responses:
'200':
description: 成功消费、同参重放结果或稳定业务错误。
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/FeeSourceEventResultEnvelope'
- $ref: '#/components/schemas/ErrorEnvelope'
/platform/finance/v1/accounts:
get:
operationId: listDerivedCustomerAccounts
summary: 查询客户财务账户派生汇总
description: 只读聚合,不返回钱包余额,不提供充值或余额调整动作。
2026-08-11 18:43:53 +08:00
x-contract-status: FROZEN
2026-08-11 18:17:02 +08:00
x-delivery-priority: PHASE1_P0
x-request-dto: AccountListQuery
x-response-dto: AccountPageEnvelope
x-idempotency: READ_ONLY_NOT_APPLICABLE
x-customer-isolation: 平台权限下按真实客户主体聚合;不得返回 tenantId,不得产生可写余额。
x-state-machine: READ_ONLY_DERIVED_VIEW
x-error-codes: [FIN_400, FIN_001]
x-acceptance-cases: [AC-01, AC-02]
2026-08-11 18:06:30 +08:00
x-permission: platform:finance:account:view
parameters:
- $ref: '#/components/parameters/Page'
- $ref: '#/components/parameters/PageSize'
- name: keyword
in: query
schema: {type: string}
- name: status
in: query
schema: {type: string, enum: [ACTIVE, DISABLED]}
responses:
'200': {$ref: '#/components/responses/AccountPageResponse'}
2026-08-11 18:17:02 +08:00
'400': {$ref: '#/components/responses/BusinessError'}
'403': {$ref: '#/components/responses/BusinessError'}
2026-08-11 18:06:30 +08:00
/platform/finance/v1/customer-accounts/{customerId}:
get:
operationId: getDerivedCustomerAccount
summary: 查询客户财务账户详情
x-permission: platform:finance:bill:view
parameters:
- $ref: '#/components/parameters/CustomerId'
responses:
'200': {$ref: '#/components/responses/CustomerAccountReadResponse'}
'404': {$ref: '#/components/responses/BusinessError'}
2026-08-13 12:22:36 +08:00
/platform/finance/v1/customer-accounts/{customerId}/summary:
get:
operationId: getCustomerAccountSummary
summary: 查询客户正式结算口径财务汇总
description: >-
固定 CNY。累计应收、已收和未结清仅聚合本客户非 VOIDED 的正式 RECEIVABLE
fin_settlement;待出账仅聚合合格且尚未进入非 VOIDED 对账单的应收费用来源;
未结应付仅聚合本客户非 VOIDED 的正式 PAYABLE fin_settlement。
x-permission: platform:finance:customer-account:list
x-customer-isolation: 所有聚合子查询都必须使用 customerId 约束,空客户返回零值。
parameters:
- $ref: '#/components/parameters/CustomerId'
responses:
'200': {$ref: '#/components/responses/CustomerAccountSummaryResponse'}
'400': {$ref: '#/components/responses/BusinessError'}
'403': {$ref: '#/components/responses/BusinessError'}
2026-08-11 18:06:30 +08:00
/platform/finance/v1/accounts/{customerId}/ledger:
get:
operationId: listDerivedCustomerAccountLedger
summary: 查询客户财务派生流水
2026-08-11 18:43:53 +08:00
x-contract-status: FROZEN
2026-08-11 18:17:02 +08:00
x-delivery-priority: PHASE1_P0
x-request-dto: AccountLedgerQuery
x-response-dto: LedgerPageEnvelope
x-idempotency: READ_ONLY_NOT_APPLICABLE
x-customer-isolation: customerId 必须解析为真实客户,流水只聚合该客户数据;跨客户对象不得出现。
x-state-machine: READ_ONLY_DERIVED_VIEW
x-error-codes: [FIN_400, FIN_404, FIN_001]
x-acceptance-cases: [AC-03, AC-04]
2026-08-11 18:06:30 +08:00
x-permission: platform:finance:account:view
parameters:
- $ref: '#/components/parameters/CustomerId'
- $ref: '#/components/parameters/Page'
- $ref: '#/components/parameters/PageSize'
- name: businessType
in: query
schema: {$ref: '#/components/schemas/LedgerBusinessType'}
- name: startDate
in: query
schema: {type: string, format: date}
- name: endDate
in: query
schema: {type: string, format: date}
responses:
'200': {$ref: '#/components/responses/LedgerPageResponse'}
2026-08-11 18:17:02 +08:00
'400': {$ref: '#/components/responses/BusinessError'}
'403': {$ref: '#/components/responses/BusinessError'}
'404': {$ref: '#/components/responses/BusinessError'}
2026-08-11 18:06:30 +08:00
/platform/finance/v1/fee-pool:
get:
operationId: listFinanceFeeSources
summary: 查询客户应收应付费用来源池
x-permission: platform:finance:bill:view
parameters:
- name: customerId
in: query
required: true
schema: {$ref: '#/components/schemas/Id'}
- name: direction
in: query
schema: {$ref: '#/components/schemas/FeeDirection'}
responses:
'200': {$ref: '#/components/responses/FeePoolReadResponse'}
/platform/finance/v1/fee-sources/{feeSourceId}:
get:
operationId: getFinanceFeeSource
summary: 查询费用来源详情、业务关联和操作记录
2026-08-11 18:43:53 +08:00
x-contract-status: FROZEN
2026-08-11 18:17:02 +08:00
x-delivery-priority: PHASE1_P0
x-request-dto: FeeSourceIdPath
x-response-dto: FeeSourceDetailEnvelope
x-idempotency: READ_ONLY_NOT_APPLICABLE
x-customer-isolation: 按费用来源真实 customerId 返回;跨客户关联按 FIN_404 隐藏。
x-state-machine: READ_ONLY_ALL_SOURCE_STATES
x-error-codes: [FIN_404, FIN_001]
x-acceptance-cases: [AC-05]
2026-08-11 18:06:30 +08:00
x-permission: platform:finance:fee-source:view
parameters:
- $ref: '#/components/parameters/FeeSourceId'
responses:
'200': {$ref: '#/components/responses/FeeSourceDetailResponse'}
2026-08-11 18:17:02 +08:00
'403': {$ref: '#/components/responses/BusinessError'}
2026-08-11 18:06:30 +08:00
'404': {$ref: '#/components/responses/BusinessError'}
/platform/finance/v1/fee-sources/{feeSourceId}/review:
post:
operationId: reviewFinanceFeeSource
summary: 审核费用来源
2026-08-11 18:43:53 +08:00
x-contract-status: FROZEN
2026-08-11 18:17:02 +08:00
x-delivery-priority: PHASE1_P0
x-request-dto: ReviewRequest
x-response-dto: FeeSourceDetailEnvelope
x-idempotency: FULL_REQUEST_HASH_SAME_REPLAY_DIFFERENT_CONFLICT
x-customer-isolation: 只按 feeSourceId 解析其真实客户;请求不得覆盖 customerId 或金额。
x-state-machine: PENDING -> APPROVED | REJECTED
x-error-codes: [FIN_400, FIN_404, FIN_409, FIN_001]
x-acceptance-cases: [AC-06, AC-07, AC-29]
2026-08-11 18:06:30 +08:00
x-permission: platform:finance:fee-source:review
parameters:
- $ref: '#/components/parameters/FeeSourceId'
- $ref: '#/components/parameters/IdempotencyKey'
requestBody:
required: true
content:
application/json:
schema: {$ref: '#/components/schemas/ReviewRequest'}
responses:
'200': {$ref: '#/components/responses/FeeSourceDetailResponse'}
2026-08-11 18:17:02 +08:00
'400': {$ref: '#/components/responses/BusinessError'}
'403': {$ref: '#/components/responses/BusinessError'}
'404': {$ref: '#/components/responses/BusinessError'}
2026-08-11 18:06:30 +08:00
'409': {$ref: '#/components/responses/BusinessError'}
/platform/finance/v1/fee-sources/{feeSourceId}/settlement-inclusion:
put:
operationId: updateFeeSourceSettlementInclusion
summary: 设置参与结算或禁止结算
2026-08-11 18:43:53 +08:00
x-contract-status: FROZEN
2026-08-11 18:17:02 +08:00
x-delivery-priority: PHASE1_P0
x-request-dto: SettlementInclusionRequest
x-response-dto: FeeSourceDetailEnvelope
x-idempotency: FULL_REQUEST_HASH_SAME_REPLAY_DIFFERENT_CONFLICT
x-customer-isolation: 只按 feeSourceId 解析其真实客户;跨客户业务引用按 FIN_404 隐藏。
x-state-machine: APPROVED + PUBLISHED + AVAILABLE + CNY 可切换;LOCKED/BILLED/VOIDED/SUPERSEDED 禁止修改
x-error-codes: [FIN_400, FIN_404, FIN_409, FIN_001]
x-acceptance-cases: [AC-08, AC-09, AC-29]
2026-08-11 18:06:30 +08:00
x-permission: platform:finance:fee-source:settlement
parameters:
- $ref: '#/components/parameters/FeeSourceId'
- $ref: '#/components/parameters/IdempotencyKey'
requestBody:
required: true
content:
application/json:
schema: {$ref: '#/components/schemas/SettlementInclusionRequest'}
responses:
'200': {$ref: '#/components/responses/FeeSourceDetailResponse'}
2026-08-11 18:17:02 +08:00
'400': {$ref: '#/components/responses/BusinessError'}
'403': {$ref: '#/components/responses/BusinessError'}
'404': {$ref: '#/components/responses/BusinessError'}
2026-08-11 18:06:30 +08:00
'409': {$ref: '#/components/responses/BusinessError'}
/platform/finance/v1/statements:
get:
operationId: listReconciliationStatements
summary: 查询客户对账单
x-permission: platform:finance:bill:view
parameters:
- name: customerId
in: query
required: true
schema: {$ref: '#/components/schemas/Id'}
responses:
'200': {$ref: '#/components/responses/StatementListReadResponse'}
post:
operationId: createReconciliationStatement
summary: 按截止时间或勾选来源生成客户对账单草稿
2026-08-11 18:43:53 +08:00
x-contract-status: FROZEN
2026-08-11 18:17:02 +08:00
x-delivery-priority: PHASE1_P0
x-request-dto: CreateReconciliationRequest
x-response-dto: ReconciliationDetailEnvelope
x-idempotency: FULL_REQUEST_HASH_SAME_REPLAY_DIFFERENT_CONFLICT
x-customer-isolation: 所有来源必须属于 request.customerId;跨客户来源按 FIN_404,禁止部分落库。
x-state-machine: 合格且未占用来源 -> DRAFT;创建时锁定所选来源
x-error-codes: [FIN_400, FIN_404, FIN_409, FIN_001]
x-acceptance-cases: [AC-10, AC-11, AC-12, AC-29]
2026-08-11 18:06:30 +08:00
x-permission: platform:finance:reconciliation:create
parameters:
- $ref: '#/components/parameters/IdempotencyKey'
requestBody:
required: true
content:
application/json:
schema: {$ref: '#/components/schemas/CreateReconciliationRequest'}
responses:
'200': {$ref: '#/components/responses/ReconciliationDetailResponse'}
2026-08-11 18:17:02 +08:00
'400': {$ref: '#/components/responses/BusinessError'}
'403': {$ref: '#/components/responses/BusinessError'}
'404': {$ref: '#/components/responses/BusinessError'}
2026-08-11 18:06:30 +08:00
'409': {$ref: '#/components/responses/BusinessError'}
/platform/finance/v1/bills/{billId}:
get:
operationId: getReconciliationStatement
summary: 查询客户对账单详情、费用明细和支付历史
x-permission: platform:finance:bill:view
parameters:
- $ref: '#/components/parameters/BillId'
responses:
'200': {$ref: '#/components/responses/StatementDetailReadResponse'}
'404': {$ref: '#/components/responses/BusinessError'}
/platform/finance/v1/reconciliation-statements/{statementId}/actions:
post:
operationId: actionReconciliationStatement
2026-08-11 18:17:02 +08:00
summary: 提交、审核、出账、调整、作废或重开客户对账单
2026-08-11 18:43:53 +08:00
x-contract-status: FROZEN
2026-08-11 18:17:02 +08:00
x-delivery-priority: PHASE1_P0
x-request-dto: ReconciliationActionRequest
x-response-dto: ReconciliationDetailEnvelope
x-idempotency: FULL_REQUEST_HASH_SAME_REPLAY_DIFFERENT_CONFLICT
x-customer-isolation: statementId 决定客户;调整行必须全部属于该对账单,跨客户按 FIN_404。
x-state-machine: DRAFT->PENDING_REVIEW->APPROVED->ISSUED;REJECTED/VOIDED 可 REOPEN 新 revision;ISSUED 仅 ADJUST 新 revision
x-error-codes: [FIN_400, FIN_404, FIN_409, FIN_001]
x-acceptance-cases: [AC-13, AC-14, AC-15, AC-16, AC-17, AC-29]
x-permission-by-action:
SUBMIT: platform:finance:reconciliation:create
APPROVE: platform:finance:reconciliation:review
REJECT: platform:finance:reconciliation:review
ISSUE: platform:finance:reconciliation:issue
ADJUST: platform:finance:reconciliation:adjust
VOID: platform:finance:reconciliation:void
REOPEN: platform:finance:reconciliation:void
2026-08-11 18:06:30 +08:00
parameters:
- $ref: '#/components/parameters/StatementId'
- $ref: '#/components/parameters/IdempotencyKey'
requestBody:
required: true
content:
application/json:
2026-08-11 18:17:02 +08:00
schema: {$ref: '#/components/schemas/ReconciliationActionRequest'}
2026-08-11 18:06:30 +08:00
responses:
'200': {$ref: '#/components/responses/ReconciliationDetailResponse'}
2026-08-11 18:17:02 +08:00
'400': {$ref: '#/components/responses/BusinessError'}
'403': {$ref: '#/components/responses/BusinessError'}
'404': {$ref: '#/components/responses/BusinessError'}
2026-08-11 18:06:30 +08:00
'409': {$ref: '#/components/responses/BusinessError'}
/platform/finance/v1/receivable-settlements:
get:
operationId: listReceivableSettlements
summary: 查询结算单应收
x-permission: platform:finance:bill:view
parameters:
- name: customerId
in: query
required: true
schema: {$ref: '#/components/schemas/Id'}
responses:
'200': {$ref: '#/components/responses/ReceivableSettlementListReadResponse'}
post:
operationId: createReceivableSettlement
summary: 从审核通过的客户对账单生成应收结算单
2026-08-11 18:43:53 +08:00
x-contract-status: FROZEN
2026-08-11 18:17:02 +08:00
x-delivery-priority: PHASE1_P0
x-request-dto: CreateReceivableSettlementRequest
x-response-dto: SettlementDetailEnvelope
x-idempotency: FULL_REQUEST_HASH_SAME_REPLAY_DIFFERENT_CONFLICT
x-customer-isolation: 客户从对账单派生,不接受前端覆盖;跨客户关联按 FIN_404。
x-state-machine: ISSUED reconciliation -> ISSUED RECEIVABLE settlement;一张对账单只允许一个有效 AR
x-error-codes: [FIN_400, FIN_404, FIN_409, FIN_001]
x-acceptance-cases: [AC-18, AC-19, AC-29]
2026-08-11 18:06:30 +08:00
x-permission: platform:finance:settlement-ar:create
parameters:
- $ref: '#/components/parameters/IdempotencyKey'
requestBody:
required: true
content:
application/json:
schema: {$ref: '#/components/schemas/CreateReceivableSettlementRequest'}
responses:
'200': {$ref: '#/components/responses/SettlementDetailResponse'}
2026-08-11 18:17:02 +08:00
'400': {$ref: '#/components/responses/BusinessError'}
'403': {$ref: '#/components/responses/BusinessError'}
'404': {$ref: '#/components/responses/BusinessError'}
2026-08-11 18:06:30 +08:00
'409': {$ref: '#/components/responses/BusinessError'}
/platform/finance/v1/payable-settlements:
get:
operationId: listPayableSettlements
summary: 查询结算单应付
x-permission: platform:finance:cost:view
parameters:
- name: customerId
in: query
required: true
schema: {$ref: '#/components/schemas/Id'}
responses:
'200': {$ref: '#/components/responses/PayableSettlementListReadResponse'}
post:
operationId: createPayableSettlement
summary: 从审核通过且参与结算的应付来源生成应付结算单
2026-08-11 18:43:53 +08:00
x-contract-status: FROZEN
2026-08-11 18:17:02 +08:00
x-delivery-priority: PHASE1_P0
x-request-dto: CreatePayableSettlementRequest
x-response-dto: SettlementDetailEnvelope
x-idempotency: FULL_REQUEST_HASH_SAME_REPLAY_DIFFERENT_CONFLICT
x-customer-isolation: 所有 PAYABLE 来源必须同 customerId 且同 supplierId;跨客户来源按 FIN_404。
x-state-machine: 合格未占用 PAYABLE 来源 -> ISSUED PAYABLE settlement
x-error-codes: [FIN_400, FIN_404, FIN_409, FIN_001]
x-acceptance-cases: [AC-20, AC-21, AC-29]
2026-08-11 18:06:30 +08:00
x-permission: platform:finance:settlement-ap:create
parameters:
- $ref: '#/components/parameters/IdempotencyKey'
requestBody:
required: true
content:
application/json:
schema: {$ref: '#/components/schemas/CreatePayableSettlementRequest'}
responses:
'200': {$ref: '#/components/responses/SettlementDetailResponse'}
2026-08-11 18:17:02 +08:00
'400': {$ref: '#/components/responses/BusinessError'}
'403': {$ref: '#/components/responses/BusinessError'}
'404': {$ref: '#/components/responses/BusinessError'}
2026-08-11 18:06:30 +08:00
'409': {$ref: '#/components/responses/BusinessError'}
/platform/finance/v1/receipts:
get:
operationId: listPlatformReceipts
summary: 平台按客户查询人工收款记录
x-permission: platform:finance:receipt:view
parameters:
- name: customerId
in: query
required: true
schema: {$ref: '#/components/schemas/Id'}
responses:
'200': {$ref: '#/components/responses/PlatformReceiptListReadResponse'}
post:
operationId: createReceiptWithAllocations
summary: 人工登记一笔收款并分配到一张或多张应收结算单
description: >-
收款总额必须等于 allocations 金额之和;所有结算单必须属于同一客户且为 CNY,
每笔分配不得超过对应未收余额。示例:收款 300 元可分配到 3 张结算单各 100 元,
共用同一组收款凭证图片。File 校验失败或不可用时必须 fail-closed,不得落库。
x-permission: platform:finance:receipt:create
parameters:
- $ref: '#/components/parameters/IdempotencyKey'
requestBody:
required: true
content:
application/json:
schema: {$ref: '#/components/schemas/CreateReceiptRequest'}
responses:
'200': {$ref: '#/components/responses/ResourceResultResponse'}
'409': {$ref: '#/components/responses/BusinessError'}
/client/finance/v1/receipts:
get:
operationId: listClientVisibleReceipts
summary: 客户只读查询已确认收款和账单分配
description: 使用登录客户身份隔离,不接收 customerId;不返回凭证、操作人、内部备注或 tenantId。
x-permission: merchant:finance:statement:view
responses:
'200': {$ref: '#/components/responses/ClientReceiptListReadResponse'}
/platform/finance/v1/settlements/{settlementId}:
get:
operationId: getSettlement
summary: 查询应收或应付结算单详情
2026-08-11 18:43:53 +08:00
x-contract-status: FROZEN
2026-08-11 18:17:02 +08:00
x-delivery-priority: PHASE1_P0
x-request-dto: SettlementIdPath
x-response-dto: SettlementDetailEnvelope
x-idempotency: READ_ONLY_NOT_APPLICABLE
x-customer-isolation: 按结算单真实客户返回;不得返回其他客户数据,客户侧仍使用独立脱敏接口。
x-state-machine: READ_ONLY_ALL_SETTLEMENT_STATES
x-error-codes: [FIN_404, FIN_001]
x-acceptance-cases: [AC-22, AC-23]
2026-08-11 18:06:30 +08:00
x-permission-any-of:
- platform:finance:settlement-ar:view
- platform:finance:settlement-ap:view
parameters:
- $ref: '#/components/parameters/SettlementId'
responses:
'200': {$ref: '#/components/responses/SettlementDetailResponse'}
2026-08-11 18:17:02 +08:00
'403': {$ref: '#/components/responses/BusinessError'}
2026-08-11 18:06:30 +08:00
'404': {$ref: '#/components/responses/BusinessError'}
/platform/finance/v1/settlements/{settlementId}/transactions:
post:
operationId: createSettlementPayment
summary: 人工登记应付结算单付款并上传凭证
2026-08-11 18:43:53 +08:00
x-contract-status: FROZEN
2026-08-11 18:17:02 +08:00
x-delivery-priority: PHASE1_P0
x-request-dto: CreateSettlementPaymentRequest
x-response-dto: SettlementDetailEnvelope
x-idempotency: FULL_REQUEST_HASH_SAME_REPLAY_DIFFERENT_CONFLICT
x-customer-isolation: settlementId 决定客户和供应商;凭证必须属于同一客户的 FINANCE_VOUCHER。
x-state-machine: PAYABLE ISSUED -> PARTIALLY_PAID -> PAID;金额不得超过 outstandingAmount
x-error-codes: [FIN_400, FIN_404, FIN_409, FIN_503, FIN_001]
x-acceptance-cases: [AC-24, AC-25, AC-26, AC-29]
2026-08-11 18:06:30 +08:00
x-permission: platform:finance:payment:create
parameters:
- $ref: '#/components/parameters/SettlementId'
- $ref: '#/components/parameters/IdempotencyKey'
requestBody:
required: true
content:
application/json:
schema: {$ref: '#/components/schemas/CreateSettlementPaymentRequest'}
responses:
'200': {$ref: '#/components/responses/SettlementDetailResponse'}
2026-08-11 18:17:02 +08:00
'400': {$ref: '#/components/responses/BusinessError'}
'403': {$ref: '#/components/responses/BusinessError'}
'404': {$ref: '#/components/responses/BusinessError'}
2026-08-11 18:06:30 +08:00
'409': {$ref: '#/components/responses/BusinessError'}
2026-08-11 18:17:02 +08:00
'503': {$ref: '#/components/responses/BusinessError'}
2026-08-13 11:57:37 +08:00
/platform/finance/v1/settlements/{settlementId}/actions:
post:
operationId: actionSettlement
summary: 作废或重开未发生收付款的结算单
x-contract-status: FROZEN
x-idempotency: FULL_REQUEST_HASH_SAME_REPLAY_DIFFERENT_CONFLICT
x-state-machine: ISSUED -> VOIDED -> ISSUED;paidAmount 必须为 0
x-permission: platform:finance:settlement:void
parameters:
- $ref: '#/components/parameters/SettlementId'
- $ref: '#/components/parameters/IdempotencyKey'
requestBody:
required: true
content:
application/json:
schema: {$ref: '#/components/schemas/SettlementActionRequest'}
responses:
'200': {$ref: '#/components/responses/SettlementDetailResponse'}
'400': {$ref: '#/components/responses/BusinessError'}
'403': {$ref: '#/components/responses/BusinessError'}
'404': {$ref: '#/components/responses/BusinessError'}
'409': {$ref: '#/components/responses/BusinessError'}
2026-08-11 18:06:30 +08:00
components:
parameters:
InternalServiceToken:
name: X-Internal-Service-Token
in: header
required: true
schema: {type: string, minLength: 1}
CustomerId:
name: customerId
in: path
required: true
schema: {$ref: '#/components/schemas/Id'}
FeeSourceId:
name: feeSourceId
in: path
required: true
schema: {$ref: '#/components/schemas/Id'}
StatementId:
name: statementId
in: path
required: true
schema: {$ref: '#/components/schemas/Id'}
BillId:
name: billId
in: path
required: true
schema: {$ref: '#/components/schemas/Id'}
SettlementId:
name: settlementId
in: path
required: true
schema: {$ref: '#/components/schemas/Id'}
Page:
name: page
in: query
required: false
schema: {type: integer, minimum: 1, default: 1}
PageSize:
name: pageSize
in: query
required: false
schema: {type: integer, minimum: 1, maximum: 200, default: 20}
IdempotencyKey:
name: Idempotency-Key
in: header
required: true
schema: {type: string, minLength: 1, maxLength: 128}
description: 完整规范化 method/path/customer/body 哈希;同参重放,异参冲突。
schemas:
Id:
type: string
pattern: '^[1-9][0-9]*$'
FinanceFeeSourceEvent:
type: object
required: [eventId, eventType, eventVersion, producer, occurredAt, tenantId, aggregateType, aggregateId, sequence, idempotencyKey, payloadHash, payload]
properties:
eventId: {type: string, minLength: 1}
eventType:
type: string
enum: [FIRSTLEG_FEE_PUBLISHED, FIRSTLEG_FEE_ADJUSTED, FIRSTLEG_FEE_VOIDED]
eventVersion: {type: integer, minimum: 1}
producer: {type: string, enum: [firstleg-service]}
occurredAt: {type: string, format: date-time}
tenantId: {$ref: '#/components/schemas/Id'}
aggregateType: {type: string, enum: [INBOUND, CONTAINER]}
aggregateId: {$ref: '#/components/schemas/Id'}
sequence: {type: integer, minimum: 1}
idempotencyKey: {type: string, minLength: 1}
payloadHash: {type: string, pattern: '^[a-f0-9]{64}$'}
payload: {$ref: '#/components/schemas/FinanceFeeSourceEventPayload'}
FinanceFeeSourceEventPayload:
type: object
required: [feeId, feeVersion]
properties:
inboundId: {$ref: '#/components/schemas/Id'}
containerId: {$ref: '#/components/schemas/Id'}
feeId: {$ref: '#/components/schemas/Id'}
feeVersion: {type: integer, minimum: 1}
oneOf:
- required: [inboundId]
not: {required: [containerId]}
- required: [containerId]
not: {required: [inboundId]}
FeeSourceEventResult:
type: object
required: [feeSourceId]
properties:
feeSourceId: {type: integer, format: int64, minimum: 1}
Money:
type: string
pattern: '^(0|[1-9][0-9]*)(\.[0-9]{1,6})?$'
2026-08-11 18:17:02 +08:00
PositiveMoney:
type: string
pattern: '^(0\.(?=[0-9]{0,5}[1-9])[0-9]{1,6}|[1-9][0-9]*(\.[0-9]{1,6})?)$'
2026-08-11 18:06:30 +08:00
FeeDirection:
type: string
enum: [RECEIVABLE, PAYABLE]
FeeSourceType:
type: string
enum: [INBOUND_FEE, CONTAINER_FEE]
ReviewStatus:
type: string
enum: [PENDING, APPROVED, REJECTED]
ReconciliationStatus:
type: string
2026-08-11 18:17:02 +08:00
enum: [DRAFT, PENDING_REVIEW, APPROVED, ISSUED, REJECTED, VOIDED]
2026-08-11 18:06:30 +08:00
SettlementStatus:
type: string
enum: [DRAFT, PENDING_REVIEW, ISSUED, PARTIALLY_PAID, PAID, REJECTED, VOIDED]
PaymentStatus:
type: string
enum: [UNPAID, PARTIALLY_PAID, PAID, OVERDUE]
LedgerBusinessType:
type: string
enum: [FEE_INCLUDED, FEE_EXCLUDED, RECONCILIATION_CREATED, SETTLEMENT_ISSUED, RECEIPT, PAYMENT, ADJUSTMENT, VOID]
TraceMeta:
type: object
required: [requestId, traceId, timestamp]
properties:
requestId: {type: string, minLength: 1}
traceId: {type: string, minLength: 1}
timestamp: {type: string, format: date-time}
PageMeta:
type: object
required: [page, pageSize, total]
properties:
page: {type: integer, minimum: 1}
pageSize: {type: integer, minimum: 1}
total: {type: integer, format: int64, minimum: 0}
AccountSummary:
type: object
required: [customerId, customerCode, customerName, outstandingReceivable, pendingBilling, receivedInPeriod, outstandingPayable, status, lastChangedAt]
properties:
customerId: {$ref: '#/components/schemas/Id'}
customerCode: {type: string}
customerName: {type: string}
contactName: {type: string}
contactPhone: {type: string}
outstandingReceivable: {$ref: '#/components/schemas/Money'}
pendingBilling: {$ref: '#/components/schemas/Money'}
receivedInPeriod: {$ref: '#/components/schemas/Money'}
outstandingPayable: {$ref: '#/components/schemas/Money'}
status: {type: string, enum: [ACTIVE, DISABLED]}
lastChangedAt: {type: string, format: date-time}
AccountDetail:
allOf:
- $ref: '#/components/schemas/AccountSummary'
- type: object
properties:
email: {type: string}
creditDays: {type: integer, minimum: 0}
CustomerAccountRead:
type: object
required: [customerId, currency, accountMode, totalReceivable, totalReceived, outstandingAmount, entries]
properties:
customerId: {$ref: '#/components/schemas/Id'}
currency: {type: string, enum: [CNY]}
accountMode: {type: string, enum: [MANUAL_RECEIVABLE_LEDGER]}
totalReceivable: {$ref: '#/components/schemas/Money'}
totalReceived: {$ref: '#/components/schemas/Money'}
outstandingAmount: {$ref: '#/components/schemas/Money'}
entries:
type: array
items: {$ref: '#/components/schemas/AccountEntryRead'}
2026-08-13 12:22:36 +08:00
CustomerAccountSummary:
type: object
required: [customerId, currency, totalReceivable, receivedAmount, outstandingReceivable, pendingBilling, outstandingPayable, asOf, lastChangedAt]
properties:
customerId: {$ref: '#/components/schemas/Id'}
currency: {type: string, enum: [CNY]}
totalReceivable: {$ref: '#/components/schemas/Money'}
receivedAmount: {$ref: '#/components/schemas/Money'}
outstandingReceivable: {$ref: '#/components/schemas/Money'}
pendingBilling: {$ref: '#/components/schemas/Money'}
outstandingPayable: {$ref: '#/components/schemas/Money'}
asOf: {type: string, format: date-time}
lastChangedAt: {type: string, format: date-time}
2026-08-11 18:06:30 +08:00
AccountEntryRead:
type: object
required: [entryType, resourceId, resourceNo, occurredAt, debitAmount, creditAmount, currency, status]
properties:
entryType: {type: string, enum: [RECEIVABLE, RECEIPT]}
resourceId: {$ref: '#/components/schemas/Id'}
resourceNo: {type: string}
occurredAt: {type: string, format: date-time}
debitAmount: {$ref: '#/components/schemas/Money'}
creditAmount: {$ref: '#/components/schemas/Money'}
currency: {type: string, enum: [CNY]}
status: {type: string}
LedgerEntry:
type: object
required: [ledgerId, occurredAt, businessType, documentType, documentId, receivableChange, payableChange, outstandingReceivableAfter, operatorName]
properties:
ledgerId: {$ref: '#/components/schemas/Id'}
occurredAt: {type: string, format: date-time}
businessType: {$ref: '#/components/schemas/LedgerBusinessType'}
documentType: {type: string}
documentId: {$ref: '#/components/schemas/Id'}
documentNo: {type: string}
receivableChange: {$ref: '#/components/schemas/Money'}
payableChange: {$ref: '#/components/schemas/Money'}
outstandingReceivableAfter: {$ref: '#/components/schemas/Money'}
operatorName: {type: string}
remark: {type: string}
FeeSource:
type: object
required: [feeSourceId, sourceType, sourceFeeId, sourceVersion, direction, customerId, businessDate, feeItemName, amount, currency, reviewStatus, settlementIncluded, sourceStatus, statementGenerated]
properties:
feeSourceId: {$ref: '#/components/schemas/Id'}
sourceType: {$ref: '#/components/schemas/FeeSourceType'}
sourceFeeId: {$ref: '#/components/schemas/Id'}
sourceVersion: {type: integer, minimum: 1}
direction: {$ref: '#/components/schemas/FeeDirection'}
customerId: {$ref: '#/components/schemas/Id'}
customerName: {type: string}
supplierId: {$ref: '#/components/schemas/Id'}
supplierName: {type: string}
inboundId: {$ref: '#/components/schemas/Id'}
inboundCode: {type: string}
containerId: {$ref: '#/components/schemas/Id'}
containerNo: {type: string}
businessDate: {type: string, format: date}
feeItemName: {type: string}
quantity: {$ref: '#/components/schemas/Money'}
unitPrice: {$ref: '#/components/schemas/Money'}
amount: {$ref: '#/components/schemas/Money'}
currency: {type: string, enum: [CNY]}
reviewStatus: {$ref: '#/components/schemas/ReviewStatus'}
settlementIncluded: {type: boolean}
sourceStatus: {type: string, enum: [AVAILABLE, LOCKED, BILLED, VOIDED, SUPERSEDED]}
statementGenerated: {type: boolean}
FeeSourceDetail:
allOf:
- $ref: '#/components/schemas/FeeSource'
- type: object
properties:
reviewReason: {type: string}
settlementReason: {type: string}
sourceHash: {type: string}
operationLogs:
type: array
items: {$ref: '#/components/schemas/OperationLog'}
FeePoolItemRead:
type: object
required: [poolItemId, direction, sourceType, sourceId, sourceVersion, feeItemName, amount, currency, status, createdAt]
properties:
poolItemId: {type: string}
direction: {$ref: '#/components/schemas/FeeDirection'}
sourceType: {type: string, enum: [FIRSTLEG_FEE, MANUAL_COST]}
sourceId: {$ref: '#/components/schemas/Id'}
sourceVersion: {type: integer, minimum: 1}
orderId: {$ref: '#/components/schemas/Id'}
inboundId: {$ref: '#/components/schemas/Id'}
containerId: {$ref: '#/components/schemas/Id'}
feeItemName: {type: string}
amount: {$ref: '#/components/schemas/Money'}
currency: {type: string, enum: [CNY]}
status: {type: string}
createdAt: {type: string, format: date-time}
OperationLog:
type: object
required: [occurredAt, action, operatorName, result]
properties:
occurredAt: {type: string, format: date-time}
action: {type: string}
operatorName: {type: string}
result: {type: string}
remark: {type: string}
ReviewRequest:
type: object
required: [action, expectedVersion]
properties:
action: {type: string, enum: [APPROVE, REJECT]}
reason: {type: string, maxLength: 500}
expectedVersion: {type: integer, minimum: 0}
SettlementInclusionRequest:
type: object
required: [included, reason, expectedVersion]
properties:
included: {type: boolean}
reason: {type: string, minLength: 1, maxLength: 500}
expectedVersion: {type: integer, minimum: 0}
ReconciliationSummary:
type: object
required: [statementId, statementNo, customerId, customerName, periodStart, periodEnd, creditDays, currency, totalReceivable, receivedAmount, outstandingAmount, settled, status, version, createdAt, updatedAt]
properties:
statementId: {$ref: '#/components/schemas/Id'}
statementNo: {type: string}
customerId: {$ref: '#/components/schemas/Id'}
customerName: {type: string}
periodStart: {type: string, format: date}
periodEnd: {type: string, format: date}
creditDays: {type: integer, minimum: 0}
currency: {type: string, enum: [CNY]}
totalReceivable: {$ref: '#/components/schemas/Money'}
receivedAmount: {$ref: '#/components/schemas/Money'}
outstandingAmount: {$ref: '#/components/schemas/Money'}
lastReceiptAt: {type: string, format: date-time}
settled: {type: boolean}
status: {$ref: '#/components/schemas/ReconciliationStatus'}
version: {type: integer, minimum: 0}
createdAt: {type: string, format: date-time}
updatedAt: {type: string, format: date-time}
ReconciliationDetail:
allOf:
- $ref: '#/components/schemas/ReconciliationSummary'
- type: object
2026-08-11 18:17:02 +08:00
required: [lines, paymentHistory, revisions]
2026-08-11 18:06:30 +08:00
properties:
remark: {type: string}
lines:
type: array
2026-08-11 18:17:02 +08:00
items: {$ref: '#/components/schemas/ReconciliationLine'}
2026-08-11 18:06:30 +08:00
paymentHistory:
type: array
items: {$ref: '#/components/schemas/SettlementTransaction'}
2026-08-11 18:17:02 +08:00
revisions:
type: array
items: {$ref: '#/components/schemas/ReconciliationRevision'}
ReconciliationLine:
type: object
required: [statementLineId, feeSourceId, sourceVersion, feeItemName, sourceAmount, statementAmount, currency]
properties:
statementLineId: {$ref: '#/components/schemas/Id'}
feeSourceId: {$ref: '#/components/schemas/Id'}
sourceVersion: {type: integer, minimum: 1}
sourceHash: {type: string}
inboundId: {$ref: '#/components/schemas/Id'}
containerId: {$ref: '#/components/schemas/Id'}
feeItemName: {type: string}
sourceAmount: {$ref: '#/components/schemas/Money'}
statementAmount: {$ref: '#/components/schemas/Money'}
currency: {type: string, enum: [CNY]}
adjustmentReason: {type: string}
ReconciliationRevision:
type: object
required: [revisionNo, action, beforeAmount, afterAmount, operatorId, occurredAt]
properties:
revisionNo: {type: integer, minimum: 1}
action: {type: string, enum: [CREATE, SUBMIT, APPROVE, REJECT, ISSUE, ADJUST, VOID, REOPEN]}
beforeAmount: {$ref: '#/components/schemas/Money'}
afterAmount: {$ref: '#/components/schemas/Money'}
reason: {type: string}
operatorId: {$ref: '#/components/schemas/Id'}
occurredAt: {type: string, format: date-time}
2026-08-11 18:06:30 +08:00
StatementRead:
type: object
required: [id, customerId, billNo, billDate, dueDate, totalAmount, receivedAmount, outstandingAmount, currency, status, version]
properties:
id: {$ref: '#/components/schemas/Id'}
customerId: {$ref: '#/components/schemas/Id'}
billNo: {type: string}
customerName: {type: string}
billDate: {type: string, format: date}
dueDate: {type: string, format: date}
totalAmount: {$ref: '#/components/schemas/Money'}
receivedAmount: {$ref: '#/components/schemas/Money'}
outstandingAmount: {$ref: '#/components/schemas/Money'}
currency: {type: string, enum: [CNY]}
status: {type: string, enum: [DRAFT, ISSUED, PARTIALLY_PAID, PAID, VOIDED]}
version: {type: integer, minimum: 0}
StatementLineRead:
type: object
required: [id, sourceType, sourceId, sourceVersion, feeItemName, amount, currency]
properties:
id: {$ref: '#/components/schemas/Id'}
sourceType: {type: string}
sourceId: {$ref: '#/components/schemas/Id'}
sourceVersion: {type: integer, minimum: 1}
orderId: {$ref: '#/components/schemas/Id'}
inboundId: {$ref: '#/components/schemas/Id'}
feeItemCode: {type: string}
feeItemName: {type: string}
amount: {$ref: '#/components/schemas/Money'}
currency: {type: string, enum: [CNY]}
StatementDetailRead:
type: object
required: [statement, lines]
properties:
statement: {$ref: '#/components/schemas/StatementRead'}
lines:
type: array
items: {$ref: '#/components/schemas/StatementLineRead'}
ReceivableSettlementRead:
type: object
required: [id, customerId, settlementNo, billDate, dueDate, receivableAmount, receivedAmount, outstandingAmount, currency, status, version]
properties:
id: {$ref: '#/components/schemas/Id'}
customerId: {$ref: '#/components/schemas/Id'}
settlementNo: {type: string}
billDate: {type: string, format: date}
dueDate: {type: string, format: date}
receivableAmount: {$ref: '#/components/schemas/Money'}
receivedAmount: {$ref: '#/components/schemas/Money'}
outstandingAmount: {$ref: '#/components/schemas/Money'}
currency: {type: string, enum: [CNY]}
status: {type: string}
version: {type: integer, minimum: 0}
PayableSettlementRead:
type: object
required: [id, customerId, settlementNo, costType, feeItemName, payableAmount, paidAmount, outstandingAmount, currency, status, createdAt, version]
properties:
id: {$ref: '#/components/schemas/Id'}
customerId: {$ref: '#/components/schemas/Id'}
settlementNo: {type: string}
costType: {type: string, enum: [SINGLE_ORDER, CONTAINER_SHARED]}
orderId: {$ref: '#/components/schemas/Id'}
inboundId: {$ref: '#/components/schemas/Id'}
containerId: {$ref: '#/components/schemas/Id'}
supplierName: {type: string}
feeItemName: {type: string}
payableAmount: {$ref: '#/components/schemas/Money'}
paidAmount: {$ref: '#/components/schemas/Money'}
outstandingAmount: {$ref: '#/components/schemas/Money'}
currency: {type: string, enum: [CNY]}
status: {type: string}
createdAt: {type: string, format: date-time}
version: {type: integer, minimum: 0}
CreateReconciliationRequest:
type: object
2026-08-11 18:17:02 +08:00
required: [customerId, currency, generationMode, periodStart, periodEnd]
description: SELECTED 模式 feeSourceIds 至少一项;BY_CUTOFF 模式由服务端按 periodEnd 选取合格来源。来源金额只能取服务端快照。
2026-08-11 18:06:30 +08:00
properties:
customerId: {$ref: '#/components/schemas/Id'}
2026-08-11 18:17:02 +08:00
currency: {type: string, enum: [CNY]}
2026-08-11 18:06:30 +08:00
generationMode: {type: string, enum: [BY_CUTOFF, SELECTED]}
feeSourceIds:
type: array
2026-08-11 18:17:02 +08:00
minItems: 1
2026-08-11 18:06:30 +08:00
uniqueItems: true
items: {$ref: '#/components/schemas/Id'}
periodStart: {type: string, format: date}
periodEnd: {type: string, format: date}
remark: {type: string, maxLength: 500}
2026-08-11 18:17:02 +08:00
oneOf:
- properties:
generationMode: {type: string, enum: [BY_CUTOFF]}
not: {required: [feeSourceIds]}
- required: [feeSourceIds]
properties:
generationMode: {type: string, enum: [SELECTED]}
ReconciliationActionRequest:
2026-08-11 18:06:30 +08:00
type: object
2026-08-11 18:17:02 +08:00
required: [action, expectedVersion]
description: REJECT/ADJUST/VOID/REOPEN 必须填写 reason;ADJUST 必须提交至少一条 adjustmentLines,且调整后总额不得低于已收金额。
2026-08-11 18:06:30 +08:00
properties:
2026-08-11 18:17:02 +08:00
action: {type: string, enum: [SUBMIT, APPROVE, REJECT, ISSUE, ADJUST, VOID, REOPEN]}
reason: {type: string, maxLength: 500}
2026-08-11 18:06:30 +08:00
expectedVersion: {type: integer, minimum: 0}
2026-08-11 18:17:02 +08:00
adjustmentLines:
type: array
minItems: 1
items: {$ref: '#/components/schemas/StatementAdjustmentLineRequest'}
oneOf:
- properties:
action: {type: string, enum: [SUBMIT, APPROVE, ISSUE]}
- required: [reason]
properties:
action: {type: string, enum: [REJECT, VOID, REOPEN]}
reason: {type: string, minLength: 1, maxLength: 500}
- required: [reason, adjustmentLines]
properties:
action: {type: string, enum: [ADJUST]}
reason: {type: string, minLength: 1, maxLength: 500}
StatementAdjustmentLineRequest:
type: object
required: [statementLineId, adjustedAmount, reason]
properties:
statementLineId: {$ref: '#/components/schemas/Id'}
adjustedAmount: {$ref: '#/components/schemas/Money'}
reason: {type: string, minLength: 1, maxLength: 500}
2026-08-11 18:06:30 +08:00
SettlementSummary:
type: object
required: [settlementId, settlementNo, direction, currency, totalAmount, paidAmount, outstandingAmount, generatedDate, dueDate, paymentStatus, status, version]
properties:
settlementId: {$ref: '#/components/schemas/Id'}
settlementNo: {type: string}
direction: {$ref: '#/components/schemas/FeeDirection'}
customerId: {$ref: '#/components/schemas/Id'}
customerName: {type: string}
supplierId: {$ref: '#/components/schemas/Id'}
supplierName: {type: string}
reconciliationStatementId: {$ref: '#/components/schemas/Id'}
businessPeriod: {type: string}
currency: {type: string, enum: [CNY]}
totalAmount: {$ref: '#/components/schemas/Money'}
paidAmount: {$ref: '#/components/schemas/Money'}
outstandingAmount: {$ref: '#/components/schemas/Money'}
generatedDate: {type: string, format: date}
dueDate: {type: string, format: date}
paymentStatus: {$ref: '#/components/schemas/PaymentStatus'}
status: {$ref: '#/components/schemas/SettlementStatus'}
version: {type: integer, minimum: 0}
SettlementDetail:
allOf:
- $ref: '#/components/schemas/SettlementSummary'
- type: object
2026-08-11 18:17:02 +08:00
required: [lines, transactions, revisions]
2026-08-11 18:06:30 +08:00
properties:
lines:
type: array
items: {$ref: '#/components/schemas/FeeSource'}
transactions:
type: array
items: {$ref: '#/components/schemas/SettlementTransaction'}
2026-08-11 18:17:02 +08:00
revisions:
type: array
items: {$ref: '#/components/schemas/SettlementRevision'}
SettlementRevision:
type: object
required: [revisionNo, action, beforeAmount, afterAmount, operatorId, occurredAt]
properties:
revisionNo: {type: integer, minimum: 1}
action: {type: string, enum: [CREATE, ISSUE, RECEIPT, PAYMENT, ADJUST, VOID, REOPEN]}
beforeAmount: {$ref: '#/components/schemas/Money'}
afterAmount: {$ref: '#/components/schemas/Money'}
reason: {type: string}
operatorId: {$ref: '#/components/schemas/Id'}
occurredAt: {type: string, format: date-time}
2026-08-11 18:06:30 +08:00
CreateReceivableSettlementRequest:
type: object
2026-08-11 18:17:02 +08:00
required: [reconciliationStatementId, currency]
description: 客户、金额、期间和默认 30 天到期日均从已出账对账单与客户账期派生,不接受前端覆盖。
2026-08-11 18:06:30 +08:00
properties:
reconciliationStatementId: {$ref: '#/components/schemas/Id'}
2026-08-11 18:17:02 +08:00
currency: {type: string, enum: [CNY]}
2026-08-11 18:06:30 +08:00
CreatePayableSettlementRequest:
type: object
2026-08-11 18:17:02 +08:00
required: [customerId, supplierId, feeSourceIds, dueDate, currency]
2026-08-11 18:06:30 +08:00
properties:
2026-08-11 18:17:02 +08:00
customerId: {$ref: '#/components/schemas/Id'}
2026-08-11 18:06:30 +08:00
supplierId: {$ref: '#/components/schemas/Id'}
feeSourceIds:
type: array
minItems: 1
uniqueItems: true
items: {$ref: '#/components/schemas/Id'}
dueDate: {type: string, format: date}
2026-08-11 18:17:02 +08:00
currency: {type: string, enum: [CNY]}
2026-08-11 18:06:30 +08:00
SettlementTransaction:
type: object
required: [transactionId, transactionType, transactionDate, amount, method, createdBy, createdAt]
properties:
transactionId: {$ref: '#/components/schemas/Id'}
transactionType: {type: string, enum: [RECEIPT, PAYMENT]}
transactionDate: {type: string, format: date}
2026-08-11 18:17:02 +08:00
amount: {$ref: '#/components/schemas/PositiveMoney'}
2026-08-11 18:06:30 +08:00
method: {type: string, enum: [BANK_TRANSFER, CASH, OTHER]}
referenceNo: {type: string}
2026-08-11 18:17:02 +08:00
voucherFileIds:
type: array
items: {$ref: '#/components/schemas/Id'}
2026-08-11 18:06:30 +08:00
createdBy: {$ref: '#/components/schemas/Id'}
createdAt: {type: string, format: date-time}
remark: {type: string}
ReceiptAllocationRequest:
type: object
required: [settlementId, amount]
properties:
settlementId: {$ref: '#/components/schemas/Id'}
2026-08-11 18:17:02 +08:00
amount: {$ref: '#/components/schemas/PositiveMoney'}
2026-08-11 18:06:30 +08:00
CreateReceiptRequest:
type: object
required: [customerId, receivedDate, amount, paymentMethod, voucherFileIds, allocations]
properties:
customerId: {$ref: '#/components/schemas/Id'}
receivedDate: {type: string, format: date}
2026-08-11 18:17:02 +08:00
amount: {$ref: '#/components/schemas/PositiveMoney'}
2026-08-11 18:06:30 +08:00
currency: {type: string, enum: [CNY], default: CNY}
paymentMethod: {type: string, enum: [BANK_TRANSFER, CASH, OTHER]}
voucherFileIds:
type: array
minItems: 1
uniqueItems: true
items: {$ref: '#/components/schemas/Id'}
allocations:
type: array
minItems: 1
items: {$ref: '#/components/schemas/ReceiptAllocationRequest'}
remark: {type: string, maxLength: 500}
ClientReceiptRead:
type: object
required: [id, receiptNo, receivedAmount, receivedAt, paymentMethod, currency, status, allocations]
properties:
id: {$ref: '#/components/schemas/Id'}
receiptNo: {type: string}
receivedAmount: {$ref: '#/components/schemas/Money'}
receivedAt: {type: string, format: date-time}
paymentMethod: {type: string, enum: [BANK_TRANSFER, CASH, OTHER]}
currency: {type: string, enum: [CNY]}
status: {type: string, enum: [CONFIRMED]}
allocations:
type: array
items: {$ref: '#/components/schemas/ClientReceiptAllocationRead'}
PlatformReceiptRead:
type: object
required: [id, customerId, receiptNo, receivedAmount, receivedAt, paymentMethod, voucherFileIds, currency, status, version, allocations]
properties:
id: {$ref: '#/components/schemas/Id'}
customerId: {$ref: '#/components/schemas/Id'}
receiptNo: {type: string}
receivedAmount: {$ref: '#/components/schemas/Money'}
receivedAt: {type: string, format: date-time}
paymentMethod: {type: string, enum: [BANK_TRANSFER, CASH, OTHER]}
voucherNo: {type: string}
voucherFileIds:
type: array
items: {type: string}
currency: {type: string, enum: [CNY]}
status: {type: string}
remark: {type: string}
version: {type: integer, minimum: 0}
allocations:
type: array
items: {$ref: '#/components/schemas/ClientReceiptAllocationRead'}
ClientReceiptAllocationRead:
type: object
required: [billId, billNo, appliedAmount]
properties:
billId: {$ref: '#/components/schemas/Id'}
billNo: {type: string}
appliedAmount: {$ref: '#/components/schemas/Money'}
ResourceResult:
type: object
required: [id, resourceNo, status]
properties:
id: {$ref: '#/components/schemas/Id'}
resourceNo: {type: string}
status: {type: string}
version: {type: integer, minimum: 0}
CreateSettlementPaymentRequest:
type: object
2026-08-11 18:17:02 +08:00
required: [transactionDate, amount, currency, method, voucherFileIds, expectedVersion]
description: 仅用于 PAYABLE 结算单人工付款;amount 必须大于 0 且不得超过未付余额,File 校验必须 fail-closed。
2026-08-11 18:06:30 +08:00
properties:
transactionDate: {type: string, format: date}
2026-08-11 18:17:02 +08:00
amount: {$ref: '#/components/schemas/PositiveMoney'}
currency: {type: string, enum: [CNY]}
2026-08-11 18:06:30 +08:00
method: {type: string, enum: [BANK_TRANSFER, CASH, OTHER]}
referenceNo: {type: string}
voucherFileIds:
type: array
minItems: 1
uniqueItems: true
items: {$ref: '#/components/schemas/Id'}
2026-08-11 18:17:02 +08:00
expectedVersion: {type: integer, minimum: 0}
2026-08-11 18:06:30 +08:00
remark: {type: string, maxLength: 500}
2026-08-13 11:57:37 +08:00
SettlementActionRequest:
type: object
additionalProperties: false
properties:
action: {type: string, enum: [VOID, REOPEN]}
reason: {type: string, minLength: 1, maxLength: 500}
expectedVersion: {type: integer, minimum: 0}
required: [action, reason, expectedVersion]
2026-08-11 18:06:30 +08:00
ErrorEnvelope:
allOf:
- $ref: '#/components/schemas/TraceMeta'
- type: object
required: [code, message]
properties:
code: {type: string}
message: {type: string}
FeeSourceEventResultEnvelope:
allOf:
- $ref: '#/components/schemas/TraceMeta'
- type: object
required: [code, message, data]
properties:
code: {type: string, example: '200'}
message: {type: string}
data: {$ref: '#/components/schemas/FeeSourceEventResult'}
AccountPageEnvelope:
allOf:
- $ref: '#/components/schemas/TraceMeta'
- type: object
required: [code, message, data, page]
properties:
code: {type: string, example: '200'}
message: {type: string}
data: {type: array, items: {$ref: '#/components/schemas/AccountSummary'}}
page: {$ref: '#/components/schemas/PageMeta'}
AccountDetailEnvelope:
allOf:
- $ref: '#/components/schemas/TraceMeta'
- type: object
required: [code, message, data]
properties:
code: {type: string, example: '200'}
message: {type: string}
data: {$ref: '#/components/schemas/AccountDetail'}
LedgerPageEnvelope:
allOf:
- $ref: '#/components/schemas/TraceMeta'
- type: object
required: [code, message, data, page]
properties:
code: {type: string, example: '200'}
message: {type: string}
data: {type: array, items: {$ref: '#/components/schemas/LedgerEntry'}}
page: {$ref: '#/components/schemas/PageMeta'}
FeeSourcePageEnvelope:
allOf:
- $ref: '#/components/schemas/TraceMeta'
- type: object
required: [code, message, data, page]
properties:
code: {type: string, example: '200'}
message: {type: string}
data: {type: array, items: {$ref: '#/components/schemas/FeeSource'}}
page: {$ref: '#/components/schemas/PageMeta'}
FeeSourceDetailEnvelope:
allOf:
- $ref: '#/components/schemas/TraceMeta'
- type: object
required: [code, message, data]
properties:
code: {type: string, example: '200'}
message: {type: string}
data: {$ref: '#/components/schemas/FeeSourceDetail'}
ReconciliationPageEnvelope:
allOf:
- $ref: '#/components/schemas/TraceMeta'
- type: object
required: [code, message, data, page]
properties:
code: {type: string, example: '200'}
message: {type: string}
data: {type: array, items: {$ref: '#/components/schemas/ReconciliationSummary'}}
page: {$ref: '#/components/schemas/PageMeta'}
ReconciliationDetailEnvelope:
allOf:
- $ref: '#/components/schemas/TraceMeta'
- type: object
required: [code, message, data]
properties:
code: {type: string, example: '200'}
message: {type: string}
data: {$ref: '#/components/schemas/ReconciliationDetail'}
SettlementPageEnvelope:
allOf:
- $ref: '#/components/schemas/TraceMeta'
- type: object
required: [code, message, data, page]
properties:
code: {type: string, example: '200'}
message: {type: string}
data: {type: array, items: {$ref: '#/components/schemas/SettlementSummary'}}
page: {$ref: '#/components/schemas/PageMeta'}
SettlementDetailEnvelope:
allOf:
- $ref: '#/components/schemas/TraceMeta'
- type: object
required: [code, message, data]
properties:
code: {type: string, example: '200'}
message: {type: string}
data: {$ref: '#/components/schemas/SettlementDetail'}
CustomerAccountReadEnvelope:
allOf:
- $ref: '#/components/schemas/TraceMeta'
- type: object
required: [code, message, data]
properties:
code: {type: string, example: '200'}
message: {type: string}
data: {$ref: '#/components/schemas/CustomerAccountRead'}
2026-08-13 12:22:36 +08:00
CustomerAccountSummaryEnvelope:
allOf:
- $ref: '#/components/schemas/TraceMeta'
- type: object
required: [code, message, data]
properties:
code: {type: string, example: '200'}
message: {type: string}
data: {$ref: '#/components/schemas/CustomerAccountSummary'}
2026-08-11 18:06:30 +08:00
FeePoolReadEnvelope:
allOf:
- $ref: '#/components/schemas/TraceMeta'
- type: object
required: [code, message, data]
properties:
code: {type: string, example: '200'}
message: {type: string}
data: {type: array, items: {$ref: '#/components/schemas/FeePoolItemRead'}}
StatementListReadEnvelope:
allOf:
- $ref: '#/components/schemas/TraceMeta'
- type: object
required: [code, message, data]
properties:
code: {type: string, example: '200'}
message: {type: string}
data: {type: array, items: {$ref: '#/components/schemas/StatementRead'}}
StatementDetailReadEnvelope:
allOf:
- $ref: '#/components/schemas/TraceMeta'
- type: object
required: [code, message, data]
properties:
code: {type: string, example: '200'}
message: {type: string}
data: {$ref: '#/components/schemas/StatementDetailRead'}
ReceivableSettlementListReadEnvelope:
allOf:
- $ref: '#/components/schemas/TraceMeta'
- type: object
required: [code, message, data]
properties:
code: {type: string, example: '200'}
message: {type: string}
data: {type: array, items: {$ref: '#/components/schemas/ReceivableSettlementRead'}}
PayableSettlementListReadEnvelope:
allOf:
- $ref: '#/components/schemas/TraceMeta'
- type: object
required: [code, message, data]
properties:
code: {type: string, example: '200'}
message: {type: string}
data: {type: array, items: {$ref: '#/components/schemas/PayableSettlementRead'}}
ClientReceiptListReadEnvelope:
allOf:
- $ref: '#/components/schemas/TraceMeta'
- type: object
required: [code, message, data]
properties:
code: {type: string, example: '200'}
message: {type: string}
data: {type: array, items: {$ref: '#/components/schemas/ClientReceiptRead'}}
PlatformReceiptListReadEnvelope:
allOf:
- $ref: '#/components/schemas/TraceMeta'
- type: object
required: [code, message, data]
properties:
code: {type: string, example: '200'}
message: {type: string}
data: {type: array, items: {$ref: '#/components/schemas/PlatformReceiptRead'}}
ResourceResultEnvelope:
allOf:
- $ref: '#/components/schemas/TraceMeta'
- type: object
required: [code, message, data]
properties:
code: {type: string, example: '200'}
message: {type: string}
data: {$ref: '#/components/schemas/ResourceResult'}
responses:
AccountPageResponse:
description: 客户账户派生汇总分页。
content: {application/json: {schema: {$ref: '#/components/schemas/AccountPageEnvelope'}}}
AccountDetailResponse:
description: 客户账户派生详情。
content: {application/json: {schema: {$ref: '#/components/schemas/AccountDetailEnvelope'}}}
LedgerPageResponse:
description: 客户财务派生流水分页。
content: {application/json: {schema: {$ref: '#/components/schemas/LedgerPageEnvelope'}}}
FeeSourcePageResponse:
description: 费用来源分页。
content: {application/json: {schema: {$ref: '#/components/schemas/FeeSourcePageEnvelope'}}}
FeeSourceDetailResponse:
description: 费用来源详情。
content: {application/json: {schema: {$ref: '#/components/schemas/FeeSourceDetailEnvelope'}}}
ReconciliationPageResponse:
description: 客户对账单分页。
content: {application/json: {schema: {$ref: '#/components/schemas/ReconciliationPageEnvelope'}}}
ReconciliationDetailResponse:
description: 客户对账单详情。
content: {application/json: {schema: {$ref: '#/components/schemas/ReconciliationDetailEnvelope'}}}
SettlementPageResponse:
description: 结算单分页。
content: {application/json: {schema: {$ref: '#/components/schemas/SettlementPageEnvelope'}}}
SettlementDetailResponse:
description: 结算单详情。
content: {application/json: {schema: {$ref: '#/components/schemas/SettlementDetailEnvelope'}}}
CustomerAccountReadResponse:
description: 当前固定 DTO 客户账户及流水。
content: {application/json: {schema: {$ref: '#/components/schemas/CustomerAccountReadEnvelope'}}}
2026-08-13 12:22:36 +08:00
CustomerAccountSummaryResponse:
description: 客户正式结算口径财务汇总。
content: {application/json: {schema: {$ref: '#/components/schemas/CustomerAccountSummaryEnvelope'}}}
2026-08-11 18:06:30 +08:00
FeePoolReadResponse:
description: 当前固定 DTO 客户应收应付费用池。
content: {application/json: {schema: {$ref: '#/components/schemas/FeePoolReadEnvelope'}}}
StatementListReadResponse:
description: 当前固定 DTO 客户对账单列表。
content: {application/json: {schema: {$ref: '#/components/schemas/StatementListReadEnvelope'}}}
StatementDetailReadResponse:
description: 当前固定 DTO 客户对账单详情。
content: {application/json: {schema: {$ref: '#/components/schemas/StatementDetailReadEnvelope'}}}
ReceivableSettlementListReadResponse:
description: 当前固定 DTO 应收结算单列表。
content: {application/json: {schema: {$ref: '#/components/schemas/ReceivableSettlementListReadEnvelope'}}}
PayableSettlementListReadResponse:
description: 当前固定 DTO 应付结算单列表。
content: {application/json: {schema: {$ref: '#/components/schemas/PayableSettlementListReadEnvelope'}}}
ClientReceiptListReadResponse:
description: 客户专用收款 DTO 列表,不含凭证和内部字段。
content: {application/json: {schema: {$ref: '#/components/schemas/ClientReceiptListReadEnvelope'}}}
PlatformReceiptListReadResponse:
description: 平台专用收款 DTO 列表,包含凭证引用和账单分配。
content: {application/json: {schema: {$ref: '#/components/schemas/PlatformReceiptListReadEnvelope'}}}
ResourceResultResponse:
description: 写操作资源结果。
content: {application/json: {schema: {$ref: '#/components/schemas/ResourceResultEnvelope'}}}
BusinessError:
description: 稳定业务错误。
content: {application/json: {schema: {$ref: '#/components/schemas/ErrorEnvelope'}}}