|
@@ -29,9 +29,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -184,6 +182,8 @@ public class UStandardInfoServiceImpl extends ServiceImpl<StandardInfoMapper, St
|
|
|
List<StandardInfoJoinDTO> list = new ArrayList<>();
|
|
|
//新增数据
|
|
|
List<StandardInfoJoin> saveData = new ArrayList<>();
|
|
|
+ //数据校验
|
|
|
+ List<String> newGroupRightIds = new ArrayList<>();
|
|
|
//解析参数
|
|
|
for (StandardInfoVO standardInfoJoin : standardInfoJoins) {
|
|
|
StandardInfoJoinDTO standardInfoJoinDTO = new StandardInfoJoinDTO();
|
|
@@ -191,8 +191,6 @@ public class UStandardInfoServiceImpl extends ServiceImpl<StandardInfoMapper, St
|
|
|
Long leftId = standardInfoJoin.getId();
|
|
|
|
|
|
standardInfoJoinDTO.setLeftId(leftId);
|
|
|
- //设置随机组id
|
|
|
- standardInfoJoinDTO.setGroupId(SnowFlakeUtil.getId());
|
|
|
List<StandardInfoConditionVo> standardInfos = standardInfoJoin.getStandardInfos();
|
|
|
if (CollectionUtil.isNotEmpty(standardInfos)) {
|
|
|
for (StandardInfoConditionVo standardInfo : standardInfos) {
|
|
@@ -202,8 +200,20 @@ public class UStandardInfoServiceImpl extends ServiceImpl<StandardInfoMapper, St
|
|
|
}
|
|
|
list.add(standardInfoJoinDTO);
|
|
|
}
|
|
|
+
|
|
|
+ //新的数据排序后组合成字符串
|
|
|
+ List<Long> newRightIds = standardInfoJoinDTO.getRightIds();
|
|
|
+ Collections.sort(newRightIds);
|
|
|
+ String newRightIdsStr = String.join(",", newRightIds.stream().map(String::valueOf).collect(Collectors.toList()));
|
|
|
+ newGroupRightIds.add(newRightIdsStr);
|
|
|
+ }
|
|
|
+
|
|
|
+ Set<String> set = new HashSet<>(newGroupRightIds);
|
|
|
+ if (set.size() < list.size()) {
|
|
|
+ throw new ServiceException("请勿重复添加条件");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
//封装参数
|
|
|
for (StandardInfoJoinDTO standardInfoJoin : list) {
|
|
|
List<Long> rightIds = standardInfoJoin.getRightIds();
|