feat: Перенесены внешние сервисы в Infrastructure. Удалены лишние проекты.
This commit is contained in:
@@ -9,10 +9,8 @@ WORKDIR /src
|
||||
COPY ["NuGet.config", "."]
|
||||
COPY ["PARR.AIHITLoaderWorker/PARR.AIHITLoaderWorker.csproj", "PARR.AIHITLoaderWorker/"]
|
||||
COPY ["PARR.AIHITMainLoader/PARR.AIHITMainLoader.csproj", "PARR.AIHITMainLoader/"]
|
||||
COPY ["PARR.BLL/PARR.BLL.csproj", "PARR.BLL/"]
|
||||
COPY ["PARR.Common/PARR.Common.csproj", "PARR.Common/"]
|
||||
COPY ["PARR.Domain/PARR.Domain.csproj", "PARR.Domain/"]
|
||||
COPY ["PARR.Core/PARR.Core.csproj", "PARR.Core/"]
|
||||
COPY ["PARR.Domain/PARR.Domain.csproj", "PARR.Domain/"]
|
||||
COPY ["PARR.Infrastructure/PARR.Infrastructure.csproj", "PARR.Infrastructure/"]
|
||||
RUN dotnet restore "./PARR.AIHITLoaderWorker/./PARR.AIHITLoaderWorker.csproj"
|
||||
COPY . .
|
||||
|
||||
@@ -3,9 +3,8 @@ using Microsoft.Extensions.Logging;
|
||||
using PARR.AIHITMainLoader.Models;
|
||||
using PARR.AIHITMainLoader.Services;
|
||||
using PARR.AIHITMainLoader.Settings;
|
||||
using PARR.BLL.Services.Interfaces;
|
||||
using PARR.Core.Common;
|
||||
using PARR.Core.Common.RabbitServices;
|
||||
using PARR.Core.Common.Interfaces;
|
||||
using PARR.Core.Common.Interfaces.RabbitServices;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Text.Json;
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using PARR.AIHITMainLoader.Context;
|
||||
using PARR.AIHITMainLoader.Services;
|
||||
using PARR.AIHITMainLoader.Settings;
|
||||
using PARR.BLL;
|
||||
using PARR.Core;
|
||||
using PARR.Infrastructure;
|
||||
|
||||
@@ -14,7 +13,6 @@ namespace PARR.AIHITMainLoader
|
||||
{
|
||||
public static void InstallAihitMainLoaderServices(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.InstallBllServices(configuration);
|
||||
services.AddCoreServices(configuration);
|
||||
services.AddInfrastructureServices(configuration);
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PARR.BLL\PARR.BLL.csproj" />
|
||||
<ProjectReference Include="..\PARR.Core\PARR.Core.csproj" />
|
||||
<ProjectReference Include="..\PARR.Domain\PARR.Domain.csproj" />
|
||||
<ProjectReference Include="..\PARR.Infrastructure\PARR.Infrastructure.csproj" />
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.AIHITMainSyncer.Services;
|
||||
using PARR.AIHITMainSyncer.Settings;
|
||||
using PARR.Core.Common.RabbitServices;
|
||||
using PARR.Core.Common.Interfaces.RabbitServices;
|
||||
|
||||
namespace PARR.AIHITMainSyncer
|
||||
{
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using PARR.AIHITMainSyncer.Services;
|
||||
using PARR.AIHITMainSyncer.Settings;
|
||||
using PARR.BLL;
|
||||
using PARR.Core;
|
||||
using PARR.DAL;
|
||||
using PARR.Infrastructure;
|
||||
|
||||
namespace PARR.AIHITMainSyncer
|
||||
{
|
||||
@@ -11,8 +12,9 @@ namespace PARR.AIHITMainSyncer
|
||||
{
|
||||
public static void InstallAihitMainSyncerServices(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.InstallBllServices(configuration);
|
||||
services.InstallDalServices(configuration);
|
||||
services.AddCoreServices(configuration);
|
||||
services.AddInfrastructureServices(configuration);
|
||||
|
||||
var settings = new WorkerSettings();
|
||||
configuration.GetSection(nameof(WorkerSettings)).Bind(settings);
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PARR.BLL\PARR.BLL.csproj" />
|
||||
<ProjectReference Include="..\PARR.Core\PARR.Core.csproj" />
|
||||
<ProjectReference Include="..\PARR.DAL\PARR.DAL.csproj" />
|
||||
<ProjectReference Include="..\PARR.Infrastructure\PARR.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PARR.AIHITMainSyncer.Settings;
|
||||
using PARR.BLL.Services.Interfaces;
|
||||
using PARR.Core.Common.Interfaces;
|
||||
using PARR.DAL.Models.Unit;
|
||||
using PARR.DAL.Services.Interfaces.Unit;
|
||||
using PARR.Domain.Common.Rabbit.Messages;
|
||||
|
||||
@@ -5,9 +5,9 @@ using PARR.AIHITRelationshipsSyncer.Context;
|
||||
using PARR.AIHITRelationshipsSyncer.Services.Implementations;
|
||||
using PARR.AIHITRelationshipsSyncer.Services.Interfaces;
|
||||
using PARR.AIHITRelationshipsSyncer.Settings;
|
||||
using PARR.BLL;
|
||||
using PARR.Core;
|
||||
using PARR.DAL;
|
||||
using PARR.Infrastructure;
|
||||
|
||||
namespace PARR.AIHITRelationshipsSyncer
|
||||
{
|
||||
@@ -15,10 +15,10 @@ namespace PARR.AIHITRelationshipsSyncer
|
||||
{
|
||||
public static void InstallAihitRelationshpsSyncerServices(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.InstallBllServices(configuration);
|
||||
services.AddCoreServices(configuration);
|
||||
services.InstallDalServices(configuration);
|
||||
|
||||
services.AddCoreServices(configuration);
|
||||
services.AddInfrastructureServices(configuration);
|
||||
|
||||
var settings = new WorkerSettings();
|
||||
configuration.GetSection(nameof(WorkerSettings)).Bind(settings);
|
||||
services.AddSingleton(settings);
|
||||
|
||||
@@ -11,8 +11,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PARR.BLL\PARR.BLL.csproj" />
|
||||
<ProjectReference Include="..\PARR.Core\PARR.Core.csproj" />
|
||||
<ProjectReference Include="..\PARR.DAL\PARR.DAL.csproj" />
|
||||
<ProjectReference Include="..\PARR.Infrastructure\PARR.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
using PARR.AIHITRelationshipsSyncer.Models;
|
||||
using PARR.AIHITRelationshipsSyncer.Services.Interfaces;
|
||||
using PARR.AIHITRelationshipsSyncer.Settings;
|
||||
using PARR.BLL.Services.Interfaces;
|
||||
using PARR.Core.Common;
|
||||
using PARR.Core.Common.Interfaces;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace PARR.AIHITRelationshipsSyncer
|
||||
|
||||
@@ -12,11 +12,10 @@ WORKDIR /src
|
||||
COPY ["NuGet.config", "."]
|
||||
COPY ["PARR.AIHITRelationshipsSyncerWorker/PARR.AIHITRelationshipsSyncerWorker.csproj", "PARR.AIHITRelationshipsSyncerWorker/"]
|
||||
COPY ["PARR.AIHITRelationshipsSyncer/PARR.AIHITRelationshipsSyncer.csproj", "PARR.AIHITRelationshipsSyncer/"]
|
||||
COPY ["PARR.BLL/PARR.BLL.csproj", "PARR.BLL/"]
|
||||
COPY ["PARR.Common/PARR.Common.csproj", "PARR.Common/"]
|
||||
COPY ["PARR.Core/PARR.Core.csproj", "PARR.Core/"]
|
||||
COPY ["PARR.Domain/PARR.Domain.csproj", "PARR.Domain/"]
|
||||
COPY ["PARR.DAL/PARR.DAL.csproj", "PARR.DAL/"]
|
||||
COPY ["PARR.Core/PARR.Core.csproj", "PARR.Core/"]
|
||||
COPY ["PARR.Infrastructure/PARR.Infrastructure.csproj", "PARR.Infrastructure/"]
|
||||
RUN dotnet restore "./PARR.AIHITRelationshipsSyncerWorker/PARR.AIHITRelationshipsSyncerWorker.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/PARR.AIHITRelationshipsSyncerWorker"
|
||||
|
||||
@@ -9,11 +9,10 @@ WORKDIR /src
|
||||
COPY ["NuGet.config", "."]
|
||||
COPY ["PARR.AIHITSyncerWorker/PARR.AIHITSyncerWorker.csproj", "PARR.AIHITSyncerWorker/"]
|
||||
COPY ["PARR.AIHITMainSyncer/PARR.AIHITMainSyncer.csproj", "PARR.AIHITMainSyncer/"]
|
||||
COPY ["PARR.BLL/PARR.BLL.csproj", "PARR.BLL/"]
|
||||
COPY ["PARR.Common/PARR.Common.csproj", "PARR.Common/"]
|
||||
COPY ["PARR.Core/PARR.Core.csproj", "PARR.Core/"]
|
||||
COPY ["PARR.Domain/PARR.Domain.csproj", "PARR.Domain/"]
|
||||
COPY ["PARR.DAL/PARR.DAL.csproj", "PARR.DAL/"]
|
||||
COPY ["PARR.Core/PARR.Core.csproj", "PARR.Core/"]
|
||||
COPY ["PARR.Infrastructure/PARR.Infrastructure.csproj", "PARR.Infrastructure/"]
|
||||
RUN dotnet restore "./PARR.AIHITSyncerWorker/./PARR.AIHITSyncerWorker.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/PARR.AIHITSyncerWorker"
|
||||
|
||||
12
PARR.API.sln
12
PARR.API.sln
@@ -20,8 +20,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
||||
EndProject
|
||||
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{AB278172-BFB4-4D54-9022-2D2A5B3338D7}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.BLL", "PARR.BLL\PARR.BLL.csproj", "{7BAB9170-743D-4542-8881-9B161EE81BB6}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.EsppTemplateSyncWorker", "PARR.EsppTemplateSyncWorker\PARR.EsppTemplateSyncWorker.csproj", "{7FBD65FE-26FE-4E60-AD1F-20AAC6F88C7A}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.EsppTemplateSync", "PARR.EsppTemplateSync\PARR.EsppTemplateSync.csproj", "{39FD9AAD-0792-46B2-A935-42486A993C32}"
|
||||
@@ -70,8 +68,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.JobAutoControlWorker",
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.JobAutoControl", "PARR.JobAutoControl\PARR.JobAutoControl.csproj", "{2C35CCD5-6DCD-4640-98DA-D2DC11CE3BA5}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.Common", "PARR.Common\PARR.Common.csproj", "{5C89E990-6E49-4897-8344-1AC3ECFBD869}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.AIHITMainLoader", "PARR.AIHITMainLoader\PARR.AIHITMainLoader.csproj", "{1BB7D841-4F6A-43B6-B89A-F0B09CDA40B1}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.AIHITMainSyncer", "PARR.AIHITMainSyncer\PARR.AIHITMainSyncer.csproj", "{173E33B2-A10B-4FE9-802C-B22940326DEB}"
|
||||
@@ -120,10 +116,6 @@ Global
|
||||
{228C8124-69E4-4AE0-8C33-0438E54FF1BA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AB278172-BFB4-4D54-9022-2D2A5B3338D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AB278172-BFB4-4D54-9022-2D2A5B3338D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7BAB9170-743D-4542-8881-9B161EE81BB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7BAB9170-743D-4542-8881-9B161EE81BB6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7BAB9170-743D-4542-8881-9B161EE81BB6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7BAB9170-743D-4542-8881-9B161EE81BB6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7FBD65FE-26FE-4E60-AD1F-20AAC6F88C7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7FBD65FE-26FE-4E60-AD1F-20AAC6F88C7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7FBD65FE-26FE-4E60-AD1F-20AAC6F88C7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -220,10 +212,6 @@ Global
|
||||
{2C35CCD5-6DCD-4640-98DA-D2DC11CE3BA5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2C35CCD5-6DCD-4640-98DA-D2DC11CE3BA5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2C35CCD5-6DCD-4640-98DA-D2DC11CE3BA5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5C89E990-6E49-4897-8344-1AC3ECFBD869}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5C89E990-6E49-4897-8344-1AC3ECFBD869}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5C89E990-6E49-4897-8344-1AC3ECFBD869}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5C89E990-6E49-4897-8344-1AC3ECFBD869}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1BB7D841-4F6A-43B6-B89A-F0B09CDA40B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1BB7D841-4F6A-43B6-B89A-F0B09CDA40B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1BB7D841-4F6A-43B6-B89A-F0B09CDA40B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using PARR.DAL.Cache.Models;
|
||||
using PARR.Domain.Cache.Models;
|
||||
|
||||
namespace PARR.API.Contracts.V1.Responses
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ using PARR.API.Contracts.V1.Responses.Base;
|
||||
using PARR.API.Controllers.V1.Base;
|
||||
using PARR.API.Services.Interfaces;
|
||||
using PARR.API.Settings;
|
||||
using PARR.Core.Common.RabbitServices;
|
||||
using PARR.Core.Common.Interfaces.RabbitServices;
|
||||
using PARR.Domain.Common.Rabbit.Messages;
|
||||
using PARR.Domain.Common.Roles;
|
||||
using PARR.Domain.Entities.Base.History;
|
||||
|
||||
@@ -1,19 +1,4 @@
|
||||
using FluentValidation;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using PARR.API.Contracts.V1;
|
||||
using PARR.API.Contracts.V1.Requests;
|
||||
using PARR.API.Contracts.V1.Responses.Base;
|
||||
using PARR.API.Controllers.V1.Base;
|
||||
using PARR.API.Services.Interfaces;
|
||||
using PARR.API.Settings;
|
||||
using PARR.Core.Common.RabbitServices;
|
||||
using PARR.Domain.Common.Rabbit.Messages;
|
||||
using PARR.Domain.Common.Roles;
|
||||
using PARR.Domain.Entities.Base.History;
|
||||
using PARR.Domain.Enums;
|
||||
|
||||
namespace PARR.API.Controllers.V1
|
||||
namespace PARR.API.Controllers.V1
|
||||
{
|
||||
//[Authorize(Roles = ParrRoles.Administrator.Role)]
|
||||
//public class GeneratorTemplateController : BaseApiController
|
||||
|
||||
@@ -13,7 +13,8 @@ using PARR.API.Extensions;
|
||||
using PARR.API.Services.Interfaces;
|
||||
using PARR.API.Settings;
|
||||
using PARR.BLL.Helpers;
|
||||
using PARR.Core.Common.RabbitServices;
|
||||
using PARR.Core.Common.Helpers;
|
||||
using PARR.Core.Common.Interfaces.RabbitServices;
|
||||
using PARR.DAL.DomainServices.Interfaces;
|
||||
using PARR.DAL.DomainServices.UnitFilterService;
|
||||
using PARR.DAL.Extensions;
|
||||
|
||||
@@ -13,7 +13,8 @@ using PARR.API.Extensions;
|
||||
using PARR.API.Services.Interfaces;
|
||||
using PARR.API.Settings;
|
||||
using PARR.BLL.Helpers;
|
||||
using PARR.Core.Common.RabbitServices;
|
||||
using PARR.Core.Common.Helpers;
|
||||
using PARR.Core.Common.Interfaces.RabbitServices;
|
||||
using PARR.DAL.DomainServices.Interfaces;
|
||||
using PARR.DAL.Models;
|
||||
using PARR.DAL.Models.Job;
|
||||
|
||||
@@ -5,7 +5,7 @@ using PARR.API.Contracts.V1;
|
||||
using PARR.API.Contracts.V1.Responses.Base;
|
||||
using PARR.API.Controllers.V1.Base;
|
||||
using PARR.API.Settings;
|
||||
using PARR.Core.Common.RabbitServices;
|
||||
using PARR.Core.Common.Interfaces.RabbitServices;
|
||||
using PARR.DAL.Services.Interfaces.Job;
|
||||
using PARR.Domain.Common.Rabbit.Messages;
|
||||
using PARR.Domain.Common.Roles;
|
||||
|
||||
@@ -5,9 +5,9 @@ using PARR.API.Contracts.V1.Requests.Queries;
|
||||
using PARR.API.Contracts.V1.Responses.Base;
|
||||
using PARR.API.Contracts.V1.Responses.Statistics;
|
||||
using PARR.API.Controllers.V1.Base;
|
||||
using PARR.DAL.InfluxDbServices;
|
||||
using PARR.DAL.Settings;
|
||||
using PARR.Core.Common.Interfaces;
|
||||
using PARR.Domain.Common.Roles;
|
||||
using PARR.Domain.Settings;
|
||||
|
||||
namespace PARR.API.Controllers.V1.Statistics
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ using PARR.API.Contracts.V1.Responses.Base;
|
||||
using PARR.API.Contracts.V1.Responses.Statistics;
|
||||
using PARR.API.Controllers.V1.Base;
|
||||
using PARR.API.Settings;
|
||||
using PARR.Core.Common.RabbitServices;
|
||||
using PARR.Core.Common.Interfaces.RabbitServices;
|
||||
using PARR.Domain.Common.Roles;
|
||||
|
||||
namespace PARR.API.Controllers.V1.Statistics
|
||||
|
||||
@@ -14,11 +14,11 @@ using PARR.API.Contracts.V1.Responses.Statistics;
|
||||
using PARR.API.Controllers.V1.Base;
|
||||
using PARR.API.Services.Interfaces;
|
||||
using PARR.API.Settings;
|
||||
using PARR.DAL.InfluxDbServices;
|
||||
using PARR.Core.Common.Interfaces;
|
||||
using PARR.DAL.Services.Interfaces;
|
||||
using PARR.DAL.Settings;
|
||||
using PARR.Domain.Common.Roles;
|
||||
using PARR.Domain.Enums;
|
||||
using PARR.Domain.Settings;
|
||||
|
||||
namespace PARR.API.Controllers.V1.Statistics
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ using PARR.API.Contracts.V1.Responses.Base;
|
||||
using PARR.API.Controllers.V1.Base;
|
||||
using PARR.API.Services.Interfaces;
|
||||
using PARR.API.Settings;
|
||||
using PARR.Core.Common.RabbitServices;
|
||||
using PARR.Core.Common.Interfaces.RabbitServices;
|
||||
using PARR.DAL.DomainServices.Interfaces;
|
||||
using PARR.Domain.Common.Rabbit.Messages;
|
||||
using PARR.Domain.Entities.Base.History;
|
||||
|
||||
@@ -7,7 +7,7 @@ using PARR.API.Contracts.V1.Responses.Base;
|
||||
using PARR.API.Controllers.V1.Base;
|
||||
using PARR.API.Services.Interfaces;
|
||||
using PARR.API.Settings;
|
||||
using PARR.Core.Common.RabbitServices;
|
||||
using PARR.Core.Common.Interfaces.RabbitServices;
|
||||
using PARR.DAL.Services.Interfaces.Job;
|
||||
using PARR.Domain.Common.Rabbit.Messages;
|
||||
using PARR.Domain.Common.Roles;
|
||||
|
||||
@@ -11,6 +11,7 @@ using PARR.API.Controllers.V1.Base;
|
||||
using PARR.API.Extensions;
|
||||
using PARR.API.Services.Interfaces;
|
||||
using PARR.BLL.Helpers;
|
||||
using PARR.Core.Common.Helpers;
|
||||
using PARR.DAL.Contracts;
|
||||
using PARR.DAL.DomainServices.Shortcodes;
|
||||
using PARR.DAL.Models;
|
||||
|
||||
@@ -5,7 +5,7 @@ using PARR.API.Contracts.V1.Responses.Base;
|
||||
using PARR.API.Controllers.V1.Base;
|
||||
using PARR.API.Services.Interfaces;
|
||||
using PARR.API.Settings;
|
||||
using PARR.DAL.Cache.Services.Base;
|
||||
using PARR.Core.Common.Interfaces;
|
||||
using PARR.DAL.NextRunServices;
|
||||
using PARR.DAL.Services.Interfaces;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ using PARR.API.Contracts.V1.Responses.Base;
|
||||
using PARR.API.Controllers.V1.Base;
|
||||
using PARR.API.Extensions;
|
||||
using PARR.BLL.Helpers;
|
||||
using PARR.Core.Common.Helpers;
|
||||
using PARR.DAL.Models.Unit;
|
||||
using PARR.DAL.Services.Interfaces.Unit;
|
||||
using PARR.Domain.Common.Pagination;
|
||||
|
||||
@@ -9,6 +9,7 @@ using PARR.API.Contracts.V1.Responses.Base;
|
||||
using PARR.API.Controllers.V1.Base;
|
||||
using PARR.API.Extensions;
|
||||
using PARR.BLL.Helpers;
|
||||
using PARR.Core.Common.Helpers;
|
||||
using PARR.DAL.Models.Unit;
|
||||
using PARR.DAL.Services.Interfaces.Unit;
|
||||
using PARR.Domain.Common.Pagination;
|
||||
|
||||
@@ -15,10 +15,8 @@ FROM 10.99.253.167:8090/dotnet/sdk:7.0 AS build
|
||||
WORKDIR /src
|
||||
COPY ["NuGet.config", "."]
|
||||
COPY ["PARR.API/PARR.API.csproj", "PARR.API/"]
|
||||
COPY ["PARR.BLL/PARR.BLL.csproj", "PARR.BLL/"]
|
||||
COPY ["PARR.Common/PARR.Common.csproj", "PARR.Common/"]
|
||||
COPY ["PARR.Domain/PARR.Domain.csproj", "PARR.Domain/"]
|
||||
COPY ["PARR.Core/PARR.Core.csproj", "PARR.Core/"]
|
||||
COPY ["PARR.Domain/PARR.Domain.csproj", "PARR.Domain/"]
|
||||
COPY ["PARR.DAL/PARR.DAL.csproj", "PARR.DAL/"]
|
||||
COPY ["PARR.Infrastructure/PARR.Infrastructure.csproj", "PARR.Infrastructure/"]
|
||||
RUN dotnet restore "PARR.API/PARR.API.csproj"
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PARR.BLL\PARR.BLL.csproj" />
|
||||
<ProjectReference Include="..\PARR.Core\PARR.Core.csproj" />
|
||||
<ProjectReference Include="..\PARR.DAL\PARR.DAL.csproj" />
|
||||
<ProjectReference Include="..\PARR.Infrastructure\PARR.Infrastructure.csproj" />
|
||||
|
||||
@@ -3,7 +3,6 @@ using FluentValidation;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using PARR.API.Authentication;
|
||||
using PARR.API.Installers;
|
||||
using PARR.BLL;
|
||||
using PARR.Core;
|
||||
using PARR.DAL;
|
||||
using PARR.Infrastructure;
|
||||
@@ -28,7 +27,6 @@ builder.Services.InstallDalServices(builder.Configuration);
|
||||
builder.Services.AddCoreServices(builder.Configuration);
|
||||
builder.Services.AddInfrastructureServices(builder.Configuration);
|
||||
//---- --- ----
|
||||
builder.Services.InstallBllServices(builder.Configuration);
|
||||
builder.Services.InstallApiServices(builder.Configuration);
|
||||
builder.Services.InstallSettings(builder.Configuration);
|
||||
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
|
||||
|
||||
@@ -3,12 +3,11 @@ using PARR.API.Authentication.Models;
|
||||
using PARR.API.Domain.InfluxDbModels;
|
||||
using PARR.API.Services.Interfaces;
|
||||
using PARR.API.Settings;
|
||||
using PARR.DAL.Cache.Services.Base;
|
||||
using PARR.DAL.InfluxDbServices;
|
||||
using PARR.Core.Common.Interfaces;
|
||||
using PARR.DAL.Services.Interfaces;
|
||||
using PARR.DAL.Services.Interfaces.Unit;
|
||||
using PARR.DAL.Settings;
|
||||
using PARR.Domain.Common.Roles;
|
||||
using PARR.Domain.Settings;
|
||||
|
||||
namespace PARR.API.Services.Implementations
|
||||
{
|
||||
|
||||
@@ -1,83 +1,80 @@
|
||||
using PARR.API.Contracts.V1.Requests.Queries;
|
||||
using PARR.API.Services.Interfaces;
|
||||
using PARR.BLL.Services.Interfaces;
|
||||
using PARR.DAL.Models;
|
||||
using PARR.API.Services.Interfaces;
|
||||
|
||||
namespace PARR.API.Services.Implementations
|
||||
{
|
||||
internal class WorkLoadService : IWorkLoadService
|
||||
{
|
||||
private readonly ICalendarService calendarService;
|
||||
//private readonly ICalendarService calendarService;
|
||||
|
||||
public WorkLoadService(ICalendarService calendarService)
|
||||
{
|
||||
this.calendarService = calendarService;
|
||||
}
|
||||
//public WorkLoadService(ICalendarService calendarService)
|
||||
//{
|
||||
// this.calendarService = calendarService;
|
||||
//}
|
||||
|
||||
private DateTime GetStartDate(int timeZoneOffsetHours)
|
||||
{
|
||||
//(так уже не делаем) начинаем не с сегодняшнего дня, а с завтра, так как на сегодня уже некоторые работы были проведены и их дата изменилась
|
||||
//return DateTimeOffset.UtcNow.AddHours(timeZoneOffsetHours).Date.AddDays(1);
|
||||
//private DateTime GetStartDate(int timeZoneOffsetHours)
|
||||
//{
|
||||
// //(так уже не делаем) начинаем не с сегодняшнего дня, а с завтра, так как на сегодня уже некоторые работы были проведены и их дата изменилась
|
||||
// //return DateTimeOffset.UtcNow.AddHours(timeZoneOffsetHours).Date.AddDays(1);
|
||||
|
||||
var dateWithTimeZoneOffset = calendarService.GetDateWithTimeZoneOffset(DateTimeOffset.UtcNow, timeZoneOffsetHours);
|
||||
//var dateWithAddDays = dateWithTimeZoneOffset.DateTime.AddDays(1);
|
||||
var dateWithAddDays = dateWithTimeZoneOffset.DateTime.AddDays(0);
|
||||
// var dateWithTimeZoneOffset = calendarService.GetDateWithTimeZoneOffset(DateTimeOffset.UtcNow, timeZoneOffsetHours);
|
||||
// //var dateWithAddDays = dateWithTimeZoneOffset.DateTime.AddDays(1);
|
||||
// var dateWithAddDays = dateWithTimeZoneOffset.DateTime.AddDays(0);
|
||||
|
||||
//var bbb = dateWithTimeZoneOffset.DateTime.AddDays(1);
|
||||
// //var bbb = dateWithTimeZoneOffset.DateTime.AddDays(1);
|
||||
|
||||
//return calendarService.GetDateWithTimeZoneOffset(DateTimeOffset.UtcNow, timeZoneOffsetHours).UtcDateTime.AddDays(1);
|
||||
return dateWithAddDays;
|
||||
}
|
||||
// //return calendarService.GetDateWithTimeZoneOffset(DateTimeOffset.UtcNow, timeZoneOffsetHours).UtcDateTime.AddDays(1);
|
||||
// return dateWithAddDays;
|
||||
//}
|
||||
|
||||
|
||||
private DateTime GetEndDate(bool? isMonth, int timeZoneOffsetHours)
|
||||
{
|
||||
var startDate = GetStartDate(timeZoneOffsetHours);
|
||||
//private DateTime GetEndDate(bool? isMonth, int timeZoneOffsetHours)
|
||||
//{
|
||||
// var startDate = GetStartDate(timeZoneOffsetHours);
|
||||
|
||||
return isMonth == true ? startDate.AddDays(30) : startDate.AddDays(6);
|
||||
}
|
||||
// return isMonth == true ? startDate.AddDays(30) : startDate.AddDays(6);
|
||||
//}
|
||||
|
||||
|
||||
public List<DateOnly> GetDatesForPeriod(WorkloadBaseQuery requestQuery)
|
||||
{
|
||||
var startDate = GetStartDate(requestQuery.TimeZoneOffsetHours);
|
||||
var endDate = GetEndDate(requestQuery.IsMonth, requestQuery.TimeZoneOffsetHours);
|
||||
//public List<DateOnly> GetDatesForPeriod(WorkloadBaseQuery requestQuery)
|
||||
//{
|
||||
// var startDate = GetStartDate(requestQuery.TimeZoneOffsetHours);
|
||||
// var endDate = GetEndDate(requestQuery.IsMonth, requestQuery.TimeZoneOffsetHours);
|
||||
|
||||
//var daysList = new List<DateTimeOffset>();
|
||||
// //var daysList = new List<DateTimeOffset>();
|
||||
|
||||
//daysList.Add(new DateTimeOffset(startDate, new TimeSpan(0)));
|
||||
// //daysList.Add(new DateTimeOffset(startDate, new TimeSpan(0)));
|
||||
|
||||
//while (daysList.Last() < endDate)
|
||||
// daysList.Add(daysList.Last().AddDays(1));
|
||||
// //while (daysList.Last() < endDate)
|
||||
// // daysList.Add(daysList.Last().AddDays(1));
|
||||
|
||||
//return daysList.OrderBy(t => t).ToList();
|
||||
// //return daysList.OrderBy(t => t).ToList();
|
||||
|
||||
//var aaa = DateOnly.FromDateTime(startDate);
|
||||
// //var aaa = DateOnly.FromDateTime(startDate);
|
||||
|
||||
return calendarService.GetDatesForPeriod(DateOnly.FromDateTime(startDate), DateOnly.FromDateTime(endDate));
|
||||
}
|
||||
// return calendarService.GetDatesForPeriod(DateOnly.FromDateTime(startDate), DateOnly.FromDateTime(endDate));
|
||||
//}
|
||||
|
||||
|
||||
public IQueryable<Template> FilterTemplatesQuery(IQueryable<Template> query, WorkloadBaseQuery requestQuery)
|
||||
{
|
||||
var startDate = GetStartDate(requestQuery.TimeZoneOffsetHours);
|
||||
var endDate = GetEndDate(requestQuery.IsMonth, requestQuery.TimeZoneOffsetHours);
|
||||
//public IQueryable<Template> FilterTemplatesQuery(IQueryable<Template> query, WorkloadBaseQuery requestQuery)
|
||||
//{
|
||||
// var startDate = GetStartDate(requestQuery.TimeZoneOffsetHours);
|
||||
// var endDate = GetEndDate(requestQuery.IsMonth, requestQuery.TimeZoneOffsetHours);
|
||||
|
||||
//query = query.Where(t =>
|
||||
// t.NextRun.DateTime.Date >= startDate.Date && t.NextRun.DateTime.Date <= endDate.Date
|
||||
// );
|
||||
// //query = query.Where(t =>
|
||||
// // t.NextRun.DateTime.Date >= startDate.Date && t.NextRun.DateTime.Date <= endDate.Date
|
||||
// // );
|
||||
|
||||
query = query.Where(t =>
|
||||
t.NextRun.DateTime.AddHours(requestQuery.TimeZoneOffsetHours).Date >= startDate.Date && t.NextRun.DateTime.AddHours(requestQuery.TimeZoneOffsetHours).Date <= endDate.Date
|
||||
);
|
||||
// query = query.Where(t =>
|
||||
// t.NextRun.DateTime.AddHours(requestQuery.TimeZoneOffsetHours).Date >= startDate.Date && t.NextRun.DateTime.AddHours(requestQuery.TimeZoneOffsetHours).Date <= endDate.Date
|
||||
// );
|
||||
|
||||
if (requestQuery.IsActiveTemplate.HasValue)
|
||||
query = query.Where(t => t.IsActiveTemplate == requestQuery.IsActiveTemplate.Value);
|
||||
// if (requestQuery.IsActiveTemplate.HasValue)
|
||||
// query = query.Where(t => t.IsActiveTemplate == requestQuery.IsActiveTemplate.Value);
|
||||
|
||||
if (requestQuery.IsActiveSchedule.HasValue)
|
||||
query = query.Where(t => t.IsActiveSchedule == requestQuery.IsActiveSchedule.Value);
|
||||
// if (requestQuery.IsActiveSchedule.HasValue)
|
||||
// query = query.Where(t => t.IsActiveSchedule == requestQuery.IsActiveSchedule.Value);
|
||||
|
||||
return query;
|
||||
}
|
||||
// return query;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@ namespace PARR.API.Services.Interfaces
|
||||
/// </summary>
|
||||
public interface IWorkLoadService
|
||||
{
|
||||
IQueryable<Template> FilterTemplatesQuery(IQueryable<Template> query, WorkloadBaseQuery requestQuery);
|
||||
//IQueryable<Template> FilterTemplatesQuery(IQueryable<Template> query, WorkloadBaseQuery requestQuery);
|
||||
|
||||
List<DateOnly> GetDatesForPeriod(WorkloadBaseQuery requestQuery);
|
||||
//List<DateOnly> GetDatesForPeriod(WorkloadBaseQuery requestQuery);
|
||||
|
||||
//DateTime GetEndDate(DateTime startDate, bool? isMonth);
|
||||
//DateTime GetStartDate();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using FluentValidation;
|
||||
using PARR.API.Contracts.V1.Requests;
|
||||
using PARR.BLL.Services.Interfaces;
|
||||
using PARR.DAL.Services.Interfaces;
|
||||
|
||||
namespace PARR.API.Validators
|
||||
@@ -12,8 +11,8 @@ namespace PARR.API.Validators
|
||||
private bool? isValid = null;
|
||||
|
||||
public WorkRequestValidator(
|
||||
ITnkService tnkService,
|
||||
ITemplateMaskValidator templateMaskValidator
|
||||
ITnkService tnkService
|
||||
//ITemplateMaskValidator templateMaskValidator
|
||||
)
|
||||
{
|
||||
this.tnkService = tnkService;
|
||||
|
||||
@@ -26,9 +26,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"StorageSettings": {
|
||||
"StoragePath": "W:\\"
|
||||
},
|
||||
"MqSettings": {
|
||||
"GenerateTemplates": {
|
||||
"HostName": "10.99.253.216"
|
||||
|
||||
@@ -22,13 +22,6 @@
|
||||
"CorsSettings": {
|
||||
"AllowedHosts": "http://localhost:4200; http://10.99.253.221:8083; http://dvgd-web-09.dvgd.oao.rzd:8094"
|
||||
},
|
||||
"StorageSettings": {
|
||||
"StoragePath": "Data",
|
||||
"EsppTemplates": {
|
||||
"AllowedExtensions": [ ".csv" ],
|
||||
"MaxFileSizeMb": 100
|
||||
}
|
||||
},
|
||||
"MqSettings": {
|
||||
"GenerateTemplates": {
|
||||
"HostName": "parr-rabbitmq",
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace PARR.BLL.Domain
|
||||
{
|
||||
public class TemplateNameConstantPart
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
public required string Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace PARR.BLL.Domain
|
||||
{
|
||||
public class UploadResult
|
||||
{
|
||||
public required string FileName { get; set; }
|
||||
public required string Path { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace PARR.BLL.Helpers
|
||||
{
|
||||
public static class TemplateHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Генерация имени шаблона
|
||||
/// </summary>
|
||||
/// <param name="prefix">%PREFIX% для замены в шаблоне настроек</param>
|
||||
/// <param name="settingsPrefix">берется из настроек</param>
|
||||
/// <param name="ek"></param>
|
||||
/// <param name="work"></param>
|
||||
/// <returns></returns>
|
||||
public static string GenerateTemplateName(string prefix, string settingsPrefix, string ek, string work)
|
||||
{
|
||||
if (string.IsNullOrEmpty(prefix))
|
||||
prefix = "ОБЩЕЕ";
|
||||
|
||||
if (string.IsNullOrEmpty(settingsPrefix))
|
||||
settingsPrefix = "%PREFIX%-ЭИТИ-ПАРР";
|
||||
|
||||
var joinedPrefix = settingsPrefix.Replace("%PREFIX%", prefix);
|
||||
|
||||
var splitter = "__";
|
||||
return joinedPrefix + splitter + ek + splitter + work.Replace(" ", "-").ToUpper();
|
||||
}
|
||||
|
||||
|
||||
public static string GenerateTemplateNameWithResponseArea(string responseAreaCode, string settingsPrefix, string ek, string work)
|
||||
{
|
||||
var shortName = new Regex("[А-я]+$").Match(responseAreaCode).Value;
|
||||
|
||||
return GenerateTemplateName(shortName, settingsPrefix, ek, work);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
|
||||
<PackageReference Include="RabbitMQ.Client" Version="7.1.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PARR.Common\PARR.Common.csproj" />
|
||||
<ProjectReference Include="..\PARR.Constants\PARR.Constants.csproj" />
|
||||
<ProjectReference Include="..\PARR.Domain\PARR.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,30 +0,0 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using PARR.BLL.Services.Implementations;
|
||||
using PARR.BLL.Services.Interfaces;
|
||||
using PARR.BLL.Settings;
|
||||
|
||||
namespace PARR.BLL
|
||||
{
|
||||
public static class ParrBllInstaller
|
||||
{
|
||||
public static void InstallBllServices(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
|
||||
var storageSettings = new StorageSettings();
|
||||
configuration.GetSection(nameof(StorageSettings)).Bind(storageSettings);
|
||||
services.AddSingleton(storageSettings);
|
||||
|
||||
|
||||
//services.AddTransient<IFileService, FileService>();
|
||||
|
||||
//services.AddTransient<IMqService, MqService>();
|
||||
//services.AddTransient<IMqService, MqServiceV2>();
|
||||
|
||||
//services.AddHttpClient<IMqAdminService, MqAdminService>();
|
||||
services.AddTransient<ITransformService, TransformService>();
|
||||
services.AddTransient<ICalendarService, CalendarService>();
|
||||
services.AddTransient<ITemplateMaskValidator, TemplateMaskValidator>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.BLL.Services.Interfaces;
|
||||
using PARR.Common;
|
||||
using PARR.Domain.Enums;
|
||||
|
||||
namespace PARR.BLL.Services.Implementations
|
||||
{
|
||||
internal class CalendarService : ICalendarService
|
||||
{
|
||||
|
||||
|
||||
|
||||
// !!! Вообще не использовать этот класс!!! Удалить его!!! Есть же INextRunServiceV2, вот его и использовать!!!
|
||||
|
||||
|
||||
|
||||
private readonly ILogger<CalendarService> logger;
|
||||
|
||||
public CalendarService(ILogger<CalendarService> logger)
|
||||
{
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
|
||||
public DateOnly GetEndPeriodDate(DateOnly startPeriod, DistributionPeriodTypeEnum periodType, string distributionPeriod)
|
||||
{
|
||||
switch (periodType)
|
||||
{
|
||||
case (DistributionPeriodTypeEnum.Day):
|
||||
return startPeriod.AddDays(ParseInt(distributionPeriod)).AddDays(-1);
|
||||
|
||||
case (DistributionPeriodTypeEnum.Month):
|
||||
return startPeriod.AddMonths(ParseInt(distributionPeriod)).AddDays(-1);
|
||||
|
||||
case (DistributionPeriodTypeEnum.Year):
|
||||
return startPeriod.AddYears(ParseInt(distributionPeriod)).AddDays(-1);
|
||||
|
||||
}
|
||||
|
||||
return startPeriod;
|
||||
}
|
||||
|
||||
|
||||
private int ParseInt(string value)
|
||||
{
|
||||
try
|
||||
{
|
||||
return int.Parse(value);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, $"{nameof(CalendarService)}, получение конца периода. Не смог распарсить string в int для значения {value}.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает список рабочих дней с начала периода без выходных
|
||||
/// </summary>
|
||||
/// <param name="startPeriod"></param>
|
||||
/// <param name="refTime"></param>
|
||||
/// <param name="periodType"></param>
|
||||
/// <param name="distributionPeriod"></param>
|
||||
/// <param name="getWeekends"></param>
|
||||
/// <returns></returns>
|
||||
public List<DateOnly> GetWorkDatesForPeriod(DateOnly startPeriod, TimeOnly refTime, DistributionPeriodTypeEnum periodType, string distributionPeriod, GetWeekendsDelegate getWeekends)
|
||||
{
|
||||
var endPeriod = GetEndPeriodDate(startPeriod, periodType, distributionPeriod);
|
||||
|
||||
//не получилось сделать асинхронным
|
||||
var weekends = getWeekends.Invoke(startPeriod, endPeriod).ToList(); //.ToListAsync();
|
||||
|
||||
//Берем список дат за период
|
||||
var workDays = GetDatesForPeriod(startPeriod, endPeriod);
|
||||
|
||||
//Убираем праздники
|
||||
if (weekends.Any())
|
||||
workDays = workDays.Where(t => !weekends.Any(x => x == t)).ToList();
|
||||
|
||||
//РАСКОММЕНТИРОВАТЬ НИЖЕ (28 дней), если не использовать календарь выходных дней
|
||||
////Убираем числа старше 28, чтобы сравнять продолжительность с февралем
|
||||
//workDays.RemoveAll(t => t.Day > 28);
|
||||
|
||||
//Так как в базе всё храним в UTC то время с 21 часа уже соответствует следующими суткам в календаре Москвы
|
||||
//просто сдвигаем на день весь список
|
||||
//if (refTime.Hour > 21)
|
||||
if (DateResolver.IsCurrentDayRelativeMskTime(refTime.Hour) == false)
|
||||
return workDays.Select(wd => wd.AddDays(-1)).ToList();
|
||||
|
||||
//иначе просто отдаём как есть
|
||||
return workDays;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает список дней между датами
|
||||
/// </summary>
|
||||
/// <param name="startPeriod"></param>
|
||||
/// <param name="endPeriod"></param>
|
||||
/// <returns></returns>
|
||||
public List<DateOnly> GetDatesForPeriod(DateOnly startPeriod, DateOnly endPeriod)
|
||||
{
|
||||
var workDaysList = new List<DateOnly>();
|
||||
|
||||
var currentDay = startPeriod;
|
||||
|
||||
while (currentDay <= endPeriod)
|
||||
{
|
||||
workDaysList.Add(currentDay);
|
||||
currentDay = currentDay.AddDays(1);
|
||||
}
|
||||
|
||||
return workDaysList.OrderBy(t => t).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает список дней между датами
|
||||
/// </summary>
|
||||
/// <param name="startPeriod"></param>
|
||||
/// <param name="endPeriod"></param>
|
||||
/// <returns></returns>
|
||||
public List<DateOnly> GetDatesForPeriod(DateTimeOffset startPeriod, DateTimeOffset endPeriod)
|
||||
{
|
||||
return GetDatesForPeriod(DateOnly.FromDateTime(startPeriod.DateTime), DateOnly.FromDateTime(endPeriod.DateTime));
|
||||
}
|
||||
|
||||
|
||||
public DateTimeOffset GetDateWithTimeZoneOffset(DateTimeOffset date, int timeZoneOffsetHours)
|
||||
{
|
||||
return date.AddHours(timeZoneOffsetHours);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
using PARR.BLL.Services.Interfaces;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace PARR.BLL.Services.Implementations
|
||||
{
|
||||
internal class TemplateMaskValidator : ITemplateMaskValidator
|
||||
{
|
||||
public bool IsValid(string mask)
|
||||
{
|
||||
if (!mask.Contains("ПАРР"))
|
||||
return false;
|
||||
|
||||
var shortcodePattern = "%[^%\\s]+%";
|
||||
var shortcodesInMask = Regex.Matches(mask, shortcodePattern).ToList();
|
||||
|
||||
if (shortcodesInMask.Count() == 0)
|
||||
return false;
|
||||
|
||||
var validShortcodes = GetShortcodesNames();
|
||||
|
||||
foreach (var shortcode in shortcodesInMask)
|
||||
{
|
||||
if (!validShortcodes.Contains(shortcode.ToString().ToUpper()))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private List<string> GetShortcodesNames()//TODO Ну ты опять этот метод дублируешь?!
|
||||
{
|
||||
var result = new List<string> {
|
||||
"%ЭК%",
|
||||
"%ЗО%",
|
||||
"%РАБОТА%"
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
using PARR.Domain.Enums;
|
||||
|
||||
namespace PARR.BLL.Services.Interfaces
|
||||
{
|
||||
public delegate IQueryable<DateOnly> GetWeekendsDelegate(DateOnly start, DateOnly end);
|
||||
|
||||
public interface ICalendarService
|
||||
{
|
||||
/// <summary>
|
||||
/// Возвращает список дней между датами
|
||||
/// </summary>
|
||||
/// <param name="startPeriod"></param>
|
||||
/// <param name="endPeriod"></param>
|
||||
/// <returns></returns>
|
||||
List<DateOnly> GetDatesForPeriod(DateOnly startPeriod, DateOnly endPeriod);
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает список дней между датами
|
||||
/// </summary>
|
||||
/// <param name="startPeriod"></param>
|
||||
/// <param name="endPeriod"></param>
|
||||
/// <returns></returns>
|
||||
List<DateOnly> GetDatesForPeriod(DateTimeOffset startPeriod, DateTimeOffset endPeriod);
|
||||
|
||||
/// <summary>
|
||||
/// Получить дату со смещенной часовой зоной
|
||||
/// </summary>
|
||||
/// <param name="date"></param>
|
||||
/// <param name="timeZoneOffsetHours"></param>
|
||||
/// <returns></returns>
|
||||
DateTimeOffset GetDateWithTimeZoneOffset(DateTimeOffset date, int timeZoneOffsetHours);
|
||||
DateOnly GetEndPeriodDate(DateOnly startPeriod, DistributionPeriodTypeEnum periodType, string distributionPeriod);
|
||||
|
||||
/// <summary>
|
||||
/// Получить только рабочие дни за период
|
||||
/// </summary>
|
||||
/// <param name="startPeriod"></param>
|
||||
/// <param name="refTime"></param>
|
||||
/// <param name="typePeriod"></param>
|
||||
/// <param name="distributionPeriod"></param>
|
||||
/// <param name="getWeekends"></param>
|
||||
/// <returns></returns>
|
||||
List<DateOnly> GetWorkDatesForPeriod(DateOnly startPeriod, TimeOnly refTime, DistributionPeriodTypeEnum periodType, string distributionPeriod, GetWeekendsDelegate getWeekends);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PARR.BLL.Services.Interfaces
|
||||
{
|
||||
public interface ITemplateMaskValidator
|
||||
{
|
||||
bool IsValid(string mask);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
namespace PARR.BLL.Settings
|
||||
{
|
||||
public class StorageSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// Путь к хранилищу
|
||||
/// </summary>
|
||||
public string StoragePath { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Настройки хранилища загрузки шаблонов ЕСПП
|
||||
/// </summary>
|
||||
public StorageSettingsEsspTemplates? EsppTemplates { get; set; }
|
||||
}
|
||||
|
||||
public class StorageSettingsEsspTemplates
|
||||
{
|
||||
public string[] TemplatePath => new string[] { "espp-templates" };
|
||||
|
||||
public string[] AllowedExtensions { get; set; } = Array.Empty<string>();
|
||||
|
||||
public int MaxFileSizeMb { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
namespace PARR.Common
|
||||
{
|
||||
//TODO:!!! Удалить этот класс !!!
|
||||
|
||||
/// <summary>
|
||||
/// Даты и часовые пояса
|
||||
/// </summary>
|
||||
public static class DateResolver
|
||||
{
|
||||
/// <summary>
|
||||
/// Это текущий день относительно часовой зоны МСК? Да - текущий, нет - следующий день.
|
||||
/// Так делаьб фуфуфу!!!
|
||||
/// смотри IsCurrentDayRelativeMskTime(int hour)
|
||||
/// </summary>
|
||||
/// <param name="date">Дата ЮТС</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsCurrentDayRelativeMskTime(DateTimeOffset date)
|
||||
{
|
||||
// смотри IsCurrentDayRelativeMskTime(int hour)
|
||||
return IsCurrentDayRelativeMskTime(date.Hour);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Это текущий день относительно часовой зоны МСК? Да - текущий, нет - следующий день.
|
||||
/// </summary>
|
||||
/// <param name="hour">Час</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsCurrentDayRelativeMskTime(int hour)
|
||||
{
|
||||
//Так как в базе всё храним в UTC то время с 21 часа уже соответствует следующими суткам в календаре Москвы
|
||||
|
||||
//TODO: Не надо так делать!!! НИКАДА!!!
|
||||
// нужно добавить к таймзоне ЮТС +3 часа, посчитать в МСК и потом обратно отнять 3 часа
|
||||
|
||||
if (hour >= 21)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,9 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace PARR.BLL.Helpers
|
||||
namespace PARR.Core.Common.Helpers
|
||||
{
|
||||
public static class SqlHelpers
|
||||
{
|
||||
@@ -1,8 +1,8 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.BLL.Services.Interfaces;
|
||||
using PARR.Core.Common.Interfaces;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace PARR.BLL.Services.Implementations
|
||||
namespace PARR.Core.Common.Implementations
|
||||
{
|
||||
internal class TransformService: ITransformService
|
||||
{
|
||||
@@ -1,10 +1,14 @@
|
||||
using InfluxDB.Client;
|
||||
|
||||
namespace PARR.DAL.InfluxDbServices
|
||||
namespace PARR.Core.Common.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Сервис взаимодействия с InfluxDb
|
||||
/// </summary>
|
||||
public interface IInfluxDbService
|
||||
{
|
||||
Task<T> QueryAsync<T>(Func<QueryApi, Task<T>> action, string token);
|
||||
|
||||
bool Write(Action<WriteApi> action, string token);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace PARR.Core.Common
|
||||
namespace PARR.Core.Common.Interfaces
|
||||
{
|
||||
//public delegate Task IntervalHandlerDelegate();
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
namespace PARR.DAL.Cache.Services.Base
|
||||
namespace PARR.Core.Common.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Сервис по управлению КЭШ
|
||||
/// </summary>
|
||||
public interface IRedisCacheService
|
||||
{
|
||||
/// <summary>
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace PARR.BLL.Services.Interfaces
|
||||
namespace PARR.Core.Common.Interfaces
|
||||
{
|
||||
public interface ITransformService
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
using PARR.Domain.DTOs.RabbitApi;
|
||||
using PARR.Domain.Settings;
|
||||
|
||||
namespace PARR.Core.Common.RabbitServices
|
||||
namespace PARR.Core.Common.Interfaces.RabbitServices
|
||||
{
|
||||
public interface IRabbitAdminService
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
using PARR.Domain.Common.Rabbit;
|
||||
using PARR.Domain.Settings;
|
||||
|
||||
namespace PARR.Core.Common.RabbitServices
|
||||
namespace PARR.Core.Common.Interfaces.RabbitServices
|
||||
{
|
||||
public delegate Task MqMessageHandlerDelegate(string msg);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using FluentValidation;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using PARR.Core.Common.Implementations;
|
||||
using PARR.Core.Common.Interfaces;
|
||||
|
||||
namespace PARR.Core
|
||||
{
|
||||
@@ -22,8 +24,19 @@ namespace PARR.Core
|
||||
services.AddValidatorsFromAssembly(typeof(DependencyInjection).Assembly, includeInternalTypes: true);
|
||||
|
||||
// Регистрируем сревисы Core
|
||||
|
||||
#region Common
|
||||
|
||||
services.AddTransient<ITransformService, TransformService>();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Services
|
||||
|
||||
//services.AddScoped<IUserService, UserService>();
|
||||
|
||||
#endregion
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
|
||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.5.2" />
|
||||
<PackageReference Include="InfluxDB.Client" Version="4.17.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.20" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PARR.BLL.Domain;
|
||||
using PARR.DAL.Contracts;
|
||||
using PARR.DAL.Extensions;
|
||||
using PARR.DAL.Models;
|
||||
@@ -7,6 +6,7 @@ using PARR.DAL.Models.Job;
|
||||
using PARR.DAL.Models.Schedule;
|
||||
using PARR.DAL.Models.Unit;
|
||||
using PARR.Domain.Common.Roles;
|
||||
using PARR.Domain.Common.Template;
|
||||
using PARR.Domain.Entities.TaskEntities;
|
||||
using PARR.Domain.Enums;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using PARR.BLL.Domain;
|
||||
using PARR.DAL.Extensions;
|
||||
using PARR.DAL.Extensions;
|
||||
using PARR.Domain.Common.Template;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using PARR.DAL.Cache.Models;
|
||||
using PARR.Domain.Cache.Models;
|
||||
|
||||
namespace PARR.DAL.DomainModels
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PARR.DAL.Cache.Models;
|
||||
using PARR.DAL.Cache.Services.Base;
|
||||
using PARR.Core.Common.Interfaces;
|
||||
using PARR.DAL.DomainModels;
|
||||
using PARR.DAL.DomainServices.Interfaces;
|
||||
using PARR.DAL.Services.Interfaces.Job;
|
||||
using PARR.Domain.Cache.Models;
|
||||
using PARR.Domain.Enums;
|
||||
|
||||
namespace PARR.DAL.DomainServices.Implementations
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using PARR.DAL.Cache.Models;
|
||||
using PARR.DAL.DomainModels;
|
||||
using PARR.DAL.DomainModels;
|
||||
using PARR.Domain.Cache.Models;
|
||||
using PARR.Domain.Enums;
|
||||
|
||||
namespace PARR.DAL.DomainServices.Interfaces
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.DAL.Cache.Services.Base;
|
||||
using PARR.Core.Common.Interfaces;
|
||||
using PARR.DAL.Contracts;
|
||||
using PARR.DAL.DomainModels;
|
||||
using PARR.DAL.DomainServices.Shortcodes.Models;
|
||||
@@ -10,6 +10,7 @@ using PARR.DAL.Models.Job;
|
||||
using PARR.DAL.Services.Interfaces;
|
||||
using PARR.DAL.Services.Interfaces.Job;
|
||||
using PARR.DAL.Services.Interfaces.Unit;
|
||||
using PARR.Domain.Common.Template;
|
||||
using PARR.Domain.Enums;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.RegularExpressions;
|
||||
@@ -667,7 +668,7 @@ namespace PARR.DAL.DomainServices.Shortcodes
|
||||
return input.Replace(shortcode, replacement, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
private static string ReplaceConstants(List<BLL.Domain.TemplateNameConstantPart> nameConstants, string resultName)
|
||||
private static string ReplaceConstants(List<TemplateNameConstantPart> nameConstants, string resultName)
|
||||
{
|
||||
foreach (var item in nameConstants)
|
||||
resultName = resultName.Replace($"%{item.Name}%", item.Value);
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using PARR.DAL.Cache.Models;
|
||||
using PARR.DAL.Cache.Services.Base;
|
||||
using PARR.DAL.Contracts;
|
||||
using PARR.Core.Common.Interfaces;
|
||||
using PARR.DAL.DomainServices.UnitFilterService.Models;
|
||||
using PARR.DAL.Models.Job;
|
||||
using PARR.DAL.Models.Unit;
|
||||
using PARR.DAL.Services.Interfaces.Job;
|
||||
using PARR.DAL.Services.Interfaces.Unit;
|
||||
using PARR.Domain.Cache.Models;
|
||||
using PARR.Domain.Enums;
|
||||
using System.Diagnostics;
|
||||
|
||||
|
||||
@@ -7,12 +7,10 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="InfluxDB.Client" Version="4.17.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.5">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="7.0.12" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
||||
|
||||
@@ -3,7 +3,6 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.Core.Repositories.Interfaces.TaskRepositories;
|
||||
using PARR.DAL.Cache.Services.Base;
|
||||
using PARR.DAL.Configurations.DbSettings;
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Contracts;
|
||||
@@ -12,7 +11,6 @@ using PARR.DAL.DomainServices.Interfaces;
|
||||
using PARR.DAL.DomainServices.Shortcodes;
|
||||
using PARR.DAL.DomainServices.UnitFilterService;
|
||||
using PARR.DAL.DomainServices.UnitFilterService.Models;
|
||||
using PARR.DAL.InfluxDbServices;
|
||||
using PARR.DAL.NextRunServices;
|
||||
using PARR.DAL.NextRunServices.Subservices;
|
||||
using PARR.DAL.Repositories.TaskRepositories;
|
||||
@@ -27,7 +25,6 @@ using PARR.DAL.Services.Interfaces.Schedule;
|
||||
using PARR.DAL.Services.Interfaces.Unit;
|
||||
using PARR.DAL.Settings;
|
||||
using PARR.DAL.TaskServices;
|
||||
using StackExchange.Redis;
|
||||
|
||||
namespace PARR.DAL
|
||||
{
|
||||
@@ -54,36 +51,36 @@ namespace PARR.DAL
|
||||
|
||||
#region Redis + cache services
|
||||
|
||||
services.AddSingleton<IConnectionMultiplexer>(sp =>
|
||||
{
|
||||
// IConnectionMultiplexer - для нативных операций Redis
|
||||
var connectionString = configuration.GetConnectionString("RedisConnection");
|
||||
return ConnectionMultiplexer.Connect(connectionString);
|
||||
});
|
||||
//services.AddSingleton<IConnectionMultiplexer>(sp =>
|
||||
//{
|
||||
// // IConnectionMultiplexer - для нативных операций Redis
|
||||
// var connectionString = configuration.GetConnectionString("RedisConnection");
|
||||
// return ConnectionMultiplexer.Connect(connectionString);
|
||||
//});
|
||||
|
||||
services.AddStackExchangeRedisCache(opt =>
|
||||
{
|
||||
opt.Configuration = configuration.GetConnectionString("RedisConnection");
|
||||
});
|
||||
//services.AddStackExchangeRedisCache(opt =>
|
||||
//{
|
||||
// opt.Configuration = configuration.GetConnectionString("RedisConnection");
|
||||
//});
|
||||
|
||||
|
||||
var groupedShortcodesCacheSettings = new GroupedShortcodesCacheSettings();
|
||||
configuration.GetSection(nameof(GroupedShortcodesCacheSettings)).Bind(groupedShortcodesCacheSettings);
|
||||
services.AddSingleton(groupedShortcodesCacheSettings);
|
||||
|
||||
services.AddSingleton<IRedisCacheService, RedisCacheService>();
|
||||
//services.AddSingleton<IRedisCacheService, RedisCacheService>();
|
||||
|
||||
#endregion
|
||||
|
||||
#region InfluxDb
|
||||
//#region InfluxDb
|
||||
|
||||
var influxDbSettings = new InfluxDbSettings();
|
||||
configuration.GetSection(nameof(InfluxDbSettings)).Bind(influxDbSettings);
|
||||
services.AddSingleton(influxDbSettings);
|
||||
//var influxDbSettings = new InfluxDbSettings();
|
||||
//configuration.GetSection(nameof(InfluxDbSettings)).Bind(influxDbSettings);
|
||||
//services.AddSingleton(influxDbSettings);
|
||||
|
||||
services.AddTransient<IInfluxDbService, InfluxDbService>();
|
||||
//services.AddTransient<IInfluxDbService, InfluxDbService>();
|
||||
|
||||
#endregion
|
||||
//#endregion
|
||||
|
||||
|
||||
// Entity services
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.DAL.Cache.Services.Base;
|
||||
using PARR.Core.Common.Interfaces;
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Contracts;
|
||||
using PARR.DAL.Models;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace PARR.DAL.Cache.Models.Base
|
||||
namespace PARR.Domain.Cache.Models.Base
|
||||
{
|
||||
/// <summary>
|
||||
/// Базовый интерфейс для КЭШ моделей
|
||||
@@ -1,7 +1,7 @@
|
||||
using PARR.DAL.Cache.Models.Base;
|
||||
using PARR.Domain.Cache.Models.Base;
|
||||
using PARR.Domain.Enums;
|
||||
|
||||
namespace PARR.DAL.Cache.Models
|
||||
namespace PARR.Domain.Cache.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// КЭШ модель, состояние matching`a
|
||||
@@ -1,6 +1,6 @@
|
||||
using PARR.DAL.Cache.Models.Base;
|
||||
using PARR.Domain.Cache.Models.Base;
|
||||
|
||||
namespace PARR.DAL.Cache.Models
|
||||
namespace PARR.Domain.Cache.Models
|
||||
{
|
||||
public class UnitFilterIds : IBaseCache<UnitFilterIdsDto>
|
||||
{
|
||||
11
PARR.Domain/Common/Template/TemplateNameConstantPart.cs
Normal file
11
PARR.Domain/Common/Template/TemplateNameConstantPart.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace PARR.Domain.Common.Template
|
||||
{
|
||||
/// <summary>
|
||||
/// Модель хранения частей имени шаблона в настройках
|
||||
/// </summary>
|
||||
public class TemplateNameConstantPart
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
public required string Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
namespace PARR.DAL.Settings
|
||||
namespace PARR.Domain.Settings
|
||||
{
|
||||
/// <summary>
|
||||
/// Настройки подключения к InfluxDb
|
||||
/// </summary>
|
||||
public class InfluxDbSettings
|
||||
{
|
||||
public string Url { get; set; } = string.Empty;
|
||||
@@ -1,7 +1,6 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.BLL.Services.Interfaces;
|
||||
using PARR.Core.Common;
|
||||
using PARR.Core.Common.Interfaces;
|
||||
using PARR.DAL.Contracts;
|
||||
using PARR.EsppApi;
|
||||
using PARR.EsppApi.Models;
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PARR.BLL\PARR.BLL.csproj" />
|
||||
<ProjectReference Include="..\PARR.DAL\PARR.DAL.csproj" />
|
||||
<ProjectReference Include="..\PARR.EsppApi\PARR.EsppApi.csproj" />
|
||||
<ProjectReference Include="..\PARR.Infrastructure\PARR.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using PARR.BLL;
|
||||
using PARR.DAL;
|
||||
using PARR.EsppApi;
|
||||
using PARR.EsppOrderLoader.Services;
|
||||
using PARR.EsppOrderLoader.Settings;
|
||||
using PARR.Infrastructure;
|
||||
|
||||
namespace PARR.EsppOrderLoader
|
||||
{
|
||||
@@ -12,9 +12,9 @@ namespace PARR.EsppOrderLoader
|
||||
{
|
||||
public static void InstallEsppOrderLoaderServices(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.InstallBllServices(configuration);
|
||||
services.InstallDalServices(configuration);
|
||||
services.InstallEsppApiServices(configuration);
|
||||
services.AddInfrastructureServices(configuration);
|
||||
|
||||
var settings = new WorkerSettings();
|
||||
configuration.GetSection(nameof(WorkerSettings)).Bind(settings);
|
||||
|
||||
@@ -8,12 +8,11 @@ WORKDIR /src
|
||||
COPY ["NuGet.config", "."]
|
||||
COPY ["PARR.EsppOrderLoaderWorker/PARR.EsppOrderLoaderWorker.csproj", "PARR.EsppOrderLoaderWorker/"]
|
||||
COPY ["PARR.EsppOrderLoader/PARR.EsppOrderLoader.csproj", "PARR.EsppOrderLoader/"]
|
||||
COPY ["PARR.BLL/PARR.BLL.csproj", "PARR.BLL/"]
|
||||
COPY ["PARR.Common/PARR.Common.csproj", "PARR.Common/"]
|
||||
COPY ["PARR.Domain/PARR.Domain.csproj", "PARR.Domain/"]
|
||||
COPY ["PARR.DAL/PARR.DAL.csproj", "PARR.DAL/"]
|
||||
COPY ["PARR.Core/PARR.Core.csproj", "PARR.Core/"]
|
||||
COPY ["PARR.Domain/PARR.Domain.csproj", "PARR.Domain/"]
|
||||
COPY ["PARR.EsppApi/PARR.EsppApi.csproj", "PARR.EsppApi/"]
|
||||
COPY ["PARR.Infrastructure/PARR.Infrastructure.csproj", "PARR.Infrastructure/"]
|
||||
RUN dotnet restore "PARR.EsppOrderLoaderWorker/PARR.EsppOrderLoaderWorker.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/PARR.EsppOrderLoaderWorker"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.BLL.Services.Interfaces;
|
||||
using PARR.Core.Common.RabbitServices;
|
||||
using PARR.Core.Common.Interfaces;
|
||||
using PARR.Core.Common.Interfaces.RabbitServices;
|
||||
using PARR.DAL.Models;
|
||||
using PARR.DAL.Services.Interfaces;
|
||||
using PARR.Domain.Common.Rabbit.Messages;
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PARR.BLL\PARR.BLL.csproj" />
|
||||
<ProjectReference Include="..\PARR.DAL\PARR.DAL.csproj" />
|
||||
<ProjectReference Include="..\PARR.EsppApi\PARR.EsppApi.csproj" />
|
||||
<ProjectReference Include="..\PARR.Infrastructure\PARR.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using PARR.BLL;
|
||||
using PARR.Core;
|
||||
using PARR.DAL;
|
||||
using PARR.EsppApi;
|
||||
using PARR.EsppOrderManager.Services;
|
||||
using PARR.EsppOrderManager.Settings;
|
||||
using PARR.Infrastructure;
|
||||
|
||||
namespace PARR.EsppOrderManager
|
||||
{
|
||||
@@ -12,9 +13,10 @@ namespace PARR.EsppOrderManager
|
||||
{
|
||||
public static void InstallEsppOrderManagerServices(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.InstallBllServices(configuration);
|
||||
services.InstallDalServices(configuration);
|
||||
services.InstallEsppApiServices(configuration);
|
||||
services.AddCoreServices(configuration);
|
||||
services.AddInfrastructureServices(configuration);
|
||||
|
||||
var mqSettings = new MqSettings();
|
||||
configuration.GetSection(nameof(MqSettings)).Bind(mqSettings);
|
||||
|
||||
@@ -8,12 +8,11 @@ WORKDIR /src
|
||||
COPY ["NuGet.config", "."]
|
||||
COPY ["PARR.EsppOrderManagerWorker/PARR.EsppOrderManagerWorker.csproj", "PARR.EsppOrderManagerWorker/"]
|
||||
COPY ["PARR.EsppOrderManager/PARR.EsppOrderManager.csproj", "PARR.EsppOrderManager/"]
|
||||
COPY ["PARR.BLL/PARR.BLL.csproj", "PARR.BLL/"]
|
||||
COPY ["PARR.Common/PARR.Common.csproj", "PARR.Common/"]
|
||||
COPY ["PARR.Domain/PARR.Domain.csproj", "PARR.Domain/"]
|
||||
COPY ["PARR.DAL/PARR.DAL.csproj", "PARR.DAL/"]
|
||||
COPY ["PARR.Core/PARR.Core.csproj", "PARR.Core/"]
|
||||
COPY ["PARR.Domain/PARR.Domain.csproj", "PARR.Domain/"]
|
||||
COPY ["PARR.EsppApi/PARR.EsppApi.csproj", "PARR.EsppApi/"]
|
||||
COPY ["PARR.Infrastructure/PARR.Infrastructure.csproj", "PARR.Infrastructure/"]
|
||||
RUN dotnet restore "PARR.EsppOrderManagerWorker/PARR.EsppOrderManagerWorker.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/PARR.EsppOrderManagerWorker"
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using PARR.BLL;
|
||||
using PARR.Core;
|
||||
using PARR.DAL;
|
||||
using PARR.EsppScheduleSync.Domain;
|
||||
using PARR.EsppScheduleSync.Settings;
|
||||
using PARR.EsppSync;
|
||||
using PARR.Infrastructure;
|
||||
|
||||
namespace PARR.EsppScheduleSync
|
||||
{
|
||||
@@ -12,8 +13,9 @@ namespace PARR.EsppScheduleSync
|
||||
{
|
||||
public static void InstallEsppScheduleSyncServices(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.InstallBllServices(configuration);
|
||||
services.InstallEsppSyncServices<EsppObjectSchedule>(configuration);
|
||||
services.AddCoreServices(configuration);
|
||||
services.AddInfrastructureServices(configuration);
|
||||
|
||||
var globalSettings = new GlobalSettings();
|
||||
configuration.GetSection(nameof(GlobalSettings)).Bind(globalSettings);
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PARR.BLL\PARR.BLL.csproj" />
|
||||
<ProjectReference Include="..\PARR.DAL\PARR.DAL.csproj" />
|
||||
<ProjectReference Include="..\PARR.EsppSync\PARR.EsppSync.csproj" />
|
||||
<ProjectReference Include="..\PARR.Infrastructure\PARR.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.BLL.Helpers;
|
||||
using PARR.Core.Common.RabbitServices;
|
||||
using PARR.Core.Common.Interfaces.RabbitServices;
|
||||
using PARR.DAL.Contracts;
|
||||
using PARR.DAL.Models;
|
||||
using PARR.DAL.NextRunServices;
|
||||
|
||||
@@ -8,12 +8,11 @@ WORKDIR /src
|
||||
COPY ["NuGet.config", "."]
|
||||
COPY ["PARR.EsppScheduleSyncWorker/PARR.EsppScheduleSyncWorker.csproj", "PARR.EsppScheduleSyncWorker/"]
|
||||
COPY ["PARR.EsppScheduleSync/PARR.EsppScheduleSync.csproj", "PARR.EsppScheduleSync/"]
|
||||
COPY ["PARR.BLL/PARR.BLL.csproj", "PARR.BLL/"]
|
||||
COPY ["PARR.Common/PARR.Common.csproj", "PARR.Common/"]
|
||||
COPY ["PARR.Domain/PARR.Domain.csproj", "PARR.Domain/"]
|
||||
COPY ["PARR.DAL/PARR.DAL.csproj", "PARR.DAL/"]
|
||||
COPY ["PARR.Core/PARR.Core.csproj", "PARR.Core/"]
|
||||
COPY ["PARR.Domain/PARR.Domain.csproj", "PARR.Domain/"]
|
||||
COPY ["PARR.EsppSync/PARR.EsppSync.csproj", "PARR.EsppSync/"]
|
||||
COPY ["PARR.Infrastructure/PARR.Infrastructure.csproj", "PARR.Infrastructure/"]
|
||||
RUN dotnet restore "PARR.EsppScheduleSyncWorker/PARR.EsppScheduleSyncWorker.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/PARR.EsppScheduleSyncWorker"
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using PARR.BLL;
|
||||
using PARR.Core;
|
||||
using PARR.DAL;
|
||||
using PARR.EsppSync;
|
||||
using PARR.EsppTemplateSync.Domain;
|
||||
using PARR.EsppTemplateSync.Settings;
|
||||
using PARR.Infrastructure;
|
||||
|
||||
namespace PARR.EsppTemplateSync
|
||||
{
|
||||
@@ -13,8 +14,9 @@ namespace PARR.EsppTemplateSync
|
||||
public static void InstallEsppTemplateSyncServices(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.InstallDalServices(configuration);
|
||||
services.InstallBllServices(configuration);
|
||||
services.InstallEsppSyncServices<EsppObjectTemplate>(configuration);
|
||||
services.AddCoreServices(configuration);
|
||||
services.AddInfrastructureServices(configuration);
|
||||
|
||||
var globalSettings = new GlobalSettings();
|
||||
configuration.GetSection(nameof(GlobalSettings)).Bind(globalSettings);
|
||||
|
||||
@@ -11,9 +11,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PARR.BLL\PARR.BLL.csproj" />
|
||||
<ProjectReference Include="..\PARR.Core\PARR.Core.csproj" />
|
||||
<ProjectReference Include="..\PARR.DAL\PARR.DAL.csproj" />
|
||||
<ProjectReference Include="..\PARR.EsppSync\PARR.EsppSync.csproj" />
|
||||
<ProjectReference Include="..\PARR.Infrastructure\PARR.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,145 +0,0 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.BLL.Services.Interfaces;
|
||||
using PARR.EsppTemplateSync.Settings;
|
||||
|
||||
namespace PARR.EsppTemplateSync
|
||||
{
|
||||
internal class TemplateFileSyncer : ITemplateSyncer
|
||||
{
|
||||
private readonly ILogger<TemplateFileSyncer> logger;
|
||||
//private readonly IFileService fileService;
|
||||
private readonly GlobalSettings globalSettings;
|
||||
//private readonly IManager manager;
|
||||
private readonly string dirPath;
|
||||
private readonly string filterExtensions;
|
||||
|
||||
//private FileSystemWatcher? watcher;
|
||||
|
||||
public TemplateFileSyncer(
|
||||
BLL.Settings.StorageSettings storageSettings,
|
||||
ILogger<TemplateFileSyncer> logger,
|
||||
//IFileService fileService,
|
||||
GlobalSettings globalSettings//,
|
||||
// IManager manager
|
||||
)
|
||||
{
|
||||
this.logger = logger;
|
||||
//this.fileService = fileService;
|
||||
this.globalSettings = globalSettings;
|
||||
//this.manager = manager;
|
||||
if (storageSettings.EsppTemplates == null)
|
||||
{
|
||||
logger.LogError("Нет секции настроек хранилища. StorageSettings, EsppTemplates");
|
||||
throw new Exception("Нет секции настроек хранилища. StorageSettings, EsppTemplates");
|
||||
}
|
||||
|
||||
string dirPath = Path.Combine(storageSettings.EsppTemplates.TemplatePath);
|
||||
this.dirPath = Path.Combine(storageSettings.StoragePath, dirPath);
|
||||
|
||||
filterExtensions = string.Join(",", storageSettings.EsppTemplates!.AllowedExtensions).Replace(".", "*.");
|
||||
}
|
||||
|
||||
public void StartAsync()
|
||||
{
|
||||
//смотрим, доступна ли папка
|
||||
if (!Directory.Exists(dirPath))
|
||||
{
|
||||
logger.LogError($"Не найдена папка: {dirPath}.");
|
||||
throw new Exception($"Не найдена папка: {dirPath}.");
|
||||
}
|
||||
|
||||
logger.LogInformation($"Запущена проверка директории. Интервал: {globalSettings.StorageSettings!.CheckIntervalSeconds} секунд. Фильтр: {filterExtensions}");
|
||||
|
||||
while (true)
|
||||
{
|
||||
//todo: new Task() ->
|
||||
//await GetFilesAsync();
|
||||
//await Task.Delay(globalSettings.StorageSettings!.CheckIntervalSeconds * 1000);
|
||||
}
|
||||
|
||||
|
||||
// сначала обрабатываем существующие файлы, до тех пор пока все не обработаем
|
||||
// после обработки всех файлов, запускаем вотчер
|
||||
//await GetFilesAsync();
|
||||
|
||||
// код ниже, это то что надо использовать, но в доккере не работает watcher
|
||||
////--- watcher
|
||||
//watcher = new FileSystemWatcher(dirPath);
|
||||
//watcher.NotifyFilter = NotifyFilters.FileName;
|
||||
////watcher.Changed += OnChanged;
|
||||
////todo: тут await???
|
||||
//watcher.Created += OnChanged;
|
||||
|
||||
//watcher.Filter = filterExtensions;
|
||||
//watcher.EnableRaisingEvents = true;
|
||||
//watcher.IncludeSubdirectories = false;
|
||||
|
||||
////=== watcher
|
||||
|
||||
//logger.LogInformation($"--- --- --- FileWatcher запущен --- --- ---");
|
||||
}
|
||||
|
||||
|
||||
public void StopAsync()
|
||||
{
|
||||
//watcher?.Dispose();
|
||||
logger.LogInformation($"=== === === FileWatcher остановлен === === ===");
|
||||
}
|
||||
|
||||
//private async void OnChanged(object sender, FileSystemEventArgs e)
|
||||
//{
|
||||
// var path = e.FullPath;
|
||||
// await ParseFileAsync(path);
|
||||
//}
|
||||
|
||||
private async Task GetFilesAsync()
|
||||
{
|
||||
// обрабатываем существующие файлы
|
||||
var files = Directory.GetFiles(this.dirPath, filterExtensions);
|
||||
|
||||
//logger.LogInformation($"Запуск первоначальной загрузки файлов после старта сервиса. (До старта вотчера). Найдено файлов: {files.Length} шт.");
|
||||
logger.LogInformation($"Найдено файлов: {files.Length} шт.");
|
||||
|
||||
foreach (var file in files)
|
||||
{
|
||||
if (File.Exists(file))
|
||||
await ParseFileAsync(file);
|
||||
else
|
||||
logger.LogInformation($"Файл не найден: {file}");
|
||||
}
|
||||
|
||||
|
||||
//если были файлы, запустим еще раз ручную обработку, вдруг за это время еще загрузили, а вотчер еще не был запущен
|
||||
//запускаем до тех пор, пока не останется необработанных файлов
|
||||
//if (files.Any())
|
||||
// await GetFilesAsync();
|
||||
}
|
||||
|
||||
|
||||
private async Task ParseFileAsync(string path)
|
||||
{
|
||||
logger.LogInformation($"--- --- Найден файл. Готов для парсинга {path} --- ---");
|
||||
//var parseResult = await manager.ManageFileAsync(path);//parserService.ParseFileAsync(path);
|
||||
|
||||
//if (parseResult)
|
||||
//{
|
||||
// logger.LogInformation($"Парсинг успешно завершен. Удаляю файл {path}");
|
||||
// var removeResult = fileService.DeleteFile(path);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// logger.LogError($"Парсинг завершен c ошибкой. Файл не удален {path}");
|
||||
//}
|
||||
}
|
||||
|
||||
Task ITemplateSyncer.StartAsync()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
Task ITemplateSyncer.StopAsync()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.Core.Common.RabbitServices;
|
||||
using PARR.Core.Common.Interfaces.RabbitServices;
|
||||
using PARR.DAL.Contracts;
|
||||
using PARR.DAL.Models;
|
||||
using PARR.EsppSync;
|
||||
|
||||
@@ -8,12 +8,11 @@ WORKDIR /src
|
||||
COPY ["NuGet.config", "."]
|
||||
COPY ["PARR.EsppTemplateSyncWorker/PARR.EsppTemplateSyncWorker.csproj", "PARR.EsppTemplateSyncWorker/"]
|
||||
COPY ["PARR.EsppTemplateSync/PARR.EsppTemplateSync.csproj", "PARR.EsppTemplateSync/"]
|
||||
COPY ["PARR.BLL/PARR.BLL.csproj", "PARR.BLL/"]
|
||||
COPY ["PARR.Common/PARR.Common.csproj", "PARR.Common/"]
|
||||
COPY ["PARR.Core/PARR.Core.csproj", "PARR.Core/"]
|
||||
COPY ["PARR.Domain/PARR.Domain.csproj", "PARR.Domain/"]
|
||||
COPY ["PARR.DAL/PARR.DAL.csproj", "PARR.DAL/"]
|
||||
COPY ["PARR.Core/PARR.Core.csproj", "PARR.Core/"]
|
||||
COPY ["PARR.EsppSync/PARR.EsppSync.csproj", "PARR.EsppSync/"]
|
||||
COPY ["PARR.Infrastructure/PARR.Infrastructure.csproj", "PARR.Infrastructure/"]
|
||||
RUN dotnet restore "PARR.EsppTemplateSyncWorker/PARR.EsppTemplateSyncWorker.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/PARR.EsppTemplateSyncWorker"
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using PARR.Core.Common;
|
||||
using PARR.Core.Common.RabbitServices;
|
||||
using PARR.Core.Common.Interfaces;
|
||||
using PARR.Core.Common.Interfaces.RabbitServices;
|
||||
using PARR.DAL.InfluxDbServices;
|
||||
using PARR.Domain.Settings;
|
||||
using PARR.Infrastructure.Interval;
|
||||
using PARR.Infrastructure.Rabbit;
|
||||
using PARR.Infrastructure.Redis;
|
||||
using StackExchange.Redis;
|
||||
|
||||
namespace PARR.Infrastructure
|
||||
{
|
||||
@@ -19,11 +23,49 @@ namespace PARR.Infrastructure
|
||||
{
|
||||
// тут регистрируем все внешние сервисы, Rabbit, Redis, Email...
|
||||
|
||||
#region Rabbit
|
||||
|
||||
services.AddHttpClient<IRabbitAdminService, RabbitAdminService>();
|
||||
services.AddTransient<IRabbitService, RabbitService>();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Interval
|
||||
|
||||
services.AddTransient<IIntervalService, IntervalService>();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Redis
|
||||
|
||||
services.AddSingleton<IConnectionMultiplexer>(sp =>
|
||||
{
|
||||
// IConnectionMultiplexer - для нативных операций Redis
|
||||
var connectionString = configuration.GetConnectionString("RedisConnection");
|
||||
return ConnectionMultiplexer.Connect(connectionString);
|
||||
});
|
||||
|
||||
services.AddStackExchangeRedisCache(opt =>
|
||||
{
|
||||
opt.Configuration = configuration.GetConnectionString("RedisConnection");
|
||||
});
|
||||
|
||||
services.AddSingleton<IRedisCacheService, RedisCacheService>();
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region InfluxDb
|
||||
|
||||
var influxDbSettings = new InfluxDbSettings();
|
||||
configuration.GetSection(nameof(InfluxDbSettings)).Bind(influxDbSettings);
|
||||
services.AddSingleton(influxDbSettings);
|
||||
|
||||
services.AddTransient<IInfluxDbService, InfluxDbService>();
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
//services.AddTransient<IEmailService, EmailService>();
|
||||
//services.AddTransient<IRabbitService, RabbitService>();
|
||||
////Redis (singleton)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using InfluxDB.Client;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.DAL.Settings;
|
||||
using PARR.Core.Common.Interfaces;
|
||||
using PARR.Domain.Settings;
|
||||
|
||||
namespace PARR.DAL.InfluxDbServices
|
||||
{
|
||||
@@ -1,5 +1,5 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.Core.Common;
|
||||
using PARR.Core.Common.Interfaces;
|
||||
|
||||
namespace PARR.Infrastructure.Interval
|
||||
{
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="InfluxDB.Client" Version="4.17.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.3.9" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="7.0.20" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
|
||||
<PackageReference Include="RabbitMQ.Client" Version="7.1.2" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.Core.Common.RabbitServices;
|
||||
using PARR.Core.Common.Interfaces.RabbitServices;
|
||||
using PARR.Domain.DTOs.RabbitApi;
|
||||
using PARR.Domain.Settings;
|
||||
using System.Net;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.Core.Common.RabbitServices;
|
||||
using PARR.Core.Common.Interfaces.RabbitServices;
|
||||
using PARR.Domain.Common.Rabbit;
|
||||
using PARR.Domain.Settings;
|
||||
using RabbitMQ.Client;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user