#TRS-ZS-594 数据库client_balance_view表,所有的字段落库值应保留2位小数

This commit is contained in:
嬴政 时
2025-07-08 16:30:54 +08:00
parent f98b556816
commit 0b88d240f4
@@ -1,6 +1,7 @@
using BaseOUDAL;
using DocumentFormat.OpenXml.Bibliography;
using DocumentFormat.OpenXml.Spreadsheet;
using MathNet.Numerics;
using NPOI.SS.UserModel;
using YLErp.BLL.Eod;
using YLErp.DBModels;
@@ -1429,13 +1430,13 @@ namespace YLErp.BLL.EodSettlement
var clientEodSwaps = clientEventFlowQuery.ToList();
foreach (var item in clientEodSwaps.GroupBy(x => x.SwapTradeId))
{
var eventPosis = item.Where(t => t.PayDirection > 0).ToList();
var eventInterests = item.Where(t => t.PayDirection == 0).ToList();
interestPnl += Convert.ToDouble(eventInterests.Sum(s=>s.InterestClosePnL)) * (-1);
tradeFee += Convert.ToDouble(eventPosis.Sum(s=>s.TradingFee+s.TradingFeePending)) * (-1);
interestPnl += Convert.ToDouble(eventInterests.Sum(s => s.InterestClosePnL)) * (-1);
tradeFee += Convert.ToDouble(eventPosis.Sum(s => s.TradingFee + s.TradingFeePending)) * (-1);
}
clientBalance.trade_fee = tradeFee;
clientBalance.interest_pnl = interestPnl;
@@ -1563,6 +1564,7 @@ namespace YLErp.BLL.EodSettlement
{
return new List<ClientBalanceView>();
}
var roundFunc = new Func<double, double>(O => Math.Round(O, ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero));
//精简字段
var resultList = result.Select(item => new ClientBalanceView
{
@@ -1570,29 +1572,29 @@ namespace YLErp.BLL.EodSettlement
Number = item.ClientNumber ?? "",
Name = item.ClientName ?? "",
TotalTradeCount = item.TotalTradeCount,
TotalNotionalPrincipal = item.TotalNotionalPrincipal,
TotalNotionalPrincipal = roundFunc(item.TotalNotionalPrincipal),
TransactionPenNumber = item.TradeCount,
TodayNotionalPrincipal = item.TodayNotionalPrincipal,
PositionNotionalPrincipal = item.PositionNotionalPrincipal,
TodayNotionalPrincipal = roundFunc(item.TodayNotionalPrincipal),
PositionNotionalPrincipal = roundFunc(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,
WinLoss = roundFunc(item.WinLoss),
PositionPnl = roundFunc(item.PositionPnl),
RoundedPositionPnl = roundFunc(item.RoundedPositionPnl),
LastDayRemainFund = roundFunc(item.LastDayRemainFund),
NetFundAll = roundFunc(item.NetFundAll),
NetFund = roundFunc(item.NetFund),
VmFundSum = roundFunc(item.VmFundSum),
OtherFund = roundFunc(item.OtherFund),
AmountFund = roundFunc(item.AmountFund),
MySideMargin = roundFunc(item.MySideMargin),
MaintenanceMargin = roundFunc(item.MaintenanceMargin),
SwapMarketAmount = roundFunc(item.SwapMarketAmount),
SwapMarketAmountPercent = item.SwapMarketAmountPercent,
AvailableAmount = item.AvailableAmount,
InsuredAmount = item.MarginByPayableMarginTotal,
DesirableFund = item.DesirableFund,
TradeFee = item.TradeFee,
InterestPnl = item.InterestPnl,
AvailableAmount = roundFunc(item.AvailableAmount),
InsuredAmount = roundFunc(item.MarginByPayableMarginTotal),
DesirableFund = roundFunc(item.DesirableFund),
TradeFee = roundFunc(item.TradeFee),
InterestPnl = roundFunc(item.InterestPnl),
Updatetime = DateTime.Now
}).ToList();
return resultList;