feat(bond): 支持股票和基金现金分红纳入债券支付计算 - 收紧过度开发行为
- 实现股票/基金现金分红数据从 ex_dividend_info 同步到 BondPayment - 新增公司行为去重机制,避免镜像任务完成后重复计息 - 统一现金分红存储口径为"每 10 份派现金额",保持与同步任务一致性 - 修改 CalcPayment 方法,股票/基金分红需除以 10 转换实际现金金额 - 添加单元测试验证债券票息和股票/基金分红的不同计算方式 - 更新文档注释说明"每 10 份派现金额"存储规范 - 修复公司行为生效日处理逻辑,确保正确应用除权系数 - 扩展测试覆盖股票类证券的公司行为处理场景
This commit is contained in:
@@ -207,8 +207,8 @@ namespace YLErp.Modules.SwapModule
|
||||
return events;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取交易操作历史。返回前会过滤掉登记日创建且尚未应用(Applied=false)
|
||||
/// 的公司行为事件,避免交易详情在真实调整前展示一条已完成历史。
|
||||
/// 获取交易操作历史。登记日创建但尚未到 EffectiveDate 的公司行为事件也保留,
|
||||
/// 由 EventData.Applied=false 表示“待生效”,保证审计日志完整可追溯。
|
||||
/// </summary>
|
||||
/// <param name="tradeId">交易id</param>
|
||||
/// <returns></returns>
|
||||
@@ -218,40 +218,7 @@ namespace YLErp.Modules.SwapModule
|
||||
.Where(x => x.SwapTradeId == tradeId)
|
||||
.OrderByDescending(o => o.id)
|
||||
.ToList();
|
||||
return FilterOperationHistory(list);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 过滤登记日创建且 Applied=false 的待生效公司行为事件,避免交易详情在真正
|
||||
/// 调整前展示一条“已完成”历史。其他事件仍保留;无法解析的旧格式公司行为也
|
||||
/// 保持可见,审计查询不能因为新 JSON 结构而静默丢失历史记录。
|
||||
/// </summary>
|
||||
public static List<swap_event> FilterOperationHistory(IEnumerable<swap_event> events)
|
||||
{
|
||||
return (events ?? Enumerable.Empty<swap_event>())
|
||||
.Where(x => !IsPendingCorporateActionEvent(x))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断指定事件是否为待生效的公司行为事件:EventType 为公司行为(13),
|
||||
/// 且 EventData 反序列化后 Applied=false(登记日写入、尚未在真实除权日补齐调整后数据)。
|
||||
/// 非公司行为类型、无法解析的旧格式或已应用的事件均返回 false,保证历史审计记录不被误删。
|
||||
/// </summary>
|
||||
public static bool IsPendingCorporateActionEvent(swap_event swapEvent)
|
||||
{
|
||||
if (swapEvent == null || swapEvent.EventType != (int)SwapEventTypeEnum.公司行为)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!TryDeserializeCorporateActionEventData(swapEvent, out var data))
|
||||
{
|
||||
// 非快照格式的历史公司行为保持可见,避免误删审计记录。
|
||||
return false;
|
||||
}
|
||||
|
||||
return !data.Applied;
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user