Merge branch 'dev' into feature/APD

This commit is contained in:
on.nemtina 2023-09-14 13:18:26 +05:00
commit 451d7207bd
46 changed files with 26865 additions and 201 deletions

View File

@ -0,0 +1,33 @@
using System.Collections.Generic;
using System.Linq;
namespace AsbCloudApp.Data.Manuals;
/// <summary>
/// Директория для хранения инструкций
/// </summary>
public class ManualDirectoryDto : IId
{
/// <inheritdoc/>
public int Id { get; set; }
/// <summary>
/// Название
/// </summary>
public string Name { get; set; } = null!;
/// <summary>
/// Id родительской директории
/// </summary>
public int? IdParent { get; set; }
/// <summary>
/// Вложенные директории
/// </summary>
public IEnumerable<ManualDirectoryDto> Children { get; set; } = Enumerable.Empty<ManualDirectoryDto>();
/// <summary>
/// Хранимые инструкции
/// </summary>
public IEnumerable<ManualDto> Manuals { get; set; } = Enumerable.Empty<ManualDto>();
}

View File

@ -0,0 +1,37 @@
using System;
namespace AsbCloudApp.Data.Manuals;
/// <summary>
/// Инструкция
/// </summary>
public class ManualDto : IId
{
/// <inheritdoc/>
public int Id { get; set; }
/// <summary>
/// Название
/// </summary>
public string Name { get; set; } = null!;
/// <summary>
/// Дата загрузки
/// </summary>
public DateTime DateDownload { get; set; }
/// <summary>
/// Id автора
/// </summary>
public int IdAuthor { get; set; }
/// <summary>
/// Id директории
/// </summary>
public int IdDirectory { get; set; }
/// <summary>
/// Id категории файла
/// </summary>
public int IdCategory { get; set; }
}

View File

@ -33,16 +33,6 @@ public abstract class TrajectoryGeoDto
/// Глубина вертикальная
/// </summary>
public double? VerticalDepth { get; set; }
/// <summary>
/// Север отн- но устья
/// </summary>
public double? NorthOrifice { get; set; }
/// <summary>
/// Восток отн- но устья
/// </summary>
public double? EastOrifice { get; set; }
}
/// <summary>

View File

@ -21,41 +21,6 @@ namespace AsbCloudApp.Data
/// </summary>
public int IdUser { get; set; }
/// <summary>
/// Абсолютная отметка
/// </summary>
public double AbsoluteMark { get; set; }
/// <summary>
/// Восток картографический
/// </summary>
public double EastCartographic { get; set; }
/// <summary>
/// Север картографический
/// </summary>
public double NorthCartographic { get; set; }
/// <summary>
/// Пространственная интенсивность
/// </summary>
public double SpatialIntensity { get; set; }
/// <summary>
/// Интенсивность по углу
/// </summary>
public double AngleIntensity { get; set; }
/// <summary>
/// Интенсивность по азимуту
/// </summary>
public double AzimuthIntensity { get; set; }
/// <summary>
/// Смещение от устья
/// </summary>
public double OrificeOffset { get; set; }
/// <summary>
/// Радиус цели
/// </summary>

View File

@ -47,6 +47,13 @@ namespace AsbCloudApp.Repositories
/// <param name="fileName"></param>
void DeleteFile(string fileName);
/// <summary>
/// Удаление директории
/// </summary>
/// <param name="path"></param>
/// <param name="isRecursive"></param>
void DeleteDirectory(string path, bool isRecursive);
/// <summary>
/// Удаление всех файлов с диска о которых нет информации в базе
/// </summary>

View File

@ -0,0 +1,37 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Data.Manuals;
using AsbCloudApp.Services;
namespace AsbCloudApp.Repositories;
/// <summary>
/// Репозиторий для работы с директориямиы хранящими инструкциями
/// </summary>
public interface IManualDirectoryRepository : ICrudRepository<ManualDirectoryDto>
{
/// <summary>
/// Получение дерева директорий
/// </summary>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<IEnumerable<ManualDirectoryDto>> GetTreeAsync(CancellationToken cancellationToken);
/// <summary>
/// Получение одной директории по параметрам
/// </summary>
/// <param name="name"></param>
/// <param name="idParent"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<ManualDirectoryDto?> GetOrDefaultAsync(string name, int? idParent, CancellationToken cancellationToken);
/// <summary>
/// Проверка директории на существование
/// </summary>
/// <param name="id"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<bool> IsExistsAsync(int id, CancellationToken cancellationToken);
}

View File

@ -0,0 +1,59 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Requests;
/// <summary>
/// Параметры запроса телеметрии
/// </summary>
public class TelemetryDataRequest
{
/// <summary>
/// Максимально допустимое кол-во строк данных
/// </summary>
public const int MaxTake = 3072;
/// <summary>
/// greater or equal then Date
/// </summary>
public DateTimeOffset? GeDate { get; set; }
/// <summary>
/// less or equal then Date
/// </summary>
public DateTimeOffset? LeDate { get; set; }
/// <summary>
/// Делитель для прореживания выборки.
/// <list type="bullet">
/// <item>1 - без прореживания (default); </item>
/// <item>2 - каждое 2-е значение; </item>
/// <item>10 - каждое 10-е значение; </item>
/// </list>
/// </summary>
[Range(0, 300)]
public int Divider { get; set; } = 1;
/// <summary>
/// сортировка/выравнивание данных в запросе по дате
/// <list type="bullet">
/// <item>0 - более ранние данные вперед; </item>
/// <item>1 - более поздние данные вперед; </item>
/// </list>
/// </summary>
[Range(0, 1)]
public int Order { get; set; } = 0;
/// <summary>
/// Пропустить с начала
/// </summary>
[Range(0, int.MaxValue)]
public int Skip { get; set; } = 0;
/// <summary>
/// Кол-во возвращаемых, но не больше MaxTake
/// </summary>
[Range(1, MaxTake)]
public int Take { get; set; } = 1024;
}

View File

@ -0,0 +1,64 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudApp.Services;
/// <summary>
/// Сервис для работы c каталогом инструкций
/// </summary>
public interface IManualCatalogService
{
/// <summary>
/// Сохранение файла
/// </summary>
/// <param name="idDirectory"></param>
/// <param name="idAuthor"></param>
/// <param name="name"></param>
/// <param name="stream"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<int> SaveFileAsync(int idDirectory, int idAuthor, string name, Stream stream, CancellationToken cancellationToken);
/// <summary>
/// Добавление директории
/// </summary>
/// <param name="name"></param>
/// <param name="idParent"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<int> AddDirectoryAsync(string name, int? idParent, CancellationToken cancellationToken);
/// <summary>
/// Обновление директории
/// </summary>
/// <param name="id"></param>
/// <param name="name"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task UpdateDirectoryAsync(int id, string name, CancellationToken cancellationToken);
/// <summary>
/// Удаление директории
/// </summary>
/// <param name="id"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<int> DeleteDirectoryAsync(int id, CancellationToken cancellationToken);
/// <summary>
/// Удаление файла
/// </summary>
/// <param name="id"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<int> DeleteFileAsync(int id, CancellationToken cancellationToken);
/// <summary>
/// Получение файла
/// </summary>
/// <param name="id"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<(Stream stream, string fileName)?> GetFileAsync(int id, CancellationToken cancellationToken);
}

View File

@ -6,9 +6,9 @@ using System.Threading.Tasks;
namespace AsbCloudApp.Services
{
/// <summary>
/// Сервис формирования РТК
/// Сервис РТК
/// </summary>
public interface IProcessMapReportService
public interface IProcessMapService
{
/// <summary>
/// Получение моделей РТК

View File

@ -1,4 +1,5 @@
using AsbCloudApp.Data;
using AsbCloudApp.Requests;
using System;
using System.Collections.Generic;
using System.Threading;
@ -25,6 +26,7 @@ namespace AsbCloudApp.Services
Task<IEnumerable<TDto>> GetAsync(int idWell,
DateTime dateBegin = default, double intervalSec = 600d,
int approxPointsCount = 1024, CancellationToken token = default);
Task<IEnumerable<TDto>> GetAsync(int idWell, TelemetryDataRequest request, CancellationToken token);
/// <summary>
/// Получение статистики за период

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,123 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Update_PlannedTrajectory : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "absolute_mark",
table: "t_planned_trajectory");
migrationBuilder.DropColumn(
name: "angle_intensity",
table: "t_planned_trajectory");
migrationBuilder.DropColumn(
name: "azimuth_intensity",
table: "t_planned_trajectory");
migrationBuilder.DropColumn(
name: "east_cartographic",
table: "t_planned_trajectory");
migrationBuilder.DropColumn(
name: "east_orifice",
table: "t_planned_trajectory");
migrationBuilder.DropColumn(
name: "north_cartographic",
table: "t_planned_trajectory");
migrationBuilder.DropColumn(
name: "north_orifice",
table: "t_planned_trajectory");
migrationBuilder.DropColumn(
name: "orifice_offset",
table: "t_planned_trajectory");
migrationBuilder.DropColumn(
name: "spatial_intensity",
table: "t_planned_trajectory");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<double>(
name: "absolute_mark",
table: "t_planned_trajectory",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Абсолютная отметка");
migrationBuilder.AddColumn<double>(
name: "angle_intensity",
table: "t_planned_trajectory",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Интенсивность по углу");
migrationBuilder.AddColumn<double>(
name: "azimuth_intensity",
table: "t_planned_trajectory",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Интенсивность по азимуту");
migrationBuilder.AddColumn<double>(
name: "east_cartographic",
table: "t_planned_trajectory",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Восток картографический");
migrationBuilder.AddColumn<double>(
name: "east_orifice",
table: "t_planned_trajectory",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Восток отн-но устья");
migrationBuilder.AddColumn<double>(
name: "north_cartographic",
table: "t_planned_trajectory",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Север картографический");
migrationBuilder.AddColumn<double>(
name: "north_orifice",
table: "t_planned_trajectory",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Север отн-но устья");
migrationBuilder.AddColumn<double>(
name: "orifice_offset",
table: "t_planned_trajectory",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Смещение от устья");
migrationBuilder.AddColumn<double>(
name: "spatial_intensity",
table: "t_planned_trajectory",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Пространственная интенсивность");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,148 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Add_Manuals : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "t_manual_directory",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
name = table.Column<string>(type: "text", nullable: false, comment: "Название"),
id_parent = table.Column<int>(type: "integer", nullable: true, comment: "Id родительской директории")
},
constraints: table =>
{
table.PrimaryKey("PK_t_manual_directory", x => x.id);
table.ForeignKey(
name: "FK_t_manual_directory_t_manual_directory_id_parent",
column: x => x.id_parent,
principalTable: "t_manual_directory",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Директория для инструкций");
migrationBuilder.CreateTable(
name: "t_manual",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
name = table.Column<string>(type: "text", nullable: false, comment: "Название"),
date_download = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "Дата загрузки"),
id_directory = table.Column<int>(type: "integer", nullable: false, comment: "Id директории"),
id_category = table.Column<int>(type: "integer", nullable: false, comment: "Id категории файла"),
id_author = table.Column<int>(type: "integer", nullable: false, comment: "Id автора")
},
constraints: table =>
{
table.PrimaryKey("PK_t_manual", x => x.id);
table.ForeignKey(
name: "FK_t_manual_t_file_category_id_category",
column: x => x.id_category,
principalTable: "t_file_category",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_manual_t_manual_directory_id_directory",
column: x => x.id_directory,
principalTable: "t_manual_directory",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_manual_t_user_id_author",
column: x => x.id_author,
principalTable: "t_user",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Инструкции");
migrationBuilder.InsertData(
table: "t_file_category",
columns: new[] { "id", "name", "short_name" },
values: new object[] { 30000, "Инструкции", null });
migrationBuilder.InsertData(
table: "t_permission",
columns: new[] { "id", "description", "name" },
values: new object[,]
{
{ 523, "Разрешить редактирование инструкций", "Manual.edit" },
{ 524, "Разрешить получение инструкций", "Manual.get" }
});
migrationBuilder.InsertData(
table: "t_relation_user_role_permission",
columns: new[] { "id_permission", "id_user_role" },
values: new object[,]
{
{ 523, 1 },
{ 524, 1 }
});
migrationBuilder.CreateIndex(
name: "IX_t_manual_id_author",
table: "t_manual",
column: "id_author");
migrationBuilder.CreateIndex(
name: "IX_t_manual_id_category",
table: "t_manual",
column: "id_category");
migrationBuilder.CreateIndex(
name: "IX_t_manual_id_directory",
table: "t_manual",
column: "id_directory");
migrationBuilder.CreateIndex(
name: "IX_t_manual_directory_id_parent",
table: "t_manual_directory",
column: "id_parent");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_manual");
migrationBuilder.DropTable(
name: "t_manual_directory");
migrationBuilder.DeleteData(
table: "t_file_category",
keyColumn: "id",
keyValue: 30000);
migrationBuilder.DeleteData(
table: "t_relation_user_role_permission",
keyColumns: new[] { "id_permission", "id_user_role" },
keyValues: new object[] { 523, 1 });
migrationBuilder.DeleteData(
table: "t_relation_user_role_permission",
keyColumns: new[] { "id_permission", "id_user_role" },
keyValues: new object[] { 524, 1 });
migrationBuilder.DeleteData(
table: "t_permission",
keyColumn: "id",
keyValue: 523);
migrationBuilder.DeleteData(
table: "t_permission",
keyColumn: "id",
keyValue: 524);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,53 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Add_New_Permissions : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "t_permission",
columns: new[] { "id", "description", "name" },
values: new object[,]
{
{ 525, "Разрешение на редактирование РТК у завершенной скважины", "ProcessMap.editCompletedWell" },
{ 526, "Разрешение на редактирование операций у завершенной скважины", "WellOperation.editCompletedWell" }
});
migrationBuilder.InsertData(
table: "t_relation_user_role_permission",
columns: new[] { "id_permission", "id_user_role" },
values: new object[,]
{
{ 525, 1 },
{ 526, 1 }
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_relation_user_role_permission",
keyColumns: new[] { "id_permission", "id_user_role" },
keyValues: new object[] { 525, 1 });
migrationBuilder.DeleteData(
table: "t_relation_user_role_permission",
keyColumns: new[] { "id_permission", "id_user_role" },
keyValues: new object[] { 526, 1 });
migrationBuilder.DeleteData(
table: "t_permission",
keyColumn: "id",
keyValue: 525);
migrationBuilder.DeleteData(
table: "t_permission",
keyColumn: "id",
keyValue: 526);
}
}
}

View File

@ -785,6 +785,11 @@ namespace AsbCloudDb.Migrations
{
Id = 20000,
Name = "Справки по страницам"
},
new
{
Id = 30000,
Name = "Инструкции"
});
});
@ -1066,6 +1071,83 @@ namespace AsbCloudDb.Migrations
b.HasComment("Ограничения по параметрам телеметрии");
});
modelBuilder.Entity("AsbCloudDb.Model.Manuals.Manual", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<DateTime>("DateDownload")
.HasColumnType("timestamp with time zone")
.HasColumnName("date_download")
.HasComment("Дата загрузки");
b.Property<int>("IdAuthor")
.HasColumnType("integer")
.HasColumnName("id_author")
.HasComment("Id автора");
b.Property<int>("IdCategory")
.HasColumnType("integer")
.HasColumnName("id_category")
.HasComment("Id категории файла");
b.Property<int>("IdDirectory")
.HasColumnType("integer")
.HasColumnName("id_directory")
.HasComment("Id директории");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text")
.HasColumnName("name")
.HasComment("Название");
b.HasKey("Id");
b.HasIndex("IdAuthor");
b.HasIndex("IdCategory");
b.HasIndex("IdDirectory");
b.ToTable("t_manual");
b.HasComment("Инструкции");
});
modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualDirectory", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("IdParent")
.HasColumnType("integer")
.HasColumnName("id_parent")
.HasComment("Id родительской директории");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text")
.HasColumnName("name")
.HasComment("Название");
b.HasKey("Id");
b.HasIndex("IdParent");
b.ToTable("t_manual_directory");
b.HasComment("Директория для инструкций");
});
modelBuilder.Entity("AsbCloudDb.Model.Measure", b =>
{
b.Property<int>("Id")
@ -2163,6 +2245,30 @@ namespace AsbCloudDb.Migrations
Id = 522,
Description = "Разрешить удаление всех настроек пользователя",
Name = "UserSettings.delete"
},
new
{
Id = 523,
Description = "Разрешить редактирование инструкций",
Name = "Manual.edit"
},
new
{
Id = 524,
Description = "Разрешить получение инструкций",
Name = "Manual.get"
},
new
{
Id = 525,
Description = "Разрешение на редактирование РТК у завершенной скважины",
Name = "ProcessMap.editCompletedWell"
},
new
{
Id = 526,
Description = "Разрешение на редактирование операций у завершенной скважины",
Name = "WellOperation.editCompletedWell"
});
});
@ -2175,26 +2281,11 @@ namespace AsbCloudDb.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<double>("AbsoluteMark")
.HasColumnType("double precision")
.HasColumnName("absolute_mark")
.HasComment("Абсолютная отметка");
b.Property<double>("AngleIntensity")
.HasColumnType("double precision")
.HasColumnName("angle_intensity")
.HasComment("Интенсивность по углу");
b.Property<double>("AzimuthGeo")
.HasColumnType("double precision")
.HasColumnName("azimuth_geo")
.HasComment("Азимут Географ.");
b.Property<double>("AzimuthIntensity")
.HasColumnType("double precision")
.HasColumnName("azimuth_intensity")
.HasComment("Интенсивность по азимуту");
b.Property<double>("AzimuthMagnetic")
.HasColumnType("double precision")
.HasColumnName("azimuth_magnetic")
@ -2205,16 +2296,6 @@ namespace AsbCloudDb.Migrations
.HasColumnName("comment")
.HasComment("Комментарии");
b.Property<double>("EastCartographic")
.HasColumnType("double precision")
.HasColumnName("east_cartographic")
.HasComment("Восток картографический");
b.Property<double>("EastOrifice")
.HasColumnType("double precision")
.HasColumnName("east_orifice")
.HasComment("Восток отн-но устья");
b.Property<int>("IdUser")
.HasColumnType("integer")
.HasColumnName("id_user")
@ -2225,31 +2306,11 @@ namespace AsbCloudDb.Migrations
.HasColumnName("id_well")
.HasComment("ID скважины");
b.Property<double>("NorthCartographic")
.HasColumnType("double precision")
.HasColumnName("north_cartographic")
.HasComment("Север картографический");
b.Property<double>("NorthOrifice")
.HasColumnType("double precision")
.HasColumnName("north_orifice")
.HasComment("Север отн-но устья");
b.Property<double>("OrificeOffset")
.HasColumnType("double precision")
.HasColumnName("orifice_offset")
.HasComment("Смещение от устья");
b.Property<double?>("Radius")
.HasColumnType("double precision")
.HasColumnName("radius")
.HasComment("Радиус цели");
b.Property<double>("SpatialIntensity")
.HasColumnType("double precision")
.HasColumnName("spatial_intensity")
.HasComment("Пространственная интенсивность");
b.Property<DateTimeOffset>("UpdateDate")
.HasColumnType("timestamp with time zone")
.HasColumnName("update_date")
@ -3750,6 +3811,26 @@ namespace AsbCloudDb.Migrations
{
IdUserRole = 1,
IdPermission = 522
},
new
{
IdUserRole = 1,
IdPermission = 523
},
new
{
IdUserRole = 1,
IdPermission = 524
},
new
{
IdUserRole = 1,
IdPermission = 525
},
new
{
IdUserRole = 1,
IdPermission = 526
});
});
@ -7694,6 +7775,43 @@ namespace AsbCloudDb.Migrations
b.Navigation("Telemetry");
});
modelBuilder.Entity("AsbCloudDb.Model.Manuals.Manual", b =>
{
b.HasOne("AsbCloudDb.Model.User", "Author")
.WithMany()
.HasForeignKey("IdAuthor")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("AsbCloudDb.Model.FileCategory", "Category")
.WithMany()
.HasForeignKey("IdCategory")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("AsbCloudDb.Model.Manuals.ManualDirectory", "Directory")
.WithMany("Manuals")
.HasForeignKey("IdDirectory")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Author");
b.Navigation("Category");
b.Navigation("Directory");
});
modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualDirectory", b =>
{
b.HasOne("AsbCloudDb.Model.Manuals.ManualDirectory", "Parent")
.WithMany("Children")
.HasForeignKey("IdParent")
.OnDelete(DeleteBehavior.Cascade);
b.Navigation("Parent");
});
modelBuilder.Entity("AsbCloudDb.Model.Measure", b =>
{
b.HasOne("AsbCloudDb.Model.MeasureCategory", "Category")
@ -8319,6 +8437,13 @@ namespace AsbCloudDb.Migrations
b.Navigation("FileMarks");
});
modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualDirectory", b =>
{
b.Navigation("Children");
b.Navigation("Manuals");
});
modelBuilder.Entity("AsbCloudDb.Model.MeasureCategory", b =>
{
b.Navigation("Measures");

View File

@ -3,6 +3,7 @@ using AsbCloudDb.Model.Subsystems;
using Microsoft.EntityFrameworkCore;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudDb.Model.Manuals;
namespace AsbCloudDb.Model
{
@ -77,6 +78,9 @@ namespace AsbCloudDb.Model
public DbSet<HelpPage> HelpPages => Set<HelpPage>();
public DbSet<Notification> Notifications => Set<Notification>();
public DbSet<NotificationCategory> NotificationCategories => Set<NotificationCategory>();
public DbSet<Manual> Manuals => Set<Manual>();
public DbSet<ManualDirectory> ManualDirectories => Set<ManualDirectory>();
public AsbCloudDbContext() : base()
{
@ -388,6 +392,18 @@ namespace AsbCloudDb.Model
entity.HasKey(x => new { x.IdWell, x.IdUser });
});
modelBuilder.Entity<ManualDirectory>()
.HasOne(mf => mf.Parent)
.WithMany(mf => mf.Children)
.HasForeignKey(mf => mf.IdParent)
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<Manual>()
.HasOne(m => m.Directory)
.WithMany(f => f.Manuals)
.HasForeignKey(m => m.IdDirectory)
.OnDelete(DeleteBehavior.Cascade);
DefaultData.DefaultContextData.Fill(modelBuilder);
}

View File

@ -73,7 +73,9 @@
new () {Id = 10042, Name = "Паспорт скважины (заполняется геологами)"},
new () {Id = 10043, Name = "Фактические данные бурения (вставляются в паспорт скважины)"},
new () {Id = 20000, Name = "Справки по страницам"}
new () {Id = 20000, Name = "Справки по страницам"},
new() { Id = 30000, Name = "Инструкции"},
};
}
}

View File

@ -156,6 +156,12 @@
new() { Id = 521, Name = "HelpPage.edit", Description = "Разрешить создание справок по страницам"},
new() { Id = 522, Name = "UserSettings.delete", Description = "Разрешить удаление всех настроек пользователя"},
new() { Id = 523, Name = "Manual.edit", Description = "Разрешить редактирование инструкций" },
new() { Id = 524, Name = "Manual.get", Description = "Разрешить получение инструкций"},
new (){ Id = 525, Name = "ProcessMap.editCompletedWell", Description = "Разрешение на редактирование РТК у завершенной скважины"},
new (){ Id = 526, Name = "WellOperation.editCompletedWell", Description = "Разрешение на редактирование операций у завершенной скважины"}
};
}
}

View File

@ -58,7 +58,6 @@ namespace AsbCloudDb.Model.DefaultData
new (){ IdUserRole = 2005, IdPermission = 247}, new (){ IdUserRole = 2005, IdPermission = 205}, new (){ IdUserRole = 2005, IdPermission = 204},
new (){ IdUserRole = 2006, IdPermission = 243}, new (){ IdUserRole = 2006, IdPermission = 205}, new (){ IdUserRole = 2006, IdPermission = 204},
new (){ IdUserRole = 2007, IdPermission = 241}, new (){ IdUserRole = 2007, IdPermission = 205}, new (){ IdUserRole = 2007, IdPermission = 204},
//new (){ IdUserRole = 1, IdPermission = 500}, new (){ IdUserRole = 1, IdPermission = 501}, new (){ IdUserRole = 1, IdPermission = 502}, new (){ IdUserRole = 1, IdPermission = 503}, new (){ IdUserRole = 1, IdPermission = 504}, new (){ IdUserRole = 1, IdPermission = 505}, new (){ IdUserRole = 1, IdPermission = 506}, new (){ IdUserRole = 1, IdPermission = 510}, new (){ IdUserRole = 1, IdPermission = 511}, new (){ IdUserRole = 1, IdPermission = 512}, new (){ IdUserRole = 1, IdPermission = 513}, new (){ IdUserRole = 1, IdPermission = 514}, new (){ IdUserRole = 1, IdPermission = 515},
};
var allPermissions = (new EntityFillerPermission()).GetData();
foreach ( var permission in allPermissions)

View File

@ -7,6 +7,7 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using System;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudDb.Model.Manuals;
namespace AsbCloudDb.Model
{
@ -70,6 +71,8 @@ namespace AsbCloudDb.Model
DbSet<HelpPage> HelpPages { get; }
DbSet<Notification> Notifications { get; }
DbSet<NotificationCategory> NotificationCategories { get; }
DbSet<Manual> Manuals { get; }
DbSet<ManualDirectory> ManualDirectories { get; }
DatabaseFacade Database { get; }
Task<int> RefreshMaterializedViewAsync(string mwName, CancellationToken token);

View File

@ -0,0 +1,38 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace AsbCloudDb.Model.Manuals;
[Table("t_manual"), Comment("Инструкции")]
public class Manual : IId
{
[Key]
[Column("id")]
public int Id { get; set; }
[Column("name"), Comment("Название")]
public string Name { get; set; } = null!;
[Column("date_download"), Comment("Дата загрузки")]
public DateTime DateDownload { get; set; }
[Column("id_directory"), Comment("Id директории")]
public int IdDirectory { get; set; }
[Column("id_category"), Comment("Id категории файла")]
public int IdCategory { get; set; }
[Column("id_author"), Comment("Id автора")]
public int IdAuthor { get; set; }
[ForeignKey(nameof(IdDirectory))]
public virtual ManualDirectory Directory { get; set; } = null!;
[ForeignKey(nameof(IdCategory))]
public virtual FileCategory Category { get; set; } = null!;
[ForeignKey(nameof(IdAuthor))]
public virtual User Author { get; set; } = null!;
}

View File

@ -0,0 +1,27 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace AsbCloudDb.Model.Manuals;
[Table("t_manual_directory"), Comment("Директория для инструкций")]
public class ManualDirectory : IId
{
[Key]
[Column("id")]
public int Id { get; set; }
[Column("name"), Comment("Название")]
public string Name { get; set; } = null!;
[Column("id_parent"), Comment("Id родительской директории")]
public int? IdParent { get; set; }
[ForeignKey(nameof(IdParent))]
public virtual ManualDirectory? Parent { get; set; }
public virtual ICollection<ManualDirectory>? Children { get; set; }
public virtual ICollection<Manual>? Manuals { get; set; }
}

View File

@ -35,33 +35,6 @@ namespace AsbCloudDb.Model
[Column("vertical_depth"), Comment("Глубина вертикальная")]
public double VerticalDepth { get; set; }
[Column("absolute_mark"), Comment("Абсолютная отметка")]
public double AbsoluteMark { get; set; }
[Column("north_orifice"), Comment("Север отн-но устья")]
public double NorthOrifice { get; set; }
[Column("east_orifice"), Comment("Восток отн-но устья")]
public double EastOrifice { get; set; }
[Column("east_cartographic"), Comment("Восток картографический")]
public double EastCartographic { get; set; }
[Column("north_cartographic"), Comment("Север картографический")]
public double NorthCartographic { get; set; }
[Column("spatial_intensity"), Comment("Пространственная интенсивность")]
public double SpatialIntensity { get; set; }
[Column("angle_intensity"), Comment("Интенсивность по углу")]
public double AngleIntensity { get; set; }
[Column("azimuth_intensity"), Comment("Интенсивность по азимуту")]
public double AzimuthIntensity { get; set; }
[Column("orifice_offset"), Comment("Смещение от устья")]
public double OrificeOffset { get; set; }
[Column("comment"), Comment("Комментарии")]
public string? Comment { get; set; }

View File

@ -23,8 +23,10 @@ using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
using AsbCloudApp.Data.Manuals;
using AsbCloudApp.Services.AutoGeneratedDailyReports;
using AsbCloudApp.Services.Notifications;
using AsbCloudDb.Model.Manuals;
using AsbCloudInfrastructure.Services.AutoGeneratedDailyReports;
namespace AsbCloudInfrastructure
@ -144,7 +146,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<IFileCategoryService, FileCategoryService>();
services.AddTransient<ILimitingParameterService, LimitingParameterService>();
services.AddTransient<IProcessMapReportMakerService, ProcessMapReportMakerService>();
services.AddTransient<IProcessMapReportService, ProcessMapReportService>();
services.AddTransient<IProcessMapService, ProcessMapService>();
services.AddTransient<WellInfoService>();
services.AddTransient<IHelpPageService, HelpPageService>();
@ -222,6 +224,10 @@ namespace AsbCloudInfrastructure
services.AddTransient<IAutoGeneratedDailyReportService, AutoGeneratedDailyReportService>();
services.AddTransient<IAutoGeneratedDailyReportMakerService, AutoGeneratedDailyReportMakerService>();
services.AddTransient<IManualDirectoryRepository, ManualDirectoryRepository>();
services.AddTransient<IManualCatalogService, ManualCatalogService>();
services.AddTransient<ICrudRepository<ManualDto>, CrudRepositoryBase<ManualDto, Manual>>();
services.AddTransient<IWellboreService, WellboreService>();
return services;

View File

@ -1,4 +1,5 @@
using AsbCloudApp.Data;
using System;
using AsbCloudApp.Data;
using AsbCloudApp.Repositories;
using System.Collections.Generic;
using System.IO;
@ -34,6 +35,23 @@ public class FileStorageRepository : IFileStorageRepository
}
}
public void DeleteDirectory(string path, bool isRecursive)
{
if (!Directory.Exists(path))
return;
if (!isRecursive)
{
var files = Directory.GetFiles(path);
var directories = Directory.GetDirectories(path);
if (files.Length != 0 || directories.Length != 0)
throw new InvalidOperationException("Директория не пуста и не может быть удалена");
}
Directory.Delete(path, isRecursive);
}
public void DeleteFile(string fileName)
{
if (File.Exists(fileName))

View File

@ -0,0 +1,62 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Data.Manuals;
using AsbCloudApp.Repositories;
using AsbCloudDb.Model;
using AsbCloudDb.Model.Manuals;
using Mapster;
using Microsoft.EntityFrameworkCore;
namespace AsbCloudInfrastructure.Repository;
public class ManualDirectoryRepository : CrudRepositoryBase<ManualDirectoryDto, ManualDirectory>, IManualDirectoryRepository
{
public ManualDirectoryRepository(IAsbCloudDbContext context) : base(context)
{
}
public async Task<IEnumerable<ManualDirectoryDto>> GetTreeAsync(CancellationToken cancellationToken)
{
var directories = await dbContext.ManualDirectories
.Include(m => m.Manuals)
.Include(m => m.Parent)
.AsNoTracking()
.ToArrayAsync(cancellationToken);
return BuildTree(directories).Select(x => x.Adapt<ManualDirectoryDto>());
}
public async Task<ManualDirectoryDto?> GetOrDefaultAsync(string name, int? idParent, CancellationToken cancellationToken)
{
var entity = await dbContext.ManualDirectories
.AsNoTracking()
.FirstOrDefaultAsync(m => m.Name == name &&
m.IdParent == idParent, cancellationToken);
if (entity is null)
return null;
return Convert(entity);
}
public Task<bool> IsExistsAsync(int id, CancellationToken cancellationToken) =>
dbContext.ManualDirectories.AnyAsync(d => d.Id == id, cancellationToken);
private static IEnumerable<ManualDirectory> BuildTree(IEnumerable<ManualDirectory> directories)
{
var directoryDict = directories.ToDictionary(f => f.Id);
foreach (var directory in directories)
{
if (directory.IdParent.HasValue && directoryDict.TryGetValue(directory.IdParent.Value, out var parent))
{
parent.Children ??= new List<ManualDirectory>();
parent.Children.Add(directory);
}
}
return directories.Where(f => f.IdParent == null);
}
}

View File

@ -41,8 +41,6 @@ namespace AsbCloudInfrastructure.Repository
IdWell = idWell,
AzimuthMagnetic = coord.Svymtf,
VerticalDepth = coord.Deptsvyv,
NorthOrifice = coord.Svyns,
EastOrifice = coord.Svyew,
WellboreDepth = coord.Deptsvym!.Value,
ZenithAngle = coord.Svyinc!.Value,
AzimuthGeo = coord.Svyazc!.Value

View File

@ -67,8 +67,6 @@ public class AutoGeneratedDailyReportService : IAutoGeneratedDailyReportService
if (datesRange is null)
return result;
result.Count = (int)(Math.Ceiling((datesRange.To - DateTime.UnixEpoch).TotalDays) - Math.Floor((datesRange.From - DateTime.UnixEpoch).TotalDays));
if (request.StartDate.HasValue)
{
var startDate = new DateTime(request.StartDate.Value.Year, request.StartDate.Value.Month,
@ -87,6 +85,9 @@ public class AutoGeneratedDailyReportService : IAutoGeneratedDailyReportService
datesRange.To = finishDate;
}
if (datesRange.From.AddDays(result.Skip) <= datesRange.To)
result.Count = (int)(Math.Ceiling((datesRange.To - DateTime.UnixEpoch).TotalDays) - Math.Floor((datesRange.From - DateTime.UnixEpoch).TotalDays));
for (int day = result.Skip; (day - result.Skip) < result.Take && (datesRange.From.AddDays(day)) <= datesRange.To; day++)
{
var reportDate = DateOnly.FromDateTime(datesRange.From.AddDays(day));
@ -149,8 +150,8 @@ public class AutoGeneratedDailyReportService : IAutoGeneratedDailyReportService
return new DatesRangeDto
{
From = factOperations.Min(o => o.DateStart),
To = factOperations.Max(o => o.DateStart)
From = factOperations.Min(o => o.DateStart).Date,
To = factOperations.Max(o => o.DateStart).Date
};
}

View File

@ -0,0 +1,180 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Data.Manuals;
using AsbCloudApp.Exceptions;
using AsbCloudApp.Repositories;
using AsbCloudApp.Services;
using Microsoft.Extensions.Configuration;
namespace AsbCloudInfrastructure.Services;
public class ManualCatalogService : IManualCatalogService
{
private const int IdFileCategory = 30000;
private readonly IEnumerable<string> validExtensions = new[]
{
".pdf",
".mp4"
};
private readonly string directoryFiles;
private readonly IFileStorageRepository fileStorageRepository;
private readonly IManualDirectoryRepository manualDirectoryRepository;
private readonly ICrudRepository<ManualDto> manualRepository;
public ManualCatalogService(IFileStorageRepository fileStorageRepository,
IManualDirectoryRepository manualDirectoryRepository,
ICrudRepository<ManualDto> manualRepository,
IConfiguration configuration)
{
this.fileStorageRepository = fileStorageRepository;
this.manualDirectoryRepository = manualDirectoryRepository;
this.manualRepository = manualRepository;
directoryFiles = configuration.GetValue<string>("DirectoryManualFiles");
if (string.IsNullOrWhiteSpace(directoryFiles))
directoryFiles = "manuals";
}
public async Task<int> SaveFileAsync(int idDirectory, int idAuthor, string name, Stream stream, CancellationToken cancellationToken)
{
var extension = Path.GetExtension(name);
if (!validExtensions.Contains(extension))
throw new ArgumentInvalidException(
$"Невозможно загрузить файл с расширением '{extension}'. Допустимые форматы файлов: {string.Join(", ", validExtensions)}",
extension);
var path = await BuildFilePathAsync(idDirectory, name, cancellationToken);
await fileStorageRepository.SaveFileAsync(path, stream, cancellationToken);
var manual = new ManualDto
{
Name = name,
DateDownload = DateTime.UtcNow,
IdDirectory = idDirectory,
IdCategory = IdFileCategory,
IdAuthor = idAuthor
};
return await manualRepository.InsertAsync(manual, cancellationToken);
}
public async Task<int> AddDirectoryAsync(string name, int? idParent, CancellationToken cancellationToken)
{
if (idParent.HasValue && !await manualDirectoryRepository.IsExistsAsync(idParent.Value, cancellationToken))
throw new ArgumentInvalidException("Родительской директории не существует", nameof(idParent));
var directory = new ManualDirectoryDto
{
Name = name,
IdParent = idParent,
};
if (await IsExistDirectoryAsync(directory, cancellationToken))
throw new ArgumentInvalidException("Директория с таким названием уже существует", name);
return await manualDirectoryRepository.InsertAsync(directory, cancellationToken);
}
public async Task UpdateDirectoryAsync(int id, string name, CancellationToken cancellationToken)
{
var directory = await manualDirectoryRepository.GetOrDefaultAsync(id, cancellationToken)
?? throw new ArgumentInvalidException($"Директории с Id: {id} не существует", nameof(id));
directory.Name = name;
if (await IsExistDirectoryAsync(directory, cancellationToken))
throw new ArgumentInvalidException("Директория с таким названием уже существует", name);
await manualDirectoryRepository.UpdateAsync(directory, cancellationToken);
}
public async Task<int> DeleteDirectoryAsync(int id, CancellationToken cancellationToken)
{
var directory = await manualDirectoryRepository.GetOrDefaultAsync(id, cancellationToken);
if (directory is null)
return 0;
var path = fileStorageRepository.MakeFilePath(directoryFiles, IdFileCategory.ToString(),
await BuildDirectoryPathAsync(id, cancellationToken));
try
{
fileStorageRepository.DeleteDirectory(path, true);
}
catch (InvalidOperationException ex)
{
throw new ArgumentInvalidException(ex.Message, nameof(id));
}
return await manualDirectoryRepository.DeleteAsync(directory.Id, cancellationToken);
}
public async Task<int> DeleteFileAsync(int id, CancellationToken cancellationToken)
{
var manual = await manualRepository.GetOrDefaultAsync(id, cancellationToken);
if (manual is null)
return 0;
var filePath = await BuildFilePathAsync(manual.IdDirectory, manual.Name, cancellationToken);
fileStorageRepository.DeleteFile(filePath);
return await manualRepository.DeleteAsync(manual.Id, cancellationToken);
}
public async Task<(Stream stream, string fileName)?> GetFileAsync(int id, CancellationToken cancellationToken)
{
var manual = await manualRepository.GetOrDefaultAsync(id, cancellationToken);
if (manual is null)
return null;
var path = await BuildFilePathAsync(manual.IdDirectory, manual.Name, cancellationToken);
var fileStream = new FileStream(path, FileMode.Open);
return (fileStream, manual.Name);
}
private async Task<bool> IsExistDirectoryAsync(ManualDirectoryDto directory, CancellationToken cancellationToken)
{
var existingDirectory = await manualDirectoryRepository.GetOrDefaultAsync(directory.Name, directory.IdParent,
cancellationToken);
return existingDirectory is not null && directory.Id != existingDirectory.Id;
}
private async Task<string> BuildDirectoryPathAsync(int idDirectory, CancellationToken cancellationToken)
{
var directiories = await manualDirectoryRepository.GetAllAsync(cancellationToken);
var directory = directiories.FirstOrDefault(d => d.Id == idDirectory)
?? throw new ArgumentInvalidException($"Директории с Id: {idDirectory} не существует", nameof(idDirectory));
var pathSegments = new List<int> { directory.Id };
while (directory.IdParent.HasValue)
{
directory = directiories.FirstOrDefault(d => d.Id == directory.IdParent.Value);
pathSegments.Insert(0, directory.Id);
}
return string.Join("/", pathSegments);
}
private async Task<string> BuildFilePathAsync(int idDirectory, string name, CancellationToken cancellationToken)
{
var directoryPath = await BuildDirectoryPathAsync(idDirectory, cancellationToken);
return fileStorageRepository.MakeFilePath(directoryFiles, IdFileCategory.ToString(), Path.Combine(directoryPath, name));
}
}

View File

@ -13,13 +13,13 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
public class ProcessMapReportMakerService : IProcessMapReportMakerService
{
const int firstColumn = 2;
const int lastColumn = 49;
const int lastColumn = 42;
const int headerRowsCount = 5;
private readonly IProcessMapReportService processMapService;
private readonly IProcessMapService processMapService;
public ProcessMapReportMakerService(IProcessMapReportService processMapService)
public ProcessMapReportMakerService(IProcessMapService processMapService)
{
this.processMapService = processMapService;
}

View File

@ -12,14 +12,14 @@ using System.Threading.Tasks;
namespace AsbCloudInfrastructure.Services.ProcessMap
{
public partial class ProcessMapReportService : IProcessMapReportService
public partial class ProcessMapService : IProcessMapService
{
private readonly IWellService wellService;
private readonly IWellOperationRepository wellOperationRepository;
private readonly IProcessMapPlanRepository processMapPlanRepository;
private readonly ITelemetryDataSaubService telemetryDataSaubService;
public ProcessMapReportService(
public ProcessMapService(
IWellService wellService,
IWellOperationRepository wellOperationRepository,
IProcessMapPlanRepository processMapPlanRepository,

View File

@ -1,4 +1,5 @@
using AsbCloudApp.Data;
using AsbCloudApp.Exceptions;
using AsbCloudApp.Services;
using AsbCloudDb;
using AsbCloudDb.Model;
@ -137,10 +138,67 @@ namespace AsbCloudInfrastructure.Services.SAUB
}
var entities = await query
.OrderBy(d => d.DateTime)
.AsNoTracking()
.ToListAsync(token)
.ConfigureAwait(false);
.ToArrayAsync(token);
var dtos = entities.Select(e => Convert(e, timezone.Hours));
return dtos;
}
/// <inheritdoc/>
public virtual async Task<IEnumerable<TDto>> GetAsync(int idWell, AsbCloudApp.Requests.TelemetryDataRequest request, CancellationToken token)
{
var telemetry = telemetryService.GetOrDefaultTelemetryByIdWell(idWell);
if (telemetry is null)
return Enumerable.Empty<TDto>();
var timezone = telemetryService.GetTimezone(telemetry.Id);
var cache = telemetryDataCache.GetOrDefault(telemetry.Id, request);
if(cache is not null)
return cache;
var dbSet = db.Set<TEntity>();
var query = dbSet
.Where(d => d.IdTelemetry == telemetry.Id)
.AsNoTracking();
if (request.GeDate.HasValue)
{
var geDate = request.GeDate.Value.UtcDateTime;
query = query.Where(d => d.DateTime >= geDate);
}
if (request.LeDate.HasValue)
{
var leDate = request.LeDate.Value.UtcDateTime;
query = query.Where(d => d.DateTime <= leDate);
}
if (request.Divider > 1)
query = query.Where((d) => (((d.DateTime.DayOfYear * 24 + d.DateTime.Hour) * 60 + d.DateTime.Minute) * 60 + d.DateTime.Second) % request.Divider == 0);
switch (request.Order)
{
case 1:// Поздние вперед
query = query
.OrderByDescending(d => d.DateTime)
.Skip(request.Skip)
.Take(request.Take)
.OrderBy(d => d.DateTime);
break;
default:// Ранние вперед
query = query
.OrderBy(d => d.DateTime)
.Skip(request.Skip)
.Take(request.Take);
break;
}
var entities = await query
.ToArrayAsync(token);
var dtos = entities.Select(e => Convert(e, timezone.Hours));

View File

@ -11,6 +11,7 @@ using Microsoft.Extensions.DependencyInjection;
using AsbCloudInfrastructure.Background;
using System.Threading;
using AsbCloudApp.Data;
using AsbCloudApp.Requests;
namespace AsbCloudInfrastructure.Services.SAUB
{
@ -21,6 +22,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
{
public TDto? FirstByDate { get; init; }
public CyclycArray<TDto> LastData { get; init; } = null!;
public double TimezoneHours { get; init; } = 5;
}
private IServiceProvider provider = null!;
@ -225,8 +227,62 @@ namespace AsbCloudInfrastructure.Services.SAUB
{
FirstByDate = first,
LastData = cacheItem,
TimezoneHours = hoursOffset,
};
return item;
}
public IEnumerable<TDto>? GetOrDefault(int idTelemetry, TelemetryDataRequest request)
{
if (!caches.TryGetValue(idTelemetry, out TelemetryDataCacheItem? cacheItem))
return null;
IEnumerable<TDto> data = cacheItem.LastData;
if (!data.Any())
return null;
if (request.GeDate.HasValue)
{
var geDate = request.GeDate.Value.ToRemoteDateTime(cacheItem.TimezoneHours);
if (data.First().DateTime > geDate)
return null;
data = data.Where(d => d.DateTime >= geDate);
}
else
{
if (request.Order == 0)
return null;
}
if (request.LeDate.HasValue)
{
var leDate = request.LeDate.Value.ToRemoteDateTime(cacheItem.TimezoneHours);
data = data.Where(d => d.DateTime >= request.LeDate);
}
if (request.Divider > 1)
data = data.Where((d) => (((d.DateTime.DayOfYear * 24 + d.DateTime.Hour) * 60 + d.DateTime.Minute) * 60 + d.DateTime.Second) % request.Divider == 0);
switch (request.Order)
{
case 1: // Поздние вперед
data = data
.OrderByDescending(d => d.DateTime)
.Skip(request.Skip)
.Take(request.Take)
.OrderBy(d => d.DateTime);
break;
default: // Ранние вперед
data = data
.OrderBy(d => d.DateTime)
.Skip(request.Skip)
.Take(request.Take);
break;
}
return data;
}
}
}

View File

@ -30,16 +30,8 @@ namespace AsbCloudInfrastructure.Services.Trajectory
private const int ColumnAzimuthGeo = 3;
private const int ColumnAzimuthMagnetic = 4;
private const int ColumnVerticalDepth = 5;
private const int ColumnAbsoluteMark = 6;
private const int ColumnNorthOrifice = 7;
private const int ColumnEastOrifice = 8;
private const int ColumnEastCartographic = 9;
private const int ColumnNorthCartographic = 10;
private const int ColumnSpatialIntensity = 11;
private const int ColumnAngleIntensity = 12;
private const int ColumnAzimuthIntensity = 13;
private const int ColumnOrificeOffset = 14;
private const int ColumnComment = 15;
private const int ColumnRadius = 6;
private const int ColumnComment = 7;
public PlannedTrajectoryImportService(IWellService wellService, ITrajectoryPlanRepository plannedTrajectoryService)
{
@ -107,15 +99,7 @@ namespace AsbCloudInfrastructure.Services.Trajectory
row.Cell(ColumnAzimuthGeo).Value = trajectory.AzimuthGeo;
row.Cell(ColumnAzimuthMagnetic).Value = trajectory.AzimuthMagnetic;
row.Cell(ColumnVerticalDepth).Value = trajectory.VerticalDepth;
row.Cell(ColumnAbsoluteMark).Value = trajectory.AbsoluteMark;
row.Cell(ColumnNorthOrifice).Value = trajectory.NorthOrifice;
row.Cell(ColumnEastOrifice).Value = trajectory.EastOrifice;
row.Cell(ColumnEastCartographic).Value = trajectory.EastCartographic;
row.Cell(ColumnNorthCartographic).Value = trajectory.NorthCartographic;
row.Cell(ColumnSpatialIntensity).Value = trajectory.SpatialIntensity;
row.Cell(ColumnAngleIntensity).Value = trajectory.AngleIntensity;
row.Cell(ColumnAzimuthIntensity).Value = trajectory.AzimuthIntensity;
row.Cell(ColumnOrificeOffset).Value = trajectory.OrificeOffset;
row.Cell(ColumnRadius).Value = trajectory.Radius;
row.Cell(ColumnComment).Value = trajectory.Comment;
}
@ -158,7 +142,7 @@ namespace AsbCloudInfrastructure.Services.Trajectory
private IEnumerable<TrajectoryGeoPlanDto> ParseSheet(IXLWorksheet sheet)
{
if (sheet.RangeUsed().RangeAddress.LastAddress.ColumnNumber < 15)
if (sheet.RangeUsed().RangeAddress.LastAddress.ColumnNumber < 7)
throw new FileFormatException($"Лист {sheet.Name} содержит меньшее количество столбцов.");
var count = sheet.RowsUsed().Count() - headerRowsCount;
@ -194,15 +178,7 @@ namespace AsbCloudInfrastructure.Services.Trajectory
var _azimuthGeo = row.Cell(ColumnAzimuthGeo).Value;
var _azimuthMagnetic = row.Cell(ColumnAzimuthMagnetic).Value;
var _verticalDepth = row.Cell(ColumnVerticalDepth).Value;
var _absoluteMark = row.Cell(ColumnAbsoluteMark).Value;
var _northOrifice = row.Cell(ColumnNorthOrifice).Value;
var _eastOrifice = row.Cell(ColumnEastOrifice).Value;
var _eastCartographic = row.Cell(ColumnEastCartographic).Value;
var _northCartographic = row.Cell(ColumnNorthCartographic).Value;
var _spatialIntensity = row.Cell(ColumnSpatialIntensity).Value;
var _angleIntensity = row.Cell(ColumnAngleIntensity).Value;
var _azimuthIntensity = row.Cell(ColumnAzimuthIntensity).Value;
var _orificeOffset = row.Cell(ColumnOrificeOffset).Value;
var _radius = row.Cell(ColumnRadius).Value;
var _comment = row.Cell(ColumnComment).Value;
var trajectoryRow = new TrajectoryGeoPlanDto();
@ -219,15 +195,8 @@ namespace AsbCloudInfrastructure.Services.Trajectory
trajectoryRow.AzimuthGeo = getDoubleValue(_azimuthGeo, "Азимут географический", row);
trajectoryRow.AzimuthMagnetic = getDoubleValue(_azimuthMagnetic, "Азимут магнитный", row);
trajectoryRow.VerticalDepth = getDoubleValue(_verticalDepth, "Глубина вертикальная", row);
trajectoryRow.AbsoluteMark = getDoubleValue(_absoluteMark, "Абсолютная отметка", row);
trajectoryRow.NorthOrifice = getDoubleValue(_northOrifice, "Север относительно устья", row);
trajectoryRow.EastOrifice = getDoubleValue(_eastOrifice, "Восток относительно устья", row);
trajectoryRow.EastCartographic = getDoubleValue(_eastCartographic, "Восток картографический", row);
trajectoryRow.NorthCartographic = getDoubleValue(_northCartographic, "Север картографический", row);
trajectoryRow.SpatialIntensity = getDoubleValue(_spatialIntensity, "Простр. интенсивность", row);
trajectoryRow.AngleIntensity = getDoubleValue(_angleIntensity, "Интенсивность по углу", row);
trajectoryRow.AzimuthIntensity = getDoubleValue(_azimuthIntensity, "Интенсивность по азимуту", row);
trajectoryRow.OrificeOffset = getDoubleValue(_orificeOffset, "Смещение от устья", row);
trajectoryRow.Radius = getDoubleValue(_radius, "Радиус цели", row);
if (_comment is not null)
trajectoryRow.Comment = _comment.ToString();
return trajectoryRow;

View File

@ -29,7 +29,10 @@ namespace AsbCloudInfrastructure.Services
{
Caption = c.Caption,
Id = c.Id,
Users = c.Users.Select(u => new UserContactDto()
Users = c.Users
.Where(u => u.IdState == 1)
.OrderBy(u => u.Surname)
.Select(u => new UserContactDto()
{
Id = u.Id,
Name = u.Name,

View File

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
@ -58,8 +59,8 @@ public class WellboreService : IWellboreService
Id = group.Key,
Name = sections[group.Key].Caption,
Well = well.Adapt<WellWithTimezoneDto>(),
DateStart = group.Min(operation => operation.DateStart),
DateEnd = group.Max(operation => operation.DateStart.AddHours(operation.DurationHours)),
DateStart = group.Min(operation => operation.DateStart).ToUtcDateTimeOffset(well.Timezone.Hours).ToOffset(TimeSpan.FromHours(well.Timezone.Hours)),
DateEnd = group.Max(operation => operation.DateStart.AddHours(operation.DurationHours)).ToUtcDateTimeOffset(well.Timezone.Hours).ToOffset(TimeSpan.FromHours(well.Timezone.Hours)),
DepthStart = group.Min(operation => operation.DepthStart),
DepthEnd = group.Max(operation => operation.DepthEnd),
});

View File

@ -0,0 +1,105 @@
using System.ComponentModel.DataAnnotations;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Exceptions;
using AsbCloudApp.Repositories;
using AsbCloudApp.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace AsbCloudWebApi.Controllers;
[ApiController]
[Route("api/[controller]")]
[Authorize]
public class ManualController : ControllerBase
{
private readonly IManualCatalogService manualCatalogService;
private readonly IUserRepository userRepository;
public ManualController(IManualCatalogService manualCatalogService,
IUserRepository userRepository)
{
this.manualCatalogService = manualCatalogService;
this.userRepository = userRepository;
}
/// <summary>
/// Сохранение файла
/// </summary>
/// <param name="idDirectory">Id директории</param>
/// <param name="file">Загружаемый файл</param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
[HttpPost]
[Permission]
[ProducesResponseType(typeof(int), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status403Forbidden)]
public async Task<IActionResult> SaveFileAsync(int idDirectory,
[Required] IFormFile file,
CancellationToken cancellationToken)
{
var idUser = User.GetUserId();
if(!idUser.HasValue)
throw new ForbidException("Не удается вас опознать");
AssertUserHasAccessToManual("Manual.edit");
using var fileStream = file.OpenReadStream();
var id = await manualCatalogService.SaveFileAsync(idDirectory, idUser.Value, file.FileName, fileStream, cancellationToken);
return Ok(id);
}
/// <summary>
/// Получение файла
/// </summary>
/// <param name="id">Id инструкции</param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
[HttpGet("{id:int}")]
[Permission]
[ProducesResponseType(typeof(PhysicalFileResult), StatusCodes.Status200OK, "application/octet-stream")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status403Forbidden)]
public async Task<IActionResult> GetFileAsync(int id, CancellationToken cancellationToken)
{
AssertUserHasAccessToManual("Manual.get");
var file = await manualCatalogService.GetFileAsync(id, cancellationToken);
if (!file.HasValue)
return NoContent();
return File(file.Value.stream, "application/octet-stream", file.Value.fileName);
}
/// <summary>
/// Удаление файла
/// </summary>
/// <param name="id">Id инструкции</param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
[HttpDelete]
[Permission]
[ProducesResponseType(typeof(int), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status403Forbidden)]
public async Task<IActionResult> DeleteFileAsync(int id, CancellationToken cancellationToken)
{
AssertUserHasAccessToManual("Manual.edit");
return Ok(await manualCatalogService.DeleteFileAsync(id, cancellationToken));
}
private void AssertUserHasAccessToManual(string permissionName)
{
var idUser = User.GetUserId();
if (!idUser.HasValue || !userRepository.HasPermission(idUser.Value, permissionName))
throw new ForbidException("У вас недостаточно прав");
}
}

View File

@ -0,0 +1,110 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Data.Manuals;
using AsbCloudApp.Exceptions;
using AsbCloudApp.Repositories;
using AsbCloudApp.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace AsbCloudWebApi.Controllers;
[ApiController]
[Route("api/[controller]")]
[Authorize]
public class ManualDirectoryController : ControllerBase
{
private readonly IManualDirectoryRepository manualDirectoryRepository;
private readonly IManualCatalogService manualCatalogService;
private readonly IUserRepository userRepository;
public ManualDirectoryController(IManualDirectoryRepository manualDirectoryRepository,
IManualCatalogService manualCatalogService,
IUserRepository userRepository)
{
this.manualDirectoryRepository = manualDirectoryRepository;
this.manualCatalogService = manualCatalogService;
this.userRepository = userRepository;
}
/// <summary>
/// Создание директории
/// </summary>
/// <param name="name">Название</param>
/// <param name="idParent">Необязательный параметр. Id родительской директории</param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
[HttpPost]
[Permission]
[ProducesResponseType(typeof(int), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status403Forbidden)]
public async Task<IActionResult> AddDirectoryAsync(string name, int? idParent, CancellationToken cancellationToken)
{
AssertUserHasAccessToManualDirectory("Manual.edit");
return Ok(await manualCatalogService.AddDirectoryAsync(name, idParent, cancellationToken));
}
/// <summary>
/// Обновление директории
/// </summary>
/// <param name="id"></param>
/// <param name="name">Новое название директории</param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
[HttpPut]
[Permission]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status403Forbidden)]
public async Task<IActionResult> UpdateDirectoryAsync(int id, string name, CancellationToken cancellationToken)
{
AssertUserHasAccessToManualDirectory("Manual.edit");
await manualCatalogService.UpdateDirectoryAsync(id, name, cancellationToken);
return Ok();
}
/// <summary>
/// Удаление директории
/// </summary>
/// <param name="id">Идентификатор директории</param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
[HttpDelete]
[Permission]
[ProducesResponseType(typeof(int), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status403Forbidden)]
public async Task<IActionResult> DeleteDirectoryAsync(int id, CancellationToken cancellationToken)
{
AssertUserHasAccessToManualDirectory("Manual.edit");
return Ok(await manualCatalogService.DeleteDirectoryAsync(id, cancellationToken));
}
/// <summary>
/// Получение дерева категорий
/// </summary>
/// <param name="cancellationToken"></param>
/// <returns></returns>
[HttpGet]
[Permission]
[ProducesResponseType(typeof(IEnumerable<ManualDirectoryDto>), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status403Forbidden)]
public async Task<IActionResult> GetAsync(CancellationToken cancellationToken)
{
AssertUserHasAccessToManualDirectory("Manual.get");
return Ok(await manualDirectoryRepository.GetTreeAsync(cancellationToken));
}
private void AssertUserHasAccessToManualDirectory(string permissionName)
{
var idUser = User.GetUserId();
if (!idUser.HasValue || !userRepository.HasPermission(idUser.Value, permissionName))
throw new ForbidException("У вас недостаточно прав");
}
}

View File

@ -27,8 +27,9 @@ namespace AsbCloudWebApi.Controllers
private readonly ITelemetryService telemetryService;
private readonly IHubContext<TelemetryHub> telemetryHubContext;
private readonly IProcessMapReportMakerService processMapReportService;
private readonly IProcessMapReportService processMapService;
private readonly IProcessMapService processMapService;
private readonly IProcessMapPlanImportService processMapPlanImportService;
private readonly IUserRepository userRepository;
private const string SirnalRMethodGetDataName = "UpdateProcessMap";
@ -36,10 +37,11 @@ namespace AsbCloudWebApi.Controllers
IWellService wellService,
IProcessMapPlanRepository repository,
IProcessMapReportMakerService processMapReportService,
IProcessMapReportService processMapService,
IProcessMapService processMapService,
ITelemetryService telemetryService,
IHubContext<TelemetryHub> telemetryHubContext,
IProcessMapPlanImportService processMapPlanImportService)
IProcessMapPlanImportService processMapPlanImportService,
IUserRepository userRepository)
: base(wellService, repository)
{
this.telemetryService = telemetryService;
@ -47,6 +49,7 @@ namespace AsbCloudWebApi.Controllers
this.processMapReportService = processMapReportService;
this.processMapService = processMapService;
this.processMapPlanImportService = processMapPlanImportService;
this.userRepository = userRepository;
}
@ -110,7 +113,7 @@ namespace AsbCloudWebApi.Controllers
return NoContent();
var fileName = $"РТК по скважине {well.Caption} куст {well.Cluster}.xlsx";
return File(stream, fileName);
return File(stream, "application/octet-stream", fileName);
}
return NoContent();
@ -139,6 +142,9 @@ namespace AsbCloudWebApi.Controllers
[HttpPost]
public override async Task<ActionResult<int>> InsertAsync([FromBody] ProcessMapPlanDto value, CancellationToken token)
{
if (!await CanUserEditProcessMapAsync(value.IdWell, token))
return Forbid();
value.IdUser = User.GetUserId() ?? -1;
var result = await base.InsertAsync(value, token);
await NotifyUsersBySignalR(value.IdWell, token);
@ -154,6 +160,9 @@ namespace AsbCloudWebApi.Controllers
[HttpPut]
public override async Task<ActionResult<int>> UpdateAsync([FromBody] ProcessMapPlanDto value, CancellationToken token)
{
if (!await CanUserEditProcessMapAsync(value.IdWell, token))
return Forbid();
value.IdUser = User.GetUserId() ?? -1;
var result = await base.UpdateAsync(value, token);
await NotifyUsersBySignalR(value.IdWell, token);
@ -192,6 +201,9 @@ namespace AsbCloudWebApi.Controllers
if (idUser is null)
return Forbid();
if (!await CanUserEditProcessMapAsync(idWell, cancellationToken))
return Forbid();
if (Path.GetExtension(file.FileName).ToLower() != ".xlsx")
return BadRequest("Требуется xlsx файл.");
@ -239,6 +251,21 @@ namespace AsbCloudWebApi.Controllers
return File(stream, "application/octet-stream", fileName);
}
private async Task<bool> CanUserEditProcessMapAsync(int idWell, CancellationToken token)
{
var idUser = User.GetUserId();
if (!idUser.HasValue)
return false;
var well = await wellService.GetOrDefaultAsync(idWell, token);
if (well is null)
return false;
return well.IdState != 2 || userRepository.HasPermission(idUser.Value, "ProcessMap.editCompletedWell");
}
private async Task NotifyUsersBySignalR(int idWell, CancellationToken token)
{
var dtos = await service.GetAllAsync(idWell, null, token);

View File

@ -1,4 +1,5 @@
using AsbCloudApp.Data;
using AsbCloudApp.Requests;
using AsbCloudApp.Services;
using AsbCloudWebApi.SignalR;
using Microsoft.AspNetCore.Authorization;
@ -96,6 +97,36 @@ namespace AsbCloudWebApi.Controllers.SAUB
return Ok(content);
}
/// <summary>
/// Новая версия. Возвращает данные САУБ по скважине.
/// По умолчанию за последние 10 минут.
/// </summary>
/// <param name="idWell">id скважины</param>
/// <param name="request"></param>
/// <param name="token">Токен завершения задачи</param>
/// <returns></returns>
[HttpGet("{idWell}/data")]
[Permission]
public virtual async Task<ActionResult<IEnumerable<TDto>>> GetData2Async(int idWell,
[FromQuery]TelemetryDataRequest request,
CancellationToken token)
{
int? idCompany = User.GetCompanyId();
if (idCompany is null)
return Forbid();
bool isCompanyOwnsWell = await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
idWell, token).ConfigureAwait(false);
if (!isCompanyOwnsWell)
return Forbid();
var content = await telemetryDataService.GetAsync(idWell, request, token);
return Ok(content);
}
/// <summary>
/// Возвращает диапазон дат за которые есть телеметрия за период времени
/// </summary>

View File

@ -26,12 +26,16 @@ namespace AsbCloudWebApi.Controllers
private readonly IWellOperationRepository operationRepository;
private readonly IWellService wellService;
private readonly IWellOperationImportService wellOperationImportService;
private readonly IUserRepository userRepository;
public WellOperationController(IWellOperationRepository operationService, IWellService wellService, IWellOperationImportService wellOperationImportService)
public WellOperationController(IWellOperationRepository operationService, IWellService wellService,
IWellOperationImportService wellOperationImportService,
IUserRepository userRepository)
{
this.operationRepository = operationService;
this.wellService = wellService;
this.wellOperationImportService = wellOperationImportService;
this.userRepository = userRepository;
}
/// <summary>
@ -199,7 +203,10 @@ namespace AsbCloudWebApi.Controllers
[FromBody] IEnumerable<WellOperationDto> values,
CancellationToken token)
{
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
if (!await CanUserAccessToWellAsync(idWell, token))
return Forbid();
if (!await CanUserEditWellOperationsAsync(idWell, token))
return Forbid();
foreach (var value in values)
@ -229,7 +236,10 @@ namespace AsbCloudWebApi.Controllers
public async Task<IActionResult> UpdateAsync(int idWell, int idOperation,
[FromBody] WellOperationDto value, CancellationToken token)
{
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
if (!await CanUserAccessToWellAsync(idWell, token))
return Forbid();
if (!await CanUserEditWellOperationsAsync(idWell, token))
return Forbid();
value.IdWell = idWell;
@ -254,8 +264,10 @@ namespace AsbCloudWebApi.Controllers
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
public async Task<IActionResult> DeleteAsync(int idWell, int idOperation, CancellationToken token)
{
if (!await CanUserAccessToWellAsync(idWell,
token).ConfigureAwait(false))
if (!await CanUserAccessToWellAsync(idWell, token))
return Forbid();
if (!await CanUserEditWellOperationsAsync(idWell, token))
return Forbid();
var result = await operationRepository.DeleteAsync(new int[] { idOperation }, token)
@ -286,6 +298,12 @@ namespace AsbCloudWebApi.Controllers
if (idCompany is null || idUser is null)
return Forbid();
if (!await CanUserAccessToWellAsync(idWell, token))
return Forbid();
if (!await CanUserEditWellOperationsAsync(idWell, token))
return Forbid();
if (!await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
idWell, token).ConfigureAwait(false))
return Forbid();
@ -376,6 +394,21 @@ namespace AsbCloudWebApi.Controllers
return File(stream, "application/octet-stream", fileName);
}
private async Task<bool> CanUserEditWellOperationsAsync(int idWell, CancellationToken token)
{
var idUser = User.GetUserId();
if (!idUser.HasValue)
return false;
var well = await wellService.GetOrDefaultAsync(idWell, token);
if (well is null)
return false;
return well.IdState != 2 || userRepository.HasPermission(idUser.Value, "WellOperation.editCompletedWell");
}
private async Task<bool> CanUserAccessToWellAsync(int idWell, CancellationToken token)
{
int? idCompany = User.GetCompanyId();

View File

@ -27,6 +27,7 @@
"supportMail": "support@digitaldrilling.ru"
},
"DirectoryNameHelpPageFiles": "helpPages",
"DirectoryManualFiles": "manuals",
"Urls": "http://0.0.0.0:5000" //;https://0.0.0.0:5001" //,
// See https man: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel/endpoints?view=aspnetcore-6.0
//"Kestrel": {