日志
This commit is contained in:
@@ -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<DateTime>();
|
||||
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}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user