Абстракции сервисов и репозиториев

This commit is contained in:
Степанов Дмитрий 2023-10-09 15:22:13 +05:00
parent dbaa0ab754
commit 5d71ff7393
16 changed files with 182 additions and 211 deletions

View File

@ -1,43 +0,0 @@
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.Repositories
{
/// <summary>
/// РТК-план
/// </summary>
public interface IProcessMapPlanRepository : IRepositoryWellRelated<ProcessMapPlanDto>
{
/// <summary>
/// Получить РТК-план начиная с даты.
/// </summary>
/// <param name="idWell"></param>
/// <param name="updateFrom"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<ProcessMapPlanDto>> GetAllAsync(int idWell,
DateTime? updateFrom, CancellationToken token = default);
/// <summary>
/// Получить РТК-план
/// </summary>
/// <param name="requests"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<ProcessMapPlanDto>> GetProcessMapAsync(IEnumerable<ProcessMapRequest> requests,
CancellationToken token);
/// <summary>
/// Удалить РТК-план по скважине
/// </summary>
/// <param name="idWell"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<int> RemoveByWellAsync(int idWell, CancellationToken cancellationToken);
}
}

View File

@ -1,23 +0,0 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Data.ProcessMap;
using AsbCloudApp.Services;
namespace AsbCloudApp.Repositories;
/// <summary>
/// Репозиторий для проработки скважины
/// </summary>
public interface IProcessMapWellboreDevelopmentRepository : IRepositoryWellRelated<ProcessMapWellboreDevelopmentDto>
{
/// <summary>
/// Получить проработку начиная с даты
/// </summary>
/// <param name="idWell"></param>
/// <param name="updateFrom"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<IEnumerable<ProcessMapWellboreDevelopmentDto>> GetAllAsync(int idWell, DateTime? updateFrom, CancellationToken cancellationToken);
}

View File

@ -1,8 +1,8 @@
using AsbCloudApp.Data;
using AsbCloudApp.Data.ProcessMap;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Data.ProcessMaps;
namespace AsbCloudApp.Repositories
{
@ -29,11 +29,11 @@ namespace AsbCloudApp.Repositories
Task<int> SaveAsync(int idWell, IEnumerable<WellCompositeDto> wellComposites, CancellationToken token);
/// <summary>
/// Получение РТК по композитной скважине
/// Получение РТК бурение по композитной скважине
/// </summary>
/// <param name="idWell"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<ProcessMapPlanDto>> GetCompositeProcessMap(int idWell, CancellationToken token);
Task<IEnumerable<WellDrillingProcessMapDto>> GetCompositeProcessMap(int idWell, CancellationToken token);
}
}

View File

@ -0,0 +1,30 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Data.ProcessMaps;
using AsbCloudApp.Requests;
using AsbCloudApp.Services;
namespace AsbCloudApp.Repositories;
/// <summary>
/// РТК бурение скважины
/// </summary>
public interface IWellDrillingProcessMapRepository : IRepositoryWellRelated<WellDrillingProcessMapDto>
{
/// <summary>
/// Получить РТК бурение по параметрам
/// </summary>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<IEnumerable<WellDrillingProcessMapDto>> GetAsync(WellDrillingProcessMapRequest request, CancellationToken cancellationToken);
/// <summary>
/// Получить РТК бурение по коллекции параметров
/// </summary>
/// <param name="requests"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<IEnumerable<WellDrillingProcessMapDto>> GetAsync(IEnumerable<WellDrillingProcessMapRequest> requests, CancellationToken cancellationToken);
}

View File

@ -0,0 +1,22 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Threading;
using AsbCloudApp.Data.ProcessMaps;
using AsbCloudApp.Requests;
using AsbCloudApp.Services;
namespace AsbCloudApp.Repositories;
/// <summary>
/// РТК проработки
/// </summary>
public interface IWellReamProcessMapRepository : IRepositoryWellRelated<WellReamProcessMapDto>
{
/// <summary>
/// Получить РТК проработки по параметрам
/// </summary>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<IEnumerable<WellReamProcessMapDto>> GetAsync(WellReamProcessMapRequest request, CancellationToken cancellationToken);
}

View File

@ -1,25 +0,0 @@
using System;
namespace AsbCloudApp.Requests
{
/// <summary>
/// Параметры для запроса получения РТК
/// </summary>
public class ProcessMapRequest
{
/// <summary>
/// Идентификатор скважины
/// </summary>
public int IdWell { get; set; }
/// <summary>
/// Тип секции
/// </summary>
public int? IdWellSectionType { get; set; }
/// <summary>
/// Дата обновления
/// </summary>
public DateTime? UpdateFrom { get; set; }
}
}

View File

@ -0,0 +1,24 @@
using System;
namespace AsbCloudApp.Requests;
/// <summary>
/// Запрос для получения РТК бурение
/// </summary>
public class WellDrillingProcessMapRequest
{
/// <summary>
/// Идентификатор скважины
/// </summary>
public int IdWell { get; set; }
/// <summary>
/// Тип секции
/// </summary>
public int? IdWellSectionType { get; set; }
/// <summary>
/// Дата обновления
/// </summary>
public DateTime? UpdateFrom { get; set; }
}

View File

@ -0,0 +1,19 @@
using System;
namespace AsbCloudApp.Requests;
/// <summary>
/// Запрос для получения РТК проработки
/// </summary>
public class WellReamProcessMapRequest
{
/// <summary>
/// Идентификатор скважины
/// </summary>
public int IdWell { get; set; }
/// <summary>
/// Дата обновления
/// </summary>
public DateTime? UpdateFrom { get; set; }
}

View File

@ -1,37 +0,0 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudApp.Services;
/// <summary>
/// Сервис импорта/экспорта для РТК вводимых вручную
/// </summary>
public interface IProcessMapPlanImportService
{
/// <summary>
/// Загрузить данные из файла
/// </summary>
/// <param name="idWell"></param>
/// <param name="idUser"></param>
/// <param name="deleteProcessMapPlansBeforeImport"></param>
/// <param name="stream"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task ImportAsync(int idWell, int idUser, bool deleteProcessMapPlansBeforeImport, Stream stream,
CancellationToken cancellationToken);
/// <summary>
/// Сформировать файл с данными
/// </summary>
/// <param name="idWell"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<Stream> ExportAsync(int idWell, CancellationToken cancellationToken);
/// <summary>
/// Получение шаблона для заполнения
/// </summary>
/// <returns></returns>
Task<Stream> GetExcelTemplateStreamAsync(CancellationToken cancellationToken);
}

View File

@ -1,20 +0,0 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudApp.Services
{
/// <summary>
/// Сервис формирования РТК.
/// </summary>
public interface IProcessMapReportMakerService
{
/// <summary>
/// Сформировать.
/// </summary>
/// <param name="idWell"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<Stream> MakeReportAsync(int idWell, CancellationToken token = default);
}
}

View File

@ -1,21 +0,0 @@
using AsbCloudApp.Data.ProcessMap;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudApp.Services
{
/// <summary>
/// Сервис РТК
/// </summary>
public interface IProcessMapService
{
/// <summary>
/// Получение моделей РТК
/// </summary>
/// <param name="idWell"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<ProcessMapReportDto>> GetProcessMapReportAsync(int idWell, CancellationToken token);
}
}

View File

@ -1,39 +0,0 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Data.ProcessMap;
namespace AsbCloudApp.Services;
/// <summary>
/// Сервис для проработок скважины
/// </summary>
public interface IProcessMapWellboreDevelopmentService
{
/// <summary>
/// Добавить запись проработки
/// </summary>
/// <param name="processMapWellboreDevelopment"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<int> InsertAsync(ProcessMapWellboreDevelopmentDto processMapWellboreDevelopment, CancellationToken cancellationToken);
/// <summary>
/// Обновить запись проработки
/// </summary>
/// <param name="processMapWellboreDevelopment"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<int> UpdateAsync(ProcessMapWellboreDevelopmentDto processMapWellboreDevelopment, CancellationToken cancellationToken);
/// <summary>
/// Получить записи проработок по уникальному ключу телеметрии
/// </summary>
/// <param name="uid"></param>
/// <param name="updateFrom"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<IEnumerable<ProcessMapWellboreDevelopmentDto>> GetByTelemetryAsync(string uid, DateTime updateFrom,
CancellationToken cancellationToken);
}

View File

@ -21,6 +21,14 @@ namespace AsbCloudApp.Services
/// <returns>emptyList if nothing found</returns>
Task<IEnumerable<Tdto>> GetByIdWellAsync(int idWell, CancellationToken token);
/// <summary>
/// Удалить записи связанных со скважиной
/// </summary>
/// <param name="idWell"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<int> RemoveByWellAsync(int idWell, CancellationToken cancellationToken);
/// <summary>
/// Получение всех записей по нескольким скважинам
/// </summary>

View File

@ -0,0 +1,37 @@
using System.IO;
using System.Threading.Tasks;
using System.Threading;
namespace AsbCloudApp.Services.ProcessMaps;
/// <summary>
/// Сервис импорта РТК
/// </summary>
public interface IProcessMapImportService
{
/// <summary>
/// Загрузить данные из файла
/// </summary>
/// <param name="idWell"></param>
/// <param name="idUser"></param>
/// <param name="deleteBeforeImport"></param>
/// <param name="stream"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task ImportAsync(int idWell, int idUser, bool deleteBeforeImport, Stream stream,
CancellationToken cancellationToken);
/// <summary>
/// Сформировать файл с данными
/// </summary>
/// <param name="idWell"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<(string Name, Stream File)> ExportAsync(int idWell, CancellationToken cancellationToken);
/// <summary>
/// Получение шаблона для заполнения
/// </summary>
/// <returns></returns>
Task<(string Name, Stream File)> GetExcelTemplateStreamAsync(CancellationToken cancellationToken);
}

View File

@ -0,0 +1,19 @@
using System.IO;
using System.Threading.Tasks;
using System.Threading;
namespace AsbCloudApp.Services.ProcessMaps;
/// <summary>
/// Сервис экспорт РТК
/// </summary>
public interface IProcessMapReportExportService
{
/// <summary>
/// Сформировать файл с данными
/// </summary>
/// <param name="idWell"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<(string Name, Stream File)?> ExportAsync(int idWell, CancellationToken cancellationToken);
}

View File

@ -0,0 +1,20 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Data.ProcessMaps.Report;
namespace AsbCloudApp.Services.ProcessMaps.WellDrillingProcessMap;
/// <summary>
/// Сервис формирования РТК
/// </summary>
public interface IWellDrillingProcessMapReportService
{
/// <summary>
/// Получить отчёт РТК по бурению
/// </summary>
/// <param name="idWell"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<WellDrillingProcessMapReportDto>> GetAsync(int idWell, CancellationToken token);
}