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)