forked from ddrilling/AsbCloudServer
Remove ReportService.GetSuitableReportsAsync()
This commit is contained in:
parent
498489b231
commit
9a7d2b4140
@ -14,9 +14,6 @@ namespace AsbCloudApp.Services
|
|||||||
Action<object, int> handleReportProgress);
|
Action<object, int> handleReportProgress);
|
||||||
int GetReportPagesCount(int idWell, DateTime begin, DateTime end,
|
int GetReportPagesCount(int idWell, DateTime begin, DateTime end,
|
||||||
int stepSeconds, int format);
|
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,
|
Task<DatesRangeDto> GetReportsDatesRangeAsync(int idWell, bool isUtc,
|
||||||
CancellationToken token = default);
|
CancellationToken token = default);
|
||||||
Task<List<ReportPropertiesDto>> GetAllReportsByWellAsync(int idWell, CancellationToken token);
|
Task<List<ReportPropertiesDto>> GetAllReportsByWellAsync(int idWell, CancellationToken token);
|
||||||
|
@ -136,38 +136,6 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
return result;
|
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) =>
|
public Task<List<ReportPropertiesDto>> GetAllReportsByWellAsync(int idWell, CancellationToken token) =>
|
||||||
(from r in db.ReportProperties.Include(r => r.File)
|
(from r in db.ReportProperties.Include(r => r.File)
|
||||||
where r.IdWell == idWell
|
where r.IdWell == idWell
|
||||||
|
@ -62,9 +62,10 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
{
|
{
|
||||||
reportsHubContext.Clients.Group($"Report_{id}").SendAsync(
|
reportsHubContext.Clients.Group($"Report_{id}").SendAsync(
|
||||||
nameof(IReportHubClient.GetReportProgress),
|
nameof(IReportHubClient.GetReportProgress),
|
||||||
progress
|
progress,
|
||||||
|
token
|
||||||
).ConfigureAwait(false);
|
).ConfigureAwait(false);
|
||||||
});
|
}, token);
|
||||||
|
|
||||||
var id = reportService.CreateReport(idWell, (int)idUser,
|
var id = reportService.CreateReport(idWell, (int)idUser,
|
||||||
stepSeconds, format, begin, end, HandleReportProgressAsync);
|
stepSeconds, format, begin, end, HandleReportProgressAsync);
|
||||||
@ -96,40 +97,6 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
return Ok(reports);
|
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>
|
||||||
/// Возвращает прогнозируемое количество страниц будущего отчета
|
/// Возвращает прогнозируемое количество страниц будущего отчета
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user