Merge branch 'S07' into test

This commit is contained in:
hardstylewyl 2025-03-27 15:55:45 +08:00
commit 8c91dfbd5c

View File

@ -381,6 +381,20 @@ public class TransportWarningService : ApplicationService
}
var postRuleItems = TransportWarningSceneRuleItemBO.From(input);
var tuples = postRuleItems.Select(x => (x.StartTrackStatusId, x.EndTrackStatusId)).ToHashSet();
// 规则项目间不允许出现起始轨迹和截止轨迹都重复的项目
if (tuples.Count < postRuleItems.Count)
{
throw new BusinessException(message: "不允许出现轨迹状态和终止轨迹状态都重复的规则项目");
}
// 起始和截止不能相同
if (tuples.Any(x => x.StartTrackStatusId == x.EndTrackStatusId))
{
throw new BusinessException(message: "同一规则项目起始轨迹状态和截止轨迹状态不能相同");
}
var sceneBo = TransportWarningSceneBO.From(ruleScene);
await _transportWarningHandler.HandleEditAsync(rule, sceneBo, postRuleItems);