From c8c504b3be0650c3313ccb8c15f3ebaf3fc0a6f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9E=D0=BB=D1=8F=20=D0=91=D0=B8=D0=B7=D1=8E=D0=BA=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0?= Date: Thu, 23 May 2024 14:07:40 +0500 Subject: [PATCH 1/6] =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BD=D0=B0=20?= =?UTF-8?q?=D1=87=D0=B0=D1=81=D1=82=D1=8C=20warnings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudApp/Data/DataSaubStatDto.cs | 3 +++ .../Data/ProcessMaps/ProcessMapPlanReamDto.cs | 2 +- AsbCloudApp/Data/Progress/ReportProgressDto.cs | 2 +- .../Data/WellOperation/WellOperationDto.cs | 3 +++ AsbCloudApp/Services/ITelemetryService.cs | 7 +++++++ AsbCloudInfrastructure/MemoryCacheExtentions.cs | 17 +++++++++++++---- AsbCloudInfrastructure/Repository/CacheBase.cs | 2 +- .../Repository/NotificationRepository.cs | 2 +- .../Services/Email/BaseFactory.cs | 8 ++++---- .../Services/Email/DrillingMailBodyFactory.cs | 4 ++-- .../Email/EmailNotificationTransportService.cs | 6 +++--- .../Email/WellFinalDocumentMailBodyFactory .cs | 2 +- .../Services/HelpPageService.cs | 2 +- .../Services/ManualCatalogService.cs | 2 +- .../Services/MeasureService.cs | 2 +- .../Services/ReduceSamplingService.cs | 2 +- .../Services/SAUB/TelemetryUserService.cs | 2 +- .../Clients/IDrillTestControllerClient.cs | 2 +- .../DetectedOperationControllerTests.cs | 3 --- .../ProcessMapReportDrillingControllerTest.cs | 2 +- .../WellOperationControllerTest.cs | 8 +++----- .../Background/BackgroundWorkerTest.cs | 6 +++--- .../Services/HelpPageServiceTest.cs | 12 ++++++------ .../EmailNotificationTransportServiceTests.cs | 2 +- AsbCloudWebApi/Controllers/DrillerController.cs | 4 ++-- AsbCloudWebApi/Extensions.cs | 2 +- 26 files changed, 63 insertions(+), 46 deletions(-) diff --git a/AsbCloudApp/Data/DataSaubStatDto.cs b/AsbCloudApp/Data/DataSaubStatDto.cs index ceae4f9d..30a09081 100644 --- a/AsbCloudApp/Data/DataSaubStatDto.cs +++ b/AsbCloudApp/Data/DataSaubStatDto.cs @@ -3,6 +3,9 @@ using AsbCloudApp.Data.WellOperation; namespace AsbCloudApp.Data { + /// + /// dto для хранения данных статистики сауб + /// public class DataSaubStatDto:IId { /// diff --git a/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanReamDto.cs b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanReamDto.cs index 9d6438dc..853a7fcd 100644 --- a/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanReamDto.cs +++ b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanReamDto.cs @@ -72,7 +72,7 @@ public class ProcessMapPlanReamDto : ProcessMapPlanBaseDto, IValidatableObject public double Torque { get; set; } /// - public IEnumerable Validate(ValidationContext validationContext) + public override IEnumerable Validate(ValidationContext validationContext) { if (DepthEnd < DepthStart) yield return new ValidationResult( diff --git a/AsbCloudApp/Data/Progress/ReportProgressDto.cs b/AsbCloudApp/Data/Progress/ReportProgressDto.cs index b14166e9..400b6c9f 100644 --- a/AsbCloudApp/Data/Progress/ReportProgressDto.cs +++ b/AsbCloudApp/Data/Progress/ReportProgressDto.cs @@ -8,5 +8,5 @@ public class ReportProgressFinalDto : ReportProgressDto /// /// файл /// - public FileInfoDto file { get; set; } + public FileInfoDto? file { get; set; } } diff --git a/AsbCloudApp/Data/WellOperation/WellOperationDto.cs b/AsbCloudApp/Data/WellOperation/WellOperationDto.cs index 17015451..6a0a473e 100644 --- a/AsbCloudApp/Data/WellOperation/WellOperationDto.cs +++ b/AsbCloudApp/Data/WellOperation/WellOperationDto.cs @@ -4,6 +4,9 @@ using System.ComponentModel.DataAnnotations; namespace AsbCloudApp.Data.WellOperation; +/// +/// Операция по скважине +/// public class WellOperationDto : ItemInfoDto, IId, IWellRelated, diff --git a/AsbCloudApp/Services/ITelemetryService.cs b/AsbCloudApp/Services/ITelemetryService.cs index 576086e6..a981be33 100644 --- a/AsbCloudApp/Services/ITelemetryService.cs +++ b/AsbCloudApp/Services/ITelemetryService.cs @@ -70,6 +70,13 @@ namespace AsbCloudApp.Services /// /// Task MergeAsync(int from, int to, CancellationToken token); + + /// + /// Получить телеметрию по последней дате + /// + /// + /// + /// Task GetTelemetriesInfoByLastData(DateTimeOffset from, CancellationToken token); } } \ No newline at end of file diff --git a/AsbCloudInfrastructure/MemoryCacheExtentions.cs b/AsbCloudInfrastructure/MemoryCacheExtentions.cs index 0153778a..eb57af3f 100644 --- a/AsbCloudInfrastructure/MemoryCacheExtentions.cs +++ b/AsbCloudInfrastructure/MemoryCacheExtentions.cs @@ -47,13 +47,17 @@ namespace AsbCloudInfrastructure public static Task> GetOrCreateBasicAsync(this IMemoryCache memoryCache, Func>> getterAsync, CancellationToken token) { var key = typeof(T).FullName; - var cache = memoryCache.GetOrCreateAsync(key, async (cacheEntry) => { + if (key == null) + return Task.FromResult(Enumerable.Empty()); + + var cache = memoryCache.GetOrCreateAsync(key, async (cacheEntry) => + { cacheEntry.AbsoluteExpirationRelativeToNow = CacheOlescence; cacheEntry.SlidingExpiration = CacheOlescence; var entities = await getterAsync(token); return entities; }); - return cache; + return cache!; } /// @@ -84,12 +88,13 @@ namespace AsbCloudInfrastructure public static IEnumerable GetOrCreateBasic(this IMemoryCache memoryCache, Func> getter) { var key = typeof(T).FullName; - var cache = memoryCache.GetOrCreate(key, cacheEntry => { + var cache = memoryCache.GetOrCreate(key, cacheEntry => + { cacheEntry.AbsoluteExpirationRelativeToNow = CacheOlescence; cacheEntry.SlidingExpiration = CacheOlescence; return getter(); }); - return cache; + return cache!; } /// @@ -102,6 +107,10 @@ namespace AsbCloudInfrastructure where T : class { var key = typeof(T).FullName; + + if (key == null) + return; + memoryCache.Remove(key); } } diff --git a/AsbCloudInfrastructure/Repository/CacheBase.cs b/AsbCloudInfrastructure/Repository/CacheBase.cs index 84f702df..53ac0b93 100644 --- a/AsbCloudInfrastructure/Repository/CacheBase.cs +++ b/AsbCloudInfrastructure/Repository/CacheBase.cs @@ -43,7 +43,7 @@ namespace AsbCloudInfrastructure.Repository cacheEntry.Value = entities; return entities; }); - return cache; + return cache!; } protected virtual Task> GetCacheAsync(CancellationToken token) diff --git a/AsbCloudInfrastructure/Repository/NotificationRepository.cs b/AsbCloudInfrastructure/Repository/NotificationRepository.cs index 7e184f02..ae2ec649 100644 --- a/AsbCloudInfrastructure/Repository/NotificationRepository.cs +++ b/AsbCloudInfrastructure/Repository/NotificationRepository.cs @@ -77,7 +77,7 @@ public class NotificationRepository : CrudRepositoryBase UpdateRangeAsync(IEnumerable notifications, CancellationToken cancellationToken) + public override async Task UpdateRangeAsync(IEnumerable notifications, CancellationToken cancellationToken) { if (!notifications.Any()) return 0; diff --git a/AsbCloudInfrastructure/Services/Email/BaseFactory.cs b/AsbCloudInfrastructure/Services/Email/BaseFactory.cs index 11c8feaa..c0431016 100644 --- a/AsbCloudInfrastructure/Services/Email/BaseFactory.cs +++ b/AsbCloudInfrastructure/Services/Email/BaseFactory.cs @@ -16,10 +16,10 @@ namespace AsbCloudInfrastructure.Services.Email public BaseFactory(IConfiguration configuration) { - platformName = configuration.GetValue("email:platformName", "Цифровое бурение"); - platformUrl = configuration.GetValue("email:platformUrl", "https://cloud.digitaldrilling.ru/"); - companyName = configuration.GetValue("email:companyName", "ООО \"Цифровое бурение\""); - supportMail = configuration.GetValue("email:supportMail", "support@digitaldrilling.ru"); + platformName = configuration.GetValue("email:platformName", "Цифровое бурение") ?? string.Empty; + platformUrl = configuration.GetValue("email:platformUrl", "https://cloud.digitaldrilling.ru/") ?? string.Empty; + companyName = configuration.GetValue("email:companyName", "ООО \"Цифровое бурение\"") ?? string.Empty; + supportMail = configuration.GetValue("email:supportMail", "support@digitaldrilling.ru") ?? string.Empty; } public static string GetOrEmptyImageBase64(string resourceFileName) diff --git a/AsbCloudInfrastructure/Services/Email/DrillingMailBodyFactory.cs b/AsbCloudInfrastructure/Services/Email/DrillingMailBodyFactory.cs index ba0da560..d1371110 100644 --- a/AsbCloudInfrastructure/Services/Email/DrillingMailBodyFactory.cs +++ b/AsbCloudInfrastructure/Services/Email/DrillingMailBodyFactory.cs @@ -12,8 +12,8 @@ namespace AsbCloudInfrastructure.Services.Email public DrillingMailBodyFactory(IConfiguration configuration) : base(configuration) { - platformName = configuration.GetValue("email:platformName", "Цифровое бурение"); - platformUrl = configuration.GetValue("email:platformUrl", "https://cloud.digitaldrilling.ru/"); + platformName = configuration.GetValue("email:platformName", "Цифровое бурение") ?? string.Empty; + platformUrl = configuration.GetValue("email:platformUrl", "https://cloud.digitaldrilling.ru/") ?? string.Empty; } public override string MakeSubject(WellDto well, string action) diff --git a/AsbCloudInfrastructure/Services/Email/EmailNotificationTransportService.cs b/AsbCloudInfrastructure/Services/Email/EmailNotificationTransportService.cs index 2eec7b27..88fbe691 100644 --- a/AsbCloudInfrastructure/Services/Email/EmailNotificationTransportService.cs +++ b/AsbCloudInfrastructure/Services/Email/EmailNotificationTransportService.cs @@ -29,9 +29,9 @@ namespace AsbCloudInfrastructure.Services.Email { this.userRepository = userRepository; - this.sender = configuration.GetValue("email:sender", string.Empty); - this.smtpPassword = configuration.GetValue("email:password", string.Empty); - this.smtpServer = configuration.GetValue("email:smtpServer", string.Empty); + this.sender = configuration.GetValue("email:sender", string.Empty) ?? string.Empty; + this.smtpPassword = configuration.GetValue("email:password", string.Empty) ?? string.Empty; + this.smtpServer = configuration.GetValue("email:smtpServer", string.Empty) ?? string.Empty; var configError = string.IsNullOrEmpty(this.sender) || string.IsNullOrEmpty(this.smtpPassword) || diff --git a/AsbCloudInfrastructure/Services/Email/WellFinalDocumentMailBodyFactory .cs b/AsbCloudInfrastructure/Services/Email/WellFinalDocumentMailBodyFactory .cs index 751ab042..814923fe 100644 --- a/AsbCloudInfrastructure/Services/Email/WellFinalDocumentMailBodyFactory .cs +++ b/AsbCloudInfrastructure/Services/Email/WellFinalDocumentMailBodyFactory .cs @@ -14,7 +14,7 @@ namespace AsbCloudInfrastructure public WellFinalDocumentMailBodyFactory(IConfiguration configuration) : base(configuration) { - platformName = configuration.GetValue("email:platformName", "Цифровое бурение"); + platformName = configuration.GetValue("email:platformName", "Цифровое бурение") ?? string.Empty; } public override string MakeSubject(WellDto well, string action) diff --git a/AsbCloudInfrastructure/Services/HelpPageService.cs b/AsbCloudInfrastructure/Services/HelpPageService.cs index 396ca595..45d4d18d 100644 --- a/AsbCloudInfrastructure/Services/HelpPageService.cs +++ b/AsbCloudInfrastructure/Services/HelpPageService.cs @@ -30,7 +30,7 @@ public class HelpPageService : IHelpPageService { this.helpPageRepository = helpPageRepository; this.fileStorageRepository = fileStorageRepository; - directoryNameHelpPageFiles = configuration.GetValue("DirectoryNameHelpPageFiles"); + directoryNameHelpPageFiles = configuration.GetValue("DirectoryNameHelpPageFiles") ?? string.Empty; if (string.IsNullOrWhiteSpace(directoryNameHelpPageFiles)) directoryNameHelpPageFiles = "helpPages"; diff --git a/AsbCloudInfrastructure/Services/ManualCatalogService.cs b/AsbCloudInfrastructure/Services/ManualCatalogService.cs index 8c779bc7..7776a4ef 100644 --- a/AsbCloudInfrastructure/Services/ManualCatalogService.cs +++ b/AsbCloudInfrastructure/Services/ManualCatalogService.cs @@ -35,7 +35,7 @@ public class ManualCatalogService : IManualCatalogService this.fileStorageRepository = fileStorageRepository; this.manualDirectoryRepository = manualDirectoryRepository; this.manualRepository = manualRepository; - directoryFiles = configuration.GetValue("DirectoryManualFiles"); + directoryFiles = configuration.GetValue("DirectoryManualFiles") ?? string.Empty; if (string.IsNullOrWhiteSpace(directoryFiles)) directoryFiles = "manuals"; diff --git a/AsbCloudInfrastructure/Services/MeasureService.cs b/AsbCloudInfrastructure/Services/MeasureService.cs index 7a349450..a291a8c1 100644 --- a/AsbCloudInfrastructure/Services/MeasureService.cs +++ b/AsbCloudInfrastructure/Services/MeasureService.cs @@ -38,7 +38,7 @@ namespace AsbCloudInfrastructure.Services .ToDictionaryAsync(e => e.Id, e => e.Name, token); return entities; }); - return cache; + return cache!; } public async Task GetLastOrDefaultAsync(int idWell, int idCategory, CancellationToken token) diff --git a/AsbCloudInfrastructure/Services/ReduceSamplingService.cs b/AsbCloudInfrastructure/Services/ReduceSamplingService.cs index b7581ad9..7fc7e19c 100644 --- a/AsbCloudInfrastructure/Services/ReduceSamplingService.cs +++ b/AsbCloudInfrastructure/Services/ReduceSamplingService.cs @@ -36,7 +36,7 @@ namespace AsbCloudInfrastructure.Services private ReduceSamplingService(IConfiguration configuration) { - connectionString = configuration.GetConnectionString("DefaultConnection"); + connectionString = configuration.GetConnectionString("DefaultConnection") ?? string.Empty; } ~ReduceSamplingService() diff --git a/AsbCloudInfrastructure/Services/SAUB/TelemetryUserService.cs b/AsbCloudInfrastructure/Services/SAUB/TelemetryUserService.cs index 20b53c43..b9efeb11 100644 --- a/AsbCloudInfrastructure/Services/SAUB/TelemetryUserService.cs +++ b/AsbCloudInfrastructure/Services/SAUB/TelemetryUserService.cs @@ -84,7 +84,7 @@ namespace AsbCloudInfrastructure.Services.SAUB var entities = db.Set().ToArray(); return entities; }); - return cache; + return cache!; } private void DropCache() diff --git a/AsbCloudWebApi.IntegrationTests/Clients/IDrillTestControllerClient.cs b/AsbCloudWebApi.IntegrationTests/Clients/IDrillTestControllerClient.cs index ba622557..fa1cd81e 100644 --- a/AsbCloudWebApi.IntegrationTests/Clients/IDrillTestControllerClient.cs +++ b/AsbCloudWebApi.IntegrationTests/Clients/IDrillTestControllerClient.cs @@ -21,7 +21,7 @@ public interface IDrillTestControllerClient int id, CancellationToken cancellationToken); - [HttpGet("/api/well/{idWell}/DrillTest/all")] + [Get("/api/well/{idWell}/DrillTest/all")] Task>> GetListAsync( int idWell, FileReportRequest request, diff --git a/AsbCloudWebApi.IntegrationTests/Controllers/DetectedOperationControllerTests.cs b/AsbCloudWebApi.IntegrationTests/Controllers/DetectedOperationControllerTests.cs index 5f518884..7b8a08a9 100644 --- a/AsbCloudWebApi.IntegrationTests/Controllers/DetectedOperationControllerTests.cs +++ b/AsbCloudWebApi.IntegrationTests/Controllers/DetectedOperationControllerTests.cs @@ -55,7 +55,6 @@ public class DetectedOperationControllerTests : BaseIntegrationTest //assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); - Assert.NotNull(response.Content); Assert.Equal(1, response.Content); } @@ -76,7 +75,6 @@ public class DetectedOperationControllerTests : BaseIntegrationTest //assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); - Assert.NotNull(response.Content); Assert.Equal(1, response.Content); } @@ -112,7 +110,6 @@ public class DetectedOperationControllerTests : BaseIntegrationTest //assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); - Assert.NotNull(response.Content); Assert.Equal(1, response.Content); } diff --git a/AsbCloudWebApi.IntegrationTests/Controllers/ProcessMapPlan/ProcessMapReportDrillingControllerTest.cs b/AsbCloudWebApi.IntegrationTests/Controllers/ProcessMapPlan/ProcessMapReportDrillingControllerTest.cs index 7de0acd5..07685f1e 100644 --- a/AsbCloudWebApi.IntegrationTests/Controllers/ProcessMapPlan/ProcessMapReportDrillingControllerTest.cs +++ b/AsbCloudWebApi.IntegrationTests/Controllers/ProcessMapPlan/ProcessMapReportDrillingControllerTest.cs @@ -77,7 +77,7 @@ public class ProcessMapReportDrillingControllerTest : BaseIntegrationTest //assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.NotNull(response.Content); - Assert.Equal(1, response.Content.Count()); + Assert.Single(response.Content); } [Fact] diff --git a/AsbCloudWebApi.IntegrationTests/Controllers/WellOperations/WellOperationControllerTest.cs b/AsbCloudWebApi.IntegrationTests/Controllers/WellOperations/WellOperationControllerTest.cs index 117ddae1..bb4c54df 100644 --- a/AsbCloudWebApi.IntegrationTests/Controllers/WellOperations/WellOperationControllerTest.cs +++ b/AsbCloudWebApi.IntegrationTests/Controllers/WellOperations/WellOperationControllerTest.cs @@ -118,7 +118,7 @@ public class WellOperationControllerTest : BaseIntegrationTest var response = await client.GetPageOperationsAsync(well.Id, request); //assert - Assert.Equal(response.StatusCode, HttpStatusCode.OK); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.NotNull(response.Content); var totalExpected = response.Content.Count - pageSize * pageIndex; @@ -230,10 +230,8 @@ public class WellOperationControllerTest : BaseIntegrationTest Assert.True(notExistedInDb.Count() == 0); } - [Theory] - [InlineData(WellOperation.IdOperationTypePlan)] - [InlineData(WellOperation.IdOperationTypeFact)] - public async Task GetPageOperationsAsyncWithDaysAndNpv_returns_success(int idType) + [Fact] + public async Task GetPageOperationsAsyncWithDaysAndNpv_returns_success() { //arrange const int pageSize = 10; diff --git a/AsbCloudWebApi.Tests/Background/BackgroundWorkerTest.cs b/AsbCloudWebApi.Tests/Background/BackgroundWorkerTest.cs index 912b4806..962ac43a 100644 --- a/AsbCloudWebApi.Tests/Background/BackgroundWorkerTest.cs +++ b/AsbCloudWebApi.Tests/Background/BackgroundWorkerTest.cs @@ -48,7 +48,7 @@ public class BackgroundWorkerTest backgroundWorker.Enqueue(work); } - await backgroundWorker.ExecuteTask; + await backgroundWorker.ExecuteTask!; //assert Assert.Equal(workCount, result); @@ -79,7 +79,7 @@ public class BackgroundWorkerTest backgroundWorker.Enqueue(badWork); backgroundWorker.Enqueue(goodWork); - await backgroundWorker.ExecuteTask; + await backgroundWorker.ExecuteTask!; //assert Assert.Equal(expectadResult, result); @@ -109,7 +109,7 @@ public class BackgroundWorkerTest var removed = backgroundWorker.TryRemoveFromQueue((workCount - 1).ToString()); - await backgroundWorker.ExecuteTask; + await backgroundWorker.ExecuteTask!; //assert Assert.True(removed); diff --git a/AsbCloudWebApi.Tests/Services/HelpPageServiceTest.cs b/AsbCloudWebApi.Tests/Services/HelpPageServiceTest.cs index e722fcb9..38fdf8bc 100644 --- a/AsbCloudWebApi.Tests/Services/HelpPageServiceTest.cs +++ b/AsbCloudWebApi.Tests/Services/HelpPageServiceTest.cs @@ -1,13 +1,13 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Threading; -using System.Threading.Tasks; using AsbCloudApp.Data; using AsbCloudApp.Repositories; using AsbCloudInfrastructure.Services; using Microsoft.Extensions.Configuration; using NSubstitute; +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading; +using System.Threading.Tasks; using Xunit; namespace AsbCloudWebApi.Tests.Services; @@ -18,7 +18,7 @@ public class HelpPageServiceTest private const string fileName = "Справка_для_страницы_test.pdf"; private const int idCategory = 20000; - private static Dictionary configSettings = new() + private static Dictionary configSettings = new() { { "DirectoryNameHelpPageFiles", "helpPages" } }; diff --git a/AsbCloudWebApi.Tests/Services/Notification/EmailNotificationTransportServiceTests.cs b/AsbCloudWebApi.Tests/Services/Notification/EmailNotificationTransportServiceTests.cs index 5b6bcb1d..386de44d 100644 --- a/AsbCloudWebApi.Tests/Services/Notification/EmailNotificationTransportServiceTests.cs +++ b/AsbCloudWebApi.Tests/Services/Notification/EmailNotificationTransportServiceTests.cs @@ -43,7 +43,7 @@ namespace AsbCloudWebApi.Tests.Services.Notification Surname = "Test", }; - private static Dictionary configSettings = new() + private static Dictionary configSettings = new() { { "email:sender", "bot@digitaldrilling.ru" }, { "email:password", "8wZrXSfP" }, diff --git a/AsbCloudWebApi/Controllers/DrillerController.cs b/AsbCloudWebApi/Controllers/DrillerController.cs index 48efca2c..5e3ff126 100644 --- a/AsbCloudWebApi/Controllers/DrillerController.cs +++ b/AsbCloudWebApi/Controllers/DrillerController.cs @@ -46,9 +46,9 @@ namespace AsbCloudWebApi.Controllers var drillers = schedulePage .Select(s => s.Driller) .Where(d => d is not null) - .GroupBy(d => d.Id) + .GroupBy(d => d!.Id) .Select(group => group.First()) - .OrderBy(d => d.Surname); + .OrderBy(d => d!.Surname); return Ok(drillers); } diff --git a/AsbCloudWebApi/Extensions.cs b/AsbCloudWebApi/Extensions.cs index a19dcc6e..d805eac7 100644 --- a/AsbCloudWebApi/Extensions.cs +++ b/AsbCloudWebApi/Extensions.cs @@ -114,7 +114,7 @@ public static class Extensions /// /// Получение Excel /// - /// + /// /// /// public static Stream GetExcelFile(this IFormFile file) From f0b46f9eca849965f4b2c1869ee6ffc00e3b3a45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9E=D0=BB=D1=8F=20=D0=91=D0=B8=D0=B7=D1=8E=D0=BA=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0?= Date: Fri, 24 May 2024 10:55:05 +0500 Subject: [PATCH 2/6] =?UTF-8?q?System.Configuration=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D0=BF=D1=80=D0=BE=D0=B1=D1=80=D0=BE=D1=81=D0=B0=20Configura?= =?UTF-8?q?tionErrorsException?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AsbCloudInfrastructure.csproj | 1 + .../MemoryCacheExtentions.cs | 12 +- .../Services/Email/BaseFactory.cs | 26 ++-- .../Services/Email/DrillingMailBodyFactory.cs | 126 +++++++++--------- .../EmailNotificationTransportService.cs | 12 +- .../Services/HelpPageService.cs | 27 ++-- .../Services/ManualCatalogService.cs | 5 +- .../Services/ReduceSamplingService.cs | 4 +- 8 files changed, 107 insertions(+), 106 deletions(-) diff --git a/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj b/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj index 6bdaf411..873bdfb4 100644 --- a/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj +++ b/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj @@ -62,6 +62,7 @@ + diff --git a/AsbCloudInfrastructure/MemoryCacheExtentions.cs b/AsbCloudInfrastructure/MemoryCacheExtentions.cs index eb57af3f..85956230 100644 --- a/AsbCloudInfrastructure/MemoryCacheExtentions.cs +++ b/AsbCloudInfrastructure/MemoryCacheExtentions.cs @@ -46,10 +46,7 @@ namespace AsbCloudInfrastructure /// public static Task> GetOrCreateBasicAsync(this IMemoryCache memoryCache, Func>> getterAsync, CancellationToken token) { - var key = typeof(T).FullName; - if (key == null) - return Task.FromResult(Enumerable.Empty()); - + var key = typeof(T).FullName!; var cache = memoryCache.GetOrCreateAsync(key, async (cacheEntry) => { cacheEntry.AbsoluteExpirationRelativeToNow = CacheOlescence; @@ -87,7 +84,7 @@ namespace AsbCloudInfrastructure /// public static IEnumerable GetOrCreateBasic(this IMemoryCache memoryCache, Func> getter) { - var key = typeof(T).FullName; + var key = typeof(T).FullName!; var cache = memoryCache.GetOrCreate(key, cacheEntry => { cacheEntry.AbsoluteExpirationRelativeToNow = CacheOlescence; @@ -106,10 +103,7 @@ namespace AsbCloudInfrastructure public static void DropBasic(this IMemoryCache memoryCache) where T : class { - var key = typeof(T).FullName; - - if (key == null) - return; + var key = typeof(T).FullName!; memoryCache.Remove(key); } diff --git a/AsbCloudInfrastructure/Services/Email/BaseFactory.cs b/AsbCloudInfrastructure/Services/Email/BaseFactory.cs index c0431016..b48d77ed 100644 --- a/AsbCloudInfrastructure/Services/Email/BaseFactory.cs +++ b/AsbCloudInfrastructure/Services/Email/BaseFactory.cs @@ -2,6 +2,7 @@ using AsbCloudApp.Exceptions; using Microsoft.Extensions.Configuration; using System; +using System.Configuration; using System.IO; namespace AsbCloudInfrastructure.Services.Email @@ -9,17 +10,24 @@ namespace AsbCloudInfrastructure.Services.Email public class BaseFactory { - private readonly string platformName; - private readonly string platformUrl; - private readonly string companyName; - private readonly string supportMail; + protected readonly string platformName; + protected readonly string platformUrl; + protected readonly string companyName; + protected readonly string supportMail; public BaseFactory(IConfiguration configuration) { - platformName = configuration.GetValue("email:platformName", "Цифровое бурение") ?? string.Empty; - platformUrl = configuration.GetValue("email:platformUrl", "https://cloud.digitaldrilling.ru/") ?? string.Empty; - companyName = configuration.GetValue("email:companyName", "ООО \"Цифровое бурение\"") ?? string.Empty; - supportMail = configuration.GetValue("email:supportMail", "support@digitaldrilling.ru") ?? string.Empty; + platformName = configuration.GetValue("email:platformName") + ?? throw new ConfigurationErrorsException("email:platformName не определен"); + + platformUrl = configuration.GetValue("email:platformUrl") + ?? throw new ConfigurationErrorsException("email:platformUrl не определен"); + + companyName = configuration.GetValue("email:companyName") + ?? throw new ConfigurationErrorsException("email:companyName не определен"); + + supportMail = configuration.GetValue("email:supportMail") + ?? throw new ConfigurationErrorsException("email:supportMail не определен"); } public static string GetOrEmptyImageBase64(string resourceFileName) @@ -37,7 +45,7 @@ namespace AsbCloudInfrastructure.Services.Email { System.Diagnostics.Trace.TraceWarning($"GetOrEmptyImageBase64(). File {logoFilePath} not found."); return string.Empty; - } + } var imageBytes = File.ReadAllBytes(logoFilePath); var format = Path.GetExtension(resourceFileName).Trim('.'); diff --git a/AsbCloudInfrastructure/Services/Email/DrillingMailBodyFactory.cs b/AsbCloudInfrastructure/Services/Email/DrillingMailBodyFactory.cs index d1371110..ac1d4771 100644 --- a/AsbCloudInfrastructure/Services/Email/DrillingMailBodyFactory.cs +++ b/AsbCloudInfrastructure/Services/Email/DrillingMailBodyFactory.cs @@ -4,83 +4,79 @@ using Microsoft.Extensions.Configuration; namespace AsbCloudInfrastructure.Services.Email { - class DrillingMailBodyFactory : BaseFactory + class DrillingMailBodyFactory : BaseFactory { - private readonly string platformName; - private readonly string platformUrl; public DrillingMailBodyFactory(IConfiguration configuration) - : base(configuration) + : base(configuration) { - platformName = configuration.GetValue("email:platformName", "Цифровое бурение") ?? string.Empty; - platformUrl = configuration.GetValue("email:platformUrl", "https://cloud.digitaldrilling.ru/") ?? string.Empty; - } + } - public override string MakeSubject(WellDto well, string action) + public override string MakeSubject(WellDto well, string action) { - var subj = $"{well.Deposit}, {well.Cluster}, {well.Caption}. Программа бурения. {action}"; - return subj; - } + var subj = $"{well.Deposit}, {well.Cluster}, {well.Caption}. Программа бурения. {action}"; + return subj; + } - public string MakeMailBodyForNewPublisher(WellDto well, string publisherName, string documentCategory) - { - var drillingProgramHref = MakeDrillingProgramHref(well); - - var body = $"

Здравствуйте, {publisherName}.

" + - $"На портале {platformName} началось создание программы бурения скважины {drillingProgramHref}," + - $" куст {well.Cluster}, месторождение {well.Deposit}." + - $"

От вас ожидается загрузка на портал документа «{documentCategory}» в формате excel (*.xlsx)." + - MakeSignatue() + - $""; - return body; - } - - public string MakeMailBodyForApproverNewFile(WellDto well, string approverName, int idFile, string fileName) + public string MakeMailBodyForNewPublisher(WellDto well, string publisherName, string documentCategory) { - var drillingProgramHref = MakeDrillingProgramHref(well); + var drillingProgramHref = MakeDrillingProgramHref(well); - var body = $"

Здравствуйте, {approverName}.

" + - $"На портал {platformName} загружен документ {fileName}" + - $" для согласования при создании программы бурения скважины {drillingProgramHref}, куст ({well.Cluster})" + - $", месторождение ({well.Deposit}).
" + + var body = $"

Здравствуйте, {publisherName}.

" + + $"На портале {platformName} началось создание программы бурения скважины {drillingProgramHref}," + + $" куст {well.Cluster}, месторождение {well.Deposit}." + + $"

От вас ожидается загрузка на портал документа «{documentCategory}» в формате excel (*.xlsx)." + MakeSignatue() + $""; - return body; - } + return body; + } - public string MakeMailBodyForPublisherOnReject(WellDto well, string publisherName, int idFile, string fileName, FileMarkDto fileMark) - { - var drillingProgramHref = MakeDrillingProgramHref(well); - - var body = $"

Здравствуйте, {publisherName}.

" + - $"На портале {platformName} отклонен загруженный вами документ {fileName} " + - $" по программе бурения скважины {drillingProgramHref}," + - $" куст {well.Cluster}, месторождение {well.Deposit}." + - $" Комментарий согласующего ({fileMark.User?.Name} {fileMark.User?.Surname}):
{fileMark.Comment}" + - MakeSignatue() + - $""; - return body; - } - - public string MakeMailBodyForPublisherOnFullAccept(WellDto well, string publisherName, int idFile, string fileName) - { - var drillingProgramHref = MakeDrillingProgramHref(well); - - var body = $"

Здравствуйте, {publisherName}.

" + - $"На портале {platformName} полностью согласован документ {fileName} " + - $" по программе бурения скважины {drillingProgramHref}," + - $" куст {well.Cluster}, месторождение {well.Deposit}." + - MakeSignatue() + - $""; - return body; - } - - private string MakeDrillingProgramHref(WellDto well) + public string MakeMailBodyForApproverNewFile(WellDto well, string approverName, int idFile, string fileName) { - var drillingProgramUrl = $"{platformUrl}/well/{well.Id}/drillingProgram"; - var drillingProgramHref = MakeHref(drillingProgramUrl, well.Caption); - return drillingProgramHref; - } - } + var drillingProgramHref = MakeDrillingProgramHref(well); + + var body = $"

Здравствуйте, {approverName}.

" + + $"На портал {platformName} загружен документ {fileName}" + + $" для согласования при создании программы бурения скважины {drillingProgramHref}, куст ({well.Cluster})" + + $", месторождение ({well.Deposit}).
" + + MakeSignatue() + + $""; + return body; + } + + public string MakeMailBodyForPublisherOnReject(WellDto well, string publisherName, int idFile, string fileName, FileMarkDto fileMark) + { + var drillingProgramHref = MakeDrillingProgramHref(well); + + var body = $"

Здравствуйте, {publisherName}.

" + + $"На портале {platformName} отклонен загруженный вами документ {fileName} " + + $" по программе бурения скважины {drillingProgramHref}," + + $" куст {well.Cluster}, месторождение {well.Deposit}." + + $" Комментарий согласующего ({fileMark.User?.Name} {fileMark.User?.Surname}):
{fileMark.Comment}" + + MakeSignatue() + + $""; + return body; + } + + public string MakeMailBodyForPublisherOnFullAccept(WellDto well, string publisherName, int idFile, string fileName) + { + var drillingProgramHref = MakeDrillingProgramHref(well); + + var body = $"

Здравствуйте, {publisherName}.

" + + $"На портале {platformName} полностью согласован документ {fileName} " + + $" по программе бурения скважины {drillingProgramHref}," + + $" куст {well.Cluster}, месторождение {well.Deposit}." + + MakeSignatue() + + $""; + return body; + } + + private string MakeDrillingProgramHref(WellDto well) + { + var drillingProgramUrl = $"{platformUrl}/well/{well.Id}/drillingProgram"; + var drillingProgramHref = MakeHref(drillingProgramUrl, well.Caption); + return drillingProgramHref; + } + } } diff --git a/AsbCloudInfrastructure/Services/Email/EmailNotificationTransportService.cs b/AsbCloudInfrastructure/Services/Email/EmailNotificationTransportService.cs index 88fbe691..6812e068 100644 --- a/AsbCloudInfrastructure/Services/Email/EmailNotificationTransportService.cs +++ b/AsbCloudInfrastructure/Services/Email/EmailNotificationTransportService.cs @@ -4,6 +4,7 @@ using AsbCloudApp.Repositories; using AsbCloudApp.Services.Notifications; using Microsoft.Extensions.Configuration; using System.Collections.Generic; +using System.Configuration; using System.Diagnostics; using System.Linq; using System.Net.Mail; @@ -29,9 +30,14 @@ namespace AsbCloudInfrastructure.Services.Email { this.userRepository = userRepository; - this.sender = configuration.GetValue("email:sender", string.Empty) ?? string.Empty; - this.smtpPassword = configuration.GetValue("email:password", string.Empty) ?? string.Empty; - this.smtpServer = configuration.GetValue("email:smtpServer", string.Empty) ?? string.Empty; + this.sender = configuration.GetValue("email:sender") + ?? throw new ConfigurationErrorsException("email:sender не определен"); + + this.smtpPassword = configuration.GetValue("email:password") + ?? throw new ConfigurationErrorsException("email:password не определен"); + + this.smtpServer = configuration.GetValue("email:smtpServer") + ?? throw new ConfigurationErrorsException("email:smtpServer не определен"); var configError = string.IsNullOrEmpty(this.sender) || string.IsNullOrEmpty(this.smtpPassword) || diff --git a/AsbCloudInfrastructure/Services/HelpPageService.cs b/AsbCloudInfrastructure/Services/HelpPageService.cs index 45d4d18d..012ce5bc 100644 --- a/AsbCloudInfrastructure/Services/HelpPageService.cs +++ b/AsbCloudInfrastructure/Services/HelpPageService.cs @@ -1,11 +1,11 @@ using AsbCloudApp.Data; using AsbCloudApp.Repositories; using AsbCloudApp.Services; +using Microsoft.Extensions.Configuration; using System.IO; using System.Net; using System.Threading; using System.Threading.Tasks; -using Microsoft.Extensions.Configuration; namespace AsbCloudInfrastructure.Services; @@ -14,7 +14,7 @@ namespace AsbCloudInfrastructure.Services; ///
public class HelpPageService : IHelpPageService { - private readonly string directoryNameHelpPageFiles; + private readonly string directoryNameHelpPageFiles; private readonly IHelpPageRepository helpPageRepository; private readonly IFileStorageRepository fileStorageRepository; @@ -27,13 +27,10 @@ public class HelpPageService : IHelpPageService public HelpPageService(IHelpPageRepository helpPageRepository, IFileStorageRepository fileStorageRepository, IConfiguration configuration) - { + { this.helpPageRepository = helpPageRepository; this.fileStorageRepository = fileStorageRepository; - directoryNameHelpPageFiles = configuration.GetValue("DirectoryNameHelpPageFiles") ?? string.Empty; - - if (string.IsNullOrWhiteSpace(directoryNameHelpPageFiles)) - directoryNameHelpPageFiles = "helpPages"; + directoryNameHelpPageFiles = configuration.GetValue("DirectoryNameHelpPageFiles", "helpPages")!; } /// @@ -45,17 +42,17 @@ public class HelpPageService : IHelpPageService /// /// /// - public async Task AddOrUpdateAsync(string urlPage, - int idCategory, - string fileName, - Stream fileStream, + public async Task AddOrUpdateAsync(string urlPage, + int idCategory, + string fileName, + Stream fileStream, CancellationToken cancellationToken) { var helpPage = await helpPageRepository.GetOrDefaultByUrlPageAndIdCategoryAsync(urlPage, idCategory, cancellationToken); - if(helpPage is not null) + if (helpPage is not null) { await UpdateFileAsync(helpPage, idCategory, @@ -86,12 +83,12 @@ public class HelpPageService : IHelpPageService CancellationToken cancellationToken) { pageKey = WebUtility.UrlDecode(pageKey); - + var helpPage = await helpPageRepository.GetOrDefaultByUrlPageAndIdCategoryAsync(pageKey, idCategory, cancellationToken); - - if(helpPage is null) + + if (helpPage is null) return null; string filePath = fileStorageRepository.GetFilePath(directoryNameHelpPageFiles, diff --git a/AsbCloudInfrastructure/Services/ManualCatalogService.cs b/AsbCloudInfrastructure/Services/ManualCatalogService.cs index 7776a4ef..83d24f4b 100644 --- a/AsbCloudInfrastructure/Services/ManualCatalogService.cs +++ b/AsbCloudInfrastructure/Services/ManualCatalogService.cs @@ -35,10 +35,7 @@ public class ManualCatalogService : IManualCatalogService this.fileStorageRepository = fileStorageRepository; this.manualDirectoryRepository = manualDirectoryRepository; this.manualRepository = manualRepository; - directoryFiles = configuration.GetValue("DirectoryManualFiles") ?? string.Empty; - - if (string.IsNullOrWhiteSpace(directoryFiles)) - directoryFiles = "manuals"; + directoryFiles = configuration.GetValue("DirectoryManualFiles", "manuals")!; } public async Task SaveFileAsync(int idDirectory, int idAuthor, string name, Stream stream, CancellationToken cancellationToken) diff --git a/AsbCloudInfrastructure/Services/ReduceSamplingService.cs b/AsbCloudInfrastructure/Services/ReduceSamplingService.cs index 7fc7e19c..38d6a03e 100644 --- a/AsbCloudInfrastructure/Services/ReduceSamplingService.cs +++ b/AsbCloudInfrastructure/Services/ReduceSamplingService.cs @@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using System; using System.Collections.Generic; +using System.Configuration; using System.Diagnostics; using System.Linq; using System.Threading; @@ -36,7 +37,8 @@ namespace AsbCloudInfrastructure.Services private ReduceSamplingService(IConfiguration configuration) { - connectionString = configuration.GetConnectionString("DefaultConnection") ?? string.Empty; + connectionString = configuration.GetConnectionString("DefaultConnection") + ?? throw new ConfigurationErrorsException("DefaultConnection не определен"); } ~ReduceSamplingService() From a41ecbf04779bc5946e5d9b835b0645a29041422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9E=D0=BB=D1=8F=20=D0=91=D0=B8=D0=B7=D1=8E=D0=BA=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0?= Date: Fri, 24 May 2024 10:57:45 +0500 Subject: [PATCH 3/6] =?UTF-8?q?=D0=97=D0=B0=D0=BB=D0=B8=D1=82=D1=8B=20?= =?UTF-8?q?=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F,=20?= =?UTF-8?q?=D0=BD=D0=B5=20=D0=B2=D0=BE=D1=88=D0=B5=D0=B4=D1=89=D0=B8=D0=B5?= =?UTF-8?q?=20=D0=B2=20=D0=BF=D1=80=D0=B5=D0=B4=D1=8B=D0=B4=D1=83=D1=89?= =?UTF-8?q?=D0=B8=D0=B9=20=D0=BA=D0=BE=D0=BC=D0=BC=D0=B8=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/Email/WellFinalDocumentMailBodyFactory .cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/AsbCloudInfrastructure/Services/Email/WellFinalDocumentMailBodyFactory .cs b/AsbCloudInfrastructure/Services/Email/WellFinalDocumentMailBodyFactory .cs index 814923fe..da2876fa 100644 --- a/AsbCloudInfrastructure/Services/Email/WellFinalDocumentMailBodyFactory .cs +++ b/AsbCloudInfrastructure/Services/Email/WellFinalDocumentMailBodyFactory .cs @@ -9,12 +9,11 @@ namespace AsbCloudInfrastructure class WellFinalDocumentMailBodyFactory : BaseFactory { - private readonly string platformName; public WellFinalDocumentMailBodyFactory(IConfiguration configuration) : base(configuration) { - platformName = configuration.GetValue("email:platformName", "Цифровое бурение") ?? string.Empty; + } public override string MakeSubject(WellDto well, string action) From 063096e236ef69f0e8f3291da1ceeedc87a0713b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9E=D0=BB=D1=8F=20=D0=91=D0=B8=D0=B7=D1=8E=D0=BA=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0?= Date: Mon, 27 May 2024 15:37:33 +0500 Subject: [PATCH 4/6] =?UTF-8?q?=D0=9E=D1=82=D0=BF=D1=80=D0=B0=D0=B2=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D0=BE=D0=B1=20?= =?UTF-8?q?=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B5,=20=D0=B5=D1=81=D0=BB?= =?UTF-8?q?=D0=B8=20=D1=84=D0=B0=D0=B9=D0=BB=20=D0=BF=D0=BE=20=D0=BA=D0=B0?= =?UTF-8?q?=D0=BA=D0=BE=D0=B9-=D1=82=D0=BE=20=D0=BF=D1=80=D0=B8=D1=87?= =?UTF-8?q?=D0=B8=D0=BD=D0=B5=20=D0=BD=D0=B5=20=D1=81=D1=84=D0=BE=D1=80?= =?UTF-8?q?=D0=BC=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Data/Progress/ProgressExceptionDto.cs | 12 +---------- .../Data/Progress/ReportProgressDto.cs | 2 +- .../Services/ReportService.cs | 20 +++++++++++++++++-- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/AsbCloudApp/Data/Progress/ProgressExceptionDto.cs b/AsbCloudApp/Data/Progress/ProgressExceptionDto.cs index cb264178..a8eb4fdd 100644 --- a/AsbCloudApp/Data/Progress/ProgressExceptionDto.cs +++ b/AsbCloudApp/Data/Progress/ProgressExceptionDto.cs @@ -5,18 +5,8 @@ namespace AsbCloudApp.Data.Progress; /// /// DTO прогресса с ошибкой /// -public class ProgressExceptionDto +public class ProgressExceptionDto : ProgressDto { - /// - /// прогресс 0 - 100% - /// - public float Progress { get; set; } - - /// - /// название текущей операции генерации - /// - public string? Operation { get; set; } - /// /// Отображаемый текст ошибки /// diff --git a/AsbCloudApp/Data/Progress/ReportProgressDto.cs b/AsbCloudApp/Data/Progress/ReportProgressDto.cs index 400b6c9f..8bfb07d2 100644 --- a/AsbCloudApp/Data/Progress/ReportProgressDto.cs +++ b/AsbCloudApp/Data/Progress/ReportProgressDto.cs @@ -8,5 +8,5 @@ public class ReportProgressFinalDto : ReportProgressDto /// /// файл /// - public FileInfoDto? file { get; set; } + public FileInfoDto file { get; set; } = null!; } diff --git a/AsbCloudInfrastructure/Services/ReportService.cs b/AsbCloudInfrastructure/Services/ReportService.cs index 4d321525..c5df7c7c 100644 --- a/AsbCloudInfrastructure/Services/ReportService.cs +++ b/AsbCloudInfrastructure/Services/ReportService.cs @@ -54,13 +54,15 @@ public class ReportService : IReportService progressHandler.Invoke(state, work.Id); }, token); - backgroundWorkerService.Enqueue(work); - progressHandler.Invoke(new ReportProgressDto { Operation = "Ожидает начала в очереди.", Progress = 0f, }, work.Id); + + backgroundWorkerService.Enqueue(work); + + return work.Id; } @@ -153,6 +155,20 @@ public class ReportService : IReportService var fileInfo = (await fileService.MoveAsync(idWell, idUser, ReportCategoryId, reportFileName, reportFileName, token))!; + if (fileInfo == null) + { + var state = new ProgressExceptionDto + { + Operation = "error", + Progress = 0f, + Message = "Не удалось сгенерировать файл отчёта", + Exception = new FileNotFoundException(), + }; + progressHandler(state, workId); + + return; + } + progressHandler(new ReportProgressFinalDto() { Operation = "done", From 188060fcaaa8af1fa9cb8c7f5e6b456754e42a84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9E=D0=BB=D1=8F=20=D0=91=D0=B8=D0=B7=D1=8E=D0=BA=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0?= Date: Mon, 27 May 2024 15:40:07 +0500 Subject: [PATCH 5/6] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B0?= =?UTF-8?q?=20=D0=BB=D0=B8=D1=88=D0=BD=D1=8F=D1=8F=20=D0=BF=D1=83=D1=81?= =?UTF-8?q?=D1=82=D0=B0=D1=8F=20=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudInfrastructure/Services/ReportService.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/AsbCloudInfrastructure/Services/ReportService.cs b/AsbCloudInfrastructure/Services/ReportService.cs index c5df7c7c..6a57ef48 100644 --- a/AsbCloudInfrastructure/Services/ReportService.cs +++ b/AsbCloudInfrastructure/Services/ReportService.cs @@ -61,7 +61,6 @@ public class ReportService : IReportService }, work.Id); backgroundWorkerService.Enqueue(work); - return work.Id; } From 72e65f272cc91046764633fbc6e44914cb3e5757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9E=D0=BB=D1=8F=20=D0=91=D0=B8=D0=B7=D1=8E=D0=BA=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0?= Date: Mon, 27 May 2024 15:41:29 +0500 Subject: [PATCH 6/6] =?UTF-8?q?=D0=A1=D1=82=D0=B0=D1=82=D1=83=D1=81=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B3=D1=80=D0=B5=D1=81=D1=81=D0=B0:=20100?= =?UTF-8?q?=20(=D0=BF=D1=80=D0=B8=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudInfrastructure/Services/ReportService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AsbCloudInfrastructure/Services/ReportService.cs b/AsbCloudInfrastructure/Services/ReportService.cs index 6a57ef48..cf533310 100644 --- a/AsbCloudInfrastructure/Services/ReportService.cs +++ b/AsbCloudInfrastructure/Services/ReportService.cs @@ -159,7 +159,7 @@ public class ReportService : IReportService var state = new ProgressExceptionDto { Operation = "error", - Progress = 0f, + Progress = 100f, Message = "Не удалось сгенерировать файл отчёта", Exception = new FileNotFoundException(), };