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); } ///