feat: Перенесены внешние сервисы в Infrastructure. Удалены лишние проекты.
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user