feat(aihit): AIHITLoadWorker + AIHITSyncWorker

This commit is contained in:
Mikhail Kuznetsov
2024-02-05 14:45:09 +10:00
parent 2ee7ad9dd4
commit 3d71f4cbe9
24 changed files with 826 additions and 19 deletions

View File

@@ -0,0 +1,42 @@
using Microsoft.Data.SqlClient;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.AIHITLoader.Context;
using PARR.AIHITLoader.Models;
namespace PARR.AIHITLoader.Services
{
internal class AIHITService : IAIHITService
{
private readonly AIHITContext context;
private readonly ILogger<AIHITService> logger;
public AIHITService(AIHITContext context, ILogger<AIHITService> logger)
{
this.context = context;
this.logger = logger;
}
public List<EK>? GetEKList(string respArea)
{
var parameters = new List<SqlParameter>() { new SqlParameter("@зо", respArea) };
try
{
var result = context.Set<EK>().FromSqlRaw($"EXEC mao2.dbo.sp_IPP_PARR_PTK_get_EK @зо", parameters.ToArray()).ToList();
if (result == null || !result.Any())
{
logger.LogWarning($"Процедура sp_IPP_PARR_PTK_get_EK вернула пустой список ЭК");
}
return result;
}
catch (Exception ex)
{
logger.LogError(ex, $"Ошибка при выполнении ХП sp_IPP_PARR_PTK_get_EK({respArea})");
}
return null;
}
}
}