Структура
This commit is contained in:
12
PARR.AIHIT/AIHIT/Properties/launchSettings.json
Normal file
12
PARR.AIHIT/AIHIT/Properties/launchSettings.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"PARR.AIHIT": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
},
|
||||||
|
"applicationUrl": "https://localhost:1090;http://localhost:1092"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
PARR.API.sln
12
PARR.API.sln
@@ -9,7 +9,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.DAL", "PARR.DAL\PARR.D
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.Mail", "PARR.Mail\PARR.Mail\PARR.Mail.csproj", "{228C8124-69E4-4AE0-8C33-0438E54FF1BA}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.Mail", "PARR.Mail\PARR.Mail\PARR.Mail.csproj", "{228C8124-69E4-4AE0-8C33-0438E54FF1BA}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.Worker", "PARR.Worker\PARR.Worker\PARR.Worker.csproj", "{D15F308C-9F63-4D69-B06E-DDA26FEE9BAB}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.AIHITWorker", "PARR.Worker\PARR.Worker\PARR.AIHITWorker.csproj", "{D15F308C-9F63-4D69-B06E-DDA26FEE9BAB}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.AIHIT", "PARR.AIHIT\AIHIT\PARR.AIHIT.csproj", "{3ED4E1CE-2AF5-4EB3-B7DF-B77CCC242B9E}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.AIHIT", "PARR.AIHIT\AIHIT\PARR.AIHIT.csproj", "{3ED4E1CE-2AF5-4EB3-B7DF-B77CCC242B9E}"
|
||||||
EndProject
|
EndProject
|
||||||
@@ -24,9 +24,11 @@ Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-co
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.BLL", "PARR.BLL\PARR.BLL.csproj", "{7BAB9170-743D-4542-8881-9B161EE81BB6}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.BLL", "PARR.BLL\PARR.BLL.csproj", "{7BAB9170-743D-4542-8881-9B161EE81BB6}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.EsppTemplateSyncWorker", "PARR.EsppTemplateSyncWorker\PARR.EsppTemplateSyncWorker.csproj", "{7FBD65FE-26FE-4E60-AD1F-20AAC6F88C7A}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.EsppTemplateSyncWorker", "PARR.EsppTemplateSyncWorker\PARR.EsppTemplateSyncWorker.csproj", "{7FBD65FE-26FE-4E60-AD1F-20AAC6F88C7A}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.EsppTemplateSync", "PARR.EsppTemplateSync\PARR.EsppTemplateSync.csproj", "{39FD9AAD-0792-46B2-A935-42486A993C32}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.EsppTemplateSync", "PARR.EsppTemplateSync\PARR.EsppTemplateSync.csproj", "{39FD9AAD-0792-46B2-A935-42486A993C32}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.MockData", "PARR.MockData\PARR.MockData.csproj", "{B02E5B16-59BD-4F02-9CC4-6873409DBD84}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -68,6 +70,10 @@ Global
|
|||||||
{39FD9AAD-0792-46B2-A935-42486A993C32}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{39FD9AAD-0792-46B2-A935-42486A993C32}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{39FD9AAD-0792-46B2-A935-42486A993C32}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{39FD9AAD-0792-46B2-A935-42486A993C32}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{39FD9AAD-0792-46B2-A935-42486A993C32}.Release|Any CPU.Build.0 = Release|Any CPU
|
{39FD9AAD-0792-46B2-A935-42486A993C32}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{B02E5B16-59BD-4F02-9CC4-6873409DBD84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{B02E5B16-59BD-4F02-9CC4-6873409DBD84}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{B02E5B16-59BD-4F02-9CC4-6873409DBD84}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{B02E5B16-59BD-4F02-9CC4-6873409DBD84}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
12
PARR.DAL/Properties/launchSettings.json
Normal file
12
PARR.DAL/Properties/launchSettings.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"PARR.DAL": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
},
|
||||||
|
"applicationUrl": "https://localhost:1086;http://localhost:1095"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,8 +18,10 @@ namespace PARR.EsppTemplateSync
|
|||||||
configuration.GetSection(nameof(GlobalSettings)).Bind(globalSettings);
|
configuration.GetSection(nameof(GlobalSettings)).Bind(globalSettings);
|
||||||
services.AddSingleton(globalSettings);
|
services.AddSingleton(globalSettings);
|
||||||
|
|
||||||
services.AddTransient<ITemplateSyncer, TemplateSyncer>();
|
//services.AddTransient<ITemplateSyncer, TemplateFileSyncer>();
|
||||||
|
services.AddTransient<ITemplateSyncer, TemplateMQSyncer>();
|
||||||
services.AddTransient<IParserService, ParserService>();
|
services.AddTransient<IParserService, ParserService>();
|
||||||
|
services.AddTransient<IManager, Manager>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
public interface ITemplateSyncer
|
public interface ITemplateSyncer
|
||||||
{
|
{
|
||||||
Task StartWatchingAsync();
|
Task StartAsync();
|
||||||
void StopWatching();
|
void Stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
8
PARR.EsppTemplateSync/Services/IManager.cs
Normal file
8
PARR.EsppTemplateSync/Services/IManager.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace PARR.EsppTemplateSync.Services
|
||||||
|
{
|
||||||
|
internal interface IManager
|
||||||
|
{
|
||||||
|
Task<bool> ManageFileAsync(string path);
|
||||||
|
Task<bool> ManageStringAsync(string str);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
{
|
{
|
||||||
internal interface IParserService
|
internal interface IParserService
|
||||||
{
|
{
|
||||||
Task<bool> ParseAsync(string path);
|
Task<bool> ParseStringAsync(string str);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
15
PARR.EsppTemplateSync/Services/Manager.cs
Normal file
15
PARR.EsppTemplateSync/Services/Manager.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
namespace PARR.EsppTemplateSync.Services
|
||||||
|
{
|
||||||
|
internal class Manager : IManager
|
||||||
|
{
|
||||||
|
public Task<bool> ManageFileAsync(string path)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<bool> ManageStringAsync(string str)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,17 @@
|
|||||||
{
|
{
|
||||||
internal class ParserService : IParserService
|
internal class ParserService : IParserService
|
||||||
{
|
{
|
||||||
public async Task<bool> ParseAsync(string path)
|
public async Task<bool> ParseFileAsync(string path)
|
||||||
|
{
|
||||||
|
//TODO:
|
||||||
|
|
||||||
|
bool isSuccess = true;
|
||||||
|
|
||||||
|
|
||||||
|
return isSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> ParseStringAsync(string str)
|
||||||
{
|
{
|
||||||
//TODO:
|
//TODO:
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,18 @@
|
|||||||
namespace PARR.EsppTemplateSync.Settings
|
namespace PARR.EsppTemplateSync.Settings
|
||||||
{
|
{
|
||||||
internal class GlobalSettings
|
internal class GlobalSettings
|
||||||
|
{
|
||||||
|
public MqSettings? MqSettings { get; set; }
|
||||||
|
|
||||||
|
public StorageSettings? StorageSettings { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class MqSettings
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class StorageSettings
|
||||||
{
|
{
|
||||||
public int CheckIntervalSeconds { get; set; } = 5;
|
public int CheckIntervalSeconds { get; set; } = 5;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,29 +6,29 @@ using PARR.EsppTemplateSync.Settings;
|
|||||||
|
|
||||||
namespace PARR.EsppTemplateSync
|
namespace PARR.EsppTemplateSync
|
||||||
{
|
{
|
||||||
internal class TemplateSyncer : ITemplateSyncer
|
internal class TemplateFileSyncer : ITemplateSyncer
|
||||||
{
|
{
|
||||||
private readonly ILogger<TemplateSyncer> logger;
|
private readonly ILogger<TemplateFileSyncer> logger;
|
||||||
private readonly IParserService parserService;
|
|
||||||
private readonly IFileService fileService;
|
private readonly IFileService fileService;
|
||||||
private readonly GlobalSettings globalSettings;
|
private readonly GlobalSettings globalSettings;
|
||||||
|
private readonly IManager manager;
|
||||||
private readonly string dirPath;
|
private readonly string dirPath;
|
||||||
private readonly string filterExtensions;
|
private readonly string filterExtensions;
|
||||||
|
|
||||||
//private FileSystemWatcher? watcher;
|
//private FileSystemWatcher? watcher;
|
||||||
|
|
||||||
public TemplateSyncer(
|
public TemplateFileSyncer(
|
||||||
StorageSettings storageSettings,
|
BLL.Settings.StorageSettings storageSettings,
|
||||||
ILogger<TemplateSyncer> logger,
|
ILogger<TemplateFileSyncer> logger,
|
||||||
IParserService parserService,
|
|
||||||
IFileService fileService,
|
IFileService fileService,
|
||||||
GlobalSettings globalSettings
|
GlobalSettings globalSettings,
|
||||||
|
IManager manager
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.parserService = parserService;
|
|
||||||
this.fileService = fileService;
|
this.fileService = fileService;
|
||||||
this.globalSettings = globalSettings;
|
this.globalSettings = globalSettings;
|
||||||
|
this.manager = manager;
|
||||||
if (storageSettings.EsppTemplates == null)
|
if (storageSettings.EsppTemplates == null)
|
||||||
{
|
{
|
||||||
logger.LogError("Нет секции настроек хранилища. StorageSettings, EsppTemplates");
|
logger.LogError("Нет секции настроек хранилища. StorageSettings, EsppTemplates");
|
||||||
@@ -41,7 +41,7 @@ namespace PARR.EsppTemplateSync
|
|||||||
filterExtensions = string.Join(",", storageSettings.EsppTemplates!.AllowedExtensions).Replace(".", "*.");
|
filterExtensions = string.Join(",", storageSettings.EsppTemplates!.AllowedExtensions).Replace(".", "*.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task StartWatchingAsync()
|
public async Task StartAsync()
|
||||||
{
|
{
|
||||||
//смотрим, доступна ли папка
|
//смотрим, доступна ли папка
|
||||||
if (!Directory.Exists(dirPath))
|
if (!Directory.Exists(dirPath))
|
||||||
@@ -50,12 +50,12 @@ namespace PARR.EsppTemplateSync
|
|||||||
throw new Exception($"Не найдена папка: {dirPath}.");
|
throw new Exception($"Не найдена папка: {dirPath}.");
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.LogInformation($"Запущена проверка директории. Интервал: {globalSettings.CheckIntervalSeconds} секунд. Фильтр: {filterExtensions}");
|
logger.LogInformation($"Запущена проверка директории. Интервал: {globalSettings.StorageSettings!.CheckIntervalSeconds} секунд. Фильтр: {filterExtensions}");
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
await GetFilesAsync();
|
await GetFilesAsync();
|
||||||
await Task.Delay(globalSettings.CheckIntervalSeconds * 1000);
|
await Task.Delay(globalSettings.StorageSettings!.CheckIntervalSeconds * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ namespace PARR.EsppTemplateSync
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void StopWatching()
|
public void Stop()
|
||||||
{
|
{
|
||||||
//watcher?.Dispose();
|
//watcher?.Dispose();
|
||||||
logger.LogInformation($"=== === === FileWatcher остановлен === === ===");
|
logger.LogInformation($"=== === === FileWatcher остановлен === === ===");
|
||||||
@@ -120,7 +120,7 @@ namespace PARR.EsppTemplateSync
|
|||||||
private async Task ParseFileAsync(string path)
|
private async Task ParseFileAsync(string path)
|
||||||
{
|
{
|
||||||
logger.LogInformation($"--- --- Найден файл. Готов для парсинга {path} --- ---");
|
logger.LogInformation($"--- --- Найден файл. Готов для парсинга {path} --- ---");
|
||||||
var parseResult = await parserService.ParseAsync(path);
|
var parseResult = await manager.ManageFileAsync(path);//parserService.ParseFileAsync(path);
|
||||||
|
|
||||||
if (parseResult)
|
if (parseResult)
|
||||||
{
|
{
|
||||||
21
PARR.EsppTemplateSync/TemplateMQSyncer.cs
Normal file
21
PARR.EsppTemplateSync/TemplateMQSyncer.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace PARR.EsppTemplateSync
|
||||||
|
{
|
||||||
|
internal class TemplateMQSyncer : ITemplateSyncer
|
||||||
|
{
|
||||||
|
public async Task StartAsync()
|
||||||
|
{
|
||||||
|
// throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Stop()
|
||||||
|
{
|
||||||
|
//throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ namespace PARR.EsppTemplateSyncWorker
|
|||||||
|
|
||||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
{
|
{
|
||||||
await templateSyncer.StartWatchingAsync();
|
await templateSyncer.StartAsync();
|
||||||
|
|
||||||
//while (!stoppingToken.IsCancellationRequested)
|
//while (!stoppingToken.IsCancellationRequested)
|
||||||
//{
|
//{
|
||||||
@@ -26,7 +26,7 @@ namespace PARR.EsppTemplateSyncWorker
|
|||||||
|
|
||||||
public override Task StopAsync(CancellationToken cancellationToken)
|
public override Task StopAsync(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
templateSyncer.StopWatching();
|
templateSyncer.Stop();
|
||||||
|
|
||||||
return base.StopAsync(cancellationToken);
|
return base.StopAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,11 @@
|
|||||||
"StoragePath": "W:\\"
|
"StoragePath": "W:\\"
|
||||||
},
|
},
|
||||||
"GlobalSettings": {
|
"GlobalSettings": {
|
||||||
"CheckIntervalSeconds": 5
|
"MqSettings": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"StorageSettings": {
|
||||||
|
"CheckIntervalSeconds": 5
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"GlobalSettings": {
|
"GlobalSettings": {
|
||||||
"CheckIntervalSeconds": 30
|
"MqSettings": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"StorageSettings": {
|
||||||
|
"CheckIntervalSeconds": 30
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
12
PARR.Mail/PARR.Mail/Properties/launchSettings.json
Normal file
12
PARR.Mail/PARR.Mail/Properties/launchSettings.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"PARR.Mail": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
},
|
||||||
|
"applicationUrl": "https://localhost:1096;http://localhost:1103"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
10
PARR.MockData/PARR.MockData.csproj
Normal file
10
PARR.MockData/PARR.MockData.csproj
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
2
PARR.MockData/Program.cs
Normal file
2
PARR.MockData/Program.cs
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
// See https://aka.ms/new-console-template for more information
|
||||||
|
Console.WriteLine("Hello, World!");
|
||||||
Reference in New Issue
Block a user