diff --git a/AsbCloudApp/Data/WellSectionDto.cs b/AsbCloudApp/Data/WellSectionDto.cs index 1f86dbe7..bfe8c79a 100644 --- a/AsbCloudApp/Data/WellSectionDto.cs +++ b/AsbCloudApp/Data/WellSectionDto.cs @@ -2,20 +2,80 @@ { public class WellSectionDto { + public int Id { get; set; } + /// + /// Конструкция секции + /// public string SectionType { get; set; } + + /// + /// Глубина план, м + /// public double WellDepthPlan { get; set; } + + /// + /// Глубина факт, м + /// public double WellDepthFact { get; set; } + + /// + /// Период план, д + /// public double BuildDaysPlan { get; set; } + + /// + /// Период факт, д + /// public double BuildDaysFact { get; set; } + + /// + /// Механическая скорость проходки план, м/час + /// public double RateOfPenetrationPlan { get; set; } + + /// + /// Механическая скорость проходки факт, м/час + /// public double RateOfPenetrationFact { get; set; } + + /// + /// Рейсовая скорость план, м/час + /// public double RouteSpeedPlan { get; set; } + + /// + /// Рейсовая скорость план, м/час + /// public double RouteSpeedFact { get; set; } + + /// + /// Скорость подъема КНБК план + /// public double BhaUpSpeedPlan { get; set; } + + /// + /// Скорость подъема КНБК факт + /// public double BhaUpSpeedFact { get; set; } + + /// + /// Скорость спуска КНБК план + /// public double BhaDownSpeedPlan { get; set; } + + /// + /// Скорость спуска КНБК факт + /// public double BhaDownSpeedFact { get; set; } + + /// + /// Скорость спуска обсадной колонны план + /// public double CasingDownSpeedPlan { get; set; } + + /// + /// Скорость спуска обсадной колонны факт + /// public double CasingDownSpeedFact { get; set; } } } diff --git a/AsbCloudApp/Services/IWellService.cs b/AsbCloudApp/Services/IWellService.cs index aaf6012f..33fc5b81 100644 --- a/AsbCloudApp/Services/IWellService.cs +++ b/AsbCloudApp/Services/IWellService.cs @@ -7,7 +7,7 @@ namespace AsbCloudApp.Services { IEnumerable GetWellsByCompany(int idCompany); IEnumerable GetTransmittingWells(int idCompany); - bool IsCompanyOwnsWell(int idCompany, int idWell); + bool IsCompanyInvolvedInWell(int idCompany, int idWell); IEnumerable GetSections(int idWell); IEnumerable GetOperations(int idWell); } diff --git a/AsbCloudDb/Model/WellSection.cs b/AsbCloudDb/Model/WellSection.cs index 0fe88015..7930dcc0 100644 --- a/AsbCloudDb/Model/WellSection.cs +++ b/AsbCloudDb/Model/WellSection.cs @@ -20,28 +20,28 @@ namespace AsbCloudDb.Model [Column("id_well")] public int IdWell { get; set; } - [Column("well_depth_plan"), Comment("глубина план")] + [Column("well_depth_plan"), Comment("глубина план, м")] public double WellDepthPlan { get; set; } - [Column("well_depth_fact"), Comment("глубина факт")] + [Column("well_depth_fact"), Comment("глубина факт, м")] public double WellDepthFact { get; set; } - [Column("build_days_plan"), Comment("период план")] + [Column("build_days_plan"), Comment("период план, д")] public double BuildDaysPlan { get; set; } - [Column("build_days_fact"), Comment("период факт")] + [Column("build_days_fact"), Comment("период факт, д")] public double BuildDaysFact { get; set; } - [Column("rate_of_penetration_plan"), Comment("Механическая скорость проходки план")] + [Column("rate_of_penetration_plan"), Comment("Механическая скорость проходки план, м/час")] public double RateOfPenetrationPlan { get; set; } - [Column("rate_of_penetration_fact"), Comment("Механическая скорость проходки факт")] + [Column("rate_of_penetration_fact"), Comment("Механическая скорость проходки факт, м/час")] public double RateOfPenetrationFact { get; set; } - [Column("route_speed_plan"), Comment("Рейсовая скорость план")] + [Column("route_speed_plan"), Comment("Рейсовая скорость план, м/час")] public double RouteSpeedPlan { get; set; } - [Column("route_speed_fact"), Comment("Рейсовая скорость факт")] + [Column("route_speed_fact"), Comment("Рейсовая скорость факт, м/час")] public double RouteSpeedFact { get; set; } [Column("bha_down_speed_plan"), Comment("Скорость спуска КНБК план")] @@ -56,10 +56,10 @@ namespace AsbCloudDb.Model [Column("bha_up_speed_fact"), Comment("Скорость подъема КНБК факт")] public double BhaUpSpeedFact { get; set; } - [Column("casing_down_speed_plan"), Comment("Скорость спуска ОК план")] + [Column("casing_down_speed_plan"), Comment("Скорость спуска обсадной колонны план")] public double CasingDownSpeedPlan { get; set; } - [Column("casing_down_speed_fact"), Comment("Скорость спуска ОК факт")] + [Column("casing_down_speed_fact"), Comment("Скорость спуска обсадной колонны факт")] public double CasingDownSpeedFact { get; set; } [JsonIgnore] diff --git a/AsbCloudInfrastructure/Services/WellService.cs b/AsbCloudInfrastructure/Services/WellService.cs index 511fb92a..3a625b5e 100644 --- a/AsbCloudInfrastructure/Services/WellService.cs +++ b/AsbCloudInfrastructure/Services/WellService.cs @@ -41,10 +41,9 @@ namespace AsbCloudInfrastructure.Services return wells.Select(w => From(w)); } - public bool IsCompanyOwnsWell(int idCompany, int idWell) + public bool IsCompanyInvolvedInWell(int idCompany, int idWell) => cacheRelationCompaniesWells.Contains(r => r.IdWell == idWell && r.IdCompany == idCompany); - public IEnumerable GetSections(int idWell) { var entities = db diff --git a/AsbCloudWebApi.Tests/ControllersTests/AnalyticsControllerTests.cs b/AsbCloudWebApi.Tests/ControllersTests/AnalyticsControllerTests.cs index f31752f8..2a6d742e 100644 --- a/AsbCloudWebApi.Tests/ControllersTests/AnalyticsControllerTests.cs +++ b/AsbCloudWebApi.Tests/ControllersTests/AnalyticsControllerTests.cs @@ -34,7 +34,7 @@ namespace AsbCloudWebApi.Tests.ControllersTests analyticsService.Setup(s => s.GetWellDepthToDay(It.IsAny())) .Returns(depthToDayDtos); - wellService.Setup(s => s.IsCompanyOwnsWell(It.IsAny(), It.IsAny())) + wellService.Setup(s => s.IsCompanyInvolvedInWell(It.IsAny(), It.IsAny())) .Returns(true); controller = new AnalyticsController(analyticsService.Object, @@ -94,7 +94,7 @@ namespace AsbCloudWebApi.Tests.ControllersTests { var wellServiceReturnsFalse = new Mock(); - wellServiceReturnsFalse.Setup(s => s.IsCompanyOwnsWell(It.IsAny(), It.IsAny())) + wellServiceReturnsFalse.Setup(s => s.IsCompanyInvolvedInWell(It.IsAny(), It.IsAny())) .Returns(false); var newControllerInstance = new AnalyticsController(analyticsService.Object, diff --git a/AsbCloudWebApi/Controllers/AnalyticsController.cs b/AsbCloudWebApi/Controllers/AnalyticsController.cs index 063c65f8..0e25e482 100644 --- a/AsbCloudWebApi/Controllers/AnalyticsController.cs +++ b/AsbCloudWebApi/Controllers/AnalyticsController.cs @@ -40,7 +40,7 @@ namespace AsbCloudWebApi.Controllers { int? idCompany = User.GetCompanyId(); - if (idCompany is null || !wellService.IsCompanyOwnsWell((int)idCompany, idWell)) + if (idCompany is null || !wellService.IsCompanyInvolvedInWell((int)idCompany, idWell)) return Forbid(); var analytics = analyticsService.GetOperationsByWell(idWell, categoryIds, begin, end, skip, take); @@ -63,7 +63,7 @@ namespace AsbCloudWebApi.Controllers { int? idCompany = User.GetCompanyId(); - if (idCompany is null || !wellService.IsCompanyOwnsWell((int)idCompany, idWell)) + if (idCompany is null || !wellService.IsCompanyInvolvedInWell((int)idCompany, idWell)) return Forbid(); var wellDepthToDayData = analyticsService.GetWellDepthToDay(idWell); @@ -89,7 +89,7 @@ namespace AsbCloudWebApi.Controllers { int? idCompany = User.GetCompanyId(); - if (idCompany is null || !wellService.IsCompanyOwnsWell((int)idCompany, idWell)) + if (idCompany is null || !wellService.IsCompanyInvolvedInWell((int)idCompany, idWell)) return Forbid(); var wellDepthToIntervalData = analyticsService.GetWellDepthToInterval(idWell, @@ -115,7 +115,7 @@ namespace AsbCloudWebApi.Controllers { int? idCompany = User.GetCompanyId(); - if (idCompany is null || !wellService.IsCompanyOwnsWell((int)idCompany, idWell)) + if (idCompany is null || !wellService.IsCompanyInvolvedInWell((int)idCompany, idWell)) return Forbid(); var analytics = analyticsService.GetOperationsSummary(idWell, begin, end); @@ -141,7 +141,7 @@ namespace AsbCloudWebApi.Controllers { int? idCompany = User.GetCompanyId(); - if (idCompany is null || !wellService.IsCompanyOwnsWell((int)idCompany, idWell)) + if (idCompany is null || !wellService.IsCompanyInvolvedInWell((int)idCompany, idWell)) return Forbid(); var analytics = analyticsService.GetOperationsToInterval(idWell, intervalSeconds, workBeginSeconds); diff --git a/AsbCloudWebApi/Controllers/DataController.cs b/AsbCloudWebApi/Controllers/DataController.cs index 3ff466b5..059f2674 100644 --- a/AsbCloudWebApi/Controllers/DataController.cs +++ b/AsbCloudWebApi/Controllers/DataController.cs @@ -59,7 +59,7 @@ namespace AsbCloudWebApi.Controllers if (idCompany is null) return Forbid(); - bool isCompanyOwnsWell = wellService.IsCompanyOwnsWell((int)idCompany, idWell); + bool isCompanyOwnsWell = wellService.IsCompanyInvolvedInWell((int)idCompany, idWell); if (!isCompanyOwnsWell) return Forbid(); diff --git a/AsbCloudWebApi/Controllers/FileController.cs b/AsbCloudWebApi/Controllers/FileController.cs index 46b82133..7b7be3d7 100644 --- a/AsbCloudWebApi/Controllers/FileController.cs +++ b/AsbCloudWebApi/Controllers/FileController.cs @@ -42,7 +42,7 @@ namespace AsbCloudWebApi.Controllers if (idCompany is null) return Forbid(); - if (!wellService.IsCompanyOwnsWell((int)idCompany, idWell)) + if (!wellService.IsCompanyInvolvedInWell((int)idCompany, idWell)) return Forbid(); var fileInfoCollection = files.Select(f => @@ -87,7 +87,7 @@ namespace AsbCloudWebApi.Controllers { int? idCompany = User.GetCompanyId(); - if (idCompany is null || !wellService.IsCompanyOwnsWell((int)idCompany, idWell)) + if (idCompany is null || !wellService.IsCompanyInvolvedInWell((int)idCompany, idWell)) return Forbid(); var filesInfo = fileService.GetFilesInfo(idWell, idCategory, @@ -117,7 +117,7 @@ namespace AsbCloudWebApi.Controllers if (idCompany is null) return Forbid(); - if (!wellService.IsCompanyOwnsWell((int)idCompany, idWell)) + if (!wellService.IsCompanyInvolvedInWell((int)idCompany, idWell)) return Forbid(); var fileInfo = fileService.GetFileInfo(fileId); diff --git a/AsbCloudWebApi/Controllers/MessageController.cs b/AsbCloudWebApi/Controllers/MessageController.cs index 3172afba..7e35a6cf 100644 --- a/AsbCloudWebApi/Controllers/MessageController.cs +++ b/AsbCloudWebApi/Controllers/MessageController.cs @@ -58,7 +58,7 @@ namespace AsbCloudWebApi.Controllers if (idCompany is null) return Forbid(); - bool isCompanyOwnsWell = wellService.IsCompanyOwnsWell((int)idCompany, idWell); + bool isCompanyOwnsWell = wellService.IsCompanyInvolvedInWell((int)idCompany, idWell); if (!isCompanyOwnsWell) return Forbid(); diff --git a/AsbCloudWebApi/Controllers/ReportController.cs b/AsbCloudWebApi/Controllers/ReportController.cs index a5d5f0a0..3e278a9e 100644 --- a/AsbCloudWebApi/Controllers/ReportController.cs +++ b/AsbCloudWebApi/Controllers/ReportController.cs @@ -72,7 +72,7 @@ namespace AsbCloudWebApi.Controllers if (idCompany is null) return Forbid(); - if (!wellService.IsCompanyOwnsWell((int)idCompany, idWell)) + if (!wellService.IsCompanyInvolvedInWell((int)idCompany, idWell)) return Forbid(); var id = reportService.CreateReport(idWell, idUser, @@ -99,7 +99,7 @@ namespace AsbCloudWebApi.Controllers if (idCompany is null) return Forbid(); - if (!wellService.IsCompanyOwnsWell((int)idCompany, idWell)) + if (!wellService.IsCompanyInvolvedInWell((int)idCompany, idWell)) return Forbid(); // TODO: словарь content typoв var relativePath = Path.Combine(fileService.RootPath, $"{idWell}", @@ -155,7 +155,7 @@ namespace AsbCloudWebApi.Controllers if (idCompany is null) return Forbid(); - if (!wellService.IsCompanyOwnsWell((int)idCompany, idWell)) + if (!wellService.IsCompanyInvolvedInWell((int)idCompany, idWell)) return Forbid(); int reportSize = reportService.GetReportPagesCount(idWell, begin, end, stepSeconds, format); @@ -178,7 +178,7 @@ namespace AsbCloudWebApi.Controllers if (idCompany is null) return Forbid(); - if (!wellService.IsCompanyOwnsWell((int)idCompany, idWell)) + if (!wellService.IsCompanyInvolvedInWell((int)idCompany, idWell)) return Forbid(); DatesRangeDto wellReportsDatesRange = reportService.GetReportsDatesRange(idWell); diff --git a/AsbCloudWebApi/Controllers/WellController.cs b/AsbCloudWebApi/Controllers/WellController.cs index 75ca4011..fa95451f 100644 --- a/AsbCloudWebApi/Controllers/WellController.cs +++ b/AsbCloudWebApi/Controllers/WellController.cs @@ -47,7 +47,7 @@ namespace AsbCloudWebApi.Controllers if (idCompany is null) return NoContent(); - if (wellService.IsCompanyOwnsWell((int)idCompany, idWell)) + if (!wellService.IsCompanyInvolvedInWell((int)idCompany, idWell)) return Forbid(); var dto = wellService.GetSections(idWell); @@ -64,7 +64,7 @@ namespace AsbCloudWebApi.Controllers if (idCompany is null) return NoContent(); - if (wellService.IsCompanyOwnsWell((int)idCompany, idWell)) + if (!wellService.IsCompanyInvolvedInWell((int)idCompany, idWell)) return Forbid(); var dto = wellService.GetOperations(idWell);