feat(kafka): 添加实时资金计算topic配置

- 在多个环境配置文件中新增RealtimeCalcAccountBalance配置项
- 移除ClientBalanceForTrsResponse中的冗余字段
- 更新Kafka任务和控制器中相关字段引用
- 修改Producer发送的目标topic为新的实时计算topic
This commit is contained in:
hjhan
2025-12-17 10:05:57 +08:00
parent a032c09cec
commit d3e576b0e5
9 changed files with 14 additions and 34 deletions
@@ -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<int, string> clientDic = new Dictionary<int, string>();
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);
@@ -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