Remove ReportService.GetSuitableReportsAsync()

This commit is contained in:
Фролов 2021-12-07 13:55:39 +05:00
parent 498489b231
commit 9a7d2b4140
3 changed files with 3 additions and 71 deletions

View File

@ -14,9 +14,6 @@ namespace AsbCloudApp.Services
Action<object, int> handleReportProgress);
int GetReportPagesCount(int idWell, DateTime begin, DateTime end,
int stepSeconds, int format);
Task<List<ReportPropertiesDto>> GetSuitableReportsAsync(int idWell,
DateTime begin, DateTime end, int stepSeconds, int format,
CancellationToken token);
Task<DatesRangeDto> GetReportsDatesRangeAsync(int idWell, bool isUtc,
CancellationToken token = default);
Task<List<ReportPropertiesDto>> GetAllReportsByWellAsync(int idWell, CancellationToken token);

View File

@ -136,38 +136,6 @@ namespace AsbCloudInfrastructure.Services
return result;
}
public Task<List<ReportPropertiesDto>> GetSuitableReportsAsync(int idWell, DateTime begin, DateTime end, int stepSeconds, int format, CancellationToken token) =>
(from r in db.ReportProperties.Include(r => r.File)
where r.IdWell == idWell
&& r.Begin >= begin
&& r.End <= end
&& r.Step <= stepSeconds
&& r.Format == format
select new ReportPropertiesDto
{
Id = r.Id,
Name = r.File.Name,
File = new FileInfoDto{
Id = r.File.Id,
Author = null,
IdAuthor = r.File.IdAuthor??0,
IdCategory = r.File.IdCategory,
IdWell = r.File.IdWell,
Name = r.File.Name,
Size = r.File.Size,
UploadDate = r.File.UploadDate,
},
IdWell = r.IdWell,
Date = r.File.UploadDate,
Begin = r.Begin,
End = r.End,
Step = r.Step,
Format = r.Format == 0 ? ".pdf" : ".las"
})
.OrderBy(o => o.Date)
.AsNoTracking()
.Take(512).ToListAsync(token);
public Task<List<ReportPropertiesDto>> GetAllReportsByWellAsync(int idWell, CancellationToken token) =>
(from r in db.ReportProperties.Include(r => r.File)
where r.IdWell == idWell

View File

@ -62,9 +62,10 @@ namespace AsbCloudWebApi.Controllers
{
reportsHubContext.Clients.Group($"Report_{id}").SendAsync(
nameof(IReportHubClient.GetReportProgress),
progress
progress,
token
).ConfigureAwait(false);
});
}, token);
var id = reportService.CreateReport(idWell, (int)idUser,
stepSeconds, format, begin, end, HandleReportProgressAsync);
@ -96,40 +97,6 @@ namespace AsbCloudWebApi.Controllers
return Ok(reports);
}
/// <summary>
/// Возвращает имена отчетов, хранящихся на диске,
/// которые подходят под указанные параметры
/// </summary>
/// <param name="idWell">id скважины</param>
/// <param name="stepSeconds">шаг интервала</param>
/// <param name="format">формат отчета (0-PDF, 1-LAS)</param>
/// <param name="begin">дата начала интервала</param>
/// <param name="end">дата окончания интервала</param>
/// <param name="token">Токен для отмены задачи</param>
/// <returns>Список имен существующих отчетов (отчетов)</returns>
[Obsolete]
[HttpGet]
[Route("suitableReports")]
[ProducesResponseType(typeof(IEnumerable<string>), (int)System.Net.HttpStatusCode.OK)]
public async Task<IActionResult> GetSuitableReportsNamesAsync(int idWell, int stepSeconds, int format,
DateTime begin = default, DateTime end = default,
CancellationToken token = default)
{
int? idCompany = User.GetCompanyId();
if (idCompany is null)
return Forbid();
if (!await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
idWell, token).ConfigureAwait(false))
return Forbid();
var suitableReportsNames = await reportService.GetSuitableReportsAsync(idWell,
begin, end, stepSeconds, format, token).ConfigureAwait(false);
return Ok(suitableReportsNames);
}
/// <summary>
/// Возвращает прогнозируемое количество страниц будущего отчета
/// </summary>