From a137136e2143356ad53666341cf7fab17b528460 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Mon, 30 Sep 2024 09:56:34 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B0=20=D0=B1?= =?UTF-8?q?=D0=B0=D0=B3=D0=B0:=20=D0=B5=D1=81=D0=BB=D0=B8=20=D1=81=20?= =?UTF-8?q?=D1=84=D1=80=D0=BE=D0=BD=D1=82=D0=B0=20=D0=BD=D0=B5=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B8=D1=85=D0=BE=D0=B4=D0=B8=D1=82=20=D0=BF=D0=B5=D1=80?= =?UTF-8?q?=D0=B8=D0=BE=D0=B4=20=D0=B2=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?,=20=D1=82=D0=BE=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D0=B5=20?= =?UTF-8?q?=D0=BF=D0=BE=20=D0=BD=D0=B0=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BA?= =?UTF-8?q?=D0=B5=20=D1=81=D0=B8=D1=81=D1=82=D0=B5=D0=BC=20=D0=BD=D1=83?= =?UTF-8?q?=D0=B6=D0=BD=D0=BE=20=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20=D0=B7=D0=B0=20=D0=B2=D1=81=D1=91=20=D0=B2=D1=80=D0=B5?= =?UTF-8?q?=D0=BC=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudApp/Requests/SubsystemBaseRequest.cs | 6 +++--- AsbCloudApp/Requests/SubsystemPlanFactRequest.cs | 3 ++- .../Services/Subsystems/SubsystemService.cs | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/AsbCloudApp/Requests/SubsystemBaseRequest.cs b/AsbCloudApp/Requests/SubsystemBaseRequest.cs index a083d434..56cc3e76 100644 --- a/AsbCloudApp/Requests/SubsystemBaseRequest.cs +++ b/AsbCloudApp/Requests/SubsystemBaseRequest.cs @@ -9,7 +9,7 @@ namespace AsbCloudApp.Requests; /// public class SubsystemBaseRequest: RequestBase, IValidatableObject { - private static readonly DateTimeOffset validationMinDate = new DateTimeOffset(2020,01,01,0,0,0, TimeSpan.Zero); + public static readonly DateTimeOffset ValidationMinDate = new DateTimeOffset(2020,01,01,0,0,0, TimeSpan.Zero); /// /// Больше или равно дате @@ -34,9 +34,9 @@ public class SubsystemBaseRequest: RequestBase, IValidatableObject /// public IEnumerable Validate(ValidationContext validationContext) { - if (GeDate.HasValue && GeDate < validationMinDate) + if (GeDate.HasValue && GeDate < ValidationMinDate) yield return new ValidationResult( - $"Должно быть больше {validationMinDate:O})", + $"Должно быть больше {ValidationMinDate:O})", new[] { nameof(GeDate) }); if (LeDate.HasValue && GeDate.HasValue) diff --git a/AsbCloudApp/Requests/SubsystemPlanFactRequest.cs b/AsbCloudApp/Requests/SubsystemPlanFactRequest.cs index ba7d2566..52b8833f 100644 --- a/AsbCloudApp/Requests/SubsystemPlanFactRequest.cs +++ b/AsbCloudApp/Requests/SubsystemPlanFactRequest.cs @@ -13,5 +13,6 @@ public class SubsystemPlanFactRequest: SubsystemBaseRequest /// /// идентификаторы скважин /// - public IEnumerable IdsWell { get; set; } = Enumerable.Empty(); + [Required] + public IEnumerable IdsWell { get; set; } = null!; } diff --git a/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs b/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs index 05711fe0..f5acee31 100644 --- a/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs +++ b/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs @@ -142,8 +142,8 @@ public class SubsystemService : ISubsystemService .ToDictionary(t => t.Id, t => t.IdWell); var dtNow = DateTimeOffset.UtcNow; - var geDate = request.GeDate ?? new DateTimeOffset(dtNow.Date); - var leDate = request.LeDate ?? geDate.AddDays(1).AddMinutes(-1); + var geDate = request.GeDate ?? SubsystemPlanFactRequest.ValidationMinDate; + var leDate = request.LeDate ?? DateTimeOffset.UtcNow; var telemetryDataSaub = await telemetryDataSaubService.Get(telemetriesDict.Keys, false, geDate, leDate, 100_000, token); var groupedTelemetryDataSaub = telemetryDataSaub