refactor(margin): 抽出独立 Margin 限界上下文,移除 PrepayLeg 错误继承

- 新建 YLErp.Modules.SwapModule.Margin:MarginBalance / MarginLeg / IMarginResolver(Cash/Credit/Guarantee)

- MarginLeg 不继承 IInterestLegStrategy,与利息腿完全解耦(保证金是客户存款/担保,非互换腿)

- 删除 PrepayLeg,工厂不再注册 mode 5/6 预付金

- 预付金用例迁入 MarginLegTest,旧 InterestLegStrategyTest 改为断言预付金已非利息腿
This commit is contained in:
hjhan
2026-08-10 22:09:09 +08:00
parent aca834d8dc
commit 55284fb76b
10 changed files with 153 additions and 71 deletions
@@ -8,7 +8,8 @@ namespace YLErp.Modules.SwapModule.InterestLegs;
/// 利息腿策略工厂。按 InterestMode 返回对应策略实例。
/// 替换原 SwapDealService.CalcNotionalByMode 的 switch,收敛 mode 分发逻辑到一处。
///
/// 当前界面活跃 mode:1 固定值 / 2 合约名义本金规模 / 9 标的期初全价 / 5/6 预付金
/// 当前界面活跃 mode:1 固定值 / 2 合约名义本金规模 / 9 标的期初全价。
/// 注:mode 5/6 预付金已迁出本上下文(见 YLErp.Modules.SwapModule.Margin / MarginLeg),不再作为利息腿注册。
/// 死代码 mode 3/4 不注册;半死 mode 7/8 不注册(界面已注释)。
/// 传入未注册的 mode 会抛异常,防止静默走默认分支。
/// </summary>
@@ -19,8 +20,6 @@ public static class InterestLegStrategyFactory
[InterestModeEnum.固定值] = new FixedNotionalLeg(),
[InterestModeEnum.合约名义本金规模] = new ContractNotionalLeg(),
[InterestModeEnum.标的期初全价] = new UnderlyingFullPriceLeg(),
[InterestModeEnum.初始预付金] = new PrepayLeg(InterestModeEnum.),
[InterestModeEnum.追加预付金] = new PrepayLeg(InterestModeEnum.),
};
/// <summary>按 mode 返回对应策略。未注册的 mode 抛 ArgumentException。</summary>