forked from ddrilling/AsbCloudServer
Заменены "Hours" на "Seconds" в именах Unix timestamp параметров.
This commit is contained in:
parent
28c42da58a
commit
1dadc96882
@ -59,9 +59,9 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<WellDepthToIntervalDto> GetWellDepthToInterval(int wellId,
|
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);
|
var telemetry = telemetryService.GetTelemetryByWellId(wellId);
|
||||||
|
|
||||||
@ -70,13 +70,13 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
|
|
||||||
var timezoneOffset = telemetryService.GetTimezoneOffsetByTelemetryId(telemetry.Id);
|
var timezoneOffset = telemetryService.GetTimezoneOffsetByTelemetryId(telemetry.Id);
|
||||||
|
|
||||||
var drillingPeriodsInfo = db.GetDepthToInterval(telemetry.Id, intervalHoursTimestamp,
|
var drillingPeriodsInfo = db.GetDepthToInterval(telemetry.Id, intervalSeconds,
|
||||||
workBeginTimestamp, timezoneOffset);
|
workBeginSeconds, timezoneOffset);
|
||||||
|
|
||||||
var wellDepthToIntervalData = drillingPeriodsInfo.Select(d => new WellDepthToIntervalDto
|
var wellDepthToIntervalData = drillingPeriodsInfo.Select(d => new WellDepthToIntervalDto
|
||||||
{
|
{
|
||||||
IntervalStartDate = d.BeginPeriodDate,
|
IntervalStartDate = d.BeginPeriodDate,
|
||||||
IntervalDepthProgress = (d.MaxDepth - d.MinDepth) ?? 0.0 / intervalHoursTimestamp
|
IntervalDepthProgress = (d.MaxDepth - d.MinDepth) ?? 0.0 / intervalSeconds
|
||||||
}).OrderBy(d => d.IntervalStartDate).ToList();
|
}).OrderBy(d => d.IntervalStartDate).ToList();
|
||||||
|
|
||||||
return wellDepthToIntervalData;
|
return wellDepthToIntervalData;
|
||||||
@ -110,9 +110,9 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<OperationInfoDto> GetOperationsToInterval(int wellId,
|
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);
|
var telemetry = telemetryService.GetTelemetryByWellId(wellId);
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
a.IdOperation != null
|
a.IdOperation != null
|
||||||
join o in db.Operations on a.IdOperation equals o.Id
|
join o in db.Operations on a.IdOperation equals o.Id
|
||||||
group a by new {
|
group a by new {
|
||||||
Interval = Math.Floor((a.UnixDate - workBeginTimestamp + timezoneOffset) / intervalHoursTimestamp),
|
Interval = Math.Floor((a.UnixDate - workBeginSeconds + timezoneOffset) / intervalSeconds),
|
||||||
OperationId = a.IdOperation,
|
OperationId = a.IdOperation,
|
||||||
o.Name } into g
|
o.Name } into g
|
||||||
select new
|
select new
|
||||||
|
@ -49,14 +49,14 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
/// Возвращает данные по глубине скважины за период
|
/// Возвращает данные по глубине скважины за период
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="wellId">id скважины</param>
|
/// <param name="wellId">id скважины</param>
|
||||||
/// <param name="intervalHoursTimestamp">количество секунд в необходимом интервале времени</param>
|
/// <param name="intervalSeconds">количество секунд в необходимом интервале времени</param>
|
||||||
/// <param name="workBeginTimestamp">количество секунд в времени начала смены</param>
|
/// <param name="workBeginSeconds">количество секунд в времени начала смены</param>
|
||||||
/// <returns>Коллекцию данных по глубине скважины за период</returns>
|
/// <returns>Коллекцию данных по глубине скважины за период</returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("{wellId}/wellDepthToInterval")]
|
[Route("{wellId}/wellDepthToInterval")]
|
||||||
[ProducesResponseType(typeof(IEnumerable<WellDepthToIntervalDto>), (int)System.Net.HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(IEnumerable<WellDepthToIntervalDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||||
public IActionResult GetWellDepthToInterval(int wellId,
|
public IActionResult GetWellDepthToInterval(int wellId,
|
||||||
int intervalHoursTimestamp, int workBeginTimestamp)
|
int intervalSeconds, int workBeginSeconds)
|
||||||
{
|
{
|
||||||
int? idCustomer = User.GetCustomerId();
|
int? idCustomer = User.GetCustomerId();
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
var wellDepthToIntervalData = analyticsService.GetWellDepthToInterval(wellId,
|
var wellDepthToIntervalData = analyticsService.GetWellDepthToInterval(wellId,
|
||||||
intervalHoursTimestamp, workBeginTimestamp);
|
intervalSeconds, workBeginSeconds);
|
||||||
|
|
||||||
if (wellDepthToIntervalData is null || !wellDepthToIntervalData.Any())
|
if (wellDepthToIntervalData is null || !wellDepthToIntervalData.Any())
|
||||||
return NoContent();
|
return NoContent();
|
||||||
@ -101,22 +101,22 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
/// Возвращает детальные данные по операциям на скважине за период
|
/// Возвращает детальные данные по операциям на скважине за период
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="wellId">id скважины</param>
|
/// <param name="wellId">id скважины</param>
|
||||||
/// <param name="intervalHoursTimestamp">количество секунд в необходимом интервале времени</param>
|
/// <param name="intervalSeconds">количество секунд в необходимом интервале времени</param>
|
||||||
/// <param name="workBeginTimestamp">количество секунд в времени начала смены</param>
|
/// <param name="workBeginSeconds">количество секунд в времени начала смены</param>
|
||||||
/// <returns>Коллекцию операций на скважине</returns>
|
/// <returns>Коллекцию операций на скважине</returns>
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("{wellId}/operationsToInterval")]
|
[Route("{wellId}/operationsToInterval")]
|
||||||
[ProducesResponseType(typeof(IEnumerable<OperationDurationDto>), (int)System.Net.HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(IEnumerable<OperationDurationDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||||
public IActionResult GetOperationsToInterval(int wellId,
|
public IActionResult GetOperationsToInterval(int wellId,
|
||||||
int intervalHoursTimestamp, int workBeginTimestamp)
|
int intervalSeconds, int workBeginSeconds)
|
||||||
{
|
{
|
||||||
int? idCustomer = User.GetCustomerId();
|
int? idCustomer = User.GetCustomerId();
|
||||||
|
|
||||||
if (idCustomer is null || !wellService.CheckWellOwnership((int)idCustomer, wellId))
|
if (idCustomer is null || !wellService.CheckWellOwnership((int)idCustomer, wellId))
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
var analytics = analyticsService.GetOperationsToInterval(wellId, intervalHoursTimestamp, workBeginTimestamp);
|
var analytics = analyticsService.GetOperationsToInterval(wellId, intervalSeconds, workBeginSeconds);
|
||||||
|
|
||||||
if (analytics is null || !analytics.Any())
|
if (analytics is null || !analytics.Any())
|
||||||
return NoContent();
|
return NoContent();
|
||||||
|
Loading…
Reference in New Issue
Block a user