DD.WellWorkover.Cloud/AsbCloudWebApi/Controllers/Trajectory/TrajectoryPlannedController.cs

59 lines
2.5 KiB
C#
Raw Normal View History

2023-11-28 15:54:47 +05:00
using AsbCloudApp.Data.Trajectory;
using AsbCloudApp.Repositories;
using AsbCloudApp.Services;
using AsbCloudInfrastructure.Services.Trajectory;
2023-11-28 15:54:47 +05:00
using AsbCloudInfrastructure.Services.Trajectory.Import;
using AsbCloudInfrastructure.Services.Trajectory.Export;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudWebApi.Controllers.Trajectory
{
2023-05-19 16:51:41 +05:00
/// <summary>
/// Плановая траектория (загрузка и хранение)
/// </summary>
[Route("api/well/{idWell}/plannedTrajectory")]
[ApiController]
2023-11-28 15:54:47 +05:00
public class TrajectoryPlannedController : TrajectoryEditableController<TrajectoryGeoPlanDto>
{
2023-05-30 11:21:07 +05:00
private readonly TrajectoryService trajectoryVisualizationService;
2023-11-28 15:54:47 +05:00
public TrajectoryPlannedController(IWellService wellService,
2023-11-30 09:40:51 +05:00
TrajectoryPlannedParserService plannedTrajectoryImportService,
2023-11-28 15:54:47 +05:00
TrajectoryPlannedExportService plannedTrajectoryExportService,
ITrajectoryEditableRepository<TrajectoryGeoPlanDto> plannedTrajectoryRepository,
2023-05-30 11:21:07 +05:00
TrajectoryService trajectoryVisualizationService)
: base(
wellService,
plannedTrajectoryImportService,
2023-11-28 15:54:47 +05:00
plannedTrajectoryExportService,
plannedTrajectoryRepository)
{
fileName = "ЕЦП_шаблон_файла_плановая_траектория.xlsx";
this.trajectoryVisualizationService = trajectoryVisualizationService;
}
/// <summary>
/// Получение координат для визуализации траектории (плановой и фактической)
/// </summary>
/// <param name="idWell"></param>
/// <param name="token"></param>
/// <returns></returns>
[HttpGet("trajectoryCartesianPlanFact")]
2023-11-28 15:54:47 +05:00
[ProducesResponseType(typeof(TrajectoryPlanFactDto<IEnumerable<TrajectoryCartesianPlanDto>, IEnumerable<TrajectoryCartesianFactDto>>), (int)System.Net.HttpStatusCode.OK)]
2023-05-30 11:21:07 +05:00
public async Task<IActionResult> GetTrajectoryCartesianPlanFactAsync(int idWell, CancellationToken token)
{
2023-11-28 15:54:47 +05:00
if (!await CanUserAccessToWellAsync(idWell,
token).ConfigureAwait(false))
return Forbid();
2023-05-30 11:21:07 +05:00
var result = await trajectoryVisualizationService.GetTrajectoryCartesianAsync(idWell, token);
return Ok(result);
}
}
2023-05-19 16:51:41 +05:00
}