|
@@ -19,36 +19,96 @@ public class SttreeService {
|
|
|
List<ProBasicWindpowerstation> wpls = CacheContext.wpls;//场站
|
|
|
List<ProBasicProject> prols = CacheContext.prols;//期次
|
|
|
List<ProBasicLine> list = CacheContext.lines;//线路
|
|
|
- List<ProBasicWindturbine> wbls = CacheContext.windturbines;//线路
|
|
|
+ List<ProBasicWindturbine> wbls = CacheContext.windturbines;//风机
|
|
|
|
|
|
// if (energyls.get(0).getChildren().size() > 0) return energyls;
|
|
|
|
|
|
- //集团-区域
|
|
|
- energyls.forEach(regls -> {
|
|
|
- List<ProBasicRegion> collect = regionsls.stream().filter(r -> r.getGroupId().equals(regls.getId())).collect(Collectors.toList());
|
|
|
- if (null != regls.getChildren()) {
|
|
|
- regls.getChildren().clear();
|
|
|
+ //集团-公司
|
|
|
+ energyls.forEach(cps -> {
|
|
|
+ List<ProBasicCompany> collect = cpls.stream().filter(r -> r.getGroupId().equals(cps.getId())).collect(Collectors.toList());
|
|
|
+ if (null != cps.getChildren()) {
|
|
|
+ cps.getChildren().clear();
|
|
|
}
|
|
|
collect.stream().forEach(c -> {
|
|
|
c.getChildren().clear();
|
|
|
});
|
|
|
- regls.getChildren().addAll(collect);
|
|
|
+ cps.getChildren().addAll(collect);
|
|
|
});
|
|
|
|
|
|
if ("1".equals(tag)) {
|
|
|
return energyls;
|
|
|
}
|
|
|
|
|
|
+ //公司-场站
|
|
|
+ cpls.forEach(wp -> {
|
|
|
+ List<ProBasicWindpowerstation> co = wpls.stream().filter(w -> null != w.getCompanyId() && w.getCompanyId().equals(wp.getId())).collect(Collectors.toList());
|
|
|
+ co.stream().forEach(c -> {
|
|
|
+ c.getChildren().clear();
|
|
|
+ });
|
|
|
+ wp.getChildren().addAll(co);
|
|
|
+ });
|
|
|
+ if ("2".equals(tag)) {
|
|
|
+ return energyls;
|
|
|
+ }
|
|
|
+
|
|
|
+ //场站-期次
|
|
|
+ wpls.forEach(pl -> {
|
|
|
+ List<ProBasicProject> cz = prols.stream().filter(p -> null != p.getWindpowerstationId() && p.getWindpowerstationId().equals(pl.getId())).collect(Collectors.toList());
|
|
|
+ cz.stream().forEach(c -> {
|
|
|
+ c.getChildren().clear();
|
|
|
+ });
|
|
|
+ pl.getChildren().addAll(cz);
|
|
|
+ });
|
|
|
+ if ("3".equals(tag)) {
|
|
|
+ return energyls;
|
|
|
+ }
|
|
|
+
|
|
|
+ //期次-线路
|
|
|
+ prols.forEach(ll -> {
|
|
|
+ List<ProBasicLine> lis = list.stream().filter(l -> null != l.getProjectId() && l.getProjectId().equals(ll.getId())).collect(Collectors.toList());
|
|
|
+ lis.stream().forEach(c -> {
|
|
|
+ c.getChildren().clear();
|
|
|
+ });
|
|
|
+ ll.getChildren().addAll(lis);
|
|
|
+ });
|
|
|
+ if ("4".equals(tag)) {
|
|
|
+ return energyls;
|
|
|
+ }
|
|
|
+ //线路-风机
|
|
|
+ list.forEach(fj -> {
|
|
|
+ List<ProBasicWindturbine> fjls = wbls.stream().filter(f -> null != f.getLineId() && f.getLineId().equals(fj.getId())).collect(Collectors.toList());
|
|
|
+ fj.getChildren().addAll(fjls);
|
|
|
+ });
|
|
|
+
|
|
|
+ return energyls;
|
|
|
+ }
|
|
|
+
|
|
|
+ //区域树
|
|
|
+ public List<ProBasicRegion> Regiontree(String tag) {
|
|
|
+
|
|
|
+ List<ProBasicEnergyGroup> energyls = CacheContext.energy;//集团
|
|
|
+ List<ProBasicRegion> regionsls = CacheContext.regions;//区域
|
|
|
+ List<ProBasicCompany> cpls = CacheContext.cpls;//公司
|
|
|
+ List<ProBasicWindpowerstation> wpls = CacheContext.wpls;//场站
|
|
|
+ List<ProBasicProject> prols = CacheContext.prols;//期次
|
|
|
+ List<ProBasicLine> list = CacheContext.lines;//线路
|
|
|
+ List<ProBasicWindturbine> wbls = CacheContext.windturbines;//线路
|
|
|
+
|
|
|
+// if (energyls.get(0).getChildren().size() > 0) return energyls;
|
|
|
+
|
|
|
//区域-公司
|
|
|
regionsls.forEach(cp -> {
|
|
|
List<ProBasicCompany> region = cpls.stream().filter(c -> null != c.getRegionId() && c.getRegionId().equals(cp.getId())).collect(Collectors.toList());
|
|
|
+ if (null != cp.getChildren()) {
|
|
|
+ cp.getChildren().clear();
|
|
|
+ }
|
|
|
region.stream().forEach(r -> {
|
|
|
r.getChildren().clear();
|
|
|
});
|
|
|
cp.getChildren().addAll(region);
|
|
|
});
|
|
|
- if ("2".equals(tag)) {
|
|
|
- return energyls;
|
|
|
+ if ("1".equals(tag)) {
|
|
|
+ return regionsls;
|
|
|
}
|
|
|
|
|
|
//公司-场站
|
|
@@ -59,8 +119,8 @@ public class SttreeService {
|
|
|
});
|
|
|
wp.getChildren().addAll(co);
|
|
|
});
|
|
|
- if ("3".equals(tag)) {
|
|
|
- return energyls;
|
|
|
+ if ("2".equals(tag)) {
|
|
|
+ return regionsls;
|
|
|
}
|
|
|
|
|
|
//场站-期次
|
|
@@ -71,17 +131,20 @@ public class SttreeService {
|
|
|
});
|
|
|
pl.getChildren().addAll(cz);
|
|
|
});
|
|
|
- if ("4".equals(tag)) {
|
|
|
- return energyls;
|
|
|
+ if ("3".equals(tag)) {
|
|
|
+ return regionsls;
|
|
|
}
|
|
|
|
|
|
//期次-线路
|
|
|
prols.forEach(ll -> {
|
|
|
List<ProBasicLine> lis = list.stream().filter(l -> null != l.getProjectId() && l.getProjectId().equals(ll.getId())).collect(Collectors.toList());
|
|
|
+ lis.stream().forEach(c -> {
|
|
|
+ c.getChildren().clear();
|
|
|
+ });
|
|
|
ll.getChildren().addAll(lis);
|
|
|
});
|
|
|
- if ("5".equals(tag)) {
|
|
|
- return energyls;
|
|
|
+ if ("4".equals(tag)) {
|
|
|
+ return regionsls;
|
|
|
}
|
|
|
//线路-风机
|
|
|
list.forEach(fj -> {
|
|
@@ -89,6 +152,6 @@ public class SttreeService {
|
|
|
fj.getChildren().addAll(fjls);
|
|
|
});
|
|
|
|
|
|
- return energyls;
|
|
|
+ return regionsls;
|
|
|
}
|
|
|
}
|