From 562bf5b348fe80e943df8ca0872e0911ebee9cbe Mon Sep 17 00:00:00 2001 From: eugeniy_ivanov Date: Mon, 31 Oct 2022 18:59:08 +0500 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B5=D0=B4=D0=B0=D0=BA=D1=82=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=B5=D1=82?= =?UTF-8?q?=D0=BE=D0=B4=D0=B0=20=D0=B2=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80?= =?UTF-8?q?=D0=BE=D0=BB=D0=BB=D0=B5=D1=80=D0=B5=20=D0=B8=D0=B7=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B8=D0=BD=D1=82=D0=B5=D1=80?= =?UTF-8?q?=D1=84=D0=B5=D0=B9=D1=81=D0=B0=20=D0=BD=D0=B0=D1=80=D0=B0=D0=B1?= =?UTF-8?q?=D0=BE=D1=82=D0=BA=D0=B8=20=D0=BF=D0=BE=D0=B4=D1=81=D0=B8=D1=81?= =?UTF-8?q?=D1=82=D0=B5=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Subsystems/ISubsystemOperationTimeService.cs | 11 ++++++++++- .../Subsystems/SubsystemOperationTimeService.cs | 2 +- .../Subsystems/SubsystemOperationTimeController.cs | 11 ++++++++--- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/AsbCloudApp/Services/Subsystems/ISubsystemOperationTimeService.cs b/AsbCloudApp/Services/Subsystems/ISubsystemOperationTimeService.cs index 62ade194..88fd3cf4 100644 --- a/AsbCloudApp/Services/Subsystems/ISubsystemOperationTimeService.cs +++ b/AsbCloudApp/Services/Subsystems/ISubsystemOperationTimeService.cs @@ -46,7 +46,16 @@ namespace AsbCloudApp.Services.Subsystems /// /// /// - Task GetDateRangeOperationTimeAsync(SubsystemOperationTimeRequest request, CancellationToken token); + Task GetDateRangeOperationTimeAsync(SubsystemOperationTimeRequest request, CancellationToken token); + /// + /// Получение статистики по наработке подсистем по активным скважинам + /// + /// + /// + /// + /// + /// + Task?> GetStatByActiveWell(int idCompany, DateTime? gtDate, DateTime? ltDate, CancellationToken token); } #nullable disable } diff --git a/AsbCloudInfrastructure/Services/Subsystems/SubsystemOperationTimeService.cs b/AsbCloudInfrastructure/Services/Subsystems/SubsystemOperationTimeService.cs index b42e8835..9aa1dd77 100644 --- a/AsbCloudInfrastructure/Services/Subsystems/SubsystemOperationTimeService.cs +++ b/AsbCloudInfrastructure/Services/Subsystems/SubsystemOperationTimeService.cs @@ -187,7 +187,7 @@ namespace AsbCloudInfrastructure.Services.Subsystems private async Task> GetSubsystemOperationTimeAll(int idCompany, CancellationToken token) - { + { var listWell = await wellService.GetWellsByCompanyAsync(idCompany, token); var active = listWell.Where(w => w.IdState == 1); return active; diff --git a/AsbCloudWebApi/Controllers/Subsystems/SubsystemOperationTimeController.cs b/AsbCloudWebApi/Controllers/Subsystems/SubsystemOperationTimeController.cs index e700d470..55b3b26b 100644 --- a/AsbCloudWebApi/Controllers/Subsystems/SubsystemOperationTimeController.cs +++ b/AsbCloudWebApi/Controllers/Subsystems/SubsystemOperationTimeController.cs @@ -52,10 +52,15 @@ namespace AsbCloudWebApi.Controllers.Subsystems [HttpGet("statByActiveWell")] [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] public async Task GetStatByWellAsync([FromQuery] DateTime? GtDate, DateTime? LtDate, CancellationToken token = default) - { + { + var idCompany = User.GetCompanyId(); + if (idCompany.HasValue) + { + var subsystemResult = await subsystemOperationTimeService.GetStatByActiveWell(idCompany.Value, GtDate, LtDate, token); + return Ok(subsystemResult); + } + return Forbid(); - var subsystemResult = await subsystemOperationTimeService.GetStatAsync(request, token); - return Ok(subsystemResult); } ///