From 42e2c57c1b0d83bef9aca7d59f8b633bd5bf548a Mon Sep 17 00:00:00 2001 From: Lyudmila Romanova Date: Fri, 10 Jun 2022 11:55:01 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=BC=D0=B5=D0=B6=D1=83?= =?UTF-8?q?=D1=82=D0=BE=D1=87=D0=BD=D0=B0=D1=8F=20=D1=84=D0=B8=D0=BA=D1=81?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F=20=D1=81=D0=BE=20=D1=81=D1=82=D1=80?= =?UTF-8?q?=D1=83=D0=BA=D1=82=D1=83=D1=80=D0=BE=D0=B9=20=D0=BE=D1=82=D0=B2?= =?UTF-8?q?=D0=B5=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudApp/Data/DetectedOperationListDto.cs | 43 +++++++++++++++++++ .../Services/IDetectedOperationService.cs | 2 +- .../DetectedOperationService.cs | 10 ++++- 3 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 AsbCloudApp/Data/DetectedOperationListDto.cs diff --git a/AsbCloudApp/Data/DetectedOperationListDto.cs b/AsbCloudApp/Data/DetectedOperationListDto.cs new file mode 100644 index 00000000..1600c94c --- /dev/null +++ b/AsbCloudApp/Data/DetectedOperationListDto.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace AsbCloudApp.Data +{ + /// + /// Автоматически определяемая операция + /// + public class DetectedOperationListDto + { + public IEnumerable> test { get; set; } + /// + /// Список всех операций + /// + public IEnumerable List { get; set; } + + /// + /// Количество по + /// + public IDictionary Count { get; set; } + + /// + /// Среднее целевое + /// + public IDictionary Average { get; set; } + + /// + /// Коэффициент эффективности + /// + public IDictionary Efficiency { get; set; } + + /// + /// Среднее по ключевому показателю + /// + public IDictionary AverageByParam { get; set; } + + /// + /// Коэффициент потерь + /// + public IDictionary Loss { get; set; } + } +} diff --git a/AsbCloudApp/Services/IDetectedOperationService.cs b/AsbCloudApp/Services/IDetectedOperationService.cs index 143a1379..3b3bccf5 100644 --- a/AsbCloudApp/Services/IDetectedOperationService.cs +++ b/AsbCloudApp/Services/IDetectedOperationService.cs @@ -9,7 +9,7 @@ namespace AsbCloudApp.Services public interface IDetectedOperationService { Task> GetCategoriesAsync(CancellationToken token); - Task> GetAsync(int idWell, Requests.DetectedOperationRequest request, CancellationToken token); + Task GetAsync(int idWell, Requests.DetectedOperationRequest request, CancellationToken token); Task DeleteAsync(int idWell, DetectedOperationRequest request, CancellationToken token); } } diff --git a/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs b/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs index b206434d..e293ae99 100644 --- a/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs +++ b/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs @@ -31,12 +31,13 @@ namespace AsbCloudInfrastructure.Services.DetectOperations this.scheduleService = scheduleService; } - public async Task> GetAsync(int idWell, DetectedOperationRequest request, CancellationToken token) + public async Task GetAsync(int idWell, DetectedOperationRequest request, CancellationToken token) { var well = await wellService.GetAsync(idWell, token); if (well?.IdTelemetry is null || well.Timezone is null) return null; + var res = new DetectedOperationListDto(); var query = BuildQuery(well, request) .AsNoTracking(); @@ -50,7 +51,12 @@ namespace AsbCloudInfrastructure.Services.DetectOperations { item.Driller = await scheduleService.GetDrillerAsync(idWell, item.DateStart); } - return dtos; + res.List = dtos; + res.Count = dtos.GroupBy(o => o.Driller==null?0:o.Driller.Id, + p=>p, + (key,gr)=>(key,gr.Count())).ToDictionary(e=>e.key,e=>e.Item2); + //res.test = g; + return res; } public async Task DeleteAsync(int idWell, DetectedOperationRequest request, CancellationToken token)