|
|
@@ -102,14 +102,14 @@ public class JyxConfigServiceImpl extends ServiceImpl<JyxConfigMapper, JyxConfig
|
|
|
JyxConfigVo jyxConfigVo = BeanUtil.copyProperties(config, JyxConfigVo.class);
|
|
|
CompletableFuture<Void> blameFuture = CompletableFuture.runAsync(() -> {
|
|
|
try {
|
|
|
- jyxConfigVo.setBlameList(selectBlameList(id));
|
|
|
+ jyxConfigVo.setBlameList(selectBlameList(config.getId()));
|
|
|
} catch (Exception e) {
|
|
|
log.error("加载 blameList 失败", e);
|
|
|
}
|
|
|
});
|
|
|
CompletableFuture<Void> settingFuture = CompletableFuture.runAsync(() -> {
|
|
|
try {
|
|
|
- jyxConfigVo.setSettingList(selectSettingList(id));
|
|
|
+ jyxConfigVo.setSettingList(selectSettingList(config.getId()));
|
|
|
} catch (Exception e) {
|
|
|
log.error("加载 settingList 失败", e);
|
|
|
}
|
|
|
@@ -161,30 +161,39 @@ public class JyxConfigServiceImpl extends ServiceImpl<JyxConfigMapper, JyxConfig
|
|
|
try {
|
|
|
List<JyxConfigVo> jyxConfigVos = Optional.ofNullable(jyxConfigMapper.jyxList(configParam)).orElse(Collections.emptyList());
|
|
|
if (StringUtils.isNotEmpty(configParam.getSeats()) || StringUtils.isNotEmpty(configParam.getParams())) {
|
|
|
- configParam.setParentId(ConstantsParent.PARENT_ID_ROOT);
|
|
|
- List<JyxConfigVo> additionalConfigs = Optional.ofNullable(jyxConfigMapper.jyxList(configParam)).orElse(Collections.emptyList());
|
|
|
- if (!additionalConfigs.isEmpty()) {
|
|
|
- Set<String> ids = additionalConfigs.stream().map(JyxConfigVo::getId).collect(Collectors.toSet());
|
|
|
- List<JyxConfigVo> parentConfigs = jyxConfigMapper.selectParentIds(new ArrayList<>(ids));
|
|
|
- jyxConfigVos.addAll(parentConfigs);
|
|
|
- jyxConfigVos = jyxConfigVos.stream().collect(collectingAndThen(
|
|
|
- toCollection(() -> new TreeSet<>(Comparator.comparing(JyxConfigVo::getId))), ArrayList::new
|
|
|
- ));
|
|
|
- }
|
|
|
+
|
|
|
+ Set<String> ids = jyxConfigVos.stream().filter(v -> !ConstantsParent.PARENT_ID_ROOT.equals(v.getParentId())).map(JyxConfigVo::getParentId).collect(Collectors.toSet());
|
|
|
+ List<JyxConfigVo> parentConfigs = jyxConfigMapper.selectParentIds(new ArrayList<>(ids));
|
|
|
+ jyxConfigVos.addAll(parentConfigs);
|
|
|
+ jyxConfigVos = jyxConfigVos.stream().collect(collectingAndThen(
|
|
|
+ toCollection(() -> new TreeSet<>(Comparator.comparing(JyxConfigVo::getId))), ArrayList::new
|
|
|
+ ));
|
|
|
+
|
|
|
+// configParam.setParentId(ConstantsParent.PARENT_ID_ROOT);
|
|
|
+// List<JyxConfigVo> additionalConfigs = Optional.ofNullable(jyxConfigMapper.jyxList(configParam)).orElse(Collections.emptyList());
|
|
|
+// if (!additionalConfigs.isEmpty()) {
|
|
|
+// Set<String> ids = additionalConfigs.stream().map(JyxConfigVo::getId).collect(Collectors.toSet());
|
|
|
+// List<JyxConfigVo> parentConfigs = jyxConfigMapper.selectParentIds(new ArrayList<>(ids));
|
|
|
+// jyxConfigVos.addAll(parentConfigs);
|
|
|
+// jyxConfigVos = jyxConfigVos.stream().collect(collectingAndThen(
|
|
|
+// toCollection(() -> new TreeSet<>(Comparator.comparing(JyxConfigVo::getId))), ArrayList::new
|
|
|
+// ));
|
|
|
+// }
|
|
|
}
|
|
|
if (jyxConfigVos.isEmpty()) {
|
|
|
return Collections.emptyList();
|
|
|
}
|
|
|
- Set<String> parentIds = jyxConfigVos.stream().map(JyxConfigVo::getParentId).collect(Collectors.toSet());
|
|
|
- List<JyxConfigVo> jyxConfigs = Optional.ofNullable(jyxConfigMapper.selectIds(new ArrayList<>(parentIds))).orElse(Collections.emptyList());
|
|
|
+// Set<String> parentIds = jyxConfigVos.stream().map(JyxConfigVo::getParentId).collect(Collectors.toSet());
|
|
|
+// List<JyxConfigVo> jyxConfigs = Optional.ofNullable(jyxConfigMapper.selectIds(new ArrayList<>(parentIds))).orElse(Collections.emptyList());
|
|
|
Map<String, List<JyxConfigVo>> childrenMap = jyxConfigVos.stream()
|
|
|
.filter(vo -> !ConstantsParent.PARENT_ID_ROOT.equals(vo.getParentId()))
|
|
|
.collect(Collectors.groupingBy(vo -> String.valueOf(vo.getParentId()), Collectors.mapping(Function.identity(), Collectors.toList())));
|
|
|
- List<JyxConfigVo> parentConfigs = BeanUtil.copyToList(jyxConfigs, JyxConfigVo.class);
|
|
|
- parentConfigs.forEach(parentConfig -> {
|
|
|
+
|
|
|
+ List<JyxConfigVo> configVos = jyxConfigVos.stream().filter(parentConfig -> ConstantsParent.PARENT_ID_ROOT.equals(parentConfig.getParentId())).collect(Collectors.toList());
|
|
|
+ configVos.forEach(parentConfig -> {
|
|
|
parentConfig.setChildren(childrenMap.getOrDefault(String.valueOf(parentConfig.getId()), Collections.emptyList()));
|
|
|
});
|
|
|
- return parentConfigs;
|
|
|
+ return configVos;
|
|
|
} catch (Exception e) {
|
|
|
// 记录日志或进行其他异常处理
|
|
|
e.printStackTrace();
|