From 5552402a7c7d0451d0b0b24fb7a6201bddd391a6 Mon Sep 17 00:00:00 2001 From: hjhan Date: Thu, 20 Aug 2026 15:53:11 +0800 Subject: [PATCH] =?UTF-8?q?feat(swap):=20EQD-6977=20=E7=BD=9A=E6=81=AF?= =?UTF-8?q?=E5=BC=80=E5=85=B3=E7=B0=BF=E8=AE=B0=E9=BB=98=E8=AE=A4=E5=80=BC?= =?UTF-8?q?=E7=AE=A1=E9=81=93=E2=80=94=E2=80=94TradeExtendJson.IsPenaltyIn?= =?UTF-8?q?terest(=E5=AD=98=E9=87=8F=E7=BC=BA=E7=9C=81false=E9=9B=B6?= =?UTF-8?q?=E5=9B=9E=E5=A1=AB)=20+=20InitUnwind=20=E5=B9=B3=E4=BB=93?= =?UTF-8?q?=E9=A1=B5=E5=B8=A6=E5=87=BA=E7=B0=BF=E8=AE=B0=E5=80=BC=20+=20Ge?= =?UTF-8?q?tUnwindInterestList=20=E5=8F=82=E6=95=B0=E9=80=8F=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Framework/YLErp.Core/DBModels/TradeExtend.cs | 7 +++++++ YLErpDAL/Modules/SwapModule/SwapDealService.cs | 2 ++ YLErpWeb/Controllers/SwapTrade2Controller.cs | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Framework/YLErp.Core/DBModels/TradeExtend.cs b/Framework/YLErp.Core/DBModels/TradeExtend.cs index 883010c5..15829dd4 100644 --- a/Framework/YLErp.Core/DBModels/TradeExtend.cs +++ b/Framework/YLErp.Core/DBModels/TradeExtend.cs @@ -97,6 +97,13 @@ namespace YLErp.DBModels [JsonIgnore] public bool CalcLast => InterestCalcMode?.EndsWith("1") ?? true; + /// + /// 是否罚息(EQD-6977):提前终止平仓时利息端按持有至到期计息的簿记默认值。 + /// 平仓页默认带出此值、可修改,以平仓时选择为准(当次选择经 UnwindData.IsPenaltyInterest 走请求,不回写)。 + /// 存量 JSON 无此键 → 反序列化默认 false("否"),零回填。 + /// + public bool IsPenaltyInterest { get; set; } + /// ///多空组合浮动端 收取方向 1:收取,2:支付 /// diff --git a/YLErpDAL/Modules/SwapModule/SwapDealService.cs b/YLErpDAL/Modules/SwapModule/SwapDealService.cs index 1160d34f..0a238637 100644 --- a/YLErpDAL/Modules/SwapModule/SwapDealService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapDealService.cs @@ -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%)。 diff --git a/YLErpWeb/Controllers/SwapTrade2Controller.cs b/YLErpWeb/Controllers/SwapTrade2Controller.cs index 2f282b7b..33c82881 100644 --- a/YLErpWeb/Controllers/SwapTrade2Controller.cs +++ b/YLErpWeb/Controllers/SwapTrade2Controller.cs @@ -400,13 +400,13 @@ namespace YLErp.Web.Controllers /// /// /// - 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);