diff --git a/AsbCloudApp/Services/IPlannedTrajectoryImportService.cs b/AsbCloudApp/Services/IPlannedTrajectoryImportService.cs
deleted file mode 100644
index 9d00caf0..00000000
--- a/AsbCloudApp/Services/IPlannedTrajectoryImportService.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using System.IO;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace AsbCloudApp.Services
-{
- ///
- /// Сервис загрузки и обработки плановой траектории из файла
- ///
- public interface IPlannedTrajectoryImportService
- {
- ///
- /// скачать шаблон для заполнения плановой траектории
- ///
- ///
- Stream GetTemplateFile();
- ///
- /// Получить имя файла (исходя из названия скважины)
- ///
- ///
- Task GetFileNameAsync(int idWell, CancellationToken token);
-
- ///
- /// загрузить текущую плановую траекторию в .xlsx
- ///
- ///
- ///
- ///
- Task ExportAsync(int idWell, CancellationToken token);
- ///
- /// импортировать из excel плановую траекторию
- ///
- ///
- ///
- ///
- ///
- /// Очистить старые координаты перед импортом (если файл проходит валидацию)
- Task ImportAsync(int idWell, int idUser, Stream stream, bool deleteBeforeImport, CancellationToken token);
- }
-}
diff --git a/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj b/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj
index 25bea191..f2edc76d 100644
--- a/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj
+++ b/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj
@@ -38,7 +38,7 @@
-
+
diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs
index 7aafcb27..4e7c8ee6 100644
--- a/AsbCloudInfrastructure/DependencyInjection.cs
+++ b/AsbCloudInfrastructure/DependencyInjection.cs
@@ -201,10 +201,10 @@ namespace AsbCloudInfrastructure
services.AddTransient();
services.AddTransient();
services.AddTransient();
- services.AddTransient();
+ services.AddTransient();
services.AddTransient();
services.AddTransient();
- services.AddTransient();
+ services.AddTransient();
services.AddTransient();
services.AddTransient();
services.AddTransient();
@@ -276,9 +276,9 @@ namespace AsbCloudInfrastructure
services.AddTransient();
services.AddTransient, CrudCacheRepositoryBase>();
-
+
services.AddTransient, CrudCacheRepositoryBase>();
-
+
services.AddTransient, CrudCacheRepositoryBase>();
// TelemetryData services
diff --git a/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryExportService.cs b/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryExportService.cs
index b2384d0e..fc075d12 100644
--- a/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryExportService.cs
+++ b/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryExportService.cs
@@ -18,7 +18,7 @@ namespace AsbCloudInfrastructure.Services.Trajectory.Export
private readonly ITrajectoryRepository trajectoryRepository;
public abstract string templateFileName { get; }
public abstract string usingTemplateFile { get; }
- public abstract string sheetTrajectory { get; }
+ public abstract string sheetName { get; }
public abstract int headerRowsCount { get; }
public TrajectoryExportService(IWellService wellService, ITrajectoryRepository trajectoryRepository)
@@ -65,9 +65,9 @@ namespace AsbCloudInfrastructure.Services.Trajectory.Export
{
if (trajectories.Any())
{
- var sheet = workbook.Worksheets.FirstOrDefault(ws => ws.Name == sheetTrajectory);
+ var sheet = workbook.Worksheets.FirstOrDefault(ws => ws.Name == sheetName);
if (sheet is null)
- throw new FileFormatException($"Лист с именем {sheetTrajectory} отсутствует, либо имеет некорректное название");
+ throw new FileFormatException($"Лист с именем {sheetName} отсутствует, либо имеет некорректное название");
AddTrajecoryToSheet(sheet, trajectories);
}
}
diff --git a/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryFactManualExportService.cs b/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryFactManualExportService.cs
index 702b79f0..8484fd3f 100644
--- a/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryFactManualExportService.cs
+++ b/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryFactManualExportService.cs
@@ -10,7 +10,7 @@ namespace AsbCloudInfrastructure.Services.Trajectory.Export
{
public override string templateFileName { get; } = "TrajectoryFactManualTemplate.xlsx";
public override string usingTemplateFile { get; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
- public override string sheetTrajectory { get; } = "Фактическая траектория";
+ public override string sheetName { get; } = "Фактическая траектория";
public override int headerRowsCount { get; } = 2;
public TrajectoryFactManualExportService(
diff --git a/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryFactNnbExportService.cs b/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryFactNnbExportService.cs
index e787eb73..e4548599 100644
--- a/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryFactNnbExportService.cs
+++ b/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryFactNnbExportService.cs
@@ -10,7 +10,7 @@ namespace AsbCloudInfrastructure.Services.Trajectory.Export
{
public override string templateFileName { get; } = "TrajectoryFactNnbTemplate.xlsx";
public override string usingTemplateFile { get; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
- public override string sheetTrajectory { get; } = "Фактическая ннб-траектория";
+ public override string sheetName { get; } = "Фактическая ннб-траектория";
public override int headerRowsCount { get; } = 2;
public TrajectoryFactNnbExportService(
diff --git a/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryPlannedExportService.cs b/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryPlanExportService.cs
similarity index 82%
rename from AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryPlannedExportService.cs
rename to AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryPlanExportService.cs
index fde6f246..e5e6cc35 100644
--- a/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryPlannedExportService.cs
+++ b/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryPlanExportService.cs
@@ -5,17 +5,17 @@ using ClosedXML.Excel;
namespace AsbCloudInfrastructure.Services.Trajectory.Export
{
- public class TrajectoryPlannedExportService : TrajectoryExportService
+ public class TrajectoryPlanExportService : TrajectoryExportService
{
/*
* password for PlannedTrajectoryTemplate.xlsx is Drill2022
*/
- public override string templateFileName { get; } = "TrajectoryPlannedTemplate.xlsx";
+ public override string templateFileName { get; } = "TrajectoryPlanTemplate.xlsx";
public override string usingTemplateFile { get; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
- public override string sheetTrajectory { get; } = "Плановая траектория";
+ public override string sheetName { get; } = "Плановая траектория";
public override int headerRowsCount { get; } = 2;
- public TrajectoryPlannedExportService(
+ public TrajectoryPlanExportService(
IWellService wellService,
ITrajectoryEditableRepository plannedTrajectoryService)
: base(wellService, plannedTrajectoryService)
diff --git a/AsbCloudInfrastructure/Services/Trajectory/Import/TrajectoryFactManualParserService.cs b/AsbCloudInfrastructure/Services/Trajectory/Import/TrajectoryFactManualParserService.cs
index 35f16a18..be08e12e 100644
--- a/AsbCloudInfrastructure/Services/Trajectory/Import/TrajectoryFactManualParserService.cs
+++ b/AsbCloudInfrastructure/Services/Trajectory/Import/TrajectoryFactManualParserService.cs
@@ -8,14 +8,9 @@ namespace AsbCloudInfrastructure.Services.Trajectory.Import
{
public override string templateFileName { get; } = "TrajectoryFactManualTemplate.xlsx";
public override string usingTemplateFile { get; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
- public override string sheetNameTrajectory { get; } = "Фактическая траектория";
+ public override string sheetName { get; } = "Фактическая траектория";
public override int headerRowsCount { get; } = 2;
- public TrajectoryFactManualParserService() : base()
- {
-
- }
-
protected override TrajectoryGeoFactDto ParseRow(IXLRow row)
{
var trajectoryRow = new TrajectoryGeoFactDto
diff --git a/AsbCloudInfrastructure/Services/Trajectory/Import/TrajectoryParserService.cs b/AsbCloudInfrastructure/Services/Trajectory/Import/TrajectoryParserService.cs
index c5b1c0b0..c67bc409 100644
--- a/AsbCloudInfrastructure/Services/Trajectory/Import/TrajectoryParserService.cs
+++ b/AsbCloudInfrastructure/Services/Trajectory/Import/TrajectoryParserService.cs
@@ -1,7 +1,6 @@
using AsbCloudApp.Data.Trajectory;
using ClosedXML.Excel;
using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Linq;
@@ -12,15 +11,12 @@ namespace AsbCloudInfrastructure.Services.Trajectory.Import
{
public abstract string templateFileName { get; }
public abstract string usingTemplateFile { get; }
- public abstract string sheetNameTrajectory { get; }
+ public abstract string sheetName { get; }
public abstract int headerRowsCount { get; }
- public TrajectoryParserService()
- {
- }
protected abstract T ParseRow(IXLRow row);
- public IEnumerable ImportAsync(Stream stream)
+ public IEnumerable Import(Stream stream)
{
using var workbook = new XLWorkbook(stream, XLEventTracking.Disabled);
var trajectoryRows = ParseFileStream(stream);
@@ -37,9 +33,9 @@ namespace AsbCloudInfrastructure.Services.Trajectory.Import
private IEnumerable ParseWorkbook(IXLWorkbook workbook)
{
- var sheetTrajectory = workbook.Worksheets.FirstOrDefault(ws => ws.Name == sheetNameTrajectory);
+ var sheetTrajectory = workbook.Worksheets.FirstOrDefault(ws => ws.Name == sheetName);
if (sheetTrajectory is null)
- throw new FileFormatException($"Книга excel не содержит листа {sheetNameTrajectory}.");
+ throw new FileFormatException($"Книга excel не содержит листа {sheetName}.");
var trajectoryRows = ParseSheet(sheetTrajectory);
return trajectoryRows;
}
diff --git a/AsbCloudInfrastructure/Services/Trajectory/Import/TrajectoryPlannedParserService.cs b/AsbCloudInfrastructure/Services/Trajectory/Import/TrajectoryPlanParserService.cs
similarity index 74%
rename from AsbCloudInfrastructure/Services/Trajectory/Import/TrajectoryPlannedParserService.cs
rename to AsbCloudInfrastructure/Services/Trajectory/Import/TrajectoryPlanParserService.cs
index 4328dc32..00f3f197 100644
--- a/AsbCloudInfrastructure/Services/Trajectory/Import/TrajectoryPlannedParserService.cs
+++ b/AsbCloudInfrastructure/Services/Trajectory/Import/TrajectoryPlanParserService.cs
@@ -4,20 +4,13 @@ using ClosedXML.Excel;
namespace AsbCloudInfrastructure.Services.Trajectory.Import
{
- public class TrajectoryPlannedParserService : TrajectoryParserService
+ public class TrajectoryPlanParserService : TrajectoryParserService
{
- /*
- * password for PlannedTrajectoryTemplate.xlsx is Drill2022
- */
- public override string templateFileName { get; } = "TrajectoryPlannedTemplate.xlsx";
+ public override string templateFileName { get; } = "TrajectoryPlanTemplate.xlsx";
public override string usingTemplateFile { get; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
- public override string sheetNameTrajectory { get; } = "Плановая траектория";
+ public override string sheetName { get; } = "Плановая траектория";
public override int headerRowsCount { get; } = 2;
- public TrajectoryPlannedParserService() : base()
- {
- }
-
protected override TrajectoryGeoPlanDto ParseRow(IXLRow row)
{
var trajectoryRow = new TrajectoryGeoPlanDto
diff --git a/AsbCloudInfrastructure/Services/Trajectory/Templates/TrajectoryPlannedTemplate.xlsx b/AsbCloudInfrastructure/Services/Trajectory/Templates/TrajectoryPlanTemplate.xlsx
similarity index 100%
rename from AsbCloudInfrastructure/Services/Trajectory/Templates/TrajectoryPlannedTemplate.xlsx
rename to AsbCloudInfrastructure/Services/Trajectory/Templates/TrajectoryPlanTemplate.xlsx
diff --git a/AsbCloudInfrastructure/Services/Trajectory/Templates/password.md b/AsbCloudInfrastructure/Services/Trajectory/Templates/password.md
new file mode 100644
index 00000000..74caf50b
--- /dev/null
+++ b/AsbCloudInfrastructure/Services/Trajectory/Templates/password.md
@@ -0,0 +1 @@
+password for PlannedTrajectoryTemplate.xlsx is Drill2022
\ No newline at end of file
diff --git a/AsbCloudWebApi.Tests/UnitTests/Services/Trajectory/TrajectoryExportTest.cs b/AsbCloudWebApi.Tests/UnitTests/Services/Trajectory/TrajectoryExportTest.cs
index 08d83882..280b7392 100644
--- a/AsbCloudWebApi.Tests/UnitTests/Services/Trajectory/TrajectoryExportTest.cs
+++ b/AsbCloudWebApi.Tests/UnitTests/Services/Trajectory/TrajectoryExportTest.cs
@@ -1,6 +1,5 @@
using AsbCloudApp.Data.Trajectory;
using AsbCloudApp.Repositories;
-using AsbCloudApp.Requests;
using AsbCloudApp.Services;
using AsbCloudInfrastructure.Services.Trajectory.Export;
using NSubstitute;
@@ -14,8 +13,8 @@ namespace AsbCloudWebApi.Tests.UnitTests.Services.Trajectory
public class TrajectoryExportTest
{
private IWellService wellService;
- private readonly ITrajectoryEditableRepository trajectoryPlannedRepository;
- private readonly TrajectoryPlannedExportService trajectoryPlannedExportService;
+ private readonly ITrajectoryEditableRepository trajectoryPlanRepository;
+ private readonly TrajectoryPlanExportService trajectoryPlanExportService;
private readonly ITrajectoryEditableRepository trajectoryFactManualReposirory;
private readonly TrajectoryFactManualExportService trajectoryFactManualExportService;
@@ -25,7 +24,7 @@ namespace AsbCloudWebApi.Tests.UnitTests.Services.Trajectory
private readonly int idWell = 4;
- private readonly TrajectoryGeoPlanDto[] trajectoryPlannedRows = new TrajectoryGeoPlanDto[2] {
+ private readonly TrajectoryGeoPlanDto[] trajectoryPlanRows = new TrajectoryGeoPlanDto[2] {
new TrajectoryGeoPlanDto() {
Id = 1,
AzimuthGeo = 1,
@@ -84,8 +83,8 @@ namespace AsbCloudWebApi.Tests.UnitTests.Services.Trajectory
public TrajectoryExportTest()
{
wellService = Substitute.For();
- trajectoryPlannedRepository = Substitute.For>();
- trajectoryPlannedExportService = new TrajectoryPlannedExportService(wellService, trajectoryPlannedRepository);
+ trajectoryPlanRepository = Substitute.For>();
+ trajectoryPlanExportService = new TrajectoryPlanExportService(wellService, trajectoryPlanRepository);
trajectoryFactManualReposirory = Substitute.For>();
trajectoryFactManualExportService = new TrajectoryFactManualExportService(wellService, trajectoryFactManualReposirory);
@@ -97,10 +96,10 @@ namespace AsbCloudWebApi.Tests.UnitTests.Services.Trajectory
[Fact]
public async Task Export_trajectory_planned()
{
- trajectoryPlannedRepository.GetAsync(idWell, CancellationToken.None)
- .Returns(trajectoryPlannedRows);
+ trajectoryPlanRepository.GetAsync(idWell, CancellationToken.None)
+ .Returns(trajectoryPlanRows);
- var stream = await trajectoryPlannedExportService.ExportAsync(idWell, CancellationToken.None);
+ var stream = await trajectoryPlanExportService.ExportAsync(idWell, CancellationToken.None);
Assert.True(stream.Length > 0);
}
diff --git a/AsbCloudWebApi.Tests/UnitTests/Services/Trajectory/TrajectoryImportTest.cs b/AsbCloudWebApi.Tests/UnitTests/Services/Trajectory/TrajectoryImportTest.cs
index 54444d9b..00063ada 100644
--- a/AsbCloudWebApi.Tests/UnitTests/Services/Trajectory/TrajectoryImportTest.cs
+++ b/AsbCloudWebApi.Tests/UnitTests/Services/Trajectory/TrajectoryImportTest.cs
@@ -6,14 +6,14 @@ namespace AsbCloudWebApi.Tests.UnitTests.Services.Trajectory
{
public class TrajectoryImportTest
{
- private readonly TrajectoryPlannedParserService trajectoryPlannedImportService;
+ private readonly TrajectoryPlanParserService trajectoryPlanImportService;
private readonly TrajectoryFactManualParserService trajectoryFactManualImportService;
private string usingTemplateFile = "AsbCloudWebApi.Tests.Services.Trajectory.Templates";
public TrajectoryImportTest()
{
- trajectoryPlannedImportService = new TrajectoryPlannedParserService();
+ trajectoryPlanImportService = new TrajectoryPlanParserService();
trajectoryFactManualImportService = new TrajectoryFactManualParserService();
}
@@ -21,12 +21,12 @@ namespace AsbCloudWebApi.Tests.UnitTests.Services.Trajectory
public void Import_trajectory_planned()
{
var stream = System.Reflection.Assembly.GetExecutingAssembly()
- .GetManifestResourceStream($"{usingTemplateFile}.TrajectoryPlannedTemplate.xlsx");
+ .GetManifestResourceStream($"{usingTemplateFile}.TrajectoryPlanTemplate.xlsx");
if (stream is null)
Assert.Fail("Файла для импорта не существует");
- var trajectoryRows = trajectoryPlannedImportService.ImportAsync(stream);
+ var trajectoryRows = trajectoryPlanImportService.Import(stream);
Assert.Equal(3, trajectoryRows.Count());
}
@@ -40,7 +40,7 @@ namespace AsbCloudWebApi.Tests.UnitTests.Services.Trajectory
if (stream is null)
Assert.Fail("Файла для импорта не существует");
- var trajectoryRows = trajectoryFactManualImportService.ImportAsync(stream);
+ var trajectoryRows = trajectoryFactManualImportService.Import(stream);
Assert.Equal(4, trajectoryRows.Count());
}
diff --git a/AsbCloudWebApi/Controllers/Trajectory/TrajectoryEditableController.cs b/AsbCloudWebApi/Controllers/Trajectory/TrajectoryEditableController.cs
index 9afc825f..05764835 100644
--- a/AsbCloudWebApi/Controllers/Trajectory/TrajectoryEditableController.cs
+++ b/AsbCloudWebApi/Controllers/Trajectory/TrajectoryEditableController.cs
@@ -88,7 +88,7 @@ namespace AsbCloudWebApi.Controllers.Trajectory
try
{
- var trajectoryRows = trajectoryImportService.ImportAsync(stream);
+ var trajectoryRows = trajectoryImportService.Import(stream);
foreach (var row in trajectoryRows)
{
row.IdWell = idWell;
diff --git a/AsbCloudWebApi/Controllers/Trajectory/TrajectoryPlannedController.cs b/AsbCloudWebApi/Controllers/Trajectory/TrajectoryPlanController.cs
similarity index 85%
rename from AsbCloudWebApi/Controllers/Trajectory/TrajectoryPlannedController.cs
rename to AsbCloudWebApi/Controllers/Trajectory/TrajectoryPlanController.cs
index 33fd045a..3ca300ee 100644
--- a/AsbCloudWebApi/Controllers/Trajectory/TrajectoryPlannedController.cs
+++ b/AsbCloudWebApi/Controllers/Trajectory/TrajectoryPlanController.cs
@@ -15,15 +15,15 @@ namespace AsbCloudWebApi.Controllers.Trajectory
///
/// Плановая траектория (загрузка и хранение)
///
- [Route("api/well/{idWell}/plannedTrajectory")]
+ [Route("api/well/{idWell}/[controller]")]
[ApiController]
- public class TrajectoryPlannedController : TrajectoryEditableController
+ public class TrajectoryPlanController : TrajectoryEditableController
{
private readonly TrajectoryService trajectoryVisualizationService;
- public TrajectoryPlannedController(IWellService wellService,
- TrajectoryPlannedParserService plannedTrajectoryImportService,
- TrajectoryPlannedExportService plannedTrajectoryExportService,
+ public TrajectoryPlanController(IWellService wellService,
+ TrajectoryPlanParserService plannedTrajectoryImportService,
+ TrajectoryPlanExportService plannedTrajectoryExportService,
ITrajectoryEditableRepository plannedTrajectoryRepository,
TrajectoryService trajectoryVisualizationService)
: base(