fix: 导出估值报告携带成交收益率

This commit is contained in:
gongpei
2025-10-15 11:13:55 +08:00
parent 1b6c332cf3
commit a78152090a
4 changed files with 9 additions and 3 deletions
@@ -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<int, decimal> 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.)