rename some methods

This commit is contained in:
Фролов 2022-03-02 16:21:07 +05:00
parent 055e6daf85
commit ef1d2dda91
5 changed files with 11 additions and 12 deletions

View File

@ -10,7 +10,7 @@ namespace AsbCloudApp.Services
Task<ClusterRopStatDto> GetRopStatByIdWellAsync(int idWell, CancellationToken token); Task<ClusterRopStatDto> GetRopStatByIdWellAsync(int idWell, CancellationToken token);
Task<ClusterRopStatDto> GetRopStatByUidAsync(string uid, CancellationToken token); Task<ClusterRopStatDto> GetRopStatByUidAsync(string uid, CancellationToken token);
Task<StatClusterDto> GetStatClusterAsync(int idCluster, int idCompany, CancellationToken token = default); Task<StatClusterDto> GetStatClusterAsync(int idCluster, int idCompany, CancellationToken token = default);
Task<StatWellDto> GetStatWellAsync(int idWell, CancellationToken token = default); Task<StatWellDto> GetWellStatAsync(int idWell, CancellationToken token = default);
Task<IEnumerable<PlanFactPredictBase<WellOperationDto>>> GetTvdAsync(int idWell, CancellationToken token); Task<IEnumerable<PlanFactPredictBase<WellOperationDto>>> GetTvdAsync(int idWell, CancellationToken token);
Task<IEnumerable<StatWellDto>> GetWellsStatAsync(IEnumerable<int> idWells, CancellationToken token); Task<IEnumerable<StatWellDto>> GetWellsStatAsync(IEnumerable<int> idWells, CancellationToken token);
} }

View File

@ -16,7 +16,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
{ {
public class DrillingProgramService : IDrillingProgramService public class DrillingProgramService : IDrillingProgramService
{ {
private static Dictionary<string, DrillingProgramCreateError> drillingProgramCreateErrors = new Dictionary<string, DrillingProgramCreateError>(); private static readonly Dictionary<string, DrillingProgramCreateError> drillingProgramCreateErrors = new Dictionary<string, DrillingProgramCreateError>();
private readonly IAsbCloudDbContext context; private readonly IAsbCloudDbContext context;
private readonly IFileService fileService; private readonly IFileService fileService;

View File

@ -95,13 +95,13 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
foreach (var well in wells) foreach (var well in wells)
{ {
var statWellDto = await CalcStatWellAsync(well, token); var statWellDto = await CalcWellStatAsync(well, token);
statsWells.Add(statWellDto); statsWells.Add(statWellDto);
} }
return statsWells; return statsWells;
} }
public async Task<StatWellDto> GetStatWellAsync(int idWell, public async Task<StatWellDto> GetWellStatAsync(int idWell,
CancellationToken token = default) CancellationToken token = default)
{ {
var well = await db.Wells var well = await db.Wells
@ -109,7 +109,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
.FirstOrDefaultAsync(w => w.Id == idWell, token) .FirstOrDefaultAsync(w => w.Id == idWell, token)
.ConfigureAwait(false); .ConfigureAwait(false);
var statWellDto = await CalcStatWellAsync(well, token); var statWellDto = await CalcWellStatAsync(well, token);
return statWellDto; return statWellDto;
} }
@ -160,7 +160,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
return clusterRops; return clusterRops;
} }
private async Task<StatWellDto> CalcStatWellAsync(Well well, CancellationToken token = default) private async Task<StatWellDto> CalcWellStatAsync(Well well, CancellationToken token = default)
{ {
var wellType = await cacheWellType.FirstOrDefaultAsync(t => t.Id == well.IdWellType, token); var wellType = await cacheWellType.FirstOrDefaultAsync(t => t.Id == well.IdWellType, token);
var statWellDto = new StatWellDto() var statWellDto = new StatWellDto()

View File

@ -59,7 +59,6 @@ namespace AsbCloudWebApi.Controllers
/// <param name="token"> Токен отмены задачи </param> /// <param name="token"> Токен отмены задачи </param>
/// <returns> Возвращает файл программы бурения </returns> /// <returns> Возвращает файл программы бурения </returns>
[HttpGet] [HttpGet]
[Permission]
[ProducesResponseType(typeof(DrillingProgramStateDto), (int)System.Net.HttpStatusCode.OK)] [ProducesResponseType(typeof(DrillingProgramStateDto), (int)System.Net.HttpStatusCode.OK)]
public async Task<IActionResult> GetStateAsync(int idWell, CancellationToken token) public async Task<IActionResult> GetStateAsync(int idWell, CancellationToken token)
{ {
@ -82,7 +81,7 @@ namespace AsbCloudWebApi.Controllers
/// <param name="idWell"></param> /// <param name="idWell"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("ClearError")] [HttpPost("ClearError")]
[Permission] [Permission("DrillingProgram.get")]
public IActionResult ClearError(int idWell) public IActionResult ClearError(int idWell)
{ {
drillingProgramService.ClearError(idWell); drillingProgramService.ClearError(idWell);
@ -98,7 +97,7 @@ namespace AsbCloudWebApi.Controllers
/// <param name="token"></param> /// <param name="token"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("part/{idFileCategory}")] [HttpPost("part/{idFileCategory}")]
[Permission] [Permission("DrillingProgram.get")]
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)] [ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
public async Task<IActionResult> AddFile( public async Task<IActionResult> AddFile(
int idWell, int idWell,
@ -249,7 +248,7 @@ namespace AsbCloudWebApi.Controllers
/// <param name="token"> Токен отмены задачи </param> /// <param name="token"> Токен отмены задачи </param>
/// <returns></returns> /// <returns></returns>
[HttpPost("fileMark")] [HttpPost("fileMark")]
[Permission] [Permission("DrillingProgram.get")]
public async Task<IActionResult> AddOrReplaceFileMarkAsync(int idWell, FileMarkDto markDto, CancellationToken token) public async Task<IActionResult> AddOrReplaceFileMarkAsync(int idWell, FileMarkDto markDto, CancellationToken token)
{ {
var idCompany = User.GetCompanyId(); var idCompany = User.GetCompanyId();
@ -275,7 +274,7 @@ namespace AsbCloudWebApi.Controllers
/// <param name="token"> Токен отмены задачи </param> /// <param name="token"> Токен отмены задачи </param>
/// <returns></returns> /// <returns></returns>
[HttpDelete("fileMark/{idMark}")] [HttpDelete("fileMark/{idMark}")]
[Permission] [Permission("DrillingProgram.get")]
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)] [ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
public async Task<IActionResult> MarkAsDeletedFileMarkAsync(int idWell, int idMark, public async Task<IActionResult> MarkAsDeletedFileMarkAsync(int idWell, int idMark,
CancellationToken token) CancellationToken token)

View File

@ -126,7 +126,7 @@ namespace AsbCloudWebApi.Controllers
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false)) if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
return Forbid(); return Forbid();
var result = await operationsStatService.GetStatWellAsync(idWell, token) var result = await operationsStatService.GetWellStatAsync(idWell, token)
.ConfigureAwait(false); .ConfigureAwait(false);
return Ok(result); return Ok(result);
} }