diff --git a/AsbCloudApp/Requests/GtrWithGetDataRequest.cs b/AsbCloudApp/Requests/GtrWithGetDataRequest.cs
index ee2d3969..8e93a02c 100644
--- a/AsbCloudApp/Requests/GtrWithGetDataRequest.cs
+++ b/AsbCloudApp/Requests/GtrWithGetDataRequest.cs
@@ -3,27 +3,22 @@ using System;
namespace AsbCloudApp.Requests;
///
-///
+/// Параметры запроса для получения загруженных данных ГТИ по скважине
///
public class GtrWithGetDataRequest
{
///
- /// Id
- ///
- public int IdWell { get; set; }
-
- ///
- /// . : - IntervalSec
+ /// Дата начала выборки.По умолчанию: текущее время - 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
deleted file mode 100644
index 6b9252db..00000000
--- a/AsbCloudApp/Requests/ReportCreateRequest.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-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
deleted file mode 100644
index 356ec1a0..00000000
--- a/AsbCloudApp/Requests/ReportGetSizeRequest.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-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/AsbCloudApp/Requests/ReportParametersRequest.cs b/AsbCloudApp/Requests/ReportParametersRequest.cs
new file mode 100644
index 00000000..d01259d4
--- /dev/null
+++ b/AsbCloudApp/Requests/ReportParametersRequest.cs
@@ -0,0 +1,29 @@
+using System;
+
+namespace AsbCloudApp.Requests;
+
+///
+/// Параметры для создания отчёта и получения прогнозируемого количества страниц будущего отчета
+///
+public class ReportParametersRequest
+{
+ ///
+ /// Шаг интервала
+ ///
+ 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 740c108d..c20db17b 100644
--- a/AsbCloudWebApi/Controllers/ReportController.cs
+++ b/AsbCloudWebApi/Controllers/ReportController.cs
@@ -4,6 +4,7 @@ using AsbCloudWebApi.SignalR;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Requests;
@@ -34,13 +35,15 @@ namespace AsbCloudWebApi.Controllers
///
/// Создает отчет по скважине с указанными параметрами
///
+ /// Id скважины
/// Параметры запроса
/// Токен для отмены задачи
/// id фоновой задачи формирования отчета
[HttpPost]
[Permission]
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
- public async Task CreateReportAsync(ReportCreateRequest request,
+ public async Task CreateReportAsync([Required] int idWell,
+ [FromQuery] ReportParametersRequest request,
CancellationToken token)
{
var idCompany = User.GetCompanyId();
@@ -49,8 +52,8 @@ namespace AsbCloudWebApi.Controllers
if ((idCompany is null) || (idUser is null))
return Forbid();
- if (!await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
- request.IdWell, token).ConfigureAwait(false))
+ if (!await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
+ idWell, token).ConfigureAwait(false))
return Forbid();
void HandleReportProgressAsync(object progress, string id) =>
@@ -63,7 +66,7 @@ namespace AsbCloudWebApi.Controllers
).ConfigureAwait(false);
}, token);
- var id = reportService.EnqueueCreateReportWork(request.IdWell, (int)idUser,
+ var id = reportService.EnqueueCreateReportWork(idWell, (int)idUser,
request.StepSeconds, request.Format, request.Begin, request.End, HandleReportProgressAsync);
return Ok(id);
@@ -97,6 +100,7 @@ namespace AsbCloudWebApi.Controllers
///
/// Возвращает прогнозируемое количество страниц будущего отчета
///
+ /// Id скважины
/// Параметры запроса
/// Токен для отмены задачи
/// прогнозируемое кол-во страниц отчета
@@ -104,7 +108,8 @@ namespace AsbCloudWebApi.Controllers
[Route("reportSize")]
[Permission]
[ProducesResponseType(typeof(string), (int)System.Net.HttpStatusCode.OK)]
- public async Task GetReportSizeAsync(ReportGetSizeRequest request,
+ public async Task GetReportSizeAsync([Required] int idWell,
+ [FromQuery] ReportParametersRequest request,
CancellationToken token)
{
int? idCompany = User.GetCompanyId();
@@ -113,10 +118,10 @@ namespace AsbCloudWebApi.Controllers
return Forbid();
if (!await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
- request.IdWell, token).ConfigureAwait(false))
+ idWell, token).ConfigureAwait(false))
return Forbid();
-
- int reportSize = reportService.GetReportPagesCount(request.IdWell,
+
+ int reportSize = reportService.GetReportPagesCount(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 1c885a37..aab78cd3 100644
--- a/AsbCloudWebApi/Controllers/SAUB/GtrWitsController.cs
+++ b/AsbCloudWebApi/Controllers/SAUB/GtrWitsController.cs
@@ -5,6 +5,7 @@ using AsbCloudWebApi.SignalR;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Requests;
@@ -39,12 +40,14 @@ namespace AsbCloudWebApi.Controllers.SAUB
///
/// Получить загруженные данные ГТИ по скважине
///
+ /// Id скважины
/// Параметры запроса
/// Токен завершения задачи
///
[HttpGet("{idWell}")]
[Permission]
- public async Task>> GetDataAsync(GtrWithGetDataRequest request,
+ public async Task>> GetDataAsync([Required] int idWell,
+ [FromQuery] GtrWithGetDataRequest request,
CancellationToken token)
{
int? idCompany = User.GetCompanyId();
@@ -53,12 +56,12 @@ namespace AsbCloudWebApi.Controllers.SAUB
return Forbid();
bool isCompanyOwnsWell = await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
- request.IdWell, token).ConfigureAwait(false);
+ idWell, token).ConfigureAwait(false);
if (!isCompanyOwnsWell)
return Forbid();
- var content = await gtrRepository.GetAsync(request.IdWell, request.Begin,
+ var content = await gtrRepository.GetAsync(idWell, request.Begin,
request.IntervalSec, request.ApproxPointsCount, token).ConfigureAwait(false);
return Ok(content);