forked from ddrilling/AsbCloudServer
Merge branch 'dev' into feature/manuals
# Conflicts: # AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs # AsbCloudDb/Model/DefaultData/EntityFillerPermission.cs
This commit is contained in:
commit
295c8d9145
@ -33,16 +33,6 @@ public abstract class TrajectoryGeoDto
|
|||||||
/// Глубина вертикальная
|
/// Глубина вертикальная
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double? VerticalDepth { get; set; }
|
public double? VerticalDepth { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Север отн- но устья
|
|
||||||
/// </summary>
|
|
||||||
public double? NorthOrifice { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Восток отн- но устья
|
|
||||||
/// </summary>
|
|
||||||
public double? EastOrifice { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -21,41 +21,6 @@ namespace AsbCloudApp.Data
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int IdUser { get; set; }
|
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>
|
||||||
/// Радиус цели
|
/// Радиус цели
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
59
AsbCloudApp/Requests/TelemetryRequest.cs
Normal file
59
AsbCloudApp/Requests/TelemetryRequest.cs
Normal 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;
|
||||||
|
|
||||||
|
}
|
@ -6,9 +6,9 @@ using System.Threading.Tasks;
|
|||||||
namespace AsbCloudApp.Services
|
namespace AsbCloudApp.Services
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Сервис формирования РТК
|
/// Сервис РТК
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IProcessMapReportService
|
public interface IProcessMapService
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение моделей РТК
|
/// Получение моделей РТК
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using AsbCloudApp.Data;
|
using AsbCloudApp.Data;
|
||||||
|
using AsbCloudApp.Requests;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -25,6 +26,7 @@ namespace AsbCloudApp.Services
|
|||||||
Task<IEnumerable<TDto>> GetAsync(int idWell,
|
Task<IEnumerable<TDto>> GetAsync(int idWell,
|
||||||
DateTime dateBegin = default, double intervalSec = 600d,
|
DateTime dateBegin = default, double intervalSec = 600d,
|
||||||
int approxPointsCount = 1024, CancellationToken token = default);
|
int approxPointsCount = 1024, CancellationToken token = default);
|
||||||
|
Task<IEnumerable<TDto>> GetAsync(int idWell, TelemetryDataRequest request, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение статистики за период
|
/// Получение статистики за период
|
||||||
|
8346
AsbCloudDb/Migrations/20230821110455_Update_PlannedTrajectory.Designer.cs
generated
Normal file
8346
AsbCloudDb/Migrations/20230821110455_Update_PlannedTrajectory.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
123
AsbCloudDb/Migrations/20230821110455_Update_PlannedTrajectory.cs
Normal file
123
AsbCloudDb/Migrations/20230821110455_Update_PlannedTrajectory.cs
Normal 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: "Пространственная интенсивность");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
8413
AsbCloudDb/Migrations/20230913063219_Add_New_Permissions.Designer.cs
generated
Normal file
8413
AsbCloudDb/Migrations/20230913063219_Add_New_Permissions.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
53
AsbCloudDb/Migrations/20230913063219_Add_New_Permissions.cs
Normal file
53
AsbCloudDb/Migrations/20230913063219_Add_New_Permissions.cs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2257,6 +2257,18 @@ namespace AsbCloudDb.Migrations
|
|||||||
Id = 524,
|
Id = 524,
|
||||||
Description = "Разрешить получение инструкций",
|
Description = "Разрешить получение инструкций",
|
||||||
Name = "Manual.get"
|
Name = "Manual.get"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 525,
|
||||||
|
Description = "Разрешение на редактирование РТК у завершенной скважины",
|
||||||
|
Name = "ProcessMap.editCompletedWell"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 526,
|
||||||
|
Description = "Разрешение на редактирование операций у завершенной скважины",
|
||||||
|
Name = "WellOperation.editCompletedWell"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -2269,26 +2281,11 @@ namespace AsbCloudDb.Migrations
|
|||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
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")
|
b.Property<double>("AzimuthGeo")
|
||||||
.HasColumnType("double precision")
|
.HasColumnType("double precision")
|
||||||
.HasColumnName("azimuth_geo")
|
.HasColumnName("azimuth_geo")
|
||||||
.HasComment("Азимут Географ.");
|
.HasComment("Азимут Географ.");
|
||||||
|
|
||||||
b.Property<double>("AzimuthIntensity")
|
|
||||||
.HasColumnType("double precision")
|
|
||||||
.HasColumnName("azimuth_intensity")
|
|
||||||
.HasComment("Интенсивность по азимуту");
|
|
||||||
|
|
||||||
b.Property<double>("AzimuthMagnetic")
|
b.Property<double>("AzimuthMagnetic")
|
||||||
.HasColumnType("double precision")
|
.HasColumnType("double precision")
|
||||||
.HasColumnName("azimuth_magnetic")
|
.HasColumnName("azimuth_magnetic")
|
||||||
@ -2299,16 +2296,6 @@ namespace AsbCloudDb.Migrations
|
|||||||
.HasColumnName("comment")
|
.HasColumnName("comment")
|
||||||
.HasComment("Комментарии");
|
.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")
|
b.Property<int>("IdUser")
|
||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("id_user")
|
.HasColumnName("id_user")
|
||||||
@ -2319,31 +2306,11 @@ namespace AsbCloudDb.Migrations
|
|||||||
.HasColumnName("id_well")
|
.HasColumnName("id_well")
|
||||||
.HasComment("ID скважины");
|
.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")
|
b.Property<double?>("Radius")
|
||||||
.HasColumnType("double precision")
|
.HasColumnType("double precision")
|
||||||
.HasColumnName("radius")
|
.HasColumnName("radius")
|
||||||
.HasComment("Радиус цели");
|
.HasComment("Радиус цели");
|
||||||
|
|
||||||
b.Property<double>("SpatialIntensity")
|
|
||||||
.HasColumnType("double precision")
|
|
||||||
.HasColumnName("spatial_intensity")
|
|
||||||
.HasComment("Пространственная интенсивность");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("UpdateDate")
|
b.Property<DateTimeOffset>("UpdateDate")
|
||||||
.HasColumnType("timestamp with time zone")
|
.HasColumnType("timestamp with time zone")
|
||||||
.HasColumnName("update_date")
|
.HasColumnName("update_date")
|
||||||
@ -3854,7 +3821,17 @@ namespace AsbCloudDb.Migrations
|
|||||||
{
|
{
|
||||||
IdUserRole = 1,
|
IdUserRole = 1,
|
||||||
IdPermission = 524
|
IdPermission = 524
|
||||||
});
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
IdUserRole = 1,
|
||||||
|
IdPermission = 525
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
IdUserRole = 1,
|
||||||
|
IdPermission = 526
|
||||||
|
},);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("AsbCloudDb.Model.RelationUserRoleUserRole", b =>
|
modelBuilder.Entity("AsbCloudDb.Model.RelationUserRoleUserRole", b =>
|
||||||
|
@ -158,7 +158,10 @@
|
|||||||
new() { Id = 522, Name = "UserSettings.delete", Description = "Разрешить удаление всех настроек пользователя"},
|
new() { Id = 522, Name = "UserSettings.delete", Description = "Разрешить удаление всех настроек пользователя"},
|
||||||
|
|
||||||
new() { Id = 523, Name = "Manual.edit", Description = "Разрешить редактирование инструкций" },
|
new() { Id = 523, Name = "Manual.edit", Description = "Разрешить редактирование инструкций" },
|
||||||
new() { Id = 524, Name = "Manual.get", Description = "Разрешить получение инструкций"}
|
new() { Id = 524, Name = "Manual.get", Description = "Разрешить получение инструкций"},
|
||||||
|
|
||||||
|
new (){ Id = 525, Name = "ProcessMap.editCompletedWell", Description = "Разрешение на редактирование РТК у завершенной скважины"},
|
||||||
|
new (){ Id = 526, Name = "WellOperation.editCompletedWell", Description = "Разрешение на редактирование операций у завершенной скважины"}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 = 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 = 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 = 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();
|
var allPermissions = (new EntityFillerPermission()).GetData();
|
||||||
foreach ( var permission in allPermissions)
|
foreach ( var permission in allPermissions)
|
||||||
|
@ -35,33 +35,6 @@ namespace AsbCloudDb.Model
|
|||||||
[Column("vertical_depth"), Comment("Глубина вертикальная")]
|
[Column("vertical_depth"), Comment("Глубина вертикальная")]
|
||||||
public double VerticalDepth { get; set; }
|
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("Комментарии")]
|
[Column("comment"), Comment("Комментарии")]
|
||||||
public string? Comment { get; set; }
|
public string? Comment { get; set; }
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ namespace AsbCloudInfrastructure
|
|||||||
services.AddTransient<IFileCategoryService, FileCategoryService>();
|
services.AddTransient<IFileCategoryService, FileCategoryService>();
|
||||||
services.AddTransient<ILimitingParameterService, LimitingParameterService>();
|
services.AddTransient<ILimitingParameterService, LimitingParameterService>();
|
||||||
services.AddTransient<IProcessMapReportMakerService, ProcessMapReportMakerService>();
|
services.AddTransient<IProcessMapReportMakerService, ProcessMapReportMakerService>();
|
||||||
services.AddTransient<IProcessMapReportService, ProcessMapReportService>();
|
services.AddTransient<IProcessMapService, ProcessMapService>();
|
||||||
services.AddTransient<WellInfoService>();
|
services.AddTransient<WellInfoService>();
|
||||||
services.AddTransient<IHelpPageService, HelpPageService>();
|
services.AddTransient<IHelpPageService, HelpPageService>();
|
||||||
|
|
||||||
|
@ -41,8 +41,6 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
IdWell = idWell,
|
IdWell = idWell,
|
||||||
AzimuthMagnetic = coord.Svymtf,
|
AzimuthMagnetic = coord.Svymtf,
|
||||||
VerticalDepth = coord.Deptsvyv,
|
VerticalDepth = coord.Deptsvyv,
|
||||||
NorthOrifice = coord.Svyns,
|
|
||||||
EastOrifice = coord.Svyew,
|
|
||||||
WellboreDepth = coord.Deptsvym!.Value,
|
WellboreDepth = coord.Deptsvym!.Value,
|
||||||
ZenithAngle = coord.Svyinc!.Value,
|
ZenithAngle = coord.Svyinc!.Value,
|
||||||
AzimuthGeo = coord.Svyazc!.Value
|
AzimuthGeo = coord.Svyazc!.Value
|
||||||
|
@ -13,13 +13,13 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
|
|||||||
public class ProcessMapReportMakerService : IProcessMapReportMakerService
|
public class ProcessMapReportMakerService : IProcessMapReportMakerService
|
||||||
{
|
{
|
||||||
const int firstColumn = 2;
|
const int firstColumn = 2;
|
||||||
const int lastColumn = 49;
|
const int lastColumn = 42;
|
||||||
|
|
||||||
const int headerRowsCount = 5;
|
const int headerRowsCount = 5;
|
||||||
|
|
||||||
private readonly IProcessMapReportService processMapService;
|
private readonly IProcessMapService processMapService;
|
||||||
|
|
||||||
public ProcessMapReportMakerService(IProcessMapReportService processMapService)
|
public ProcessMapReportMakerService(IProcessMapService processMapService)
|
||||||
{
|
{
|
||||||
this.processMapService = processMapService;
|
this.processMapService = processMapService;
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -12,14 +12,14 @@ using System.Threading.Tasks;
|
|||||||
namespace AsbCloudInfrastructure.Services.ProcessMap
|
namespace AsbCloudInfrastructure.Services.ProcessMap
|
||||||
{
|
{
|
||||||
|
|
||||||
public partial class ProcessMapReportService : IProcessMapReportService
|
public partial class ProcessMapService : IProcessMapService
|
||||||
{
|
{
|
||||||
private readonly IWellService wellService;
|
private readonly IWellService wellService;
|
||||||
private readonly IWellOperationRepository wellOperationRepository;
|
private readonly IWellOperationRepository wellOperationRepository;
|
||||||
private readonly IProcessMapPlanRepository processMapPlanRepository;
|
private readonly IProcessMapPlanRepository processMapPlanRepository;
|
||||||
private readonly ITelemetryDataSaubService telemetryDataSaubService;
|
private readonly ITelemetryDataSaubService telemetryDataSaubService;
|
||||||
|
|
||||||
public ProcessMapReportService(
|
public ProcessMapService(
|
||||||
IWellService wellService,
|
IWellService wellService,
|
||||||
IWellOperationRepository wellOperationRepository,
|
IWellOperationRepository wellOperationRepository,
|
||||||
IProcessMapPlanRepository processMapPlanRepository,
|
IProcessMapPlanRepository processMapPlanRepository,
|
@ -1,4 +1,5 @@
|
|||||||
using AsbCloudApp.Data;
|
using AsbCloudApp.Data;
|
||||||
|
using AsbCloudApp.Exceptions;
|
||||||
using AsbCloudApp.Services;
|
using AsbCloudApp.Services;
|
||||||
using AsbCloudDb;
|
using AsbCloudDb;
|
||||||
using AsbCloudDb.Model;
|
using AsbCloudDb.Model;
|
||||||
@ -137,10 +138,67 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
|||||||
}
|
}
|
||||||
|
|
||||||
var entities = await query
|
var entities = await query
|
||||||
.OrderBy(d => d.DateTime)
|
|
||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
.ToListAsync(token)
|
.ToArrayAsync(token);
|
||||||
.ConfigureAwait(false);
|
|
||||||
|
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));
|
var dtos = entities.Select(e => Convert(e, timezone.Hours));
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ using Microsoft.Extensions.DependencyInjection;
|
|||||||
using AsbCloudInfrastructure.Background;
|
using AsbCloudInfrastructure.Background;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using AsbCloudApp.Data;
|
using AsbCloudApp.Data;
|
||||||
|
using AsbCloudApp.Requests;
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.SAUB
|
namespace AsbCloudInfrastructure.Services.SAUB
|
||||||
{
|
{
|
||||||
@ -21,6 +22,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
|||||||
{
|
{
|
||||||
public TDto? FirstByDate { get; init; }
|
public TDto? FirstByDate { get; init; }
|
||||||
public CyclycArray<TDto> LastData { get; init; } = null!;
|
public CyclycArray<TDto> LastData { get; init; } = null!;
|
||||||
|
public double TimezoneHours { get; init; } = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IServiceProvider provider = null!;
|
private IServiceProvider provider = null!;
|
||||||
@ -225,8 +227,62 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
|||||||
{
|
{
|
||||||
FirstByDate = first,
|
FirstByDate = first,
|
||||||
LastData = cacheItem,
|
LastData = cacheItem,
|
||||||
|
TimezoneHours = hoursOffset,
|
||||||
};
|
};
|
||||||
return item;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,16 +30,8 @@ namespace AsbCloudInfrastructure.Services.Trajectory
|
|||||||
private const int ColumnAzimuthGeo = 3;
|
private const int ColumnAzimuthGeo = 3;
|
||||||
private const int ColumnAzimuthMagnetic = 4;
|
private const int ColumnAzimuthMagnetic = 4;
|
||||||
private const int ColumnVerticalDepth = 5;
|
private const int ColumnVerticalDepth = 5;
|
||||||
private const int ColumnAbsoluteMark = 6;
|
private const int ColumnRadius = 6;
|
||||||
private const int ColumnNorthOrifice = 7;
|
private const int ColumnComment = 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;
|
|
||||||
|
|
||||||
public PlannedTrajectoryImportService(IWellService wellService, ITrajectoryPlanRepository plannedTrajectoryService)
|
public PlannedTrajectoryImportService(IWellService wellService, ITrajectoryPlanRepository plannedTrajectoryService)
|
||||||
{
|
{
|
||||||
@ -107,15 +99,7 @@ namespace AsbCloudInfrastructure.Services.Trajectory
|
|||||||
row.Cell(ColumnAzimuthGeo).Value = trajectory.AzimuthGeo;
|
row.Cell(ColumnAzimuthGeo).Value = trajectory.AzimuthGeo;
|
||||||
row.Cell(ColumnAzimuthMagnetic).Value = trajectory.AzimuthMagnetic;
|
row.Cell(ColumnAzimuthMagnetic).Value = trajectory.AzimuthMagnetic;
|
||||||
row.Cell(ColumnVerticalDepth).Value = trajectory.VerticalDepth;
|
row.Cell(ColumnVerticalDepth).Value = trajectory.VerticalDepth;
|
||||||
row.Cell(ColumnAbsoluteMark).Value = trajectory.AbsoluteMark;
|
row.Cell(ColumnRadius).Value = trajectory.Radius;
|
||||||
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(ColumnComment).Value = trajectory.Comment;
|
row.Cell(ColumnComment).Value = trajectory.Comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +142,7 @@ namespace AsbCloudInfrastructure.Services.Trajectory
|
|||||||
|
|
||||||
private IEnumerable<TrajectoryGeoPlanDto> ParseSheet(IXLWorksheet sheet)
|
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} содержит меньшее количество столбцов.");
|
throw new FileFormatException($"Лист {sheet.Name} содержит меньшее количество столбцов.");
|
||||||
|
|
||||||
var count = sheet.RowsUsed().Count() - headerRowsCount;
|
var count = sheet.RowsUsed().Count() - headerRowsCount;
|
||||||
@ -194,15 +178,7 @@ namespace AsbCloudInfrastructure.Services.Trajectory
|
|||||||
var _azimuthGeo = row.Cell(ColumnAzimuthGeo).Value;
|
var _azimuthGeo = row.Cell(ColumnAzimuthGeo).Value;
|
||||||
var _azimuthMagnetic = row.Cell(ColumnAzimuthMagnetic).Value;
|
var _azimuthMagnetic = row.Cell(ColumnAzimuthMagnetic).Value;
|
||||||
var _verticalDepth = row.Cell(ColumnVerticalDepth).Value;
|
var _verticalDepth = row.Cell(ColumnVerticalDepth).Value;
|
||||||
var _absoluteMark = row.Cell(ColumnAbsoluteMark).Value;
|
var _radius = row.Cell(ColumnRadius).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 _comment = row.Cell(ColumnComment).Value;
|
var _comment = row.Cell(ColumnComment).Value;
|
||||||
|
|
||||||
var trajectoryRow = new TrajectoryGeoPlanDto();
|
var trajectoryRow = new TrajectoryGeoPlanDto();
|
||||||
@ -219,15 +195,8 @@ namespace AsbCloudInfrastructure.Services.Trajectory
|
|||||||
trajectoryRow.AzimuthGeo = getDoubleValue(_azimuthGeo, "Азимут географический", row);
|
trajectoryRow.AzimuthGeo = getDoubleValue(_azimuthGeo, "Азимут географический", row);
|
||||||
trajectoryRow.AzimuthMagnetic = getDoubleValue(_azimuthMagnetic, "Азимут магнитный", row);
|
trajectoryRow.AzimuthMagnetic = getDoubleValue(_azimuthMagnetic, "Азимут магнитный", row);
|
||||||
trajectoryRow.VerticalDepth = getDoubleValue(_verticalDepth, "Глубина вертикальная", row);
|
trajectoryRow.VerticalDepth = getDoubleValue(_verticalDepth, "Глубина вертикальная", row);
|
||||||
trajectoryRow.AbsoluteMark = getDoubleValue(_absoluteMark, "Абсолютная отметка", row);
|
trajectoryRow.Radius = getDoubleValue(_radius, "Радиус цели", 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);
|
|
||||||
if (_comment is not null)
|
if (_comment is not null)
|
||||||
trajectoryRow.Comment = _comment.ToString();
|
trajectoryRow.Comment = _comment.ToString();
|
||||||
return trajectoryRow;
|
return trajectoryRow;
|
||||||
|
Binary file not shown.
@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -58,8 +59,8 @@ public class WellboreService : IWellboreService
|
|||||||
Id = group.Key,
|
Id = group.Key,
|
||||||
Name = sections[group.Key].Caption,
|
Name = sections[group.Key].Caption,
|
||||||
Well = well.Adapt<WellWithTimezoneDto>(),
|
Well = well.Adapt<WellWithTimezoneDto>(),
|
||||||
DateStart = group.Min(operation => operation.DateStart),
|
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)),
|
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),
|
DepthStart = group.Min(operation => operation.DepthStart),
|
||||||
DepthEnd = group.Max(operation => operation.DepthEnd),
|
DepthEnd = group.Max(operation => operation.DepthEnd),
|
||||||
});
|
});
|
||||||
|
@ -27,8 +27,9 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
private readonly ITelemetryService telemetryService;
|
private readonly ITelemetryService telemetryService;
|
||||||
private readonly IHubContext<TelemetryHub> telemetryHubContext;
|
private readonly IHubContext<TelemetryHub> telemetryHubContext;
|
||||||
private readonly IProcessMapReportMakerService processMapReportService;
|
private readonly IProcessMapReportMakerService processMapReportService;
|
||||||
private readonly IProcessMapReportService processMapService;
|
private readonly IProcessMapService processMapService;
|
||||||
private readonly IProcessMapPlanImportService processMapPlanImportService;
|
private readonly IProcessMapPlanImportService processMapPlanImportService;
|
||||||
|
private readonly IUserRepository userRepository;
|
||||||
|
|
||||||
private const string SirnalRMethodGetDataName = "UpdateProcessMap";
|
private const string SirnalRMethodGetDataName = "UpdateProcessMap";
|
||||||
|
|
||||||
@ -36,10 +37,11 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
IWellService wellService,
|
IWellService wellService,
|
||||||
IProcessMapPlanRepository repository,
|
IProcessMapPlanRepository repository,
|
||||||
IProcessMapReportMakerService processMapReportService,
|
IProcessMapReportMakerService processMapReportService,
|
||||||
IProcessMapReportService processMapService,
|
IProcessMapService processMapService,
|
||||||
ITelemetryService telemetryService,
|
ITelemetryService telemetryService,
|
||||||
IHubContext<TelemetryHub> telemetryHubContext,
|
IHubContext<TelemetryHub> telemetryHubContext,
|
||||||
IProcessMapPlanImportService processMapPlanImportService)
|
IProcessMapPlanImportService processMapPlanImportService,
|
||||||
|
IUserRepository userRepository)
|
||||||
: base(wellService, repository)
|
: base(wellService, repository)
|
||||||
{
|
{
|
||||||
this.telemetryService = telemetryService;
|
this.telemetryService = telemetryService;
|
||||||
@ -47,6 +49,7 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
this.processMapReportService = processMapReportService;
|
this.processMapReportService = processMapReportService;
|
||||||
this.processMapService = processMapService;
|
this.processMapService = processMapService;
|
||||||
this.processMapPlanImportService = processMapPlanImportService;
|
this.processMapPlanImportService = processMapPlanImportService;
|
||||||
|
this.userRepository = userRepository;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +113,7 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
return NoContent();
|
return NoContent();
|
||||||
|
|
||||||
var fileName = $"РТК по скважине {well.Caption} куст {well.Cluster}.xlsx";
|
var fileName = $"РТК по скважине {well.Caption} куст {well.Cluster}.xlsx";
|
||||||
return File(stream, fileName);
|
return File(stream, "application/octet-stream", fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NoContent();
|
return NoContent();
|
||||||
@ -139,6 +142,9 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
[HttpPost]
|
[HttpPost]
|
||||||
public override async Task<ActionResult<int>> InsertAsync([FromBody] ProcessMapPlanDto value, CancellationToken token)
|
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;
|
value.IdUser = User.GetUserId() ?? -1;
|
||||||
var result = await base.InsertAsync(value, token);
|
var result = await base.InsertAsync(value, token);
|
||||||
await NotifyUsersBySignalR(value.IdWell, token);
|
await NotifyUsersBySignalR(value.IdWell, token);
|
||||||
@ -154,6 +160,9 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
[HttpPut]
|
[HttpPut]
|
||||||
public override async Task<ActionResult<int>> UpdateAsync([FromBody] ProcessMapPlanDto value, CancellationToken token)
|
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;
|
value.IdUser = User.GetUserId() ?? -1;
|
||||||
var result = await base.UpdateAsync(value, token);
|
var result = await base.UpdateAsync(value, token);
|
||||||
await NotifyUsersBySignalR(value.IdWell, token);
|
await NotifyUsersBySignalR(value.IdWell, token);
|
||||||
@ -192,6 +201,9 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
if (idUser is null)
|
if (idUser is null)
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
|
if (!await CanUserEditProcessMapAsync(idWell, cancellationToken))
|
||||||
|
return Forbid();
|
||||||
|
|
||||||
if (Path.GetExtension(file.FileName).ToLower() != ".xlsx")
|
if (Path.GetExtension(file.FileName).ToLower() != ".xlsx")
|
||||||
return BadRequest("Требуется xlsx файл.");
|
return BadRequest("Требуется xlsx файл.");
|
||||||
|
|
||||||
@ -239,6 +251,21 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
return File(stream, "application/octet-stream", fileName);
|
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)
|
private async Task NotifyUsersBySignalR(int idWell, CancellationToken token)
|
||||||
{
|
{
|
||||||
var dtos = await service.GetAllAsync(idWell, null, token);
|
var dtos = await service.GetAllAsync(idWell, null, token);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using AsbCloudApp.Data;
|
using AsbCloudApp.Data;
|
||||||
|
using AsbCloudApp.Requests;
|
||||||
using AsbCloudApp.Services;
|
using AsbCloudApp.Services;
|
||||||
using AsbCloudWebApi.SignalR;
|
using AsbCloudWebApi.SignalR;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
@ -96,6 +97,36 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
|||||||
return Ok(content);
|
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>
|
||||||
/// Возвращает диапазон дат за которые есть телеметрия за период времени
|
/// Возвращает диапазон дат за которые есть телеметрия за период времени
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -26,12 +26,16 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
private readonly IWellOperationRepository operationRepository;
|
private readonly IWellOperationRepository operationRepository;
|
||||||
private readonly IWellService wellService;
|
private readonly IWellService wellService;
|
||||||
private readonly IWellOperationImportService wellOperationImportService;
|
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.operationRepository = operationService;
|
||||||
this.wellService = wellService;
|
this.wellService = wellService;
|
||||||
this.wellOperationImportService = wellOperationImportService;
|
this.wellOperationImportService = wellOperationImportService;
|
||||||
|
this.userRepository = userRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -199,7 +203,10 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
[FromBody] IEnumerable<WellOperationDto> values,
|
[FromBody] IEnumerable<WellOperationDto> values,
|
||||||
CancellationToken token)
|
CancellationToken token)
|
||||||
{
|
{
|
||||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
if (!await CanUserAccessToWellAsync(idWell, token))
|
||||||
|
return Forbid();
|
||||||
|
|
||||||
|
if (!await CanUserEditWellOperationsAsync(idWell, token))
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
foreach (var value in values)
|
foreach (var value in values)
|
||||||
@ -229,7 +236,10 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
public async Task<IActionResult> UpdateAsync(int idWell, int idOperation,
|
public async Task<IActionResult> UpdateAsync(int idWell, int idOperation,
|
||||||
[FromBody] WellOperationDto value, CancellationToken token)
|
[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();
|
return Forbid();
|
||||||
|
|
||||||
value.IdWell = idWell;
|
value.IdWell = idWell;
|
||||||
@ -254,8 +264,10 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> DeleteAsync(int idWell, int idOperation, CancellationToken token)
|
public async Task<IActionResult> DeleteAsync(int idWell, int idOperation, CancellationToken token)
|
||||||
{
|
{
|
||||||
if (!await CanUserAccessToWellAsync(idWell,
|
if (!await CanUserAccessToWellAsync(idWell, token))
|
||||||
token).ConfigureAwait(false))
|
return Forbid();
|
||||||
|
|
||||||
|
if (!await CanUserEditWellOperationsAsync(idWell, token))
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
var result = await operationRepository.DeleteAsync(new int[] { idOperation }, token)
|
var result = await operationRepository.DeleteAsync(new int[] { idOperation }, token)
|
||||||
@ -286,6 +298,12 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
if (idCompany is null || idUser is null)
|
if (idCompany is null || idUser is null)
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
|
if (!await CanUserAccessToWellAsync(idWell, token))
|
||||||
|
return Forbid();
|
||||||
|
|
||||||
|
if (!await CanUserEditWellOperationsAsync(idWell, token))
|
||||||
|
return Forbid();
|
||||||
|
|
||||||
if (!await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
|
if (!await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
|
||||||
idWell, token).ConfigureAwait(false))
|
idWell, token).ConfigureAwait(false))
|
||||||
return Forbid();
|
return Forbid();
|
||||||
@ -376,6 +394,21 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
return File(stream, "application/octet-stream", fileName);
|
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)
|
private async Task<bool> CanUserAccessToWellAsync(int idWell, CancellationToken token)
|
||||||
{
|
{
|
||||||
int? idCompany = User.GetCompanyId();
|
int? idCompany = User.GetCompanyId();
|
||||||
|
Loading…
Reference in New Issue
Block a user