|
|
@ -137,7 +137,7 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn |
|
|
|
if (StringUtils.isNotBlank(s)){ |
|
|
|
tree = JSON.parseArray(s,AreaCodeDictResultDTO.class); |
|
|
|
}else { |
|
|
|
List<AreaCodeDictResultDTO> areaCodeDictResultDTOS = disposeTree(); |
|
|
|
List<AreaCodeDictResultDTO> areaCodeDictResultDTOS = disposeTree(formDTO); |
|
|
|
areaCodeRedis.set(AreaCodeConstant.SCREEN_TREE,areaCodeDictResultDTOS); |
|
|
|
tree = areaCodeDictResultDTOS; |
|
|
|
} |
|
|
@ -154,11 +154,11 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn |
|
|
|
* @author zxc |
|
|
|
* @date 2021/1/8 上午8:57 |
|
|
|
*/ |
|
|
|
public List<AreaCodeDictResultDTO> disposeTree(){ |
|
|
|
public List<AreaCodeDictResultDTO> disposeTree(AreaCodeDictFormDTO formDTO){ |
|
|
|
// 查询所有省市区
|
|
|
|
List<AreaCodeDTO> areaCodeDTOS = baseDao.selectAllArea(); |
|
|
|
// 查询所有街道、社区
|
|
|
|
List<AreaCodeChildDTO> areaCodeChildDTOS = childDao.selectAllChild(); |
|
|
|
List<AreaCodeChildDTO> areaCodeChildDTOS = childDao.selectAllChild(formDTO.getRootAreaCode()); |
|
|
|
List<AreaCodeDictResultDTO> result = new ArrayList<>(); |
|
|
|
List<AreaCodeDictResultDTO> fourResult = new ArrayList<>(); |
|
|
|
List<AreaCodeDictResultDTO> cityResult = new ArrayList<>(); |
|
|
@ -388,21 +388,21 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn |
|
|
|
* @author zxc |
|
|
|
* @date 2021/1/11 上午9:48 |
|
|
|
*/ |
|
|
|
public List<AreaCodeDictResultDTO> afterTwoTree(){ |
|
|
|
public List<AreaCodeDictResultDTO> afterTwoTree(AreaCodeDictFormDTO form){ |
|
|
|
// 查询所有街道、社区
|
|
|
|
List<AreaCodeChildDTO> areaCodeChildDTOS = childDao.selectAllChild(); |
|
|
|
List<AreaCodeChildDTO> areaCodeChildDTOS = childDao.selectAllChild(form.getRootAreaCode()); |
|
|
|
List<AreaCodeDictResultDTO> fourResult = new ArrayList<>(); |
|
|
|
List<AreaCodeDictResultDTO> fiveResult = new ArrayList<>(); |
|
|
|
// 街道-社区
|
|
|
|
Map<Integer, List<AreaCodeChildDTO>> groupByLevel = areaCodeChildDTOS.stream().collect(Collectors.groupingBy(AreaCodeChildDTO::getLevel)); |
|
|
|
//社区
|
|
|
|
List<AreaCodeChildDTO> levelFive = groupByLevel.get(NumConstant.FIVE); |
|
|
|
Map<String, List<AreaCodeChildDTO>> groupByPCode = levelFive.stream().collect(Collectors.groupingBy(AreaCodeChildDTO::getPCode)); |
|
|
|
List<AreaCodeChildDTO> levelFive = org.apache.commons.collections4.CollectionUtils.isNotEmpty(groupByLevel.get(NumConstant.FIVE)) ? groupByLevel.get(NumConstant.FIVE) : new ArrayList<>(); |
|
|
|
Map<String, List<AreaCodeChildDTO>> groupByPCode = CollectionUtils.isEmpty(levelFive) ? new HashMap<>() : levelFive.stream().collect(Collectors.groupingBy(AreaCodeChildDTO::getPCode)); |
|
|
|
//街道
|
|
|
|
List<AreaCodeChildDTO> levelFour = groupByLevel.get(NumConstant.FOUR); |
|
|
|
List<AreaCodeChildDTO> levelFour = org.apache.commons.collections4.CollectionUtils.isNotEmpty(groupByLevel.get(NumConstant.FOUR)) ?groupByLevel.get(NumConstant.FOUR):new ArrayList<>(); |
|
|
|
// 6级
|
|
|
|
List<AreaCodeChildDTO> levelSix = groupByLevel.get(NumConstant.SIX); |
|
|
|
Map<String, List<AreaCodeChildDTO>> groupBySixPCode = levelSix.stream().collect(Collectors.groupingBy(AreaCodeChildDTO::getPCode)); |
|
|
|
Map<String, List<AreaCodeChildDTO>> groupBySixPCode = CollectionUtils.isEmpty(levelSix) ? new HashMap<>() : levelSix.stream().collect(Collectors.groupingBy(AreaCodeChildDTO::getPCode)); |
|
|
|
|
|
|
|
levelFive.forEach(f -> { |
|
|
|
AreaCodeDictResultDTO dto = new AreaCodeDictResultDTO(); |
|
|
@ -450,7 +450,7 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn |
|
|
|
*/ |
|
|
|
public List<AreaCodeDictResultDTO> disposeAfterTwoLevel(AreaCodeDictFormDTO form){ |
|
|
|
List<AreaCodeDictResultDTO> result = new ArrayList<>(); |
|
|
|
List<AreaCodeDictResultDTO> areaCodeDictResultDTOS = afterTwoTree(); |
|
|
|
List<AreaCodeDictResultDTO> areaCodeDictResultDTOS = afterTwoTree(form); |
|
|
|
if (CollectionUtils.isEmpty(areaCodeDictResultDTOS)){ |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
@ -532,7 +532,7 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn |
|
|
|
*/ |
|
|
|
public List<AreaCodeDictResultDTO> disposeBeforeThreeLevelFinal(AreaCodeDictFormDTO form,List<AreaCodeDictResultDTO> tree){ |
|
|
|
List<AreaCodeDictResultDTO> threeDto = disposeBeforeThreeLevel(form, tree); |
|
|
|
List<AreaCodeDictResultDTO> twoDto = afterTwoTree(); |
|
|
|
List<AreaCodeDictResultDTO> twoDto = afterTwoTree(form); |
|
|
|
if (CollectionUtils.isEmpty(threeDto)){ |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|