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

60 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>
2023-11-30 15:08:58 +05:00
[Route("api/well/{idWell}/[controller]")]
[ApiController]
2023-11-30 15:08:58 +05:00
public class TrajectoryPlanController : TrajectoryEditableController<TrajectoryGeoPlanDto>
{
2023-05-30 11:21:07 +05:00
private readonly TrajectoryService trajectoryVisualizationService;
protected override string fileName => "ЕЦП_шаблон_файла_плановая_траектория.xlsx";
2023-11-30 15:08:58 +05:00
public TrajectoryPlanController(IWellService wellService,
2023-11-30 15:20:22 +05:00
TrajectoryPlanParserService trajectoryPlanImportService,
TrajectoryPlanExportService trajectoryPlanExportService,
ITrajectoryEditableRepository<TrajectoryGeoPlanDto> trajectoryPlanRepository,
2023-05-30 11:21:07 +05:00
TrajectoryService trajectoryVisualizationService)
: base(
wellService,
2023-11-30 15:20:22 +05:00
trajectoryPlanImportService,
trajectoryPlanExportService,
trajectoryPlanRepository)
{
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
}