forked from ddrilling/AsbCloudServer
nit deleting an outdated tasks
This commit is contained in:
parent
c06712f2f9
commit
464678a3db
@ -22,10 +22,6 @@ namespace AsbCloudApp.Data
|
|||||||
[Range(1, int.MaxValue, ErrorMessage = "Id категории не может быть ниже 1")]
|
[Range(1, int.MaxValue, ErrorMessage = "Id категории не может быть ниже 1")]
|
||||||
public int CategoryId { get; set; }
|
public int CategoryId { get; set; }
|
||||||
|
|
||||||
//TODO: в модели дто сообщения отсутствует поле Id скважины
|
|
||||||
// скорее всего опечатка т.к. используется глубина в правиле валидатора
|
|
||||||
//в других валидаторах парамтр глубины идет рэнжированный от...до
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// глубина забоя, при котором событие возникло
|
/// глубина забоя, при котором событие возникло
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -10,7 +10,6 @@ namespace AsbCloudApp.Services
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IScheduleRepository : IRepositoryWellRelated<ScheduleDto>
|
public interface IScheduleRepository : IRepositoryWellRelated<ScheduleDto>
|
||||||
{
|
{
|
||||||
// TODO: this should be nullable.
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// получить бурильщика по idWell и времени
|
/// получить бурильщика по idWell и времени
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -18,6 +17,6 @@ namespace AsbCloudApp.Services
|
|||||||
/// <param name="workTime"></param>
|
/// <param name="workTime"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<DrillerDto?> GetDrillerAsync(int idWell, DateTime workTime, CancellationToken token);
|
Task<DrillerDto?> GetOrDefaultDrillerAsync(int idWell, DateTime workTime, CancellationToken token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ namespace AsbCloudApp.Services
|
|||||||
/// <param name="approxPointsCount">кол-во элементов до которых эти данные прореживаются</param>
|
/// <param name="approxPointsCount">кол-во элементов до которых эти данные прореживаются</param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<TDto>?> GetOrDefaultAsync(int idWell,
|
Task<IEnumerable<TDto>> GetAsync(int idWell,
|
||||||
DateTime dateBegin = default, double intervalSec = 600d,
|
DateTime dateBegin = default, double intervalSec = 600d,
|
||||||
int approxPointsCount = 1024, CancellationToken token = default);
|
int approxPointsCount = 1024, CancellationToken token = default);
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
this.wellService = wellService;
|
this.wellService = wellService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<DrillerDto?> GetDrillerAsync(int idWell, DateTime workTime, CancellationToken token)
|
public async Task<DrillerDto?> GetOrDefaultDrillerAsync(int idWell, DateTime workTime, CancellationToken token)
|
||||||
{
|
{
|
||||||
var hoursOffset = wellService.GetTimezone(idWell).Hours;
|
var hoursOffset = wellService.GetTimezone(idWell).Hours;
|
||||||
var date = workTime.ToUtcDateTimeOffset(hoursOffset);
|
var date = workTime.ToUtcDateTimeOffset(hoursOffset);
|
||||||
|
@ -86,16 +86,14 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO: It shouldn`t be nullable. Throw exceptions instead and return empty.
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public virtual async Task<IEnumerable<TDto>?> GetOrDefaultAsync(int idWell,
|
public virtual async Task<IEnumerable<TDto>> GetAsync(int idWell,
|
||||||
DateTime dateBegin = default, double intervalSec = 600d,
|
DateTime dateBegin = default, double intervalSec = 600d,
|
||||||
int approxPointsCount = 1024, CancellationToken token = default)
|
int approxPointsCount = 1024, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var telemetry = telemetryService.GetOrDefaultTelemetryByIdWell(idWell);
|
var telemetry = telemetryService.GetOrDefaultTelemetryByIdWell(idWell);
|
||||||
if (telemetry is null)
|
if (telemetry is null)
|
||||||
return null;
|
return Enumerable.Empty<TDto>();
|
||||||
|
|
||||||
var timezone = telemetryService.GetTimezone(telemetry.Id);
|
var timezone = telemetryService.GetTimezone(telemetry.Id);
|
||||||
|
|
||||||
@ -134,7 +132,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
|||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
if (fullDataCount == 0)
|
if (fullDataCount == 0)
|
||||||
return default;
|
return Enumerable.Empty<TDto>();
|
||||||
|
|
||||||
if (fullDataCount > 1.75 * approxPointsCount)
|
if (fullDataCount > 1.75 * approxPointsCount)
|
||||||
{
|
{
|
||||||
|
@ -121,8 +121,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
|||||||
_ => 32_768
|
_ => 32_768
|
||||||
};
|
};
|
||||||
|
|
||||||
var data = await GetOrDefaultAsync(idWell, beginDate, intervalSec, approxPointsCount, token )
|
var data = await GetAsync(idWell, beginDate, intervalSec, approxPointsCount, token );
|
||||||
?? Enumerable.Empty<TelemetryDataSaubDto>();
|
|
||||||
|
|
||||||
var fileName = $"DataSaub idWell{idWell}";
|
var fileName = $"DataSaub idWell{idWell}";
|
||||||
if (telemetry.Info is not null)
|
if (telemetry.Info is not null)
|
||||||
|
@ -35,7 +35,7 @@ namespace AsbCloudWebApi.Tests.Middlware
|
|||||||
|
|
||||||
public class TelemetryDataSaubService : ITelemetryDataSaubService
|
public class TelemetryDataSaubService : ITelemetryDataSaubService
|
||||||
{
|
{
|
||||||
public async Task<IEnumerable<TelemetryDataSaubDto>?> GetOrDefaultAsync(int idWell, DateTime dateBegin = default, double intervalSec = 600, int approxPointsCount = 1024, CancellationToken token = default)
|
public async Task<IEnumerable<TelemetryDataSaubDto>?> GetAsync(int idWell, DateTime dateBegin = default, double intervalSec = 600, int approxPointsCount = 1024, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
await Task.Delay(1000, token);
|
await Task.Delay(1000, token);
|
||||||
return Enumerable.Empty<TelemetryDataSaubDto>();
|
return Enumerable.Empty<TelemetryDataSaubDto>();
|
||||||
|
@ -77,22 +77,17 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("cluster/{idCluster}/stat")] // TODO: Это статистика кластера, перенести в ClusterOperationStatController
|
[Route("cluster/{idCluster}/stat")]
|
||||||
[Permission]
|
[Permission]
|
||||||
[ProducesResponseType(typeof(StatClusterDto), (int)System.Net.HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(StatClusterDto), (int)System.Net.HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> GetStatClusterAsync(int idCluster,
|
public async Task<IActionResult> GetStatClusterAsync(int idCluster,
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
int? idCompanyOrNull = User.GetCompanyId();
|
int? idCompany = User.GetCompanyId();
|
||||||
if (idCompanyOrNull is null)
|
if (idCompany is null)
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
int idCompany = idCompanyOrNull ?? 0;
|
var result = await operationsStatService.GetStatClusterAsync(idCluster, idCompany.Value, token)
|
||||||
// TODO: Fix next commented lines
|
|
||||||
//if (!await CanUserAccessToWellAsync(idCluster, token).ConfigureAwait(false))
|
|
||||||
// return Forbid();
|
|
||||||
|
|
||||||
var result = await operationsStatService.GetStatClusterAsync(idCluster, idCompany, token)
|
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
|||||||
if (!isCompanyOwnsWell)
|
if (!isCompanyOwnsWell)
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
var content = await telemetryDataService.GetOrDefaultAsync(idWell, begin,
|
var content = await telemetryDataService.GetAsync(idWell, begin,
|
||||||
intervalSec, approxPointsCount, token).ConfigureAwait(false);
|
intervalSec, approxPointsCount, token).ConfigureAwait(false);
|
||||||
|
|
||||||
return Ok(content);
|
return Ok(content);
|
||||||
|
@ -8,6 +8,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace AsbCloudWebApi.Controllers
|
namespace AsbCloudWebApi.Controllers
|
||||||
{
|
{
|
||||||
|
#nullable enable
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Расписание бурильщиков
|
/// Расписание бурильщиков
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -32,12 +33,12 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns>бурильщик</returns>
|
/// <returns>бурильщик</returns>
|
||||||
[HttpGet("driller")]
|
[HttpGet("driller")]
|
||||||
public async Task<ActionResult<DrillerDto>> GetDrillerAsync(int idWell, DateTime workTime, CancellationToken token)
|
public async Task<ActionResult<DrillerDto?>> GetDrillerAsync(int idWell, DateTime workTime, CancellationToken token)
|
||||||
{
|
{
|
||||||
if (!await UserHasAccesToWellAsync(idWell, token))
|
if (!await UserHasAccesToWellAsync(idWell, token))
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
var result = await scheduleService.GetDrillerAsync(idWell, workTime, token);
|
var result = await scheduleService.GetOrDefaultDrillerAsync(idWell, workTime, token);
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user