forked from ddrilling/AsbCloudServer
Merge pull request 'feature/change-log-refactoring' (#280) from feature/change-log-refactoring into dev
Reviewed-on: http://test.digitaldrilling.ru:8080/DDrilling/AsbCloudServer/pulls/280
This commit is contained in:
commit
e6fdc56750
@ -6,12 +6,12 @@ namespace AsbCloudApp.Data;
|
||||
/// <summary>
|
||||
/// Часть записи описывающая изменение
|
||||
/// </summary>
|
||||
public abstract class ChangeLogAbstract
|
||||
public class ChangeLogDto<T> where T: IId
|
||||
{
|
||||
/// <summary>
|
||||
/// ИД записи
|
||||
/// Запись
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
public required T Item { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Автор
|
@ -5,13 +5,18 @@ using System.ComponentModel.DataAnnotations;
|
||||
namespace AsbCloudApp.Data.ProcessMaps;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public abstract class ProcessMapPlanBaseDto : ChangeLogAbstract, IId, IWellRelated, IValidatableObject
|
||||
public abstract class ProcessMapPlanBaseDto : IId, IWellRelated, IValidatableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Id скважины
|
||||
/// </summary>
|
||||
public int IdWell { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Id записи
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Тип секции
|
||||
/// </summary>
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.ProcessMaps;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -19,8 +20,8 @@ namespace AsbCloudApp.Extensions
|
||||
/// <param name="items"></param>
|
||||
/// <param name="moment"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<T> WhereActualAtMoment<T>(this IEnumerable<T> items, DateTimeOffset moment)
|
||||
where T : ChangeLogAbstract
|
||||
public static IEnumerable<ChangeLogDto<T>> WhereActualAtMoment<T>(this IEnumerable<ChangeLogDto<T>> items, DateTimeOffset moment)
|
||||
where T : IId
|
||||
{
|
||||
var actualItems = items
|
||||
.Where(item => item.Creation <= moment)
|
||||
|
62
AsbCloudApp/Repositories/IChangeLogQueryBuilder.cs
Normal file
62
AsbCloudApp/Repositories/IChangeLogQueryBuilder.cs
Normal file
@ -0,0 +1,62 @@
|
||||
using AsbCloudApp.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudApp.Repositories;
|
||||
|
||||
/// <summary>
|
||||
/// Интерфейс для работы с объектами, содержащими историю изменений
|
||||
/// </summary>
|
||||
/// <typeparam name="TDto"></typeparam>
|
||||
/// <typeparam name="TRequest"></typeparam>
|
||||
public interface IChangeLogQueryBuilder<TDto, TRequest>
|
||||
where TDto : IId
|
||||
{
|
||||
/// <summary>
|
||||
/// Применение запроса
|
||||
/// </summary>
|
||||
/// <param name="request">Запрос</param>
|
||||
/// <returns></returns>
|
||||
IChangeLogQueryBuilderWithKnownTimezone<TDto, TRequest> ApplyRequest(TRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Материализация записей
|
||||
/// </summary>
|
||||
/// <param name="offset"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<TDto>> GetData(TimeSpan offset, CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// Материализация записей с историей
|
||||
/// </summary>
|
||||
/// <param name="offset"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<ChangeLogDto<TDto>>> GetChangeLogData(TimeSpan offset, CancellationToken token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Интерфейс для работы с объектами, содержащими историю изменений. С известной временной зоной
|
||||
/// </summary>
|
||||
/// <typeparam name="TDto"></typeparam>
|
||||
/// <typeparam name="TRequest"></typeparam>
|
||||
public interface IChangeLogQueryBuilderWithKnownTimezone<TDto, TRequest>: IChangeLogQueryBuilder<TDto, TRequest>
|
||||
where TDto : IId
|
||||
{
|
||||
/// <summary>
|
||||
/// Материализация записей. Временная зона определяется по запросу из последнего ApplyRequest
|
||||
/// </summary>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<TDto>> GetData(CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// Материализация записей с историей. Временная зона определяется по запросу из последнего ApplyRequest
|
||||
/// </summary>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<ChangeLogDto<TDto>>> GetChangeLogData(CancellationToken token);
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Requests;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Requests;
|
||||
|
||||
namespace AsbCloudApp.Repositories;
|
||||
|
||||
@ -11,41 +11,40 @@ namespace AsbCloudApp.Repositories;
|
||||
/// Репозиторий для записей с историей
|
||||
/// </summary>
|
||||
public interface IChangeLogRepository<TDto, TRequest>
|
||||
where TDto : ChangeLogAbstract
|
||||
where TRequest : ChangeLogBaseRequest
|
||||
where TDto : IId
|
||||
{
|
||||
/// <summary>
|
||||
/// Добавление записей
|
||||
/// </summary>
|
||||
/// <param name="idUser"></param>
|
||||
/// <param name="dtos"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<int> InsertRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token);
|
||||
/// <summary>
|
||||
/// Добавление записей
|
||||
/// </summary>
|
||||
/// <param name="idUser">пользователь, который добавляет</param>
|
||||
/// <param name="dtos"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<int> InsertRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// Редактирование записей
|
||||
/// </summary>
|
||||
/// <param name="idUser"></param>
|
||||
/// <param name="dtos"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<int> UpdateRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token);
|
||||
/// <summary>
|
||||
/// Редактирование записей
|
||||
/// </summary>
|
||||
/// <param name="idUser">пользователь, который редактирует</param>
|
||||
/// <param name="dtos"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<int> UpdateRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// Добавляет Dto у которых id == 0, изменяет dto у которых id != 0
|
||||
/// </summary>
|
||||
/// <param name="idUser"></param>
|
||||
/// <param name="idUser">пользователь, который редактирует или добавляет</param>
|
||||
/// <param name="dtos"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<int> UpdateOrInsertRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// Добавление записей с удалением старых (для импорта)
|
||||
/// Помечает записи как удаленные
|
||||
/// </summary>
|
||||
/// <param name="idUser"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="idUser">пользователь, который чистит</param>
|
||||
/// <param name="request">Фильтр по свойствам конкретной сущности</param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<int> Clear(int idUser, TRequest request, CancellationToken token);
|
||||
@ -61,13 +60,13 @@ public interface IChangeLogRepository<TDto, TRequest>
|
||||
Task<int> ClearAndInsertRange(int idUser, TRequest request, IEnumerable<TDto> dtos, CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// Удаление записей
|
||||
/// Пометить записи как удаленные
|
||||
/// </summary>
|
||||
/// <param name="idUser"></param>
|
||||
/// <param name="ids"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<int> DeleteRange(int idUser, IEnumerable<int> ids, CancellationToken token);
|
||||
Task<int> MarkAsDeleted(int idUser, IEnumerable<int> ids, CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// Получение дат изменений записей
|
||||
@ -78,19 +77,26 @@ public interface IChangeLogRepository<TDto, TRequest>
|
||||
Task<IEnumerable<DateOnly>> GetDatesChange(TRequest request, CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// Получение журнала изменений
|
||||
/// Получение измененных записей за определенную дату
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="date">Фильтр по дате. Если null - вернет все</param>
|
||||
/// <param name="date">Фильтр по дате. Если null - вернет все записи, без привязки к дате</param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<TDto>> GetChangeLog(TRequest request, DateOnly? date, CancellationToken token);
|
||||
Task<IEnumerable<ChangeLogDto<TDto>>> GetChangeLogForDate(TRequest request, DateOnly? date, CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// Получение записей по параметрам
|
||||
/// Получение текущих сейчас записей по параметрам
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<TDto>> Get(TRequest request, CancellationToken token);
|
||||
Task<IEnumerable<TDto>> GetCurrent(TRequest request, CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// Получение объекта, реализующего интерфейс IChangeLogRepositoryBuilder
|
||||
/// для последующих вызовов методов фильтрации по запросам
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
IChangeLogQueryBuilder<TDto, TRequest> GetQueryBuilder(ChangeLogRequest request);
|
||||
}
|
||||
|
@ -1,14 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace AsbCloudApp.Requests;
|
||||
|
||||
/// <summary>
|
||||
/// Базовый запрос актуальных данных
|
||||
/// </summary>
|
||||
public class ChangeLogBaseRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Дата/время на которую записи были актуальны. Если не задано, то возвращаются все данные без учета их актуальности
|
||||
/// </summary>
|
||||
public DateTimeOffset? Moment { get; set; }
|
||||
}
|
31
AsbCloudApp/Requests/ChangeLogRequest.cs
Normal file
31
AsbCloudApp/Requests/ChangeLogRequest.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System;
|
||||
|
||||
namespace AsbCloudApp.Requests;
|
||||
|
||||
/// <summary>
|
||||
/// Запрос изменений
|
||||
/// </summary>
|
||||
public class ChangeLogRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Дата/время на которую записи были актуальны. Если не задано, то возвращаются все данные без учета их актуальности
|
||||
/// </summary>
|
||||
public DateTimeOffset? Moment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
public ChangeLogRequest()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Копирующий конструктор
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
public ChangeLogRequest(ChangeLogRequest request)
|
||||
{
|
||||
Moment = request.Moment;
|
||||
}
|
||||
}
|
@ -1,29 +1,39 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace AsbCloudApp.Requests;
|
||||
|
||||
/// <summary>
|
||||
/// Запрос для получения РТК план
|
||||
/// </summary>
|
||||
public class ProcessMapPlanBaseRequest: ChangeLogBaseRequest
|
||||
public class ProcessMapPlanBaseRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Тип секции
|
||||
/// </summary>
|
||||
[Range(1, int.MaxValue, ErrorMessage = "Id секции - положительное число")]
|
||||
public int? IdWellSectionType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Вернуть данные, которые поменялись с указанной даты
|
||||
/// </summary>
|
||||
public DateTimeOffset? UpdateFrom { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
public ProcessMapPlanBaseRequest()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Копирующий конструктор
|
||||
/// </summary>
|
||||
/// <param name="request">Параметры запроса</param>
|
||||
public ProcessMapPlanBaseRequest(ProcessMapPlanBaseRequest request)
|
||||
{
|
||||
UpdateFrom = request.UpdateFrom;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Запрос для получения РТК план по скважине
|
||||
/// </summary>
|
||||
public class ProcessMapPlanBaseRequestWithWell: ProcessMapPlanBaseRequest
|
||||
public class ProcessMapPlanBaseRequestWithWell : ProcessMapPlanBaseRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Запрос для получения РТК план по скважине
|
||||
@ -40,11 +50,9 @@ public class ProcessMapPlanBaseRequestWithWell: ProcessMapPlanBaseRequest
|
||||
/// <param name="request"></param>
|
||||
/// <param name="idWell"></param>
|
||||
public ProcessMapPlanBaseRequestWithWell(ProcessMapPlanBaseRequest request, int idWell)
|
||||
: base(request)
|
||||
{
|
||||
IdWell=idWell;
|
||||
IdWellSectionType=request.IdWellSectionType;
|
||||
UpdateFrom = request.UpdateFrom;
|
||||
Moment = request.Moment;
|
||||
IdWell = idWell;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1,24 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace AsbCloudApp.Requests;
|
||||
|
||||
/// <summary>
|
||||
/// Запрос для получения РТК план
|
||||
/// </summary>
|
||||
public class ProcessMapPlanRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Идентификатор скважины
|
||||
/// </summary>
|
||||
public int IdWell { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Тип секции
|
||||
/// </summary>
|
||||
public int? IdWellSectionType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Дата обновления
|
||||
/// </summary>
|
||||
public DateTimeOffset? UpdateFrom { get; set; }
|
||||
}
|
@ -86,4 +86,10 @@ public abstract class ChangeLogAbstract
|
||||
/// </summary>
|
||||
[Column("id_previous"), Comment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная")]
|
||||
public int? IdPrevious { get; set; }
|
||||
|
||||
[ForeignKey(nameof(IdAuthor))]
|
||||
public virtual User Author { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(IdEditor))]
|
||||
public virtual User? Editor { get; set; }
|
||||
}
|
||||
|
@ -20,12 +20,6 @@ public abstract class ProcessMapPlanBase : ChangeLogAbstract, IId, IWellRelated
|
||||
[ForeignKey(nameof(IdWell))]
|
||||
public virtual Well Well { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(IdAuthor))]
|
||||
public virtual User Author { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(IdEditor))]
|
||||
public virtual User? Editor { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(IdWellSectionType))]
|
||||
public virtual WellSectionType WellSectionType { get; set; } = null!;
|
||||
}
|
@ -1,22 +1,22 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.DailyReport.Blocks.TimeBalance;
|
||||
using AsbCloudApp.Data.DetectedOperation;
|
||||
using AsbCloudApp.Data.DrillTestReport;
|
||||
using AsbCloudApp.Data.Manuals;
|
||||
using AsbCloudApp.Data.ProcessMaps;
|
||||
using AsbCloudApp.Data.SAUB;
|
||||
using AsbCloudApp.Data.Subsystems;
|
||||
using AsbCloudApp.Data.Trajectory;
|
||||
using AsbCloudApp.Data.WellOperationImport.Options;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Requests;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudApp.Services.DailyReport;
|
||||
using AsbCloudApp.Services.Notifications;
|
||||
using AsbCloudApp.Services.ProcessMaps;
|
||||
using AsbCloudApp.Services.ProcessMaps.WellDrilling;
|
||||
using AsbCloudDb.Model;
|
||||
using AsbCloudDb.Model.DailyReports.Blocks.TimeBalance;
|
||||
using AsbCloudDb.Model.Manuals;
|
||||
using AsbCloudDb.Model.ProcessMapPlan;
|
||||
using AsbCloudDb.Model.ProcessMaps;
|
||||
using AsbCloudDb.Model.Trajectory;
|
||||
using AsbCloudDb.Model.WellSections;
|
||||
@ -27,14 +27,15 @@ using AsbCloudInfrastructure.Services.DailyReport;
|
||||
using AsbCloudInfrastructure.Services.DetectOperations;
|
||||
using AsbCloudInfrastructure.Services.DrillingProgram;
|
||||
using AsbCloudInfrastructure.Services.DrillTestReport;
|
||||
using AsbCloudInfrastructure.Services.ProcessMapPlan.Export;
|
||||
using AsbCloudInfrastructure.Services.ProcessMapPlan.Parser;
|
||||
using AsbCloudInfrastructure.Services.ProcessMaps;
|
||||
using AsbCloudInfrastructure.Services.ProcessMaps.Report;
|
||||
using AsbCloudInfrastructure.Services.SAUB;
|
||||
using AsbCloudInfrastructure.Services.Subsystems;
|
||||
using AsbCloudInfrastructure.Services.Trajectory;
|
||||
using AsbCloudInfrastructure.Services.Trajectory.Export;
|
||||
using AsbCloudInfrastructure.Services.Trajectory.Parser;
|
||||
using AsbCloudInfrastructure.Services.WellOperations.Factories;
|
||||
using AsbCloudInfrastructure.Services.WellOperationService;
|
||||
using Mapster;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@ -42,9 +43,6 @@ using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using AsbCloudApp.Data.DetectedOperation;
|
||||
using AsbCloudInfrastructure.Services.ProcessMapPlan.Export;
|
||||
using AsbCloudInfrastructure.Services.WellOperations.Factories;
|
||||
|
||||
namespace AsbCloudInfrastructure
|
||||
{
|
||||
@ -56,15 +54,21 @@ namespace AsbCloudInfrastructure
|
||||
.ForType<SetpointsRequestDto, SetpointsRequest>()
|
||||
.Ignore(source => source.Author)
|
||||
.Ignore(source => source.Well);
|
||||
|
||||
|
||||
TypeAdapterConfig.GlobalSettings.Default.Config
|
||||
.ForType<DetectedOperationDto, DetectedOperation>()
|
||||
.Ignore(source => source.OperationCategory);
|
||||
|
||||
|
||||
TypeAdapterConfig.GlobalSettings.Default.Config
|
||||
.ForType<ScheduleDto, Schedule>()
|
||||
.Ignore(source => source.Driller);
|
||||
|
||||
|
||||
#pragma warning disable CS8603 // Possible null reference return.
|
||||
TypeAdapterConfig.GlobalSettings.Default.Config
|
||||
.ForType<ProcessMapPlanBaseDto, ProcessMapPlanBase>()
|
||||
.Ignore(dst => dst.Author, dst => dst.Editor);
|
||||
#pragma warning restore CS8603 // Possible null reference return.
|
||||
|
||||
TypeAdapterConfig.GlobalSettings.Default.Config
|
||||
.ForType<DateTimeOffset, DateTime>()
|
||||
.MapWith((source) => source.DateTime);
|
||||
@ -127,6 +131,13 @@ namespace AsbCloudInfrastructure
|
||||
{
|
||||
Plan = src.WellDepthPlan
|
||||
});
|
||||
|
||||
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanDrillingDto>>.NewConfig()
|
||||
.Include<ProcessMapPlanDrilling, ChangeLogDto<ProcessMapPlanDrillingDto>>()
|
||||
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanDrillingDto>()
|
||||
{
|
||||
Item = src.Adapt<ProcessMapPlanDrillingDto>()
|
||||
});
|
||||
}
|
||||
|
||||
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
|
||||
@ -186,11 +197,11 @@ namespace AsbCloudInfrastructure
|
||||
|
||||
services.AddTransient<
|
||||
IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell>,
|
||||
ProcessMapPlanBaseRepository<ProcessMapPlanDrillingDto, ProcessMapPlanDrilling>>();
|
||||
ProcessMapPlanBaseRepository<ProcessMapPlanDrilling, ProcessMapPlanDrillingDto>>();
|
||||
|
||||
services.AddTransient<
|
||||
IChangeLogRepository<ProcessMapPlanReamDto, ProcessMapPlanBaseRequestWithWell>,
|
||||
ProcessMapPlanBaseRepository<ProcessMapPlanReamDto, ProcessMapPlanReam>>();
|
||||
ProcessMapPlanBaseRepository<ProcessMapPlanReam, ProcessMapPlanReamDto>>();
|
||||
|
||||
services.AddTransient<IProcessMapReportDrillingService, ProcessMapReportDrillingService>();
|
||||
|
||||
@ -293,7 +304,7 @@ namespace AsbCloudInfrastructure
|
||||
services.AddTransient<TrajectoryFactManualParser>();
|
||||
services.AddTransient<ProcessMapPlanDrillingParser>();
|
||||
services.AddTransient<ProcessMapPlanReamParser>();
|
||||
|
||||
|
||||
services.AddTransient<TrajectoryPlanExportService>();
|
||||
services.AddTransient<TrajectoryFactManualExportService>();
|
||||
services.AddTransient<TrajectoryFactNnbExportService>();
|
||||
@ -303,7 +314,7 @@ namespace AsbCloudInfrastructure
|
||||
|
||||
services.AddTransient<WellOperationParserFactory>();
|
||||
services.AddTransient<WellOperationExportServiceFactory>();
|
||||
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AsbCloudApp.Exceptions;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Exceptions;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Requests;
|
||||
using AsbCloudDb.Model;
|
||||
@ -13,10 +14,9 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudInfrastructure.Repository;
|
||||
|
||||
public abstract class ChangeLogRepositoryAbstract<TDto, TEntity, TRequest> : IChangeLogRepository<TDto, TRequest>
|
||||
where TDto : AsbCloudApp.Data.ChangeLogAbstract
|
||||
public abstract class ChangeLogRepositoryAbstract<TEntity, TDto, TRequest> : IChangeLogRepository<TDto, TRequest>
|
||||
where TDto : AsbCloudApp.Data.IId
|
||||
where TEntity : ChangeLogAbstract
|
||||
where TRequest : ChangeLogBaseRequest
|
||||
{
|
||||
protected readonly IAsbCloudDbContext db;
|
||||
|
||||
@ -25,6 +25,97 @@ public abstract class ChangeLogRepositoryAbstract<TDto, TEntity, TRequest> : ICh
|
||||
this.db = db;
|
||||
}
|
||||
|
||||
private class ChangeLogQueryBuilder: IChangeLogQueryBuilder<TDto, TRequest>
|
||||
{
|
||||
protected readonly ChangeLogRepositoryAbstract<TEntity, TDto, TRequest> Repository;
|
||||
protected IQueryable<TEntity> Query;
|
||||
|
||||
public ChangeLogQueryBuilder(
|
||||
ChangeLogRepositoryAbstract<TEntity, TDto, TRequest> repository,
|
||||
ChangeLogRequest request)
|
||||
{
|
||||
this.Repository = repository;
|
||||
this.Query = repository.db.Set<TEntity>()
|
||||
.Include(e => e.Author)
|
||||
.Include(e => e.Editor);
|
||||
|
||||
if (request.Moment.HasValue)
|
||||
{
|
||||
var momentUtc = request.Moment.Value.ToUniversalTime();
|
||||
|
||||
this.Query = this.Query
|
||||
.Where(e => e.Creation <= momentUtc)
|
||||
.Where(e => e.Obsolete == null || e.Obsolete >= momentUtc);
|
||||
}
|
||||
}
|
||||
|
||||
public ChangeLogQueryBuilder(ChangeLogQueryBuilder builder)
|
||||
{
|
||||
Repository = builder.Repository;
|
||||
Query = builder.Query;
|
||||
}
|
||||
|
||||
public virtual IChangeLogQueryBuilderWithKnownTimezone<TDto, TRequest> ApplyRequest(TRequest request)
|
||||
{
|
||||
this.Query = Repository.BuildQuery(request, Query);
|
||||
return new ChangeLogQueryBuilderWithKnownTimezone(this, request);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<TDto>> GetData(TimeSpan offset, CancellationToken token)
|
||||
{
|
||||
var dtos = await this.Query.Select(e => Repository.Convert(e, offset))
|
||||
.ToArrayAsync(token);
|
||||
return dtos;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ChangeLogDto<TDto>>> GetChangeLogData(TimeSpan offset, CancellationToken token)
|
||||
{
|
||||
var dtos = await this.Query.Select(e => Repository.ConvertChangeLogDto(e, offset))
|
||||
.ToArrayAsync(token);
|
||||
return dtos;
|
||||
}
|
||||
}
|
||||
|
||||
private class ChangeLogQueryBuilderWithKnownTimezone: ChangeLogQueryBuilder, IChangeLogQueryBuilderWithKnownTimezone<TDto, TRequest>
|
||||
{
|
||||
TRequest request;
|
||||
|
||||
public ChangeLogQueryBuilderWithKnownTimezone(
|
||||
ChangeLogQueryBuilder parentBuilder,
|
||||
TRequest request)
|
||||
:base(parentBuilder)
|
||||
{
|
||||
this.request = request;
|
||||
}
|
||||
|
||||
public override IChangeLogQueryBuilderWithKnownTimezone<TDto, TRequest> ApplyRequest(TRequest request)
|
||||
{
|
||||
Query = Repository.BuildQuery(request, Query);
|
||||
this.request = request;
|
||||
return this;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<TDto>> GetData(CancellationToken token)
|
||||
{
|
||||
TimeSpan timezoneOffset = Repository.GetTimezoneOffset(request);
|
||||
var dtos = await this.GetData(timezoneOffset, token);
|
||||
return dtos;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ChangeLogDto<TDto>>> GetChangeLogData(CancellationToken token)
|
||||
{
|
||||
TimeSpan timezoneOffset = Repository.GetTimezoneOffset(request);
|
||||
var dtos = await this.GetChangeLogData(timezoneOffset, token);
|
||||
return dtos;
|
||||
}
|
||||
}
|
||||
|
||||
public IChangeLogQueryBuilder<TDto, TRequest> GetQueryBuilder(ChangeLogRequest request)
|
||||
{
|
||||
var builder = new ChangeLogQueryBuilder(this, request);
|
||||
return builder;
|
||||
}
|
||||
|
||||
public async Task<int> InsertRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token)
|
||||
{
|
||||
var result = 0;
|
||||
@ -133,6 +224,7 @@ public abstract class ChangeLogRepositoryAbstract<TDto, TEntity, TRequest> : ICh
|
||||
public async Task<int> Clear(int idUser, TRequest request, CancellationToken token)
|
||||
{
|
||||
var updateTime = DateTimeOffset.UtcNow;
|
||||
|
||||
var query = BuildQuery(request);
|
||||
query = query.Where(e => e.Obsolete == null);
|
||||
|
||||
@ -168,7 +260,7 @@ public abstract class ChangeLogRepositoryAbstract<TDto, TEntity, TRequest> : ICh
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<int> DeleteRange(int idUser, IEnumerable<int> ids, CancellationToken token)
|
||||
public async Task<int> MarkAsDeleted(int idUser, IEnumerable<int> ids, CancellationToken token)
|
||||
{
|
||||
var updateTime = DateTimeOffset.UtcNow;
|
||||
var query = db.Set<TEntity>()
|
||||
@ -217,7 +309,7 @@ public abstract class ChangeLogRepositoryAbstract<TDto, TEntity, TRequest> : ICh
|
||||
return datesOnly;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<TDto>> GetChangeLog(TRequest request, DateOnly? date, CancellationToken token)
|
||||
public async Task<IEnumerable<ChangeLogDto<TDto>>> GetChangeLogForDate(TRequest request, DateOnly? date, CancellationToken token)
|
||||
{
|
||||
var query = BuildQuery(request);
|
||||
TimeSpan offset = GetTimezoneOffset(request);
|
||||
@ -233,53 +325,72 @@ public abstract class ChangeLogRepositoryAbstract<TDto, TEntity, TRequest> : ICh
|
||||
query = createdQuery.Union(editedQuery);
|
||||
}
|
||||
|
||||
var dtos = await CreateChangeLogDto(query, offset, token);
|
||||
|
||||
return dtos;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ChangeLogDto<TDto>>> CreateChangeLogDto(IQueryable<TEntity> query, TimeSpan offset, CancellationToken token)
|
||||
{
|
||||
var entities = await query
|
||||
.OrderBy(e => e.Creation)
|
||||
.ThenBy(e => e.Obsolete)
|
||||
.ThenBy(e => e.Id)
|
||||
.ToListAsync(token);
|
||||
var dtos = entities.Select(e => Convert(e, offset));
|
||||
|
||||
var dtos = entities.Select(e => ConvertChangeLogDto(e, offset));
|
||||
return dtos;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<TDto>> Get(TRequest request, CancellationToken token)
|
||||
public async Task<IEnumerable<TDto>> GetCurrent(TRequest request, CancellationToken token)
|
||||
{
|
||||
var query = BuildQuery(request);
|
||||
var entities = await query
|
||||
.OrderBy(e => e.Creation)
|
||||
.ThenBy(e => e.Obsolete)
|
||||
.ThenBy(e => e.Id)
|
||||
.ToArrayAsync(token);
|
||||
var changeLogRequest = new ChangeLogRequest()
|
||||
{
|
||||
Moment = new DateTimeOffset(3000, 1, 1, 0, 0, 0, TimeSpan.Zero)
|
||||
};
|
||||
|
||||
var builder = GetQueryBuilder(changeLogRequest)
|
||||
.ApplyRequest(request);
|
||||
var dtos = await builder.GetData(token);
|
||||
|
||||
TimeSpan offset = GetTimezoneOffset(request);
|
||||
var dtos = entities.Select(e => Convert(e, offset));
|
||||
return dtos;
|
||||
}
|
||||
|
||||
protected abstract TimeSpan GetTimezoneOffset(TRequest request);
|
||||
|
||||
protected abstract IQueryable<TEntity> BuildQuery(TRequest request);
|
||||
private IQueryable<TEntity> BuildQuery(TRequest request) =>
|
||||
BuildQuery(request, db.Set<TEntity>()
|
||||
.Include(e => e.Author)
|
||||
.Include(e => e.Editor));
|
||||
|
||||
protected abstract IQueryable<TEntity> BuildQuery(TRequest request, IQueryable<TEntity> query);
|
||||
|
||||
protected virtual TEntity Convert(TDto dto)
|
||||
{
|
||||
var entity = dto.Adapt<TEntity>();
|
||||
entity.Creation = entity.Creation.ToUniversalTime();
|
||||
|
||||
if(entity.Obsolete.HasValue)
|
||||
if (entity.Obsolete.HasValue)
|
||||
entity.Obsolete = entity.Obsolete.Value.ToUniversalTime();
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
protected virtual ChangeLogDto<TDto> ConvertChangeLogDto(TEntity entity, TimeSpan offset)
|
||||
{
|
||||
var changeLogDto = entity.Adapt<ChangeLogDto<TDto>>();
|
||||
changeLogDto.Creation = entity.Creation.ToOffset(offset);
|
||||
|
||||
if (entity.Obsolete.HasValue)
|
||||
changeLogDto.Obsolete = entity.Obsolete.Value.ToOffset(offset);
|
||||
|
||||
changeLogDto.Item = Convert(entity, offset);
|
||||
return changeLogDto;
|
||||
}
|
||||
|
||||
protected virtual TDto Convert(TEntity entity, TimeSpan offset)
|
||||
{
|
||||
var dto = entity.Adapt<TDto>();
|
||||
dto.Creation = entity.Creation.ToOffset(offset);
|
||||
|
||||
if (entity.Obsolete.HasValue)
|
||||
dto.Obsolete = entity.Obsolete.Value.ToOffset(offset);
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
@ -303,4 +414,5 @@ public abstract class ChangeLogRepositoryAbstract<TDto, TEntity, TRequest> : ICh
|
||||
if (pgException.SqlState == PostgresErrorCodes.ForeignKeyViolation)
|
||||
throw new ArgumentInvalidException("dtos", pgException.Message + "\r\n" + pgException.Detail);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,45 +9,31 @@ using System.Linq;
|
||||
|
||||
namespace AsbCloudInfrastructure.Repository;
|
||||
|
||||
public class ProcessMapPlanBaseRepository<TDto, TEntity> : ChangeLogRepositoryAbstract<TDto, TEntity, ProcessMapPlanBaseRequestWithWell>
|
||||
public class ProcessMapPlanBaseRepository<TEntity, TDto> : ChangeLogRepositoryAbstract<TEntity, TDto, ProcessMapPlanBaseRequestWithWell>
|
||||
where TDto : ProcessMapPlanBaseDto
|
||||
where TEntity : ProcessMapPlanBase
|
||||
{
|
||||
private readonly IWellService wellService;
|
||||
|
||||
public ProcessMapPlanBaseRepository(IAsbCloudDbContext context, IWellService wellService)
|
||||
public ProcessMapPlanBaseRepository(IAsbCloudDbContext context, IWellService wellService)
|
||||
: base(context)
|
||||
{
|
||||
this.wellService = wellService;
|
||||
}
|
||||
|
||||
protected override IQueryable<TEntity> BuildQuery(ProcessMapPlanBaseRequestWithWell request)
|
||||
protected override IQueryable<TEntity> BuildQuery(ProcessMapPlanBaseRequestWithWell request, IQueryable<TEntity> query)
|
||||
{
|
||||
var query = db
|
||||
.Set<TEntity>()
|
||||
.Include(e => e.Author)
|
||||
.Include(e => e.Editor)
|
||||
query = query
|
||||
.Include(e => e.Well)
|
||||
.Include(e => e.WellSectionType)
|
||||
.Where(e => e.IdWell == request.IdWell);
|
||||
|
||||
if (request.IdWellSectionType.HasValue)
|
||||
query = query.Where(e => e.IdWellSectionType == request.IdWellSectionType);
|
||||
|
||||
if (request.UpdateFrom.HasValue)
|
||||
{
|
||||
var from = request.UpdateFrom.Value.ToUniversalTime();
|
||||
query = query.Where(e => e.Creation >= from || e.Obsolete >= from);
|
||||
}
|
||||
|
||||
if (request.Moment.HasValue)
|
||||
{
|
||||
var moment = request.Moment.Value.ToUniversalTime();
|
||||
query = query
|
||||
.Where(e => e.Creation <= moment)
|
||||
.Where(e => e.Obsolete == null || e.Obsolete >= moment);
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
@ -68,8 +54,6 @@ public class ProcessMapPlanBaseRepository<TDto, TEntity> : ChangeLogRepositoryAb
|
||||
protected override TEntity Convert(TDto dto)
|
||||
{
|
||||
var entity = base.Convert(dto);
|
||||
entity.Author = null;
|
||||
entity.Editor = null;
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class WellCompositeRepository : IWellCompositeRepository
|
||||
private readonly IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> processMapPlanDrillingRepository;
|
||||
|
||||
public WellCompositeRepository(
|
||||
IAsbCloudDbContext db,
|
||||
IAsbCloudDbContext db,
|
||||
IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> processMapPlanDrillingRepository)
|
||||
{
|
||||
this.db = db;
|
||||
@ -51,17 +51,9 @@ public class WellCompositeRepository : IWellCompositeRepository
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<IEnumerable<ProcessMapPlanDrillingDto>> GetCompositeProcessMap(int idWell, CancellationToken token)
|
||||
public Task<IEnumerable<ProcessMapPlanDrillingDto>> GetCompositeProcessMap(int idWell, CancellationToken token)
|
||||
{
|
||||
var dtos = await GetAsync(idWell, token);
|
||||
|
||||
var requests = dtos.Select(x => new ProcessMapPlanRequest {
|
||||
IdWell = x.IdWellSrc,
|
||||
IdWellSectionType = x.IdWellSectionType
|
||||
});
|
||||
|
||||
//var result = await processMapPlanDrillingRepository.GetAsync(requests, token);
|
||||
return Enumerable.Empty<ProcessMapPlanDrillingDto>();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private static WellComposite Convert(int idWell, WellCompositeDto dto)
|
||||
|
@ -43,7 +43,7 @@ public class WorkOperationDetection: Work
|
||||
var telemetryId = telemetryIds[i];
|
||||
|
||||
var beginDate = lastDetectedDates.TryGetValue(telemetryId, out var date) ? date : (DateTimeOffset?)null;
|
||||
|
||||
|
||||
onProgressCallback($"Start detecting telemetry: {telemetryId} from {beginDate}", i / telemetryIds.Length);
|
||||
var detectedOperations = await detectedOperationService.DetectOperationsAsync(telemetryId, beginDate, token);
|
||||
|
||||
|
@ -1,38 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.ProcessMaps;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Requests;
|
||||
using AsbCloudApp.Requests.ExportOptions;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudInfrastructure.Services.ExcelServices;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Export;
|
||||
|
||||
public abstract class ProcessMapPlanExportService<TDto> : ExportExcelService<TDto, WellRelatedExportRequest>
|
||||
where TDto : ChangeLogAbstract
|
||||
where TDto : ProcessMapPlanBaseDto
|
||||
{
|
||||
protected readonly IWellService wellService;
|
||||
protected readonly IWellService wellService;
|
||||
|
||||
private readonly IChangeLogRepository<TDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository;
|
||||
private readonly IChangeLogRepository<TDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository;
|
||||
|
||||
protected ProcessMapPlanExportService(IChangeLogRepository<TDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
|
||||
IWellService wellService)
|
||||
{
|
||||
this.processMapPlanRepository = processMapPlanRepository;
|
||||
this.wellService = wellService;
|
||||
}
|
||||
|
||||
protected override async Task<IEnumerable<TDto>> GetDtosAsync(WellRelatedExportRequest options, CancellationToken token)
|
||||
{
|
||||
var request = new ProcessMapPlanBaseRequestWithWell(options.IdWell)
|
||||
{
|
||||
Moment = DateTimeOffset.UtcNow
|
||||
};
|
||||
|
||||
var dtos = await processMapPlanRepository.Get(request, token);
|
||||
return dtos;
|
||||
}
|
||||
protected ProcessMapPlanExportService(IChangeLogRepository<TDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
|
||||
IWellService wellService)
|
||||
{
|
||||
this.processMapPlanRepository = processMapPlanRepository;
|
||||
this.wellService = wellService;
|
||||
}
|
||||
|
||||
protected override async Task<IEnumerable<TDto>> GetDtosAsync(WellRelatedExportRequest options, CancellationToken token)
|
||||
{
|
||||
var request = new ProcessMapPlanBaseRequestWithWell(options.IdWell);
|
||||
|
||||
var dtos = await processMapPlanRepository.GetCurrent(request, token);
|
||||
return dtos;
|
||||
}
|
||||
}
|
@ -1,5 +1,3 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AsbCloudApp.Data.ProcessMaps;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Requests;
|
||||
@ -7,24 +5,26 @@ using AsbCloudApp.Requests.ExportOptions;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudInfrastructure.Services.ExcelServices.Templates;
|
||||
using AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Export;
|
||||
|
||||
public class ProcessMapPlanReamExportService : ProcessMapPlanExportService<ProcessMapPlanReamDto>
|
||||
{
|
||||
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanReamTemplate();
|
||||
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanReamTemplate();
|
||||
|
||||
public ProcessMapPlanReamExportService(
|
||||
IChangeLogRepository<ProcessMapPlanReamDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
|
||||
IWellService wellService)
|
||||
: base(processMapPlanRepository, wellService)
|
||||
{
|
||||
}
|
||||
|
||||
protected override async Task<string> BuildFileNameAsync(WellRelatedExportRequest options, CancellationToken token)
|
||||
{
|
||||
var caption = await wellService.GetWellCaptionByIdAsync(options.IdWell, token);
|
||||
public ProcessMapPlanReamExportService(
|
||||
IChangeLogRepository<ProcessMapPlanReamDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
|
||||
IWellService wellService)
|
||||
: base(processMapPlanRepository, wellService)
|
||||
{
|
||||
}
|
||||
|
||||
return $"{caption}_РТК_План_проработка.xlsx";
|
||||
}
|
||||
protected override async Task<string> BuildFileNameAsync(WellRelatedExportRequest options, CancellationToken token)
|
||||
{
|
||||
var caption = await wellService.GetWellCaptionByIdAsync(options.IdWell, token);
|
||||
|
||||
return $"{caption}_РТК_План_проработка.xlsx";
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.ProcessMaps;
|
||||
using AsbCloudApp.Data.ProcessMaps.Report;
|
||||
using AsbCloudApp.Data.WellOperation;
|
||||
using AsbCloudApp.Exceptions;
|
||||
using AsbCloudApp.Extensions;
|
||||
using AsbCloudApp.Repositories;
|
||||
@ -13,7 +14,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AsbCloudApp.Data.WellOperation;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.ProcessMaps.Report;
|
||||
|
||||
@ -48,13 +48,13 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService
|
||||
return Enumerable.Empty<ProcessMapReportDataSaubStatDto>();
|
||||
|
||||
var requestProcessMapPlan = new ProcessMapPlanBaseRequestWithWell(idWell);
|
||||
var processMapPlanWellDrillings = await processMapPlanBaseRepository.Get(requestProcessMapPlan, token);
|
||||
var changeLogProcessMaps = await processMapPlanBaseRepository.GetChangeLogForDate(requestProcessMapPlan, null, token);
|
||||
|
||||
if (!processMapPlanWellDrillings.Any())
|
||||
if (!changeLogProcessMaps.Any())
|
||||
return Enumerable.Empty<ProcessMapReportDataSaubStatDto>();
|
||||
|
||||
var geDepth = processMapPlanWellDrillings.Min(p => p.DepthStart);
|
||||
var leDepth = processMapPlanWellDrillings.Max(p => p.DepthEnd);
|
||||
var geDepth = changeLogProcessMaps.Min(p => p.Item.DepthStart);
|
||||
var leDepth = changeLogProcessMaps.Max(p => p.Item.DepthEnd);
|
||||
|
||||
var requestWellOperationFact = new WellOperationRequest(new[] { idWell })
|
||||
{
|
||||
@ -85,10 +85,10 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService
|
||||
var wellSectionTypes = wellOperationRepository.GetSectionTypes();
|
||||
|
||||
var result = CalcByIntervals(
|
||||
request,
|
||||
processMapPlanWellDrillings,
|
||||
request,
|
||||
changeLogProcessMaps,
|
||||
dataSaubStats,
|
||||
orderedWellOperations,
|
||||
orderedWellOperations,
|
||||
wellOperationCategories,
|
||||
wellSectionTypes);
|
||||
|
||||
@ -97,7 +97,7 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService
|
||||
|
||||
private static IEnumerable<ProcessMapReportDataSaubStatDto> CalcByIntervals(
|
||||
DataSaubStatRequest request,
|
||||
IEnumerable<ProcessMapPlanDrillingDto> processMapPlanWellDrillings,
|
||||
IEnumerable<ChangeLogDto<ProcessMapPlanDrillingDto>> changeLogProcessMaps,
|
||||
Span<DataSaubStatDto> dataSaubStats,
|
||||
IEnumerable<WellOperationDto> wellOperations,
|
||||
IEnumerable<WellOperationCategoryDto> wellOperationCategories,
|
||||
@ -115,23 +115,24 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService
|
||||
|
||||
int GetSection(DataSaubStatDto data)
|
||||
{
|
||||
if(lastFoundIndex < orderedWellOperations.Length - 1)
|
||||
if (lastFoundIndex < orderedWellOperations.Length - 1)
|
||||
{
|
||||
lastFoundIndex = Array.FindIndex(orderedWellOperations, lastFoundIndex, o => o.DateStart > data.DateStart) - 1;
|
||||
lastFoundIndex = lastFoundIndex < 0 ? orderedWellOperations.Length - 1 : lastFoundIndex;
|
||||
}
|
||||
|
||||
|
||||
var operation = orderedWellOperations[lastFoundIndex];
|
||||
return operation.IdWellSectionType;
|
||||
}
|
||||
}
|
||||
|
||||
ProcessMapPlanDrillingDto? GetProcessMapPlan(int idWellSectionType, DataSaubStatDto data)
|
||||
=> processMapPlanWellDrillings
|
||||
.Where(p => p.IdWellSectionType == idWellSectionType)
|
||||
.Where(p => p.DepthStart <= data.DepthStart)
|
||||
.Where(p => p.DepthEnd >= data.DepthStart)
|
||||
.Where(p => IsModeMatchOperationCategory(p.IdMode, data.IdCategory))
|
||||
ProcessMapPlanDrillingDto? GetProcessMapPlan(int idWellSectionType, DataSaubStatDto data)
|
||||
=> changeLogProcessMaps
|
||||
.Where(p => p.Item.IdWellSectionType == idWellSectionType)
|
||||
.Where(p => p.Item.DepthStart <= data.DepthStart)
|
||||
.Where(p => p.Item.DepthEnd >= data.DepthStart)
|
||||
.Where(p => IsModeMatchOperationCategory(p.Item.IdMode, data.IdCategory))
|
||||
.WhereActualAtMoment(data.DateStart)
|
||||
.Select(p => p.Item)
|
||||
.FirstOrDefault();
|
||||
|
||||
var idWellSectionType = GetSection(firstElemInInterval);
|
||||
@ -168,7 +169,7 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService
|
||||
var elem = CalcStat(processMapPlan, span, wellOperationCategoryName, wellSectionType);
|
||||
|
||||
if (elem is not null)
|
||||
list.Add(elem);
|
||||
list.Add(elem);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
@ -333,7 +334,7 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService
|
||||
SetpointUsagePressure: sumDiffDepthByPressure * 100 / diffDepthTotal,
|
||||
SetpointUsageAxialLoad: sumDiffDepthByAxialLoad * 100 / diffDepthTotal,
|
||||
SetpointUsageRotorTorque: sumDiffDepthByRotorTorque * 100 / diffDepthTotal,
|
||||
SetpointUsageRopPlan: sumDiffDepthByRopPlan * 100/ diffDepthTotal,
|
||||
SetpointUsageRopPlan: sumDiffDepthByRopPlan * 100 / diffDepthTotal,
|
||||
DrilledTime: drilledTime
|
||||
);
|
||||
}
|
||||
|
@ -43,14 +43,11 @@ public class WellInfoService
|
||||
|
||||
var wellsIds = activeWells.Select(w => w.Id);
|
||||
|
||||
var processMapPlanWellDrillingRequests = wellsIds.Select(id => new ProcessMapPlanBaseRequestWithWell(id)
|
||||
{
|
||||
Moment = DateTimeOffset.UtcNow.AddDays(1)
|
||||
});
|
||||
var processMapPlanWellDrillingRequests = wellsIds.Select(id => new ProcessMapPlanBaseRequestWithWell(id));
|
||||
var processMapPlanWellDrillings = new List<ProcessMapPlanDrillingDto>();
|
||||
foreach (var processMapPlanWellDrillingRequest in processMapPlanWellDrillingRequests)
|
||||
{
|
||||
var processMaps = await processMapPlanWellDrillingRepository.Get(processMapPlanWellDrillingRequest, token);
|
||||
var processMaps = await processMapPlanWellDrillingRepository.GetCurrent(processMapPlanWellDrillingRequest, token);
|
||||
processMapPlanWellDrillings.AddRange(processMaps);
|
||||
}
|
||||
|
||||
@ -100,14 +97,14 @@ public class WellInfoService
|
||||
int? idSection = wellLastFactSection?.Id;
|
||||
ProcessMapPlanDrillingDto? processMapPlanWellDrilling = null;
|
||||
|
||||
if(idSection.HasValue && currentDepth.HasValue)
|
||||
if (idSection.HasValue && currentDepth.HasValue)
|
||||
{
|
||||
processMapPlanWellDrilling = wellProcessMaps
|
||||
.Where(p => p.IdWellSectionType == idSection)
|
||||
.Where(p => p.DepthStart <= currentDepth.Value && p.DepthEnd >= currentDepth.Value)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
else if(currentDepth.HasValue)
|
||||
}
|
||||
else if (currentDepth.HasValue)
|
||||
{
|
||||
processMapPlanWellDrilling = wellProcessMaps.FirstOrDefault(p => p.DepthStart <= currentDepth.Value && p.DepthEnd >= currentDepth.Value);
|
||||
}
|
||||
|
@ -31,10 +31,10 @@ namespace AsbCloudInfrastructure
|
||||
var backgroundWorker = provider.GetRequiredService<PeriodicBackgroundWorker>();
|
||||
backgroundWorker.Add<WorkToDeleteOldReports>(TimeSpan.FromDays(1));
|
||||
backgroundWorker.Add<WellInfoService.WorkWellInfoUpdate>(TimeSpan.FromMinutes(30));
|
||||
backgroundWorker.Add<WorkOperationDetection>(TimeSpan.FromMinutes(15));
|
||||
backgroundWorker.Add<WorkDataSaubStat>(TimeSpan.FromMinutes(15));
|
||||
backgroundWorker.Add<WorkLimitingParameterCalc>(TimeSpan.FromMinutes(30));
|
||||
backgroundWorker.Add(MakeMemoryMonitoringWork(), TimeSpan.FromMinutes(1));
|
||||
backgroundWorker.Add<WorkOperationDetection>(TimeSpan.FromMinutes(0));
|
||||
backgroundWorker.Add<WorkDataSaubStat>(TimeSpan.FromMinutes(0));
|
||||
backgroundWorker.Add<WorkLimitingParameterCalc>(TimeSpan.FromMinutes(0));
|
||||
backgroundWorker.Add(MakeMemoryMonitoringWork(), TimeSpan.FromMinutes(0));
|
||||
|
||||
var notificationBackgroundWorker = provider.GetRequiredService<NotificationBackgroundWorker>();
|
||||
}
|
||||
|
@ -5,15 +5,15 @@ using Refit;
|
||||
|
||||
namespace AsbCloudWebApi.IntegrationTests.Clients;
|
||||
|
||||
public interface IProcessMapPlanDrillingClient
|
||||
public interface IProcessMapPlanDrillingClient<TDto> where TDto : ProcessMapPlanBaseDto
|
||||
{
|
||||
private const string BaseRoute = "/api/well/{idWell}/ProcessMapPlanDrilling";
|
||||
|
||||
[Post(BaseRoute)]
|
||||
Task<IApiResponse<int>> InsertRange(int idWell, [Body] IEnumerable<ProcessMapPlanDrillingDto> dtos);
|
||||
Task<IApiResponse<int>> InsertRange(int idWell, [Body] IEnumerable<TDto> dtos);
|
||||
|
||||
[Post($"{BaseRoute}/replace")]
|
||||
Task<IApiResponse<int>> ClearAndInsertRange(int idWell, [Body] IEnumerable<ProcessMapPlanDrillingDto> dtos);
|
||||
Task<IApiResponse<int>> ClearAndInsertRange(int idWell, [Body] IEnumerable<TDto> dtos);
|
||||
|
||||
[Delete(BaseRoute)]
|
||||
Task<IApiResponse<int>> DeleteRange(int idWell, [Body] IEnumerable<int> ids);
|
||||
@ -22,18 +22,24 @@ public interface IProcessMapPlanDrillingClient
|
||||
Task<IApiResponse<int>> Clear(int idWell);
|
||||
|
||||
[Get(BaseRoute)]
|
||||
Task<IApiResponse<IEnumerable<ProcessMapPlanDrillingDto>>> Get(int idWell, ProcessMapPlanBaseRequest request);
|
||||
Task<IApiResponse<IEnumerable<TDto>>> Get(int idWell);
|
||||
|
||||
[Get($"{BaseRoute}/changeLog")]
|
||||
Task<IApiResponse<IEnumerable<ProcessMapPlanDrillingDto>>> GetChangeLog(int idWell, DateOnly? date);
|
||||
[Get($"{BaseRoute}/changelogByMoment")]
|
||||
Task<IApiResponse<IEnumerable<ChangeLogDto<TDto>>>> Get(int idWell, DateTimeOffset? moment);
|
||||
|
||||
[Get("/api/telemetry/{uid}/ProcessMapPlanDrilling")]
|
||||
Task<IApiResponse<IEnumerable<ChangeLogDto<TDto>>>> Get(string uid, DateTimeOffset? updateFrom);
|
||||
|
||||
[Get($"{BaseRoute}/changeLogForDate")]
|
||||
Task<IApiResponse<IEnumerable<TDto>>> GetChangeLog(int idWell, DateOnly? date);
|
||||
|
||||
[Get($"{BaseRoute}/dates")]
|
||||
Task<IApiResponse<IEnumerable<DateOnly>>> GetDatesChange(int idWell);
|
||||
|
||||
[Put(BaseRoute)]
|
||||
Task<IApiResponse<int>> UpdateOrInsertRange(int idWell, IEnumerable<ProcessMapPlanDrillingDto> dtos);
|
||||
Task<IApiResponse<int>> UpdateOrInsertRange(int idWell, IEnumerable<TDto> dtos);
|
||||
|
||||
[Multipart]
|
||||
[Post(BaseRoute + "/parse")]
|
||||
Task<IApiResponse<ParserResultDto<ProcessMapPlanDrillingDto>>> Parse(int idWell, [AliasAs("file")] StreamPart stream);
|
||||
Task<IApiResponse<ParserResultDto<TDto>>> Parse(int idWell, [AliasAs("file")] StreamPart stream);
|
||||
}
|
||||
|
@ -12,20 +12,18 @@ using Xunit;
|
||||
using AsbCloudApp.Data.ProcessMaps;
|
||||
using AsbCloudDb.Model;
|
||||
using AsbCloudApp.Data.User;
|
||||
using AsbCloudApp.Data;
|
||||
|
||||
namespace AsbCloudWebApi.IntegrationTests.Controllers.ProcessMapPlan;
|
||||
|
||||
public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
public class ProcessMapPlanDrillingControllerTest : BaseIntegrationTest
|
||||
{
|
||||
private const int IdWell = 1;
|
||||
|
||||
private readonly ProcessMapPlanDrillingDto dto = new (){
|
||||
|
||||
private readonly ProcessMapPlanDrillingDto dto = new()
|
||||
{
|
||||
Id = 0,
|
||||
Creation = new(),
|
||||
Obsolete = null,
|
||||
IdState = 0,
|
||||
IdPrevious = null,
|
||||
|
||||
|
||||
IdWell = IdWell,
|
||||
Section = "Кондуктор",
|
||||
IdWellSectionType = 3,
|
||||
@ -48,7 +46,7 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
UsageSpin = 14,
|
||||
Comment = "это тестовая запись",
|
||||
};
|
||||
private readonly ProcessMapPlanDrilling entity = new ()
|
||||
private readonly ProcessMapPlanDrilling entity = new()
|
||||
{
|
||||
Id = 0,
|
||||
IdAuthor = 1,
|
||||
@ -80,12 +78,12 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
Comment = "это тестовая запись",
|
||||
};
|
||||
|
||||
private IProcessMapPlanDrillingClient client;
|
||||
|
||||
private IProcessMapPlanDrillingClient<ProcessMapPlanDrillingDto> client;
|
||||
|
||||
public ProcessMapPlanDrillingControllerTest(WebAppFactoryFixture factory) : base(factory)
|
||||
{
|
||||
dbContext.CleanupDbSet<ProcessMapPlanDrilling>();
|
||||
client = factory.GetAuthorizedHttpClient<IProcessMapPlanDrillingClient>(string.Empty);
|
||||
client = factory.GetAuthorizedHttpClient<IProcessMapPlanDrillingClient<ProcessMapPlanDrillingDto>>(string.Empty);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -96,7 +94,7 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
|
||||
//act
|
||||
var response = await client.InsertRange(dto.IdWell, new[] { expected });
|
||||
|
||||
|
||||
//assert
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
Assert.Equal(1, response.Content);
|
||||
@ -110,17 +108,14 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
|
||||
Assert.NotNull(entity);
|
||||
|
||||
var actual = entity.Adapt<ProcessMapPlanDrillingDto>();
|
||||
var actual = entity.Adapt<ChangeLogDto<ProcessMapPlanDrillingDto>>();
|
||||
Assert.Equal(ProcessMapPlanBase.IdStateActual, actual.IdState);
|
||||
|
||||
var excludeProps = new[] {
|
||||
nameof(ProcessMapPlanDrillingDto.Id),
|
||||
nameof(ProcessMapPlanDrillingDto.IdState),
|
||||
nameof(ProcessMapPlanDrillingDto.Author),
|
||||
nameof(ProcessMapPlanDrillingDto.Creation),
|
||||
nameof(ProcessMapPlanDrillingDto.Section)
|
||||
};
|
||||
MatchHelper.Match(expected, actual, excludeProps);
|
||||
MatchHelper.Match(expected, actual.Item, excludeProps);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -150,19 +145,19 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
//assert
|
||||
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task ClearAndInsertRange_returns_success()
|
||||
{
|
||||
// arrange
|
||||
var dbset = dbContext.Set<ProcessMapPlanDrilling>();
|
||||
|
||||
|
||||
var entry = dbset.Add(entity);
|
||||
dbContext.SaveChanges();
|
||||
entry.State = EntityState.Detached;
|
||||
|
||||
var startTime = DateTimeOffset.UtcNow;
|
||||
|
||||
|
||||
// act
|
||||
var result = await client.ClearAndInsertRange(entity.IdWell, new ProcessMapPlanDrillingDto[] { dto });
|
||||
|
||||
@ -221,7 +216,6 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
dtoUpdate.TopDriveSpeedLimitMax++;
|
||||
dtoUpdate.TopDriveTorquePlan++;
|
||||
dtoUpdate.TopDriveTorqueLimitMax++;
|
||||
dtoUpdate.Author = user;
|
||||
|
||||
var dtoInsert = dtoUpdate.Adapt<ProcessMapPlanDrillingDto>();
|
||||
dtoInsert.Id = 0;
|
||||
@ -239,7 +233,6 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
dtoInsert.TopDriveSpeedLimitMax++;
|
||||
dtoInsert.TopDriveTorquePlan++;
|
||||
dtoInsert.TopDriveTorqueLimitMax++;
|
||||
dtoInsert.Author = user;
|
||||
|
||||
// act
|
||||
var result = await client.UpdateOrInsertRange(entity.IdWell, new ProcessMapPlanDrillingDto[] { dtoUpdate, dtoInsert });
|
||||
@ -283,13 +276,13 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
{
|
||||
//arrange
|
||||
var dbset = dbContext.Set<ProcessMapPlanDrilling>();
|
||||
|
||||
|
||||
var entry = dbset.Add(entity);
|
||||
dbContext.SaveChanges();
|
||||
entry.State = EntityState.Detached;
|
||||
|
||||
var startTime = DateTimeOffset.UtcNow;
|
||||
|
||||
|
||||
//act
|
||||
var response = await client.DeleteRange(dto.IdWell, new[] { entry.Entity.Id });
|
||||
|
||||
@ -346,7 +339,7 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
{
|
||||
//arrange
|
||||
var dbset = dbContext.Set<ProcessMapPlanDrilling>();
|
||||
|
||||
|
||||
var entity2 = entity.Adapt<ProcessMapPlanDrilling>();
|
||||
entity2.Creation = entity.Creation.AddDays(1);
|
||||
dbset.Add(entity);
|
||||
@ -367,40 +360,13 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
Assert.Equal(2, response.Content.Count());
|
||||
Assert.All(response.Content, d => dates.Contains(d));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Get_all_returns_success()
|
||||
{
|
||||
//arrange
|
||||
var dbset = dbContext.Set<ProcessMapPlanDrilling>();
|
||||
|
||||
dbset.Add(entity);
|
||||
|
||||
var entityDeleted = entity.Adapt<ProcessMapPlanDrilling>();
|
||||
entityDeleted.Creation = entity.Creation.AddDays(-1);
|
||||
entityDeleted.Obsolete = entity.Creation;
|
||||
entityDeleted.IdState = ProcessMapPlanBase.IdStateDeleted;
|
||||
entityDeleted.IdEditor = 1;
|
||||
dbset.Add(entityDeleted);
|
||||
|
||||
dbContext.SaveChanges();
|
||||
|
||||
//act
|
||||
var request = new ProcessMapPlanBaseRequest();
|
||||
var response = await client.Get(dto.IdWell, request);
|
||||
|
||||
//assert
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
Assert.NotNull(response.Content);
|
||||
Assert.Equal(2, response.Content.Count());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Get_actual_returns_success()
|
||||
{
|
||||
//arrange
|
||||
var dbset = dbContext.Set<ProcessMapPlanDrilling>();
|
||||
|
||||
|
||||
dbset.Add(entity);
|
||||
|
||||
var entityDeleted = entity.Adapt<ProcessMapPlanDrilling>();
|
||||
@ -413,11 +379,7 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
|
||||
dbContext.SaveChanges();
|
||||
|
||||
//act
|
||||
var request = new ProcessMapPlanBaseRequest {
|
||||
Moment = new DateTimeOffset(3000, 1, 1, 0, 0, 0, 0, TimeSpan.Zero)
|
||||
};
|
||||
var response = await client.Get(dto.IdWell, request);
|
||||
var response = await client.Get(dto.IdWell);
|
||||
|
||||
//assert
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
@ -425,12 +387,12 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
Assert.Single(response.Content);
|
||||
|
||||
var actual = response.Content.First()!;
|
||||
|
||||
Assert.NotNull(actual.Section);
|
||||
Assert.NotEmpty(actual.Section);
|
||||
|
||||
var expected = entity.Adapt<ProcessMapPlanDrillingDto>()!;
|
||||
var excludeProps = new[] {
|
||||
nameof(ProcessMapPlanDrillingDto.Id),
|
||||
nameof(ProcessMapPlanDrillingDto.Author),
|
||||
nameof(ProcessMapPlanDrillingDto.Creation),
|
||||
};
|
||||
MatchHelper.Match(expected, actual, excludeProps);
|
||||
}
|
||||
@ -440,7 +402,7 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
{
|
||||
//arrange
|
||||
var dbset = dbContext.Set<ProcessMapPlanDrilling>();
|
||||
|
||||
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
var entityDeleted = entity.Adapt<ProcessMapPlanDrilling>();
|
||||
entityDeleted.Creation = now;
|
||||
@ -461,11 +423,7 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
dbContext.SaveChanges();
|
||||
|
||||
//act
|
||||
var request = new ProcessMapPlanBaseRequest
|
||||
{
|
||||
Moment = now.AddMinutes(0.5),
|
||||
};
|
||||
var response = await client.Get(dto.IdWell, request);
|
||||
var response = await client.Get(dto.IdWell, now.AddMinutes(0.5));
|
||||
|
||||
//assert
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
@ -474,49 +432,33 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Get_section_returns_success()
|
||||
public async Task Get_by_updated_from_returns_success()
|
||||
{
|
||||
//arrange
|
||||
var dbset = dbContext.Set<ProcessMapPlanDrilling>();
|
||||
|
||||
dbset.Add(entity);
|
||||
|
||||
var entity2 = entity.Adapt<ProcessMapPlanDrilling>();
|
||||
entity2.IdWellSectionType = 2;
|
||||
entity2.Comment = "IdWellSectionType = 2";
|
||||
entity2.Obsolete = DateTimeOffset.UtcNow;
|
||||
dbset.Add(entity2);
|
||||
|
||||
dbContext.SaveChanges();
|
||||
|
||||
//act
|
||||
var request = new ProcessMapPlanBaseRequest
|
||||
{
|
||||
IdWellSectionType = 2,
|
||||
};
|
||||
var response = await client.Get(dto.IdWell, request);
|
||||
var response = await client.Get(Defaults.RemoteUid, DateTimeOffset.UtcNow.AddHours(-1));
|
||||
|
||||
//assert
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
Assert.NotNull(response.Content);
|
||||
Assert.Single(response.Content);
|
||||
|
||||
var actual = response.Content.First()!;
|
||||
|
||||
var expected = entity2.Adapt<ProcessMapPlanDrillingDto>()!;
|
||||
var excludeProps = new[] {
|
||||
nameof(ProcessMapPlanDrillingDto.Id),
|
||||
nameof(ProcessMapPlanDrillingDto.Author),
|
||||
nameof(ProcessMapPlanDrillingDto.Creation),
|
||||
};
|
||||
MatchHelper.Match(expected, actual, excludeProps);
|
||||
Assert.Equal(2, response.Content.Count());
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task Get_updated_returns_success()
|
||||
{
|
||||
//arrange
|
||||
var dbset = dbContext.Set<ProcessMapPlanDrilling>();
|
||||
|
||||
|
||||
dbset.Add(entity);
|
||||
|
||||
var entity2 = entity.Adapt<ProcessMapPlanDrilling>();
|
||||
@ -540,7 +482,7 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
{
|
||||
UpdateFrom = updateFrom,
|
||||
};
|
||||
var response = await client.Get(dto.IdWell, request);
|
||||
var response = await client.Get(dto.IdWell);
|
||||
|
||||
//assert
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
@ -553,8 +495,6 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
var expected = entity2.Adapt<ProcessMapPlanDrillingDto>();
|
||||
var excludeProps = new[] {
|
||||
nameof(ProcessMapPlanDrillingDto.Id),
|
||||
nameof(ProcessMapPlanDrillingDto.Author),
|
||||
nameof(ProcessMapPlanDrillingDto.Creation),
|
||||
};
|
||||
MatchHelper.Match(expected, actual, excludeProps);
|
||||
}
|
||||
@ -567,19 +507,19 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
var stream = Assembly.GetExecutingAssembly().GetFileCopyStream(fileName);
|
||||
|
||||
var streamPart = new StreamPart(stream, fileName, "application/octet-stream");
|
||||
|
||||
|
||||
//act
|
||||
var response = await client.Parse(IdWell, streamPart);
|
||||
|
||||
|
||||
//assert
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
|
||||
var parserResult = response.Content;
|
||||
|
||||
|
||||
Assert.NotNull(parserResult);
|
||||
Assert.Single(parserResult.Item);
|
||||
Assert.True(parserResult.IsValid);
|
||||
|
||||
|
||||
var row = parserResult.Item.First();
|
||||
var dtoActual = row.Item;
|
||||
|
||||
@ -595,23 +535,23 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
//arrange
|
||||
const string fileName = "ProcessMapPlanDrillingInvalid.xlsx";
|
||||
var stream = Assembly.GetExecutingAssembly().GetFileCopyStream(fileName);
|
||||
|
||||
|
||||
var streamPart = new StreamPart(stream, fileName, "application/octet-stream");
|
||||
|
||||
|
||||
//act
|
||||
var response = await client.Parse(IdWell, streamPart);
|
||||
|
||||
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
|
||||
|
||||
var parserResult = response.Content;
|
||||
|
||||
|
||||
Assert.NotNull(parserResult);
|
||||
Assert.False(parserResult.IsValid);
|
||||
Assert.Single(parserResult.Warnings);
|
||||
Assert.Single(parserResult.Item);
|
||||
|
||||
|
||||
var row = parserResult.Item.First();
|
||||
|
||||
|
||||
Assert.False(row.IsValid);
|
||||
Assert.Equal(2, row.Warnings.Count());
|
||||
}
|
||||
|
@ -11,6 +11,8 @@ namespace AsbCloudWebApi.IntegrationTests.Data
|
||||
Hours = 1
|
||||
};
|
||||
|
||||
public const string RemoteUid = "555-555-555";
|
||||
|
||||
public static Deposit[] Deposits => new Deposit[]
|
||||
{
|
||||
new()
|
||||
@ -39,7 +41,7 @@ namespace AsbCloudWebApi.IntegrationTests.Data
|
||||
Timezone = Timezone,
|
||||
Telemetry = new Telemetry
|
||||
{
|
||||
RemoteUid = "555-555-555",
|
||||
RemoteUid = RemoteUid,
|
||||
TimeZone = Timezone
|
||||
},
|
||||
RelationCompaniesWells = new RelationCompanyWell[]
|
||||
|
@ -1,21 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.ProcessMaps;
|
||||
using AsbCloudApp.Data.WellOperation;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Requests;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudDb.Model;
|
||||
using AsbCloudInfrastructure.Repository;
|
||||
using AsbCloudInfrastructure.Services.ProcessMaps;
|
||||
using AsbCloudInfrastructure.Services.ProcessMaps.Report;
|
||||
using DocumentFormat.OpenXml.Bibliography;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using NSubstitute;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
namespace AsbCloudWebApi.Tests.Services.ProcessMaps;
|
||||
@ -24,27 +20,27 @@ public class ProcessMapReportDataSaubStatServiceTest
|
||||
{
|
||||
|
||||
|
||||
private IWellService wellService
|
||||
private IWellService wellService
|
||||
= Substitute.For<IWellService>();
|
||||
|
||||
private IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> processMapPlanBaseRepository
|
||||
private IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> processMapPlanBaseRepository
|
||||
= Substitute.For<IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell>>();
|
||||
|
||||
private IWellOperationRepository wellOperationRepository
|
||||
private IWellOperationRepository wellOperationRepository
|
||||
= Substitute.For<IWellOperationRepository>();
|
||||
|
||||
private IWellOperationCategoryRepository wellOperationCategoryRepository
|
||||
private IWellOperationCategoryRepository wellOperationCategoryRepository
|
||||
= Substitute.For<IWellOperationCategoryRepository>();
|
||||
|
||||
private IDataSaubStatRepository dataSaubStatRepository
|
||||
private IDataSaubStatRepository dataSaubStatRepository
|
||||
= Substitute.For<IDataSaubStatRepository>();
|
||||
|
||||
private ProcessMapReportDrillingService service;
|
||||
|
||||
private readonly static SimpleTimezoneDto timezone = new() { Hours = 2 };
|
||||
private static readonly DateTimeOffset dateStart = new (2024, 01, 01, 00, 11, 11, timezone.Offset);
|
||||
private readonly static WellDto well = new()
|
||||
{
|
||||
private static readonly DateTimeOffset dateStart = new(2024, 01, 01, 00, 11, 11, timezone.Offset);
|
||||
private readonly static WellDto well = new()
|
||||
{
|
||||
Id = 1,
|
||||
IdTelemetry = 1,
|
||||
Timezone = timezone
|
||||
@ -52,7 +48,7 @@ public class ProcessMapReportDataSaubStatServiceTest
|
||||
private readonly static IEnumerable<ProcessMapPlanDrillingDto> processMapPlan = new List<ProcessMapPlanDrillingDto>()
|
||||
{
|
||||
new() {
|
||||
DepthStart = 0,
|
||||
DepthStart = 0,
|
||||
DepthEnd = 100,
|
||||
IdMode = 1,
|
||||
IdWell = well.Id,
|
||||
@ -136,6 +132,12 @@ public class ProcessMapReportDataSaubStatServiceTest
|
||||
Comment = "s",
|
||||
},
|
||||
};
|
||||
|
||||
private readonly static IEnumerable<ChangeLogDto<ProcessMapPlanDrillingDto>> processMapPlanChangeLog = processMapPlan.Select(p => new ChangeLogDto<ProcessMapPlanDrillingDto>()
|
||||
{
|
||||
Item = p,
|
||||
});
|
||||
|
||||
private readonly static IEnumerable<WellOperationDto> operations = new List<WellOperationDto>()
|
||||
{
|
||||
new()
|
||||
@ -253,15 +255,18 @@ public class ProcessMapReportDataSaubStatServiceTest
|
||||
HasOscillation = false,
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public ProcessMapReportDataSaubStatServiceTest()
|
||||
{
|
||||
wellService.GetOrDefaultAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
|
||||
.Returns(well);
|
||||
|
||||
processMapPlanBaseRepository.Get(Arg.Any<ProcessMapPlanBaseRequestWithWell>(), Arg.Any<CancellationToken>())
|
||||
processMapPlanBaseRepository.GetCurrent(Arg.Any<ProcessMapPlanBaseRequestWithWell>(), Arg.Any<CancellationToken>())
|
||||
.Returns(processMapPlan);
|
||||
|
||||
processMapPlanBaseRepository.GetChangeLogForDate(Arg.Any<ProcessMapPlanBaseRequestWithWell>(), null, Arg.Any<CancellationToken>())
|
||||
.Returns(processMapPlanChangeLog);
|
||||
|
||||
wellOperationRepository.GetAsync(Arg.Any<WellOperationRequest>(), Arg.Any<CancellationToken>())
|
||||
.Returns(operations);
|
||||
|
||||
|
@ -1,23 +1,24 @@
|
||||
using AsbCloudApp.Repositories;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using AsbCloudApp.Exceptions;
|
||||
using AsbCloudApp.Requests;
|
||||
using System;
|
||||
using System.IO;
|
||||
using AsbCloudApp.Services;
|
||||
using System.Linq;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Requests.ParserOptions;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.ProcessMaps;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using AsbCloudApp.Exceptions;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Requests;
|
||||
using AsbCloudApp.Requests.ExportOptions;
|
||||
using AsbCloudApp.Requests.ParserOptions;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudApp.Services.Export;
|
||||
using AsbCloudApp.Services.Parsers;
|
||||
using AsbCloudDb.Model.ProcessMapPlan;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers.ProcessMaps;
|
||||
|
||||
@ -27,22 +28,26 @@ namespace AsbCloudWebApi.Controllers.ProcessMaps;
|
||||
[ApiController]
|
||||
[Route("api/well/{idWell}/[controller]")]
|
||||
[Authorize]
|
||||
public abstract class ProcessMapPlanBaseController<TDto> : ControllerBase
|
||||
public abstract class ProcessMapPlanBaseController<TEntity, TDto> : ControllerBase
|
||||
where TEntity : ProcessMapPlanBase
|
||||
where TDto : ProcessMapPlanBaseDto
|
||||
{
|
||||
private readonly IChangeLogRepository<TDto, ProcessMapPlanBaseRequestWithWell> repository;
|
||||
private readonly IWellService wellService;
|
||||
private readonly IParserService<TDto, WellRelatedParserRequest> parserService;
|
||||
private readonly ITelemetryService telemetryService;
|
||||
private readonly IExportService<WellRelatedExportRequest> processMapPlanExportService;
|
||||
|
||||
protected ProcessMapPlanBaseController(IChangeLogRepository<TDto, ProcessMapPlanBaseRequestWithWell> repository,
|
||||
IWellService wellService,
|
||||
IParserService<TDto, WellRelatedParserRequest> parserService,
|
||||
IExportService<WellRelatedExportRequest> processMapPlanExportService)
|
||||
IExportService<WellRelatedExportRequest> processMapPlanExportService,
|
||||
ITelemetryService telemetryService)
|
||||
{
|
||||
this.repository = repository;
|
||||
this.wellService = wellService;
|
||||
this.parserService = parserService;
|
||||
this.telemetryService = telemetryService;
|
||||
this.processMapPlanExportService = processMapPlanExportService;
|
||||
}
|
||||
|
||||
@ -58,7 +63,7 @@ public abstract class ProcessMapPlanBaseController<TDto> : ControllerBase
|
||||
[HttpPost]
|
||||
[ProducesResponseType(typeof(int), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
|
||||
public async Task<IActionResult> InsertRange([FromRoute][Range(0,int.MaxValue)] int idWell, IEnumerable<TDto> dtos, CancellationToken token)
|
||||
public async Task<IActionResult> InsertRange([FromRoute][Range(0, int.MaxValue)] int idWell, IEnumerable<TDto> dtos, CancellationToken token)
|
||||
{
|
||||
var idUser = await AssertUserHasAccessToWell(idWell, token);
|
||||
|
||||
@ -92,7 +97,7 @@ public abstract class ProcessMapPlanBaseController<TDto> : ControllerBase
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удаление
|
||||
/// Пометить записи как удаленные
|
||||
/// </summary>
|
||||
/// <param name="idWell"></param>
|
||||
/// <param name="ids"></param>
|
||||
@ -101,11 +106,11 @@ public abstract class ProcessMapPlanBaseController<TDto> : ControllerBase
|
||||
[HttpDelete]
|
||||
[ProducesResponseType(typeof(int), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
|
||||
public async Task<IActionResult> DeleteRange([FromRoute] int idWell, IEnumerable<int> ids, CancellationToken token)
|
||||
public async Task<IActionResult> MarkAsDeleted([FromRoute] int idWell, IEnumerable<int> ids, CancellationToken token)
|
||||
{
|
||||
var idUser = await AssertUserHasAccessToWell(idWell, token);
|
||||
|
||||
var result = await repository.DeleteRange(idUser, ids, token);
|
||||
var result = await repository.MarkAsDeleted(idUser, ids, token);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
@ -128,21 +133,78 @@ public abstract class ProcessMapPlanBaseController<TDto> : ControllerBase
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение
|
||||
/// Получение текущих записей по параметрам
|
||||
/// </summary>
|
||||
/// <param name="idWell"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
|
||||
public async Task<ActionResult<IEnumerable<TDto>>> Get([FromRoute] int idWell, [FromQuery] ProcessMapPlanBaseRequest request, CancellationToken token)
|
||||
public async Task<ActionResult<IEnumerable<TDto>>> GetCurrent([FromRoute] int idWell, CancellationToken token)
|
||||
{
|
||||
await AssertUserHasAccessToWell(idWell, token);
|
||||
|
||||
var serviceRequest = new ProcessMapPlanBaseRequestWithWell(request, idWell);
|
||||
var result = await repository.Get(serviceRequest, token);
|
||||
var serviceRequest = new ProcessMapPlanBaseRequestWithWell(idWell);
|
||||
|
||||
var result = await repository.GetCurrent(serviceRequest, token);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение измененных записей за определенную дату по ключу скважины
|
||||
/// </summary>
|
||||
/// <param name="idWell"></param>
|
||||
/// <param name="moment"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("changelogByMoment")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
|
||||
public async Task<ActionResult<IEnumerable<ChangeLogDto<TDto>>>> GetChangeLogByMoment([FromRoute] int idWell, DateTimeOffset? moment, CancellationToken token)
|
||||
{
|
||||
await AssertUserHasAccessToWell(idWell, token);
|
||||
|
||||
var dataRequest = new ProcessMapPlanBaseRequestWithWell(idWell);
|
||||
|
||||
var changeLogRequest = new ChangeLogRequest()
|
||||
{
|
||||
Moment = moment
|
||||
};
|
||||
|
||||
var builder = repository
|
||||
.GetQueryBuilder(changeLogRequest)
|
||||
.ApplyRequest(dataRequest);
|
||||
|
||||
var dtos = await builder.GetChangeLogData(token);
|
||||
|
||||
return Ok(dtos);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение записей за определенную дату по uid
|
||||
/// </summary>
|
||||
/// <param name="uid"></param>
|
||||
/// <param name="updateFrom"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[HttpGet("/api/telemetry/{uid}/[controller]")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
|
||||
public async Task<ActionResult<IEnumerable<ChangeLogDto<TDto>>>> GetByUid(string uid, DateTimeOffset? updateFrom, CancellationToken token)
|
||||
{
|
||||
var idWell = telemetryService.GetIdWellByTelemetryUid(uid) ?? -1;
|
||||
|
||||
if (idWell < 0)
|
||||
return this.ValidationBadRequest(nameof(uid), "Скважина по uid не найдена");
|
||||
|
||||
var serviceRequest = new ProcessMapPlanBaseRequestWithWell(idWell)
|
||||
{
|
||||
UpdateFrom = updateFrom,
|
||||
};
|
||||
|
||||
var result = await repository.GetChangeLogForDate(serviceRequest, null, token);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
@ -153,15 +215,15 @@ public abstract class ProcessMapPlanBaseController<TDto> : ControllerBase
|
||||
/// <param name="date"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("changeLog")]
|
||||
[HttpGet("changeLogForDate")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
|
||||
public async Task<ActionResult<IEnumerable<TDto>>> GetChangeLog([FromRoute] int idWell, [FromQuery] DateOnly? date, CancellationToken token)
|
||||
public async Task<ActionResult<IEnumerable<ChangeLogDto<TDto>>>> GetChangeLogForDate([FromRoute] int idWell, [FromQuery] DateOnly? date, CancellationToken token)
|
||||
{
|
||||
await AssertUserHasAccessToWell(idWell, token);
|
||||
|
||||
var serviceRequest = new ProcessMapPlanBaseRequestWithWell(idWell);
|
||||
var result = await repository.GetChangeLog(serviceRequest, date, token);
|
||||
var result = await repository.GetChangeLogForDate(serviceRequest, date, token);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
@ -197,7 +259,7 @@ public abstract class ProcessMapPlanBaseController<TDto> : ControllerBase
|
||||
{
|
||||
if (!dtos.Any())
|
||||
return NoContent();
|
||||
|
||||
|
||||
var idUser = await AssertUserHasAccessToWell(idWell, token);
|
||||
|
||||
foreach (var dto in dtos)
|
||||
@ -218,7 +280,7 @@ public abstract class ProcessMapPlanBaseController<TDto> : ControllerBase
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
|
||||
public async Task<ActionResult<ParserResultDto<TDto>>> Parse(int idWell,
|
||||
[Required] IFormFile file,
|
||||
[Required] IFormFile file,
|
||||
CancellationToken token)
|
||||
{
|
||||
await AssertUserHasAccessToWell(idWell, token);
|
||||
@ -229,7 +291,7 @@ public abstract class ProcessMapPlanBaseController<TDto> : ControllerBase
|
||||
{
|
||||
var options = new WellRelatedParserRequest(idWell);
|
||||
var dto = parserService.Parse(stream, options);
|
||||
|
||||
|
||||
return Ok(dto);
|
||||
}
|
||||
catch (FileFormatException ex)
|
||||
@ -271,7 +333,7 @@ public abstract class ProcessMapPlanBaseController<TDto> : ControllerBase
|
||||
throw new ForbidException("Нет доступа к скважине");
|
||||
return idUser;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Формируем excel файл с текущими строками РТК
|
||||
/// </summary>
|
||||
|
@ -2,6 +2,7 @@
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Requests;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudDb.Model.ProcessMaps;
|
||||
using AsbCloudInfrastructure.Services.ProcessMapPlan.Export;
|
||||
using AsbCloudInfrastructure.Services.ProcessMapPlan.Parser;
|
||||
|
||||
@ -10,13 +11,14 @@ namespace AsbCloudWebApi.Controllers.ProcessMaps;
|
||||
/// <summary>
|
||||
/// РТК план бурения
|
||||
/// </summary>
|
||||
public class ProcessMapPlanDrillingController : ProcessMapPlanBaseController<ProcessMapPlanDrillingDto>
|
||||
public class ProcessMapPlanDrillingController : ProcessMapPlanBaseController<ProcessMapPlanDrilling, ProcessMapPlanDrillingDto>
|
||||
{
|
||||
public ProcessMapPlanDrillingController(IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> repository,
|
||||
IWellService wellService,
|
||||
ProcessMapPlanDrillingParser parserService,
|
||||
ITelemetryService telemetryService,
|
||||
ProcessMapPlanDrillingExportService processMapPlanExportService)
|
||||
: base(repository, wellService, parserService, processMapPlanExportService)
|
||||
: base(repository, wellService, parserService, processMapPlanExportService, telemetryService)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Requests;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudDb.Model.ProcessMaps;
|
||||
using AsbCloudInfrastructure.Services.ProcessMapPlan.Export;
|
||||
using AsbCloudInfrastructure.Services.ProcessMapPlan.Parser;
|
||||
|
||||
@ -10,13 +11,14 @@ namespace AsbCloudWebApi.Controllers.ProcessMaps;
|
||||
/// <summary>
|
||||
/// РТК план проработка
|
||||
/// </summary>
|
||||
public class ProcessMapPlanReamController : ProcessMapPlanBaseController<ProcessMapPlanReamDto>
|
||||
public class ProcessMapPlanReamController : ProcessMapPlanBaseController<ProcessMapPlanReam, ProcessMapPlanReamDto>
|
||||
{
|
||||
public ProcessMapPlanReamController(IChangeLogRepository<ProcessMapPlanReamDto, ProcessMapPlanBaseRequestWithWell> repository,
|
||||
IWellService wellService,
|
||||
ProcessMapPlanReamParser parserService,
|
||||
ITelemetryService telemetryService,
|
||||
ProcessMapPlanReamExportService processMapPlanExportService)
|
||||
: base(repository, wellService, parserService, processMapPlanExportService)
|
||||
: base(repository, wellService, parserService, processMapPlanExportService, telemetryService)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,25 +1,24 @@
|
||||
using AsbCloudApp.Data.GTR;
|
||||
using AsbCloudApp.IntegrationEvents;
|
||||
using AsbCloudApp.IntegrationEvents.Interfaces;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Services.Notifications;
|
||||
using AsbCloudDb.Model;
|
||||
using AsbCloudInfrastructure.Services;
|
||||
using AsbCloudInfrastructure.Services.Email;
|
||||
using AsbCloudWebApi.SignalR;
|
||||
using AsbCloudWebApi.SignalR.Services;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Microsoft.OpenApi.Any;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using AsbCloudApp.IntegrationEvents;
|
||||
using AsbCloudApp.IntegrationEvents.Interfaces;
|
||||
using AsbCloudApp.Services.Notifications;
|
||||
using AsbCloudInfrastructure.Services.Email;
|
||||
using AsbCloudWebApi.SignalR;
|
||||
using AsbCloudWebApi.SignalR.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.OpenApi.Any;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
|
||||
namespace AsbCloudWebApi
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user