DD.WellWorkover.Cloud/AsbCloudWebApi/Controllers/AnalyticsController.cs
2021-06-16 14:47:36 +05:00

42 lines
2.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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