diff --git a/AsbCloudApp/Data/Subsystems/SubsystemDto.cs b/AsbCloudApp/Data/Subsystems/SubsystemDto.cs
new file mode 100644
index 00000000..7bf2c0b6
--- /dev/null
+++ b/AsbCloudApp/Data/Subsystems/SubsystemDto.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AsbCloudApp.Data.Subsystems
+{
+ ///
+ /// Описание параметров подсистемы
+ ///
+ public class SubsystemDto : IId
+ {
+ ///
+ /// Идентификатор подсистемы
+ ///
+ public int Id { get; set; }
+ ///
+ /// Наименование подсистемы
+ ///
+ public string Name { get; set; }
+ ///
+ /// Детальное описание подсистемы
+ ///
+ public string Description { get; set; }
+ }
+}
diff --git a/AsbCloudApp/Data/Subsystems/SubsystemOperationTimeDto.cs b/AsbCloudApp/Data/Subsystems/SubsystemOperationTimeDto.cs
new file mode 100644
index 00000000..ccb923d7
--- /dev/null
+++ b/AsbCloudApp/Data/Subsystems/SubsystemOperationTimeDto.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AsbCloudApp.Data.Subsystems
+{
+ ///
+ /// Модель информации о работе подсистемы
+ ///
+ public class SubsystemOperationTimeDto:IId
+ {
+ ///
+ /// Идентификатор
+ ///
+ public int Id { get; set; }
+ ///
+ /// ИД телеметрии по которой выдается информация
+ ///
+ public int IdTelemetry { get; set; }
+ public TelemetryBaseDto Telemetry { get; set; }
+
+ ///
+ /// идентификатор подсистемы
+ ///
+ public int IdSubsystem { get; set; }
+ public SubsystemDto Subsystem { get; set; }
+ ///
+ /// дата/время включения подсистемы
+ ///
+ public DateTime DateStart { get; set; }
+ ///
+ /// дата/время выключения подсистемы
+ ///
+ public DateTime DateEnd { get; set; }
+ ///
+ /// глубина забоя на момент включения подсистемы
+ ///
+ public double DepthStart { get; set; }
+ ///
+ /// глубина забоя на момент выключения подсистемы
+ ///
+ public double DepthEnd { get; set; }
+
+
+ }
+}
diff --git a/AsbCloudApp/Data/Subsystems/SubsystemStatisticsDto.cs b/AsbCloudApp/Data/Subsystems/SubsystemStatisticsDto.cs
new file mode 100644
index 00000000..6363bf2c
--- /dev/null
+++ b/AsbCloudApp/Data/Subsystems/SubsystemStatisticsDto.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AsbCloudApp.Data.Subsystems
+{
+ ///
+ /// Статистика подсистемы
+ ///
+ public class SubsystemStatisticsDto
+ {
+
+ ///
+ /// Идентификатор подсистемы
+ ///
+ public int IdSubsystem { get; set; }
+ ///
+ /// Название подсистемы
+ ///
+ public string Subsystem { get; set; }
+ ///
+ /// наработка подсистемы
+ ///
+ public DateTime UsedTime { get; set; }
+ ///
+ /// коэффициент использования
+ ///
+ public TimeSpan KUsage { get; set; }
+ ///
+ /// коэффициент применения
+ ///
+ public TimeSpan K2 { get; set; }
+
+
+ }
+}
diff --git a/AsbCloudApp/Services/Subsystems/ISubsystemOperationTimeService.cs b/AsbCloudApp/Services/Subsystems/ISubsystemOperationTimeService.cs
new file mode 100644
index 00000000..44e0b2d4
--- /dev/null
+++ b/AsbCloudApp/Services/Subsystems/ISubsystemOperationTimeService.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AsbCloudApp.Services.Subsystems
+{
+ public interface ISubsystemOperationTimeService
+ {
+ }
+}
diff --git a/AsbCloudApp/Services/Subsystems/ISubsystemService.cs b/AsbCloudApp/Services/Subsystems/ISubsystemService.cs
new file mode 100644
index 00000000..c9a51954
--- /dev/null
+++ b/AsbCloudApp/Services/Subsystems/ISubsystemService.cs
@@ -0,0 +1,6 @@
+namespace AsbCloudApp.Services.Subsystems
+{
+ internal interface ISubsystemService
+ {
+ }
+}
diff --git a/AsbCloudApp/Services/Subsystems/ISubsystemStatisticsService.cs b/AsbCloudApp/Services/Subsystems/ISubsystemStatisticsService.cs
new file mode 100644
index 00000000..411baa9e
--- /dev/null
+++ b/AsbCloudApp/Services/Subsystems/ISubsystemStatisticsService.cs
@@ -0,0 +1,16 @@
+using AsbCloudApp.Data.Subsystems;
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace AsbCloudApp.Services.Subsystems
+{
+ public interface ISubsystemStatisticsService
+ {
+ Task> GetStatisticsAsync(CancellationToken token);
+ Task> GetPeriodStatisticsAsync(DateTime periodBegin,
+ DateTime periodEnd,
+ CancellationToken token = default);
+ }
+}
diff --git a/AsbCloudDb/Model/Subsystems/Subsystem.cs b/AsbCloudDb/Model/Subsystems/Subsystem.cs
new file mode 100644
index 00000000..b781d4cb
--- /dev/null
+++ b/AsbCloudDb/Model/Subsystems/Subsystem.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using Microsoft.EntityFrameworkCore;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace AsbCloudDb.Model.Subsystems
+{
+ [Table("t_subsystem"), Comment("Описание подсистем")]
+ public class Subsystem : IId
+ {
+ [Key]
+ [Column("id")]
+ public int Id { get; set; }
+
+ [Column("name")]
+ [StringLength(255)]
+ public string? Name { get; set; }
+
+ [Column("description")]
+ [StringLength(255)]
+ public string? Description { get; set; }
+ }
+
+}
diff --git a/AsbCloudDb/Model/Subsystems/SubsystemOperationTime.cs b/AsbCloudDb/Model/Subsystems/SubsystemOperationTime.cs
new file mode 100644
index 00000000..3e86ca6d
--- /dev/null
+++ b/AsbCloudDb/Model/Subsystems/SubsystemOperationTime.cs
@@ -0,0 +1,39 @@
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace AsbCloudDb.Model.Subsystems
+{
+ [Table("t_subsystem_operation_time"), Comment("наработки подсистем")]
+ public partial class SubsystemOperationTime : IId
+ {
+ [Key]
+ [Column("id")]
+ public int Id { get; set; }
+
+ [Column("id_telemetry"), Comment("ИД телеметрии по которой выдается информация")]
+ public int IdTelemetry { get; set; }
+
+ [Column("id_subsystem")]
+ public int IdSubsystem { get; set; }
+
+ [Column("date_end"), Comment("дата/время включения подсистемы")]
+ public DateTime DateStart { get; set; }
+ [Column("date_end"), Comment("дата/время выключения подсистемы")]
+ public DateTime DateEnd { get; set; }
+ [Column("depth_start"), Comment("глубина забоя на момент включения подсистемы")]
+ public double DepthStart { get; set; }
+ [Column("depth_end"), Comment("глубина забоя на момент выключения подсистемы")]
+ public double DepthEnd { get; set; }
+
+ [ForeignKey(nameof(IdSubsystem))]
+ public virtual Subsystem Subsystem { get; set; }
+
+ [ForeignKey(nameof(IdTelemetry))]
+ public virtual Telemetry Telemetry { get; set; }
+
+
+
+ }
+}
diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs
index c4cab363..de9a1889 100644
--- a/AsbCloudInfrastructure/DependencyInjection.cs
+++ b/AsbCloudInfrastructure/DependencyInjection.cs
@@ -1,7 +1,9 @@
using AsbCloudApp.Data;
using AsbCloudApp.Data.SAUB;
+using AsbCloudApp.Data.Subsystems;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
+using AsbCloudDb.Model.Subsystems;
using AsbCloudInfrastructure.Repository;
using AsbCloudInfrastructure.Services;
using AsbCloudInfrastructure.Services.Cache;
@@ -141,6 +143,8 @@ namespace AsbCloudInfrastructure
dbSet => dbSet
.Include(c => c.Wells)
.Include(c => c.Deposit))); // может быть включен в сервис ClusterService
+ // Subsystem service
+ services.AddTransient, CrudCacheServiceBase>();
services.AddTransient, CrudCacheServiceBase>();
diff --git a/AsbCloudInfrastructure/Services/Subsystems/SubsystemOperationTimeBackgroundService.cs b/AsbCloudInfrastructure/Services/Subsystems/SubsystemOperationTimeBackgroundService.cs
new file mode 100644
index 00000000..e4538522
--- /dev/null
+++ b/AsbCloudInfrastructure/Services/Subsystems/SubsystemOperationTimeBackgroundService.cs
@@ -0,0 +1,24 @@
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.Hosting;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace AsbCloudInfrastructure.Services.Subsystems
+{
+ internal class SubsystemOperationTimeBackgroundService : BackgroundService
+ {
+ private readonly string connectionString;
+ public SubsystemOperationTimeBackgroundService(IConfiguration configuration)
+ {
+ connectionString = configuration.GetConnectionString("DefaultConnection");
+ }
+ protected override Task ExecuteAsync(CancellationToken token)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/AsbCloudInfrastructure/Services/Subsystems/SubsystemOperationTimeService.cs b/AsbCloudInfrastructure/Services/Subsystems/SubsystemOperationTimeService.cs
new file mode 100644
index 00000000..d756aec6
--- /dev/null
+++ b/AsbCloudInfrastructure/Services/Subsystems/SubsystemOperationTimeService.cs
@@ -0,0 +1,14 @@
+using AsbCloudApp.Services.Subsystems;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AsbCloudInfrastructure.Services.Subsystems
+{
+ internal class SubsystemOperationTimeService: ISubsystemOperationTimeService
+ {
+
+ }
+}
diff --git a/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs b/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs
new file mode 100644
index 00000000..f740c5fa
--- /dev/null
+++ b/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs
@@ -0,0 +1,14 @@
+using AsbCloudApp.Data.Subsystems;
+using AsbCloudDb.Model;
+using AsbCloudDb.Model.Subsystems;
+using AsbCloudInfrastructure.Repository;
+
+namespace AsbCloudInfrastructure.Services.Subsystems
+{
+ internal class SubsystemService : CrudCacheServiceBase
+ {
+ public SubsystemService(IAsbCloudDbContext dbContext) : base(dbContext)
+ {
+ }
+ }
+}
diff --git a/AsbCloudInfrastructure/Services/Subsystems/SubsystemStatisticService.cs b/AsbCloudInfrastructure/Services/Subsystems/SubsystemStatisticService.cs
new file mode 100644
index 00000000..d083bf8b
--- /dev/null
+++ b/AsbCloudInfrastructure/Services/Subsystems/SubsystemStatisticService.cs
@@ -0,0 +1,30 @@
+using AsbCloudApp.Data.Subsystems;
+using AsbCloudApp.Services.Subsystems;
+using AsbCloudDb.Model;
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace AsbCloudInfrastructure.Services.Subsystems
+{
+ internal class SubsystemStatisticService : ISubsystemStatisticsService
+ {
+
+ private readonly IAsbCloudDbContext db;
+
+ public SubsystemStatisticService(IAsbCloudDbContext db)
+ {
+ this.db = db;
+ }
+ public Task> GetPeriodStatisticsAsync(DateTime periodBegin, DateTime periodEnd, CancellationToken token = default)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Task> GetStatisticsAsync(CancellationToken token)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/AsbCloudWebApi/Controllers/Subsystems/AdminSubsystemController.cs b/AsbCloudWebApi/Controllers/Subsystems/AdminSubsystemController.cs
new file mode 100644
index 00000000..3663f5df
--- /dev/null
+++ b/AsbCloudWebApi/Controllers/Subsystems/AdminSubsystemController.cs
@@ -0,0 +1,23 @@
+using AsbCloudApp.Data.Subsystems;
+using AsbCloudApp.Services;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+
+namespace AsbCloudWebApi.Controllers.Subsystems
+{
+ ///
+ /// Редактор подсистем для админки
+ ///
+ [Route("api/admin/subsystem")]
+ [ApiController]
+ [Authorize]
+ public class AdminSubsystemController : CrudController>
+ {
+ public AdminSubsystemController(ICrudService service)
+ : base(service)
+ {
+ }
+ }
+ }
+
diff --git a/AsbCloudWebApi/Controllers/Subsystems/OperatingTimeSubsystemController.cs b/AsbCloudWebApi/Controllers/Subsystems/OperatingTimeSubsystemController.cs
new file mode 100644
index 00000000..1e6d9451
--- /dev/null
+++ b/AsbCloudWebApi/Controllers/Subsystems/OperatingTimeSubsystemController.cs
@@ -0,0 +1,22 @@
+using AsbCloudApp.Data.Subsystems;
+using AsbCloudApp.Services;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace AsbCloudWebApi.Controllers.Subsystems
+{
+ ///
+ /// Наработка подсистем
+ ///
+ [Route("api/[OperatingTimeSubsystem]")]
+ [ApiController]
+ [Authorize]
+
+ public class OperatingTimeSubsystemController : ControllerBase
+ {
+ }
+ }
diff --git a/AsbCloudWebApi/Controllers/Subsystems/StatisticSubsystemsController.cs b/AsbCloudWebApi/Controllers/Subsystems/StatisticSubsystemsController.cs
new file mode 100644
index 00000000..1fafe82b
--- /dev/null
+++ b/AsbCloudWebApi/Controllers/Subsystems/StatisticSubsystemsController.cs
@@ -0,0 +1,94 @@
+using AsbCloudApp.Data.Subsystems;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace AsbCloudWebApi.Controllers.Subsystems
+{
+ ///
+ /// Статистика наработки подсистем
+ ///
+ [Route("api/statisticsSubsystem")]
+ [ApiController]
+ [Authorize]
+ public class StatisticSubsystemsController : ControllerBase
+ {
+
+ ///
+ /// получить без временного периода в запросе.
+ ///
+ [HttpGet]
+ [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)]
+ public async Task GetStatisticsAsync(CancellationToken token = default)
+ {
+ var subsystemResult = new List()
+ {
+ new SubsystemStatisticsDto(){
+ IdSubsystem = 1,
+ Subsystem = "test1",
+ UsedTime = System.DateTime.Now,
+ K2 = System.TimeSpan.MinValue,
+ KUsage = System.TimeSpan.MinValue
+
+ },
+ new SubsystemStatisticsDto(){
+ IdSubsystem = 2,
+ Subsystem = "test2",
+ UsedTime = System.DateTime.Now,
+ K2 = System.TimeSpan.Zero,
+ KUsage = System.TimeSpan.Zero
+ },
+ new SubsystemStatisticsDto(){
+ IdSubsystem = 3,
+ Subsystem = "test3",
+ UsedTime = System.DateTime.Now,
+ K2 = System.TimeSpan.MaxValue,
+ KUsage = System.TimeSpan.MaxValue
+ }
+ };
+
+ return Ok(subsystemResult);
+ }
+
+
+
+ //[HttpGet]
+ //[ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)]
+ //public async Task GetStatisticsPeriodAsync(CancellationToken token = default, DateTime dateBegin , DateTime dateEnd)
+ //{
+ // var subsystemResult = new List()
+ // {
+ // new SubsystemStatisticsDto(){
+ // IdSubsystem = 1,
+ // Subsystem = "test1",
+ // UsedTime = System.DateTime.Now,
+ // K2 = System.TimeSpan.MinValue,
+ // KUsage = System.TimeSpan.MinValue
+
+ // },
+ // new SubsystemStatisticsDto(){
+ // IdSubsystem = 2,
+ // Subsystem = "test2",
+ // UsedTime = System.DateTime.Now,
+ // K2 = System.TimeSpan.Zero,
+ // KUsage = System.TimeSpan.Zero
+ // },
+ // new SubsystemStatisticsDto(){
+ // IdSubsystem = 3,
+ // Subsystem = "test3",
+ // UsedTime = System.DateTime.Now,
+ // K2 = System.TimeSpan.MaxValue,
+ // KUsage = System.TimeSpan.MaxValue
+ // }
+ // };
+
+ // return Ok(subsystemResult);
+ //}
+
+
+ }
+}