diff --git a/AsbCloudApp/Requests/WellOperationRequest.cs b/AsbCloudApp/Requests/WellOperationRequest.cs index 3164c2d1..356ef52d 100644 --- a/AsbCloudApp/Requests/WellOperationRequest.cs +++ b/AsbCloudApp/Requests/WellOperationRequest.cs @@ -1,52 +1,84 @@ using System; using System.Collections.Generic; -namespace AsbCloudApp.Requests +namespace AsbCloudApp.Requests; + +/// +/// Запрос получения ГГД +/// +public class WellOperationRequestBase : RequestBase { - public class WellOperationRequest : RequestBase + /// + /// Больше или равно дате начала операции + /// + public DateTimeOffset? GeDate { get; set; } + + /// + /// Меньше или равно дате окончания операции + /// + public DateTimeOffset? LeDate { get; set; } + + /// + /// Больше или равно глубины скважины на начало операции. + /// + public double? GeDepth { get; set; } + + /// + /// Меньше или равно глубины скважины на конец операции. + /// + public double? LeDepth { get; set; } + + /// + /// Идентификаторы категорий операции + /// + public IEnumerable? OperationCategoryIds { get; set; } + + /// + /// Тип операций + /// + /// 0 - плановая операция + /// 1 - фактическая операция + /// + /// + public int? OperationType { get; set; } + + /// + /// Идентификаторы конструкций секции + /// + public IEnumerable? SectionTypeIds { get; set; } +} + +/// +/// Запрос получения ГГД с идентификаторами скважин +/// +public class WellOperationRequest : WellOperationRequestBase +{ + /// + public WellOperationRequest(IEnumerable idsWell) { - /// - /// Идентификаторы скважин - /// - public IEnumerable? IdsWell { get; set; } - - /// - /// Больше или равно дате начала операции - /// - public DateTimeOffset? GeDate { get; set; } - - /// - /// Меньше или равно дате окончания операции - /// - public DateTimeOffset? LeDate { get; set; } - - /// - /// Больше или равно глубины скважины на начало операции. - /// - public double? GeDepth { get; set; } - - /// - /// Меньше или равно глубины скважины на конец операции. - /// - public double? LeDepth { get; set; } - - /// - /// Идентификаторы категорий операции - /// - public IEnumerable? OperationCategoryIds { get; set; } - - /// - /// Тип операций - /// - /// 0 - плановая операция - /// 1 - фактическая операция - /// - /// - public int? OperationType { get; set; } - - /// - /// Идентификаторы конструкций секции - /// - public IEnumerable? SectionTypeIds { get; set; } + IdsWell = idsWell; } + + /// + public WellOperationRequest(WellOperationRequestBase request, IEnumerable idsWell) + : this(idsWell) + { + GeDepth = request.GeDepth; + LeDepth = request.LeDepth; + GeDate = request.GeDate; + LeDate = request.LeDate; + + OperationCategoryIds = request.OperationCategoryIds; + OperationType = request.OperationType; + SectionTypeIds = request.SectionTypeIds; + + Skip = request.Skip; + Take = request.Take; + SortFields = request.SortFields; + } + + /// + /// Идентификаторы скважин + /// + public IEnumerable? IdsWell { get; } } \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs index fface665..3e9607f4 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs @@ -110,9 +110,8 @@ public class DailyReportService : IDailyReportService var geDate = dailyReport.Date.ToDateTime(TimeOnly.MinValue, DateTimeKind.Unspecified); var leDate = dailyReport.Date.AddDays(1).ToDateTime(TimeOnly.MinValue, DateTimeKind.Unspecified); - var factOperationRequest = new WellOperationRequest - { - IdsWell = new []{ idWell }, + var factOperationRequest = new WellOperationRequest(new []{ idWell }) + { OperationType = WellOperation.IdOperationTypeFact, GeDate = geDate, LeDate = leDate @@ -187,9 +186,8 @@ public class DailyReportService : IDailyReportService var geDateFactWellOperation = datesRange.From.AddDays(result.Skip); var leDateFactWellOperation = geDateFactWellOperation.AddDays(result.Take); - var factWellOperationRequest = new WellOperationRequest + var factWellOperationRequest = new WellOperationRequest(new[] { idWell }) { - IdsWell = new[] { idWell }, OperationType = WellOperation.IdOperationTypeFact, GeDate = geDateFactWellOperation, LeDate = leDateFactWellOperation diff --git a/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs b/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs index 3a0d43d4..9f527b4c 100644 --- a/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs +++ b/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs @@ -56,9 +56,8 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService var geDepth = processMapPlanWellDrillings.Min(p => p.DepthStart); var leDepth = processMapPlanWellDrillings.Max(p => p.DepthEnd); - var requestWellOperationFact = new WellOperationRequest() + var requestWellOperationFact = new WellOperationRequest(new[] { idWell }) { - IdsWell = new[] { idWell }, OperationType = WellOperation.IdOperationTypeFact, GeDepth = geDepth, LeDepth = leDepth diff --git a/AsbCloudInfrastructure/Services/WellCompositeOperationService.cs b/AsbCloudInfrastructure/Services/WellCompositeOperationService.cs index 4334e8be..8beb3c3e 100644 --- a/AsbCloudInfrastructure/Services/WellCompositeOperationService.cs +++ b/AsbCloudInfrastructure/Services/WellCompositeOperationService.cs @@ -145,9 +145,8 @@ namespace AsbCloudInfrastructure.Services var idsWellSectionTypes = WellSectionTypesWithCategories.Select(t => t.IdSectionType).Distinct(); var usedCategories = WellSectionTypesWithCategories.Select(c => c.IdCategory).Distinct(); - var wellOperationRequest = new WellOperationRequest + var wellOperationRequest = new WellOperationRequest(idsWells) { - IdsWell = idsWells, OperationCategoryIds = usedCategories, SectionTypeIds = idsWellSectionTypes, OperationType = WellOperation.IdOperationTypeFact diff --git a/AsbCloudInfrastructure/Services/WellOperations/WellOperationExport.cs b/AsbCloudInfrastructure/Services/WellOperations/WellOperationExport.cs index 31a49d2a..430bf92f 100644 --- a/AsbCloudInfrastructure/Services/WellOperations/WellOperationExport.cs +++ b/AsbCloudInfrastructure/Services/WellOperations/WellOperationExport.cs @@ -40,9 +40,8 @@ public class WellOperationExport : ExcelExportService> GetDtosAsync(WellOperationExportRequest options, CancellationToken token) { - var request = new WellOperationRequest + var request = new WellOperationRequest(new[] { options.IdWell }) { - IdsWell = new[] { options.IdWell }, OperationType = options.IdType }; diff --git a/AsbCloudWebApi.IntegrationTests/Clients/IWellOperationClient.cs b/AsbCloudWebApi.IntegrationTests/Clients/IWellOperationClient.cs index e7943144..84906a77 100644 --- a/AsbCloudWebApi.IntegrationTests/Clients/IWellOperationClient.cs +++ b/AsbCloudWebApi.IntegrationTests/Clients/IWellOperationClient.cs @@ -19,7 +19,7 @@ public interface IWellOperationClient Task> UpdateRangeAsync(int idWell, [Body] IEnumerable dtos); [Get(BaseRoute)] - Task>> GetPageOperationsPlanAsync(int idWell, [Query] WellOperationRequest request); + Task>> GetPageOperationsPlanAsync(int idWell, [Query] WellOperationRequestBase request); [Multipart] [Post(BaseRoute + "/parse/{idType}")] diff --git a/AsbCloudWebApi.IntegrationTests/Controllers/WellOperations/WellOperationControllerTest.cs b/AsbCloudWebApi.IntegrationTests/Controllers/WellOperations/WellOperationControllerTest.cs index 5520121c..4d6dd3c0 100644 --- a/AsbCloudWebApi.IntegrationTests/Controllers/WellOperations/WellOperationControllerTest.cs +++ b/AsbCloudWebApi.IntegrationTests/Controllers/WellOperations/WellOperationControllerTest.cs @@ -102,7 +102,7 @@ public class WellOperationControllerTest : BaseIntegrationTest dto.DateStart = dto.DateStart.ToOffset(timezoneOffset); dto.LastUpdateDate = dto.LastUpdateDate?.ToOffset(timezoneOffset); - var request = new WellOperationRequest + var request = new WellOperationRequestBase { OperationType = WellOperation.IdOperationTypePlan }; diff --git a/AsbCloudWebApi/Controllers/WellOperationController.cs b/AsbCloudWebApi/Controllers/WellOperationController.cs index e91c9c65..96d5f5f9 100644 --- a/AsbCloudWebApi/Controllers/WellOperationController.cs +++ b/AsbCloudWebApi/Controllers/WellOperationController.cs @@ -150,14 +150,15 @@ public class WellOperationController : ControllerBase [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] public async Task GetGroupOperationsAsync( [FromRoute] int idWell, - [FromQuery] WellOperationRequest request, + [FromQuery] WellOperationRequestBase request, CancellationToken token) { if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false)) return Forbid(); - request.IdsWell = new[] { idWell }; - var result = await wellOperationRepository.GetGroupOperationsStatAsync(request, token); + var requestToservice = new WellOperationRequest(request, new[] { idWell }); + + var result = await wellOperationRepository.GetGroupOperationsStatAsync(requestToservice, token); return Ok(result); } @@ -187,14 +188,15 @@ public class WellOperationController : ControllerBase [ProducesResponseType(typeof(PaginationContainer), StatusCodes.Status200OK)] public async Task GetPageOperationsAsync( [FromRoute] int idWell, - [FromQuery] WellOperationRequest request, + [FromQuery] WellOperationRequestBase request, CancellationToken token) { if (!await CanUserAccessToWellAsync(idWell, token)) return Forbid(); - request.IdsWell = new[] { idWell }; - var result = await wellOperationRepository.GetPageAsync(request, token); + var requestToService = new WellOperationRequest(request, new[] { idWell }); + + var result = await wellOperationRepository.GetPageAsync(requestToService, token); return Ok(result); } @@ -270,7 +272,7 @@ public class WellOperationController : ControllerBase } /// - /// Импорт ГГД из excel (xlsx) файла + /// Парсинг ГГД из excel (xlsx) файла /// /// /// @@ -315,7 +317,6 @@ public class WellOperationController : ControllerBase [HttpGet("template")] [AllowAnonymous] [ProducesResponseType(typeof(PhysicalFileResult), StatusCodes.Status200OK, "application/octet-stream")] - [ProducesResponseType(StatusCodes.Status204NoContent)] public IActionResult GetTemplate(int idType) { var parser = wellOperationParserFactory.CreateParser(idType);