diff --git a/YLErpDAL/Model/ClientBalanceForTrsResponse.cs b/YLErpDAL/Model/ClientBalanceForTrsResponse.cs index bf813393..49e63a7c 100644 --- a/YLErpDAL/Model/ClientBalanceForTrsResponse.cs +++ b/YLErpDAL/Model/ClientBalanceForTrsResponse.cs @@ -8,10 +8,7 @@ namespace YLErp.Model { public class ClientBalanceForTrsResponse { - /// - /// 总资产 - /// - public double TotalAmountTotal { get; set; } + /// /// 可用资金 /// @@ -24,11 +21,7 @@ namespace YLErp.Model /// 持仓盈亏 /// public double PositionPnl { get; set; } - /// - /// 当日盈亏 - /// - public double DaliyPnl { get; set; } - + public int ClientId { get; set; } /// /// 互换交易类别(0:非DMA,1;DMA) diff --git a/YLErpWeb/App/KafkaTask/ClientBalanceTask.cs b/YLErpWeb/App/KafkaTask/ClientBalanceTask.cs index 2e126dec..53703668 100644 --- a/YLErpWeb/App/KafkaTask/ClientBalanceTask.cs +++ b/YLErpWeb/App/KafkaTask/ClientBalanceTask.cs @@ -74,11 +74,9 @@ namespace YLErp.Web.App var AvailableMoney = cb.AvailableAmount + cb.FrozenMarginMoney; var obj = new ClientBalanceForTrsResponse { - TotalAmountTotal = cb.RoundedTotalAmountTotal, AvailableAmount = Math.Round(cb.AvailableAmount, 2), PositionPv = cb.RoundedPositionPv, PositionPnl = cb.RoundedPositionPnl, - DaliyPnl = Math.Round(cb.DaliyPnl, 2), ClientId = req.clientId, ClientType = cb.ClientType, Credit = cb.TotalCredit, diff --git a/YLErpWeb/Controllers/trade_spanController.cs b/YLErpWeb/Controllers/trade_spanController.cs index 373fa481..d8737fe1 100644 --- a/YLErpWeb/Controllers/trade_spanController.cs +++ b/YLErpWeb/Controllers/trade_spanController.cs @@ -138,11 +138,11 @@ namespace YLErp.Web.Controllers var cb = ClientAssetDataService.GetClientLatestBalance(null, DateTime.Now.Date, clientId, false, false, false); var obj = new ClientBalanceForTrsResponse { - TotalAmountTotal = cb.RoundedTotalAmountTotal, + AvailableAmount = Math.Round(cb.AvailableAmount,2), PositionPv = cb.RoundedPositionPv, PositionPnl = cb.RoundedPositionPnl, - DaliyPnl = Math.Round(cb.DaliyPnl, 2), + Credit =cb.TotalCredit }; return JsonSuccess("", obj); diff --git a/YLErpWeb/appsettings.dev.json b/YLErpWeb/appsettings.dev.json index fb524450..61bdf12d 100644 --- a/YLErpWeb/appsettings.dev.json +++ b/YLErpWeb/appsettings.dev.json @@ -37,6 +37,7 @@ "HedgingAccountTopic": "ylHedgingAccountTopic", //对冲账户生产topic "ReqAccountCapitalTopic": "ReqAccountCapital", //账户资金请求topic "OnRspAccountCapitalTopic": "OnRspAccountCapital", //账户资金请求返回topic + "RealtimeCalcAccountBalance": "RealtimeCalcAccountBalance", //实时资金计算topic "AccountCapitalTopicGroupId": "YiLian_OnRspAccountCapitalConsumer", //账户资金消费组 "AutoOffsetReset": 1, //Latest(0),Earliest(1),Error(2) "EnableCalcBongd": false, //是否启用kafka计算 diff --git a/YLErpWeb/appsettings.local.json b/YLErpWeb/appsettings.local.json index 0b484dc9..4d38ff0d 100644 --- a/YLErpWeb/appsettings.local.json +++ b/YLErpWeb/appsettings.local.json @@ -40,6 +40,7 @@ "AccountCapitalTopicGroupId": "YiLian_OnRspAccountCapitalConsumer", //账户资金消费组 "ReqAccountCapitalTopic": "ReqAccountCapital", //账户资金请求topic "OnRspAccountCapitalTopic": "OnRspAccountCapital", //账户资金请求返回topic + "RealtimeCalcAccountBalance": "RealtimeCalcAccountBalance", //实时资金计算topic "AutoOffsetReset": 1, //Latest(0),Earliest(1),Error(2) "EnableCalcBongd": false, //是否启用kafka计算 "ReqClientRiskCheckTopic": "YiLian_ReqClientRiskCheck", //客户风控检查 diff --git a/YLErpWeb/appsettings.prod.json b/YLErpWeb/appsettings.prod.json index aa0e95d8..f9ed854c 100644 --- a/YLErpWeb/appsettings.prod.json +++ b/YLErpWeb/appsettings.prod.json @@ -40,6 +40,7 @@ "AccountCapitalTopicGroupId": "YiLian_OnRspAccountCapitalConsumer", //账户资金消费组 "ReqAccountCapitalTopic": "ReqAccountCapital", //账户资金请求topic "OnRspAccountCapitalTopic": "OnRspAccountCapital", //账户资金请求返回topic + "RealtimeCalcAccountBalance": "RealtimeCalcAccountBalance", //实时资金计算topic "AutoOffsetReset": 1, //Latest(0),Earliest(1),Error(2) "EnableCalcBongd": false, //是否启用kafka计算 "ReqClientRiskCheckTopic": "YiLian_ReqClientRiskCheck", //客户风控检查 diff --git a/YLErpWeb/appsettings.uat.json b/YLErpWeb/appsettings.uat.json index 5d3053c4..6b446f14 100644 --- a/YLErpWeb/appsettings.uat.json +++ b/YLErpWeb/appsettings.uat.json @@ -40,6 +40,7 @@ "AccountCapitalTopicGroupId": "YiLian_OnRspAccountCapitalConsumer", //账户资金消费组 "ReqAccountCapitalTopic": "ReqAccountCapital", //账户资金请求topic "OnRspAccountCapitalTopic": "OnRspAccountCapital", //账户资金请求返回topic + "RealtimeCalcAccountBalance": "RealtimeCalcAccountBalance", //实时资金计算topic "AutoOffsetReset": 1, //Latest(0),Earliest(1),Error(2) "EnableCalcBongd": false, //是否启用kafka计算 "ReqClientRiskCheckTopic": "YiLian_ReqClientRiskCheck", //客户风控检查 diff --git a/YLWinSer/RealTimeCalcPositionService/ClientNoDMABalanceTask.cs b/YLWinSer/RealTimeCalcPositionService/ClientNoDMABalanceTask.cs index 950f9ba3..1a47e574 100644 --- a/YLWinSer/RealTimeCalcPositionService/ClientNoDMABalanceTask.cs +++ b/YLWinSer/RealTimeCalcPositionService/ClientNoDMABalanceTask.cs @@ -1,26 +1,11 @@ -using BaseOUDAL; -using DocumentFormat.OpenXml.Drawing.Charts; -using Newtonsoft.Json; -using Org.BouncyCastle.Ocsp; -using StackExchange.Redis; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using System.Xml.Linq; +using Newtonsoft.Json; using YLErp; using YLErp.Abstract; using YLErp.BLL; using YLErp.BLL.Eod; using YLErp.Cache; -using YLErp.DBModels; using YLErp.Helpers; using YLErp.Model; -using YLErp.Modules; -using YLErp.Modules.ClientModule; -using YLErp.Modules.EodModule.QueryModule; namespace RealTimeCalcPositionService { @@ -29,13 +14,13 @@ namespace RealTimeCalcPositionService private readonly IYcLogger _logger; private readonly CancellationTokenSource _cts = new CancellationTokenSource(); private IKafkaProduce kafkaProduceHelper; - private string onRspAccountCapitalTopicTopic = string.Empty; + private string RealtimeCalcAccountBalance = string.Empty; private Dictionary clientDic = new Dictionary(); private IYLCache _yLCache; public ClientNoDMABalanceTask(IKafkaProduce kafkaProduce, IYLCache yLCache) { _logger = LogFactory.GetLogger("ClientNoDMABalanceTask"); - onRspAccountCapitalTopicTopic = Environment.GetEnvironmentVariable("KafkaConfig_OnRspAccountCapitalTopic"); + RealtimeCalcAccountBalance = Environment.GetEnvironmentVariable("KafkaConfig_RealtimeCalcAccountBalance"); kafkaProduceHelper = kafkaProduce; _yLCache = yLCache; } @@ -66,11 +51,10 @@ namespace RealTimeCalcPositionService { var obj = new ClientBalanceForTrsResponse { - TotalAmountTotal = cb.RoundedTotalAmount, + AvailableAmount = Math.Round(cb.AvailableAmount, 2), PositionPv = cb.RoundedPositionPv, PositionPnl = cb.RoundedPositionPnl, - DaliyPnl = Math.Round(cb.DaliyPnl, 2), ClientId = cb.ClientId, ClientType = cb.ClientType, Credit = cb.TotalCredit, @@ -107,7 +91,7 @@ namespace RealTimeCalcPositionService } if (needProduce) { - kafkaProduceHelper.Produce(onRspAccountCapitalTopicTopic, resultStr); + kafkaProduceHelper.Produce(RealtimeCalcAccountBalance, resultStr); } } Thread.Sleep(3000); diff --git a/YLWinSer/RealTimeCalcPositionService/appsettings.json b/YLWinSer/RealTimeCalcPositionService/appsettings.json index 26ed92ee..9439601d 100644 --- a/YLWinSer/RealTimeCalcPositionService/appsettings.json +++ b/YLWinSer/RealTimeCalcPositionService/appsettings.json @@ -36,6 +36,7 @@ "HedgingAccountTopic": "ylHedgingAccountTopic", //对冲账户生产topic "ReqAccountCapitalTopic": "ReqAccountCapital", //账户资金请求topic "OnRspAccountCapitalTopic": "OnRspAccountCapital", //账户资金请求返回topic + "RealtimeCalcAccountBalance": "RealtimeCalcAccountBalance", //实时资金计算topic "AccountCapitalTopicGroupId": "YiLian_OnRspAccountCapitalConsumer", //账户资金消费组 "ReqCalcBondTopic": "ReqCalcBond", //互换成交收益率计算器topic "OnRspCalcBondTopic": "OnRspCalcBond", //互换成交收益率计算器消费topic