|
|
@ -35,22 +35,22 @@ public class UserServiceImpl implements UserService { |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 遍历所有机关(它的下级机关)统计注册用户和参与用户的数据,使用level控制 |
|
|
|
* @param topAgencies - List<AgencySubTreeDto> |
|
|
|
* @param agencies - List<AgencySubTreeDto> |
|
|
|
* @return |
|
|
|
* @author wangc |
|
|
|
* @date 2020.06.18 10:03 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public void traverseAgencyUser(List<AgencySubTreeDto> topAgencies, Date targetDate) { |
|
|
|
if(null == topAgencies || topAgencies.size() == NumConstant.ZERO){ |
|
|
|
public void traverseAgencyUser(List<AgencySubTreeDto> agencies, Date targetDate) { |
|
|
|
if(null == agencies || agencies.size() == NumConstant.ZERO){ |
|
|
|
logger.warn("没有相应的机关集合"); |
|
|
|
return ; |
|
|
|
} |
|
|
|
//自上向下检索
|
|
|
|
//Map<String, List<AgencySubTreeDto>> agencyMap = agencies.stream().collect(Collectors.groupingBy(AgencySubTreeDto::getAgencyId));
|
|
|
|
Map<String,Set<String>> subGridOfAgency = new HashMap<>(); |
|
|
|
topAgencies.forEach(agency -> { |
|
|
|
initAgencyGridMap(agency,subGridOfAgency); |
|
|
|
agencies.forEach(agency -> { |
|
|
|
initAgencyGridMap(agency.getAgencyId(),agency,subGridOfAgency); |
|
|
|
}); |
|
|
|
|
|
|
|
//对每一个机关进行数据统计
|
|
|
@ -86,6 +86,7 @@ public class UserServiceImpl implements UserService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 初始化机关-所有下级网格Map |
|
|
|
* @param agency - AgencySubTreeDto |
|
|
@ -93,15 +94,16 @@ public class UserServiceImpl implements UserService { |
|
|
|
* @return |
|
|
|
* @author wangc |
|
|
|
* @date 2020.06.18 15:54 |
|
|
|
**/ |
|
|
|
void initAgencyGridMap(AgencySubTreeDto agency, Map<String,Set<String>> subGridOfAgency){ |
|
|
|
**/ |
|
|
|
void initAgencyGridMap(String pid, AgencySubTreeDto agency, Map<String,Set<String>> subGridOfAgency){ |
|
|
|
|
|
|
|
//向map中放入数据
|
|
|
|
if(subGridOfAgency.containsKey(agency.getAgencyId())){ |
|
|
|
if(subGridOfAgency.containsKey(pid)){ |
|
|
|
//包含key
|
|
|
|
Set<String> grids = subGridOfAgency.get(agency.getAgencyId()); |
|
|
|
Set<String> grids = subGridOfAgency.get(pid); |
|
|
|
if(null == grids){ |
|
|
|
grids = new HashSet<>(); |
|
|
|
subGridOfAgency.put(agency.getAgencyId(),grids); |
|
|
|
subGridOfAgency.put(pid,grids); |
|
|
|
} |
|
|
|
if(null != agency.getGridIds() && agency.getGridIds().size() > NumConstant.ZERO){ |
|
|
|
grids.addAll(agency.getGridIds()); |
|
|
@ -109,7 +111,7 @@ public class UserServiceImpl implements UserService { |
|
|
|
}else{ |
|
|
|
//不包含key
|
|
|
|
Set<String> grids = new HashSet<>(agency.getGridIds()); |
|
|
|
subGridOfAgency.put(agency.getAgencyId(),grids); |
|
|
|
subGridOfAgency.put(pid,grids); |
|
|
|
} |
|
|
|
|
|
|
|
//定义递归出口
|
|
|
@ -117,9 +119,10 @@ public class UserServiceImpl implements UserService { |
|
|
|
return ; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//定义递归入口
|
|
|
|
agency.getSubAgencies().forEach(obj -> { |
|
|
|
initAgencyGridMap(obj,subGridOfAgency); |
|
|
|
initAgencyGridMap(pid,obj,subGridOfAgency); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|