refactor(config): 移除冗余的实时资金计算配置项

删除多个环境配置文件中的RealtimeCalcAccountBalance配置
- 更新ClientNoDMABalanceTask类中使用的资金计算topic
- 修改代码逻辑以复用已有的OnRspAccountCapitalTopic
- 清理无用的环境变量读取逻辑
- 统一使用onRspAccountCapitalTopic进行消息生产
This commit is contained in:
hjhan
2025-12-18 14:25:39 +08:00
parent bbd5aabca3
commit f7c706219f
5 changed files with 8 additions and 11 deletions
@@ -1,4 +1,4 @@
using Newtonsoft.Json;
using Newtonsoft.Json;
using YLErp;
using YLErp.Abstract;
using YLErp.BLL;
@@ -14,13 +14,13 @@ namespace RealTimeCalcPositionService
private readonly IYcLogger _logger;
private readonly CancellationTokenSource _cts = new CancellationTokenSource();
private IKafkaProduce kafkaProduceHelper;
private string RealtimeCalcAccountBalance = string.Empty;
private string onRspAccountCapitalTopicTopic = string.Empty;
private Dictionary<int, string> clientDic = new Dictionary<int, string>();
private IYLCache _yLCache;
public ClientNoDMABalanceTask(IKafkaProduce kafkaProduce, IYLCache yLCache)
{
_logger = LogFactory.GetLogger("ClientNoDMABalanceTask");
RealtimeCalcAccountBalance = Environment.GetEnvironmentVariable("KafkaConfig_RealtimeCalcAccountBalance");
onRspAccountCapitalTopicTopic = Environment.GetEnvironmentVariable("KafkaConfig_OnRspAccountCapitalTopic");
kafkaProduceHelper = kafkaProduce;
_yLCache = yLCache;
}
@@ -91,7 +91,8 @@ namespace RealTimeCalcPositionService
}
if (needProduce)
{
kafkaProduceHelper.Produce(RealtimeCalcAccountBalance, resultStr);
// 使用原有的topic而不是新增的RealtimeCalcAccountBalance
kafkaProduceHelper.Produce(onRspAccountCapitalTopicTopic, resultStr);
}
}
Thread.Sleep(3000);
@@ -110,4 +111,4 @@ namespace RealTimeCalcPositionService
await Task.CompletedTask;
}
}
}
}