|
@@ -67,13 +67,18 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
|
|
|
Integer createPersonId = personnelVO.getId();
|
|
|
String createPersonName = personnelVO.getName();
|
|
|
|
|
|
+ //去除所有事件的名称的前后空格
|
|
|
+ eventAddNewDTOs.forEach(eventAddNewDTO -> {
|
|
|
+ eventAddNewDTO.setQuestionName(eventAddNewDTO.getQuestionName().trim());
|
|
|
+ });
|
|
|
+
|
|
|
//取出DTOs中的事件名称questionNames,根据事件名称questionNames和租户id查询出重名的已有事件
|
|
|
List<String> questionNames = eventAddNewDTOs.stream().map(EventAddNewDTO::getQuestionName).collect(Collectors.toList());
|
|
|
LambdaQueryWrapper<Event> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.in(Event::getQuestionName, questionNames).in(Event::getTenantId, tenantId);
|
|
|
List<Event> existNamesEvents = this.list(wrapper);
|
|
|
if (existNamesEvents != null && existNamesEvents.size() > 0) {
|
|
|
- ThrowException.throwXiaoShiException("新增失败,本租户下事件名称【" + existNamesEvents.get(0).getQuestionName() + "已存在,请尝试更换名称】");
|
|
|
+ ThrowException.throwXiaoShiException("新增失败,本租户下事件名称【" + existNamesEvents.get(0).getQuestionName() + "】已存在,请尝试更换名称】");
|
|
|
}
|
|
|
|
|
|
//新增事件
|
|
@@ -329,6 +334,9 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
|
|
|
ThrowException.throwXiaoShiException("修改失败,访问的数据不存在,请尝试刷新页面");
|
|
|
}
|
|
|
|
|
|
+ //去除事件名称的前后空格
|
|
|
+ eventUpdateDTO.setQuestionName(eventUpdateDTO.getQuestionName().trim());
|
|
|
+
|
|
|
//若修改了名称,则检查名称是否被占用(同一租户下专题库不能有同名事件名称)
|
|
|
String newQuestionName = eventUpdateDTO.getQuestionName();
|
|
|
String oldQuestionName = queryResult.getQuestionName();
|