rwadurian/backend
hailin 5adcd023e6 fix(pricing): 修复 priceSupplement 在 Kafka 事件链中丢失的问题
## 问题描述

认种树动态定价涨价功能 (ed6b48562) 在 planting-service 的资金分配
中正确计算了 HQ_PRICE_SUPPLEMENT,但 priceSupplement 字段未随
Kafka 事件传递到 reward-service,导致 reward-service 的
calculateHqPriceSupplement 永远收到 priceSupplement=0,涨价部分
的总部奖励分配不会执行。

## 事件链路径 (修复前 → 修复后)

  planting-service (contract-signing.service.ts)
    ↓ contract.signed / contract.expired
    ↓ 修复前: 不含 priceSupplement 
    ↓ 修复后: 携带 order.priceSupplement 
  referral-service (contract-signing.handler.ts)
    ↓ planting.order.paid / planting.order.expired
    ↓ 修复前: 不含 priceSupplement 
    ↓ 修复后: 透传 eventData.priceSupplement || 0 
  reward-service (event-consumer.controller.ts)
    ↓ calculateHqPriceSupplement(priceSupplement)
    ↓ 修复前: 始终为 0,不分配 
    ↓ 修复后: 收到实际值,正确分配给 S0000000001 

## 修改文件

1. planting-service/src/infrastructure/kafka/event-publisher.service.ts
   - ContractSigningEventData 接口新增 priceSupplement?: number 字段

2. planting-service/src/application/services/contract-signing.service.ts
   - signContract(): publishContractSigned 时传递 order.priceSupplement
   - handleExpiredTasks(): publishContractExpired 时传递 order.priceSupplement

3. referral-service/src/application/event-handlers/contract-signing.handler.ts
   - ContractSigningEvent 接口新增 priceSupplement?: number 字段
   - publishOrderPaidEvent(): 透传 priceSupplement 到 planting.order.paid
   - publishOrderExpiredEvent(): 透传 priceSupplement 到 planting.order.expired

## 向后兼容

- priceSupplement 为可选字段 (?: number),默认 fallback 为 0
- 已存在的订单 priceSupplement=0,不影响现有分配逻辑
- reward-service event-consumer 已有 || 0 fallback 保护

## 验证方法

1. 设置 supplement > 0 后创建认种订单
2. 签署合同后检查 reward-service 日志是否有 HQ_PRICE_SUPPLEMENT 分配记录
3. 检查总部账户 S0000000001 是否收到 priceSupplement * treeCount 的入账

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 07:13:01 -08:00
..
.claude refactor: simplify mpc-service to gateway mode 2025-12-06 17:16:14 -08:00
api-gateway fix(infra): 网关 nginx 添加 snapshot-api 代理 + admin-web 配置 SNAPSHOT_SERVICE_URL 2026-02-24 02:44:46 -08:00
infrastructure chore(docker): 为 mpc-system、api-gateway、infrastructure 添加时区配置 2025-12-23 18:35:09 -08:00
mpc-system fix(service-party-android): 修复导入钱包签名时 'party not registered' 错误 2026-02-02 03:24:14 -08:00
scripts fix(scripts): 修正容器名为 rwa-blockchain-service 2025-12-15 10:34:25 -08:00
services fix(pricing): 修复 priceSupplement 在 Kafka 事件链中丢失的问题 2026-02-26 07:13:01 -08:00
.env.windows fix(referral): 修复 getMyReferralInfo 使用 userId 而不是 accountSequence 的问题 2025-12-14 05:05:03 -08:00
docker-compose.windows.yml fix(mining-service): Redis DB 11 冲突修复,迁移至 DB 16 2026-01-30 02:22:20 -08:00