Operation rename to TelemetryOperation

This commit is contained in:
Фролов 2021-07-27 13:32:00 +05:00
parent 05cf7244ef
commit b76687ecc2
17 changed files with 109 additions and 75 deletions

View File

@ -1,6 +1,6 @@
namespace AsbCloudApp.Data namespace AsbCloudApp.Data
{ {
public class OperationDetailsDto public class TelemetryOperationDetailsDto
{ {
public string OperationName { get; set; } public string OperationName { get; set; }
public int DurationSec { get; set; } public int DurationSec { get; set; }

View File

@ -2,7 +2,7 @@
namespace AsbCloudApp.Data namespace AsbCloudApp.Data
{ {
public class OperationDto public class TelemetryOperationDto
{ {
public int Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string Name { get; set; }

View File

@ -1,6 +1,6 @@
namespace AsbCloudApp.Data namespace AsbCloudApp.Data
{ {
public class OperationDurationDto public class TelemetryOperationDurationDto
{ {
public string OperationName { get; set; } public string OperationName { get; set; }
public double Duration { get; set; } public double Duration { get; set; }

View File

@ -3,9 +3,9 @@ using System.Collections.Generic;
namespace AsbCloudApp.Data namespace AsbCloudApp.Data
{ {
public class OperationInfoDto public class TelemetryOperationInfoDto
{ {
public DateTimeOffset IntervalBegin { get; set; } public DateTimeOffset IntervalBegin { get; set; }
public IEnumerable<OperationDetailsDto> Operations { get; set; } public IEnumerable<TelemetryOperationDetailsDto> Operations { get; set; }
} }
} }

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AsbCloudApp.Data
{
public class WellOperationDto
{
}
}

View File

@ -7,15 +7,15 @@ namespace AsbCloudApp.Services
{ {
public interface IAnalyticsService public interface IAnalyticsService
{ {
PaginationContainer<OperationDto> GetOperationsByWell(int wellId, PaginationContainer<TelemetryOperationDto> GetOperationsByWell(int wellId,
IEnumerable<int> categoryids = default, DateTime begin = default, IEnumerable<int> categoryids = default, DateTime begin = default,
DateTime end = default, int skip = 0, int take = 32); DateTime end = default, int skip = 0, int take = 32);
IEnumerable<WellDepthToDayDto> GetWellDepthToDay(int wellId); IEnumerable<WellDepthToDayDto> GetWellDepthToDay(int wellId);
IEnumerable<WellDepthToIntervalDto> GetWellDepthToInterval(int wellId, IEnumerable<WellDepthToIntervalDto> GetWellDepthToInterval(int wellId,
int intervalHoursTimestamp, int workBeginTimestamp); int intervalHoursTimestamp, int workBeginTimestamp);
IEnumerable<OperationDurationDto> GetOperationsSummary(int wellId, IEnumerable<TelemetryOperationDurationDto> GetOperationsSummary(int wellId,
DateTime begin = default, DateTime end = default); DateTime begin = default, DateTime end = default);
IEnumerable<OperationInfoDto> GetOperationsToInterval(int wellId, IEnumerable<TelemetryOperationInfoDto> GetOperationsToInterval(int wellId,
int intervalHoursTimestamp, int workBeginTimestamp); int intervalHoursTimestamp, int workBeginTimestamp);
void SaveAnalytics(DataSaubBase dataSaub); void SaveAnalytics(DataSaubBase dataSaub);
} }

View File

@ -8,6 +8,7 @@ namespace AsbCloudApp.Services
IEnumerable<WellDto> GetWellsByCompany(int idCompany); IEnumerable<WellDto> GetWellsByCompany(int idCompany);
IEnumerable<WellDto> GetTransmittingWells(int idCompany); IEnumerable<WellDto> GetTransmittingWells(int idCompany);
bool IsCompanyOwnsWell(int idCompany, int wellId); bool IsCompanyOwnsWell(int idCompany, int wellId);
IEnumerable<WellSectionDto> GetStat(int wellId, int idCompany); IEnumerable<WellSectionDto> GetSections(int wellId);
object GetOperations(int wellId);
} }
} }

View File

@ -27,7 +27,7 @@ namespace AsbCloudDb.Model
public virtual DbSet<Report> Reports { get; set; } public virtual DbSet<Report> Reports { get; set; }
public virtual DbSet<File> Files { get; set; } public virtual DbSet<File> Files { get; set; }
public virtual DbSet<FileCategory> FileCategories { get; set; } public virtual DbSet<FileCategory> FileCategories { get; set; }
public virtual DbSet<Operation> Operations { get; set; } public virtual DbSet<TelemetryOperation> Operations { get; set; }
public virtual DbSet<TelemetryAnalysis> TelemetryAnalysis { get; set; } public virtual DbSet<TelemetryAnalysis> TelemetryAnalysis { get; set; }
public virtual DbSet<WellSection> SectionAnalysis { get; set; } public virtual DbSet<WellSection> SectionAnalysis { get; set; }
public virtual DbSet<WellType> WellTypes { get; set; } public virtual DbSet<WellType> WellTypes { get; set; }
@ -189,26 +189,26 @@ namespace AsbCloudDb.Model
}); });
}); });
modelBuilder.Entity<Operation>(entity => modelBuilder.Entity<TelemetryOperation>(entity =>
{ {
entity.HasData(new List<Operation> { entity.HasData(new List<TelemetryOperation> {
new Operation {Id = 1, Name = "Невозможно определить операцию"}, new TelemetryOperation {Id = 1, Name = "Невозможно определить операцию"},
new Operation {Id = 2, Name = "Роторное бурение" }, new TelemetryOperation {Id = 2, Name = "Роторное бурение" },
new Operation {Id = 3, Name = "Слайдирование" }, new TelemetryOperation {Id = 3, Name = "Слайдирование" },
new Operation {Id = 4, Name = "Подъем с проработкой" }, new TelemetryOperation {Id = 4, Name = "Подъем с проработкой" },
new Operation {Id = 5, Name = "Спуск с проработкой" }, new TelemetryOperation {Id = 5, Name = "Спуск с проработкой" },
new Operation {Id = 6, Name = "Подъем с промывкой" }, new TelemetryOperation {Id = 6, Name = "Подъем с промывкой" },
new Operation {Id = 7, Name = "Спуск с промывкой" }, new TelemetryOperation {Id = 7, Name = "Спуск с промывкой" },
new Operation {Id = 8, Name = "Спуск в скважину" }, new TelemetryOperation {Id = 8, Name = "Спуск в скважину" },
new Operation {Id = 9, Name = "Спуск с вращением" }, new TelemetryOperation {Id = 9, Name = "Спуск с вращением" },
new Operation {Id = 10, Name = "Подъем из скважины" }, new TelemetryOperation {Id = 10, Name = "Подъем из скважины" },
new Operation {Id = 11, Name = "Подъем с вращением" }, new TelemetryOperation {Id = 11, Name = "Подъем с вращением" },
new Operation {Id = 12, Name = "Промывка в покое" }, new TelemetryOperation {Id = 12, Name = "Промывка в покое" },
new Operation {Id = 13, Name = "Промывка с вращением" }, new TelemetryOperation {Id = 13, Name = "Промывка с вращением" },
new Operation {Id = 14, Name = "Удержание в клиньях" }, new TelemetryOperation {Id = 14, Name = "Удержание в клиньях" },
new Operation {Id = 15, Name = "Неподвижное состояние" }, new TelemetryOperation {Id = 15, Name = "Неподвижное состояние" },
new Operation {Id = 16, Name = "Вращение без циркуляции" }, new TelemetryOperation {Id = 16, Name = "Вращение без циркуляции" },
new Operation {Id = 17, Name = "На поверхности" } new TelemetryOperation {Id = 17, Name = "На поверхности" }
}); });
}); });

View File

@ -23,7 +23,7 @@ namespace AsbCloudDb.Model
DbSet<Report> Reports { get; set; } DbSet<Report> Reports { get; set; }
DbSet<File> Files { get; set; } DbSet<File> Files { get; set; }
DbSet<FileCategory> FileCategories { get; set; } DbSet<FileCategory> FileCategories { get; set; }
DbSet<Operation> Operations { get; set; } DbSet<TelemetryOperation> Operations { get; set; }
DbSet<TelemetryAnalysis> TelemetryAnalysis { get; set; } DbSet<TelemetryAnalysis> TelemetryAnalysis { get; set; }
int SaveChanges(); int SaveChanges();

View File

@ -28,8 +28,8 @@ namespace AsbCloudDb.Model
[JsonIgnore] [JsonIgnore]
[ForeignKey(nameof(IdOperation))] [ForeignKey(nameof(IdOperation))]
[InverseProperty(nameof(Model.Operation.Analysis))] [InverseProperty(nameof(Model.TelemetryOperation.Analysis))]
public virtual Operation Operation { get; set; } public virtual TelemetryOperation Operation { get; set; }
[Column("unix_date", TypeName = "bigint"), Comment("Unix timestamp для Linq запросов с вычислением дат")] [Column("unix_date", TypeName = "bigint"), Comment("Unix timestamp для Linq запросов с вычислением дат")]

View File

@ -5,8 +5,8 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model namespace AsbCloudDb.Model
{ {
[Table("t_operation"), Comment("Справочник операций на скважине")] [Table("t_telemetry_operation"), Comment("Справочник операций на скважине")]
public class Operation public class TelemetryOperation
{ {
[Key] [Key]
[Column("id")] [Column("id")]

View File

@ -14,9 +14,9 @@ namespace AsbCloudInfrastructure.Services
private readonly IAsbCloudDbContext db; private readonly IAsbCloudDbContext db;
private readonly ITelemetryService telemetryService; private readonly ITelemetryService telemetryService;
private readonly ISaubDataCache saubDataCache; private readonly ISaubDataCache saubDataCache;
private readonly CacheTable<Operation> cacheOperations; private readonly CacheTable<TelemetryOperation> cacheOperations;
private readonly OperationDetectorService operationDetectorService; private readonly TelemetryOperationDetectorService operationDetectorService;
private readonly IEnumerable<Operation> operations; private readonly IEnumerable<TelemetryOperation> operations;
public AnalyticsService(IAsbCloudDbContext db, ITelemetryService telemetryService, public AnalyticsService(IAsbCloudDbContext db, ITelemetryService telemetryService,
ISaubDataCache saubDataCache, CacheDb cacheDb) ISaubDataCache saubDataCache, CacheDb cacheDb)
@ -24,9 +24,9 @@ namespace AsbCloudInfrastructure.Services
this.db = db; this.db = db;
this.telemetryService = telemetryService; this.telemetryService = telemetryService;
this.saubDataCache = saubDataCache; this.saubDataCache = saubDataCache;
cacheOperations = cacheDb.GetCachedTable<Operation>((AsbCloudDbContext)db); cacheOperations = cacheDb.GetCachedTable<TelemetryOperation>((AsbCloudDbContext)db);
operations = cacheOperations.Select(c => true); operations = cacheOperations.Select(c => true);
operationDetectorService = new OperationDetectorService(operations); operationDetectorService = new TelemetryOperationDetectorService(operations);
} }
public IEnumerable<WellDepthToDayDto> GetWellDepthToDay(int wellId) public IEnumerable<WellDepthToDayDto> GetWellDepthToDay(int wellId)
@ -83,7 +83,7 @@ namespace AsbCloudInfrastructure.Services
return wellDepthToIntervalData; return wellDepthToIntervalData;
} }
public PaginationContainer<OperationDto> GetOperationsByWell(int wellId, public PaginationContainer<TelemetryOperationDto> GetOperationsByWell(int wellId,
IEnumerable<int> categoryIds = default, DateTime begin = default, IEnumerable<int> categoryIds = default, DateTime begin = default,
DateTime end = default, int skip = 0, int take = 32) DateTime end = default, int skip = 0, int take = 32)
{ {
@ -99,7 +99,7 @@ namespace AsbCloudInfrastructure.Services
if ((categoryIds != default) && (categoryIds.Any())) if ((categoryIds != default) && (categoryIds.Any()))
operations = operations.Where(o => categoryIds.Contains(o.IdOperation)); operations = operations.Where(o => categoryIds.Contains(o.IdOperation));
var result = new PaginationContainer<OperationDto> var result = new PaginationContainer<TelemetryOperationDto>
{ {
Skip = skip, Skip = skip,
Take = take Take = take
@ -131,7 +131,7 @@ namespace AsbCloudInfrastructure.Services
foreach(var operation in operations) foreach(var operation in operations)
{ {
var operationDto = new OperationDto var operationDto = new TelemetryOperationDto
{ {
Id = operation.Id, Id = operation.Id,
Name = operation.Operation.Name, Name = operation.Operation.Name,
@ -147,7 +147,7 @@ namespace AsbCloudInfrastructure.Services
return result; return result;
} }
public IEnumerable<OperationDurationDto> GetOperationsSummary(int wellId, public IEnumerable<TelemetryOperationDurationDto> GetOperationsSummary(int wellId,
DateTime begin = default, DateTime end = default) DateTime begin = default, DateTime end = default)
{ {
var telemetry = telemetryService.GetTelemetryByWellId(wellId); var telemetry = telemetryService.GetTelemetryByWellId(wellId);
@ -163,7 +163,7 @@ namespace AsbCloudInfrastructure.Services
a.UnixDate > unixBegin && a.UnixDate < unixEnd a.UnixDate > unixBegin && a.UnixDate < unixEnd
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 { a.IdOperation, o.Name } into g group a by new { a.IdOperation, o.Name } into g
select new OperationDurationDto select new TelemetryOperationDurationDto
{ {
OperationName = g.Key.Name, OperationName = g.Key.Name,
Duration = g.Where(g => g.DurationSec > 0) Duration = g.Where(g => g.DurationSec > 0)
@ -173,7 +173,7 @@ namespace AsbCloudInfrastructure.Services
return operations; return operations;
} }
public IEnumerable<OperationInfoDto> GetOperationsToInterval(int wellId, public IEnumerable<TelemetryOperationInfoDto> GetOperationsToInterval(int wellId,
int intervalSeconds, int workBeginSeconds) int intervalSeconds, int workBeginSeconds)
{ {
intervalSeconds = intervalSeconds == 0 ? 86400 : intervalSeconds; intervalSeconds = intervalSeconds == 0 ? 86400 : intervalSeconds;
@ -202,10 +202,10 @@ namespace AsbCloudInfrastructure.Services
}).ToList(); }).ToList();
var operationsGroupedByInterval = operations.GroupBy(op => op.IntervalStart) var operationsGroupedByInterval = operations.GroupBy(op => op.IntervalStart)
.Select(o => new OperationInfoDto .Select(o => new TelemetryOperationInfoDto
{ {
IntervalBegin = DateTimeOffset.FromUnixTimeSeconds(o.Key), IntervalBegin = DateTimeOffset.FromUnixTimeSeconds(o.Key),
Operations = o.Select(opr => new OperationDetailsDto Operations = o.Select(opr => new TelemetryOperationDetailsDto
{ {
OperationName = opr.OperationName, OperationName = opr.OperationName,
DurationSec = opr.OperationsDuration DurationSec = opr.OperationsDuration

View File

@ -3,10 +3,10 @@ using System;
namespace AsbCloudInfrastructure.Services namespace AsbCloudInfrastructure.Services
{ {
public class OperationDetector public class TelemetryOperationDetector
{ {
public int Order { get; set; } public int Order { get; set; }
public Operation Operation { get; set; } public TelemetryOperation Operation { get; set; }
public Func<TelemetryAnalysis, bool> Detect { get; set; } public Func<TelemetryAnalysis, bool> Detect { get; set; }
} }
} }

View File

@ -4,15 +4,15 @@ using System.Linq;
namespace AsbCloudInfrastructure.Services namespace AsbCloudInfrastructure.Services
{ {
public class OperationDetectorService public class TelemetryOperationDetectorService
{ {
private readonly IEnumerable<OperationDetector> detectors; private readonly IEnumerable<TelemetryOperationDetector> detectors;
public OperationDetectorService(IEnumerable<Operation> operations) public TelemetryOperationDetectorService(IEnumerable<TelemetryOperation> operations)
{ {
detectors = new List<OperationDetector>() detectors = new List<TelemetryOperationDetector>()
{ {
new OperationDetector new TelemetryOperationDetector
{ {
Order = 1, Order = 1,
Operation = operations.FirstOrDefault(o => o.Name.Equals("На поверхности")), Operation = operations.FirstOrDefault(o => o.Name.Equals("На поверхности")),
@ -22,7 +22,7 @@ namespace AsbCloudInfrastructure.Services
&& data.IsBitPositionLt20 && data.IsHookWeightLt3; && data.IsBitPositionLt20 && data.IsHookWeightLt3;
} }
}, },
new OperationDetector new TelemetryOperationDetector
{ {
Order = 2, Order = 2,
Operation = operations.FirstOrDefault(o => o.Name.Equals("Удержание в клиньях")), Operation = operations.FirstOrDefault(o => o.Name.Equals("Удержание в клиньях")),
@ -34,7 +34,7 @@ namespace AsbCloudInfrastructure.Services
data.IsHookWeightLt3; data.IsHookWeightLt3;
} }
}, },
new OperationDetector new TelemetryOperationDetector
{ {
Order = 3, Order = 3,
Operation = operations.FirstOrDefault(o => o.Name.Equals("Подъем с проработкой")), Operation = operations.FirstOrDefault(o => o.Name.Equals("Подъем с проработкой")),
@ -45,7 +45,7 @@ namespace AsbCloudInfrastructure.Services
data.IsRotorSpeedGt3 && data.IsPressureGt20; data.IsRotorSpeedGt3 && data.IsPressureGt20;
} }
}, },
new OperationDetector new TelemetryOperationDetector
{ {
Order = 4, Order = 4,
Operation = operations.FirstOrDefault(o => o.Name.Equals("Спуск с проработкой")), Operation = operations.FirstOrDefault(o => o.Name.Equals("Спуск с проработкой")),
@ -56,7 +56,7 @@ namespace AsbCloudInfrastructure.Services
data.IsRotorSpeedGt3 && data.IsPressureGt20; data.IsRotorSpeedGt3 && data.IsPressureGt20;
} }
}, },
new OperationDetector new TelemetryOperationDetector
{ {
Order = 5, Order = 5,
Operation = operations.FirstOrDefault(o => o.Name.Equals("Подъем с промывкой")), Operation = operations.FirstOrDefault(o => o.Name.Equals("Подъем с промывкой")),
@ -67,7 +67,7 @@ namespace AsbCloudInfrastructure.Services
data.IsRotorSpeedLt3 && data.IsPressureGt20; data.IsRotorSpeedLt3 && data.IsPressureGt20;
} }
}, },
new OperationDetector new TelemetryOperationDetector
{ {
Order = 6, Order = 6,
Operation = operations.FirstOrDefault(o => o.Name.Equals("Спуск с промывкой")), Operation = operations.FirstOrDefault(o => o.Name.Equals("Спуск с промывкой")),
@ -78,7 +78,7 @@ namespace AsbCloudInfrastructure.Services
data.IsRotorSpeedLt3 && data.IsPressureGt20; data.IsRotorSpeedLt3 && data.IsPressureGt20;
} }
}, },
new OperationDetector new TelemetryOperationDetector
{ {
Order = 7, Order = 7,
Operation = operations.FirstOrDefault(o => o.Name.Equals("Спуск в скважину")), Operation = operations.FirstOrDefault(o => o.Name.Equals("Спуск в скважину")),
@ -89,7 +89,7 @@ namespace AsbCloudInfrastructure.Services
data.IsRotorSpeedLt3 && data.IsPressureLt20; data.IsRotorSpeedLt3 && data.IsPressureLt20;
} }
}, },
new OperationDetector new TelemetryOperationDetector
{ {
Order = 8, Order = 8,
Operation = operations.FirstOrDefault(o => o.Name.Equals("Спуск с вращением")), Operation = operations.FirstOrDefault(o => o.Name.Equals("Спуск с вращением")),
@ -100,7 +100,7 @@ namespace AsbCloudInfrastructure.Services
data.IsRotorSpeedGt3 && data.IsPressureLt20; data.IsRotorSpeedGt3 && data.IsPressureLt20;
} }
}, },
new OperationDetector new TelemetryOperationDetector
{ {
Order = 9, Order = 9,
Operation = operations.FirstOrDefault(o => o.Name.Equals("Подъем из скважины")), Operation = operations.FirstOrDefault(o => o.Name.Equals("Подъем из скважины")),
@ -111,7 +111,7 @@ namespace AsbCloudInfrastructure.Services
data.IsRotorSpeedLt3 && data.IsPressureLt20; data.IsRotorSpeedLt3 && data.IsPressureLt20;
} }
}, },
new OperationDetector new TelemetryOperationDetector
{ {
Order = 10, Order = 10,
Operation = operations.FirstOrDefault(o => o.Name.Equals("Подъем с вращением")), Operation = operations.FirstOrDefault(o => o.Name.Equals("Подъем с вращением")),
@ -122,7 +122,7 @@ namespace AsbCloudInfrastructure.Services
data.IsRotorSpeedGt3 && data.IsPressureLt20; data.IsRotorSpeedGt3 && data.IsPressureLt20;
} }
}, },
new OperationDetector new TelemetryOperationDetector
{ {
Order = 11, Order = 11,
Operation = operations.FirstOrDefault(o => o.Name.Equals("Промывка в покое")), Operation = operations.FirstOrDefault(o => o.Name.Equals("Промывка в покое")),
@ -134,7 +134,7 @@ namespace AsbCloudInfrastructure.Services
data.IsRotorSpeedLt3 && data.IsPressureGt20; data.IsRotorSpeedLt3 && data.IsPressureGt20;
} }
}, },
new OperationDetector new TelemetryOperationDetector
{ {
Order = 12, Order = 12,
Operation = operations.FirstOrDefault(o => o.Name.Equals("Промывка с вращением")), Operation = operations.FirstOrDefault(o => o.Name.Equals("Промывка с вращением")),
@ -146,7 +146,7 @@ namespace AsbCloudInfrastructure.Services
data.IsRotorSpeedGt3 && data.IsPressureGt20; data.IsRotorSpeedGt3 && data.IsPressureGt20;
} }
}, },
new OperationDetector new TelemetryOperationDetector
{ {
Order = 13, Order = 13,
Operation = operations.FirstOrDefault(o => o.Name.Equals("Неподвижное состояние")), Operation = operations.FirstOrDefault(o => o.Name.Equals("Неподвижное состояние")),
@ -158,7 +158,7 @@ namespace AsbCloudInfrastructure.Services
data.IsRotorSpeedLt3 && data.IsPressureLt20 && data.IsHookWeightNotChanges; data.IsRotorSpeedLt3 && data.IsPressureLt20 && data.IsHookWeightNotChanges;
} }
}, },
new OperationDetector new TelemetryOperationDetector
{ {
Order = 14, Order = 14,
Operation = operations.FirstOrDefault(o => o.Name.Equals("Вращение без циркуляции")), Operation = operations.FirstOrDefault(o => o.Name.Equals("Вращение без циркуляции")),
@ -170,7 +170,7 @@ namespace AsbCloudInfrastructure.Services
data.IsRotorSpeedGt3 && data.IsPressureLt20; data.IsRotorSpeedGt3 && data.IsPressureLt20;
} }
}, },
new OperationDetector new TelemetryOperationDetector
{ {
Order = 15, Order = 15,
Operation = operations.FirstOrDefault(o => o.Name.Equals("Невозможно определить операцию")), Operation = operations.FirstOrDefault(o => o.Name.Equals("Невозможно определить операцию")),
@ -179,8 +179,8 @@ namespace AsbCloudInfrastructure.Services
}; };
} }
public Operation DetectOperation(TelemetryAnalysis data) => public TelemetryOperation DetectOperation(TelemetryAnalysis data) =>
detectors.OrderBy(d => d.Order).First(o => o.Detect(data)).Operation detectors.OrderBy(d => d.Order).First(o => o.Detect(data)).Operation
?? new Operation { Id = 1, Name = "Невозможно определить операцию" }; ?? new TelemetryOperation { Id = 1, Name = "Невозможно определить операцию" };
} }
} }

View File

@ -56,9 +56,14 @@ namespace AsbCloudInfrastructure.Services
return wellDto; return wellDto;
} }
public IEnumerable<WellSectionDto> GetStat(int wellId, int idCompany) public IEnumerable<WellSectionDto> GetSections(int wellId)
{ {
return null; return null;
} }
public object GetOperations(int wellId)
{
throw new NotImplementedException();
}
} }
} }

View File

@ -34,7 +34,7 @@ namespace AsbCloudWebApi.Controllers
/// <returns>Список операций на скважине за все время</returns> /// <returns>Список операций на скважине за все время</returns>
[HttpGet] [HttpGet]
[Route("{wellId}/operationsByWell")] [Route("{wellId}/operationsByWell")]
[ProducesResponseType(typeof(PaginationContainer<OperationDto>), (int)System.Net.HttpStatusCode.OK)] [ProducesResponseType(typeof(PaginationContainer<TelemetryOperationDto>), (int)System.Net.HttpStatusCode.OK)]
public IActionResult GetOperationsByWell(int wellId, int skip = 0, int take = 32, public IActionResult GetOperationsByWell(int wellId, int skip = 0, int take = 32,
[FromQuery] IEnumerable<int> categoryIds = default, DateTime begin = default, DateTime end = default) [FromQuery] IEnumerable<int> categoryIds = default, DateTime begin = default, DateTime end = default)
{ {
@ -110,7 +110,7 @@ namespace AsbCloudWebApi.Controllers
/// <returns>Коллекцию операций на скважине</returns> /// <returns>Коллекцию операций на скважине</returns>
[HttpGet] [HttpGet]
[Route("{wellId}/operationsSummary")] [Route("{wellId}/operationsSummary")]
[ProducesResponseType(typeof(IEnumerable<OperationDurationDto>), (int)System.Net.HttpStatusCode.OK)] [ProducesResponseType(typeof(IEnumerable<TelemetryOperationDurationDto>), (int)System.Net.HttpStatusCode.OK)]
public IActionResult GetOperationsSummary(int wellId, DateTime begin = default, DateTime end = default) public IActionResult GetOperationsSummary(int wellId, DateTime begin = default, DateTime end = default)
{ {
int? idCompany = User.GetCompanyId(); int? idCompany = User.GetCompanyId();
@ -135,7 +135,7 @@ namespace AsbCloudWebApi.Controllers
/// <returns>Коллекцию операций на скважине</returns> /// <returns>Коллекцию операций на скважине</returns>
[HttpGet] [HttpGet]
[Route("{wellId}/operationsToInterval")] [Route("{wellId}/operationsToInterval")]
[ProducesResponseType(typeof(IEnumerable<OperationDurationDto>), (int)System.Net.HttpStatusCode.OK)] [ProducesResponseType(typeof(IEnumerable<TelemetryOperationDurationDto>), (int)System.Net.HttpStatusCode.OK)]
public IActionResult GetOperationsToInterval(int wellId, public IActionResult GetOperationsToInterval(int wellId,
int intervalSeconds, int workBeginSeconds) int intervalSeconds, int workBeginSeconds)
{ {

View File

@ -50,10 +50,26 @@ namespace AsbCloudWebApi.Controllers
if (wellService.IsCompanyOwnsWell((int)idCompany, wellId)) if (wellService.IsCompanyOwnsWell((int)idCompany, wellId))
return Forbid(); return Forbid();
var dto = wellService.GetStat(wellId, (int)idCompany); var dto = wellService.GetSections(wellId);
return Ok(dto); return Ok(dto);
}
[HttpGet("{wellId}/operations")]
[ProducesResponseType(typeof(IEnumerable<WellSectionDto>), (int)System.Net.HttpStatusCode.OK)]
public IActionResult GetOperations(int wellId)
{
var idCompany = User.GetCompanyId();
if (idCompany is null)
return NoContent();
if (wellService.IsCompanyOwnsWell((int)idCompany, wellId))
return Forbid();
var dto = wellService.GetOperations(wellId);
return Ok(dto);
} }
[HttpGet("transmittingWells")] [HttpGet("transmittingWells")]