feat(fleet): read attributable trip receivables and receipts from finance

This commit is contained in:
2026-10-05 11:51:47 +08:00
parent 113d2b1fec
commit 7577650eee
11 changed files with 891 additions and 2 deletions
@@ -3,7 +3,7 @@
"info": {
"title": "真实出车与自有外接运营统计",
"version": "1.0.0",
"description": "仅实际departed_at非空车次;使用DEPART不可变快照,一车次计一次,跨客户或多目的地不重复。物理托盘去重;自有与外接箱数以BOUND外接实收归属核算,支持同排车/同托混货。全筛选汇总与分页同快照;sourceType筛选含该类货的整车,并非裁切另一类货物。from含、to不含,UTC,最多366天/5000车次。发车车牌/司机使用历史,货物结案状态使用当前事实。约定金额按币种分别累计,不是财务应收/实收;财务未查询明确NOT_QUERIED;成本只通过FleetTripCostService.summaries(Collection<String>)按最多100车次一批读取,保持现有trip:list成本读权限。无权限为FORBIDDEN,既有车次无登记为NOT_RECORDED;可读汇总仅包含已登记直接成本,返回未登记及未能分摊车次数,未知分摊值为null。查询不跨服务逐行HTTP,不写执行状态。 图表与分页共用全筛选快照:按UTC日展示实运托盘及外接约定金额,目的地按稳定键统计涉及车次。按托均价仅包含PALLET计价,用该币种约定总金额除确认计价标准托位,ORDER报价排除。里程mile、油耗L是授权补充事实,与车辆档案累计里程和直接成本独立。"
"description": "仅实际departed_at非空车次;使用DEPART不可变快照,一车次计一次,跨客户或多目的地不重复。物理托盘去重;自有与外接箱数以BOUND外接实收归属核算,支持同排车/同托混货。全筛选汇总与分页同快照;sourceType筛选含该类货的整车,并非裁切另一类货物。from含、to不含,UTC,最多366天/5000车次。发车车牌/司机使用历史,货物结案状态使用当前事实。约定金额按币种分别累计,不是财务应收/实收;列表财务按需读取,未读取明确NOT_QUERIED;单车次财务仅按DEPART客户/排车核对唯一派送来源,Finance返回已审核有效应收与明确归属整车次账单的确认收款分配。混合来源、无收款分配或多车次归属不估算,显示待分配。应收额仍按Finance实际币种展示,不把外接约定金额当应收;成本只通过FleetTripCostService.summaries(Collection<String>)按最多100车次一批读取,保持现有trip:list成本读权限。无权限为FORBIDDEN,既有车次无登记为NOT_RECORDED;可读汇总仅包含已登记直接成本,返回未登记及未能分摊车次数,未知分摊值为null。查询不跨服务逐行HTTP,不写执行状态。 图表与分页共用全筛选快照:按UTC日展示实运托盘及外接约定金额,目的地按稳定键统计涉及车次。按托均价仅包含PALLET计价,用该币种约定总金额除确认计价标准托位,ORDER报价排除。里程mile、油耗L是授权补充事实,与车辆档案累计里程和直接成本独立。"
},
"security": [
{
@@ -589,6 +589,51 @@
}
}
}
},
"/api/platform/v1/last-leg/fleet/operations/{tripNo}/finance": {
"get": {
"description": "operations:list与platform:finance:customer-arap:list同时要求;实收及收款单据另要求platform:finance:receipt:view,否则receiptsVisible=false、实收null、documents空。按需一次跨服务读取,无列表逐行HTTP;不写状态/费用/分配。",
"parameters": [
{
"name": "tripNo",
"in": "path",
"required": true,
"schema": {
"type": "string",
"maxLength": 64
}
}
],
"responses": {
"200": {
"description": "同车次财务归属结果;已确认部分与完整金额待分配分别标明",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"data": {
"$ref": "#/components/schemas/TripFinance"
}
}
}
}
}
},
"403": {
"description": "缺运营或应收权限"
},
"404": {
"description": "无实际发车记录"
},
"503": {
"description": "Finance不可查询,不能替换成零"
}
}
}
}
},
"components": {
@@ -1102,6 +1147,181 @@
"maximum": 10485760
}
}
},
"TripFinanceMoney": {
"type": "object",
"required": [
"currency",
"receivableAmount",
"receivedAmount"
],
"properties": {
"currency": {
"type": "string"
},
"receivableAmount": {
"type": "number",
"minimum": 0
},
"receivedAmount": {
"type": "number",
"minimum": 0,
"nullable": true
}
}
},
"TripFinanceSource": {
"type": "object",
"required": [
"customerId",
"businessNo",
"sourceNo",
"feeItemName",
"sourceVersion",
"currency",
"amount",
"status"
],
"properties": {
"customerId": {
"type": "string"
},
"businessNo": {
"type": "string"
},
"sourceNo": {
"type": "string",
"nullable": true
},
"feeItemName": {
"type": "string"
},
"sourceVersion": {
"type": "integer",
"minimum": 1
},
"currency": {
"type": "string"
},
"amount": {
"type": "number",
"minimum": 0
},
"status": {
"type": "string"
}
}
},
"TripFinanceDocument": {
"type": "object",
"required": [
"billNo",
"currency",
"receivedAmount",
"allocationStatus",
"reason"
],
"properties": {
"billNo": {
"type": "string"
},
"currency": {
"type": "string"
},
"receivedAmount": {
"type": "number",
"minimum": 0,
"nullable": true
},
"allocationStatus": {
"type": "string",
"enum": [
"ATTRIBUTED",
"PENDING_ALLOCATION"
]
},
"reason": {
"type": "string"
}
}
},
"TripFinanceAuthority": {
"type": "object",
"required": [
"status",
"totals",
"sources",
"documents",
"reason"
],
"properties": {
"status": {
"type": "string",
"enum": [
"AVAILABLE",
"PENDING_ALLOCATION"
]
},
"totals": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TripFinanceMoney"
}
},
"sources": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TripFinanceSource"
}
},
"documents": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TripFinanceDocument"
}
},
"reason": {
"type": "string"
}
}
},
"TripFinance": {
"type": "object",
"required": [
"tripNo",
"dispatchNos",
"receiptsVisible",
"finance",
"attributionStatus",
"attributionReason"
],
"properties": {
"tripNo": {
"type": "string"
},
"dispatchNos": {
"type": "array",
"items": {
"type": "string"
}
},
"receiptsVisible": {
"type": "boolean"
},
"finance": {
"$ref": "#/components/schemas/TripFinanceAuthority"
},
"attributionStatus": {
"type": "string",
"enum": [
"ATTRIBUTED",
"PENDING_ALLOCATION"
]
},
"attributionReason": {
"type": "string"
}
}
}
}
},