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

View File

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

View File

@ -2,7 +2,6 @@
using AsbCloudApp.Data.ProcessMap; using AsbCloudApp.Data.ProcessMap;
using AsbCloudApp.Repositories; using AsbCloudApp.Repositories;
using AsbCloudApp.Requests; using AsbCloudApp.Requests;
using AsbCloudApp.Services;
using AsbCloudDb.Model; using AsbCloudDb.Model;
using Mapster; using Mapster;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
@ -54,17 +53,13 @@ namespace AsbCloudInfrastructure.Repository
public async Task<IEnumerable<ProcessMapDto>?> GetCompositeProcessMap(int idWell, CancellationToken token) public async Task<IEnumerable<ProcessMapDto>?> GetCompositeProcessMap(int idWell, CancellationToken token)
{ {
var dtos = await GetAsync(idWell, 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 var result = processMap?.Select(x => new ProcessMapDto
{ {

View File

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