|
|
|
|
@ -33,17 +33,8 @@ public class RiskScoreRuleService extends ServiceImpl<RiskScoreRuleMapper, RiskS
|
|
|
|
|
List<RiskClassModel> riskClasses = riskScoreRuleMapper.selectListAll(); |
|
|
|
|
List<RiskClassModel> treeList = riskClasses.stream().filter(item -> item.getPid() != 0).toList(); |
|
|
|
|
List<Model> models = modelService.list(); |
|
|
|
|
|
|
|
|
|
// id, root item根目录
|
|
|
|
|
Map<Integer, RiskClassModel> map = rootsList.stream().collect(Collectors.toMap(RiskClassModel::getId, Function.identity(), (newVal, oldVal) -> newVal)); |
|
|
|
|
|
|
|
|
|
// pid, treeList 子目录
|
|
|
|
|
Map<Integer, List<RiskClassModel>> treeMap = treeList.stream().collect(Collectors.groupingBy(RiskClassModel::getPid)); |
|
|
|
|
|
|
|
|
|
// Map<Integer, List<Model>> modelMap = models.stream().collect(Collectors.groupingBy(Model::getRiskScoreRuleId));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// pid,子目录
|
|
|
|
|
Map<Integer, List<RiskTree>> rootChildren = new HashMap<>(); |
|
|
|
|
for (Map.Entry<Integer, List<RiskClassModel>> entry : treeMap.entrySet()) { |
|
|
|
|
List<RiskClassModel> trees = entry.getValue(); |
|
|
|
|
@ -54,7 +45,6 @@ public class RiskScoreRuleService extends ServiceImpl<RiskScoreRuleMapper, RiskS
|
|
|
|
|
RiskTree node = new RiskTree(); |
|
|
|
|
node.setId(model.getId()); |
|
|
|
|
node.setRiskName(model.getModelName()); |
|
|
|
|
// node.setSize(tree.getSize());
|
|
|
|
|
node.setType("modelClass"); |
|
|
|
|
children.add(node); |
|
|
|
|
} |
|
|
|
|
@ -78,33 +68,6 @@ public class RiskScoreRuleService extends ServiceImpl<RiskScoreRuleMapper, RiskS
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
// List<RiskTree> list = new ArrayList<>();
|
|
|
|
|
// list.addAll(rootsList.stream().map(item -> {
|
|
|
|
|
// RiskTree node = new RiskTree();
|
|
|
|
|
// node.setId(item.getId());
|
|
|
|
|
// node.setRiskName(item.getName());
|
|
|
|
|
// node.setSize(item.getSize());
|
|
|
|
|
// node.setType("modelClass");
|
|
|
|
|
// List<RiskTree> children = models.stream().filter(
|
|
|
|
|
// model -> {
|
|
|
|
|
// for (RiskClassModel riskClassModel : treeList) {
|
|
|
|
|
// boolean b = item.getId().equals(riskClassModel.getPid()) && riskClassModel.getId().equals(model.getRiskScoreRuleId());
|
|
|
|
|
// System.out.println("测试1当前item:【id:" + item.getId() + ",pid:" + item.getPid()
|
|
|
|
|
// + "】,当前model:【id:" + model.getId() + ",risk_id:" + model.getRiskScoreRuleId()
|
|
|
|
|
// + "】,当前riskClassModel:【id:" + riskClassModel.getId() + ",pid:" + riskClassModel.getPid()
|
|
|
|
|
// + ",name:" + riskClassModel.getName() + ",size:" + riskClassModel.getSize());
|
|
|
|
|
// return b;
|
|
|
|
|
// }
|
|
|
|
|
// System.out.println("测试2当前item:【id:" + item.getId() + ",pid:" + item.getPid()
|
|
|
|
|
// + "】,当前model:【id:" + model.getId() + ",risk_id:" + model.getRiskScoreRuleId()
|
|
|
|
|
// + "】");
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
// ).map(RiskTree::of).toList();
|
|
|
|
|
// node.setChildren(children);
|
|
|
|
|
// return node;
|
|
|
|
|
// }).toList());
|
|
|
|
|
// return list;
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public List<RiskScoreRuleTree> oldBuildTree() { |
|
|
|
|
|