界面算法数据查询调整
This commit is contained in:
@@ -182,8 +182,8 @@ public class TerminalServiceImpl implements TerminalService {
|
||||
powerCompanyList.stream().peek(item -> item.setChildren(getChildCategoryList(item, substationList))).collect(Collectors.toList());
|
||||
setTreeFlag(powerCompanyList,substationList);
|
||||
|
||||
setFatherOnlineRate(substationList);
|
||||
setFatherOnlineRate(powerCompanyList);
|
||||
setFatherOnlineRate(substationList,3);
|
||||
setFatherOnlineRate(powerCompanyList,2);
|
||||
// setAreaIntegrity(areaList);
|
||||
return powerCompanyList;
|
||||
}
|
||||
@@ -264,18 +264,24 @@ public class TerminalServiceImpl implements TerminalService {
|
||||
/**
|
||||
* 计算该子层级终端在线率
|
||||
*/
|
||||
private void setFatherOnlineRate(List<TerminalVO> list) {
|
||||
list.forEach(item -> {
|
||||
private void setFatherOnlineRate(List<TerminalVO> list,Integer level) {
|
||||
List<TerminalVO> buttonList = new ArrayList<>(),tempList = new ArrayList<>();
|
||||
for (TerminalVO item : list) {
|
||||
List<TerminalVO> children = item.getChildren();
|
||||
List<TerminalVO> tempList = children.stream().filter(s -> !Objects.equals(s.getOnlineRateData(), 3.14159)).collect(Collectors.toList());
|
||||
if (Objects.equals(level,2)){
|
||||
for (TerminalVO item2 : children) {
|
||||
buttonList.addAll(item2.getChildren());
|
||||
tempList = buttonList.stream().filter(s -> !Objects.equals(s.getOnlineRateData(), 3.14159)).collect(Collectors.toList());
|
||||
}
|
||||
} else if (Objects.equals(level,3)){
|
||||
tempList = children.stream().filter(s -> !Objects.equals(s.getOnlineRateData(), 3.14159)).collect(Collectors.toList());
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(tempList)) {
|
||||
item.setOnlineRateData(PubUtils.dataLimits(tempList.stream().mapToDouble(TerminalVO::getOnlineRateData).sum() / tempList.size()));
|
||||
} else {
|
||||
item.setOnlineRateData(3.14159);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user