fix(dal): в UnitFilter исправлена ошибка когда один ЭК попадал в несколько работ одной группы работ типа зонтик.

This commit is contained in:
Mikhail Kuznetsov
2026-02-19 17:28:12 +10:00
parent 6def0f200d
commit d056f8b0c9
11 changed files with 682 additions and 747 deletions

View File

@@ -86,11 +86,11 @@ namespace PARR.DAL.IntegrationTests.Integration
public async Task GetUnitsIdByJobFilterAsync_WithExistingJobId_ShouldReturnExpectedUnits()
{
// Arrange
var jobId = _context.Jobs.First(j => j.Name == "TestJob_1").Id;
var job = _context.Jobs.First(j => j.Name == "TestJob_1");
var expectedUnitIds = new[] { TestDataGenerator.UnitAId, TestDataGenerator.UnitBId };
// Act
var result = await _service.GetUnitsIdByJobFilterAsync(jobId, takeCount: 10);
var result = await _service.GetUnitsIdByJobFilterAsync(job, takeCount: 10);
// Assert
result.Should().NotBeNull()

View File

@@ -0,0 +1,18 @@
using PARR.DAL.Cache.Models.Base;
namespace PARR.DAL.Cache.Models
{
public class UnitFilterIds : IBaseCache<UnitFilterIdsDto>
{
public required UnitFilterIdsDto Data { get; set; }
public DateTimeOffset Timestamp { get; set; }
public required string Source { get; set; }
}
public class UnitFilterIdsDto
{
public List<Guid> UnitIds { get; set; } = new();
}
}

View File

@@ -1,5 +1,4 @@
using Microsoft.Extensions.Caching.Distributed;
using PARR.DAL.Migrations;
using System.Text.Json;
namespace PARR.DAL.Cache.Services.Base

View File

@@ -11,9 +11,9 @@ namespace PARR.DAL.DomainServices.UnitFilterService
/// <param name="jobId">ID Job</param>
/// <param name="takeCount">Максимальное количество Unit'ов (опционально)</param>
/// <returns>Список ID Unit'ов или null, если Job не найден</returns>
Task<IEnumerable<Guid>?> GetUnitsIdByJobFilterAsync(
Guid jobId,
int? takeCount = null);
//Task<IEnumerable<Guid>?> GetUnitsIdByJobFilterAsync(
// Guid jobId,
// int? takeCount = null);
/// <summary>
/// Получает список ID Unit'ов, соответствующих фильтрам Job.

View File

@@ -0,0 +1,9 @@
namespace PARR.DAL.DomainServices.UnitFilterService.Models
{
internal class FilteredUnitContext
{
public Guid UnitId { get; set; }
public HashSet<Guid> ValidParentIds { get; set; } = new();
public HashSet<Guid> ValidChildIds { get; set; } = new();
}
}

View File

@@ -30,4 +30,4 @@
/// </summary>
public List<RelatedUnitDto> Children { get; set; } = new();
}
}
}

View File

@@ -0,0 +1,7 @@
namespace PARR.DAL.DomainServices.UnitFilterService.Models
{
internal class UnitFilterServiceOptions
{
public int LoadBatchSize { get; set; } = 1000;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -9,6 +9,7 @@ using PARR.DAL.DomainServices.Implementations;
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;
@@ -22,7 +23,6 @@ using PARR.DAL.Services.Interfaces.Job;
using PARR.DAL.Services.Interfaces.Schedule;
using PARR.DAL.Services.Interfaces.Unit;
using PARR.DAL.Settings;
using PARR.DAL.TransformServices;
namespace PARR.DAL
{
@@ -149,6 +149,8 @@ namespace PARR.DAL
services.AddTransient<IShortcodesService, ShortcodesService>();
services.AddTransient<IUnitFilterService, UnitFilterService>();
services.AddTransient<IMatchingStatusService, MatchingStatusService>();
services.AddSingleton(new UnitFilterServiceOptions { LoadBatchSize = 1000 });
#endregion

View File

@@ -1,26 +1,23 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"Serilog": {
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Debug"
}
"ConnectionStrings": {
"RedisConnection": "10.99.253.216:6379,password=ParrP@ssPtk202MMdevDvs"
},
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "log/log-.txt",
"rollingInterval": "Day"
}
}
]
}
"Serilog": {
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Debug"
}
},
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "log/log-.txt",
"rollingInterval": "Day"
}
}
]
}
}

View File

@@ -1,40 +1,41 @@
{
"ConnectionStrings": {
"DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"ConnectionStrings": {
"DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;",
"RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "log/log-.txt",
"rollingInterval": "Day"
}
}
]
},
"EsppOrderSettings": {
//dev
//"Url": "http://rzd-espp-t-rpa-app-1.gvc.oao.rzd:8080/espp_api/OperationExecutor/",
"Url": "http://espp.gvc.rzd/esppapi_prom/OperationExecutor/",
"UserName": "Auto-PTK-INFO-0002-DVS",
"AccountName": "АВТО ТЕХНОЛОГ ПТК-ИНФО-0002-ДВС (AUTO-PTK-INFO-0002-DVS)",
"Password": "123456789",
"EsppUserTimeZone": 3,
"RobotEk": "РПА-РОБИН-ГВЦ-ЕСПП-ТС-513-ДВС",
"CodeRRO": "ЦТС-РЦТ-9999"
}
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "log/log-.txt",
"rollingInterval": "Day"
}
}
]
},
"EsppOrderSettings": {
//dev
//"Url": "http://rzd-espp-t-rpa-app-1.gvc.oao.rzd:8080/espp_api/OperationExecutor/",
"Url": "http://espp.gvc.rzd/esppapi_prom/OperationExecutor/",
"UserName": "Auto-PTK-INFO-0002-DVS",
"AccountName": "АВТО ТЕХНОЛОГ ПТК-ИНФО-0002-ДВС (AUTO-PTK-INFO-0002-DVS)",
"Password": "123456789",
"EsppUserTimeZone": 3,
"RobotEk": "РПА-РОБИН-ГВЦ-ЕСПП-ТС-513-ДВС",
"CodeRRO": "ЦТС-РЦТ-9999"
}
}