fix: 空数据时接口报错
This commit is contained in:
+12
-6
@@ -208,7 +208,9 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
|
|||||||
esRelations.add(standMenuRelation);
|
esRelations.add(standMenuRelation);
|
||||||
}
|
}
|
||||||
// 计算每个节点的数值
|
// 计算每个节点的数值
|
||||||
TsResources.get(0).calculateAndSetCounts(gbRelations, fbRelations, esRelations, 0);
|
if (!TsResources.isEmpty()) {
|
||||||
|
TsResources.get(0).calculateAndSetCounts(gbRelations, fbRelations, esRelations, 0);
|
||||||
|
}
|
||||||
// 拼接返回
|
// 拼接返回
|
||||||
return TsResources;
|
return TsResources;
|
||||||
}
|
}
|
||||||
@@ -486,11 +488,15 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
|
|||||||
.filter(resource1 -> resource1.getParentId().equals(resource.getId()))
|
.filter(resource1 -> resource1.getParentId().equals(resource.getId()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if (!tsResources.isEmpty()) {
|
if (!tsResources.isEmpty()) {
|
||||||
tsResources = tsResources.stream().sorted(Comparator.comparing(resource1 -> resource1.getDisplaySeq())).collect(Collectors.toList());
|
try {
|
||||||
tsResources.forEach(resource1 -> {
|
tsResources = tsResources.stream().sorted(Comparator.comparing(resource1 -> resource1.getDisplaySeq())).collect(Collectors.toList());
|
||||||
resource1.setTreeType("sarMs");
|
tsResources.forEach(resource1 -> {
|
||||||
resource1.setChildren(recursionGetListChildrenStand((resource1), (children)));
|
resource1.setTreeType("sarMs");
|
||||||
});
|
resource1.setChildren(recursionGetListChildrenStand((resource1), (children)));
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("异常");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return tsResources;
|
return tsResources;
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-8
@@ -147,14 +147,16 @@ public class SarMenuStandard extends BaseEntity {
|
|||||||
this.fbStandCount = countMatches(fbStandMenu, this.id, fbStandIdList);
|
this.fbStandCount = countMatches(fbStandMenu, this.id, fbStandIdList);
|
||||||
this.esStandCount = countMatches(esStandMenu, this.id, esStandIdList);
|
this.esStandCount = countMatches(esStandMenu, this.id, esStandIdList);
|
||||||
|
|
||||||
for (SarMenuStandard child : children) {
|
if (children != null && !children.isEmpty()) {
|
||||||
child.calculateAndSetCounts(gbStandMenu, fbStandMenu, esStandMenu, curLevel + 1);
|
for (SarMenuStandard child : children) {
|
||||||
this.gbStandCount += child.gbStandCount;
|
child.calculateAndSetCounts(gbStandMenu, fbStandMenu, esStandMenu, curLevel + 1);
|
||||||
this.gbStandIdList.addAll(child.gbStandIdList);
|
this.gbStandCount += child.gbStandCount;
|
||||||
this.fbStandCount += child.fbStandCount;
|
this.gbStandIdList.addAll(child.gbStandIdList);
|
||||||
this.fbStandIdList.addAll(child.fbStandIdList);
|
this.fbStandCount += child.fbStandCount;
|
||||||
this.esStandCount += child.esStandCount;
|
this.fbStandIdList.addAll(child.fbStandIdList);
|
||||||
this.esStandIdList.addAll(child.esStandIdList);
|
this.esStandCount += child.esStandCount;
|
||||||
|
this.esStandIdList.addAll(child.esStandIdList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user