Заменены "Hours" на "Seconds" в именах Unix timestamp параметров.

This commit is contained in:
KharchenkoVV 2021-07-20 11:50:35 +05:00
parent 28c42da58a
commit 1dadc96882
2 changed files with 17 additions and 17 deletions

View File

@ -59,9 +59,9 @@ namespace AsbCloudInfrastructure.Services
}
public IEnumerable<WellDepthToIntervalDto> GetWellDepthToInterval(int wellId,
int intervalHoursTimestamp, int workBeginTimestamp)
int intervalSeconds, int workBeginSeconds)
{
intervalHoursTimestamp = intervalHoursTimestamp == 0 ? 86400 : intervalHoursTimestamp;
intervalSeconds = intervalSeconds == 0 ? 86400 : intervalSeconds;
var telemetry = telemetryService.GetTelemetryByWellId(wellId);
@ -70,13 +70,13 @@ namespace AsbCloudInfrastructure.Services
var timezoneOffset = telemetryService.GetTimezoneOffsetByTelemetryId(telemetry.Id);
var drillingPeriodsInfo = db.GetDepthToInterval(telemetry.Id, intervalHoursTimestamp,
workBeginTimestamp, timezoneOffset);
var drillingPeriodsInfo = db.GetDepthToInterval(telemetry.Id, intervalSeconds,
workBeginSeconds, timezoneOffset);
var wellDepthToIntervalData = drillingPeriodsInfo.Select(d => new WellDepthToIntervalDto
{
IntervalStartDate = d.BeginPeriodDate,
IntervalDepthProgress = (d.MaxDepth - d.MinDepth) ?? 0.0 / intervalHoursTimestamp
IntervalDepthProgress = (d.MaxDepth - d.MinDepth) ?? 0.0 / intervalSeconds
}).OrderBy(d => d.IntervalStartDate).ToList();
return wellDepthToIntervalData;
@ -110,9 +110,9 @@ namespace AsbCloudInfrastructure.Services
}
public IEnumerable<OperationInfoDto> GetOperationsToInterval(int wellId,
int intervalHoursTimestamp, int workBeginTimestamp)
int intervalSeconds, int workBeginSeconds)
{
intervalHoursTimestamp = intervalHoursTimestamp == 0 ? 86400 : intervalHoursTimestamp;
intervalSeconds = intervalSeconds == 0 ? 86400 : intervalSeconds;
var telemetry = telemetryService.GetTelemetryByWellId(wellId);
@ -126,7 +126,7 @@ namespace AsbCloudInfrastructure.Services
a.IdOperation != null
join o in db.Operations on a.IdOperation equals o.Id
group a by new {
Interval = Math.Floor((a.UnixDate - workBeginTimestamp + timezoneOffset) / intervalHoursTimestamp),
Interval = Math.Floor((a.UnixDate - workBeginSeconds + timezoneOffset) / intervalSeconds),
OperationId = a.IdOperation,
o.Name } into g
select new

View File

@ -49,22 +49,22 @@ namespace AsbCloudWebApi.Controllers
/// Возвращает данные по глубине скважины за период
/// </summary>
/// <param name="wellId">id скважины</param>
/// <param name="intervalHoursTimestamp">количество секунд в необходимом интервале времени</param>
/// <param name="workBeginTimestamp">количество секунд в времени начала смены</param>
/// <param name="intervalSeconds">количество секунд в необходимом интервале времени</param>
/// <param name="workBeginSeconds">количество секунд в времени начала смены</param>
/// <returns>Коллекцию данных по глубине скважины за период</returns>
[HttpGet]
[Route("{wellId}/wellDepthToInterval")]
[ProducesResponseType(typeof(IEnumerable<WellDepthToIntervalDto>), (int)System.Net.HttpStatusCode.OK)]
public IActionResult GetWellDepthToInterval(int wellId,
int intervalHoursTimestamp, int workBeginTimestamp)
int intervalSeconds, int workBeginSeconds)
{
int? idCustomer = User.GetCustomerId();
if (idCustomer is null || !wellService.CheckWellOwnership((int)idCustomer, wellId))
return Forbid();
var wellDepthToIntervalData = analyticsService.GetWellDepthToInterval(wellId,
intervalHoursTimestamp, workBeginTimestamp);
var wellDepthToIntervalData = analyticsService.GetWellDepthToInterval(wellId,
intervalSeconds, workBeginSeconds);
if (wellDepthToIntervalData is null || !wellDepthToIntervalData.Any())
return NoContent();
@ -101,22 +101,22 @@ namespace AsbCloudWebApi.Controllers
/// Возвращает детальные данные по операциям на скважине за период
/// </summary>
/// <param name="wellId">id скважины</param>
/// <param name="intervalHoursTimestamp">количество секунд в необходимом интервале времени</param>
/// <param name="workBeginTimestamp">количество секунд в времени начала смены</param>
/// <param name="intervalSeconds">количество секунд в необходимом интервале времени</param>
/// <param name="workBeginSeconds">количество секунд в времени начала смены</param>
/// <returns>Коллекцию операций на скважине</returns>
[HttpGet]
[Route("{wellId}/operationsToInterval")]
[ProducesResponseType(typeof(IEnumerable<OperationDurationDto>), (int)System.Net.HttpStatusCode.OK)]
public IActionResult GetOperationsToInterval(int wellId,
int intervalHoursTimestamp, int workBeginTimestamp)
int intervalSeconds, int workBeginSeconds)
{
int? idCustomer = User.GetCustomerId();
if (idCustomer is null || !wellService.CheckWellOwnership((int)idCustomer, wellId))
return Forbid();
var analytics = analyticsService.GetOperationsToInterval(wellId, intervalHoursTimestamp, workBeginTimestamp);
var analytics = analyticsService.GetOperationsToInterval(wellId, intervalSeconds, workBeginSeconds);
if (analytics is null || !analytics.Any())
return NoContent();