diff --git a/YLErpDAL/Modules/SwapModule/SwapFlowEventService.cs b/YLErpDAL/Modules/SwapModule/SwapFlowEventService.cs index 3d9b23bd..ceba0abc 100644 --- a/YLErpDAL/Modules/SwapModule/SwapFlowEventService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapFlowEventService.cs @@ -3,6 +3,7 @@ using ClosedXML.Report.Utils; using Confluent.Kafka; using Microsoft.Office.Interop.Excel; using MoreLinq; +using NPOI.OpenXmlFormats.Spreadsheet; using System.Collections.Generic; using YLErp.BLL.Calculation; using YLErp.DBModels; @@ -11,6 +12,7 @@ using YLErp.Model; using YLErp.Modules.AppModule; using YLErp.Modules.EodModule.QueryModule; using YLErp.QdpModule; +using static YLErp.ConsGlobal; namespace YLErp.Modules.SwapModule { @@ -498,7 +500,9 @@ namespace YLErp.Modules.SwapModule } var retListResult = query.ToSearchList(req); var tds= retListResult.rows.Select(x => x.FlowEvent.SwapTradeId).Distinct().ToList(); - var posiList = DbContext.swap_position.Where(s => !s.Invalid && s.IsInitial && tds.Contains(s.SwapTradeId)&&!string.IsNullOrEmpty(s.FloatRateUnderlyingCode)).ToList(); + var posiList = DbContext.swap_position.Where(s => !s.Invalid && s.IsInitial && tds.Contains(s.SwapTradeId) && !string.IsNullOrEmpty(s.FloatRateUnderlyingCode)).ToList(); + // 查询成交收益率 + Dictionary ytmMap = DbContext.trade.AsNoTracking().Where(p => tds.Contains(p.id)).ToList().ToDictionary(t => t.id, t => t.InitYtm); foreach (var item in retListResult.rows) { item.FlowEvent.DividendPending = -item.FlowEvent.DividendPending; @@ -509,6 +513,7 @@ namespace YLErp.Modules.SwapModule item.FlowEvent.TradingFee = -item.FlowEvent.TradingFee; item.FlowEvent.TradingFeePending = -item.FlowEvent.TradingFeePending; item.FlowEvent.InterestClosePnL = -item.FlowEvent.InterestClosePnL; + item.FlowEvent.InitYtm = ytmMap.GetValueOrDefault(item.FlowEvent.SwapTradeId); var posi= posiList.FirstOrDefault(s => s.id == item.FlowEvent.PositionId); item.FloatRateUnderlyingCode= posi?.FloatRateUnderlyingCode; if (item.FlowEvent.EventType==(int)SwapFlowEventTypeEnum.开仓) diff --git a/YLErpDAL/Modules/SwapModule/SwapTradeAutoService.cs b/YLErpDAL/Modules/SwapModule/SwapTradeAutoService.cs index c0efa879..fd5846c6 100644 --- a/YLErpDAL/Modules/SwapModule/SwapTradeAutoService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapTradeAutoService.cs @@ -355,6 +355,7 @@ namespace YLErp.Modules.SwapModule /// public List SummaryFlow(List swapFlows, DateTime valueDate, bool save = true, Action callback = null) { + DateTime settleDate = QdpCalendarHelper.GetNonHoliday(valueDate.AddDays(1)); var swapFlowGroup = swapFlows.GroupBy(g => new { g.ClientId, g.OccurTime, g.UnderlyingCode, g.BsType }).ToList(); List list = new List(); foreach (var gourpItem in swapFlowGroup) @@ -389,7 +390,7 @@ namespace YLErp.Modules.SwapModule swap_flow_summary.TradingAmountNetFeeAvg = swap_flow_summary.TradingQty == 0 ? swap_flow_summary.TradingAmountNetAvg : swap_flow_summary.TradingAmountNetAvg + swap_flow_summary.TradingFeePending * tradeSide / swap_flow_summary.TradingQty; swap_flow_summary.TradingAmountNetFeeAvg = Math.Round(swap_flow_summary.TradingAmountNetFeeAvg ?? 0, 10); // 计算收益率 - CalBondResult result = BondCalcHepler.BondCalcByDate(gourpItem.Key.UnderlyingCode, swap_flow_summary.TradingAmountAvg * ConsGlobal.bondShowPriceMultiple, valueDate.ToString("yyyy-MM-dd")); + CalBondResult result = BondCalcHepler.BondCalcByDate(gourpItem.Key.UnderlyingCode, swap_flow_summary.TradingAmountAvg * ConsGlobal.bondShowPriceMultiple, settleDate.ToString("yyyy-MM-dd")); if (result != null) { swap_flow_summary.InitYtm = result.ytm * ConsGlobal.bondPriceMultiple; diff --git a/YLErpWeb/App_Docs/导出模板/结算报告模板.xlsx b/YLErpWeb/App_Docs/导出模板/结算报告模板.xlsx index ce65897f..ba6be62b 100644 Binary files a/YLErpWeb/App_Docs/导出模板/结算报告模板.xlsx and b/YLErpWeb/App_Docs/导出模板/结算报告模板.xlsx differ diff --git a/YLErpWeb/Views/SwapTrade2/SwapflowList.cshtml b/YLErpWeb/Views/SwapTrade2/SwapflowList.cshtml index a8f37f02..6bc78ac4 100644 --- a/YLErpWeb/Views/SwapTrade2/SwapflowList.cshtml +++ b/YLErpWeb/Views/SwapTrade2/SwapflowList.cshtml @@ -171,7 +171,7 @@
- +