diff --git a/AsbCloudApp/Requests/GtrWithGetDataRequest.cs b/AsbCloudApp/Requests/GtrWithGetDataRequest.cs
new file mode 100644
index 00000000..ee2d3969
--- /dev/null
+++ b/AsbCloudApp/Requests/GtrWithGetDataRequest.cs
@@ -0,0 +1,29 @@
+using System;
+
+namespace AsbCloudApp.Requests;
+
+///
+///
+///
+public class GtrWithGetDataRequest
+{
+ ///
+ /// Id
+ ///
+ public int IdWell { get; set; }
+
+ ///
+ /// . : - IntervalSec
+ ///
+ public DateTime? Begin { get; set; }
+
+ ///
+ /// ,
+ ///
+ public int IntervalSec { get; set; } = 600;
+
+ ///
+ /// . , .
+ ///
+ public int ApproxPointsCount { get; set; } = 1024;
+}
\ No newline at end of file
diff --git a/AsbCloudApp/Requests/ReportCreateRequest.cs b/AsbCloudApp/Requests/ReportCreateRequest.cs
new file mode 100644
index 00000000..6b9252db
--- /dev/null
+++ b/AsbCloudApp/Requests/ReportCreateRequest.cs
@@ -0,0 +1,34 @@
+using System;
+
+namespace AsbCloudApp.Requests;
+
+///
+///
+///
+public class ReportCreateRequest
+{
+ ///
+ /// Id
+ ///
+ public int IdWell { get; set; }
+
+ ///
+ ///
+ ///
+ public int StepSeconds { get; set; }
+
+ ///
+ /// (0-PDF, 1-LAS)
+ ///
+ public int Format { get; set; }
+
+ ///
+ ///
+ ///
+ public DateTime Begin { get; set; } = default;
+
+ ///
+ ///
+ ///
+ public DateTime End { get; set; } = default;
+}
\ No newline at end of file
diff --git a/AsbCloudApp/Requests/ReportGetSizeRequest.cs b/AsbCloudApp/Requests/ReportGetSizeRequest.cs
new file mode 100644
index 00000000..356ec1a0
--- /dev/null
+++ b/AsbCloudApp/Requests/ReportGetSizeRequest.cs
@@ -0,0 +1,34 @@
+using System;
+
+namespace AsbCloudApp.Requests;
+
+///
+///
+///
+public class ReportGetSizeRequest
+{
+ ///
+ /// Id
+ ///
+ public int IdWell { get; set; }
+
+ ///
+ ///
+ ///
+ public int StepSeconds { get; set; }
+
+ ///
+ /// (0-PDF, 1-LAS)
+ ///
+ public int Format { get; set; }
+
+ ///
+ ///
+ ///
+ public DateTime Begin { get; set; } = default;
+
+ ///
+ ///
+ ///
+ public DateTime End { get; set; } = default;
+}
\ No newline at end of file
diff --git a/AsbCloudWebApi/Controllers/ReportController.cs b/AsbCloudWebApi/Controllers/ReportController.cs
index 262692a9..740c108d 100644
--- a/AsbCloudWebApi/Controllers/ReportController.cs
+++ b/AsbCloudWebApi/Controllers/ReportController.cs
@@ -3,10 +3,10 @@ using AsbCloudApp.Services;
using AsbCloudWebApi.SignalR;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
-using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
+using AsbCloudApp.Requests;
namespace AsbCloudWebApi.Controllers
{
@@ -34,19 +34,14 @@ namespace AsbCloudWebApi.Controllers
///
/// Создает отчет по скважине с указанными параметрами
///
- /// id скважины
- /// шаг интервала
- /// формат отчета (0-PDF, 1-LAS)
- /// дата начала интервала
- /// дата окончания интервала
+ /// Параметры запроса
/// Токен для отмены задачи
/// id фоновой задачи формирования отчета
[HttpPost]
[Permission]
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
- public async Task CreateReportAsync(int idWell, int stepSeconds, int format,
- CancellationToken token,
- DateTime begin = default, DateTime end = default)
+ public async Task CreateReportAsync(ReportCreateRequest request,
+ CancellationToken token)
{
var idCompany = User.GetCompanyId();
var idUser = User.GetUserId();
@@ -55,7 +50,7 @@ namespace AsbCloudWebApi.Controllers
return Forbid();
if (!await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
- idWell, token).ConfigureAwait(false))
+ request.IdWell, token).ConfigureAwait(false))
return Forbid();
void HandleReportProgressAsync(object progress, string id) =>
@@ -68,8 +63,8 @@ namespace AsbCloudWebApi.Controllers
).ConfigureAwait(false);
}, token);
- var id = reportService.EnqueueCreateReportWork(idWell, (int)idUser,
- stepSeconds, format, begin, end, HandleReportProgressAsync);
+ var id = reportService.EnqueueCreateReportWork(request.IdWell, (int)idUser,
+ request.StepSeconds, request.Format, request.Begin, request.End, HandleReportProgressAsync);
return Ok(id);
}
@@ -102,35 +97,27 @@ namespace AsbCloudWebApi.Controllers
///
/// Возвращает прогнозируемое количество страниц будущего отчета
///
- /// id скважины
- /// дата начала интервала
- /// дата окончания интервала
- /// шаг интервала
- /// формат отчета (0-PDF, 1-LAS)
+ /// Параметры запроса
/// Токен для отмены задачи
/// прогнозируемое кол-во страниц отчета
[HttpGet]
[Route("reportSize")]
[Permission]
[ProducesResponseType(typeof(string), (int)System.Net.HttpStatusCode.OK)]
- public async Task GetReportSizeAsync(int idWell,
- int stepSeconds,
- int format,
- CancellationToken token,
- DateTime begin = default,
- DateTime end = default)
+ public async Task GetReportSizeAsync(ReportGetSizeRequest request,
+ CancellationToken token)
{
int? idCompany = User.GetCompanyId();
if (idCompany is null)
return Forbid();
- if (!await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
- idWell, token).ConfigureAwait(false))
+ if (!await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
+ request.IdWell, token).ConfigureAwait(false))
return Forbid();
- int reportSize = reportService.GetReportPagesCount(idWell,
- begin, end, stepSeconds, format);
+ int reportSize = reportService.GetReportPagesCount(request.IdWell,
+ request.Begin, request.End, request.StepSeconds, request.Format);
return Ok(reportSize);
}
diff --git a/AsbCloudWebApi/Controllers/SAUB/GtrWitsController.cs b/AsbCloudWebApi/Controllers/SAUB/GtrWitsController.cs
index 6c6a57c0..1c885a37 100644
--- a/AsbCloudWebApi/Controllers/SAUB/GtrWitsController.cs
+++ b/AsbCloudWebApi/Controllers/SAUB/GtrWitsController.cs
@@ -4,10 +4,10 @@ using AsbCloudApp.Services;
using AsbCloudWebApi.SignalR;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
-using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
+using AsbCloudApp.Requests;
namespace AsbCloudWebApi.Controllers.SAUB
{
@@ -39,16 +39,13 @@ namespace AsbCloudWebApi.Controllers.SAUB
///
/// Получить загруженные данные ГТИ по скважине
///
- /// id скважины
- /// дата начала выборки.По умолчанию: текущее время - intervalSec
- /// интервал времени даты начала выборки, секунды
- /// желаемое количество точек. Если в выборке точек будет больше, то выборка будет прорежена.
- /// Токен завершения задачи
+ /// Параметры запроса
+ /// Токен завершения задачи
///
[HttpGet("{idWell}")]
[Permission]
- public async Task>> GetDataAsync(int idWell, DateTime? begin,
- CancellationToken token, int intervalSec = 600, int approxPointsCount = 1024)
+ public async Task>> GetDataAsync(GtrWithGetDataRequest request,
+ CancellationToken token)
{
int? idCompany = User.GetCompanyId();
@@ -56,13 +53,13 @@ namespace AsbCloudWebApi.Controllers.SAUB
return Forbid();
bool isCompanyOwnsWell = await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
- idWell, token).ConfigureAwait(false);
+ request.IdWell, token).ConfigureAwait(false);
if (!isCompanyOwnsWell)
return Forbid();
- var content = await gtrRepository.GetAsync(idWell, begin,
- intervalSec, approxPointsCount, token).ConfigureAwait(false);
+ var content = await gtrRepository.GetAsync(request.IdWell, request.Begin,
+ request.IntervalSec, request.ApproxPointsCount, token).ConfigureAwait(false);
return Ok(content);
}
diff --git a/AsbCloudWebApi/Controllers/SAUB/TelemetryDataBaseController.cs b/AsbCloudWebApi/Controllers/SAUB/TelemetryDataBaseController.cs
index 76783bda..9d0e1b8f 100644
--- a/AsbCloudWebApi/Controllers/SAUB/TelemetryDataBaseController.cs
+++ b/AsbCloudWebApi/Controllers/SAUB/TelemetryDataBaseController.cs
@@ -72,10 +72,12 @@ namespace AsbCloudWebApi.Controllers.SAUB
///
[HttpGet("{idWell}")]
[Permission]
- public virtual async Task>> GetDataAsync(int idWell, CancellationToken token,
+ public virtual async Task>> GetDataAsync(int idWell,
DateTime begin = default,
int intervalSec = 600,
- int approxPointsCount = 1024)
+ int approxPointsCount = 1024,
+ //TODO: сделать cancellationToken обязательным
+ CancellationToken token = default)
{
int? idCompany = User.GetCompanyId();