forked from ddrilling/AsbCloudServer
Merge pull request '#12149981 Рефакторинг путей api' (#90) from feature/refactoring_api_route into dev
Reviewed-on: http://test.digitaldrilling.ru:8080/DDrilling/AsbCloudServer/pulls/90
This commit is contained in:
commit
ec09520d25
@ -97,13 +97,6 @@ namespace AsbCloudApp.Services
|
||||
/// <returns></returns>
|
||||
DatesRangeDto GetDatesRange(int idWell);
|
||||
|
||||
/// <summary>
|
||||
/// Проверить задан ли у скважины часовой пояс и задать его если он не задан
|
||||
/// </summary>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task EnshureTimezonesIsSetAsync(CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// ВРЕМЕННЫЙ метод
|
||||
/// </summary>
|
||||
|
@ -300,26 +300,6 @@ namespace AsbCloudInfrastructure.Services
|
||||
return dto;
|
||||
}
|
||||
|
||||
public async Task EnshureTimezonesIsSetAsync(CancellationToken token)
|
||||
{
|
||||
var cache = await GetCacheAsync(token);
|
||||
if (!cache.Any(w => w.Timezone is null))
|
||||
return;
|
||||
|
||||
var defaultTimeZone = new SimpleTimezone
|
||||
{
|
||||
Hours = 5,
|
||||
IsOverride = false,
|
||||
TimezoneId = "Assumed",
|
||||
};
|
||||
|
||||
await dbSet.Where(w => w.Timezone == null)
|
||||
.ForEachAsync(w => w.Timezone = defaultTimeZone, token);
|
||||
|
||||
await dbContext.SaveChangesAsync(token);
|
||||
DropCache();
|
||||
}
|
||||
|
||||
public SimpleTimezoneDto GetTimezone(int idWell)
|
||||
{
|
||||
var well = GetOrDefault(idWell);
|
||||
|
@ -27,9 +27,7 @@ namespace AsbCloudInfrastructure
|
||||
context.Database.SetCommandTimeout(TimeSpan.FromSeconds(2 * 60));
|
||||
context.Database.Migrate();
|
||||
|
||||
var wellService = provider.GetRequiredService<IWellService>();
|
||||
wellService.EnshureTimezonesIsSetAsync(CancellationToken.None).Wait();// TODO: make this background work
|
||||
|
||||
// TODO: Сделать инициализацию кеша телеметрии более явной.
|
||||
_ = provider.GetRequiredService<TelemetryDataCache<TelemetryDataSaubDto>>();
|
||||
_ = provider.GetRequiredService<TelemetryDataCache<TelemetryDataSpinDto>>();
|
||||
|
||||
|
@ -28,8 +28,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// Merge telemetries. No body required.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("/merge/{idFrom}/{idTo}")]
|
||||
[HttpPost("/merge/{idFrom}/{idTo}")]
|
||||
[Permission]
|
||||
public async Task<IActionResult> MergeTelemetriesAsync(int idFrom, int idTo, CancellationToken token)
|
||||
{
|
||||
|
@ -18,13 +18,5 @@ namespace AsbCloudWebApi.Controllers
|
||||
public AdminWellController(IWellService service)
|
||||
: base(service)
|
||||
{ }
|
||||
|
||||
[HttpPost("EnshureTimezonesIsSet")]
|
||||
[Permission]
|
||||
public async Task<IActionResult> EnshureTimezonesIsSet(CancellationToken token)
|
||||
{
|
||||
await ((IWellService)service).EnshureTimezonesIsSetAsync(token);
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
using AsbCloudApp.Data.User;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudInfrastructure.Repository;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
@ -40,10 +40,9 @@ public class AutoGeneratedDailyReportController : ControllerBase
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("generate")]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)HttpStatusCode.OK)]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)HttpStatusCode.OK, "application/octet-stream")]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
public async Task<IActionResult> GenerateAsync([FromRoute] int idWell,
|
||||
public async Task<IActionResult> GenerateReportAsync([FromRoute] int idWell,
|
||||
[Required] DateOnly reportDate,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
@ -54,7 +53,7 @@ public class AutoGeneratedDailyReportController : ControllerBase
|
||||
reportDate,
|
||||
cancellationToken);
|
||||
|
||||
return File(reportFile.stream, "application/octet-stream", reportFile.fileName);
|
||||
return File(reportFile.stream, reportFile.fileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -64,7 +63,7 @@ public class AutoGeneratedDailyReportController : ControllerBase
|
||||
/// <param name="request">Параметры запроса</param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[HttpGet("all")]
|
||||
[ProducesResponseType(typeof(PaginationContainer<AutoGeneratedDailyReportInfoDto>), (int)HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetListAsync([FromRoute][Required] int idWell,
|
||||
[FromQuery] AutoGeneratedDailyReportRequest request,
|
||||
|
@ -1,7 +1,6 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.DailyReport;
|
||||
using AsbCloudApp.Exceptions;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@ -10,6 +9,7 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
@ -24,16 +24,13 @@ namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
private readonly IDailyReportService dailyReportService;
|
||||
private readonly IWellService wellService;
|
||||
private readonly IWellOperationRepository operationRepository;
|
||||
|
||||
public DailyReportController(
|
||||
IDailyReportService dailyReportService,
|
||||
IWellService wellService,
|
||||
IWellOperationRepository operationRepository)
|
||||
IWellService wellService)
|
||||
{
|
||||
this.dailyReportService = dailyReportService;
|
||||
this.wellService = wellService;
|
||||
this.operationRepository = operationRepository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -165,7 +162,8 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{date}/excel")]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
public async Task<IActionResult> DownloadAsync(int idWell, DateOnly date, CancellationToken token)
|
||||
{
|
||||
if (!await UserHasAccesToWellAsync(idWell, token))
|
||||
@ -175,13 +173,12 @@ namespace AsbCloudWebApi.Controllers
|
||||
?? throw new ArgumentInvalidException($"Скважина c id:{idWell} не найдена", nameof(idWell));
|
||||
|
||||
var stream = await dailyReportService.MakeReportAsync(idWell, date, token);
|
||||
if (stream is not null)
|
||||
{
|
||||
var fileName = $"Суточный рапорт по скважине {well.Caption} куст {well.Cluster}.xlsx";
|
||||
return File(stream, "application/octet-stream", fileName);
|
||||
}
|
||||
else
|
||||
if (stream is null)
|
||||
return NoContent();
|
||||
|
||||
var fileName = $"Суточный рапорт по скважине {well.Caption} куст {well.Cluster}.xlsx";
|
||||
return File(stream, fileName);
|
||||
|
||||
}
|
||||
|
||||
protected async Task<bool> UserHasAccesToWellAsync(int idWell, CancellationToken token)
|
||||
|
@ -83,7 +83,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// </summary>
|
||||
/// <param name="idWell"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("ClearError")]
|
||||
[HttpDelete("errors")]
|
||||
[Permission("DrillingProgram.get")]
|
||||
public IActionResult ClearError(int idWell)
|
||||
{
|
||||
|
@ -30,7 +30,6 @@ public class FactTrajectoryController : ControllerBase
|
||||
/// <param name="cancellationToken">Токен отмены операции</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("getRows")]
|
||||
[ProducesResponseType(typeof(IEnumerable<TrajectoryGeoPlanDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetRowsAsync([FromRoute] int idWell,
|
||||
CancellationToken cancellationToken)
|
||||
|
@ -73,8 +73,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="request"> </param>
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns>Список информации о файлах в этой категории</returns>
|
||||
[HttpGet]
|
||||
[Route("/api/files")]
|
||||
[HttpGet("/api/files")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(PaginationContainer<FileInfoDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetFilesInfoAsync(
|
||||
@ -101,8 +100,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="idFile">id запрашиваемого файла</param>
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns>Запрашиваемый файл</returns>
|
||||
[HttpGet]
|
||||
[Route("{idFile}")]
|
||||
[HttpGet("{idFile}")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetFileAsync(
|
||||
@ -220,8 +218,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="idFile">id запрашиваемого файла</param>
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns>Запрашиваемый файл</returns>
|
||||
[HttpGet]
|
||||
[Route("/api/files/{idFile}")]
|
||||
[HttpGet("/api/files/{idFile}")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(FileInfoDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetFileInfoAsync([FromRoute] int idFile, CancellationToken token)
|
||||
|
@ -102,8 +102,7 @@ public class HelpPageController : ControllerBase
|
||||
/// <param name="idCategory">Id категории файла. Допустимое значение параметра: 20000</param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("isExisting")]
|
||||
[HttpGet("isExisting")]
|
||||
[ProducesResponseType(typeof(bool), (int)HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> IsExistingAsync(
|
||||
[Required] string key,
|
||||
|
@ -24,9 +24,8 @@ namespace AsbCloudWebApi.Controllers
|
||||
this.wellService = wellService;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HttpGet("categories")]
|
||||
[Permission]
|
||||
[Route("categories")]
|
||||
public async Task<IActionResult> GetCategoriesAsync([FromRoute] int idWell, CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
@ -36,9 +35,8 @@ namespace AsbCloudWebApi.Controllers
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HttpGet("last/{idCategory}")]
|
||||
[Permission]
|
||||
[Route("last/{idCategory}")]
|
||||
public async Task<IActionResult> GetLastAsync([FromRoute] int idWell, [FromRoute] int idCategory, CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
@ -55,9 +53,8 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="idCategory">Категория скважины. Не обязательный параметр.</param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[HttpGet("history")]
|
||||
[Permission]
|
||||
[Route("history")]
|
||||
public async Task<IActionResult> GetHisoryAsync([FromRoute] int idWell, CancellationToken token,
|
||||
int? idCategory = null)
|
||||
{
|
||||
@ -90,9 +87,8 @@ namespace AsbCloudWebApi.Controllers
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
[HttpDelete]
|
||||
[HttpDelete("history/{idData}")]
|
||||
[Permission]
|
||||
[Route("history/{idData}")]
|
||||
public async Task<IActionResult> MarkAsDeleteAsync([FromRoute] int idWell, [FromRoute] int idData, CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
|
@ -16,7 +16,7 @@ namespace AsbCloudWebApi.Controllers;
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
[Route("api/notification")]
|
||||
[Route("api/[controller]")]
|
||||
public class NotificationController : ControllerBase
|
||||
{
|
||||
private readonly NotificationService notificationService;
|
||||
@ -40,7 +40,6 @@ public class NotificationController : ControllerBase
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("send")]
|
||||
public async Task<IActionResult> SendAsync([Required] int idUser,
|
||||
[Required]
|
||||
[Range(minimum: 1, maximum: 1, ErrorMessage = "Id категории уведомления недоступно. Допустимые: 1")]
|
||||
@ -70,7 +69,6 @@ public class NotificationController : ControllerBase
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[Route("update")]
|
||||
public async Task<IActionResult> UpdateAsync([Required] int idNotification,
|
||||
[Required] bool isRead,
|
||||
CancellationToken cancellationToken)
|
||||
@ -88,8 +86,7 @@ public class NotificationController : ControllerBase
|
||||
/// <param name="idNotification">Id уведомления</param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("get/{idNotification}")]
|
||||
[HttpGet("{idNotification}")]
|
||||
[ProducesResponseType(typeof(NotificationDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetAsync([Required] int idNotification,
|
||||
CancellationToken cancellationToken)
|
||||
@ -112,7 +109,6 @@ public class NotificationController : ControllerBase
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("getList")]
|
||||
[ProducesResponseType(typeof(PaginationContainer<NotificationDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetListAsync([FromQuery] NotificationRequest request,
|
||||
CancellationToken cancellationToken)
|
||||
@ -135,8 +131,7 @@ public class NotificationController : ControllerBase
|
||||
/// <param name="idNotification">Id уведомления</param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete]
|
||||
[Route("delete")]
|
||||
[HttpDelete("{idNotification}")]
|
||||
public async Task<IActionResult> DeleteAsync([Required] int idNotification,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
|
@ -77,8 +77,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="idCluster">id куста</param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("cluster/{idCluster}/stat")]
|
||||
[HttpGet("cluster/{idCluster}/stat")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(StatClusterDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetStatClusterAsync(int idCluster,
|
||||
@ -99,8 +98,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="idWells">список скважин</param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("wellsStats")]
|
||||
[HttpGet("wellsStats")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<StatWellDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetWellsStatAsync([FromQuery] IEnumerable<int> idWells, CancellationToken token)
|
||||
@ -123,8 +121,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="idWell">id скважины</param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("well/{idWell}/stat")]
|
||||
[HttpGet("well/{idWell}/stat")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(StatWellDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetStatWellAsync(int idWell,
|
||||
@ -144,8 +141,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="idWell"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("well/{idWell}/tvd")]
|
||||
[HttpGet("well/{idWell}/tvd")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<PlanFactPredictBase<WellOperationDto>>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetTvdAsync(int idWell,
|
||||
|
@ -8,7 +8,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <summary>
|
||||
/// Целевые и нормативные значения по глубине
|
||||
/// </summary>
|
||||
[Route("api/operationValue")]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
public class OperationValueController : CrudWellRelatedController<OperationValueDto, IRepositoryWellRelated<OperationValueDto>>
|
||||
|
@ -38,18 +38,18 @@ namespace AsbCloudWebApi.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает шаблон для заполнения строк плановой траектории
|
||||
/// Возвращает excel шаблон для заполнения строк плановой траектории
|
||||
/// </summary>
|
||||
/// <returns>Запрашиваемый файл</returns>
|
||||
[HttpGet]
|
||||
[Route("template")]
|
||||
[HttpGet("template")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK,"application/octet-stream")]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
public IActionResult GetTemplate()
|
||||
{
|
||||
var stream = plannedTrajectoryImportService.GetTemplateFile();
|
||||
var fileName = "ЕЦП_шаблон_файла_плановая_траектория.xlsx";
|
||||
return File(stream, "application/octet-stream", fileName);
|
||||
return File(stream, fileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -58,9 +58,9 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="idWell">id скважины</param>
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns>Запрашиваемый файл</returns>
|
||||
[HttpGet]
|
||||
[Route("export")]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)]
|
||||
[HttpGet("export")]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
public async Task<IActionResult> ExportAsync([FromRoute] int idWell, CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell,
|
||||
@ -68,7 +68,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
return Forbid();
|
||||
var stream = await plannedTrajectoryImportService.ExportAsync(idWell, token);
|
||||
var fileName = await plannedTrajectoryImportService.GetFileNameAsync(idWell, token);
|
||||
return File(stream, "application/octet-stream", fileName);
|
||||
return File(stream, fileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -79,8 +79,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="deleteBeforeImport">Удалить операции перед импортом, если фал валидный</param>
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns>количество успешно записанных строк в БД</returns>
|
||||
[HttpPost]
|
||||
[Route("import/{deleteBeforeImport}")]
|
||||
[HttpPost("import/{deleteBeforeImport}")]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> ImportAsync(int idWell,
|
||||
[FromForm] IFormFileCollection files,
|
||||
@ -118,7 +117,6 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns>Список добавленных координат плановой траектории</returns>
|
||||
[HttpGet]
|
||||
[Route("getRows")]
|
||||
[ProducesResponseType(typeof(IEnumerable<TrajectoryGeoPlanDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetAsync([FromRoute] int idWell, CancellationToken token)
|
||||
{
|
||||
@ -137,7 +135,6 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"></param>
|
||||
/// <returns>количество успешно записанных строк в БД</returns>
|
||||
[HttpPost]
|
||||
[Route("addRow")]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> AddAsync(int idWell, [FromBody] TrajectoryGeoPlanDto row,
|
||||
CancellationToken token)
|
||||
@ -160,8 +157,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="rows"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns>количество успешно записанных строк в БД</returns>
|
||||
[HttpPost]
|
||||
[Route("addRangeRows")]
|
||||
[HttpPost("range")]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> AddRangeAsync(int idWell, [FromBody] IEnumerable<TrajectoryGeoPlanDto> rows,
|
||||
CancellationToken token)
|
||||
@ -231,7 +227,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="idWell"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[HttpGet("trajectoryCartesianPlanFact")]
|
||||
[ProducesResponseType(typeof(PlanFactBase<IEnumerable<TrajectoryCartesianPlanDto>, IEnumerable<TrajectoryCartesianFactDto>>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetTrajectoryCartesianPlanFactAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
|
@ -57,9 +57,8 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="updateFrom"> Дата, с которой следует искать новые параметры </param>
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns> Список параметров для коридоров бурения </returns>
|
||||
[HttpGet]
|
||||
[HttpGet("/api/telemetry/{uid}/drillFlowChart")]
|
||||
[Obsolete("use GetByUidAsync(..) instead")]
|
||||
[Route("/api/telemetry/{uid}/drillFlowChart")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(typeof(IEnumerable<ProcessMapPlanDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public IActionResult GetByTelemetry(string uid, DateTime updateFrom, CancellationToken token)
|
||||
@ -77,8 +76,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="updateFrom"> Дата, с которой следует искать новые параметры </param>
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns> Список параметров для коридоров бурения </returns>
|
||||
[HttpGet]
|
||||
[Route("/api/telemetry/{uid}/processMap")]
|
||||
[HttpGet("/api/telemetry/{uid}/processMap")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(typeof(IEnumerable<ProcessMapPlanDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetByUidAsync(string uid, DateTime updateFrom, CancellationToken token)
|
||||
@ -99,9 +97,9 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="wellId"></param>
|
||||
/// /// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("getReportFile/{wellId}")]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)]
|
||||
[HttpGet("report/{wellId}")]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
public async Task<IActionResult> GetReportFileAsync(int wellId, CancellationToken token)
|
||||
{
|
||||
var stream = await processMapReportService.MakeReportAsync(wellId, token);
|
||||
@ -110,14 +108,12 @@ namespace AsbCloudWebApi.Controllers
|
||||
var well = await wellService.GetOrDefaultAsync(wellId, token);
|
||||
if (well is null)
|
||||
return NoContent();
|
||||
else
|
||||
{
|
||||
var fileName = $"РТК по скважине {well.Caption} куст {well.Cluster}.xlsx";
|
||||
return File(stream, "application/octet-stream", fileName);
|
||||
}
|
||||
|
||||
var fileName = $"РТК по скважине {well.Caption} куст {well.Cluster}.xlsx";
|
||||
return File(stream, fileName);
|
||||
}
|
||||
else
|
||||
return NoContent();
|
||||
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -126,8 +122,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="wellId"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("getDrillProcessMap/{wellId}")]
|
||||
[HttpGet("report/{wellId}/data")]
|
||||
[ProducesResponseType(typeof(IEnumerable<ProcessMapReportDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetDrillProcessMap(int wellId, CancellationToken token)
|
||||
{
|
||||
@ -169,14 +164,13 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// Возвращает шаблон файла импорта плановой РТК
|
||||
/// </summary>
|
||||
/// <returns>Запрашиваемый файл</returns>
|
||||
[HttpGet]
|
||||
[Route("template")]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)]
|
||||
[HttpGet("template")]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")]
|
||||
public async Task<IActionResult> GetTemplateAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
var stream = await processMapPlanImportService.GetExcelTemplateStreamAsync(cancellationToken);
|
||||
var fileName = "ЕЦП_шаблон_файла_РТК.xlsx";
|
||||
return File(stream, "application/octet-stream", fileName);
|
||||
return File(stream, fileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -187,8 +181,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="file">Загружаемый файл</param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("import/{idWell}/{options}")]
|
||||
[HttpPost("import/{idWell}/{options}")]
|
||||
public async Task<IActionResult> ImportAsync(int idWell,
|
||||
int options,
|
||||
[Required] IFormFile file,
|
||||
@ -226,9 +219,9 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="idWell">Id скважины</param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("export/{idWell}")]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)]
|
||||
[HttpGet("export/{idWell}")]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
public async Task<IActionResult> ExportAsync(int idWell, CancellationToken cancellationToken)
|
||||
{
|
||||
int? idUser = User.GetUserId();
|
||||
@ -243,7 +236,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
|
||||
var stream = await processMapPlanImportService.ExportAsync(idWell, cancellationToken);
|
||||
var fileName = $"РТК-план по скважине {well.Caption} куст {well.Cluster}.xlsx";
|
||||
return File(stream, "application/octet-stream", fileName);
|
||||
return File(stream, fileName);
|
||||
}
|
||||
|
||||
private async Task NotifyUsersBySignalR(int idWell, CancellationToken token)
|
||||
|
@ -104,8 +104,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="request">Параметры запроса</param>
|
||||
/// <param name="token">Токен для отмены задачи</param>
|
||||
/// <returns>прогнозируемое кол-во страниц отчета</returns>
|
||||
[HttpGet]
|
||||
[Route("reportSize")]
|
||||
[HttpGet("reportSize")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(string), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetReportSizeAsync([Required] int idWell,
|
||||
@ -133,8 +132,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="idWell">id скважины</param>
|
||||
/// <param name="token">Токен для отмены задачи</param>
|
||||
/// <returns>Даты самого старого и самого свежего отчетов в БД</returns>
|
||||
[HttpGet]
|
||||
[Route("datesRange")]
|
||||
[HttpGet("datesRange")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(DatesRangeDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetReportsDateRangeAsync(int idWell, CancellationToken token)
|
||||
|
@ -8,6 +8,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers.SAUB
|
||||
{
|
||||
@ -120,10 +121,10 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
/// <param name="idCluster"></param>
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns>Запрашиваемый файл</returns>
|
||||
[HttpGet]
|
||||
[Route("export")]
|
||||
[HttpGet("export")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
public async Task<IActionResult> ExportAsync(int? idWell, int? idCluster, CancellationToken token)
|
||||
{
|
||||
if (idCluster is null && idWell is null)
|
||||
@ -151,7 +152,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
|
||||
var stream = await detectedOperationService.ExportAsync(idsWells, token);
|
||||
var fileName = "operations.xlsx";
|
||||
return File(stream, "application/octet-stream", fileName);
|
||||
return File(stream, fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,8 +64,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
/// <param name="idWell">id скважины</param>
|
||||
/// <param name="token">Токен для отмены задачи</param>
|
||||
/// <returns>список сообщений по скважине</returns>
|
||||
[HttpGet]
|
||||
[Route("datesRange")]
|
||||
[HttpGet("datesRange")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(DatesRangeDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetMessagesDateRangeAsync(int idWell, CancellationToken token)
|
||||
|
@ -44,8 +44,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
/// <param name="info">Информация об отправителе</param>
|
||||
/// <param name="token">Токен отмены задачи</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("{uid}/info")]
|
||||
[HttpPost("{uid}/info")]
|
||||
public async Task<IActionResult> PostInfoAsync(string uid, [FromBody] TelemetryInfoDto info,
|
||||
CancellationToken token)
|
||||
{
|
||||
@ -60,8 +59,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
/// <param name="dtos">сообщения</param>
|
||||
/// <param name="token">Токен для отмены задачи</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("{uid}/message")]
|
||||
[HttpPost("{uid}/message")]
|
||||
public async Task<IActionResult> PostMessagesAsync(string uid, [FromBody] IEnumerable<TelemetryMessageDto> dtos,
|
||||
CancellationToken token)
|
||||
{
|
||||
@ -82,8 +80,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
/// <param name="events">справочник событий</param>
|
||||
/// <param name="token">Токен для отмены задачи</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("{uid}/event")]
|
||||
[HttpPost("{uid}/event")]
|
||||
public async Task<IActionResult> PostEventsAsync(string uid, [FromBody] List<EventDto> events,
|
||||
CancellationToken token)
|
||||
{
|
||||
@ -99,8 +96,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
/// <param name="users">справочник пользователей телеметрии</param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("{uid}/user")]
|
||||
[HttpPost("{uid}/user")]
|
||||
public async Task<IActionResult> PostUsersAsync(string uid, [FromBody] List<TelemetryUserDto> users,
|
||||
CancellationToken token)
|
||||
{
|
||||
|
@ -44,8 +44,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
/// <param name="dtos">Данные</param>
|
||||
/// <param name="token">Токен для отмены задачи</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("{uid}")]
|
||||
[HttpPost("{uid}")]
|
||||
[AllowAnonymous]
|
||||
public virtual async Task<IActionResult> PostDataAsync(string uid, [FromBody] IEnumerable<TDto> dtos,
|
||||
CancellationToken token)
|
||||
@ -102,8 +101,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
/// <param name="idWell">id скважины</param>
|
||||
/// <param name="token">Токен завершения задачи</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("{idWell}/datesRange")]
|
||||
[HttpGet("{idWell}/datesRange")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(DatesRangeDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public virtual async Task<ActionResult<DatesRangeDto>> GetDataDatesRangeAsync(int idWell,
|
||||
|
@ -3,11 +3,10 @@ using AsbCloudApp.Services;
|
||||
using AsbCloudWebApi.SignalR;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using AsbCloudInfrastructure.Services;
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers.SAUB
|
||||
{
|
||||
@ -44,7 +43,8 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{idWell}/export/csv")]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
public async Task<IActionResult> GetZippedCsv(int idWell, DateTime beginDate, DateTime endDate, CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
@ -60,7 +60,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
|
||||
var stream = await telemetryDataSaubService.GetZippedCsv(idWell, beginDate, endDate, token).ConfigureAwait(false);
|
||||
var fileName = $"DataSaub idWell{idWell} {beginDate:yyyy-MM-DDTHH-mm} - {endDate:yyyy-MM-DDTHH-mm}.zip";
|
||||
return File(stream, "application/octet-stream", fileName);
|
||||
return File(stream, fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,8 +45,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
/// <param name="dto"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("{uid}")]
|
||||
[HttpPost("{uid}")]
|
||||
[AllowAnonymous]
|
||||
public async Task<IActionResult> PostDataAsync(string uid, [FromBody] TelemetryWirelineRunOutBaseDto dto, CancellationToken token)
|
||||
{
|
||||
|
@ -71,7 +71,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="idWell"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getCompositeProcessMap")]
|
||||
[HttpGet("compositeProcessMap")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<ProcessMapPlanDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetCompositeProcessMap(int idWell, CancellationToken token)
|
||||
|
@ -160,8 +160,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// Получение справочника категорий файлов
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("wellCaseCategories")]
|
||||
[HttpGet("wellCaseCategories")]
|
||||
[Permission]
|
||||
public async Task<IActionResult> GetWellCaseCategoriesAsync(CancellationToken token)
|
||||
{
|
||||
|
@ -1,5 +1,4 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Exceptions;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Requests;
|
||||
using AsbCloudApp.Services;
|
||||
@ -10,7 +9,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -40,8 +38,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// Возвращает словарь типов секций
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("sectionTypes")]
|
||||
[HttpGet("sectionTypes")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<WellSectionTypeDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public IActionResult GetSectionTypes()
|
||||
@ -55,8 +52,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// </summary>
|
||||
/// <param name="includeParents">флаг, нужно ли включать родителей в список</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("categories")]
|
||||
[HttpGet("categories")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<WellOperationCategoryDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public IActionResult GetCategories(bool includeParents = true)
|
||||
@ -72,8 +68,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="currentDate">дата для нахождения последней сопоставленной плановой операции</param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("operationsPlan")]
|
||||
[HttpGet("operationsPlan")]
|
||||
[ProducesResponseType(typeof(WellOperationPlanDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetOperationsPlanAsync(
|
||||
[FromRoute] int idWell,
|
||||
@ -97,8 +92,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="request"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns>Список операций на скважине</returns>
|
||||
[HttpGet]
|
||||
[Route("fact")]
|
||||
[HttpGet("fact")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<WellOperationDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetPageOperationsFactAsync(
|
||||
@ -125,8 +119,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="request"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns>Список операций на скважине в контейнере для постраничного просмотра</returns>
|
||||
[HttpGet]
|
||||
[Route("plan")]
|
||||
[HttpGet("plan")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(PaginationContainer<WellOperationDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetPageOperationsPlanAsync(
|
||||
@ -152,8 +145,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="request"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("groupStat")]
|
||||
[HttpGet("groupStat")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<WellGroupOpertionDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetGroupOperationsAsync(
|
||||
@ -179,8 +171,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="idOperation">id нужной операции</param>
|
||||
/// <param name="token">Токен отмены задачи</param>
|
||||
/// <returns>Нужную операцию на скважине</returns>
|
||||
[HttpGet]
|
||||
[Route("{idOperation}")]
|
||||
[HttpGet("{idOperation}")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(WellOperationDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetOrDefaultAsync(int idWell, int idOperation,
|
||||
@ -282,9 +273,8 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="options">Удалить операции перед импортом = 1, если фал валидный</param>
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[HttpPost("import/{options}")]
|
||||
[Permission]
|
||||
[Route("import/{options}")]
|
||||
public async Task<IActionResult> ImportAsync(int idWell,
|
||||
[FromForm] IFormFileCollection files,
|
||||
int options,
|
||||
@ -324,12 +314,12 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// Создает excel файл с операциями по скважине
|
||||
/// </summary>
|
||||
/// <param name="idWell">id скважины</param>
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <param name="token">Токен отмены задачи </param>
|
||||
/// <returns>Запрашиваемый файл</returns>
|
||||
[HttpGet]
|
||||
[Route("export")]
|
||||
[HttpGet("export")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
public async Task<IActionResult> ExportAsync([FromRoute] int idWell, CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
@ -343,7 +333,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
|
||||
var stream = wellOperationImportService.Export(idWell);
|
||||
var fileName = await wellService.GetWellCaptionByIdAsync(idWell, token) + "_operations.xlsx";
|
||||
return File(stream, "application/octet-stream", fileName);
|
||||
return File(stream, fileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -353,8 +343,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="scheduleReportService"></param>
|
||||
/// <param name="token"> Токен отмены задачи</param>
|
||||
/// <returns>Запрашиваемый файл</returns>
|
||||
[HttpGet]
|
||||
[Route("scheduleReport")]
|
||||
[HttpGet("scheduleReport")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> ScheduleReportAsync([FromRoute] int idWell, [FromServices] IScheduleReportService scheduleReportService, CancellationToken token)
|
||||
@ -377,15 +366,14 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// Возвращает шаблон файла импорта
|
||||
/// </summary>
|
||||
/// <returns>Запрашиваемый файл</returns>
|
||||
[HttpGet]
|
||||
[Route("template")]
|
||||
[HttpGet("template")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")]
|
||||
public IActionResult GetTemplate()
|
||||
{
|
||||
var stream = wellOperationImportService.GetExcelTemplateStream();
|
||||
var fileName = "ЕЦП_шаблон_файла_операций.xlsx";
|
||||
return File(stream, "application/octet-stream", fileName);
|
||||
return File(stream, fileName);
|
||||
}
|
||||
|
||||
private async Task<bool> CanUserAccessToWellAsync(int idWell, CancellationToken token)
|
||||
|
Loading…
Reference in New Issue
Block a user