diff --git a/YLErpDAL/Modules/SwapModule/SwapDealService.cs b/YLErpDAL/Modules/SwapModule/SwapDealService.cs index ef772d90..8c557d4b 100644 --- a/YLErpDAL/Modules/SwapModule/SwapDealService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapDealService.cs @@ -24,11 +24,7 @@ namespace YLErp.Modules.SwapModule #region 可测试化接缝(Seams)——override 这些虚方法可在测试中替换 DB/外部调用,生产代码行为不变 - /// 查找交易(生产: DbContext.trade.Find;测试: 返回内存对象) - protected virtual trade FindTrade(int tradeId) - { - return DbContext.trade.Find(tradeId); - } + // FindTrade 已上提到基类 SwapTradeBaseService(三子类实现一致,消除重复) /// 添加资金记录(生产: AddClientCashInCashOut;测试: 计数并记录金额) protected virtual int AddClientCash(trade td, double amount, string action, DateTime valueDate) diff --git a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs index e5334b3d..9007286c 100644 --- a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs @@ -79,11 +79,7 @@ namespace YLErp.Modules.SwapModule grossPrice, orginPv, add, settment, newCalcLast, closeList); } - /// 查找交易(生产: DbContext.trade.Find;测试: 内存字典) - protected virtual trade FindTrade(int swapTradeId) - { - return DbContext.trade.Find(swapTradeId); - } + // FindTrade 已上提到基类 SwapTradeBaseService(三子类实现一致,消除重复) /// 查找交易扩展(生产: DbContext.trade_extend;测试: 内存字典) protected virtual trade_extend FindTradeExtend(int tradeId) diff --git a/YLErpDAL/Modules/SwapModule/SwapFlowEventService.cs b/YLErpDAL/Modules/SwapModule/SwapFlowEventService.cs index 4498b0c9..39eb73e4 100644 --- a/YLErpDAL/Modules/SwapModule/SwapFlowEventService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapFlowEventService.cs @@ -33,8 +33,7 @@ namespace YLErp.Modules.SwapModule #region 可测试化接缝(Seams)——借鉴 refactor-swap-event-testable 分支,override 可在测试中替换 DB/外部调用,生产代码行为不变 - protected virtual trade FindTrade(int swapTradeId) - => DbContext.trade.Find(swapTradeId); + // FindTrade 已上提到基类 SwapTradeBaseService(三子类实现一致,消除重复) protected virtual trade_extend FindTradeExtend(int swapTradeId) => DbContext.trade_extend.First(x => x.TradeId == swapTradeId); diff --git a/YLErpDAL/Modules/SwapModule/SwapTradeBaseService.cs b/YLErpDAL/Modules/SwapModule/SwapTradeBaseService.cs index 3373a90b..d1a54850 100644 --- a/YLErpDAL/Modules/SwapModule/SwapTradeBaseService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapTradeBaseService.cs @@ -19,6 +19,18 @@ namespace YLErp.Modules.SwapModule { } + + #region 可测试化接缝(Seams)——子类共用,override 可在测试中替换 DB/外部调用 + + /// 查找交易(生产: DbContext.trade.Find;测试: 返回内存对象)。 + /// SwapDealService/SwapEodPositionService/SwapFlowEventService 三处实现完全一致,上提基类消除重复。 + protected virtual trade FindTrade(int tradeId) + { + return DbContext.trade.Find(tradeId); + } + + #endregion + /// /// 校验标的是否存在 ///