forked from ddrilling/AsbCloudServer
Разделение запроса получения ГГД
This commit is contained in:
parent
41695502b0
commit
24887632f4
@ -1,52 +1,84 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AsbCloudApp.Requests
|
||||
namespace AsbCloudApp.Requests;
|
||||
|
||||
/// <summary>
|
||||
/// Запрос получения ГГД
|
||||
/// </summary>
|
||||
public class WellOperationRequestBase : RequestBase
|
||||
{
|
||||
public class WellOperationRequest : RequestBase
|
||||
/// <summary>
|
||||
/// Больше или равно дате начала операции
|
||||
/// </summary>
|
||||
public DateTimeOffset? GeDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Меньше или равно дате окончания операции
|
||||
/// </summary>
|
||||
public DateTimeOffset? LeDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Больше или равно глубины скважины на начало операции.
|
||||
/// </summary>
|
||||
public double? GeDepth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Меньше или равно глубины скважины на конец операции.
|
||||
/// </summary>
|
||||
public double? LeDepth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Идентификаторы категорий операции
|
||||
/// </summary>
|
||||
public IEnumerable<int>? OperationCategoryIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Тип операций
|
||||
/// <list type="bullet">
|
||||
/// <item>0 - плановая операция</item>
|
||||
/// <item>1 - фактическая операция</item>
|
||||
/// </list>
|
||||
/// </summary>
|
||||
public int? OperationType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Идентификаторы конструкций секции
|
||||
/// </summary>
|
||||
public IEnumerable<int>? SectionTypeIds { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Запрос получения ГГД с идентификаторами скважин
|
||||
/// </summary>
|
||||
public class WellOperationRequest : WellOperationRequestBase
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public WellOperationRequest(IEnumerable<int> idsWell)
|
||||
{
|
||||
/// <summary>
|
||||
/// Идентификаторы скважин
|
||||
/// </summary>
|
||||
public IEnumerable<int>? IdsWell { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Больше или равно дате начала операции
|
||||
/// </summary>
|
||||
public DateTimeOffset? GeDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Меньше или равно дате окончания операции
|
||||
/// </summary>
|
||||
public DateTimeOffset? LeDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Больше или равно глубины скважины на начало операции.
|
||||
/// </summary>
|
||||
public double? GeDepth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Меньше или равно глубины скважины на конец операции.
|
||||
/// </summary>
|
||||
public double? LeDepth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Идентификаторы категорий операции
|
||||
/// </summary>
|
||||
public IEnumerable<int>? OperationCategoryIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Тип операций
|
||||
/// <list type="bullet">
|
||||
/// <item>0 - плановая операция</item>
|
||||
/// <item>1 - фактическая операция</item>
|
||||
/// </list>
|
||||
/// </summary>
|
||||
public int? OperationType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Идентификаторы конструкций секции
|
||||
/// </summary>
|
||||
public IEnumerable<int>? SectionTypeIds { get; set; }
|
||||
IdsWell = idsWell;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public WellOperationRequest(WellOperationRequestBase request, IEnumerable<int> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Идентификаторы скважин
|
||||
/// </summary>
|
||||
public IEnumerable<int>? IdsWell { get; }
|
||||
}
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -40,9 +40,8 @@ public class WellOperationExport<TTemplate> : ExcelExportService<WellOperationDt
|
||||
|
||||
protected override Task<IEnumerable<WellOperationDto>> GetDtosAsync(WellOperationExportRequest options, CancellationToken token)
|
||||
{
|
||||
var request = new WellOperationRequest
|
||||
var request = new WellOperationRequest(new[] { options.IdWell })
|
||||
{
|
||||
IdsWell = new[] { options.IdWell },
|
||||
OperationType = options.IdType
|
||||
};
|
||||
|
||||
|
@ -19,7 +19,7 @@ public interface IWellOperationClient
|
||||
Task<IApiResponse<int>> UpdateRangeAsync(int idWell, [Body] IEnumerable<WellOperationDto> dtos);
|
||||
|
||||
[Get(BaseRoute)]
|
||||
Task<IApiResponse<PaginationContainer<WellOperationDto>>> GetPageOperationsPlanAsync(int idWell, [Query] WellOperationRequest request);
|
||||
Task<IApiResponse<PaginationContainer<WellOperationDto>>> GetPageOperationsPlanAsync(int idWell, [Query] WellOperationRequestBase request);
|
||||
|
||||
[Multipart]
|
||||
[Post(BaseRoute + "/parse/{idType}")]
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -150,14 +150,15 @@ public class WellOperationController : ControllerBase
|
||||
[ProducesResponseType(typeof(IEnumerable<WellGroupOpertionDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> 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<WellOperationDto>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> 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
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Импорт ГГД из excel (xlsx) файла
|
||||
/// Парсинг ГГД из excel (xlsx) файла
|
||||
/// </summary>
|
||||
/// <param name="idWell"></param>
|
||||
/// <param name="idType"></param>
|
||||
@ -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<WellOperationParserRequest>(idType);
|
||||
|
Loading…
Reference in New Issue
Block a user