Commit f41d4d75 authored by chenhao's avatar chenhao

提交对于建筑树的帅选

parent 2c4512be
...@@ -4,6 +4,7 @@ import java.util.ArrayList; ...@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.constants.BizConstant; import com.yeejoin.amos.boot.biz.common.constants.BizConstant;
...@@ -225,7 +226,8 @@ public class FireStationServiceImpl extends BaseService<FireStationDto, FireStat ...@@ -225,7 +226,8 @@ public class FireStationServiceImpl extends BaseService<FireStationDto, FireStat
if(buildingMapList==null || buildingMapList.size()<1) { if(buildingMapList==null || buildingMapList.size()<1) {
return null; return null;
} }
return parseTree((List<Map<String, Object>>)buildingMapList.get(0).get("children"),FireStationCountMap); List<Map<String, Object>> childrens = ((List<Map<String, Object>>) buildingMapList.get(0).get("children")).stream().filter(i->i.get("bizOrgCode").toString().contains(bizOrgCode)).collect(Collectors.toList());
return parseTree(childrens,FireStationCountMap);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
......
package com.yeejoin.amos.boot.module.common.biz.service.impl; package com.yeejoin.amos.boot.module.common.biz.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -416,12 +417,13 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite ...@@ -416,12 +417,13 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
if (buildingMapList == null || buildingMapList.size() < 1) { if (buildingMapList == null || buildingMapList.size() < 1) {
return null; return null;
} }
Map<String, Object> reMap = parseTree((List<Map<String, Object>>) buildingMapList.get(0).get("children"), List<Map<String, Object>> childrens = ((List<Map<String, Object>>) buildingMapList.get(0).get("children")).stream().filter(i->i.get("bizOrgCode").toString().contains(bizOrgCode)).collect(Collectors.toList());
Map<String, Object> reMap = parseTree(childrens,
keySiteCountMap, allCount); keySiteCountMap, allCount);
Map<String, Object> fristMap = buildingMapList.get(0); Map<String, Object> fristMap = buildingMapList.get(0);
fristMap.put("id", 0); fristMap.put("id", 0);
fristMap.put("name", fristMap.get("instanceName") + " (" + reMap.get("allCount") + ")"); fristMap.put("name", fristMap.get("instanceName") + " (" + reMap.get("allCount") + ")");
fristMap.put("children", fristMap.get("children")); fristMap.put("children", reMap.get("children"));
buildingMapList.clear(); buildingMapList.clear();
buildingMapList.add(fristMap); buildingMapList.add(fristMap);
return buildingMapList; return buildingMapList;
...@@ -437,12 +439,12 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite ...@@ -437,12 +439,12 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
if (keySiteCountMap.containsKey(child.get("id").toString())) { if (keySiteCountMap.containsKey(child.get("id").toString())) {
allCount = allCount + keySiteCountMap.get(child.get("id").toString()).intValue(); allCount = allCount + keySiteCountMap.get(child.get("id").toString()).intValue();
child.put("name", child.put("name",
child.get("name") + " (" + keySiteCountMap.get(child.get("id").toString()) + ")"); child.get("name") + "(" + keySiteCountMap.get(child.get("id").toString()) + ")");
} else { } else {
child.put("name", child.get("name") + " (" + 0 + ")"); child.put("name", child.get("name") + "(" + 0 + ")");
} }
} else { } else {
child.put("name", child.get("name") + " (" + 0 + ")"); child.put("name", child.get("name") + "(" + 0 + ")");
} }
if (!ValidationUtil.isEmpty(child.get("children"))) { if (!ValidationUtil.isEmpty(child.get("children"))) {
parseTree((List<Map<String, Object>>) child.get("children"), keySiteCountMap, allCount); parseTree((List<Map<String, Object>>) child.get("children"), keySiteCountMap, allCount);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment