Add supply contracts page
This commit is contained in:
@ -0,0 +1,27 @@
|
|||||||
|
using Hcs.WebApp.Data.Hcs;
|
||||||
|
|
||||||
|
namespace Hcs.WebApp.BackgroundServices.CampaignManagers
|
||||||
|
{
|
||||||
|
public class ExportSupplyContractsManager_15_7_0_1(
|
||||||
|
IServiceScopeFactory scopeFactory,
|
||||||
|
OperationExecutionState operationExecutionState,
|
||||||
|
ResultGetState resultGetState,
|
||||||
|
DataParsingState dataParsingState,
|
||||||
|
Campaign campaign) : ManagerBase(scopeFactory, operationExecutionState, resultGetState, dataParsingState, campaign)
|
||||||
|
{
|
||||||
|
private enum Step
|
||||||
|
{
|
||||||
|
Start = 0,
|
||||||
|
ExecutionWait = 1,
|
||||||
|
ResultWait = 2,
|
||||||
|
End = 3
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override int StepCount => Enum.GetValues(typeof(Step)).Length;
|
||||||
|
|
||||||
|
public override async Task ProcessAsync()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -15,7 +15,8 @@ namespace Hcs.WebApp.BackgroundServices.CampaignManagers
|
|||||||
{
|
{
|
||||||
Campaign.CampaignType.ExportPrivateRegistryElements_15_7_0_1 => typeof(ExportPrivateRegistryElementsManager_15_7_0_1),
|
Campaign.CampaignType.ExportPrivateRegistryElements_15_7_0_1 => typeof(ExportPrivateRegistryElementsManager_15_7_0_1),
|
||||||
Campaign.CampaignType.ExportCommonRegistryElements_15_7_0_1 => typeof(ExportCommonRegistryElementsManager_15_7_0_1),
|
Campaign.CampaignType.ExportCommonRegistryElements_15_7_0_1 => typeof(ExportCommonRegistryElementsManager_15_7_0_1),
|
||||||
Campaign.CampaignType.ParseHousesData_15_7_0_1 => typeof(ParseHousesDataManager_15_7_0_1)
|
Campaign.CampaignType.ParseHousesData_15_7_0_1 => typeof(ParseHousesDataManager_15_7_0_1),
|
||||||
|
Campaign.CampaignType.ExportSupplyContracts_15_7_0_1 => typeof(ExportSupplyContractsManager_15_7_0_1),
|
||||||
};
|
};
|
||||||
var args = new object[] { serviceScopeFactory, operationExecutionState, resultGetState, dataParsingState, campaign };
|
var args = new object[] { serviceScopeFactory, operationExecutionState, resultGetState, dataParsingState, campaign };
|
||||||
var instance = Activator.CreateInstance(type, args);
|
var instance = Activator.CreateInstance(type, args);
|
||||||
|
|||||||
@ -32,6 +32,7 @@
|
|||||||
<RadzenPanelMenuItem Path="/operations" Text="Операции" Icon="construction" />
|
<RadzenPanelMenuItem Path="/operations" Text="Операции" Icon="construction" />
|
||||||
<RadzenPanelMenuItem Text="Объекты" Icon="business_center">
|
<RadzenPanelMenuItem Text="Объекты" Icon="business_center">
|
||||||
<RadzenPanelMenuItem Path="/objects/houses" Text="Жилищный фонд" />
|
<RadzenPanelMenuItem Path="/objects/houses" Text="Жилищный фонд" />
|
||||||
|
<RadzenPanelMenuItem Path="/objects/supply-contracts" Text="Договора ресурсоснабжения" />
|
||||||
</RadzenPanelMenuItem>
|
</RadzenPanelMenuItem>
|
||||||
<RadzenPanelMenuItem Text="Справочники" Icon="book_2">
|
<RadzenPanelMenuItem Text="Справочники" Icon="book_2">
|
||||||
<RadzenPanelMenuItem Path="/registry/common" Text="Общие" />
|
<RadzenPanelMenuItem Path="/registry/common" Text="Общие" />
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
@page "/objects/houses"
|
@page "/objects/houses"
|
||||||
|
|
||||||
@using Hcs.WebApp.Components.Dialogs
|
|
||||||
@using Hcs.WebApp.Services
|
@using Hcs.WebApp.Services
|
||||||
@using Microsoft.AspNetCore.Authorization
|
@using Microsoft.AspNetCore.Authorization
|
||||||
@using System.Security.Claims
|
@using System.Security.Claims
|
||||||
@ -10,7 +9,6 @@
|
|||||||
@attribute [Authorize]
|
@attribute [Authorize]
|
||||||
|
|
||||||
@inject HouseService HouseService
|
@inject HouseService HouseService
|
||||||
@inject DialogService DialogService
|
|
||||||
|
|
||||||
<PageTitle>Жилищный фонд</PageTitle>
|
<PageTitle>Жилищный фонд</PageTitle>
|
||||||
|
|
||||||
|
|||||||
56
Hcs.WebApp/Components/Pages/Objects/SupplyContracts.razor
Normal file
56
Hcs.WebApp/Components/Pages/Objects/SupplyContracts.razor
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
@page "/objects/supply-contracts"
|
||||||
|
|
||||||
|
@using Hcs.WebApp.Services
|
||||||
|
@using Microsoft.AspNetCore.Authorization
|
||||||
|
@using System.Security.Claims
|
||||||
|
|
||||||
|
@inherits SyncedPageBase<SupplyContract>
|
||||||
|
|
||||||
|
@attribute [Authorize]
|
||||||
|
|
||||||
|
@inject SupplyContractService SupplyContractService
|
||||||
|
|
||||||
|
<PageTitle>Договора ресурсоснабжения</PageTitle>
|
||||||
|
|
||||||
|
<AuthorizedContent Roles="@($"{AppRole.ADMINISTRATOR_TYPE},{AppRole.OPERATOR_TYPE}")">
|
||||||
|
<Content>
|
||||||
|
<RadzenStack>
|
||||||
|
<RadzenRow AlignItems="AlignItems.Center">
|
||||||
|
<RadzenColumn Size="12" SizeMD="6">
|
||||||
|
<RadzenText Text="Договора ресурсоснабжения" TextStyle="TextStyle.H5" class="rz-m-0" />
|
||||||
|
</RadzenColumn>
|
||||||
|
<RadzenColumn Size="12" SizeMD="6">
|
||||||
|
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" JustifyContent="JustifyContent.End" Gap="0.5rem">
|
||||||
|
<RadzenButton Icon="sync" Text="@syncButtonText" Disabled="@(state != SyncedPageState.Idle)" Click="@SyncDataAsync" ButtonStyle="ButtonStyle.Primary" />
|
||||||
|
</RadzenStack>
|
||||||
|
</RadzenColumn>
|
||||||
|
</RadzenRow>
|
||||||
|
<RadzenRow>
|
||||||
|
<RadzenColumn SizeMD="12">
|
||||||
|
<RadzenDataGrid TItem="SupplyContract" Data="@data" IsLoading="@(state != SyncedPageState.Idle)" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true">
|
||||||
|
<Columns>
|
||||||
|
<RadzenDataGridColumn TItem="SupplyContract" Property="@nameof(SupplyContract.Id)" Title="ID" SortOrder="SortOrder.Descending" Resizable="false" Width="100px" MaxWidth="100px" />
|
||||||
|
<RadzenDataGridColumn TItem="SupplyContract" Property="@nameof(SupplyContract.HcsId)" Title="ID ГИС ЖКХ" />
|
||||||
|
<RadzenDataGridColumn TItem="SupplyContract" Property="@nameof(SupplyContract.ThirdPartyId)" Title="ID интеграции" />
|
||||||
|
<RadzenDataGridColumn TItem="SupplyContract" Property="@nameof(SupplyContract.SyncedAt)" Title="Дата синхронизации" />
|
||||||
|
</Columns>
|
||||||
|
</RadzenDataGrid>
|
||||||
|
</RadzenColumn>
|
||||||
|
</RadzenRow>
|
||||||
|
</RadzenStack>
|
||||||
|
</Content>
|
||||||
|
</AuthorizedContent>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
protected override Campaign.CampaignType CampaignType => Campaign.CampaignType.ExportSupplyContracts_15_7_0_1;
|
||||||
|
|
||||||
|
protected override bool HasPermission(ClaimsPrincipal user)
|
||||||
|
{
|
||||||
|
return user.IsOperatorOrHigher();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Task<IEnumerable<SupplyContract>> GetDataAsync()
|
||||||
|
{
|
||||||
|
return SupplyContractService.GetAllSupplyContractsAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -16,7 +16,10 @@ namespace Hcs.WebApp.Data.Hcs
|
|||||||
ExportPrivateRegistryElements_15_7_0_1,
|
ExportPrivateRegistryElements_15_7_0_1,
|
||||||
|
|
||||||
[Display(Description = "Парсинг данных домов")]
|
[Display(Description = "Парсинг данных домов")]
|
||||||
ParseHousesData_15_7_0_1
|
ParseHousesData_15_7_0_1,
|
||||||
|
|
||||||
|
[Display(Description = "Экспорт договоров ресурсоснабжения")]
|
||||||
|
ExportSupplyContracts_15_7_0_1,
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|||||||
@ -72,6 +72,7 @@ builder.Services.AddScoped<HeadquartersService>();
|
|||||||
builder.Services.AddScoped<RegistryService>();
|
builder.Services.AddScoped<RegistryService>();
|
||||||
builder.Services.AddScoped<HouseService>();
|
builder.Services.AddScoped<HouseService>();
|
||||||
builder.Services.AddScoped<FileToParseService>();
|
builder.Services.AddScoped<FileToParseService>();
|
||||||
|
builder.Services.AddScoped<SupplyContractService>();
|
||||||
|
|
||||||
builder.Services.AddSingleton<CampaignManagementState>();
|
builder.Services.AddSingleton<CampaignManagementState>();
|
||||||
builder.Services.AddSingleton<OperationExecutionState>();
|
builder.Services.AddSingleton<OperationExecutionState>();
|
||||||
|
|||||||
31
Hcs.WebApp/Services/SupplyContractService.cs
Normal file
31
Hcs.WebApp/Services/SupplyContractService.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
using EFCore.BulkExtensions;
|
||||||
|
using Hcs.WebApp.Data.Hcs;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace Hcs.WebApp.Services
|
||||||
|
{
|
||||||
|
public class SupplyContractService(IDbContextFactory<HcsDbContext> factory) : HcsServiceBase(factory)
|
||||||
|
{
|
||||||
|
public async Task<IEnumerable<SupplyContract>> GetAllSupplyContractsAsync()
|
||||||
|
{
|
||||||
|
using var context = GetNewContext();
|
||||||
|
return await context.SupplyContracts.ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task UpsertSupplyContracts(IEnumerable<SupplyContract> supplyContracts)
|
||||||
|
{
|
||||||
|
using var context = GetNewContext();
|
||||||
|
await context.BulkInsertOrUpdateAsync(supplyContracts, new BulkConfig()
|
||||||
|
{
|
||||||
|
PropertiesToExcludeOnUpdate =
|
||||||
|
[
|
||||||
|
nameof(SupplyContract.ThirdPartyId)
|
||||||
|
],
|
||||||
|
UpdateByProperties =
|
||||||
|
[
|
||||||
|
nameof(SupplyContract.HcsId)
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user