#8103063 Замечания

This commit is contained in:
ai.astrakhantsev 2023-02-02 12:04:50 +05:00
parent 20b99011d1
commit 5644c06fac
4 changed files with 15 additions and 17 deletions

View File

@ -1,11 +1,12 @@
using AsbCloudApp.Data.ProcessMap;
using AsbCloudApp.Requests;
using AsbCloudApp.Services;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudApp.Services
namespace AsbCloudApp.Repositories
{
#nullable enable
/// <summary>
@ -26,10 +27,10 @@ namespace AsbCloudApp.Services
/// <summary>
/// Ïîëó÷èòü ïàðàìåòðû áóðåíèÿ
/// </summary>
/// <param name="request"></param>
/// <param name="requests"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<ProcessMapDto>?> GetByRequesProcessMaplAsync(IEnumerable<ProcessMapRequest> request, CancellationToken token);
Task<IEnumerable<ProcessMapDto>?> GetProcessMaplAsync(IEnumerable<ProcessMapRequest> requests, CancellationToken token);
}
#nullable disable
}

View File

@ -1,5 +1,6 @@
using AsbCloudApp.Data;
using AsbCloudApp.Data.ProcessMap;
using AsbCloudApp.Repositories;
using AsbCloudApp.Requests;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
@ -31,7 +32,7 @@ namespace AsbCloudInfrastructure.Repository
public async Task<IEnumerable<ProcessMapDto>> GetAllAsync(int idWell,
DateTime? updateFrom, CancellationToken token)
{
var request = new List<ProcessMapRequest>
var request = new[]
{
new ProcessMapRequest {
IdWell = idWell,
@ -49,9 +50,9 @@ namespace AsbCloudInfrastructure.Repository
return dtos;
}
public async Task<IEnumerable<ProcessMapDto>?> GetByRequesProcessMaplAsync(IEnumerable<ProcessMapRequest> request, CancellationToken token)
public async Task<IEnumerable<ProcessMapDto>?> GetProcessMaplAsync(IEnumerable<ProcessMapRequest> requests, CancellationToken token)
{
var entities = await BuildQuery(request)
var entities = await BuildQuery(requests)
.ToListAsync(token)
.ConfigureAwait(false);
var dtos = entities.Select(Convert).ToList();

View File

@ -2,7 +2,6 @@
using AsbCloudApp.Data.ProcessMap;
using AsbCloudApp.Repositories;
using AsbCloudApp.Requests;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using Mapster;
using Microsoft.EntityFrameworkCore;
@ -54,17 +53,13 @@ namespace AsbCloudInfrastructure.Repository
public async Task<IEnumerable<ProcessMapDto>?> GetCompositeProcessMap(int idWell, CancellationToken token)
{
var dtos = await GetAsync(idWell, token);
var request = new List<ProcessMapRequest>(dtos.Count());
foreach(var dto in dtos)
{
request.Add(new ProcessMapRequest
{
IdWell = dto.IdWellSrc,
IdWellSectionTypes = dto.IdWellSectionType
});
};
var processMap = (await processMapRepository.GetByRequesProcessMaplAsync(request, token));
var request = dtos.Select(x => new ProcessMapRequest {
IdWell = x.IdWellSrc,
IdWellSectionTypes = x.IdWellSectionType
});
var processMap = (await processMapRepository.GetProcessMaplAsync(request, token));
var result = processMap?.Select(x => new ProcessMapDto
{

View File

@ -1,4 +1,5 @@
using AsbCloudApp.Data.ProcessMap;
using AsbCloudApp.Repositories;
using AsbCloudApp.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;