From ba465f4b26f858a47e2aa67f6dd0023616b72f78 Mon Sep 17 00:00:00 2001 From: Mikhail Kuznetsov Date: Mon, 12 Jan 2026 11:06:47 +1000 Subject: [PATCH] =?UTF-8?q?fix(esppTemplateSyncer):=20=D0=B4=D0=BE=D0=B1?= =?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=20Id=20Group=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=D1=8C=D0=BD=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20=D1=84=D0=BE=D1=80=D0=BC=D0=B8=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=B3=D1=80=D1=83=D0=BF=D0=BF=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D0=B7=D0=BD?= =?UTF-8?q?=D0=B0=D1=87=D0=B5=D0=BD=D0=B8=D0=B9=20=20%=D0=9C=D0=90=D0=9A?= =?UTF-8?q?=D0=A1:...%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Shortcodes/ShortcodesService.cs | 24 +++++++++++++++++++ PARR.EsppSync/SyncService.cs | 1 + .../TemplateGenerator.cs | 1 + 3 files changed, 26 insertions(+) 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 {