|
|
@@ -25,6 +25,7 @@ import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
public class CommService {
|
|
|
@@ -105,9 +106,13 @@ public class CommService {
|
|
|
parent.getChildren().add(node);
|
|
|
}
|
|
|
if(!CollectionUtils.isEmpty(knowledgeIdSet)) {
|
|
|
+ List<LearnTeacherService.TreeNode> childList;
|
|
|
List<LearnTeacherService.TreeNode> rootList = Lists.newArrayList();
|
|
|
for(LearnTeacherService.TreeNode tn : treeNodeList) {
|
|
|
- if(knowledgeIdSet.contains(tn.getId()) || tn.getChildren().stream().filter(t -> knowledgeIdSet.contains(t.getId())).count() > 0L) {
|
|
|
+ if(knowledgeIdSet.contains(tn.getId())) {
|
|
|
+ rootList.add(tn);
|
|
|
+ } else if(!(childList = tn.getChildren().stream().filter(t -> knowledgeIdSet.contains(t.getId())).collect(Collectors.toList())).isEmpty()) {
|
|
|
+ tn.setChildren(childList);
|
|
|
rootList.add(tn);
|
|
|
}
|
|
|
}
|