|
|
@@ -1694,29 +1694,13 @@ public class CustomFunction {
|
|
|
Integer type = RandomNumberHolder.getRandomTemplateType();
|
|
|
if(type==null||type==1){
|
|
|
for (Integer i : index) {
|
|
|
- if (i >= nodes.size()) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- boolean isExist = false;
|
|
|
- //获取当前节点的名称
|
|
|
- String title = nodes.get(i);
|
|
|
- //当前节点的名称是否已经在父级节点中包含了
|
|
|
- if(org.apache.commons.lang.StringUtils.isNotEmpty(title)){
|
|
|
- for (int j = 0; j < i; j++) {
|
|
|
- String parentTitle = nodes.get(j);
|
|
|
- //如果父级节点名称中保存当前节点名称 就跳过当前节点
|
|
|
- if(org.apache.commons.lang.StringUtils.isNotEmpty(parentTitle) && org.apache.commons.lang.StringUtils.isNotEmpty(title) && parentTitle.contains(title)){
|
|
|
- isExist = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if(isExist){
|
|
|
+ if (i < nodes.size()) {
|
|
|
+ //获取当前节点的名称
|
|
|
+ String title = nodes.get(i);
|
|
|
+ if(title == null || result.stream().anyMatch(f -> f.contains(title))){
|
|
|
continue;
|
|
|
}
|
|
|
- //保留之间的添加逻辑 在之前对数据做去重过滤
|
|
|
- if (i < nodes.size()) {
|
|
|
- result.add(nodes.get(i));
|
|
|
- }
|
|
|
+ result.add(nodes.get(i));
|
|
|
}
|
|
|
}
|
|
|
return String.join("", result);
|
|
|
@@ -1729,24 +1713,11 @@ public class CustomFunction {
|
|
|
(existing, replacement) -> replacement // 如果键重复,保留后者
|
|
|
));
|
|
|
for (Integer i : index) {
|
|
|
- boolean isExist = false;
|
|
|
- //获取当前节点的名称
|
|
|
String title = map.get(i == 0 ? 1 : i == 1 && map.containsKey(18) ? 18 : i);
|
|
|
- //当前节点的名称是否已经在父级节点中包含了
|
|
|
- if(org.apache.commons.lang.StringUtils.isNotEmpty(title)){
|
|
|
- for (int j = 0; j < i; j++) {
|
|
|
- String parentTitle = map.get(j == 0 ? 1 : j == 1 && map.containsKey(18) ? 18 : j);
|
|
|
- //如果父级节点名称中保存当前节点名称 就跳过当前节点
|
|
|
- if(org.apache.commons.lang.StringUtils.isNotEmpty(parentTitle) && org.apache.commons.lang.StringUtils.isNotEmpty(title) && parentTitle.contains(title)){
|
|
|
- isExist = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if(isExist){
|
|
|
- continue;
|
|
|
- }
|
|
|
- result.add(title);
|
|
|
+ if(title == null || result.stream().anyMatch(f -> f.contains(title))){
|
|
|
+ continue;
|
|
|
}
|
|
|
+ result.add(title);
|
|
|
}
|
|
|
return String.join("", result);
|
|
|
}
|