From 39e2dab9cc31ca543a2ad7f83697c5ab95f84a6d Mon Sep 17 00:00:00 2001 From: xiaolipro <2357729423@qq.com> Date: Mon, 30 Sep 2024 10:54:49 +0800 Subject: [PATCH] =?UTF-8?q?change=EF=BC=9A=E4=BF=AE=E6=94=B9=E9=A2=84?= =?UTF-8?q?=E8=AD=A6=E8=A7=84=E5=88=99=E6=97=B6=E6=95=88=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/ForewarningServices/ForewarningService.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/SJZY.Track.Application/Services/ForewarningServices/ForewarningService.cs b/src/SJZY.Track.Application/Services/ForewarningServices/ForewarningService.cs index ac85bb84..ae39736d 100644 --- a/src/SJZY.Track.Application/Services/ForewarningServices/ForewarningService.cs +++ b/src/SJZY.Track.Application/Services/ForewarningServices/ForewarningService.cs @@ -184,6 +184,15 @@ public class ForewarningService : ApplicationService public async Task ModifyTimeSpans(ModifyTimeSpanInput input) { if (input.Items.IsNullOrEmpty()) return false; + if (input.Items.Any(x => x.TotalTimeSpan < x.WarnTimeSpan)) + { + throw new BusinessException(message: "预警时效不能小于预警提醒时效"); + } + + if (input.Items.Any(x => x.WarnCount is < 1 or > 10)) + { + throw new BusinessException(message: "预警次数范围为1-10"); + } var warning = await _warningRepository.GetFirstAsync(x => x.Id == input.WarningId); if (warning == null)