从山证v2.3.0拷贝
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Qdp.Pricing.Base.Utilities;
|
||||
using Qdp.Pricing.Library.Base.Utilities;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using YLErp.Model;
|
||||
|
||||
namespace YLErp.Modules.SuperviseReportModule.ExtendReport.GeLin
|
||||
{
|
||||
/// <summary>
|
||||
/// 客户持仓信息报表
|
||||
/// </summary>
|
||||
public class ClientPositionReport : ExtendReportBaseService
|
||||
{
|
||||
public ClientPositionReport(OptUserInfo userInfo, SuperviseReportReq req) : base(userInfo, req)
|
||||
{ }
|
||||
|
||||
public override string TemplateName => "客户持仓信息报表.xlsx";
|
||||
|
||||
|
||||
public override string TargetFileName => $"{RequestInfo.ValueDate:yyyy-MM-dd}~{RequestInfo.EndDate:yyyy-MM-dd}客户持仓信息报表.xlsx";
|
||||
|
||||
public override Dictionary<string, object> SearchReportInfo()
|
||||
{
|
||||
//结束
|
||||
//客户持仓名义本金
|
||||
var tradeList = DbContext.eod_trade.Where(s => s.ValueDate >= RequestInfo.ValueDate &&s.ParentTradeId==0 && s.ValueDate <= RequestInfo.EndDate).Select(s => new xodTradeBase()
|
||||
{
|
||||
ValueDate = s.ValueDate,
|
||||
TradeJson = s.TradeJson,
|
||||
}).ToList().Select(O => new { O.ValueDate, ClientId = O.trade.ClientId, StockEqvNotional = O.trade.StockEqvNotional }).GroupBy(s => s.ValueDate).ToList();
|
||||
|
||||
var positionNotionalList = new List<GeLin_ClientPositionNotional>();
|
||||
var positionCountList = new List<GeLin_ClientPositionCount>();
|
||||
|
||||
foreach (var item in tradeList)
|
||||
{
|
||||
var date = item.Key;
|
||||
var clientCount = item.GroupBy(s => s.ClientId).Distinct();
|
||||
positionCountList.Add(
|
||||
new GeLin_ClientPositionCount()
|
||||
{
|
||||
valueDate = date,
|
||||
PositionCount = clientCount.Count()
|
||||
});
|
||||
foreach (var items in clientCount)
|
||||
{
|
||||
var sumParemoney = items.Sum(s => s.StockEqvNotional);
|
||||
var client = DataCacheProvider.GetClientDataSource().GetData(items.Key);
|
||||
positionNotionalList.Add(
|
||||
new GeLin_ClientPositionNotional()
|
||||
{
|
||||
valueDate = date,
|
||||
ClientNumber = client.Number,
|
||||
ClientName = client.Name,
|
||||
StockEqvNotional = sumParemoney
|
||||
});
|
||||
}
|
||||
}
|
||||
return new Dictionary<string, object>() {
|
||||
{"持仓客户数量", positionCountList},
|
||||
{"客户持仓名义本金", positionNotionalList}
|
||||
};
|
||||
}
|
||||
|
||||
public class GeLin_ClientPositionNotional
|
||||
{
|
||||
public DateTime valueDate { get; set; }
|
||||
|
||||
public string ClientNumber { get; set; }
|
||||
|
||||
|
||||
public string ClientName { get; set; }
|
||||
|
||||
|
||||
public double StockEqvNotional { get; set; }
|
||||
}
|
||||
|
||||
public class GeLin_ClientPositionCount
|
||||
{
|
||||
public DateTime valueDate { get; set; }
|
||||
|
||||
public int PositionCount { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user