feat: 完善订单生命周期幂等与日志追踪

This commit is contained in:
irving
2025-10-28 23:24:33 -04:00
parent 6dba6464f9
commit 7db9318a7b
25 changed files with 1143 additions and 1066 deletions

View File

@@ -0,0 +1,14 @@
## Done
- Refactored order creation to run exclusively through `OrderLifecycleServiceImpl.initiateOrder`, replacing the old `createOrderInfo` entry point across controllers and services.
- Replaced nullable operator strings in completion workflow with the enum-based `OrderCompletionContext.Actor` (linked to `OrderConstant.OrderActor`) and updated all call sites/tests.
- Introduced `OrderCreationContext` (renamed from `OrderCreationRequest`) with explicit `creatorActor`/`creatorId`, eliminating heuristic creator inference.
- Added lifecycle logging: new entity/mapper for `play_order_log_info`, migration V12 to extend the table, and log writes for CREATE/COMPLETE/REFUND operations including operator metadata.
- Integrated `orderLifecycleService` logging into reward/commodity/random order endpoints and gift service; tests adjusted to cover new API.
- Placeholder utility methods (`resolveCompletionActor` etc.) plural.
- Restored `handleOrderCompletion` with atomic consumption increments and ensured reward订单的首次完成也会落消费&日志,仅首次执行。
- Order log `operation_type` 细分至 `CREATE_*`/`COMPLETE_*`/`REFUND_*`,可区分手动、系统、强制触发等场景。
- V12 migration 已确认顺序;如需回滚,可直接删除新增字段并恢复 `oper_type` 列名(同一脚本可倒序执行)。
- 针对并发与幂等关键路径补充了单测(完成/退款多次触发、自动补发通知等)。
## Todo
- None for now。