feat(swap): EQD-6977 罚息开关簿记默认值管道——TradeExtendJson.IsPenaltyInterest(存量缺省false零回填) + InitUnwind 平仓页带出簿记值 + GetUnwindInterestList 参数透传

This commit is contained in:
hjhan
2026-08-20 15:53:11 +08:00
parent d6646f9c90
commit 5552402a7c
3 changed files with 11 additions and 2 deletions
@@ -97,6 +97,13 @@ namespace YLErp.DBModels
[JsonIgnore]
public bool CalcLast => InterestCalcMode?.EndsWith("1") ?? true;
/// <summary>
/// 是否罚息(EQD-6977):提前终止平仓时利息端按持有至到期计息的簿记默认值。
/// 平仓页默认带出此值、可修改,以平仓时选择为准(当次选择经 UnwindData.IsPenaltyInterest 走请求,不回写)。
/// 存量 JSON 无此键 → 反序列化默认 false("否"),零回填。
/// </summary>
public bool IsPenaltyInterest { get; set; }
/// <summary>
///多空组合浮动端 收取方向 1:收取,2:支付
/// </summary>
@@ -258,6 +258,8 @@ namespace YLErp.Modules.SwapModule
unwindData.PosiNotionalValue = Convert.ToDecimal(td.StockEqvNotional);
unwindData.PositionQty = position != null ? position.PosiQuantity : Convert.ToDecimal(td.TradeAmount);
unwindData.AnnualDays = tradeExtend == null ? 365 : tradeExtend.ExtendObj.AnnualDays;
// EQD-6977 罚息:平仓页「是否罚息」默认带出簿记值;以平仓时选择为准(可改),此处仅默认值
unwindData.IsPenaltyInterest = tradeExtend != null && tradeExtend.ExtendObj.IsPenaltyInterest;
unwindData.CloseMethod = (int)CloseMethodEnum.;
// 占期初(original)语义(A):默认"平掉剩余全部持仓" = 剩余名义本金/期初名义本金。
// 未平仓时 PosiNotionalValue==NotionalValue → 1(平100%);部分平仓后自动变为剩余比例(如已平10%则默认90%)。
+2 -2
View File
@@ -400,13 +400,13 @@ namespace YLErp.Web.Controllers
/// <param name="tradeId"></param>
/// <param name="closePercent"></param>
/// <returns></returns>
public JsonResult GetUnwindInterestList(DateTime valueDate,DateTime unwindDate, int tradeId, decimal closePercent, int eventType, decimal notionalValue = 0, decimal posiNotionalValue = 0)
public JsonResult GetUnwindInterestList(DateTime valueDate,DateTime unwindDate, int tradeId, decimal closePercent, int eventType, decimal notionalValue = 0, decimal posiNotionalValue = 0, bool isPenaltyInterest = false)
{
unwindDate = valueDate;
// 前端按"占期初(original)"语义传 closePercent(A);后端 GetUnwindInterests 按"占剩余(remaining)"语义(B)计算。
// 多空互换前端不传 notionalValue/posiNotionalValue(默认 0),则跳过转换保持原行为。
var convertedClosePercent = SwapDealService.ToRemainingClosePercent(closePercent, notionalValue, posiNotionalValue);
var interests = new SwapDealService(CurUser).GetUnwindInterests(valueDate, unwindDate, tradeId, convertedClosePercent, eventType);
var interests = new SwapDealService(CurUser).GetUnwindInterests(valueDate, unwindDate, tradeId, convertedClosePercent, eventType, isPenaltyInterest);
foreach (var interest in interests)
{
interest.TdInterestAmount=Math.Round(interest.TdInterestAmount, ConsGlobal.MoneyRound,MidpointRounding.AwayFromZero);