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

55 lines
2.3 KiB
C#
Raw Normal View History

using AsbCloudApp.Data;
using AsbCloudApp.Repositories;
using AsbCloudApp.Services;
using AsbCloudInfrastructure.Services.Trajectory;
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]
public class PlannedTrajectoryController : TrajectoryController<TrajectoryGeoPlanDto>
{
2023-05-30 11:21:07 +05:00
private readonly TrajectoryService trajectoryVisualizationService;
public PlannedTrajectoryController(IWellService wellService,
PlannedTrajectoryImportService plannedTrajectoryImportService,
ITrajectoryEditableRepository<TrajectoryGeoPlanDto> plannedTrajectoryRepository,
2023-05-30 11:21:07 +05:00
TrajectoryService trajectoryVisualizationService)
: base(
wellService,
plannedTrajectoryImportService,
plannedTrajectoryRepository)
{
fileName = "ЕЦП_шаблон_файла_плановая_траектория.xlsx";
this.trajectoryVisualizationService = trajectoryVisualizationService;
}
/// <summary>
/// Получение координат для визуализации траектории (плановой и фактической)
/// </summary>
/// <param name="idWell"></param>
/// <param name="token"></param>
/// <returns></returns>
[HttpGet("trajectoryCartesianPlanFact")]
[ProducesResponseType(typeof(PlanFactBase<IEnumerable<TrajectoryCartesianPlanDto>, IEnumerable<TrajectoryCartesianFactDto>, IEnumerable<TrajectoryCartesianFactDto>>), (int)System.Net.HttpStatusCode.OK)]
2023-05-30 11:21:07 +05:00
public async Task<IActionResult> GetTrajectoryCartesianPlanFactAsync(int idWell, CancellationToken token)
{
if (!await base.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
}