forked from ddrilling/AsbCloudServer
59 lines
2.5 KiB
C#
59 lines
2.5 KiB
C#
using AsbCloudApp.Data.Trajectory;
|
||
using AsbCloudApp.Repositories;
|
||
using AsbCloudApp.Services;
|
||
using AsbCloudInfrastructure.Services.Trajectory;
|
||
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
|
||
{
|
||
|
||
/// <summary>
|
||
/// Плановая траектория (загрузка и хранение)
|
||
/// </summary>
|
||
[Route("api/well/{idWell}/plannedTrajectory")]
|
||
[ApiController]
|
||
public class TrajectoryPlannedController : TrajectoryEditableController<TrajectoryGeoPlanDto>
|
||
{
|
||
private readonly TrajectoryService trajectoryVisualizationService;
|
||
|
||
public TrajectoryPlannedController(IWellService wellService,
|
||
TrajectoryPlannedParserService plannedTrajectoryImportService,
|
||
TrajectoryPlannedExportService plannedTrajectoryExportService,
|
||
ITrajectoryEditableRepository<TrajectoryGeoPlanDto> plannedTrajectoryRepository,
|
||
TrajectoryService trajectoryVisualizationService)
|
||
: base(
|
||
wellService,
|
||
plannedTrajectoryImportService,
|
||
plannedTrajectoryExportService,
|
||
plannedTrajectoryRepository)
|
||
{
|
||
fileName = "ЕЦП_шаблон_файла_плановая_траектория.xlsx";
|
||
this.trajectoryVisualizationService = trajectoryVisualizationService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// Получение координат для визуализации траектории (плановой и фактической)
|
||
/// </summary>
|
||
/// <param name="idWell"></param>
|
||
/// <param name="token"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("trajectoryCartesianPlanFact")]
|
||
[ProducesResponseType(typeof(TrajectoryPlanFactDto<IEnumerable<TrajectoryCartesianPlanDto>, IEnumerable<TrajectoryCartesianFactDto>>), (int)System.Net.HttpStatusCode.OK)]
|
||
public async Task<IActionResult> GetTrajectoryCartesianPlanFactAsync(int idWell, CancellationToken token)
|
||
{
|
||
if (!await CanUserAccessToWellAsync(idWell,
|
||
token).ConfigureAwait(false))
|
||
return Forbid();
|
||
|
||
var result = await trajectoryVisualizationService.GetTrajectoryCartesianAsync(idWell, token);
|
||
return Ok(result);
|
||
}
|
||
}
|
||
|
||
}
|