feat(api,dal): tbl TemplateStatusType - добавлен новый тип Error. В API добавлен метод просмотра статистики распределения StatTemplateDistributionController

This commit is contained in:
Mikhail Trubnikov
2026-01-26 14:29:47 +10:00
parent f724efb12b
commit 3bae8917a6
14 changed files with 4425 additions and 78 deletions

View File

@@ -70,18 +70,19 @@ namespace PARR.DAL.NextRunServices
var duration = GetDurationDays(jobGroup.DistributionConfig);
var dateStart = GetDateStart(jobGroup.ReferenceDate);
//получаем шаблоны только в статусе Used
var allTemplates = await templateService.Get()
.Include(t => t.Job)
.Where(t => t.Job!.GroupId == jobGroupId)
.Where(t => t.Job!.GroupId == jobGroupId && t.StatusTypeId == TemplateStatusTypeEnum.Used)
.AsNoTracking()
.ToListAsync();
if (!allTemplates.Any())
{
logger.LogInformation("В группе c ИД {jobGroupId} отсутствуют шаблоны", jobGroupId);
logger.LogInformation("В группе c ИД {jobGroupId} отсутствуют шаблоны в статусе Used", jobGroupId);
return null;
}
logger.LogDebug("Всего шаблонов для распределения: {count} шт.", allTemplates.Count);
logger.LogDebug("Всего шаблонов для распределения в статусе Used: {count} шт.", allTemplates.Count);
var result = new List<TemplateNextRunResultDto>();
@@ -258,7 +259,7 @@ namespace PARR.DAL.NextRunServices
/// </summary>
/// <param name="config"></param>
/// <returns></returns>
private int GetDurationDays(JobGroupDistributionConfig config)
public int GetDurationDays(JobGroupDistributionConfig config)
{
var period = config.DistributionPeriod;
var periodType = period!.Type;
@@ -303,5 +304,11 @@ namespace PARR.DAL.NextRunServices
else
return DateOnly.FromDateTime(today.Date);
}
public async Task<List<DateOnly>> GetWorkDaysAsync(DateOnly start, DateOnly end, bool excludeWeekends)
{
return await templateDistributor.GetWorkDaysAsync(start, end, excludeWeekends);
}
}
}