change:修改预警规则时效添加参数校验
This commit is contained in:
parent
bf5f9662a9
commit
39e2dab9cc
@ -184,6 +184,15 @@ public class ForewarningService : ApplicationService
|
||||
public async Task<bool> 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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user