diff --git a/AsbCloudApp/Data/WellDto.cs b/AsbCloudApp/Data/WellDto.cs index 4ffd262e..b347bdd8 100644 --- a/AsbCloudApp/Data/WellDto.cs +++ b/AsbCloudApp/Data/WellDto.cs @@ -5,6 +5,23 @@ using System.Linq; namespace AsbCloudApp.Data { + /// + /// базовая информация о скважине + /// + public class WellWithTimezoneDto : WellInfoDto + { + /// + [Required] + public SimpleTimezoneDto Timezone { get; set; } = null!; + + /// + /// 0 - неизвестно, + /// 1 - в работе, + /// 2 - завершена + /// + public int IdState { get; set; } + } + /// /// Скважина /// diff --git a/AsbCloudApp/Data/WellboreDto.cs b/AsbCloudApp/Data/WellboreDto.cs index e64a188f..dbd9b697 100644 --- a/AsbCloudApp/Data/WellboreDto.cs +++ b/AsbCloudApp/Data/WellboreDto.cs @@ -7,41 +7,18 @@ namespace AsbCloudApp.Data; /// public class WellboreDto { - /// - /// Идентификатор - /// - public int Id { get; set; } + public WellWithTimezoneDto Well { get; set; } + + /// + /// Идентификатор + /// + public int Id { get; set; } /// /// Название /// public string Name { get; set; } = null!; - /// - /// Идентификатор скважины - /// - public int IdWell { get; set; } - - /// - /// Состояние скважины - /// - public int IdWellState { get; set; } - - /// - /// Идентификатор телеметрии - /// - public int? IdWellTelemetry { get; set; } - - /// - /// Временная зона скважины - /// - public SimpleTimezoneDto? WellTimezone { get; set; } - - /// - /// Название скважины - /// - public string WellName { get; set; } = null!; - /// /// Начальная глубина ствола /// diff --git a/AsbCloudInfrastructure/Services/WellboreService.cs b/AsbCloudInfrastructure/Services/WellboreService.cs index 727878dc..79ef8a3c 100644 --- a/AsbCloudInfrastructure/Services/WellboreService.cs +++ b/AsbCloudInfrastructure/Services/WellboreService.cs @@ -7,6 +7,7 @@ using AsbCloudApp.Repositories; using AsbCloudApp.Requests; using AsbCloudApp.Services; using AsbCloudDb.Model; +using Mapster; namespace AsbCloudInfrastructure.Services; @@ -55,13 +56,8 @@ public class WellboreService : IWellboreService var groupedOperations = wellOperations.GroupBy(o => o.IdWellSectionType); var wellWellbores = groupedOperations.Select(group => new WellboreDto { Id = group.Key, - IdWell = well.Id, - IdWellState = well.IdState, - IdWellTelemetry = well.IdTelemetry, Name = sections[group.Key].Caption, - WellName = well.Caption, - WellTimezone = well.Timezone, - + Well = well.Adapt(), DateStart = group.Min(operation => operation.DateStart), DateEnd = group.Max(operation => operation.DateStart.AddHours(operation.DurationHours)), DepthStart = group.Min(operation => operation.DepthStart), @@ -71,7 +67,7 @@ public class WellboreService : IWellboreService } return wellbores - .OrderBy(w =>w.IdWell).ThenBy(w=>w.Id) + .OrderBy(w => w.Well.Id).ThenBy(w => w.Id) .Skip(skip).Take(take); }