forked from ddrilling/AsbCloudServer
Промежуточная фиксация со структурой ответа
This commit is contained in:
parent
cf8c61c1a7
commit
42e2c57c1b
43
AsbCloudApp/Data/DetectedOperationListDto.cs
Normal file
43
AsbCloudApp/Data/DetectedOperationListDto.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace AsbCloudApp.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Автоматически определяемая операция
|
||||
/// </summary>
|
||||
public class DetectedOperationListDto
|
||||
{
|
||||
public IEnumerable<IGrouping<int, DetectedOperationDto>> test { get; set; }
|
||||
/// <summary>
|
||||
/// Список всех операций
|
||||
/// </summary>
|
||||
public IEnumerable<DetectedOperationDto> List { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Количество по
|
||||
/// </summary>
|
||||
public IDictionary<int,int> Count { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Среднее целевое
|
||||
/// </summary>
|
||||
public IDictionary<int,double> Average { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Коэффициент эффективности
|
||||
/// </summary>
|
||||
public IDictionary<int,double> Efficiency { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Среднее по ключевому показателю
|
||||
/// </summary>
|
||||
public IDictionary<int,double> AverageByParam { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Коэффициент потерь
|
||||
/// </summary>
|
||||
public IDictionary<int,double> Loss { get; set; }
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@ namespace AsbCloudApp.Services
|
||||
public interface IDetectedOperationService
|
||||
{
|
||||
Task<IEnumerable<WellOperationCategoryDto>> GetCategoriesAsync(CancellationToken token);
|
||||
Task<IEnumerable<DetectedOperationDto>> GetAsync(int idWell, Requests.DetectedOperationRequest request, CancellationToken token);
|
||||
Task<DetectedOperationListDto> GetAsync(int idWell, Requests.DetectedOperationRequest request, CancellationToken token);
|
||||
Task<int> DeleteAsync(int idWell, DetectedOperationRequest request, CancellationToken token);
|
||||
}
|
||||
}
|
||||
|
@ -31,12 +31,13 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
|
||||
this.scheduleService = scheduleService;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<DetectedOperationDto>> GetAsync(int idWell, DetectedOperationRequest request, CancellationToken token)
|
||||
public async Task<DetectedOperationListDto> 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<int> DeleteAsync(int idWell, DetectedOperationRequest request, CancellationToken token)
|
||||
|
Loading…
Reference in New Issue
Block a user