From 8fff0bf03d831d07dd3adf144383a4cfd6c8124a Mon Sep 17 00:00:00 2001 From: hardstylewyl <827778732@qq.com> Date: Thu, 27 Mar 2025 15:26:41 +0800 Subject: [PATCH] =?UTF-8?q?add-validation:=E5=AE=8C=E6=95=B4=E9=A2=84?= =?UTF-8?q?=E8=AD=A6=E8=A7=84=E5=88=99=E7=BC=96=E8=BE=91=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=20=20-=20=E5=A4=9A=E4=B8=AA=E9=A2=84?= =?UTF-8?q?=E8=AD=A6=E8=A7=84=E5=88=99=E9=A1=B9=E7=9B=AE=E4=B8=AD=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E7=82=B9=E8=BD=A8=E8=BF=B9=E7=8A=B6=E6=80=81=E4=B8=8D?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/Warning/CompleteWarningService.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/SJZY.Track.Application/Services/Warning/CompleteWarningService.cs b/src/SJZY.Track.Application/Services/Warning/CompleteWarningService.cs index fa3797bd..01de540d 100644 --- a/src/SJZY.Track.Application/Services/Warning/CompleteWarningService.cs +++ b/src/SJZY.Track.Application/Services/Warning/CompleteWarningService.cs @@ -216,9 +216,6 @@ public class CompleteWarningService : ApplicationService // 构建缺失轨迹状态 List BuildMissingTrackStatus(CompleteWarningDetailsIndex detail) { - // return detail.GetMissingTrackStatusIdGroups() - // .Select(g => g.ToDictionary(id => id.ToString(), id => trackStatusDict.GetValueOrDefault(id, GlobalConst.EmptyString))) - // .ToList(); return detail.GetMissingTrackStatusIdGroups() .Select(g => new RequireTrackStatusItem { @@ -246,6 +243,13 @@ public class CompleteWarningService : ApplicationService } var bos = CompleteWarningRuleItemBO.From(input); + // 同一个主体下,规则项目的检查点不能重复 + var checkPointTrackStatusIds = bos.Select(x => x.CheckPointTrackStatusId).ToHashSet(); + if (checkPointTrackStatusIds.Count < bos.Count) + { + throw new BusinessException(message: "完整预警规则项目检查点不能重复!"); + } + await _completeWarningHandler.HandleEditAsync(rule, bos); return new UnifyResultDto(true); }