Add supply contracts export executor

This commit is contained in:
2025-11-24 11:17:03 +09:00
parent f798c0c80f
commit 46ff771dd6
8 changed files with 181 additions and 2 deletions

View File

@ -1,4 +1,5 @@
using Hcs.Broker;
using Hcs.WebApp.BackgroundServices.OperationExecutors.HouseManagement;
using Hcs.WebApp.BackgroundServices.OperationExecutors.Nsi;
using Hcs.WebApp.BackgroundServices.OperationExecutors.NsiCommon;
using Hcs.WebApp.Data.Hcs;
@ -13,6 +14,7 @@ namespace Hcs.WebApp.BackgroundServices.OperationExecutors
{
Operation.OperationType.Nsi_ExportNsiItem_15_7_0_1 => new ExportDataProviderNsiItemExecutor_15_7_0_1(client, scope, operation),
Operation.OperationType.NsiCommon_ExportNsiItem_15_7_0_1 => new ExportNsiItemExecutor_15_7_0_1(client, scope, operation),
Operation.OperationType.HouseManagement_ExportSupplyResourceContractData_15_7_0_1 => new ExportSupplyResourceContractDataExecutor_15_7_0_1(client, scope, operation),
Operation.OperationType.ParseHousesData_15_7_0_1 => throw new ArgumentException($"Нельзя использовать операцию с типом {operation.Type} для обращения к ГИС ЖКХ")
};

View File

@ -0,0 +1,13 @@
using Hcs.Broker;
using Hcs.WebApp.Data.Hcs;
namespace Hcs.WebApp.BackgroundServices.OperationExecutors.HouseManagement
{
public class ExportSupplyResourceContractDataExecutor_15_7_0_1(IClient client, IServiceScope scope, Operation operation) : ExecutorBase(client, scope, operation)
{
public override async Task<string> ExecuteAsync(CancellationToken cancellationToken)
{
return await client.HouseManagement.RequestExportSupplyResourceContractDataAsync(operation.ExportGuid, cancellationToken);
}
}
}

View File

@ -14,7 +14,10 @@ namespace Hcs.WebApp.Data.Hcs
Nsi_ExportNsiItem_15_7_0_1,
[Display(Description = "Парсинг данных домов")]
ParseHousesData_15_7_0_1
ParseHousesData_15_7_0_1,
[Display(Description = "Экспорт договоров ресурсоснабжения")]
HouseManagement_ExportSupplyResourceContractData_15_7_0_1,
}
public enum OperationKind
@ -39,6 +42,8 @@ namespace Hcs.WebApp.Data.Hcs
public string? MessageGuid { get; set; }
public string? ExportGuid { get; set; }
public string? FailureReason { get; set; }
public virtual ICollection<Registry> Registries { get; set; } = [];
@ -47,6 +52,8 @@ namespace Hcs.WebApp.Data.Hcs
public virtual ICollection<FileToParse> FilesToParse { get; set; } = [];
public virtual ICollection<SupplyContract> SupplyContracts { get; set; } = [];
[NotMapped]
public bool Completed => EndedAt.HasValue;
@ -54,7 +61,8 @@ namespace Hcs.WebApp.Data.Hcs
public OperationKind Kind => Type switch
{
OperationType.NsiCommon_ExportNsiItem_15_7_0_1 or
OperationType.Nsi_ExportNsiItem_15_7_0_1 => OperationKind.Remote,
OperationType.Nsi_ExportNsiItem_15_7_0_1 or
OperationType.HouseManagement_ExportSupplyResourceContractData_15_7_0_1 => OperationKind.Remote,
OperationType.ParseHousesData_15_7_0_1 => OperationKind.Parse
};