forked from ddrilling/AsbCloudServer
CS2-24: Добавлен Analytics controller.
This commit is contained in:
parent
098b0906f9
commit
7069e8af24
8
AsbCloudApp/Data/OperationPercentageDto.cs
Normal file
8
AsbCloudApp/Data/OperationPercentageDto.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace AsbCloudApp.Data
|
||||
{
|
||||
public class OperationPercentageDto
|
||||
{
|
||||
public string ProcessName { get; set; }
|
||||
public double Percentage { get; set; }
|
||||
}
|
||||
}
|
41
AsbCloudWebApi/Controllers/AnalyticsController.cs
Normal file
41
AsbCloudWebApi/Controllers/AnalyticsController.cs
Normal file
@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using AsbCloudApp.Data;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
[Route("api/analytics")]
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
public class AnalyticsController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Возвращает данные по операциям на скважине за период
|
||||
/// </summary>
|
||||
/// <param name="wellId">id скважины</param>
|
||||
/// <param name="begin">дата начала интервала</param>
|
||||
/// <param name="end">дата окончания интервала</param>
|
||||
/// <returns>Коллекцию операций на скважине</returns>
|
||||
[HttpGet]
|
||||
[Route("{wellId}/get")]
|
||||
[ProducesResponseType(typeof(List<OperationPercentageDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public IActionResult GetAnalytics(int wellId, DateTime begin = default, DateTime end = default)
|
||||
{
|
||||
var analytics = new List<OperationPercentageDto>
|
||||
{
|
||||
new OperationPercentageDto { ProcessName = "Роторное бурение", Percentage = 19.7 },
|
||||
new OperationPercentageDto { ProcessName = "Подъем с проработкой", Percentage = 6.2 },
|
||||
new OperationPercentageDto { ProcessName = "Спуск с проработкой", Percentage = 9.4 },
|
||||
new OperationPercentageDto { ProcessName = "Подъем с промывкой", Percentage = 18.4 },
|
||||
new OperationPercentageDto { ProcessName = "Неподвижное состояние", Percentage = 12.1 },
|
||||
new OperationPercentageDto { ProcessName = "Вращение без циркуляции", Percentage = 7.4 },
|
||||
new OperationPercentageDto { ProcessName = "Спуск в скважину", Percentage = 16.7 },
|
||||
new OperationPercentageDto { ProcessName = "На поверхности", Percentage = 10.1 }
|
||||
};
|
||||
|
||||
return Ok(analytics);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user