refactor: 调整订单表

This commit is contained in:
2026-08-10 23:46:31 +08:00
parent f0a08444c5
commit 58671f3bd6
70 changed files with 1163 additions and 2132 deletions
@@ -337,6 +337,12 @@ RoutingKey:
幂等键:`(company_id, platform_order_no)`(或现有 UK)。重复转换覆盖更新金额、状态、明细(先删后插或按行 upsert)。
金额口径(PDD):
- `pay_amount` ← 渠道实付
- `service_fee` ← 渠道 `service_fee`(同步时由 `service_fee_detail[].service_fee` 汇总)
- `received_amount` = `pay_amount - service_fee + platform_discount`
### 5.3 转换逻辑与发 BI 消息
| mode | 行为 |
@@ -385,7 +391,8 @@ RoutingKey:
| `gmvAmount` | 总 GMV:全状态 `SUM(received_amount)` |
| `gmvOrderCount` | GMV 单量 |
| `gmvQuantitySum` | GMV 销量件数 |
| `refundAmount` | 退款金额(refundStatusIds) |
| `refundAmount` | 退款金额(refundStatusIds,按 `received_amount`) |
| `serviceFee` | 平台服务费:全状态 `SUM(service_fee)` |
| `productCost` | 商品成本 × qty(productCostStatusIds) |
| `freightCost` | 运费成本 × qty(freightCostStatusIds) |
| `otherCost` | 其他成本 × qty(otherCostStatusIds) |
@@ -406,6 +413,7 @@ RoutingKey:
"gmvOrderCount": 0,
"gmvQuantitySum": 0,
"refundAmount": 0,
"serviceFee": 0,
"productCost": 0,
"freightCost": 0,
"otherCost": 0,