diff --git a/PARR.DAL/DomainServices/Shortcodes/ShortcodesService.cs b/PARR.DAL/DomainServices/Shortcodes/ShortcodesService.cs index 47af5297..87e9b8dd 100644 --- a/PARR.DAL/DomainServices/Shortcodes/ShortcodesService.cs +++ b/PARR.DAL/DomainServices/Shortcodes/ShortcodesService.cs @@ -365,6 +365,18 @@ namespace PARR.DAL.DomainServices.Shortcodes private async Task ReplaceMaxShortcodesAsync(Guid jobGroupId, Guid unitId, string input, MatchCollection maxShortcodes) { + if (jobGroupId == Guid.Empty) + { + logger.LogWarning("jobGroupId не задан. Пропускаем обработку %МАКС:...%"); + return input; + } + + if (unitId == Guid.Empty) + { + logger.LogWarning("unitId не задан. Пропускаем обработку %МАКС:...%"); + return input; + } + var shortcodeToMatches = maxShortcodes .Cast() .GroupBy(m => m.Value, StringComparer.OrdinalIgnoreCase) @@ -390,6 +402,18 @@ namespace PARR.DAL.DomainServices.Shortcodes private async Task GetMaxShortCodeFromCacheOrDbAsync(Guid jobGroupId, Guid unitId, string fullShortcode, string fieldName) { + if (jobGroupId == Guid.Empty) + { + logger.LogWarning("jobGroupId не задан. Пропускаем обработку шорткода {Shortcode}", fullShortcode); + return "Нет данных"; + } + + if (unitId == Guid.Empty) + { + logger.LogWarning("unitId не задан. Пропускаем обработку шорткода {Shortcode}", fullShortcode); + return "Нет данных"; + } + var cacheKey = $"gr_shcd_{jobGroupId:N}_{unitId:N}_{ComputeHash(fullShortcode)}"; var cachedData = await cacheService.GetCachedDataAsync(cacheKey); diff --git a/PARR.EsppSync/SyncService.cs b/PARR.EsppSync/SyncService.cs index f5f65a20..5dbb6af7 100644 --- a/PARR.EsppSync/SyncService.cs +++ b/PARR.EsppSync/SyncService.cs @@ -101,6 +101,7 @@ namespace PARR.EsppSync { Group = template.Job.Group == null ? null : new JobGroupForShortcodes { + Id = template.Job.GroupId, GroupingUnitFieldId = template.Job.Group.GroupingUnitFieldId, GroupType = template.Job.Group.GroupType == null ? null : new JobGroupTypeForShortcodes { diff --git a/PARR.TemplateGeneratorWorker/TemplateGenerator.cs b/PARR.TemplateGeneratorWorker/TemplateGenerator.cs index aa0c088a..4a53ee38 100644 --- a/PARR.TemplateGeneratorWorker/TemplateGenerator.cs +++ b/PARR.TemplateGeneratorWorker/TemplateGenerator.cs @@ -90,6 +90,7 @@ namespace PARR.TemplateGeneratorWorker { Group = job.Group == null ? null : new JobGroupForShortcodes { + Id = job.GroupId, GroupingUnitFieldId = job.Group.GroupingUnitFieldId, GroupType = job.Group.GroupType == null ? null : new JobGroupTypeForShortcodes {