From 134b16b2c2b641158ba0dbf3cd74a9edcf9c7a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=94=A6=E9=BA=9F=20=E7=8E=8B?= <2452821485@qq.com> Date: Tue, 22 Apr 2025 15:25:49 +0800 Subject: [PATCH] =?UTF-8?q?TRS-ZS-181=E4=BF=9D=E8=AF=81=E9=87=91=E4=B8=AD?= =?UTF-8?q?=E5=8F=B0=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE=E7=9A=84=E8=A7=86?= =?UTF-8?q?=E5=9B=BE=E6=8F=90=E4=BE=9B=EF=BC=88=E5=B0=BD=E9=87=8FAPI?= =?UTF-8?q?=EF=BC=89=20=E6=96=B0=E5=A2=9E=E5=AE=A2=E6=88=B7=E4=BD=99?= =?UTF-8?q?=E9=A2=9D=E6=8E=A5=E5=8F=A3=20=E8=B5=84=E9=87=91=E7=9B=91?= =?UTF-8?q?=E6=8E=A7=E7=95=8C=E9=9D=A2=E7=9A=84=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/ClientBalanceController.cs | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 YLErpWeb/WebAPI/Controllers/ClientBalanceController.cs diff --git a/YLErpWeb/WebAPI/Controllers/ClientBalanceController.cs b/YLErpWeb/WebAPI/Controllers/ClientBalanceController.cs new file mode 100644 index 00000000..a523fe77 --- /dev/null +++ b/YLErpWeb/WebAPI/Controllers/ClientBalanceController.cs @@ -0,0 +1,129 @@ +using System; +using System.Data; +using YLErp.BLL.EodSettlement; +using YLErp.Modules.ClientModule; +using YLErp.Modules.VolatilityModule; + +namespace YLErp.Web.WebAPI.Controllers +{ + public class ClientBalanceController + { + + /// + /// + [HttpPost("m/api/ClientBalance/GetClientRsikMonitor")] + public JsonResult GetClientRsikMonitor([FromBody]MonitorReq req) + { + LogFactory.GetLogger("GetClientRsikMonitor请求").Info(JsonHelper.Serialize(req)); + if (!req.SearchDate.HasValue) + { + req.SearchDate = valuedateBLL.ValueDate; + } + if (string.IsNullOrWhiteSpace(req.marginShownType)) + { + req.marginShownType = "default"; + } + if (req.ClientIds == null || req.ClientIds.Count <= 0) + { + req.ClientIds = DataCacheProvider.GetClientDataSource().AsQueryable().Select(o => o.id).Distinct().ToList(); + } + var result = ClientBalanceUtility.GetClientRiskMonitorForShanXiGuShou(req.ClientIds, req.SearchDate.Value, req.marginShownType); + //精简字段 + var resultList = result.Select(item => new resultParam + { + Number = item.ClientNumber, + Name = item.ClientName, + TotalTradeCount = item.TotalTradeCount, + TotalNotionalPrincipal = item.TotalNotionalPrincipal, + TransactionPenNumber = item.TradeCount, + TodayNotionalPrincipal = item.TodayNotionalPrincipal, + PositionNotionalPrincipal = item.PositionNotionalPrincipal, + CurrentHoldingPenNumber = item.PositionCount, + WinLoss = item.WinLoss, + PositionPnl = item.PositionPnl, + RoundedPositionPnl = item.RoundedPositionPnl, + LastDayRemainFund = item.LastDayRemainFund, + NetFundAll = item.NetFundAll, + NetFund = item.NetFund, + VmFundSum = item.VmFundSum, + OtherFund = item.OtherFund, + AmountFund = item.AmountFund, + MySideMargin = item.MySideMargin, + MaintenanceMargin = item.MaintenanceMargin, + SwapMarketAmount = item.SwapMarketAmount, + SwapMarketAmountPercent = item.SwapMarketAmountPercent, + AvailableAmount = item.AvailableAmount, + InsuredAmount = item.MarginByPayableMarginTotal, + DesirableFund = item.DesirableFund + }).ToList(); + LogFactory.GetLogger().Info($"GetClientRsikMonitor: {JsonHelper.Serialize(resultList)}"); + return new JsonResult(resultList); + } + + public class MonitorReq + { + public List ClientIds { get; set; } + + public DateTime? SearchDate { get; set; } + + public string marginShownType { get; set; } + } + + public class resultParam + { + /*客户编号 客户名称 交易总数 名义本金总额 当日交易数 当日交易名义本金 + 持仓名义本金 持仓笔数 实现盈亏 持仓盈亏 期初结存 出金入金 初保账户 追保账户 其他收支 + 期末结存 初始保证金金额 维持保证金金额 盯市金额 履约保证金比例 可用资金 追保金额 可取资金*/ + + public string Number { get; set; } + + public string Name { get; set; } + + public int TotalTradeCount { get; set; } + + public double TotalNotionalPrincipal { get; set; } + + public int TransactionPenNumber { get; set; } + + public double TodayNotionalPrincipal { get; set; } + + public double PositionNotionalPrincipal { get; set; } + + public int CurrentHoldingPenNumber { get; set; } + + public double WinLoss { get; set; } + + public double PositionPnl { get; set; } + + public double RoundedPositionPnl { get; set; } + + public double LastDayRemainFund { get; set; } + + public double NetFundAll { get; set; } + + public double NetFund { get; set; } + + public double VmFundSum { get; set; } + + public double OtherFund { get; set; } + + public double AmountFund { get; set; } + + public double MySideMargin { get; set; } + + public double MaintenanceMargin { get; set; } + + public double SwapMarketAmount { get; set; } + + public decimal SwapMarketAmountPercent { get; set; } + + public double AvailableAmount { get; set; } + + public double InsuredAmount { get; set; } + + public double DesirableFund { get; set; } + } + + + } +}