2023-04-07 04:51:30 +05:00
|
|
|
|
using AsbCloudApp.Data.GTR;
|
|
|
|
|
using AsbCloudApp.Repositories;
|
|
|
|
|
using AsbCloudApp.Services;
|
|
|
|
|
using AsbCloudDb.Model;
|
|
|
|
|
using AsbCloudWebApi.SignalR;
|
|
|
|
|
using Microsoft.AspNetCore.Http;
|
2023-03-31 11:10:16 +05:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2023-04-07 04:51:30 +05:00
|
|
|
|
using Microsoft.AspNetCore.SignalR;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
2023-03-31 11:10:16 +05:00
|
|
|
|
|
|
|
|
|
namespace AsbCloudWebApi.Controllers.GTR
|
|
|
|
|
{
|
|
|
|
|
[Route("api/[controller]")]
|
|
|
|
|
[ApiController]
|
|
|
|
|
public class GtrWitsController : ControllerBase
|
2023-04-07 05:32:03 +05:00
|
|
|
|
|
2023-03-31 11:10:16 +05:00
|
|
|
|
{
|
2023-04-07 04:51:30 +05:00
|
|
|
|
protected readonly IWellService wellService;
|
|
|
|
|
private readonly ITelemetryService telemetryService;
|
2023-04-07 05:32:03 +05:00
|
|
|
|
//private readonly IGtrRepository<float> gtrRepository;
|
2023-04-07 04:51:30 +05:00
|
|
|
|
private readonly IHubContext<TelemetryHub> telemetryHubContext;
|
|
|
|
|
|
|
|
|
|
//public string SirnalRMethodGetDataName { get; protected set; } = "ReceiveData";
|
|
|
|
|
|
|
|
|
|
public GtrWitsController(
|
|
|
|
|
ITelemetryService telemetryService,
|
2023-04-07 05:32:03 +05:00
|
|
|
|
// IGtrRepository<float> gtrRepository,
|
2023-04-07 04:51:30 +05:00
|
|
|
|
IWellService wellService,
|
|
|
|
|
IHubContext<TelemetryHub> telemetryHubContext)
|
|
|
|
|
{
|
|
|
|
|
this.telemetryService = telemetryService;
|
2023-04-07 05:32:03 +05:00
|
|
|
|
//this.gtrRepository = gtrRepository;
|
2023-04-07 04:51:30 +05:00
|
|
|
|
this.wellService = wellService;
|
|
|
|
|
this.telemetryHubContext = telemetryHubContext;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Возвращает данные САУБ по скважине.
|
|
|
|
|
/// По умолчанию за последние 10 минут.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idWell">id скважины</param>
|
|
|
|
|
/// <param name="begin">дата начала выборки. По умолчанию: текущее время - intervalSec</param>
|
|
|
|
|
/// <param name="intervalSec">интервал времени даты начала выборки, секунды</param>
|
|
|
|
|
/// <param name="approxPointsCount">желаемое количество точек. Если в выборке точек будет больше, то выборка будет прорежена.</param>
|
|
|
|
|
/// <param name="token">Токен завершения задачи</param>
|
|
|
|
|
/// <returns></returns>
|
2023-04-07 05:32:03 +05:00
|
|
|
|
//[HttpGet("{idWell}")]
|
|
|
|
|
////[Permission]
|
|
|
|
|
//public async Task<ActionResult<IEnumerable<WitsRecordDto>>> GetDataAsync(int idWell, DateTime begin = default,
|
|
|
|
|
// int intervalSec = 600, int approxPointsCount = 1024, CancellationToken token = default)
|
|
|
|
|
//{
|
|
|
|
|
// //int? idCompany = User.GetCompanyId();
|
2023-04-07 04:51:30 +05:00
|
|
|
|
|
2023-04-07 05:32:03 +05:00
|
|
|
|
// //if (idCompany is null)
|
|
|
|
|
// // return Forbid();
|
2023-04-07 04:51:30 +05:00
|
|
|
|
|
2023-04-07 05:32:03 +05:00
|
|
|
|
// //bool isCompanyOwnsWell = await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
|
|
|
|
|
// // idWell, token).ConfigureAwait(false);
|
2023-04-07 04:51:30 +05:00
|
|
|
|
|
2023-04-07 05:32:03 +05:00
|
|
|
|
// //if (!isCompanyOwnsWell)
|
|
|
|
|
// // return Forbid();
|
2023-04-07 04:51:30 +05:00
|
|
|
|
|
2023-04-07 05:32:03 +05:00
|
|
|
|
// //var content = await gtrRepository.GetAsync(idWell, begin,
|
|
|
|
|
// // intervalSec, approxPointsCount, token).ConfigureAwait(false);
|
2023-04-07 04:51:30 +05:00
|
|
|
|
|
2023-04-07 05:32:03 +05:00
|
|
|
|
// //return Ok(content);
|
|
|
|
|
//}
|
2023-03-31 11:10:16 +05:00
|
|
|
|
}
|
|
|
|
|
}
|