|
|
@ -48,11 +48,13 @@ public class GenerativeTaskConfigStrategy implements TaskConfigStrategy { |
|
|
if (StrUtil.isBlank(dto.getName())) { |
|
|
if (StrUtil.isBlank(dto.getName())) { |
|
|
throw new BusinessErrorException("考试任务名称不能为空"); |
|
|
throw new BusinessErrorException("考试任务名称不能为空"); |
|
|
} |
|
|
} |
|
|
if (dto.getId() == null) { |
|
|
LambdaQueryWrapper<TaskEntity> nameWrapper = new LambdaQueryWrapper<TaskEntity>() |
|
|
long count = taskBaseService.count(new LambdaQueryWrapper<TaskEntity>().eq(TaskEntity::getName, dto.getName())); |
|
|
.eq(TaskEntity::getName, dto.getName()); |
|
|
if (count > 0) { |
|
|
if (dto.getId() != null) { |
|
|
throw new BusinessErrorException("考试任务名称已存在"); |
|
|
nameWrapper.ne(TaskEntity::getId, dto.getId()); |
|
|
} |
|
|
} |
|
|
|
|
|
if (taskBaseService.count(nameWrapper) > 0) { |
|
|
|
|
|
throw new BusinessErrorException("考试任务名称已存在"); |
|
|
} |
|
|
} |
|
|
if (StrUtil.length(dto.getName()) > 20) { |
|
|
if (StrUtil.length(dto.getName()) > 20) { |
|
|
throw new BusinessErrorException("考试任务名称过长"); |
|
|
throw new BusinessErrorException("考试任务名称过长"); |
|
|
|