Merge branch 'S07' into test

This commit is contained in:
hardstylewyl 2025-03-24 16:55:44 +08:00
commit 955ba93024

View File

@ -213,8 +213,28 @@ public class ReturnWarningService : ApplicationService
}
var bos = ReturnWarningRuleItemBO.From(input);
// 要求规则项目中轨迹状态集合不允许存在交集
if (CheckForIntersection(bos.Select(x => x.TrackStatusIds).ToList()))
{
throw new BusinessException("运输预警规则项目间,轨迹状态不允许存在交集!");
}
await _returnWarningHandler.HandleEditAsync(rule, bos);
return new UnifyResultDto(true);
}
private static bool CheckForIntersection(List<HashSet<int>> sets)
{
var combinedSet = new HashSet<int>();
var totalElements = 0;
foreach (var set in sets)
{
totalElements += set.Count;
combinedSet.UnionWith(set);
}
return combinedSet.Count < totalElements;
}
}