fix(esppTemplateSyncer): добавлен Id Group для правильного формирования группированных значений %МАКС:...%

This commit is contained in:
Mikhail Kuznetsov
2026-01-12 11:06:47 +10:00
parent 1d618bb300
commit ba465f4b26
3 changed files with 26 additions and 0 deletions

View File

@@ -365,6 +365,18 @@ namespace PARR.DAL.DomainServices.Shortcodes
private async Task<string> 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<Match>()
.GroupBy(m => m.Value, StringComparer.OrdinalIgnoreCase)
@@ -390,6 +402,18 @@ namespace PARR.DAL.DomainServices.Shortcodes
private async Task<string> 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<CachedGroupedShortCode>(cacheKey);