forked from ddrilling/AsbCloudServer
Merge pull request '#27822302, #26881769 Удаление метода из API подсистем' (#202) from feature/subsystems into dev
Reviewed-on: http://test.digitaldrilling.ru:8080/DDrilling/AsbCloudServer/pulls/202
This commit is contained in:
commit
38cbbe4109
@ -19,17 +19,7 @@ public interface ISubsystemService
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<SubsystemStatDto>> GetStatAsync(SubsystemRequest request, CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// Получение статистики по наработке подсистем по активным скважинам
|
||||
/// </summary>
|
||||
/// <param name="idCompany"></param>
|
||||
/// <param name="gtDate"></param>
|
||||
/// <param name="ltDate"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<SubsystemActiveWellStatDto>> GetStatByActiveWells(int idCompany, DateTime? gtDate, DateTime? ltDate, CancellationToken token);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Получение статистики по наработке подсистем по активным скважинам
|
||||
/// </summary>
|
||||
|
@ -71,16 +71,6 @@ internal class SubsystemService : ISubsystemService
|
||||
return stat;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<SubsystemActiveWellStatDto>> GetStatByActiveWells(int idCompany,
|
||||
DateTime? gtDate,
|
||||
DateTime? ltDate,
|
||||
CancellationToken token)
|
||||
{
|
||||
var activeWells = await wellService.GetAsync(new() { IdCompany = idCompany, IdState = 1 }, token);
|
||||
var result = await GetStatAsync(activeWells, gtDate, ltDate, token);
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<SubsystemActiveWellStatDto>> GetStatByActiveWells(IEnumerable<int> wellIds, CancellationToken token)
|
||||
{
|
||||
var activeWells = await wellService.GetAsync(new() { Ids = wellIds, IdState = 1 }, token);
|
||||
|
@ -61,24 +61,6 @@ namespace AsbCloudWebApi.Controllers.Subsystems
|
||||
return Ok(dateRange);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// получить статистику по активным скважинам
|
||||
/// </summary>
|
||||
/// <param name="gtDate"> Больше или равно дате </param>
|
||||
/// <param name="ltDate"> Меньше или равно дате </param>
|
||||
/// <param name="token"> Токен </param>
|
||||
/// <returns> </returns>
|
||||
[HttpGet("statByActiveWell")]
|
||||
[ProducesResponseType(typeof(IEnumerable<SubsystemActiveWellStatDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetStatByWellAsync(DateTime? gtDate, DateTime? ltDate, CancellationToken token)
|
||||
{
|
||||
var idCompany = User.GetCompanyId();
|
||||
if (!idCompany.HasValue)
|
||||
return Forbid();
|
||||
var subsystemResult = await subsystemService.GetStatByActiveWells(idCompany.Value, gtDate, ltDate, token);
|
||||
return Ok(subsystemResult);
|
||||
}
|
||||
|
||||
private async Task<bool> UserHasAccessToWellAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
var idCompany = User.GetCompanyId();
|
||||
|
Loading…
Reference in New Issue
Block a user