forked from ddrilling/AsbCloudServer
Merge branch 'dev' into Microsoft_MemoryCache
This commit is contained in:
commit
abb6a513fd
@ -91,7 +91,7 @@ namespace System.Collections.Generic
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (used == 0)
|
if (used == 0)
|
||||||
return default;
|
throw new IndexOutOfRangeException();
|
||||||
|
|
||||||
var i = (current + 1 + index) % used;
|
var i = (current + 1 + index) % used;
|
||||||
return array[i];
|
return array[i];
|
||||||
|
@ -10,7 +10,7 @@ namespace AsbCloudApp.Data.Subsystems
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Активная скважина
|
/// Активная скважина
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public WellDto Well { get; set; }
|
public WellDto Well { get; set; } = null!;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Наработки подсистемы АКБ
|
/// Наработки подсистемы АКБ
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -51,7 +51,6 @@ namespace AsbCloudApp.Repositories
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Вывод списка всех файлов из базы, для которых нет файла на диске
|
/// Вывод списка всех файлов из базы, для которых нет файла на диске
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="idWell"></param>
|
|
||||||
/// <param name="files"></param>
|
/// <param name="files"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
IEnumerable<FileInfoDto> GetListFilesNotDisc(IEnumerable<FileInfoDto> files);
|
IEnumerable<FileInfoDto> GetListFilesNotDisc(IEnumerable<FileInfoDto> files);
|
||||||
|
@ -165,15 +165,6 @@ namespace AsbCloudApp.Services
|
|||||||
public async Task<IEnumerable<FileInfoDto>> GetInfoByIdsAsync(IEnumerable<int> idsFile, CancellationToken token)
|
public async Task<IEnumerable<FileInfoDto>> GetInfoByIdsAsync(IEnumerable<int> idsFile, CancellationToken token)
|
||||||
{
|
{
|
||||||
var result = await fileRepository.GetInfoByIdsAsync(idsFile, token).ConfigureAwait(false);
|
var result = await fileRepository.GetInfoByIdsAsync(idsFile, token).ConfigureAwait(false);
|
||||||
|
|
||||||
foreach (var entity in result)
|
|
||||||
{
|
|
||||||
|
|
||||||
var ext = Path.GetExtension(entity.Name);
|
|
||||||
var relativePath = GetUrl(entity.IdWell, entity.IdCategory, entity.Id, ext);
|
|
||||||
var fullPath = Path.GetFullPath(relativePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace AsbCloudApp.Services
|
namespace AsbCloudApp.Services
|
||||||
{
|
{
|
||||||
|
#nullable enable
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Сервис авторизации
|
/// Сервис авторизации
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -33,13 +34,14 @@ namespace AsbCloudApp.Services
|
|||||||
/// <param name="password"></param>
|
/// <param name="password"></param>
|
||||||
/// <param name="token">токен отмены задачи</param>
|
/// <param name="token">токен отмены задачи</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<UserTokenDto> LoginAsync(string login,
|
Task<UserTokenDto?> LoginAsync(string login,
|
||||||
string password, CancellationToken token = default);
|
string password, CancellationToken token = default);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Обновление токена авторизации
|
/// Обновление токена авторизации
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="user"></param>
|
/// <param name="identity"></param>
|
||||||
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<UserTokenDto?> RefreshAsync(ClaimsPrincipal identity,
|
Task<UserTokenDto?> RefreshAsync(ClaimsPrincipal identity,
|
||||||
CancellationToken token);
|
CancellationToken token);
|
||||||
@ -51,4 +53,5 @@ namespace AsbCloudApp.Services
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
int Register(UserRegistrationDto userDto);
|
int Register(UserRegistrationDto userDto);
|
||||||
}
|
}
|
||||||
|
#nullable disable
|
||||||
}
|
}
|
@ -10,6 +10,12 @@ namespace AsbCloudApp.Services
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IFileCategoryService
|
public interface IFileCategoryService
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Получить категории файлов
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="token"></param>
|
||||||
|
/// <returns></returns>
|
||||||
Task<FileCategoryDto> GetOrDefaultAsync(int id, CancellationToken token);
|
Task<FileCategoryDto> GetOrDefaultAsync(int id, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -6,8 +6,19 @@ using System.Threading.Tasks;
|
|||||||
namespace AsbCloudApp.Services.Subsystems
|
namespace AsbCloudApp.Services.Subsystems
|
||||||
{
|
{
|
||||||
#nullable enable
|
#nullable enable
|
||||||
|
// TODO: move this to repositories
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// репозиторий получения подсистем
|
||||||
|
/// </summary>
|
||||||
public interface ISubsystemService
|
public interface ISubsystemService
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// получение списка подсистем. Если скважина указана, то получим только использованные в скважине подсистемы.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="idWell"></param>
|
||||||
|
/// <param name="token"></param>
|
||||||
|
/// <returns></returns>
|
||||||
Task<IEnumerable<SubsystemDto>?> GetSubsystemAsync(int? idWell, CancellationToken token);
|
Task<IEnumerable<SubsystemDto>?> GetSubsystemAsync(int? idWell, CancellationToken token);
|
||||||
}
|
}
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
@ -59,15 +59,7 @@ namespace AsbCloudDb.Model
|
|||||||
public DbSet<WITS.Record50> Record50 => Set<WITS.Record50>();
|
public DbSet<WITS.Record50> Record50 => Set<WITS.Record50>();
|
||||||
public DbSet<WITS.Record60> Record60 => Set<WITS.Record60>();
|
public DbSet<WITS.Record60> Record60 => Set<WITS.Record60>();
|
||||||
public DbSet<WITS.Record61> Record61 => Set<WITS.Record61>();
|
public DbSet<WITS.Record61> Record61 => Set<WITS.Record61>();
|
||||||
|
|
||||||
private System.Text.Json.JsonSerializerOptions jsonSerializerOptions = new()
|
|
||||||
{
|
|
||||||
AllowTrailingCommas = true,
|
|
||||||
WriteIndented = true,
|
|
||||||
NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString |
|
|
||||||
System.Text.Json.Serialization.JsonNumberHandling.AllowNamedFloatingPointLiterals,
|
|
||||||
};
|
|
||||||
|
|
||||||
public AsbCloudDbContext() : base()
|
public AsbCloudDbContext() : base()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -368,10 +360,5 @@ namespace AsbCloudDb.Model
|
|||||||
var sql = $"REFRESH MATERIALIZED VIEW {materializedViewName};";
|
var sql = $"REFRESH MATERIALIZED VIEW {materializedViewName};";
|
||||||
return Database.ExecuteSqlRawAsync(sql, token);
|
return Database.ExecuteSqlRawAsync(sql, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<int> RefreshMaterializedViewAsync<TEntity>(string? mwName = null, CancellationToken token = default) where TEntity : class
|
|
||||||
{
|
|
||||||
throw new System.NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,58 +5,57 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// КНБК описание
|
/// КНБК описание
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string BHADescription { get; set; }
|
public string BHADescription { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Бурение с наращиваниями в инт. 2195-2763м. Время начала
|
/// Бурение с наращиваниями в инт. 2195-2763м. Время начала
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ExtensionDrillingOneBegin { get; set; }
|
public string ExtensionDrillingOneBegin { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Бурение с наращиваниями в инт. 2195-2763м. Время окончания
|
/// Бурение с наращиваниями в инт. 2195-2763м. Время окончания
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ExtensionDrillingOneFinish { get; set; }
|
public string ExtensionDrillingOneFinish { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Промывка. Время начала
|
/// Промывка. Время начала
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SluiceBegin { get; set; }
|
public string SluiceBegin { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Промывка. Время окончания
|
/// Промывка. Время окончания
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SluiceFinish { get; set; }
|
public string SluiceFinish { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Подьем КНБК. Время начала
|
/// Подьем КНБК. Время начала
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ClimbBegin { get; set; }
|
public string ClimbBegin { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Подьем КНБК. Время окончания
|
/// Подьем КНБК. Время окончания
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ClimbFinish { get; set; }
|
public string ClimbFinish { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Спуск КНБК. Время начала
|
/// Спуск КНБК. Время начала
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DescentBegin { get; set; }
|
public string DescentBegin { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Спуск КНБК. Время окончания
|
/// Спуск КНБК. Время окончания
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DescentFinish { get; set; }
|
public string DescentFinish { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Бурение с наращиваниями в инт. 2763-2850м. Время начала
|
/// Бурение с наращиваниями в инт. 2763-2850м. Время начала
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ExtensionDrillingTwoBegin { get; set; }
|
public string ExtensionDrillingTwoBegin { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Бурение с наращиваниями в инт. 2763-2850м. Время окончания
|
/// Бурение с наращиваниями в инт. 2763-2850м. Время окончания
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ExtensionDrillingTwoFinish { get; set; }
|
public string ExtensionDrillingTwoFinish { get; set; } = string.Empty;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,22 +6,22 @@ namespace AsbCloudDb.Model.DailyReport
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// название скважины
|
/// название скважины
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string WellName { get; set; }
|
public string WellName { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// название куста
|
/// название куста
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ClusterName { get; set; }
|
public string ClusterName { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// заказчик
|
/// заказчик
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Customer { get; set; }
|
public string Customer { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// подрядчик
|
/// подрядчик
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Contractor { get; set; }
|
public string Contractor { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// дата рапорта
|
/// дата рапорта
|
||||||
@ -61,12 +61,12 @@ namespace AsbCloudDb.Model.DailyReport
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// ФИО бурильщиков
|
/// ФИО бурильщиков
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string FirstDriller { get; set; }
|
public string FirstDriller { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ФИО бурильщиков
|
/// ФИО бурильщиков
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SecondDriller { get; set; }
|
public string SecondDriller { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Время работы АПД
|
/// Время работы АПД
|
||||||
|
@ -72,32 +72,32 @@ namespace AsbCloudDb.Model.DailyReport
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// указываются все причины, которые влияют на снижение МСП.
|
/// указываются все причины, которые влияют на снижение МСП.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DeclinesReasonsROP { get; set; }
|
public string DeclinesReasonsROP { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Увеличение мех скорости за секцию %
|
/// Увеличение мех скорости за секцию %
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string IncreaseSpeedSection { get; set; }
|
public string IncreaseSpeedSection { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Увеличение мех скорости за сутки %
|
/// Увеличение мех скорости за сутки %
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string IncreaseSpeedDay { get; set; }
|
public string IncreaseSpeedDay { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Сокращение времени бурения за секцию, ч
|
/// Сокращение времени бурения за секцию, ч
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ReductionTimeDrilling { get; set; }
|
public string ReductionTimeDrilling { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ротор/Слайд %
|
/// Ротор/Слайд %
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string RotorSlidePercent { get; set; }
|
public string RotorSlidePercent { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// МСП
|
/// МСП
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string MspSection { get; set; }
|
public string MspSection { get; set; } = string.Empty;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,12 +5,12 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// ФИО Мастера буровой
|
/// ФИО Мастера буровой
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DrillingMaster { get; set; }
|
public string DrillingMaster { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ФИО супервайзера
|
/// ФИО супервайзера
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Supervisor { get; set; }
|
public string Supervisor { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,92 +5,92 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Бурение
|
/// Бурение
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Drilling { get; set; }
|
public string Drilling { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Промывка
|
/// Промывка
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Flushing { get; set; }
|
public string Flushing { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Наращивание
|
/// Наращивание
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Building { get; set; }
|
public string Building { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Проработка
|
/// Проработка
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Elaboration { get; set; }
|
public string Elaboration { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Расширка
|
/// Расширка
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Extension { get; set; }
|
public string Extension { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ремонт
|
/// Ремонт
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Repair { get; set; }
|
public string Repair { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// КНБК
|
/// КНБК
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Knbk { get; set; }
|
public string Knbk { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// СПО
|
/// СПО
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Spo { get; set; }
|
public string Spo { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ПЗР
|
/// ПЗР
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Pzr { get; set; }
|
public string Pzr { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ПВО
|
/// ПВО
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Pvo { get; set; }
|
public string Pvo { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ПГР
|
/// ПГР
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Pgr { get; set; }
|
public string Pgr { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ГИС
|
/// ГИС
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Gis { get; set; }
|
public string Gis { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ОЗЦ
|
/// ОЗЦ
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Ozc { get; set; }
|
public string Ozc { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Тех. работы
|
/// Тех. работы
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string EngineeringWorks { get; set; }
|
public string EngineeringWorks { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Снятие замера
|
/// Снятие замера
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TakingMeasure { get; set; }
|
public string TakingMeasure { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Цементирование
|
/// Цементирование
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Cementing { get; set; }
|
public string Cementing { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Простой
|
/// Простой
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Simple { get; set; }
|
public string Simple { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// НПВ
|
/// НПВ
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Npv { get; set; }
|
public string Npv { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,8 @@ namespace AsbCloudInfrastructure
|
|||||||
services.AddDbContext<AsbCloudDbContext>(options =>
|
services.AddDbContext<AsbCloudDbContext>(options =>
|
||||||
options.UseNpgsql(configuration.GetConnectionString(connectionStringName)));
|
options.UseNpgsql(configuration.GetConnectionString(connectionStringName)));
|
||||||
|
|
||||||
services.AddFluentValidation();
|
// TODO: переместить FluentValidation в описание моделей
|
||||||
|
services.AddFluentValidationClientsideAdapters();
|
||||||
|
|
||||||
services.AddMemoryCache();
|
services.AddMemoryCache();
|
||||||
services.AddScoped<IAsbCloudDbContext>(provider => provider.GetService<AsbCloudDbContext>());
|
services.AddScoped<IAsbCloudDbContext>(provider => provider.GetService<AsbCloudDbContext>());
|
||||||
|
@ -12,6 +12,7 @@ using AsbCloudApp.Data.DailyReport;
|
|||||||
using AsbCloudApp.Requests;
|
using AsbCloudApp.Requests;
|
||||||
using AsbCloudInfrastructure.Services.DetectOperations;
|
using AsbCloudInfrastructure.Services.DetectOperations;
|
||||||
using AsbCloudApp.Data.DetectedOperation;
|
using AsbCloudApp.Data.DetectedOperation;
|
||||||
|
using AsbCloudApp.Exceptions;
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.DailyReport
|
namespace AsbCloudInfrastructure.Services.DailyReport
|
||||||
{
|
{
|
||||||
@ -34,7 +35,8 @@ namespace AsbCloudInfrastructure.Services.DailyReport
|
|||||||
{
|
{
|
||||||
var well = wellService.GetOrDefault(idWell);
|
var well = wellService.GetOrDefault(idWell);
|
||||||
if (well is null || well.Timezone is null)
|
if (well is null || well.Timezone is null)
|
||||||
return null;
|
throw new ArgumentInvalidException("idWell doesn`t exist", nameof(idWell));
|
||||||
|
|
||||||
var query = db.DailyReports.Where(r => r.IdWell == idWell);
|
var query = db.DailyReports.Where(r => r.IdWell == idWell);
|
||||||
|
|
||||||
DateTimeOffset ExtractDate(DateTime dateTime)
|
DateTimeOffset ExtractDate(DateTime dateTime)
|
||||||
@ -65,9 +67,8 @@ namespace AsbCloudInfrastructure.Services.DailyReport
|
|||||||
public async Task<DailyReportDto> GetOrGenerateAsync(int idWell, DateTime date, CancellationToken token)
|
public async Task<DailyReportDto> GetOrGenerateAsync(int idWell, DateTime date, CancellationToken token)
|
||||||
{
|
{
|
||||||
var dateOnly = DateTime.SpecifyKind(date.Date, DateTimeKind.Utc);
|
var dateOnly = DateTime.SpecifyKind(date.Date, DateTimeKind.Utc);
|
||||||
var dailyReportDto = await GetAsync(idWell, dateOnly, token);
|
var dailyReportDto = await GetOrDefaultAsync(idWell, dateOnly, token);
|
||||||
if (dailyReportDto is null)
|
dailyReportDto ??= await MakeDefaultDailyReportAsync(idWell, dateOnly, token);
|
||||||
dailyReportDto = await MakeDefaultDailyReportAsync(idWell, dateOnly, token);
|
|
||||||
return dailyReportDto;
|
return dailyReportDto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +106,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport
|
|||||||
|
|
||||||
public async Task<Stream?> MakeReportAsync(int idWell, DateTime date, CancellationToken token = default)
|
public async Task<Stream?> MakeReportAsync(int idWell, DateTime date, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var dailyReportDto = await GetAsync(idWell, date, token);
|
var dailyReportDto = await GetOrDefaultAsync(idWell, date, token);
|
||||||
if (dailyReportDto is null)
|
if (dailyReportDto is null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@ -113,7 +114,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport
|
|||||||
return memoryStream;
|
return memoryStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<DailyReportDto?> GetAsync(int idWell, DateTime date, CancellationToken token)
|
private async Task<DailyReportDto?> GetOrDefaultAsync(int idWell, DateTime date, CancellationToken token)
|
||||||
{
|
{
|
||||||
var dateOffset = date.Date;
|
var dateOffset = date.Date;
|
||||||
var entity = await db.DailyReports
|
var entity = await db.DailyReports
|
||||||
|
@ -37,7 +37,7 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
/// <param name="idWell">id скважины</param>
|
/// <param name="idWell">id скважины</param>
|
||||||
/// <param name="idCategory">id категории файла</param>
|
/// <param name="idCategory">id категории файла</param>
|
||||||
/// <param name="files">Коллекция файлов</param>
|
/// <param name="files">Коллекция файлов</param>
|
||||||
/// <param name="userService">dependency</param>
|
/// <param name="userRepository">dependency</param>
|
||||||
/// <param name="token"> Токен отмены задачи </param>
|
/// <param name="token"> Токен отмены задачи </param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
@ -100,7 +100,6 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Возвращает файл с диска на сервере
|
/// Возвращает файл с диска на сервере
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="idWell">id скважины</param>
|
|
||||||
/// <param name="idFile">id запрашиваемого файла</param>
|
/// <param name="idFile">id запрашиваемого файла</param>
|
||||||
/// <param name="token"> Токен отмены задачи </param>
|
/// <param name="token"> Токен отмены задачи </param>
|
||||||
/// <returns>Запрашиваемый файл</returns>
|
/// <returns>Запрашиваемый файл</returns>
|
||||||
@ -108,7 +107,7 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
[Route("{idFile}")]
|
[Route("{idFile}")]
|
||||||
[Permission]
|
[Permission]
|
||||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> GetFileAsync([FromRoute] int idWell,
|
public async Task<IActionResult> GetFileAsync(
|
||||||
int idFile, CancellationToken token = default)
|
int idFile, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
int? idCompany = User.GetCompanyId();
|
int? idCompany = User.GetCompanyId();
|
||||||
@ -135,7 +134,7 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="idWell">id скважины</param>
|
/// <param name="idWell">id скважины</param>
|
||||||
/// <param name="idFile">id запрашиваемого файла</param>
|
/// <param name="idFile">id запрашиваемого файла</param>
|
||||||
/// <param name="userService">dependency</param>
|
/// <param name="userRepository">dependency</param>
|
||||||
/// <param name="token">Токен отмены задачи </param>
|
/// <param name="token">Токен отмены задачи </param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpDelete("{idFile}")]
|
[HttpDelete("{idFile}")]
|
||||||
|
Loading…
Reference in New Issue
Block a user