refactor(aihit): удален старый проект синхронизации aihit. Удалены таблицы из БД.

This commit is contained in:
Mikhail Trubnikov
2024-02-05 16:56:44 +10:00
parent e6e3d57f8f
commit e9cd70e910
34 changed files with 2675 additions and 1574 deletions

View File

@@ -1,15 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.AIHIT.Models;
namespace PARR.AIHIT.Context
{
internal class AIHITContext : DbContext
{
public AIHITContext(DbContextOptions<AIHITContext> options) : base(options) { }
public DbSet<EK> EKs { get; set; }
}
}

View File

@@ -1,7 +0,0 @@
namespace PARR.AIHIT
{
public interface ISyncher
{
Task InvokeFromDatabase();
}
}

View File

@@ -1,48 +0,0 @@
using AutoMapper;
using PARR.AIHIT.MappingProfiles.Resolvers;
using PARR.AIHIT.Models;
using PARR.DAL.Models;
using PARR.DAL.Models.AIHIT;
namespace PARR.AIHIT.MappingProfiles
{
internal class RequestToDomain : Profile
{
public RequestToDomain()
{
//CreateMap<XmlNode, V1_Host>()
// .ForMember(d => d.HostName, o => o.MapFrom(s => (s.Attributes!["ХОСТ"] != null) ? s.Attributes!["ХОСТ"]!.Value.Trim() : ""))
// .ForMember(d => d.IP, o => o.MapFrom(s => s.Attributes!["IP_АДРЕС"]!.Value.Trim()))
// .ForMember(d => d.RegionalEK, o => o.MapFrom(s => s.Attributes!["РЕГИОНАЛЬНЫЙ_ЭК"]!.Value.Trim()))
// .ForMember(d => d.LinkEK, o => o.MapFrom(s => s.Attributes!["СВЯЗАННЫЙ_ЭК"]!.Value.Trim()))
// .ForMember(d => d.Status, o => o.MapFrom(s => s.Attributes!["СТАТУС"]!.Value.Trim()))
// .ForMember(d => d.WorkGroup, o => o.MapFrom(s => (s.Attributes!["РАБОЧАЯ_ГР_ОТВ_ЗАК"] != null) ? s.Attributes!["РАБОЧАЯ_ГР_ОТВ_ЗАК"]!.Value.Trim() : ""))
// .ForMember(d => d.Responsible, o => o.MapFrom(s => s.Attributes!["ОТВЕТСТВЕННЫЙ_ЗАК"]!.Value.Trim()));
CreateMap<RawDataEK, Host>()
.ForMember(d => d.Ek, o => o.MapFrom(s => s.EKFindCode))//TODO Определить имя хоста по
.ForMember(d => d.IP, o => o.MapFrom(s => s.IP))
.ForMember(d => d.EkStatusCode, o => o.MapFrom<EkStatusCodeResolver>())
//.ForMember(d => d.StatusStr, o => o.MapFrom(s => s.Status))
.ForMember(d => d.WorkGroup, o => o.MapFrom(s => s.WorkGroup))
.ForMember(d => d.ResponseAreaCode, o => o.MapFrom<ResponseAreaCodeResolver>())
.ForMember(d => d.ResponseArea, o => o.Ignore());
//.ForMember(d => d.ResponseAreaStr, o => o.MapFrom(s => s.ResponseArea));
//CreateMap<PARR.DAL.Models.Host, PARR.DAL.Models.Host>()
// .ForMember(d => d.HostName, o => o.MapFrom(s => s.HostName))
// .ForMember(d => d.IP, o => o.MapFrom(s => s.IP))
// .ForMember(d => d.RegionalEK, o => o.MapFrom(s => s.RegionalEK))
// .ForMember(d => d.LinkEK, o => o.MapFrom(s => s.LinkEK))
// .ForMember(d => d.Status, o => o.MapFrom(s => s.Status))
// .ForMember(d => d.WorkGroup, o => o.MapFrom(s => s.WorkGroup))
// .ForMember(d => d.Responsible, o => o.MapFrom(s => s.Responsible))
// .ForMember(d => d.OS, o => o.MapFrom(s => s.OS))
// .ForMember(d => d.DB, o => o.MapFrom(s => s.DB))
// .ForMember(d => d.APP, o => o.MapFrom(s => s.APP));
CreateMap<EK, RawDataEK>();
}
}
}

View File

@@ -1,24 +0,0 @@
using AutoMapper;
using PARR.DAL.Contracts;
using PARR.DAL.Models;
using PARR.DAL.Models.AIHIT;
using System.Text.RegularExpressions;
namespace PARR.AIHIT.MappingProfiles.Resolvers
{
internal class EkStatusCodeResolver : IValueResolver<RawDataEK, Host, int>
{
public int Resolve(RawDataEK source, Host destination, int destMember, ResolutionContext context)
{
var pattern = "\\d+";
var regex = new Regex(pattern);
int.TryParse(regex.Match(source.Status!).Value, out int result);
if (!Enum.IsDefined(typeof(EkStatusEnum), result))
throw new Exception($"Неверный статус ЭК {source.Status}");
return result;
}
}
}

View File

@@ -1,27 +0,0 @@
using AutoMapper;
using PARR.DAL.Contracts;
using PARR.DAL.Models;
using PARR.DAL.Models.AIHIT;
using System.Text.RegularExpressions;
namespace PARR.AIHIT.MappingProfiles.Resolvers
{
internal class ResponseAreaCodeResolver : IValueResolver<RawDataEK, Host, int>
{
public int Resolve(RawDataEK source, Host destination, int destMember, ResolutionContext context)
{
var pattern = "\\d+";
var regex = new Regex(pattern);
int.TryParse(regex.Match(source.ResponseArea!).Value, out int result);
if (result == 0)
return (int)ResponseAreaEnum.gvc;
if (!Enum.IsDefined(typeof(ResponseAreaEnum), result))
throw new Exception($"Неверный код дороги {source.ResponseArea}");
return result;
}
}
}

View File

@@ -1,100 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.AIHIT.Models
{
public class EK
{
[Column("IP_АДРЕС")]
public string? IP { get; set; }
[Column("МЕТКА")]
public string? Metka { get; set; }
[Column("АКТИВЕН")]
public string? IsActive { get; set; }
[Column("ВАЖНЫЙ_ЭК")]
public string? IsImportant { get; set; }
[Column("ВРЕМЯ_СОЗДАНИЯ")]
public DateTime? CreateTime { get; set; }
[Column("ДОПОЛНИТЕЛЬНАЯ_ИНФОРМАЦИЯ")]
public string? AdditionalInfo { get; set; }
[Column("ЗОНА_ОТВЕТСТВЕННОСТИ")]
public string? ResponseArea { get; set; }
[Column("КАТЕГОРИЯ_ЭК")]
public string? EKCategory { get; set; }
[Column("КОД_ПОИСКАК")]
public string? EKFindCode { get; set; }
[Column("КОД_ПРОДУКТА")]
public string? ProductCode { get; set; }
[Column("КОД_УСЛУГИ")]
public string? ServiceCode { get; set; }
[Column("КРАТКОЕ_НАИМЕНОВАНИЕ")]
public string? ShortName { get; set; }
[Column("ОТВЕТСТВЕННЫЙ_ЗАК")]
public string? ResponsibleByEK { get; set; }
[Column("ПЛАНОВОЕ_ВРЕМЯ_ВОССТАНОВЛЕНИЯ")]
public DateTime? PlannedTimeToRepair { get; set; }
[Column("ПОДКАТЕГОРИЯ_ЭК")]
public string? EKSubCategory { get; set; }
[Column("ПОЛНОЕ_НАИМЕНОВАНИЕ")]
public string? FullName { get; set; }
[Column("ПРЕДПИСАНИЕ")]
public string? Prescription { get; set; }
[Column("ПРЕДПРИЯТИЕ")]
public string? Company { get; set; }
[Column("РАБОЧАЯ_ГР_ОТВ_ЗАК")]
public string? WorkGroup { get; set; }
[Column("РАСПОЛОЖЕНИЕ")]
public string? Location { get; set; }
[Column("РЕВИЗОРК")]
public string? EKRevizor { get; set; }
[Column("РЕГИСТРАТОРК")]
public string? EKRegister { get; set; }
[Column("СЕТЕВОЕМЯ")]
public string? NetworkName { get; set; }
[Column("СТАТУС")]
public string? Status { get; set; }
[Column("ТИП_ЭК")]
public string? EKType { get; set; }
[Column("ФАКТИЧЕСКОЕ_ЗАВЕРШЕНИЕКСПЛУАТАЦИИ")]
public DateTime? EndExplotationDate { get; set; }
[Column("ФАКТИЧЕСКОЕ_НАЧАЛОКСПЛУАТАЦИИ")]
public DateTime? StartExplotationDate { get; set; }
[Column("ЦЕЛЕВОЕ_ВРЕМЯ_ВОССТАНОВЛЕНИЯ")]
public string? TargetRepairTime { get; set; }
[Column("SYSMODTIME")]
public DateTime? SysModTime { get; set; }
[Column("SYSMODUSER")]
public string? SysModUser { get; set; }
[Column("НОВЫЙ_КОД_ПОИСКА")]
public string? NewEKFindCode { get; set; }
[Column("СТАРЫЙ_КОД_ПОИСКА")]
public string? OldEKFindCode { get; set; }
[Column("НАПРАВЛЕНИЕТСК")]
public string? CTSDirection { get; set; }
[Key]
[Column("ID")]
public int? AIHID { get; set; }
[Column("недостоверныеанные")]
public char? IsUnreliableData { get; set; }
[Column("РГ_смены")]
public string? ShiftWorkGroup { get; set; }
[Column("КлиентскоеО")]
public string? ClientSoftware { get; set; }
[Column("Клиентская_ОС")]
public string? ClientOS { get; set; }
[Column("Тип СУБД")]
public string? DBType { get; set; }
[Column("Тип сервера приложений")]
public string? APPType { get; set; }
[Column("Тип сервера ЦК БС")]
public string? CKBSServerType { get; set; }
[Column("Тип сервера ИБ")]
public string? IBServerType { get; set; }
[Column("Тип сервера инфраструктуры")]
public string? InfrastructureServerType { get; set; }
[Column("Тип сервера мониторинга")]
public string? MonitoringServerType { get; set; }
[Column("ОС")]
public string? OSType { get; set; }
}
}

View File

@@ -1,21 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.9" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\PARR.BLL\PARR.BLL.csproj" />
<ProjectReference Include="..\..\PARR.DAL\PARR.DAL.csproj" />
<ProjectReference Include="..\..\PARR.Mail\PARR.Mail\PARR.Mail.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,12 +0,0 @@
{
"profiles": {
"PARR.AIHIT": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:1090;http://localhost:1092"
}
}
}

View File

@@ -1,42 +0,0 @@
using Microsoft.Data.SqlClient;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.AIHIT.Context;
using PARR.AIHIT.Models;
namespace PARR.AIHIT.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;
}
}
}

View File

@@ -1,9 +0,0 @@
using PARR.AIHIT.Models;
namespace PARR.AIHIT.Services
{
internal interface IAIHITService
{
List<EK>? GetEKList(string respArea);
}
}

View File

@@ -1,10 +0,0 @@
namespace PARR.AIHIT.Settings
{
internal class SyncherSettings
{
public int OccursEvery { get; set; }
public string? IncludeAddresses { get; set; }
public List<string> IncludeAddressesArray => IncludeAddresses == null ? new List<string>() : IncludeAddresses.Split(",").ToList();
}
}

View File

@@ -1,376 +0,0 @@
using AutoMapper;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.AIHIT.Services;
using PARR.DAL.Contracts;
using PARR.DAL.Extensions;
using PARR.DAL.Models;
using PARR.DAL.Models.AIHIT;
using PARR.DAL.Services.Interfaces;
using PARR.DAL.Services.Interfaces.AIHIT;
using System.Text;
namespace PARR.AIHIT
{
internal class Syncher : ISyncher
{
private readonly ILogger<Syncher> logger;
private readonly IHostService hostService;
private readonly IMapper mapper;
private readonly IApplicationService appService;
private readonly IApplicationTypeService appTypeService;
private readonly IApplicationInHostService appInHostService;
private readonly IRawDataEKService rawDataEKService;
private readonly ISettingService settingService;
private readonly IAIHITService aihitService;
public List<ApplicationType> AppTypes { get; private set; } = new List<ApplicationType>();
public Syncher(
ILogger<Syncher> logger,
IHostService hostService,
IMapper mapper,
IApplicationService appService,
IApplicationTypeService appTypeService,
IApplicationInHostService appInHostService,
IRawDataEKService rawDataEKService,
ISettingService settingService,
IAIHITService aihitService
)
{
this.hostService = hostService;
this.mapper = mapper;
this.appService = appService;
this.appTypeService = appTypeService;
this.appInHostService = appInHostService;
this.rawDataEKService = rawDataEKService;
this.settingService = settingService;
this.aihitService = aihitService;
this.logger = logger;
}
private async Task GetAppTypesAsync()
{
AppTypes = await appTypeService.Get().ToListAsync();
}
public async Task InvokeFromDatabase()
{
await GetAppTypesAsync();
//Получаем зоны ответственности из БД
var respAreas = await settingService.Get()
.Where(ra => ra.Group == AIHTITSettings.RespAreaGroupName)
.ToListAsync();
#if !DEBUG
//Запускаем хранимую процедуру в АИХ ИТ и складываем в таблицу RawDataEKs, предварительно почистив старые данные
foreach (var respArea in respAreas)
{
logger.LogDebug($"-= Получение данных об ЭК зоны ответственности {respArea.Name} =-");
var eksFromAIHIT = aihitService.GetEKList(respArea.Value)?.ToList();
if (eksFromAIHIT == null)
continue;
//Удаляем текущие данные по зоне ответственности respArea
logger.LogDebug($"-= Удаление существующих данных об ЭК зоны ответственности {respArea.Name} =-");
var toDelete = rawDataEKService.Get().Where(rd => rd.ResponseArea == respArea.Value).ToList();
toDelete.ForEach(d => rawDataEKService.Delete(d));
if(!await rawDataEKService.CommitAsync())
{
logger.LogError($"Не удалось создать удалить записи в rawDataEK зоны ответственности {respArea.Name}");
continue;
}
logger.LogDebug($"-= Создание новых записей об ЭК зоны ответственности {respArea.Name} =-");
foreach (var ek in eksFromAIHIT)
{
// создаем
var mappedEK = mapper.Map<RawDataEK>(ek);
mappedEK.Id = Guid.NewGuid();
mappedEK.DateCreated = DateTimeOffset.UtcNow;
//if (!await rawDataEKService.CreateAsync(mappedEK) || !await rawDataEKService.CommitAsync())
if (!await rawDataEKService.CreateAsync(mappedEK))
{
logger.LogError($"Не удалось создать запись rawDataEK {mappedEK.ShortName}({mappedEK.IP})");
continue;
}
else
logger.LogInformation($"Создана запись rawDataEK {mappedEK.ShortName}({mappedEK.IP}), зона ответственности {respArea.Name}");
}
logger.LogDebug($"-= Запись в базу данных записей об ЭК зоны ответственности {respArea.Name} ");
if (!await rawDataEKService.CommitAsync())
logger.LogError($"Информация о хостах зоны ответственности {respArea.Name} не записана ");
logger.LogDebug($"-= Конец синхронизации данных об ЭК зоны ответственности {respArea.Name} =-");
}
#endif
//Разбираем сырые данные
//Получаем интересующие статусы ЭК
var statusList = await settingService.Get()
.Where(s => s.Group == AIHTITSettings.StatusGroupName)
.Select(s => s.Value.Trim())
.ToListAsync();
if (statusList == null || statusList.Count == 0)
return;
//Берём только активные ЭК
var eks = await rawDataEKService.Get()
.Where(e => e.IsActive == "t" && (e.Status != null && statusList.Contains(e.Status.Trim())) && e.EKFindCode.StartsWith("ВРТ-"))
.ToListAsync();
foreach (var ek in eks)
{
if (ek.IP == null)
continue;
var host = await hostService.GetHostWithAppsAsync(ek.IP);
var mappedHost = mapper.Map<Host>(ek);
//TODO Валидация по внешним связям
var hostApplications = await GetAndFillApplicationsAsync(ek);
if (host == null)
{
// создаем
if (!await hostService.CreateAsync(mappedHost) || !await hostService.CommitAsync())
{
logger.LogError($"Не удалось создать узел {mappedHost.IP}");
continue;
}
else
logger.LogInformation($"----- Создан Host: {mappedHost.Id} -----");
host = await hostService.GetHostWithAppsAsync(mappedHost.IP);
// Синхронизация Applications
await SyncApplicationAndHostAsync(host, hostApplications);
}
else
{
// обновляем
var isChanged = false;
if (!host.EkStatusCode!.Equals(mappedHost.EkStatusCode))
{
host.EkStatusCode = mappedHost.EkStatusCode;
isChanged = true;
}
else if (mappedHost.WorkGroup != null && (host.WorkGroup == null || !host.WorkGroup!.Equals(mappedHost.WorkGroup)))
{
host.WorkGroup = mappedHost.WorkGroup;
isChanged = true;
}
if (isChanged)
{
host.DateModified = DateTimeOffset.UtcNow;
if (!await hostService.CommitAsync())
logger.LogError($"Не удалось обновить узел {mappedHost.IP}");
else
logger.LogInformation($"Обновлён Host: {mappedHost.Id}");
}
// Синхронизация Applications
await SyncApplicationAndHostAsync(host, hostApplications, true);
}
}
}
/// <summary>
/// Метод синхронизации
/// </summary>
/// <param name="host">Хост</param>
/// <param name="hostApplications">Список программного обеспечения</param>
/// <param name="isUpdateDateModified">Признак обновления поля DateModified</param>
/// <returns></returns>
private async Task SyncApplicationAndHostAsync(Host? host, List<Application> hostApplications, bool isUpdateDateModified = false)
{
var isUpdated = false;
if (host == null)
return;
logger.LogDebug($"Host: {host.Ek}({host.IP}), начало синхронизации приложений ({hostApplications.Count()}) ");
foreach (var changedHostApp in hostApplications)
{
var exist = host.ApplicationsInHosts.FirstOrDefault(a => a.ApplicationId == changedHostApp.Id);
if (exist == null)
{
//add
logger.LogInformation($"Host: {host.Ek}({host.IP}), добавление нового приложения Application {changedHostApp.Name}");
var newAppHost = new ApplicationInHost { Id = Guid.NewGuid(), ApplicationId = changedHostApp.Id, HostId = host.Id };
if (!await appInHostService.CreateAsync(newAppHost))
logger.LogError($"Не удалось создать ApplicationInHost {changedHostApp.Name}, host: {host.Ek}({host.IP})");
isUpdated = true;
}
}
foreach (var app in host.ApplicationsInHosts)
{
var appToRemove = hostApplications.FirstOrDefault(a => a.Id == app.ApplicationId);
if (appToRemove == null)
{
//todo remove appToRemove
var obj = await appInHostService.Get().FirstOrDefaultAsync(t => t.ApplicationId == app.ApplicationId && t.HostId == host.Id);
if (obj != null)
{
logger.LogInformation($"Host: {host.Ek}({host.IP}), удаление неактуального приложения Application {app.Application?.Name}");
appInHostService.Delete(obj);
if (!await hostService.CommitAsync())
logger.LogError($"Не удалось удалить Application {app.Application?.Name} узла {host.Ek}({host.IP})");
isUpdated = true;
}
}
}
if (isUpdated && isUpdateDateModified)
host.DateModified = DateTimeOffset.UtcNow;
if (!await appInHostService.CommitAsync())
logger.LogError($"Не удалось обновить ApplicationInHost для Host: {host.Ek}({host.IP})");
logger.LogDebug($"Host: {host.Ek}({host.IP} конец синхронизации приложений");
}
private async Task<List<Application>> GetAndFillApplicationsAsync(RawDataEK vm)
{
//logger.LogDebug($"Начало парсинга данных о программном обеспечении(СП, БД, ОС) из АИХ ИТ");
var applications = new List<Application>();
if (vm.APPType != null)
{
var appList = vm.APPType.Split(new char[] { ',', ';' }).Distinct().ToList();
foreach (var app in appList)
{
var created = await CreateAppIfNotExistAsync(app, ApplicationTypesEnum.APP);
if (created != null)
applications.Add(created);
}
}
if (vm.DBType != null)
{
var appList = vm.DBType.Split(new char[] { ',', ';' }).Distinct().ToList();
foreach (var app in appList)
{
var created = await CreateAppIfNotExistAsync(app, ApplicationTypesEnum.DB);
if (created != null)
applications.Add(created);
}
}
if (vm.OSType != null)
{
var appList = vm.OSType.Split(new char[] { ',', ';' }).Distinct().ToList();
foreach (var app in appList)
{
var created = await CreateAppIfNotExistAsync(app, ApplicationTypesEnum.OS);
if (created != null)
applications.Add(created);
}
}
//logger.LogDebug($"Конец парсинга данных о программном обеспечении(СП, БД, ОС) из АИХ ИТ");
return applications;
}
private List<string> GetAppFromXML(string? appField)
{
if (string.IsNullOrEmpty(appField))
return new List<string>();
var appList = appField.Split(";").Distinct().ToList();
//appList.ForEach(item => item.Trim());
return appList;
}
private List<string> GetDBFromXML(string? dbField)
{
if (string.IsNullOrEmpty(dbField))
return new List<string>();
var dbList = dbField.Split(";").Distinct().ToList();
return dbList;
}
private List<string> GetOSFromXML(string? osField)
{
if (string.IsNullOrEmpty(osField))
return new List<string>();
var osList = osField.Split(";").Distinct().ToList();
return osList;
}
private async Task<Application?> CreateAppIfNotExistAsync(string appName, ApplicationTypesEnum type)
{
if (string.IsNullOrEmpty(appName) || string.IsNullOrWhiteSpace(appName)) return null;
var existApp = await appService.GetByNameAsync(appName);
if (existApp != null)
return existApp;
//Создаем
var appType = GetAppTypeByName(type);
if (appType == null)
{
logger.LogError($"Не удалось создать запись в таблице Applications: {appName}, так как не получил AppType: {type.ToString()}");
return null;
}
var app = new Application
{
Id = Guid.NewGuid(),
Name = appName.Trim(),
ApplicationTypeId = appType.Id
};
if (!await appService.CreateAsync(app) || !await appService.CommitAsync())
logger.LogError($"Не удалось создать запись в таблице Application: {appName}, {app.ToJson()}");
else
logger.LogInformation($"Создана запись а таблице Application: {appName}, {app.ToJson()}");
return await appService.GetAsync(app.Id);
}
private ApplicationType? GetAppTypeByName(ApplicationTypesEnum type)
{
var existType = AppTypes.FirstOrDefault(t => t.Name == type.ToString());
if (existType == null)
logger.LogError($"Не найден AppType: {type}");
return existType;
}
private static string EncodeString(string str)
{
byte[] bStr = Encoding.GetEncoding("koi8r").GetBytes(str);
Encoding encoding = Encoding.GetEncoding("koi8r");
str = encoding.GetString(bStr, 0, bStr.Length);
return str;
}
}
}

View File

@@ -1,45 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using PARR.AIHIT.Context;
using PARR.AIHIT.Services;
using PARR.AIHIT.Settings;
using PARR.BLL;
using PARR.DAL;
using PARR.Mail;
namespace PARR.AIHIT
{
public static class SyncherInstaller
{
public static void InstallSyncerServices(this IServiceCollection services, IConfiguration configuration)
{
var syncherSettings = new SyncherSettings();
configuration.GetSection(nameof(SyncherSettings)).Bind(syncherSettings);
services.AddSingleton(syncherSettings);
services.InstallMailServices(configuration);
services.InstallDalServices(configuration);
services.InstallBllServices(configuration);
services.AddDbContext<AIHITContext>(options =>
options.UseSqlServer(
configuration.GetConnectionString("AihitConnection")
, sqlServerOptions => sqlServerOptions.CommandTimeout(1800)
));
services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
services.AddTransient<ISyncher, Syncher>();
services.AddTransient<IAIHITService, AIHITService>();
//services.AddDbContext <AIHITContext> (options =>
//{
// options.UseSqlServer("server=(10.248.19.97);uid=awhit-ipp-parr;pwd=ET3h$9y1LH#D");
//});
}
}
}

View File

@@ -9,10 +9,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.DAL", "PARR.DAL\PARR.D
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.Mail", "PARR.Mail\PARR.Mail\PARR.Mail.csproj", "{228C8124-69E4-4AE0-8C33-0438E54FF1BA}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.Mail", "PARR.Mail\PARR.Mail\PARR.Mail.csproj", "{228C8124-69E4-4AE0-8C33-0438E54FF1BA}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.AIHITWorker", "PARR.Worker\PARR.Worker\PARR.AIHITWorker.csproj", "{D15F308C-9F63-4D69-B06E-DDA26FEE9BAB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.AIHIT", "PARR.AIHIT\AIHIT\PARR.AIHIT.csproj", "{3ED4E1CE-2AF5-4EB3-B7DF-B77CCC242B9E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C170A32C-5A9D-4F1C-B6FF-FAE12736ED17}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C170A32C-5A9D-4F1C-B6FF-FAE12736ED17}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore .gitignore = .gitignore
@@ -60,16 +56,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.EsppScheduleSync", "PA
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.EsppScheduleSyncWorker", "PARR.EsppScheduleSyncWorker\PARR.EsppScheduleSyncWorker.csproj", "{C597A1D7-1BC5-493B-BC29-03EC830FB090}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.EsppScheduleSyncWorker", "PARR.EsppScheduleSyncWorker\PARR.EsppScheduleSyncWorker.csproj", "{C597A1D7-1BC5-493B-BC29-03EC830FB090}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.AIHITLoader", "PARR.AIHITLoader\PARR.AIHITLoader.csproj", "{E7F3C8FB-445B-4711-8F89-0B7DA7DB4537}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.AIHITLoader", "PARR.AIHITLoader\PARR.AIHITLoader.csproj", "{E7F3C8FB-445B-4711-8F89-0B7DA7DB4537}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.AIHITLoaderWorker", "PARR.AIHITLoaderWorker\PARR.AIHITLoaderWorker.csproj", "{E9434123-E697-42E2-B7C0-FE08766B98D1}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.AIHITLoaderWorker", "PARR.AIHITLoaderWorker\PARR.AIHITLoaderWorker.csproj", "{E9434123-E697-42E2-B7C0-FE08766B98D1}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.AIHITSyncer", "PARR.AIHITSyncer\PARR.AIHITSyncer.csproj", "{4177B13B-585C-44C7-B3C1-6B6E46D6BABC}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.AIHITSyncer", "PARR.AIHITSyncer\PARR.AIHITSyncer.csproj", "{4177B13B-585C-44C7-B3C1-6B6E46D6BABC}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.AIHITSyncerWorker", "PARR.AIHITSyncerWorker\PARR.AIHITSyncerWorker.csproj", "{4FA79176-F833-4879-8437-37EA053BAA94}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.AIHITSyncerWorker", "PARR.AIHITSyncerWorker\PARR.AIHITSyncerWorker.csproj", "{4FA79176-F833-4879-8437-37EA053BAA94}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.NextRun", "PARR.NextRun\PARR.NextRun.csproj", "{92400205-B781-4C6C-BDA3-6D3652C2B62F}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.NextRunWorker", "PARR.NextRunWorker\PARR.NextRunWorker.csproj", "{47C6E193-257A-4001-84D7-11B640E3D1A0}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.NextRun", "PARR.NextRun\PARR.NextRun.csproj", "{92400205-B781-4C6C-BDA3-6D3652C2B62F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.NextRunWorker", "PARR.NextRunWorker\PARR.NextRunWorker.csproj", "{47C6E193-257A-4001-84D7-11B640E3D1A0}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -89,14 +86,6 @@ Global
{228C8124-69E4-4AE0-8C33-0438E54FF1BA}.Debug|Any CPU.Build.0 = Debug|Any CPU {228C8124-69E4-4AE0-8C33-0438E54FF1BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{228C8124-69E4-4AE0-8C33-0438E54FF1BA}.Release|Any CPU.ActiveCfg = Release|Any CPU {228C8124-69E4-4AE0-8C33-0438E54FF1BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{228C8124-69E4-4AE0-8C33-0438E54FF1BA}.Release|Any CPU.Build.0 = Release|Any CPU {228C8124-69E4-4AE0-8C33-0438E54FF1BA}.Release|Any CPU.Build.0 = Release|Any CPU
{D15F308C-9F63-4D69-B06E-DDA26FEE9BAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D15F308C-9F63-4D69-B06E-DDA26FEE9BAB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D15F308C-9F63-4D69-B06E-DDA26FEE9BAB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D15F308C-9F63-4D69-B06E-DDA26FEE9BAB}.Release|Any CPU.Build.0 = Release|Any CPU
{3ED4E1CE-2AF5-4EB3-B7DF-B77CCC242B9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3ED4E1CE-2AF5-4EB3-B7DF-B77CCC242B9E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3ED4E1CE-2AF5-4EB3-B7DF-B77CCC242B9E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3ED4E1CE-2AF5-4EB3-B7DF-B77CCC242B9E}.Release|Any CPU.Build.0 = Release|Any CPU
{AB278172-BFB4-4D54-9022-2D2A5B3338D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AB278172-BFB4-4D54-9022-2D2A5B3338D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AB278172-BFB4-4D54-9022-2D2A5B3338D7}.Release|Any CPU.ActiveCfg = Release|Any CPU {AB278172-BFB4-4D54-9022-2D2A5B3338D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7BAB9170-743D-4542-8881-9B161EE81BB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7BAB9170-743D-4542-8881-9B161EE81BB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -171,7 +160,6 @@ Global
{C597A1D7-1BC5-493B-BC29-03EC830FB090}.Debug|Any CPU.Build.0 = Debug|Any CPU {C597A1D7-1BC5-493B-BC29-03EC830FB090}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C597A1D7-1BC5-493B-BC29-03EC830FB090}.Release|Any CPU.ActiveCfg = Release|Any CPU {C597A1D7-1BC5-493B-BC29-03EC830FB090}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C597A1D7-1BC5-493B-BC29-03EC830FB090}.Release|Any CPU.Build.0 = Release|Any CPU {C597A1D7-1BC5-493B-BC29-03EC830FB090}.Release|Any CPU.Build.0 = Release|Any CPU
<<<<<<< HEAD
{E7F3C8FB-445B-4711-8F89-0B7DA7DB4537}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E7F3C8FB-445B-4711-8F89-0B7DA7DB4537}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E7F3C8FB-445B-4711-8F89-0B7DA7DB4537}.Debug|Any CPU.Build.0 = Debug|Any CPU {E7F3C8FB-445B-4711-8F89-0B7DA7DB4537}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7F3C8FB-445B-4711-8F89-0B7DA7DB4537}.Release|Any CPU.ActiveCfg = Release|Any CPU {E7F3C8FB-445B-4711-8F89-0B7DA7DB4537}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -188,7 +176,6 @@ Global
{4FA79176-F833-4879-8437-37EA053BAA94}.Debug|Any CPU.Build.0 = Debug|Any CPU {4FA79176-F833-4879-8437-37EA053BAA94}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4FA79176-F833-4879-8437-37EA053BAA94}.Release|Any CPU.ActiveCfg = Release|Any CPU {4FA79176-F833-4879-8437-37EA053BAA94}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4FA79176-F833-4879-8437-37EA053BAA94}.Release|Any CPU.Build.0 = Release|Any CPU {4FA79176-F833-4879-8437-37EA053BAA94}.Release|Any CPU.Build.0 = Release|Any CPU
=======
{92400205-B781-4C6C-BDA3-6D3652C2B62F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {92400205-B781-4C6C-BDA3-6D3652C2B62F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{92400205-B781-4C6C-BDA3-6D3652C2B62F}.Debug|Any CPU.Build.0 = Debug|Any CPU {92400205-B781-4C6C-BDA3-6D3652C2B62F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{92400205-B781-4C6C-BDA3-6D3652C2B62F}.Release|Any CPU.ActiveCfg = Release|Any CPU {92400205-B781-4C6C-BDA3-6D3652C2B62F}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -197,7 +184,6 @@ Global
{47C6E193-257A-4001-84D7-11B640E3D1A0}.Debug|Any CPU.Build.0 = Debug|Any CPU {47C6E193-257A-4001-84D7-11B640E3D1A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47C6E193-257A-4001-84D7-11B640E3D1A0}.Release|Any CPU.ActiveCfg = Release|Any CPU {47C6E193-257A-4001-84D7-11B640E3D1A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47C6E193-257A-4001-84D7-11B640E3D1A0}.Release|Any CPU.Build.0 = Release|Any CPU {47C6E193-257A-4001-84D7-11B640E3D1A0}.Release|Any CPU.Build.0 = Release|Any CPU
>>>>>>> next-run
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@@ -2,7 +2,6 @@
using PARR.Constants; using PARR.Constants;
using PARR.DAL.Contracts; using PARR.DAL.Contracts;
using PARR.DAL.Models; using PARR.DAL.Models;
using PARR.DAL.Models.AIHIT;
namespace PARR.DAL.Context namespace PARR.DAL.Context
{ {
@@ -17,8 +16,6 @@ namespace PARR.DAL.Context
public DbSet<ApplicationType> ApplicationTypes { get; set; } public DbSet<ApplicationType> ApplicationTypes { get; set; }
public DbSet<ApplicationInHost> ApplicationsInHosts { get; set; } public DbSet<ApplicationInHost> ApplicationsInHosts { get; set; }
public DbSet<Models.AIHIT.Setting> Settings { get; set; }
public DbSet<RawDataEK> RawDataEKs { get; set; }
public DbSet<Template> Templates { get; set; } public DbSet<Template> Templates { get; set; }
public DbSet<Models.TaskStatus> TaskStatuses { get; set; } public DbSet<Models.TaskStatus> TaskStatuses { get; set; }
public DbSet<RobotStatus> RobotStatuses { get; set; } public DbSet<RobotStatus> RobotStatuses { get; set; }
@@ -72,33 +69,6 @@ namespace PARR.DAL.Context
}); });
#endregion #endregion
#region AIHIT_Setting
modelBuilder.Entity<Models.AIHIT.Setting>(f =>
{
f.HasData(
//new() { Id = new Guid("1AD12210-BE62-459A-AA6C-FDA7648503F7"), DateCreated = dateCreated, DateModified = null, Group = null, Name = "ConnectionString", Value = @"Data Source=10.248.19.97; Initial Catalog=mao2;User ID=awhit-ipp-parr;pwd=ET3h$9y1LH#D;TrustServerCertificate=true;", Description = "Строка подключения к базе данных АИХ ИТ" },
new() { Id = new Guid("B16AFD06-605B-499F-9E35-A19586DE96B0"), DateCreated = dateCreated, DateModified = null, Group = AIHTITSettings.RespAreaGroupName, Name = "ГВЦ", Value = "00-ГВЦ", Description = "Зона ответственности" },
new() { Id = new Guid("42A2EC03-DA3A-45FC-971E-399910FDC5AE"), DateCreated = dateCreated, DateModified = null, Group = AIHTITSettings.RespAreaGroupName, Name = "ОКТ", Value = "01-ОКТ", Description = "Зона ответственности" },
new() { Id = new Guid("17EFAF65-AE8C-45F1-B187-E6CB1BD6385B"), DateCreated = dateCreated, DateModified = null, Group = AIHTITSettings.RespAreaGroupName, Name = "КЛГ", Value = "10-КЛГ", Description = "Зона ответственности" },
new() { Id = new Guid("51270997-20F6-4A61-85AC-64F6B6DD5DC4"), DateCreated = dateCreated, DateModified = null, Group = AIHTITSettings.RespAreaGroupName, Name = "МСК", Value = "17-МСК", Description = "Зона ответственности" },
new() { Id = new Guid("B94F8C38-E78A-494E-81BA-39E4E902FFCC"), DateCreated = dateCreated, DateModified = null, Group = AIHTITSettings.RespAreaGroupName, Name = "ГОР", Value = "24-ГОР", Description = "Зона ответственности" },
new() { Id = new Guid("52BA20EA-4E7A-4500-939B-E2CFF563809A"), DateCreated = dateCreated, DateModified = null, Group = AIHTITSettings.RespAreaGroupName, Name = "СЕВ", Value = "28-СЕВ", Description = "Зона ответственности" },
new() { Id = new Guid("CB9DA805-29E9-4E08-B1ED-D4B374920F77"), DateCreated = dateCreated, DateModified = null, Group = AIHTITSettings.RespAreaGroupName, Name = "СКВ", Value = "51-СКВ", Description = "Зона ответственности" },
new() { Id = new Guid("1943A65C-2060-4B5F-AF1F-ACEC74835481"), DateCreated = dateCreated, DateModified = null, Group = AIHTITSettings.RespAreaGroupName, Name = "ЮВСТ", Value = "58-ЮВСТ", Description = "Зона ответственности" },
new() { Id = new Guid("4D9EF2EE-D4FA-4D28-A93B-6F1FD0A639F9"), DateCreated = dateCreated, DateModified = null, Group = AIHTITSettings.RespAreaGroupName, Name = "ПРИВ", Value = "61-ПРИВ", Description = "Зона ответственности" },
new() { Id = new Guid("F1A54C25-A93A-4FE3-8268-AFBCC435B6E9"), DateCreated = dateCreated, DateModified = null, Group = AIHTITSettings.RespAreaGroupName, Name = "КБШ", Value = "63-КБШ", Description = "Зона ответственности" },
new() { Id = new Guid("CC839C48-62BB-46A8-924C-85B5E7A3E245"), DateCreated = dateCreated, DateModified = null, Group = AIHTITSettings.RespAreaGroupName, Name = "СВРД", Value = "76-СВРД", Description = "Зона ответственности" },
new() { Id = new Guid("C98FB684-FF03-441E-A9C3-AC5071D69857"), DateCreated = dateCreated, DateModified = null, Group = AIHTITSettings.RespAreaGroupName, Name = "ЮУР", Value = "80-ЮУР", Description = "Зона ответственности" },
new() { Id = new Guid("F2684A90-6029-4476-BD3D-E713A8A228D6"), DateCreated = dateCreated, DateModified = null, Group = AIHTITSettings.RespAreaGroupName, Name = "ЗСИБ", Value = "83-ЗСИБ", Description = "Зона ответственности" },
new() { Id = new Guid("B3C73162-21EA-42F0-B0E1-3C5076176F8A"), DateCreated = dateCreated, DateModified = null, Group = AIHTITSettings.RespAreaGroupName, Name = "КРАСН", Value = "88-КРАСН", Description = "Зона ответственности" },
new() { Id = new Guid("a8cff6fd-28b7-49f2-a412-9208c10f6516"), DateCreated = dateCreated, DateModified = null, Group = AIHTITSettings.RespAreaGroupName, Name = "ВСИБ", Value = "92-ВСИБ", Description = "Зона ответственности" },
new() { Id = new Guid("50F66704-4D26-4587-BB1E-DCA70C8F4B89"), DateCreated = dateCreated, DateModified = null, Group = AIHTITSettings.RespAreaGroupName, Name = "ЗАБ", Value = "94-ЗАБ", Description = "Зона ответственности" },
new() { Id = new Guid("1FD43634-4A06-4237-9727-EDFA6F3EEBE8"), DateCreated = dateCreated, DateModified = null, Group = AIHTITSettings.RespAreaGroupName, Name = "ДВС", Value = "96-ДВС", Description = "Зона ответственности" },
new() { Id = new Guid("77C73C0A-8E4D-4676-B6E2-6A112F20E346"), DateCreated = dateCreated, DateModified = null, Group = AIHTITSettings.StatusGroupName, Name = "Exploitation", Value = "3-В эксплуатации", Description = "Статус актуальных ЭК" }
);
});
#endregion
#region TaskStatus #region TaskStatus
modelBuilder.Entity<Models.TaskStatus>(f => modelBuilder.Entity<Models.TaskStatus>(f =>
{ {

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,135 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class removeTblAihit : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "RawDataEKs",
schema: "AIHIT");
migrationBuilder.DropTable(
name: "Settings",
schema: "AIHIT");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.EnsureSchema(
name: "AIHIT");
migrationBuilder.CreateTable(
name: "RawDataEKs",
schema: "AIHIT",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
AIHID = table.Column<int>(type: "integer", nullable: true),
APPType = table.Column<string>(type: "text", nullable: true),
AdditionalInfo = table.Column<string>(type: "text", nullable: true),
CKBSServerType = table.Column<string>(type: "text", nullable: true),
CTSDirection = table.Column<string>(type: "text", nullable: true),
ClientOS = table.Column<string>(type: "text", nullable: true),
ClientSoftware = table.Column<string>(type: "text", nullable: true),
Company = table.Column<string>(type: "text", nullable: true),
CreateTime = table.Column<string>(type: "text", nullable: true),
DBType = table.Column<string>(type: "text", nullable: true),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
EKCategory = table.Column<string>(type: "text", nullable: true),
EKFindCode = table.Column<string>(type: "text", nullable: true),
EKRegister = table.Column<string>(type: "text", nullable: true),
EKRevizor = table.Column<string>(type: "text", nullable: true),
EKSubCategory = table.Column<string>(type: "text", nullable: true),
EKType = table.Column<string>(type: "text", nullable: true),
EndExplotationDate = table.Column<string>(type: "text", nullable: true),
FullName = table.Column<string>(type: "text", nullable: true),
IBServerType = table.Column<string>(type: "text", nullable: true),
IP = table.Column<string>(type: "text", nullable: true),
InfrastructureServerType = table.Column<string>(type: "text", nullable: true),
IsActive = table.Column<string>(type: "text", nullable: true),
IsImportant = table.Column<string>(type: "text", nullable: true),
IsUnreliableData = table.Column<char>(type: "character(1)", nullable: true),
Location = table.Column<string>(type: "text", nullable: true),
Metka = table.Column<string>(type: "text", nullable: true),
MonitoringServerType = table.Column<string>(type: "text", nullable: true),
NetworkName = table.Column<string>(type: "text", nullable: true),
NewEKFindCode = table.Column<string>(type: "text", nullable: true),
OSType = table.Column<string>(type: "text", nullable: true),
OldEKFindCode = table.Column<string>(type: "text", nullable: true),
PlannedTimeToRepair = table.Column<string>(type: "text", nullable: true),
Prescription = table.Column<string>(type: "text", nullable: true),
ProductCode = table.Column<string>(type: "text", nullable: true),
ResponseArea = table.Column<string>(type: "text", nullable: true),
ResponsibleByEK = table.Column<string>(type: "text", nullable: true),
ServiceCode = table.Column<string>(type: "text", nullable: true),
ShiftWorkGroup = table.Column<string>(type: "text", nullable: true),
ShortName = table.Column<string>(type: "text", nullable: true),
StartExplotationDate = table.Column<string>(type: "text", nullable: true),
Status = table.Column<string>(type: "text", nullable: true),
SysModTime = table.Column<string>(type: "text", nullable: true),
SysModUser = table.Column<string>(type: "text", nullable: true),
TargetRepairTime = table.Column<string>(type: "text", nullable: true),
WorkGroup = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_RawDataEKs", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Settings",
schema: "AIHIT",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Description = table.Column<string>(type: "text", nullable: true),
Group = table.Column<string>(type: "text", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
Value = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Settings", x => x.Id);
});
migrationBuilder.InsertData(
schema: "AIHIT",
table: "Settings",
columns: new[] { "Id", "DateCreated", "DateModified", "Description", "Group", "Name", "Value" },
values: new object[,]
{
{ new Guid("17efaf65-ae8c-45f1-b187-e6cb1bd6385b"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Зона ответственности", "ResponsibleArea", "КЛГ", "10-КЛГ" },
{ new Guid("1943a65c-2060-4b5f-af1f-acec74835481"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Зона ответственности", "ResponsibleArea", "ЮВСТ", "58-ЮВСТ" },
{ new Guid("1fd43634-4a06-4237-9727-edfa6f3eebe8"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Зона ответственности", "ResponsibleArea", "ДВС", "96-ДВС" },
{ new Guid("42a2ec03-da3a-45fc-971e-399910fdc5ae"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Зона ответственности", "ResponsibleArea", "ОКТ", "01-ОКТ" },
{ new Guid("4d9ef2ee-d4fa-4d28-a93b-6f1fd0a639f9"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Зона ответственности", "ResponsibleArea", "ПРИВ", "61-ПРИВ" },
{ new Guid("50f66704-4d26-4587-bb1e-dca70c8f4b89"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Зона ответственности", "ResponsibleArea", "ЗАБ", "94-ЗАБ" },
{ new Guid("51270997-20f6-4a61-85ac-64f6b6dd5dc4"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Зона ответственности", "ResponsibleArea", "МСК", "17-МСК" },
{ new Guid("52ba20ea-4e7a-4500-939b-e2cff563809a"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Зона ответственности", "ResponsibleArea", "СЕВ", "28-СЕВ" },
{ new Guid("77c73c0a-8e4d-4676-b6e2-6a112f20e346"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Статус актуальных ЭК", "Status", "Exploitation", "3-В эксплуатации" },
{ new Guid("a8cff6fd-28b7-49f2-a412-9208c10f6516"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Зона ответственности", "ResponsibleArea", "ВСИБ", "92-ВСИБ" },
{ new Guid("b16afd06-605b-499f-9e35-a19586de96b0"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Зона ответственности", "ResponsibleArea", "ГВЦ", "00-ГВЦ" },
{ new Guid("b3c73162-21ea-42f0-b0e1-3c5076176f8a"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Зона ответственности", "ResponsibleArea", "КРАСН", "88-КРАСН" },
{ new Guid("b94f8c38-e78a-494e-81ba-39e4e902ffcc"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Зона ответственности", "ResponsibleArea", "ГОР", "24-ГОР" },
{ new Guid("c98fb684-ff03-441e-a9c3-ac5071d69857"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Зона ответственности", "ResponsibleArea", "ЮУР", "80-ЮУР" },
{ new Guid("cb9da805-29e9-4e08-b1ed-d4b374920f77"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Зона ответственности", "ResponsibleArea", "СКВ", "51-СКВ" },
{ new Guid("cc839c48-62bb-46a8-924c-85b5e7a3e245"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Зона ответственности", "ResponsibleArea", "СВРД", "76-СВРД" },
{ new Guid("f1a54c25-a93a-4fe3-8268-afbcc435b6e9"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Зона ответственности", "ResponsibleArea", "КБШ", "63-КБШ" },
{ new Guid("f2684a90-6029-4476-bd3d-e713a8a228d6"), new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), null, "Зона ответственности", "ResponsibleArea", "ЗСИБ", "83-ЗСИБ" }
});
}
}
}

View File

@@ -22,353 +22,6 @@ namespace PARR.DAL.Migrations
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("PARR.DAL.Models.AIHIT.RawDataEK", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int?>("AIHID")
.HasColumnType("integer");
b.Property<string>("APPType")
.HasColumnType("text");
b.Property<string>("AdditionalInfo")
.HasColumnType("text");
b.Property<string>("CKBSServerType")
.HasColumnType("text");
b.Property<string>("CTSDirection")
.HasColumnType("text");
b.Property<string>("ClientOS")
.HasColumnType("text");
b.Property<string>("ClientSoftware")
.HasColumnType("text");
b.Property<string>("Company")
.HasColumnType("text");
b.Property<string>("CreateTime")
.HasColumnType("text");
b.Property<string>("DBType")
.HasColumnType("text");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("EKCategory")
.HasColumnType("text");
b.Property<string>("EKFindCode")
.HasColumnType("text");
b.Property<string>("EKRegister")
.HasColumnType("text");
b.Property<string>("EKRevizor")
.HasColumnType("text");
b.Property<string>("EKSubCategory")
.HasColumnType("text");
b.Property<string>("EKType")
.HasColumnType("text");
b.Property<string>("EndExplotationDate")
.HasColumnType("text");
b.Property<string>("FullName")
.HasColumnType("text");
b.Property<string>("IBServerType")
.HasColumnType("text");
b.Property<string>("IP")
.HasColumnType("text");
b.Property<string>("InfrastructureServerType")
.HasColumnType("text");
b.Property<string>("IsActive")
.HasColumnType("text");
b.Property<string>("IsImportant")
.HasColumnType("text");
b.Property<char?>("IsUnreliableData")
.HasColumnType("character(1)");
b.Property<string>("Location")
.HasColumnType("text");
b.Property<string>("Metka")
.HasColumnType("text");
b.Property<string>("MonitoringServerType")
.HasColumnType("text");
b.Property<string>("NetworkName")
.HasColumnType("text");
b.Property<string>("NewEKFindCode")
.HasColumnType("text");
b.Property<string>("OSType")
.HasColumnType("text");
b.Property<string>("OldEKFindCode")
.HasColumnType("text");
b.Property<string>("PlannedTimeToRepair")
.HasColumnType("text");
b.Property<string>("Prescription")
.HasColumnType("text");
b.Property<string>("ProductCode")
.HasColumnType("text");
b.Property<string>("ResponseArea")
.HasColumnType("text");
b.Property<string>("ResponsibleByEK")
.HasColumnType("text");
b.Property<string>("ServiceCode")
.HasColumnType("text");
b.Property<string>("ShiftWorkGroup")
.HasColumnType("text");
b.Property<string>("ShortName")
.HasColumnType("text");
b.Property<string>("StartExplotationDate")
.HasColumnType("text");
b.Property<string>("Status")
.HasColumnType("text");
b.Property<string>("SysModTime")
.HasColumnType("text");
b.Property<string>("SysModUser")
.HasColumnType("text");
b.Property<string>("TargetRepairTime")
.HasColumnType("text");
b.Property<string>("WorkGroup")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("RawDataEKs", "AIHIT");
});
modelBuilder.Entity("PARR.DAL.Models.AIHIT.Setting", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("Group")
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Settings", "AIHIT");
b.HasData(
new
{
Id = new Guid("b16afd06-605b-499f-9e35-a19586de96b0"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "ГВЦ",
Value = "00-ГВЦ"
},
new
{
Id = new Guid("42a2ec03-da3a-45fc-971e-399910fdc5ae"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "ОКТ",
Value = "01-ОКТ"
},
new
{
Id = new Guid("17efaf65-ae8c-45f1-b187-e6cb1bd6385b"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "КЛГ",
Value = "10-КЛГ"
},
new
{
Id = new Guid("51270997-20f6-4a61-85ac-64f6b6dd5dc4"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "МСК",
Value = "17-МСК"
},
new
{
Id = new Guid("b94f8c38-e78a-494e-81ba-39e4e902ffcc"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "ГОР",
Value = "24-ГОР"
},
new
{
Id = new Guid("52ba20ea-4e7a-4500-939b-e2cff563809a"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "СЕВ",
Value = "28-СЕВ"
},
new
{
Id = new Guid("cb9da805-29e9-4e08-b1ed-d4b374920f77"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "СКВ",
Value = "51-СКВ"
},
new
{
Id = new Guid("1943a65c-2060-4b5f-af1f-acec74835481"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "ЮВСТ",
Value = "58-ЮВСТ"
},
new
{
Id = new Guid("4d9ef2ee-d4fa-4d28-a93b-6f1fd0a639f9"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "ПРИВ",
Value = "61-ПРИВ"
},
new
{
Id = new Guid("f1a54c25-a93a-4fe3-8268-afbcc435b6e9"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "КБШ",
Value = "63-КБШ"
},
new
{
Id = new Guid("cc839c48-62bb-46a8-924c-85b5e7a3e245"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "СВРД",
Value = "76-СВРД"
},
new
{
Id = new Guid("c98fb684-ff03-441e-a9c3-ac5071d69857"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "ЮУР",
Value = "80-ЮУР"
},
new
{
Id = new Guid("f2684a90-6029-4476-bd3d-e713a8a228d6"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "ЗСИБ",
Value = "83-ЗСИБ"
},
new
{
Id = new Guid("b3c73162-21ea-42f0-b0e1-3c5076176f8a"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "КРАСН",
Value = "88-КРАСН"
},
new
{
Id = new Guid("a8cff6fd-28b7-49f2-a412-9208c10f6516"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "ВСИБ",
Value = "92-ВСИБ"
},
new
{
Id = new Guid("50f66704-4d26-4587-bb1e-dca70c8f4b89"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "ЗАБ",
Value = "94-ЗАБ"
},
new
{
Id = new Guid("1fd43634-4a06-4237-9727-edfa6f3eebe8"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зона ответственности",
Group = "ResponsibleArea",
Name = "ДВС",
Value = "96-ДВС"
},
new
{
Id = new Guid("77c73c0a-8e4d-4676-b6e2-6a112f20e346"),
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Статус актуальных ЭК",
Group = "Status",
Name = "Exploitation",
Value = "3-В эксплуатации"
});
});
modelBuilder.Entity("PARR.DAL.Models.AgentHistory", b => modelBuilder.Entity("PARR.DAL.Models.AgentHistory", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")

View File

@@ -1,60 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.AIHIT
{
[Table("RawDataEKs", Schema = "AIHIT")]
public class RawDataEK:IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public string? IP { get; set; }
public string? Metka { get; set; }
public string? IsActive { get; set; }
public string? IsImportant { get; set; }
public string? CreateTime { get; set; }
public string? AdditionalInfo { get; set; }
public string? ResponseArea { get; set; }
public string? EKCategory { get; set; }
public string? EKFindCode { get; set; }
public string? ProductCode { get; set; }
public string? ServiceCode { get; set; }
public string? ShortName { get; set; }
public string? ResponsibleByEK { get; set; }
public string? PlannedTimeToRepair { get; set; }
public string? EKSubCategory { get; set; }
public string? FullName { get; set; }
public string? Prescription { get; set; }
public string? Company { get; set; }
public string? WorkGroup { get; set; }
public string? Location { get; set; }
public string? EKRevizor { get; set; }
public string? EKRegister { get; set; }
public string? NetworkName { get; set; }
public string? Status { get; set; }
public string? EKType { get; set; }
public string? EndExplotationDate { get; set; }
public string? StartExplotationDate { get; set; }
public string? TargetRepairTime { get; set; }
public string? SysModTime { get; set; }
public string? SysModUser { get; set; }
public string? NewEKFindCode { get; set; }
public string? OldEKFindCode { get; set; }
public string? CTSDirection { get; set; }
public int? AIHID { get; set; }
public char? IsUnreliableData { get; set; }
public string? ShiftWorkGroup { get; set; }
public string? ClientSoftware { get; set; }
public string? ClientOS { get; set; }
public string? DBType { get; set; }
public string? APPType { get; set; }
public string? CKBSServerType { get; set; }
public string? IBServerType { get; set; }
public string? InfrastructureServerType { get; set; }
public string? MonitoringServerType { get; set; }
public string? OSType { get; set; }
}
}

View File

@@ -1,21 +0,0 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.AIHIT
{
[Table("Settings", Schema = "AIHIT")]
public class Setting : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public string? Group { get; set; }
public required string Name { get; set; }
public required string Value { get; set; }
public string? Description { get; set; }
}
}

View File

@@ -7,9 +7,7 @@ using PARR.DAL.Context;
using PARR.DAL.Contracts; using PARR.DAL.Contracts;
using PARR.DAL.Services.Implementation; using PARR.DAL.Services.Implementation;
using PARR.DAL.Services.Implementations; using PARR.DAL.Services.Implementations;
using PARR.DAL.Services.Implementations.AIHIT;
using PARR.DAL.Services.Interfaces; using PARR.DAL.Services.Interfaces;
using PARR.DAL.Services.Interfaces.AIHIT;
using PARR.DAL.Settings; using PARR.DAL.Settings;
using PARR.DAL.TransformServices; using PARR.DAL.TransformServices;
@@ -49,8 +47,6 @@ namespace PARR.DAL
services.AddTransient<IProcessService, ProcessService>(); services.AddTransient<IProcessService, ProcessService>();
services.AddTransient<ISubprocessService, SubprocessService>(); services.AddTransient<ISubprocessService, SubprocessService>();
services.AddTransient<ITnkService, TnkService>(); services.AddTransient<ITnkService, TnkService>();
services.AddTransient<IRawDataEKService, RawDataEKService>();
services.AddTransient<ISettingService, SettingService>();
services.AddTransient<ITemplateService, TemplateService>(); services.AddTransient<ITemplateService, TemplateService>();
services.AddTransient<IStatusTemplateService, StatusTemplateService>(); services.AddTransient<IStatusTemplateService, StatusTemplateService>();
services.AddTransient<IRobotHistoryLevelService, RobotHistoryLevelService>(); services.AddTransient<IRobotHistoryLevelService, RobotHistoryLevelService>();

View File

@@ -1,39 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models.AIHIT;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.AIHIT;
namespace PARR.DAL.Services.Implementations.AIHIT
{
internal class RawDataEKService : BaseService<RawDataEK>, IRawDataEKService
{
private readonly DataContext dataContext;
private readonly ILogger<RawDataEKService> logger;
public RawDataEKService(DataContext dataContext, ILogger<RawDataEKService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
public void DeleteAll()
{
var startCount = EntitySet.Count();
if (startCount > 0)
{
EntitiContext.RawDataEKs.RemoveRange(EntitySet);
logger.LogInformation($"Из таблицы RawDataEK удалено {startCount} записей");
EntitiContext.SaveChanges();
}
}
protected override DbSet<RawDataEK> EntitySet => dataContext.RawDataEKs;
protected override DataContext EntitiContext => dataContext;
}
}

View File

@@ -1,23 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models.AIHIT;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.AIHIT;
namespace PARR.DAL.Services.Implementations.AIHIT
{
internal class SettingService : BaseService<Setting>, ISettingService
{
private readonly DataContext dataContext;
private readonly ILogger<SettingService> logger;
public SettingService(DataContext dataContext, ILogger<SettingService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<Setting> EntitySet => dataContext.Settings;
protected override DataContext EntitiContext => dataContext;
}
}

View File

@@ -1,9 +0,0 @@
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.AIHIT
{
public interface IRawDataEKService : IBaseService<Models.AIHIT.RawDataEK>
{
void DeleteAll();
}
}

View File

@@ -1,8 +0,0 @@
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.AIHIT
{
public interface ISettingService : IBaseService<Models.AIHIT.Setting>
{
}
}

View File

@@ -1,33 +0,0 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM 10.99.253.167:8090/dotnet/runtime:7.0 AS base
WORKDIR /app
FROM 10.99.253.167:8090/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["NuGet.config", "."]
COPY ["PARR.Worker/PARR.Worker/PARR.AIHITWorker.csproj", "PARR.Worker/PARR.Worker/"]
COPY ["PARR.AIHIT/AIHIT/PARR.AIHIT.csproj", "PARR.AIHIT/AIHIT/"]
COPY ["PARR.DAL/PARR.DAL.csproj", "PARR.DAL/"]
COPY ["PARR.Mail/PARR.Mail/PARR.Mail.csproj", "PARR.Mail/PARR.Mail/"]
RUN dotnet restore "PARR.Worker/PARR.Worker/PARR.AIHITWorker.csproj"
COPY . .
WORKDIR "/src/PARR.Worker/PARR.Worker"
RUN dotnet build "PARR.AIHITWorker.csproj" -c Release -o /app/build
FROM build AS publish
ARG app_version=0.0.0-default
RUN dotnet publish "PARR.AIHITWorker.csproj" -c Release -o /app/publish /p:UseAppHost=false /p:Version=$app_version
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
# Fixes an old version TLS (AIH IT GVC)
RUN sed -i 's/DEFAULT@SECLEVEL=2/DEFAULT@SECLEVEL=1/g' /etc/ssl/openssl.cnf
ENTRYPOINT ["dotnet", "PARR.AIHITWorker.dll"]
### EXAMPLE ###
# docker build -t parr-aihit-syncher:v1.0.0 --build-arg app_version=1.0.0 -f PARR.Worker/Dockerfile .

View File

@@ -1,26 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>dotnet-PARR.Worker-87bfa085-3c62-4b97-b25f-bdece8fc03df</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Elastic.CommonSchema.Serilog" Version="8.6.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="7.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\PARR.AIHIT\AIHIT\PARR.AIHIT.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,33 +0,0 @@
using Elastic.CommonSchema.Serilog;
using PARR.AIHIT;
using PARR.Worker;
using PARR.Worker.Settings;
using Serilog;
using System.Text;
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
IHost host = Host.CreateDefaultBuilder(args)
.ConfigureServices((hostContext, services) =>
{
var workerSettings = new WorkerSettings();
hostContext.Configuration.GetSection(nameof(WorkerSettings)).Bind(workerSettings);
services.AddSingleton(workerSettings);
//services.InstallMailServices(hostContext.Configuration);
services.InstallSyncerServices(hostContext.Configuration);
services.AddHostedService<Worker>();
})
.UseSerilog((hostContext, services, config) =>
{
if (hostContext.HostingEnvironment.IsProduction())
config.WriteTo.Console(new EcsTextFormatter());
else
config.WriteTo.Console();
config.ReadFrom.Configuration(hostContext.Configuration);
})
.Build();
host.Run();

View File

@@ -1,14 +0,0 @@
{
"profiles": {
"PARR.Worker": {
"commandName": "Project",
"environmentVariables": {
"DOTNET_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true
},
"Docker": {
"commandName": "Docker"
}
}
}

View File

@@ -1,7 +0,0 @@
namespace PARR.Worker.Settings
{
public class WorkerSettings
{
public TimeSpan OccursEvery { get; set; }
}
}

View File

@@ -1,72 +0,0 @@
using PARR.AIHIT;
using PARR.BLL.Services.Interfaces;
using PARR.Worker.Settings;
namespace PARR.Worker
{
public class Worker : BackgroundService
{
private readonly ILogger<Worker> logger;
private readonly IServiceProvider serviceProvider;
private readonly WorkerSettings workerSettings;
private readonly IIntervalService intervalService;
public Worker(
ILogger<Worker> logger,
IServiceProvider serviceProvider,
WorkerSettings workerSettings,
IIntervalService intervalService
)
{
this.logger = logger;
this.serviceProvider = serviceProvider;
this.workerSettings = workerSettings;
this.intervalService = intervalService;
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
logger.LogInformation("--- Сервис запущен! ---");
await intervalService.IntervalInitAsync(RunAihitSyncAsync, workerSettings.OccursEvery);
//while (!stoppingToken.IsCancellationRequested)
//{
// logger.LogInformation("--- --- --- --- Начало синхронизации --- --- --- ---");
// using var scope = serviceProvider.CreateScope();
// var services = scope.ServiceProvider;
// var syncer = services.GetService<ISyncher>();
// if (syncer != null) await syncer.InvokeFromDatabase();
// //var hosts = await hostService.Get().ToListAsync();
// //foreach ( var host in hosts ) { logger.LogInformation($"{host.HostName}"); }
// //await attachmentUploader.UploadAsync();
// //logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
// logger.LogInformation("=== === === === Конец синхронизации === === === ===");
// var mills = (int?) workerSettings?.OccursEvery.TotalMilliseconds ?? 60*1000;
// await Task.Delay(mills, stoppingToken);
//}
}
private async Task RunAihitSyncAsync()
{
logger.LogInformation("--- --- --- --- Начало синхронизации --- --- --- ---");
using var scope = serviceProvider.CreateScope();
var services = scope.ServiceProvider;
var syncer = services.GetService<ISyncher>();
if (syncer != null)
await syncer.InvokeFromDatabase();
logger.LogInformation("=== === === === Конец синхронизации === === === ===");
}
}
}

View File

@@ -1,44 +0,0 @@
{
"ConnectionStrings": {
"DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;",
"AihitConnection": "Data Source=10.248.19.97; Initial Catalog=mao2;User ID=awhit-ipp-parr;pwd=ET3h$9y1LH#D;TrustServerCertificate=true;",
"RedisConnection": "10.99.253.216:6379,password=ParrP@ssPtk202MMdevDvs"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"Serilog": {
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Debug"
}
},
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "log/log-.txt",
"rollingInterval": "Day"
}
}
]
},
"MailSettings": {
"Host": "uc.dvgd.rzd",
"Password": "Robin123",
"Port": 143,
"SSL": false,
"UserName": "IVC_Robot"
},
"SyncherSettings": {
"IncludeAddresses": "aihit@gvc.rzd"
},
"WorkerSettings": {
"OccursEvery": "12:00:00.0"
}
}

View File

@@ -1,45 +0,0 @@
{
"ConnectionStrings": {
"DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;",
"AihitConnection": "Data Source=10.248.19.97; Initial Catalog=mao2;User ID=awhit-ipp-parr;pwd=ET3h$9y1LH#D;TrustServerCertificate=true;",
"RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"Serilog": {
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Debug"
}
},
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "log/log-.txt",
"rollingInterval": "Day"
}
}
]
},
"MailSettings": {
"Host": "uc.dvgd.rzd",
"Password": "Robin123",
"Port": 143,
"SSL": false,
"UserName": "IVC_Robot"
},
"SyncherSettings": {
"IncludeAddresses": "aihit@gvc.rzd"
},
"WorkerSettings": {
"OccursEvery": "12:00:00.0"
}
}

View File

@@ -6,8 +6,12 @@
## Структура ## Структура
- PARR.AIHIT - логика синхронизации АИХ ИТ с БД PARR - ~~PARR.AIHIT - логика синхронизации АИХ ИТ с БД PARR~~
- PARR.AIHITWorker - worker для PARR.AIHIT - ~~PARR.AIHITWorker - worker для PARR.AIHIT~~
- PARR.AIHITLoader - загрузка из АИХ ИТ в очередь по расписанию
- PARR.AIHITLoaderWorker
- PARR.AIHITSyncer - синхронизация АИХ ИТ из очереди в ПАРР
- PARR.AIHITSyncerWorker
- PARR.API - API - PARR.API - API
- PARR.BLL - общие методы и настройки для проектов - PARR.BLL - общие методы и настройки для проектов
- PARR.Constants - глобальные константы - PARR.Constants - глобальные константы