diff --git a/PARR.AIHITLoaderWorker/appsettings.json b/PARR.AIHITLoaderWorker/appsettings.json index bb95fe59..c5228b8d 100644 --- a/PARR.AIHITLoaderWorker/appsettings.json +++ b/PARR.AIHITLoaderWorker/appsettings.json @@ -2,11 +2,21 @@ "ConnectionStrings": { "AihitConnection": "Data Source=10.248.19.97; Initial Catalog=mao2;User ID=awhit-ipp-parr;pwd=ET3h$9y1LH#D;TrustServerCertificate=true;" }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.AspNetCore": "Warning" + } + }, "Serilog": { "MinimumLevel": { "Default": "Information", "Override": { "Microsoft": "Warning", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", "Microsoft.Hosting.Lifetime": "Information" } } diff --git a/PARR.AIHITRelationshipsSyncerWorker/appsettings.json b/PARR.AIHITRelationshipsSyncerWorker/appsettings.json index dd2eb2b6..391dc3c7 100644 --- a/PARR.AIHITRelationshipsSyncerWorker/appsettings.json +++ b/PARR.AIHITRelationshipsSyncerWorker/appsettings.json @@ -1,25 +1,29 @@ { - "ConnectionStrings": { - "AihitConnection": "Data Source=10.248.19.97; Initial Catalog=mao2;User ID=awhit-ipp-parr;pwd=ET3h$9y1LH#D;TrustServerCertificate=true;", - "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;" - }, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.Hosting.Lifetime": "Information" + "ConnectionStrings": { + "AihitConnection": "Data Source=10.248.19.97; Initial Catalog=mao2;User ID=awhit-ipp-parr;pwd=ET3h$9y1LH#D;TrustServerCertificate=true;", + "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.AspNetCore": "Warning" + } + }, + "Serilog": { + "MinimumLevel": { + "Default": "Information", + "Override": { + "Microsoft": "Warning", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } + }, + "WorkerSettings": { + "RepeatEvery": "12:00:00", + "CommitAfter": 500 } - }, - "Serilog": { - "MinimumLevel": { - "Default": "Information", - "Override": { - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - } - }, - "WorkerSettings": { - "RepeatEvery": "12:00:00", - "CommitAfter": 500 - } } diff --git a/PARR.AIHITSyncerWorker/appsettings.json b/PARR.AIHITSyncerWorker/appsettings.json index 21e753da..6d0d80ce 100644 --- a/PARR.AIHITSyncerWorker/appsettings.json +++ b/PARR.AIHITSyncerWorker/appsettings.json @@ -5,7 +5,9 @@ "Logging": { "LogLevel": { "Default": "Information", - "Microsoft.EntityFrameworkCore.Database.Command": "Warning" + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.AspNetCore": "Warning" } }, "Serilog": { @@ -13,7 +15,9 @@ "Default": "Information", "Override": { "Microsoft": "Warning", - "Microsoft.EntityFrameworkCore.Database.Command": "Warning" + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.Hosting.Lifetime": "Information" } } }, diff --git a/PARR.API/Controllers/V1/RobotTaskController.cs b/PARR.API/Controllers/V1/RobotTaskController.cs index 1e783fed..96d5aa26 100644 --- a/PARR.API/Controllers/V1/RobotTaskController.cs +++ b/PARR.API/Controllers/V1/RobotTaskController.cs @@ -128,13 +128,17 @@ namespace PARR.API.Controllers.V1 .ThenInclude(t => t!.Group) .ThenInclude(t => t.ScheduleExcludeTypeCalendar) .Include(t => t.Template) - .ThenInclude(t => t.UnitsInTemplate); + .ThenInclude(t => t!.Job) + .ThenInclude(t=>t!.Tnk) + .Include(t => t.Template) + .ThenInclude(t => t!.UnitsInTemplate); //выбираем только записи с созданными шаблонами (у которых статус 20 или 30), а только потом у них ищем расписания var createdTemplates = robotConfigurationService.Get() .Where(t => t.RobotCode == (int)RobotsEnum.TemplateOrder && (t.TaskStatusCode == (int)TaskStatusEnum.Ok)) .Select(t => t.TemplateId); query = query.Where(t => t.RobotCode == (int)RobotsEnum.ScheduleOrder && createdTemplates.Contains(t.TemplateId)); + // query = query.Where(t => t.RobotCode == (int)RobotsEnum.ScheduleOrder && t.TemplateId==Guid.Parse("7cb7c3be-506d-40e0-a63f-4554edb52459")); break; default: diff --git a/PARR.DAL/DomainServices/Implementations/GroupedShortcodesCacheService.cs b/PARR.DAL/DomainServices/Implementations/GroupedShortcodesCacheService.cs deleted file mode 100644 index 229f37bc..00000000 --- a/PARR.DAL/DomainServices/Implementations/GroupedShortcodesCacheService.cs +++ /dev/null @@ -1,95 +0,0 @@ -using Microsoft.Extensions.Logging; -using PARR.DAL.CacheServices; -using PARR.DAL.DomainServices.Interfaces; -using PARR.DAL.Settings; -using System.Security.Cryptography; -using System.Text; - -namespace PARR.DAL.DomainServices.Implementations -{ - public class GroupedShortcodesCacheService : IGroupedShortcodesCacheService - { - private readonly IRedisCacheService cacheService; - private readonly GroupedShortcodesCacheSettings settings; - private readonly ILogger logger; - - public GroupedShortcodesCacheService( - IRedisCacheService cacheService, - GroupedShortcodesCacheSettings settings, - ILogger logger) - { - this.cacheService = cacheService; - this.settings = settings; - this.logger = logger; - } - - public async Task GetAggregatedValueAsync( - Guid jobGroupId, - Guid unitId, - string shortcode, - Func> computeIfMissing) - { - if (string.IsNullOrEmpty(shortcode)) - throw new ArgumentException("Ключ шорткода должен быть указан.", nameof(shortcode)); - - var cacheKey = GetCacheKey(jobGroupId, unitId, shortcode); - - try - { - var cachedValue = await cacheService.GetCachedDataAsync(cacheKey); - if (cachedValue != null) - { - logger.LogDebug( - "Попадание в кэш для шорткода '{ShortcodeKey}': unit={UnitId} → '{Value}'", - shortcode, unitId, cachedValue); - return cachedValue; - } - - logger.LogDebug( - "Промах кэша для шорткода '{ShortcodeKey}': unit={UnitId}. Вычисление...", - shortcode, unitId); - - var computedValue = await computeIfMissing(); - - await cacheService.SetCachedDataAsync(cacheKey, computedValue, settings.ValueTtl); - - logger.LogDebug( - "Вычислено и сохранено значение для '{ShortcodeKey}': unit={UnitId} → '{Value}' (срок хранения={Ttl})", - shortcode, unitId, computedValue, settings.ValueTtl); - - return computedValue; - } - catch (Exception ex) - { - logger.LogWarning( - ex, - "Ошибка при получении или вычислении значения для шорткода '{ShortcodeKey}' (unit={UnitId}). Возвращена пустая строка.", - shortcode, unitId); - - return string.Empty; - } - } - - private static string GetCacheKey(Guid jobGroupId, Guid unitId, string shortcodeKey) - { - var safeKey = shortcodeKey - .Trim() - .Replace(":", "_") - .Replace(" ", "_") - .Replace(".", "_") - .Replace("%", "") - .Replace("[", "_") - .Replace("]", "_") - .Replace("/", "_") - .Replace("\\", "_"); - - // ✅ SHA256 от safeKey - using var sha256 = SHA256.Create(); - var hashBytes = sha256.ComputeHash(Encoding.UTF8.GetBytes(safeKey)); - var hashHex = BitConverter.ToString(hashBytes).Replace("-", "").ToLower(); - - // ✅ Новый формат ключа - return $"gr_shcd_{jobGroupId:N}{unitId:N}_{hashHex}"; - } - } -} \ No newline at end of file diff --git a/PARR.DAL/DomainServices/Implementations/UnitFilterService.cs b/PARR.DAL/DomainServices/Implementations/UnitFilterService.cs index 485ff273..10fcfa1d 100644 --- a/PARR.DAL/DomainServices/Implementations/UnitFilterService.cs +++ b/PARR.DAL/DomainServices/Implementations/UnitFilterService.cs @@ -398,44 +398,68 @@ namespace PARR.DAL.DomainServices.Implementations logger.LogDebug("Обработка UnitFilter.Id {FilterId}. Количество RelationshipFilters: {RelFilterCount}", filter.Id, filter.RelationshipFilters.Count()); - foreach (var rf in filter.RelationshipFilters) + // ✅ Получить все связи для юнита + var parentLinks = await unitInUnitService.GetByChildIdAsync(unitId); + var childLinks = await unitInUnitService.GetByParentIdAsync(unitId); + + // ✅ Собрать все UnitId, участвующие в связях + var allRelatedUnitIds = parentLinks + .Select(l => l.ParentUnitId) + .Concat(childLinks.Select(l => l.ChildUnitId)) + .Distinct() + .ToList(); + + if (!allRelatedUnitIds.Any()) continue; + + // ✅ Получить значения для всех связанных юнитов + var allUnitValues = await unitInValueService.GetByUnitIdsAsync(allRelatedUnitIds); + + // ✅ Сгруппировать значения по UnitId + var valuesByUnit = allUnitValues + .GroupBy(uv => uv.UnitId) + .ToDictionary(g => g.Key, g => g.ToList()); + + // ✅ Найти UnitId, которые проходят все RelationshipFilters + var matchingUnitIds = new HashSet(); + + foreach (var relatedUnitId in allRelatedUnitIds) { - logger.LogDebug("Обработка RelationshipFilter (UnitFilterId={UnitFilterId}): IsParent={IsParent}, FieldId={FieldId}, ValueMask={ValueMask}", - rf.UnitFilterId, rf.IsParent, rf.FieldId, rf.ValueMask); - - var valueMask = rf.ValueMask?.Trim(); - if (string.IsNullOrEmpty(valueMask)) continue; - - List relevantLinks; - if (rf.IsParent) - relevantLinks = await unitInUnitService.GetByChildIdAsync(unitId); - else - relevantLinks = await unitInUnitService.GetByParentIdAsync(unitId); - - var unitIdsToCheck = rf.IsParent - ? relevantLinks.Select(l => l.ParentUnitId).ToList() - : relevantLinks.Select(l => l.ChildUnitId).ToList(); - - if (!unitIdsToCheck.Any()) continue; - - var unitValues = await unitInValueService.GetByUnitIdsAsync(unitIdsToCheck); - - var matchingUnitIds = unitValues - .Where(uv => uv.FieldId == rf.FieldId - && uv.Value?.Value != null - && uv.Value.Value.Contains(valueMask, StringComparison.OrdinalIgnoreCase)) - .Select(uv => uv.UnitId) - .Distinct() - .ToList(); - - if (matchingUnitIds.Any()) + // ✅ Изменяем на `All` — все фильтры должны подходить + bool passesAllFilters = filter.RelationshipFilters.All(rf => { - var names = await unitService.Get().AsNoTracking() - .Where(u => matchingUnitIds.Contains(u.Id)) - .Select(u => u.Name) - .ToListAsync(); - result.UnionWith(names); - } + var values = valuesByUnit.GetValueOrDefault(relatedUnitId, new List()); + + var matchingValues = values + .Where(uv => uv.FieldId == rf.FieldId && uv.Value?.Value != null) + .ToList(); + + if (!matchingValues.Any()) // Нет значений по полю + { + // ✅ Если нет значений, и IsInverse = false → не подходит + // ✅ Если нет значений, и IsInverse = true → подходит + return rf.IsInverse; + } + + var hasMatch = matchingValues.Any(uv => uv.Value!.Value!.Contains(rf.ValueMask.Trim('%'), StringComparison.OrdinalIgnoreCase)); + + // ✅ Учитываем IsInverse + if (rf.IsInverse) + hasMatch = !hasMatch; + + return hasMatch; + }); + + if (passesAllFilters) + matchingUnitIds.Add(relatedUnitId); + } + + if (matchingUnitIds.Any()) + { + var names = await unitService.Get().AsNoTracking() + .Where(u => matchingUnitIds.Contains(u.Id)) + .Select(u => u.Name) + .ToListAsync(); + result.UnionWith(names); } } @@ -450,21 +474,25 @@ namespace PARR.DAL.DomainServices.Implementations if (string.IsNullOrEmpty(valueMask)) return query; - logger.LogDebug("Применяем FieldFilterDto: FieldId={FieldId}, ValueMask={ValueMask}", fieldFilter.FieldId, valueMask); + logger.LogDebug("Применяем FieldFilterDto: FieldId={FieldId}, ValueMask={ValueMask}, IsInverse={IsInverse}", fieldFilter.FieldId, valueMask, fieldFilter.IsInverse); bool isStartsWith = valueMask.EndsWith("%") && !valueMask.EndsWith("%%"); bool isEndsWith = valueMask.StartsWith("%") && !valueMask.StartsWith("%%"); return query.AsEnumerable().Where(dto => - dto.Values.Any(v => + { + var hasMatch = dto.Values.Any(v => v.FieldId == fieldFilter.FieldId && v.Value != null && (isStartsWith && isEndsWith ? v.Value.Contains(valueMask.Trim('%'), StringComparison.OrdinalIgnoreCase) : isStartsWith ? v.Value.StartsWith(valueMask.TrimEnd('%'), StringComparison.OrdinalIgnoreCase) : isEndsWith ? v.Value.EndsWith(valueMask.TrimStart('%'), StringComparison.OrdinalIgnoreCase) : v.Value.Contains(valueMask, StringComparison.OrdinalIgnoreCase)) - ) - ).AsQueryable(); + ); + + // ✅ Правильная логика: если IsInverse = true, то юнит подходит, если НЕ проходит фильтр + return fieldFilter.IsInverse ? !hasMatch : hasMatch; + }).AsQueryable(); } private IQueryable ApplyRelationshipFilterToQuery(IQueryable query, JobRelationshipFilter relFilter) @@ -640,13 +668,12 @@ namespace PARR.DAL.DomainServices.Implementations // Есть фильтры по полям → считаем только связанные юниты, подходящие под фильтр foreach (var link in links) { - bool hasMatch = link.Values.Any(v => - activeFilters.Any(f => - v.FieldId == f.FieldId && - v.Value != null && - v.Value.Contains(f.ValueMask, StringComparison.OrdinalIgnoreCase) - ) - ); + // ✅ Изменяем на `All` — все фильтры должны подходить + bool hasMatch = activeFilters.All(f => + { + var value = link.Values.FirstOrDefault(v => v.FieldId == f.FieldId); + return value != null && value.Value != null && value.Value.Contains(f.ValueMask, StringComparison.OrdinalIgnoreCase); + }); if (hasMatch) matchingCount++; diff --git a/PARR.DAL/DomainServices/Interfaces/IGroupedShortcodesCacheService.cs b/PARR.DAL/DomainServices/Interfaces/IGroupedShortcodesCacheService.cs deleted file mode 100644 index 9e2a442d..00000000 --- a/PARR.DAL/DomainServices/Interfaces/IGroupedShortcodesCacheService.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace PARR.DAL.DomainServices.Interfaces -{ - public interface IGroupedShortcodesCacheService - { - Task GetAggregatedValueAsync( - Guid jobGroupId, - Guid unitId, - string shortcodeKey, - Func> computeIfMissing); - } -} diff --git a/PARR.DAL/DomainServices/Shortcodes/Models/CachedGroupedShortCode.cs b/PARR.DAL/DomainServices/Shortcodes/Models/CachedGroupedShortCode.cs new file mode 100644 index 00000000..6d9e244d --- /dev/null +++ b/PARR.DAL/DomainServices/Shortcodes/Models/CachedGroupedShortCode.cs @@ -0,0 +1,10 @@ +namespace PARR.DAL.DomainServices.Shortcodes.Models +{ + internal class CachedGroupedShortCode + { + public string Value { get; set; } = string.Empty; + public DateTimeOffset Timestamp { get; set; } + public string? Source { get; set; } = "ShortcodesService"; + public int Version { get; set; } = 1; + } +} diff --git a/PARR.DAL/DomainServices/Shortcodes/ShortcodesService.cs b/PARR.DAL/DomainServices/Shortcodes/ShortcodesService.cs index bfce6b8e..47af5297 100644 --- a/PARR.DAL/DomainServices/Shortcodes/ShortcodesService.cs +++ b/PARR.DAL/DomainServices/Shortcodes/ShortcodesService.cs @@ -1,6 +1,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using PARR.Constants; +using PARR.DAL.CacheServices; using PARR.DAL.Contracts; using PARR.DAL.DomainModels; using PARR.DAL.DomainServices.Interfaces; @@ -31,7 +32,7 @@ namespace PARR.DAL.DomainServices.Shortcodes private readonly IUnitInValueService unitInValueService; private readonly IUnitFieldService unitFieldService; private readonly ITemplateService templateService; - private readonly IGroupedShortcodesCacheService groupedShortcodesCacheService; + private readonly IRedisCacheService cacheService; private readonly IUnitFilterService unitFilterService; public ShortcodesService( @@ -43,7 +44,7 @@ namespace PARR.DAL.DomainServices.Shortcodes IUnitInValueService unitInValueService, IUnitFieldService unitFieldService, ITemplateService templateService, - IGroupedShortcodesCacheService groupedShortcodesCacheService + IRedisCacheService cacheService ) { this.logger = logger; @@ -53,7 +54,7 @@ namespace PARR.DAL.DomainServices.Shortcodes this.unitInValueService = unitInValueService; this.unitFieldService = unitFieldService; this.templateService = templateService; - this.groupedShortcodesCacheService = groupedShortcodesCacheService; + this.cacheService = cacheService; this.unitFilterService = unitFilterService; } @@ -124,8 +125,7 @@ namespace PARR.DAL.DomainServices.Shortcodes var maxShortcodes = Regex.Matches(resultName, maxShortcodePattern); if (maxShortcodes.Count > 0) { - var unitIds = template.UnitsInTemplate.Select(uit => uit.UnitId).ToList(); - resultName = await ReplaceMaxShortcodesAsync(job.Group.Id, template.UnitId, unitIds, resultName, maxShortcodes); + resultName = await ReplaceMaxShortcodesAsync(job.Group.Id, template.UnitId, resultName, maxShortcodes); } } @@ -273,9 +273,6 @@ namespace PARR.DAL.DomainServices.Shortcodes new ShortcodeInfoDto { Shortcode = "%МАКС:ИМЯ АТРИБУТА%", Description = "Используется только с групповым типом работ. Наиболее часто встречающееся значение поля в группе (игнорирует пустые). Пример: %МАКС:РАБОЧАЯ_ГР_ОТВ_ЗА_ЭК%", Type = ShortcodeTypeEnum.Standart }, - new ShortcodeInfoDto { Shortcode = "%ГР_ПОЛЕ-ПН%", - Description = "Нумерованный список unit-ов из шаблона: 1. ЭК-123 (Значение1, Значение2). Использует GroupingUnitFieldId из JobGroup.", - Type = ShortcodeTypeEnum.Relationship }, new ShortcodeInfoDto{ Shortcode = "%БУКВЫ:ИМЯ АТРИБУТА%", Description = "Извлекает только буквы из значения поля. Пример: %БУКВЫ:ЗОНА_ОТВЕТСТВЕННОСТИ% → ПРИВ", Type = ShortcodeTypeEnum.Standart @@ -290,7 +287,10 @@ namespace PARR.DAL.DomainServices.Shortcodes Type = ShortcodeTypeEnum.Relationship }, new ShortcodeInfoDto { Shortcode = "%СВЯЗИ-ПН%", Description = "Связанные ЭК с нумерацией (1. ..., 2. ...), выбираются только при настроенном фильтре по полям в связанных ЭК", - Type = ShortcodeTypeEnum.Relationship } + Type = ShortcodeTypeEnum.Relationship }, + new ShortcodeInfoDto { Shortcode = "%ГР_ПОЛЕ-ПН%", + Description = "Нумерованный список unit-ов из шаблона: 1. ЭК-123 (Значение1, Значение2). Использует GroupingUnitFieldId из JobGroup.", + Type = ShortcodeTypeEnum.Relationship }, }); // 4. Все доступные поля из UnitField @@ -363,7 +363,7 @@ namespace PARR.DAL.DomainServices.Shortcodes return resultName; } - private async Task ReplaceMaxShortcodesAsync(Guid jobGroupId, Guid unitId, List unitIds, string input, MatchCollection maxShortcodes) + private async Task ReplaceMaxShortcodesAsync(Guid jobGroupId, Guid unitId, string input, MatchCollection maxShortcodes) { var shortcodeToMatches = maxShortcodes .Cast() @@ -379,56 +379,69 @@ namespace PARR.DAL.DomainServices.Shortcodes logger.LogDebug("Обработка {Shortcode} для JobGroup {JobGroupId}, Template.UnitId {UnitId}, fieldName {FieldName}", fullShortcode, jobGroupId, unitId, fieldName); - var mostFrequentValue = await groupedShortcodesCacheService.GetAggregatedValueAsync( - jobGroupId, - unitId, - fullShortcode, - async () => - { - logger.LogDebug("Кэш промахнут для {Shortcode}, начинаем вычисление.", fullShortcode); - - // ✅ Пытаемся загрузить UnitsInTemplate из БД - var dbUnitIds = await jobService.Get() - .Where(j => j.GroupId == jobGroupId) - .Join( - templateService.Get() - .Where(t => t.StatusTypeId == TemplateStatusTypeEnum.Used) - .Include(t => t.UnitsInTemplate), - job => job.Id, - template => template.JobId, - (job, template) => template - ) - .SelectMany(template => template.UnitsInTemplate) - .Select(uit => uit.UnitId) - .Distinct() - .ToListAsync(); - - logger.LogDebug("Загружено {Count} unitIds из БД для JobGroup {JobGroupId}", dbUnitIds.Count, jobGroupId); - - // ✅ Если в БД нет UnitsInTemplate — используем переданные unitIds - var effectiveUnitIds = dbUnitIds.Any() ? dbUnitIds : unitIds; - - logger.LogDebug("EffectiveUnitIds: [{Ids}], Count: {Count}", string.Join(", ", effectiveUnitIds), effectiveUnitIds.Count); - - // Вызываем метод из сервиса - var result = await unitInValueService.GetMostFrequentValueForFieldAsync(effectiveUnitIds, fieldName); - - logger.LogDebug("Результат GetMostFrequentValueForFieldAsync: {Result}, для поля {FieldName}, unitIds: [{Ids}]", result, fieldName, string.Join(", ", effectiveUnitIds)); - - return result ?? string.Empty; - }); - - logger.LogDebug("Итоговое значение для {Shortcode}: {Value}", fullShortcode, mostFrequentValue); + var mostFrequentValue = await GetMaxShortCodeFromCacheOrDbAsync(jobGroupId, unitId, fullShortcode, fieldName); foreach (var match in matches) - { input = input.Replace(match.Value, mostFrequentValue); - } } return input; } + private async Task GetMaxShortCodeFromCacheOrDbAsync(Guid jobGroupId, Guid unitId, string fullShortcode, string fieldName) + { + var cacheKey = $"gr_shcd_{jobGroupId:N}_{unitId:N}_{ComputeHash(fullShortcode)}"; + + var cachedData = await cacheService.GetCachedDataAsync(cacheKey); + if (cachedData != null) + { + logger.LogDebug("Кэш попал для GroupedShortCode '{Name}': {Value}", fullShortcode, cachedData.Value); + return cachedData.Value; + } + + logger.LogDebug("Кэш промахнут для GroupedShortCode '{Name}'. Запрашиваем из БД.", fullShortcode); + + // Загружаем юниты из БД + var effectiveUnitIds = await jobService.Get() + .Where(j => j.GroupId == jobGroupId) + .Join( + templateService.Get() + .Where(t => t.StatusTypeId == TemplateStatusTypeEnum.Used && t.UnitId == unitId) + .Include(t => t.UnitsInTemplate), + job => job.Id, + template => template.JobId, + (job, template) => template + ) + .SelectMany(template => template.UnitsInTemplate) + .Select(uit => uit.UnitId) + .Distinct() + .ToListAsync(); + + logger.LogDebug("EffectiveUnitIds: [{Ids}], Count: {Count}", string.Join(", ", effectiveUnitIds), effectiveUnitIds.Count); + + // Вызываем метод из сервиса + var mostFrequentValue = await unitInValueService.GetMostFrequentValueForFieldAsync(effectiveUnitIds, fieldName); + + logger.LogDebug("Результат GetMostFrequentValueForFieldAsync: {Result}, для поля {FieldName}, unitIds: [{Ids}]", mostFrequentValue, fieldName, string.Join(", ", effectiveUnitIds)); + + // Не кэшируем пустые значения + if (!string.IsNullOrEmpty(mostFrequentValue)) + { + var toCache = new CachedGroupedShortCode + { + Value = mostFrequentValue, + Timestamp = DateTimeOffset.UtcNow, + Source = GetType().Name, + Version = 1 + }; + + await cacheService.SetCachedDataAsync(cacheKey, toCache, TimeSpan.FromHours(1)); + return mostFrequentValue; + } + + return "Нет данных"; + } + private async Task ReplaceLettersShortcodesAsync(Guid unitId, string input, MatchCollection lettersShortcodes) { var shortcodeToMatches = lettersShortcodes @@ -485,5 +498,12 @@ namespace PARR.DAL.DomainServices.Shortcodes } return result.ToString(); } + + private static string ComputeHash(string input) + { + using var sha256 = System.Security.Cryptography.SHA256.Create(); + var hashedBytes = sha256.ComputeHash(System.Text.Encoding.UTF8.GetBytes(input)); + return Convert.ToBase64String(hashedBytes).Replace('+', '-').Replace('/', '_').Substring(0, 16); + } } } \ No newline at end of file diff --git a/PARR.EsppOrderLoaderWorker/appsettings.json b/PARR.EsppOrderLoaderWorker/appsettings.json index ae5591e0..4dc4d06f 100644 --- a/PARR.EsppOrderLoaderWorker/appsettings.json +++ b/PARR.EsppOrderLoaderWorker/appsettings.json @@ -1,32 +1,36 @@ { - "ConnectionStrings": { - "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;", - "RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs" - }, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "Serilog": { - "MinimumLevel": { - "Default": "Information", - "Override": { - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" + "ConnectionStrings": { + "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;", + "RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.AspNetCore": "Warning" } + }, + "Serilog": { + "MinimumLevel": { + "Default": "Information", + "Override": { + "Microsoft": "Warning", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } + }, + "WorkerSettings": { + "RepeatEvery": "1:00:00" + }, + "EsppOrderSettings": { + //dev + //"Url": "http://rzd-espp-t-rpa-app-1.gvc.oao.rzd:8080/espp_api/OperationExecutor/", + "Url": "http://espp.gvc.rzd/esppapi_prom/OperationExecutor/", + "UserName": "Auto-PTK-INFO-0002-DVS", + "Password": "123456789", + "EsppUserTimeZone": 3 } - }, - "WorkerSettings": { - "RepeatEvery": "1:00:00" - }, - "EsppOrderSettings": { - //dev - //"Url": "http://rzd-espp-t-rpa-app-1.gvc.oao.rzd:8080/espp_api/OperationExecutor/", - "Url": "http://espp.gvc.rzd/esppapi_prom/OperationExecutor/", - "UserName": "Auto-PTK-INFO-0002-DVS", - "Password": "123456789", - "EsppUserTimeZone": 3 - } } diff --git a/PARR.EsppOrderManagerWorker/appsettings.json b/PARR.EsppOrderManagerWorker/appsettings.json index a13af0e8..b4b21043 100644 --- a/PARR.EsppOrderManagerWorker/appsettings.json +++ b/PARR.EsppOrderManagerWorker/appsettings.json @@ -1,47 +1,51 @@ { - "ConnectionStrings": { - "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;", - "RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs" - }, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "Serilog": { - "MinimumLevel": { - "Default": "Information", - "Override": { - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" + "ConnectionStrings": { + "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;", + "RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.AspNetCore": "Warning" } + }, + "Serilog": { + "MinimumLevel": { + "Default": "Information", + "Override": { + "Microsoft": "Warning", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } + }, + "MqSettings": { + "HostName": "parr-rabbitmq", + "QueueName": "parr-orders", + "User": "espp_orders_manager", + "Password": "Lfhsdkfg*&%9sdfgf23" + }, + "EsppOrderSettings": { + //dev + //"Url": "http://rzd-espp-t-rpa-app-1.gvc.oao.rzd:8080/espp_api/OperationExecutor/", + "Url": "http://espp.gvc.rzd/esppapi_prom/OperationExecutor/", + "UserName": "Auto-PTK-INFO-0002-DVS", + "AccountName": "АВТО ТЕХНОЛОГ ПТК-ИНФО-0002-ДВС (AUTO-PTK-INFO-0002-DVS)", + "Password": "123456789", + "EsppUserTimeZone": 3, + "RobotEk": "РПА-РОБИН-ГВЦ-ЕСПП-ТС-513-ДВС", + "CodeRRO": "ЦТС-РЦТ-9999" + }, + "EsppPoligonSettings": { + "IsEnabled": false, + "TnkValue": "Не учтена в перечне ТНК" + }, + "ResultTemplateSettings": { + "Template": "{base}\n{msgAgent}", + "MsgAgent": "Работы выполнены средствами автоматизации.\nЖурнал работы:\n{agentHistory}", + "MsgAgentEmpty": "Работы должны были выполняться средствами автоматизации. От средств автоматизации не поступило сообщений. Работы не выполнены." } - }, - "MqSettings": { - "HostName": "parr-rabbitmq", - "QueueName": "parr-orders", - "User": "espp_orders_manager", - "Password": "Lfhsdkfg*&%9sdfgf23" - }, - "EsppOrderSettings": { - //dev - //"Url": "http://rzd-espp-t-rpa-app-1.gvc.oao.rzd:8080/espp_api/OperationExecutor/", - "Url": "http://espp.gvc.rzd/esppapi_prom/OperationExecutor/", - "UserName": "Auto-PTK-INFO-0002-DVS", - "AccountName": "АВТО ТЕХНОЛОГ ПТК-ИНФО-0002-ДВС (AUTO-PTK-INFO-0002-DVS)", - "Password": "123456789", - "EsppUserTimeZone": 3, - "RobotEk": "РПА-РОБИН-ГВЦ-ЕСПП-ТС-513-ДВС", - "CodeRRO": "ЦТС-РЦТ-9999" - }, - "EsppPoligonSettings": { - "IsEnabled": false, - "TnkValue": "Не учтена в перечне ТНК" - }, - "ResultTemplateSettings": { - "Template": "{base}\n{msgAgent}", - "MsgAgent": "Работы выполнены средствами автоматизации.\nЖурнал работы:\n{agentHistory}", - "MsgAgentEmpty": "Работы должны были выполняться средствами автоматизации. От средств автоматизации не поступило сообщений. Работы не выполнены." - } } diff --git a/PARR.EsppScheduleSync/ScheduleSyncher.cs b/PARR.EsppScheduleSync/ScheduleSyncher.cs index 2f104924..9831e8af 100644 --- a/PARR.EsppScheduleSync/ScheduleSyncher.cs +++ b/PARR.EsppScheduleSync/ScheduleSyncher.cs @@ -68,7 +68,7 @@ namespace PARR.EsppScheduleSync private async Task SyncScheduleAsync(string str) { - await syncService.SyncEsppObjectAsync(str, ParseStrToEsppObject, ConvertDbObjToEsppObj); + await syncService.SyncEsppObjectAsync(str, ParseStrToEsppObject, ConvertDbObjToEsppObj); } diff --git a/PARR.EsppScheduleSyncWorker/appsettings.json b/PARR.EsppScheduleSyncWorker/appsettings.json index 5c56b72c..13e58908 100644 --- a/PARR.EsppScheduleSyncWorker/appsettings.json +++ b/PARR.EsppScheduleSyncWorker/appsettings.json @@ -1,31 +1,35 @@ { - "ConnectionStrings": { - "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;", - "RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs" - }, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "Serilog": { - "MinimumLevel": { - "Default": "Information", - "Override": { - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - } - }, - "GlobalSettings": { - "MqSettings": { - "HostName": "parr-rabbitmq", - "QueueName": "parr-espp-schedulers", - "User": "espp_schedulers_reader", - "Password": "KjdhGLJDshgd&^%84S2", - "PrefetchCount": 100 + "ConnectionStrings": { + "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;", + "RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs" }, - "ParsingSeparator": "<|>" - } + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.AspNetCore": "Warning" + } + }, + "Serilog": { + "MinimumLevel": { + "Default": "Information", + "Override": { + "Microsoft": "Warning", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } + }, + "GlobalSettings": { + "MqSettings": { + "HostName": "parr-rabbitmq", + "QueueName": "parr-espp-schedulers", + "User": "espp_schedulers_reader", + "Password": "KjdhGLJDshgd&^%84S2", + "PrefetchCount": 100 + }, + "ParsingSeparator": "<|>" + } } diff --git a/PARR.EsppSync/SyncService.cs b/PARR.EsppSync/SyncService.cs index 19b37448..b484992d 100644 --- a/PARR.EsppSync/SyncService.cs +++ b/PARR.EsppSync/SyncService.cs @@ -60,6 +60,13 @@ namespace PARR.EsppSync // Загружаем Template и TemplateForShortcodes в одном запросе var query = templateService.Get() .AsNoTracking() + .Include(h => h.Unit) + .ThenInclude(t => t!.UnitValues) + .ThenInclude(t => t.Value) + .Include(h => h.Unit) + .ThenInclude(t => t!.UnitValues) + .ThenInclude(t => t.Field) + .Include(t => t.RobotConfigurations) .Include(t => t.Job) .ThenInclude(j => j.Group) .ThenInclude(g => g.GroupType) @@ -71,6 +78,8 @@ namespace PARR.EsppSync .ThenInclude(t => t.ScheduleExcludeTypeCalendar) .Include(t => t.Job) .ThenInclude(j => j.Tnk) + .ThenInclude(s => s!.Subprocess) + .ThenInclude(p => p!.Process) .Include(t => t.UnitsInTemplate); var template = await query.FirstOrDefaultAsync(t => t.Name == esppObject.TemplateName); diff --git a/PARR.EsppTemplateSyncWorker/appsettings.json b/PARR.EsppTemplateSyncWorker/appsettings.json index 47bb0ebd..52f031c3 100644 --- a/PARR.EsppTemplateSyncWorker/appsettings.json +++ b/PARR.EsppTemplateSyncWorker/appsettings.json @@ -1,41 +1,45 @@ { - "ConnectionStrings": { - "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;", - "RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs" - }, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "Serilog": { - "MinimumLevel": { - "Default": "Information", - "Override": { - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" + "ConnectionStrings": { + "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;", + "RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.AspNetCore": "Warning" + } + }, + "Serilog": { + "MinimumLevel": { + "Default": "Information", + "Override": { + "Microsoft": "Warning", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } } - } - }, - "StorageSettings": { - "StoragePath": "Data", - "EsppTemplates": { - "AllowedExtensions": [ ".csv" ], - "MaxFileSizeMb": 100 - } - }, - "GlobalSettings": { - "MqSettings": { - "HostName": "parr-rabbitmq", - "QueueName": "parr-espp-templates", - "User": "espp_templates_reader", - "Password": "P@ssReaderPtk202!", - "PrefetchCount": 100 }, "StorageSettings": { - "CheckIntervalSeconds": 30 + "StoragePath": "Data", + "EsppTemplates": { + "AllowedExtensions": [ ".csv" ], + "MaxFileSizeMb": 100 + } }, - "ParsingSeparator": "<|>" - } + "GlobalSettings": { + "MqSettings": { + "HostName": "parr-rabbitmq", + "QueueName": "parr-espp-templates", + "User": "espp_templates_reader", + "Password": "P@ssReaderPtk202!", + "PrefetchCount": 100 + }, + "StorageSettings": { + "CheckIntervalSeconds": 30 + }, + "ParsingSeparator": "<|>" + } } diff --git a/PARR.GeneratorTemplatesWorker/appsettings.json b/PARR.GeneratorTemplatesWorker/appsettings.json index 349afdd7..42ef88ee 100644 --- a/PARR.GeneratorTemplatesWorker/appsettings.json +++ b/PARR.GeneratorTemplatesWorker/appsettings.json @@ -1,27 +1,31 @@ { - "ConnectionStrings": { - "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;", - "RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs" - }, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "Serilog": { - "MinimumLevel": { - "Default": "Information", - "Override": { - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" + "ConnectionStrings": { + "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;", + "RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.AspNetCore": "Warning" } + }, + "Serilog": { + "MinimumLevel": { + "Default": "Information", + "Override": { + "Microsoft": "Warning", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } + }, + "MqSettings": { + "HostName": "parr-rabbitmq", + "QueueName": "parr-generate-templates", + "User": "generate_templates_worker", + "Password": "Dhgdf%d&609sssa" } - }, - "MqSettings": { - "HostName": "parr-rabbitmq", - "QueueName": "parr-generate-templates", - "User": "generate_templates_worker", - "Password": "Dhgdf%d&609sssa" - } } diff --git a/PARR.JobAutoControlWorker/appsettings.json b/PARR.JobAutoControlWorker/appsettings.json index 8275475f..a605bc93 100644 --- a/PARR.JobAutoControlWorker/appsettings.json +++ b/PARR.JobAutoControlWorker/appsettings.json @@ -1,32 +1,36 @@ { - "ConnectionStrings": { - "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;", - "RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs" - }, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "Serilog": { - "MinimumLevel": { - "Default": "Information", - "Override": { - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" + "ConnectionStrings": { + "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;", + "RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.AspNetCore": "Warning" + } + }, + "Serilog": { + "MinimumLevel": { + "Default": "Information", + "Override": { + "Microsoft": "Warning", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } + }, + "WorkerSettings": { + "RepeatEvery": "6:00:00" + }, + "MqSettings": { + "TemplateMatcher": { + "HostName": "parr-rabbitmq", + "QueueName": "parr-template-matcher", + "User": "template_matcher_writer", + "Password": "8ndd%BpP61Ias;ldk23CkvZM" } } - }, - "WorkerSettings": { - "RepeatEvery": "6:00:00" - }, - "MqSettings": { - "TemplateMatcher": { - "HostName": "parr-rabbitmq", - "QueueName": "parr-template-matcher", - "User": "template_matcher_writer", - "Password": "8ndd%BpP61Ias;ldk23CkvZM" - } - } } diff --git a/PARR.NextRunWorker/appsettings.json b/PARR.NextRunWorker/appsettings.json index 73008d31..d3b75e8c 100644 --- a/PARR.NextRunWorker/appsettings.json +++ b/PARR.NextRunWorker/appsettings.json @@ -1,24 +1,28 @@ { - "ConnectionStrings": { - "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;", - "RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs" - }, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "Serilog": { - "MinimumLevel": { - "Default": "Information", - "Override": { - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" + "ConnectionStrings": { + "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;", + "RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.AspNetCore": "Warning" } + }, + "Serilog": { + "MinimumLevel": { + "Default": "Information", + "Override": { + "Microsoft": "Warning", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } + }, + "WorkerSettings": { + "RepeatEvery": "0:50:00" } - }, - "WorkerSettings": { - "RepeatEvery": "0:50:00" - } } diff --git a/PARR.TemplateActivatorWorker/appsettings.json b/PARR.TemplateActivatorWorker/appsettings.json index da790cfb..88c5a0ee 100644 --- a/PARR.TemplateActivatorWorker/appsettings.json +++ b/PARR.TemplateActivatorWorker/appsettings.json @@ -1,27 +1,31 @@ { - "ConnectionStrings": { - "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;", - "RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs" - }, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "Serilog": { - "MinimumLevel": { - "Default": "Information", - "Override": { - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" + "ConnectionStrings": { + "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;", + "RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.AspNetCore": "Warning" } + }, + "Serilog": { + "MinimumLevel": { + "Default": "Information", + "Override": { + "Microsoft": "Warning", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } + }, + "MqSettings": { + "HostName": "parr-rabbitmq", + "QueueName": "parr-template-activator", + "User": "template_activator_reader", + "Password": "KUYGFskdjhgf&^%sdfg" } - }, - "MqSettings": { - "HostName": "parr-rabbitmq", - "QueueName": "parr-template-activator", - "User": "template_activator_reader", - "Password": "KUYGFskdjhgf&^%sdfg" - } } diff --git a/PARR.TemplateDistributorWorker/appsettings.json b/PARR.TemplateDistributorWorker/appsettings.json index 0b4d9c7b..f2570261 100644 --- a/PARR.TemplateDistributorWorker/appsettings.json +++ b/PARR.TemplateDistributorWorker/appsettings.json @@ -1,27 +1,31 @@ { - "ConnectionStrings": { - "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;", - "RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs" - }, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "Serilog": { - "MinimumLevel": { - "Default": "Information", - "Override": { - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" + "ConnectionStrings": { + "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;", + "RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.AspNetCore": "Warning" } + }, + "Serilog": { + "MinimumLevel": { + "Default": "Information", + "Override": { + "Microsoft": "Warning", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } + }, + "MqSettings": { + "HostName": "parr-rabbitmq", + "QueueName": "parr-template-distributor", + "User": "template_distributor_reader", + "Password": "P@ss@3441gfgkjuyy" } - }, - "MqSettings": { - "HostName": "parr-rabbitmq", - "QueueName": "parr-template-distributor", - "User": "template_distributor_reader", - "Password": "P@ss@3441gfgkjuyy" - } } diff --git a/PARR.TemplateGeneratorWorker/appsettings.json b/PARR.TemplateGeneratorWorker/appsettings.json index f8bea384..fb69a9fb 100644 --- a/PARR.TemplateGeneratorWorker/appsettings.json +++ b/PARR.TemplateGeneratorWorker/appsettings.json @@ -3,25 +3,29 @@ "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;", "RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs" }, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "Serilog": { - "MinimumLevel": { - "Default": "Information", - "Override": { - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.AspNetCore": "Warning" } + }, + "Serilog": { + "MinimumLevel": { + "Default": "Information", + "Override": { + "Microsoft": "Warning", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } + }, + "MqSettings": { + "HostName": "parr-rabbitmq", + "QueueName": "parr-template-generator", + "User": "template_generator_reader", + "Password": "Jy7vsoygcl7e0:Qy" } - }, - "MqSettings": { - "HostName": "parr-rabbitmq", - "QueueName": "parr-template-generator", - "User": "template_generator_reader", - "Password": "Jy7vsoygcl7e0:Qy" - } } diff --git a/PARR.TemplateMatcherWorker/appsettings.json b/PARR.TemplateMatcherWorker/appsettings.json index 9e75ba0d..25ea572d 100644 --- a/PARR.TemplateMatcherWorker/appsettings.json +++ b/PARR.TemplateMatcherWorker/appsettings.json @@ -3,11 +3,21 @@ "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;", "RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs" }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.AspNetCore": "Warning" + } + }, "Serilog": { "MinimumLevel": { "Default": "Information", "Override": { "Microsoft": "Warning", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", "Microsoft.Hosting.Lifetime": "Information" } } diff --git a/PARR.TemplateTaskGeneratorWorker/appsettings.json b/PARR.TemplateTaskGeneratorWorker/appsettings.json index 350034d9..afa05c72 100644 --- a/PARR.TemplateTaskGeneratorWorker/appsettings.json +++ b/PARR.TemplateTaskGeneratorWorker/appsettings.json @@ -1,36 +1,40 @@ { - "ConnectionStrings": { - "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;", - "RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs" - }, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "Serilog": { - "MinimumLevel": { - "Default": "Information", - "Override": { - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - } - }, - "MqSettings": { - "TemplateTaskGenerator": { - "HostName": "parr-rabbitmq", - "QueueName": "parr-template-task-generator", - "User": "template_task_generator_reader", - "Password": "wzqj$Z@3:poz@oot" + "ConnectionStrings": { + "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;", + "RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs" }, - "TemplateGeneratorWorker": { - "HostName": "parr-rabbitmq", - "QueueName": "parr-template-generator", - "User": "template_generator_writer", - "Password": "B;6h+yF$zQ0OSkLX" - } + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.AspNetCore": "Warning" + } + }, + "Serilog": { + "MinimumLevel": { + "Default": "Information", + "Override": { + "Microsoft": "Warning", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } + }, + "MqSettings": { + "TemplateTaskGenerator": { + "HostName": "parr-rabbitmq", + "QueueName": "parr-template-task-generator", + "User": "template_task_generator_reader", + "Password": "wzqj$Z@3:poz@oot" + }, + "TemplateGeneratorWorker": { + "HostName": "parr-rabbitmq", + "QueueName": "parr-template-generator", + "User": "template_generator_writer", + "Password": "B;6h+yF$zQ0OSkLX" + } - } + } } \ No newline at end of file diff --git a/PARR.TemplateUpdaterWorker/appsettings.json b/PARR.TemplateUpdaterWorker/appsettings.json index e2addf2c..4f92d438 100644 --- a/PARR.TemplateUpdaterWorker/appsettings.json +++ b/PARR.TemplateUpdaterWorker/appsettings.json @@ -1,28 +1,32 @@ { - "ConnectionStrings": { - "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;" - }, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.Hosting.Lifetime": "Information" + "ConnectionStrings": { + "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.AspNetCore": "Warning" + } + }, + "Serilog": { + "MinimumLevel": { + "Default": "Information", + "Override": { + "Microsoft": "Warning", + "Microsoft.EntityFrameworkCore": "Error", + "Microsoft.EntityFrameworkCore.Database.Command": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } + }, + "MqSettings": { + "TemplatesUpdater": { + "HostName": "parr-rabbitmq", + "QueueName": "parr-template-updater", + "User": "template_updater_reader", + "Password": "JfdsfUFJJh2255&*&F1" + } } - }, - "Serilog": { - "MinimumLevel": { - "Default": "Information", - "Override": { - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - } - }, - "MqSettings": { - "TemplatesUpdater": { - "HostName": "parr-rabbitmq", - "QueueName": "parr-template-updater", - "User": "template_updater_reader", - "Password": "JfdsfUFJJh2255&*&F1" - } - } }