| @@ -264,42 +264,25 @@ namespace Himp.TaskScheduling | |||||
| , testItems | , testItems | ||||
| , 0); | , 0); | ||||
| Console.WriteLine("\n========== 执行插入样本测试任务操作 ==========\n"); | |||||
| var insertStas = await connection.ExecuteAsync(INSERT_STANDARD_TEST_TASK_SQL, sampleTestTask, transaction); | |||||
| Console.WriteLine($"\n========== 样本测试任务插入结果={insertStas} ==========\n"); | |||||
| } | |||||
| else | |||||
| { | |||||
| Console.WriteLine($"\n========== 样本测试任务已存在,跳过插入: {item.SampleCode} ==========\n"); | |||||
| } | |||||
| // 提交事务 | |||||
| transaction.Commit(); | |||||
| Console.WriteLine($"\n========== 任务处理完成并提交事务: {item.SampleCode} ==========\n"); | |||||
| } | |||||
| catch (Exception ex) | |||||
| { | |||||
| // 回滚事务 | |||||
| transaction.Rollback(); | |||||
| Console.WriteLine($"\n========== 处理任务出错,回滚事务: {item.SampleCode}, 错误: {ex.Message} ==========\n"); | |||||
| _logger.LogError(ex, $"处理任务出错: {item.SampleCode}"); | |||||
| throw; // 重新抛出异常 | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| catch (Exception ex) | |||||
| { | |||||
| _logger.LogError(ex, "数据库操作异常"); | |||||
| Console.WriteLine($"\n========== 数据库操作异常: {ex.Message} ==========\n"); | |||||
| Console.WriteLine("\n========== 执行插入操作 ==========\n"); | |||||
| var insertStas = await connection.ExecuteAsync(INSERT_STANDARD_TEST_TASK_SQL, sampleTestTask); | |||||
| Console.WriteLine("\n========== 执行更新操作 ==========\n"); | |||||
| var updateStas = await connection.ExecuteAsync(UPDATE_STANDARD_TEST_TASK_SQL, new { ID = item.Id }); | |||||
| Console.WriteLine($"\n========== 任务处理完成: 插入结果={insertStas}, 更新结果={updateStas} ==========\n"); | |||||
| } | } | ||||
| } | } | ||||
| catch (Exception ex) | |||||
| { | |||||
| _logger.LogError(ex, "数据库操作异常"); | |||||
| Console.WriteLine($"\n========== 数据库操作异常: {ex.Message} ==========\n"); | |||||
| } | |||||
| } | } | ||||
| catch (Exception e) | |||||
| { | |||||
| _logger.LogError(e, "异常:自动审核标准化验任务"); | |||||
| Console.WriteLine($"\n========== 异常:自动审核标准化验任务: {e.Message} ==========\n"); | |||||
| } | |||||
| } | |||||
| catch (Exception e) | |||||
| { | |||||
| _logger.LogError(e, "异常:自动审核标准化验任务"); | |||||
| Console.WriteLine($"\n========== 异常:自动审核标准化验任务: {e.Message} ==========\n"); | |||||
| } | |||||
| _logger.LogInformation("--------自动审核标准化验任务完成--------"); | _logger.LogInformation("--------自动审核标准化验任务完成--------"); | ||||
| Console.WriteLine("\n========== 自动审核标准化验任务完成 ==========\n"); | Console.WriteLine("\n========== 自动审核标准化验任务完成 ==========\n"); | ||||