fix(esppTemplateSyncer): добавлен Id Group для правильного формирования группированных значений %МАКС:...%
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user