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() public async Task GetUnitsIdByJobFilterAsync_WithExistingJobId_ShouldReturnExpectedUnits()
{ {
// Arrange // 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 }; var expectedUnitIds = new[] { TestDataGenerator.UnitAId, TestDataGenerator.UnitBId };
// Act // Act
var result = await _service.GetUnitsIdByJobFilterAsync(jobId, takeCount: 10); var result = await _service.GetUnitsIdByJobFilterAsync(job, takeCount: 10);
// Assert // Assert
result.Should().NotBeNull() 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 Microsoft.Extensions.Caching.Distributed;
using PARR.DAL.Migrations;
using System.Text.Json; using System.Text.Json;
namespace PARR.DAL.Cache.Services.Base 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="jobId">ID Job</param>
/// <param name="takeCount">Максимальное количество Unit'ов (опционально)</param> /// <param name="takeCount">Максимальное количество Unit'ов (опционально)</param>
/// <returns>Список ID Unit'ов или null, если Job не найден</returns> /// <returns>Список ID Unit'ов или null, если Job не найден</returns>
Task<IEnumerable<Guid>?> GetUnitsIdByJobFilterAsync( //Task<IEnumerable<Guid>?> GetUnitsIdByJobFilterAsync(
Guid jobId, // Guid jobId,
int? takeCount = null); // int? takeCount = null);
/// <summary> /// <summary>
/// Получает список ID Unit'ов, соответствующих фильтрам Job. /// Получает список 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

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

View File

@@ -1,9 +1,6 @@
{ {
"Logging": { "ConnectionStrings": {
"LogLevel": { "RedisConnection": "10.99.253.216:6379,password=ParrP@ssPtk202MMdevDvs"
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
}, },
"Serilog": { "Serilog": {
"MinimumLevel": { "MinimumLevel": {

View File

@@ -1,6 +1,7 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;" "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;",
"RedisConnection": "parr-redis:6379,password=ParrP@ssPtk202MMdevDvs"
}, },
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {