From bdaab1dee962cf5170e2e7b53ff25904e240becc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=96=B9=E6=B5=B7?= Date: Mon, 11 May 2026 17:57:08 +0800 Subject: [PATCH] =?UTF-8?q?#EQD-5857=20=E8=B5=84=E9=87=91=E8=AE=B0?= =?UTF-8?q?=E5=BD=95-=E9=A2=84=E4=BB=98=E9=87=91=E8=BF=94=E6=81=AF?= =?UTF-8?q?=E5=92=8C=E5=88=A9=E6=81=AF=E9=87=91=E9=A2=9D=E4=B8=8D=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/SwapModule/SwapDealService.cs | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/YLErpDAL/Modules/SwapModule/SwapDealService.cs b/YLErpDAL/Modules/SwapModule/SwapDealService.cs index 05f67719..c60eccf5 100644 --- a/YLErpDAL/Modules/SwapModule/SwapDealService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapDealService.cs @@ -402,6 +402,7 @@ namespace YLErp.Modules.SwapModule // 根据场景计算利息 if (settment) { + calcLast = calcLast = td.trade_extend.ExtendObj.InterestCalcMode.EndsWith("1");//算尾 // 收盘归档场景,使用 CalcEodInterest interests.Add(CalcEodInterest(td, valueDate, positionClone, rate, floatRate, closePrincipal, posiPrincipal, annualDays, calcFirst, calcLast, preEodPosition, eventType, add)); } @@ -496,7 +497,6 @@ namespace YLErp.Modules.SwapModule bool calcToday = true; if (calcFirst == false && valueDate == td.StartDate.Value) calcToday = false; // 首日不算头 if (calcLast == false && valueDate == td.ExerciseDate.Value) calcToday = false; // 到期日不算尾 - // 初始化EOD持仓信息 if (preEod.id == 0) { @@ -530,17 +530,26 @@ namespace YLErp.Modules.SwapModule decimal tdInterestAmount = 0; if (calcToday) { - - if (position.InterestType == (int)InterestTypeEnum.复利) + // 收盘自动互换场景,如果不算尾,当天是不产生利息的 + if (calcLast == false && eventType == (int)SwapEventTypeEnum.自动互换) { - // 复利计算 - CalcDailyCompoundInterestByEod(preEod, valueDate, td.StartDate.Value, position, closePrincipal, posiPrincipal, interest, annualDays, false, eodFloatRate, 1m, posiPrincipal, ref interestAmount, ref tdInterestAmount); + interestAmount= preEod.InterestProfitSum; + tdInterestAmount = 0; } else { - // 单利计算 - CalcDailySimpleInterestByEod(preEod, valueDate, td.StartDate.Value, position, closePrincipal, posiPrincipal, interest, annualDays, false, eodFloatRate, 1m, posiPrincipal, ref interestAmount, ref tdInterestAmount); + if (position.InterestType == (int)InterestTypeEnum.复利) + { + // 复利计算 + CalcDailyCompoundInterestByEod(preEod, valueDate, td.StartDate.Value, position, closePrincipal, posiPrincipal, interest, annualDays, false, eodFloatRate, 1m, posiPrincipal, ref interestAmount, ref tdInterestAmount); + } + else + { + // 单利计算 + CalcDailySimpleInterestByEod(preEod, valueDate, td.StartDate.Value, position, closePrincipal, posiPrincipal, interest, annualDays, false, eodFloatRate, 1m, posiPrincipal, ref interestAmount, ref tdInterestAmount); + } } + } // 四舍五入并赋值 interest.InterestAmount = Math.Round(interestAmount, ConsGlobal.PriceRound, MidpointRounding.AwayFromZero);