From f7d6bef3e95a50c257758e0ddd8a18cb853aa9ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=96=B9=E6=B5=B7?= Date: Wed, 13 Aug 2025 17:27:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YLErpWeb/Controllers/eod_trade_valueController.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/YLErpWeb/Controllers/eod_trade_valueController.cs b/YLErpWeb/Controllers/eod_trade_valueController.cs index c72a3275..89825bb0 100644 --- a/YLErpWeb/Controllers/eod_trade_valueController.cs +++ b/YLErpWeb/Controllers/eod_trade_valueController.cs @@ -678,11 +678,11 @@ namespace YLErp.Web.Controllers } catch (OperationCanceledException) { - Console.WriteLine($"异步日终持仓结算任务 {taskId} 已被取消"); + LogFactory.GetLogger("日终持仓结算").Info($"异步日终持仓结算任务 {taskId} 已被取消"); } catch (Exception ex) { - Console.WriteLine($"异步日终持仓结算任务 {taskId} 执行失败: {ex.Message}"); + LogFactory.GetLogger("日终持仓结算").Error($"异步日终持仓结算任务 {taskId} 执行失败: {ex.Message}", ex); } }); @@ -711,14 +711,14 @@ namespace YLErp.Web.Controllers var processedDates = new List(); var currentDate = startDate; - Console.WriteLine($"开始执行异步日终持仓结算任务 {taskId},从 {startDate:yyyy-MM-dd} 到 {endDate:yyyy-MM-dd}"); + LogFactory.GetLogger("日终持仓结算").Info($"开始执行异步日终持仓结算任务 {taskId},从 {startDate:yyyy-MM-dd} 到 {endDate:yyyy-MM-dd}"); try { while (currentDate <= endDate) { - Console.WriteLine($"任务 {taskId}: 正在处理日期 {currentDate:yyyy-MM-dd}"); + LogFactory.GetLogger("日终持仓结算").Info($"任务 {taskId}: 正在处理日期 {currentDate:yyyy-MM-dd}"); // 创建结算请求对象 @@ -759,11 +759,11 @@ namespace YLErp.Web.Controllers // 每处理一个日期后稍作延迟,避免过度占用系统资源 await Task.Delay(100); } - Console.WriteLine($"异步日终持仓结算任务 {taskId} 执行完成,共处理了 {processedDates.Count} 个交易日"); + LogFactory.GetLogger("日终持仓结算").Info($"异步日终持仓结算任务 {taskId} 执行完成,共处理了 {processedDates.Count} 个交易日"); } catch (Exception ex) { - Console.WriteLine($"异步日终持仓结算任务 {taskId} 在处理日期 {currentDate:yyyy-MM-dd} 时发生错误: {ex.Message}"); + LogFactory.GetLogger("日终持仓结算").Error($"异步日终持仓结算任务 {taskId} 在处理日期 {currentDate:yyyy-MM-dd} 时发生错误: {ex.Message}", ex); throw; } } @@ -781,7 +781,7 @@ namespace YLErp.Web.Controllers public void SetTaskStep(string step) { // 可以在这里记录日志或更新进度 - Console.WriteLine($"任务步骤: {step}"); + LogFactory.GetLogger("日终持仓结算").Info($"任务步骤: {step}"); } ///