Commit 287fc781 authored by duanruiming's avatar duanruiming

[update] 态势检测-辖区分组添加行政区级别

parent c97355c3
...@@ -27,6 +27,9 @@ public class AreaTreePO { ...@@ -27,6 +27,9 @@ public class AreaTreePO {
@ApiModelProperty(value = "父行政区划代码") @ApiModelProperty(value = "父行政区划代码")
private Integer parentCode; private Integer parentCode;
@ApiModelProperty(value = "行政区级别")
private Integer level;
@ApiModelProperty(value = "子行政区划列表") @ApiModelProperty(value = "子行政区划列表")
private List<AreaTreePO> children; private List<AreaTreePO> children;
......
...@@ -397,12 +397,15 @@ public class SituationDetectionServiceImpl implements SituationDetectionService ...@@ -397,12 +397,15 @@ public class SituationDetectionServiceImpl implements SituationDetectionService
List<AreaTreePO> resultList = areaTreePOS.stream().filter(areaTreePO -> areaTreePO.getChildren() != null).collect(Collectors.toList()); List<AreaTreePO> resultList = areaTreePOS.stream().filter(areaTreePO -> areaTreePO.getChildren() != null).collect(Collectors.toList());
// 辖区构建 // 辖区构建
List<AreaTreePO> jurisdictionAreaList = tBaseAreaInfoMapper.selectJurisdictionArea(); List<AreaTreePO> jurisdictionAreaList = tBaseAreaInfoMapper.selectJurisdictionArea();
jurisdictionAreaList.forEach(areaTreePO -> areaTreePO.setLevel(3));
Map<Integer, List<AreaTreePO>> parentCodeListMap = jurisdictionAreaList.stream().collect(Collectors.groupingBy(AreaTreePO::getParentCode)); Map<Integer, List<AreaTreePO>> parentCodeListMap = jurisdictionAreaList.stream().collect(Collectors.groupingBy(AreaTreePO::getParentCode));
for (AreaTreePO areaTreePO : resultList) { for (AreaTreePO areaTreePO : resultList) {
areaTreePO.setLevel(1);
List<AreaTreePO> childrenList = areaTreePO.getChildren(); List<AreaTreePO> childrenList = areaTreePO.getChildren();
for (AreaTreePO child : childrenList) { for (AreaTreePO child : childrenList) {
Integer areaCode = child.getAreaCode(); Integer areaCode = child.getAreaCode();
child.setLevel(2);
if (!parentCodeListMap.isEmpty() && parentCodeListMap.containsKey(areaCode)) { if (!parentCodeListMap.isEmpty() && parentCodeListMap.containsKey(areaCode)) {
child.setChildren(parentCodeListMap.get(areaCode)); child.setChildren(parentCodeListMap.get(areaCode));
} }
......
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