feat(templateMatcher): Рефакторинг, основной метод синхронизации GroupedTemplateSynchronizer разбит на отдельные классы; Неиспользуемые шаблоны теперь привязываются к ЭК КОСМПЛЕКСЫ-[ЗО].

This commit is contained in:
Mikhail Kuznetsov
2026-05-14 16:47:27 +10:00
parent f7a74d315a
commit 90e6352117
30 changed files with 1150 additions and 864 deletions

View File

@@ -1,50 +0,0 @@
using PARR.Domain.Entities.Base.History;
namespace PARR.Domain.Common.Rabbit.Messages
{
/// <summary>
/// Модель в MQ, запрос на генерацию шаблона
/// </summary>
public class GeneratorTemplateMq
{
/// <summary>
/// Id работы
/// </summary>
public Guid WorkId { get; set; }
/// <summary>
/// Id приложения
/// </summary>
public Guid ApplicationId { get; set; }
/// <summary>
/// Действие: create, deactivate
/// </summary>
public required string Action { get; set; }
/// <summary>
/// ЭК, принимает регулярное выражение. Например: *, ВРТ-*-ДВС
/// </summary>
public required string Ek { get; set; }
/// <summary>
/// Статус ЭК. Допустимые значения: 0 - все статусы, 1,2,3,4,5,6,7,9
/// </summary>
public int StatusEk { get; set; }
/// <summary>
/// Активировать шаблон
/// </summary>
public bool? IsActiveTemplate { get; set; }
/// <summary>
/// Активировать расписание
/// </summary>
public bool? IsActiveSchedule { get; set; }
/// <summary>
/// Инициатор запроса к генератору
/// </summary>
public HistoryInitiator? HistoryInitiator { get; set; }
}
}

View File

@@ -1,46 +1,46 @@
using PARR.Domain.Entities.Base.History;
namespace PARR.Domain.Common.Rabbit.Messages
namespace PARR.Domain.Common.Rabbit.Messages.TemplateMatching
{
/// <summary>
/// Модель в MQ, простого создания Template
/// </summary>
public class TemplateGeneratorMq
public record TemplateGeneratorMessage
{
/// <summary>
/// Id регламентной работы
/// </summary>
public Guid JobId { get; set; }
public Guid JobId { get; init; }
/// <summary>
/// Id Юнита(единицы обслуживания)/ЭК
/// </summary>
public Guid UnitId { get; set; }
public Guid UnitId { get; init; }
/// <summary>
/// Актировать шаблон при инициализации
/// </summary>
public bool? IsActiveTemplate { get; set; }
public bool? IsActiveTemplate { get; init; }
/// <summary>
/// Актировать расписание при инициализации
/// </summary>
public bool? IsActiveSchedule { get; set; }
public bool? IsActiveSchedule { get; init; }
/// <summary>
/// Инициатор запроса к генератору
/// </summary>
public HistoryInitiator? HistoryInitiator { get; set; }
public HistoryInitiator? HistoryInitiator { get; init; }
/// <summary>
/// Связанные ЭК для сгруппированного типа JobGroup
/// </summary>
public required List<Guid> UnitsInTemplate { get; set; }
public required List<UnitInTemplateMessage> UnitsInTemplate { get; init; }
/// <summary>
/// Индекс, используется в групповых шаблонах
/// </summary>
public int? Index { get; set; }
public int? Index { get; init; }
}
}

View File

@@ -1,58 +1,60 @@
using PARR.Domain.Entities.Base.History;
using PARR.Domain.Enums;
namespace PARR.Domain.Common.Rabbit.Messages
namespace PARR.Domain.Common.Rabbit.Messages.TemplateMatching
{
public class TemplateUpdaterMq
public record TemplateUpdaterMessage
{
public Guid TemplateId { get; set; }
public Guid TemplateId { get; init; }
/// <summary>
/// Id регламентной работы
/// </summary>
public Guid JobId { get; set; }
public Guid JobId { get; init; }
public required string Name { get; set; }
public required string Name { get; init; }
/// <summary>
/// Актировать шаблон при инициализации
/// </summary>
public bool IsActiveTemplate { get; set; }
public bool IsActiveTemplate { get; init; }
/// <summary>
/// Актировать расписание при инициализации
/// </summary>
public bool IsActiveSchedule { get; set; }
public bool IsActiveSchedule { get; init; }
//public DateTimeOffset? LastRun { get; set; }
//public DateTimeOffinit? LastRun { get; init; }
//public DateTimeOffset NextRun { get; set; }
//public DateTimeOffinit NextRun { get; init; }
/// <summary>
/// Это новый шаблон? (true - перемещаем существующий в новый Job) (false - шаблон остается в своем Job)
/// </summary>
public bool IsNew { get; set; }
public bool IsNew { get; init; }
/// <summary>
/// Id Юнита(единицы обслуживания)/ЭК
/// </summary>
public Guid UnitId { get; set; }
public Guid UnitId { get; init; }
/// <summary>
/// Индекс, используется в групповых шаблонах
/// </summary>
public int? Index { get; set; }
public int? Index { get; init; }
public TemplateStatusTypeEnum StatusTypeId { get; set; }
public TemplateStatusTypeEnum StatusTypeId { get; init; }
/// <summary>
/// Инициатор запроса к генератору
/// </summary>
public required HistoryInitiator Initiator { get; set; }
public required HistoryInitiator Initiator { get; init; }
/// <summary>
/// Связанные ЭК для сгруппированного типа JobGroup
/// </summary>
public required List<Guid> UnitsInTemplate { get; set; }
public required List<UnitInTemplateMessage> UnitsInTemplate { get; init; }
}
}

View File

@@ -0,0 +1,15 @@
namespace PARR.Domain.Common.Rabbit.Messages.TemplateMatching
{
public record UnitInTemplateMessage
{
/// <summary>
/// Id ЭК
/// </summary>
public Guid UnitId { get; init; }
/// <summary>
/// Id значения атрибута
/// </summary>
public Guid UnitFieldValueId { get; init; }
}
}

View File

@@ -1,13 +0,0 @@
namespace PARR.Domain.Common.Rabbit.Messages
{
/// <summary>
/// Модель в MQ, генератора заданий на генерацию шаблонов
/// </summary>
public class TemplateTaskGeneratorMq
{
/// <summary>
/// Id регламентной работы
/// </summary>
public Guid JobId { get; set; }
}
}