From fb735d474023bb3d221c3830a2f6e43be8181646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=96=B9=E6=B5=B7?= Date: Thu, 14 May 2026 11:11:08 +0800 Subject: [PATCH 1/4] =?UTF-8?q?#EQD-5901=20=E5=9B=BD=E8=81=94=E6=B0=91?= =?UTF-8?q?=E7=94=9F-=E5=88=A9=E6=81=AF=E7=AB=AF=E4=BA=92=E6=8D=A2?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E7=9B=B8=E5=85=B3=E7=9A=84=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeEdit.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeEdit.js b/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeEdit.js index a46f49c2..9922fb2e 100644 --- a/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeEdit.js +++ b/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeEdit.js @@ -623,13 +623,14 @@ const vue = new Vue({ } var obdate = {}; if (type == 1) { - var SettlementDate = value.Date; + var settlementDate = value.Date; if (value.SettlementDate!=null) { - SettlementDate = value.SettlementDate; + settlementDate = value.SettlementDate; } + var m = new moment(settlementDate); obdate = { date: _date, - SettlementDate: _date, + SettlementDate: m.format("YYYY-MM-DD"), floatRateCode: floatRateCode, val: _.toString(val) ? parseFloat(consNumberFormat.umpriceP(val)) : "", itemChecked: itemChecked, From 44e89726262381b229069da4732d2962dd97999f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=96=B9=E6=B5=B7?= Date: Thu, 14 May 2026 16:15:38 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=94=B6=E7=9B=98=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E4=BA=92=E6=8D=A2=EF=BC=8C=E9=9C=80=E8=A6=81=E5=B0=86=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E8=AE=A1=E6=81=AF=E5=9F=BA=E6=95=B0=E7=BB=99=E5=9B=9E?= =?UTF-8?q?=E5=88=B0=E6=8C=81=E4=BB=93=E5=90=8D=E4=B9=89=E6=9C=AC=E9=87=91?= =?UTF-8?q?=E6=88=96=E5=9B=BA=E5=AE=9A=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SwapModule/SwapEodPositionService.cs | 17 ++++++++++------- .../Modules/SwapModule/SwapTradeBaseService.cs | 3 ++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs index 06d8c90a..deb84211 100644 --- a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs @@ -825,7 +825,8 @@ namespace YLErp.Modules.SwapModule positions.Add(position); List preEodPositions = new List(); preEodPositions.Add(eodPayPosition); - if (position.InterestMode == (int)InterestModeEnum.固定值||position.InterestMode == (int)InterestModeEnum.初始预付金 || position.InterestMode == (int)InterestModeEnum.追加预付金) + var interestModes = new List() { (int)InterestModeEnum.固定值, (int)InterestModeEnum.初始预付金, (int)InterestModeEnum.追加预付金 }; + if (interestModes.Contains(position.InterestMode)) { orginPv = eodPayPosition.InterestPrincipalFix; } @@ -853,7 +854,7 @@ namespace YLErp.Modules.SwapModule newEodPayPosition.FloatRateUnderlyingCode = position.FloatRateUnderlyingCode; newEodPayPosition.InterestFeePending = 0; //利息端估值用信息 - newEodPayPosition.TdInterestPrincipal = interests.Count > 0 ? interests.First().InterestPrincipal : 0; + eodPayPosition.TdInterestPrincipal = interestModes.Contains(position.InterestMode) ? eodPayPosition.InterestPrincipalFix : posiNotionalValue; newEodPayPosition.TdInterestRate = interval.Rate; //当日已实现 //newEodPayPosition.TdInterestFee = 0; @@ -920,7 +921,8 @@ namespace YLErp.Modules.SwapModule newEodPayPosition = eodPayPosition.Clone(); newEodPayPosition.id = 0; } - if (position.InterestMode == (int)InterestModeEnum.固定值 || position.InterestMode == (int)InterestModeEnum.初始预付金 || position.InterestMode == (int)InterestModeEnum.追加预付金) + var interestModes = new List() { (int)InterestModeEnum.固定值, (int)InterestModeEnum.初始预付金, (int)InterestModeEnum.追加预付金 }; + if (interestModes.Contains(position.InterestMode)) { orginPv = eodPayPosition.InterestPrincipalFix; } @@ -962,8 +964,7 @@ namespace YLErp.Modules.SwapModule newEodPayPosition.interest_rest_days = position.interest_rest_days; newEodPayPosition.interest_rule = position.interest_rule; //利息端估值用信息 - newEodPayPosition.TdInterestPrincipal = interests.Count > 0 ? interests.First().InterestPrincipal : 0; - newEodPayPosition.TdInterestPrincipal *= (1 - closePercent); + newEodPayPosition.TdInterestPrincipal = interestModes.Contains(position.InterestMode) ? eodPayPosition.InterestPrincipalFix : posiLongNotional + posiShortNational; if (interval != null) { newEodPayPosition.TdInterestRate = interval.Rate; @@ -1027,6 +1028,7 @@ namespace YLErp.Modules.SwapModule Log.Info($"eodPayPosition is {JsonHelper.Serialize(eodPayPosition, false)},newEodPayPosition is {JsonHelper.Serialize(newEodPayPosition, false)}"); List intervals = position.SwapIntervalList; var tradeExtend = td.trade_extend.ExtendObj; + var interestModes = new List() { (int)InterestModeEnum.固定值, (int)InterestModeEnum.初始预付金, (int)InterestModeEnum.追加预付金 }; if (eodPayPosition == null) { //if (position.PosiStartDate > valueDate) @@ -1038,11 +1040,12 @@ namespace YLErp.Modules.SwapModule eodPayPosition.ClientId = td.ClientId; eodPayPosition.SwapTradeId = td.id; //eodPayPosition.PositionId = position.id; 为了算利息时找不到给日期重新赋值 + eodPayPosition.InterestMode = position.InterestMode; eodPayPosition.InterestPrincipalFix = position.InterestPrincipalFix; eodPayPosition.InterestRateDefault = position.InterestRateDefault; eodPayPosition.InterestSwapInterval = position.InterestSwapInterval; - eodPayPosition.TdInterestPrincipal = position.InterestMode == 1 ? eodPayPosition.InterestPrincipalFix : posiLongNational + posiShortNational; + eodPayPosition.TdInterestPrincipal = interestModes.Contains(position.InterestMode) ? eodPayPosition.InterestPrincipalFix : posiLongNational + posiShortNational; eodPayPosition.PosiStartDate = td.StartDate.Value; eodPayPosition.PosiMatuirityDate = td.ExerciseDate.Value; eodPayPosition.IsAnnualized = position.IsAnnualized; @@ -1060,7 +1063,7 @@ namespace YLErp.Modules.SwapModule newEodPayPosition.id = 0; newEodPayPosition.PositionId = position.id; } - if (position.InterestMode == (int)InterestModeEnum.固定值 || position.InterestMode == (int)InterestModeEnum.初始预付金 || position.InterestMode == (int)InterestModeEnum.追加预付金) + if (interestModes.Contains(position.InterestMode)) { orginPv = eodPayPosition.InterestPrincipalFix; } diff --git a/YLErpDAL/Modules/SwapModule/SwapTradeBaseService.cs b/YLErpDAL/Modules/SwapModule/SwapTradeBaseService.cs index 5c8b2bb1..0fe0981a 100644 --- a/YLErpDAL/Modules/SwapModule/SwapTradeBaseService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapTradeBaseService.cs @@ -397,10 +397,11 @@ namespace YLErp.Modules.SwapModule // 删除预付金腿的资金记录(通过交易ID、日期和Action类型查找,一次性查询避免MySQL连接重用问题) var swapTradeIds = swapEvents.Select(s => s.SwapTradeId).Distinct().ToList(); + var actions = new List() { ClientCashInCashOut.系统操作_预付金返息, ClientCashInCashOut.系统操作_互换 }; var premiumCashRecords = DbContext.ClientCashInCashOut .Where(x => swapTradeIds.Contains(x.TradeId ?? 0) && x.HappenDate>=valueDate - && x.Action == ClientCashInCashOut.系统操作_预付金返息) + && actions.Contains(x.Action)) .ToList(); if (premiumCashRecords.Any()) { From 4c570c512ed749a13adbc78215d6bd69624e745f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=96=B9=E6=B5=B7?= Date: Thu, 14 May 2026 16:25:23 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=94=B6=E7=9B=98=E5=88=A9=E6=81=AF?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YLErpDAL/Modules/SwapModule/SwapDealService.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/YLErpDAL/Modules/SwapModule/SwapDealService.cs b/YLErpDAL/Modules/SwapModule/SwapDealService.cs index 5539f5e4..b8bbd82a 100644 --- a/YLErpDAL/Modules/SwapModule/SwapDealService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapDealService.cs @@ -788,13 +788,15 @@ namespace YLErp.Modules.SwapModule } flowEvent.InterestPrincipal = tdDynomicPrincipal * closePercent; - interest = flowEvent.InterestPrincipal * (flowEvent.InterestRate + Convert.ToDecimal(floatRate)); - tdinterest = tdDynomicPrincipal * (flowEvent.InterestRate + Convert.ToDecimal(floatRate)); + var interest1 = flowEvent.InterestPrincipal * (flowEvent.InterestRate + Convert.ToDecimal(floatRate)); + var tdinterest1 = tdDynomicPrincipal * (flowEvent.InterestRate + Convert.ToDecimal(floatRate)); if (position.IsAnnualized) { - interest /= annualDays; - tdinterest /= annualDays; + interest1 /= annualDays; + tdinterest1 /= annualDays; } + interest += interest1; + tdinterest = tdinterest1; } else { @@ -806,7 +808,7 @@ namespace YLErp.Modules.SwapModule interest1 /= annualDays; tdinterest1 /= annualDays; } - interest = interest1; + interest += interest1; tdinterest = tdinterest1; } flowEvent.FloatRate = Convert.ToDecimal(floatRate); From e92ee46c4cb0da60c497925d9cbe46354de0ac00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=94=A6=E9=BA=9F=20=E7=8E=8B?= Date: Thu, 14 May 2026 17:22:17 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8D=8F=E8=AE=AE?= =?UTF-8?q?=E7=BC=96=E5=8F=B7=E8=8E=B7=E5=8F=96=E9=80=BB=E8=BE=91=E5=8F=8A?= =?UTF-8?q?=E5=88=A9=E7=8E=87=E5=AD=97=E6=AE=B5=E5=B1=95=E7=A4=BA=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TradeConfirmationGenerator.cs | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeConfirmationGenerator.cs b/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeConfirmationGenerator.cs index 4972eba5..5edf5907 100644 --- a/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeConfirmationGenerator.cs +++ b/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeConfirmationGenerator.cs @@ -187,7 +187,21 @@ namespace YLErp.Plugins.GuoLian.DocumentGenerator ? client.Name : $"{client.Manager}作为管理人代表{client.Name}"; - dic["主协议编号"] = client.MainProtocolCode ?? ""; + // 主协议编号:优先取 client 表字段,为空时从 client_meta 表兜底 + var mainProtocolCode = client.MainProtocolCode; + if (string.IsNullOrWhiteSpace(mainProtocolCode)) + { + mainProtocolCode = Context.GetClientMeta(client.id, ConsTradeMetaKey.MainProtocolCode)?.MetaValue; + } + dic["主协议编号"] = mainProtocolCode ?? ""; + + // 补充协议编号:优先取 client 表字段,为空时从 client_meta 表兜底 + var supProtocolCode = client.SupProtocolCode; + if (string.IsNullOrWhiteSpace(supProtocolCode)) + { + supProtocolCode = Context.GetClientMeta(client.id, ConsTradeMetaKey.SupProtocolCode)?.MetaValue; + } + dic["补充协议编号"] = supProtocolCode ?? ""; dic["名义本金"] = trade.OriginalStockEqvNotional?.ToString("N2") ?? "0.00"; // 银行账户信息 @@ -208,7 +222,7 @@ namespace YLErp.Plugins.GuoLian.DocumentGenerator var bond = JsonHelper.Deserialize(underlying.ExJson) ?? new UnderlyingBond(); dic["参考标的发行人"] = bond.UnderlyingIssuer ?? ""; dic["参考标的担保人"] = ""; - dic["票面利率"] = (bond.CouponRate ?? 0).ToString("N4"); + dic["票面利率"] = ((double)(bond.CouponRate ?? 0) * 100).ToString("N4"); dic["参考标的到期日"] = underlying.MaturityDate?.ToString("yyyy年M月d日") ?? ""; } @@ -326,7 +340,7 @@ namespace YLErp.Plugins.GuoLian.DocumentGenerator dic["利率类型"] = "浮动利率"; dic["IsFloat"] = "☑"; dic["固定利率"] = ""; - dic["利差"] = ((double)interestMargin.InterestRateDefault * 10000).ToString("N2"); + dic["利差"] = ((double)interestMargin.InterestRateDefault * 10000).ToString("N0"); dic["重置频率"] = (interestMargin.interest_rest_days ?? 0) + "天"; } }