|  | @ -36,12 +36,10 @@ import com.epmet.dao.AreaCodeChildDao; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.dao.AreaCodeDao; |  |  | import com.epmet.dao.AreaCodeDao; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.dto.AreaCodeChildDTO; |  |  | import com.epmet.dto.AreaCodeChildDTO; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.dto.AreaCodeDTO; |  |  | import com.epmet.dto.AreaCodeDTO; | 
			
		
	
		
		
			
				
					
					|  |  | import com.epmet.dto.form.AddAreaCodeDictFormDTO; |  |  | import com.epmet.dto.form.*; | 
			
				
				
			
		
	
		
		
			
				
					|  |  | import com.epmet.dto.form.AddAreaCodeFormDTO; |  |  |  | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.dto.form.AreaCodeDictFormDTO; |  |  |  | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.dto.form.AreaCodeFormDTO; |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					|  |  | import com.epmet.dto.result.AreaCodeDictResultDTO; |  |  | import com.epmet.dto.result.AreaCodeDictResultDTO; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.dto.result.AreaCodeResultDTO; |  |  | import com.epmet.dto.result.AreaCodeResultDTO; | 
			
		
	
		
		
			
				
					|  |  |  |  |  | import com.epmet.dto.result.CustomerTreeDTO; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.entity.AreaCodeEntity; |  |  | import com.epmet.entity.AreaCodeEntity; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.redis.AreaCodeRedis; |  |  | import com.epmet.redis.AreaCodeRedis; | 
			
		
	
		
		
			
				
					|  |  | import com.epmet.service.AreaCodeChildService; |  |  | import com.epmet.service.AreaCodeChildService; | 
			
		
	
	
		
		
			
				
					|  | @ -72,6 +70,7 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn | 
			
		
	
		
		
			
				
					|  |  |     private AreaCodeChildDao childDao; |  |  |     private AreaCodeChildDao childDao; | 
			
		
	
		
		
			
				
					|  |  |     @Autowired |  |  |     @Autowired | 
			
		
	
		
		
			
				
					|  |  |     private AreaCodeChildService areaCodeChildService; |  |  |     private AreaCodeChildService areaCodeChildService; | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     @Override |  |  |     @Override | 
			
		
	
		
		
			
				
					|  |  |     public PageData<AreaCodeDTO> page(Map<String, Object> params) { |  |  |     public PageData<AreaCodeDTO> page(Map<String, Object> params) { | 
			
		
	
		
		
			
				
					|  |  |         IPage<AreaCodeEntity> page = baseDao.selectPage( |  |  |         IPage<AreaCodeEntity> page = baseDao.selectPage( | 
			
		
	
	
		
		
			
				
					|  | @ -88,8 +87,8 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn | 
			
		
	
		
		
			
				
					|  |  |         return ConvertUtils.sourceToTarget(entityList, AreaCodeDTO.class); |  |  |         return ConvertUtils.sourceToTarget(entityList, AreaCodeDTO.class); | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |     private QueryWrapper<AreaCodeEntity> getWrapper(Map<String, Object> params){ |  |  |     private QueryWrapper<AreaCodeEntity> getWrapper(Map<String, Object> params) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |         String id = (String)params.get(FieldConstant.ID_HUMP); |  |  |         String id = (String) params.get(FieldConstant.ID_HUMP); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |         QueryWrapper<AreaCodeEntity> wrapper = new QueryWrapper<>(); |  |  |         QueryWrapper<AreaCodeEntity> wrapper = new QueryWrapper<>(); | 
			
		
	
		
		
			
				
					|  |  |         wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |  |  |         wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); | 
			
		
	
	
		
		
			
				
					|  | @ -125,7 +124,7 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     /** |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |      * @Description  行政地区编码查询 |  |  |      * @Description 行政地区编码查询 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |      * @Param formDTO |  |  |      * @Param formDTO | 
			
		
	
		
		
			
				
					|  |  |      * @author zxc |  |  |      * @author zxc | 
			
		
	
		
		
			
				
					|  |  |      * @date 2021/1/7 下午1:41 |  |  |      * @date 2021/1/7 下午1:41 | 
			
		
	
	
		
		
			
				
					|  | @ -134,14 +133,14 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn | 
			
		
	
		
		
			
				
					|  |  |     public List<AreaCodeDictResultDTO> areaCodeDictTree(AreaCodeDictFormDTO formDTO) { |  |  |     public List<AreaCodeDictResultDTO> areaCodeDictTree(AreaCodeDictFormDTO formDTO) { | 
			
		
	
		
		
			
				
					|  |  |         List<AreaCodeDictResultDTO> tree = new ArrayList<>(); |  |  |         List<AreaCodeDictResultDTO> tree = new ArrayList<>(); | 
			
		
	
		
		
			
				
					|  |  |         String s = areaCodeRedis.get(AreaCodeConstant.SCREEN_TREE); |  |  |         String s = areaCodeRedis.get(AreaCodeConstant.SCREEN_TREE); | 
			
		
	
		
		
			
				
					
					|  |  |         if (StringUtils.isNotBlank(s)){ |  |  |         if (StringUtils.isNotBlank(s)) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             tree = JSON.parseArray(s,AreaCodeDictResultDTO.class); |  |  |             tree = JSON.parseArray(s, AreaCodeDictResultDTO.class); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |         }else { |  |  |         } else { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |             List<AreaCodeDictResultDTO> areaCodeDictResultDTOS = disposeTree(formDTO); |  |  |             List<AreaCodeDictResultDTO> areaCodeDictResultDTOS = disposeTree(formDTO); | 
			
		
	
		
		
			
				
					
					|  |  |             areaCodeRedis.set(AreaCodeConstant.SCREEN_TREE,areaCodeDictResultDTOS); |  |  |             areaCodeRedis.set(AreaCodeConstant.SCREEN_TREE, areaCodeDictResultDTOS); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |             tree = areaCodeDictResultDTOS; |  |  |             tree = areaCodeDictResultDTOS; | 
			
		
	
		
		
			
				
					|  |  |         } |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |         if (StringUtils.isBlank(formDTO.getRootAreaCode())){ |  |  |         if (StringUtils.isBlank(formDTO.getRootAreaCode())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |             return tree; |  |  |             return tree; | 
			
		
	
		
		
			
				
					|  |  |         } |  |  |         } | 
			
		
	
		
		
			
				
					|  |  |         List<AreaCodeDictResultDTO> treeByRootAreaCode = getTreeByRootAreaCode(tree, formDTO.getRootAreaCode()); |  |  |         List<AreaCodeDictResultDTO> treeByRootAreaCode = getTreeByRootAreaCode(tree, formDTO.getRootAreaCode()); | 
			
		
	
	
		
		
			
				
					|  | @ -149,12 +148,12 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     /** |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |      * @Description  行政区树查询 |  |  |      * @Description 行政区树查询 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |      * @Param |  |  |      * @Param | 
			
		
	
		
		
			
				
					|  |  |      * @author zxc |  |  |      * @author zxc | 
			
		
	
		
		
			
				
					|  |  |      * @date 2021/1/8 上午8:57 |  |  |      * @date 2021/1/8 上午8:57 | 
			
		
	
		
		
			
				
					|  |  |      */ |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |     public List<AreaCodeDictResultDTO> disposeTree(AreaCodeDictFormDTO formDTO){ |  |  |     public List<AreaCodeDictResultDTO> disposeTree(AreaCodeDictFormDTO formDTO) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |         // 查询所有省市区
 |  |  |         // 查询所有省市区
 | 
			
		
	
		
		
			
				
					|  |  |         List<AreaCodeDTO> areaCodeDTOS = baseDao.selectAllArea(); |  |  |         List<AreaCodeDTO> areaCodeDTOS = baseDao.selectAllArea(); | 
			
		
	
		
		
			
				
					|  |  |         // 查询所有街道、社区
 |  |  |         // 查询所有街道、社区
 | 
			
		
	
	
		
		
			
				
					|  | @ -173,8 +172,8 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn | 
			
		
	
		
		
			
				
					|  |  |             dto.setCode(four.getCode()); |  |  |             dto.setCode(four.getCode()); | 
			
		
	
		
		
			
				
					|  |  |             dto.setName(four.getName()); |  |  |             dto.setName(four.getName()); | 
			
		
	
		
		
			
				
					|  |  |             dto.setParentCode(four.getPCode()); |  |  |             dto.setParentCode(four.getPCode()); | 
			
		
	
		
		
			
				
					
					|  |  |             groupByPCode.forEach((pCode,v) -> { |  |  |             groupByPCode.forEach((pCode, v) -> { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                 if (dto.getCode().equals(pCode)){ |  |  |                 if (dto.getCode().equals(pCode)) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |                     List<AreaCodeDictResultDTO> fiveResult = new ArrayList<>(); |  |  |                     List<AreaCodeDictResultDTO> fiveResult = new ArrayList<>(); | 
			
		
	
		
		
			
				
					|  |  |                     v.forEach(five -> { |  |  |                     v.forEach(five -> { | 
			
		
	
		
		
			
				
					|  |  |                         AreaCodeDictResultDTO fiveDto = new AreaCodeDictResultDTO(); |  |  |                         AreaCodeDictResultDTO fiveDto = new AreaCodeDictResultDTO(); | 
			
		
	
	
		
		
			
				
					|  | @ -189,7 +188,7 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn | 
			
		
	
		
		
			
				
					|  |  |             fourResult.add(dto); |  |  |             fourResult.add(dto); | 
			
		
	
		
		
			
				
					|  |  |         }); |  |  |         }); | 
			
		
	
		
		
			
				
					|  |  |         List<AreaCodeDictResultDTO> fourSort = new ArrayList<>(); |  |  |         List<AreaCodeDictResultDTO> fourSort = new ArrayList<>(); | 
			
		
	
		
		
			
				
					
					|  |  |         if (!CollectionUtils.isEmpty(fourResult)){ |  |  |         if (!CollectionUtils.isEmpty(fourResult)) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |             fourSort = fourResult.stream().sorted(Comparator.comparing(AreaCodeDictResultDTO::getCode)).collect(Collectors.toList()); |  |  |             fourSort = fourResult.stream().sorted(Comparator.comparing(AreaCodeDictResultDTO::getCode)).collect(Collectors.toList()); | 
			
		
	
		
		
			
				
					|  |  |         } |  |  |         } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  | @ -209,7 +208,7 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn | 
			
		
	
		
		
			
				
					|  |  |                 dto.setName(three.getCountyName()); |  |  |                 dto.setName(three.getCountyName()); | 
			
		
	
		
		
			
				
					|  |  |                 List<AreaCodeDictResultDTO> fourOnceResult = new ArrayList<>(); |  |  |                 List<AreaCodeDictResultDTO> fourOnceResult = new ArrayList<>(); | 
			
		
	
		
		
			
				
					|  |  |                 finalFourSort.forEach(four -> { |  |  |                 finalFourSort.forEach(four -> { | 
			
		
	
		
		
			
				
					
					|  |  |                     if (dto.getCode().equals(four.getParentCode())){ |  |  |                     if (dto.getCode().equals(four.getParentCode())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                         fourOnceResult.add(four); |  |  |                         fourOnceResult.add(four); | 
			
		
	
		
		
			
				
					|  |  |                     } |  |  |                     } | 
			
		
	
		
		
			
				
					|  |  |                 }); |  |  |                 }); | 
			
		
	
	
		
		
			
				
					|  | @ -220,13 +219,13 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn | 
			
		
	
		
		
			
				
					|  |  |             cityDto.setChildren(threeSort); |  |  |             cityDto.setChildren(threeSort); | 
			
		
	
		
		
			
				
					|  |  |             cityResult.add(cityDto); |  |  |             cityResult.add(cityDto); | 
			
		
	
		
		
			
				
					|  |  |         }); |  |  |         }); | 
			
		
	
		
		
			
				
					
					|  |  |         groupByProvince.forEach((p,v) -> { |  |  |         groupByProvince.forEach((p, v) -> { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |             AreaCodeDictResultDTO dto = new AreaCodeDictResultDTO(); |  |  |             AreaCodeDictResultDTO dto = new AreaCodeDictResultDTO(); | 
			
		
	
		
		
			
				
					|  |  |             dto.setCode(p); |  |  |             dto.setCode(p); | 
			
		
	
		
		
			
				
					|  |  |             dto.setName(v.get(NumConstant.ZERO).getProvinceName()); |  |  |             dto.setName(v.get(NumConstant.ZERO).getProvinceName()); | 
			
		
	
		
		
			
				
					|  |  |             List<AreaCodeDictResultDTO> cityOnceResult = new ArrayList<>(); |  |  |             List<AreaCodeDictResultDTO> cityOnceResult = new ArrayList<>(); | 
			
		
	
		
		
			
				
					|  |  |             cityResult.forEach(c -> { |  |  |             cityResult.forEach(c -> { | 
			
		
	
		
		
			
				
					
					|  |  |                 if (dto.getCode().equals(c.getParentCode())){ |  |  |                 if (dto.getCode().equals(c.getParentCode())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                     cityOnceResult.add(c); |  |  |                     cityOnceResult.add(c); | 
			
		
	
		
		
			
				
					|  |  |                 } |  |  |                 } | 
			
		
	
		
		
			
				
					|  |  |             }); |  |  |             }); | 
			
		
	
	
		
		
			
				
					|  | @ -239,54 +238,51 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     /** |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |      * @Description  根据节点获取组织区域树【遍历】,传参只能是 省,市,区级别 【暂时这样,循环太多了】 |  |  |      * @Description 根据节点获取组织区域树【遍历】,传参只能是 省,市,区级别 【暂时这样,循环太多了】 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |      * |  |  |      * <p> | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |      * |  |  |      * <p> | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |      * 暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样 |  |  |      * 暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样 | 
			
		
	
		
		
			
				
					
					|  |  |      *   ==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样== |  |  |      * ==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样== | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |      *     暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样 |  |  |      * 暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样==暂时这样 | 
			
				
				
			
		
	
		
		
			
				
					|  |  |      * |  |  |  | 
			
		
	
		
		
			
				
					|  |  |      * |  |  |  | 
			
		
	
		
		
			
				
					|  |  |      * |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |      * @Param tree |  |  |      * @Param tree | 
			
		
	
		
		
			
				
					|  |  |      * @Param rootAreaCode |  |  |      * @Param rootAreaCode | 
			
		
	
		
		
			
				
					|  |  |      * @author zxc |  |  |      * @author zxc | 
			
		
	
		
		
			
				
					|  |  |      * @date 2021/1/8 上午10:02 |  |  |      * @date 2021/1/8 上午10:02 | 
			
		
	
		
		
			
				
					|  |  |      */ |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |     public List<AreaCodeDictResultDTO> getTreeByRootAreaCode(List<AreaCodeDictResultDTO> tree , String rootAreaCode){ |  |  |     public List<AreaCodeDictResultDTO> getTreeByRootAreaCode(List<AreaCodeDictResultDTO> tree, String rootAreaCode) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |         List<AreaCodeDictResultDTO> result = new ArrayList<>(); |  |  |         List<AreaCodeDictResultDTO> result = new ArrayList<>(); | 
			
		
	
		
		
			
				
					
					|  |  |         if (!CollectionUtils.isEmpty(tree)){ |  |  |         if (!CollectionUtils.isEmpty(tree)) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |             // 省级获取
 |  |  |             // 省级获取
 | 
			
		
	
		
		
			
				
					|  |  |             for (AreaCodeDictResultDTO dto : tree) { |  |  |             for (AreaCodeDictResultDTO dto : tree) { | 
			
		
	
		
		
			
				
					
					|  |  |                 if (rootAreaCode.equals(dto.getCode())){ |  |  |                 if (rootAreaCode.equals(dto.getCode())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                     result.add(dto); |  |  |                     result.add(dto); | 
			
		
	
		
		
			
				
					|  |  |                     return result; |  |  |                     return result; | 
			
		
	
		
		
			
				
					|  |  |                 } |  |  |                 } | 
			
		
	
		
		
			
				
					|  |  |                 // 市级获取
 |  |  |                 // 市级获取
 | 
			
		
	
		
		
			
				
					
					|  |  |                 if (!CollectionUtils.isEmpty(dto.getChildren())){ |  |  |                 if (!CollectionUtils.isEmpty(dto.getChildren())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                     for (AreaCodeDictResultDTO child : dto.getChildren()) { |  |  |                     for (AreaCodeDictResultDTO child : dto.getChildren()) { | 
			
		
	
		
		
			
				
					
					|  |  |                         if (rootAreaCode.equals(child.getCode())){ |  |  |                         if (rootAreaCode.equals(child.getCode())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                             result.add(child); |  |  |                             result.add(child); | 
			
		
	
		
		
			
				
					|  |  |                             return result; |  |  |                             return result; | 
			
		
	
		
		
			
				
					|  |  |                         } |  |  |                         } | 
			
		
	
		
		
			
				
					|  |  |                         // 区级获取
 |  |  |                         // 区级获取
 | 
			
		
	
		
		
			
				
					
					|  |  |                         if (!CollectionUtils.isEmpty(child.getChildren())){ |  |  |                         if (!CollectionUtils.isEmpty(child.getChildren())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                             for (AreaCodeDictResultDTO threeChild : child.getChildren()) { |  |  |                             for (AreaCodeDictResultDTO threeChild : child.getChildren()) { | 
			
		
	
		
		
			
				
					
					|  |  |                                 if (rootAreaCode.equals(threeChild.getCode())){ |  |  |                                 if (rootAreaCode.equals(threeChild.getCode())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                                     result.add(threeChild); |  |  |                                     result.add(threeChild); | 
			
		
	
		
		
			
				
					|  |  |                                     return result; |  |  |                                     return result; | 
			
		
	
		
		
			
				
					|  |  |                                 } |  |  |                                 } | 
			
		
	
		
		
			
				
					|  |  |                                 // 街道获取
 |  |  |                                 // 街道获取
 | 
			
		
	
		
		
			
				
					
					|  |  |                                 if (!CollectionUtils.isEmpty(threeChild.getChildren())){ |  |  |                                 if (!CollectionUtils.isEmpty(threeChild.getChildren())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                                     for (AreaCodeDictResultDTO fourChild : threeChild.getChildren()) { |  |  |                                     for (AreaCodeDictResultDTO fourChild : threeChild.getChildren()) { | 
			
		
	
		
		
			
				
					
					|  |  |                                         if (rootAreaCode.equals(fourChild.getCode())){ |  |  |                                         if (rootAreaCode.equals(fourChild.getCode())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                                             result.add(fourChild); |  |  |                                             result.add(fourChild); | 
			
		
	
		
		
			
				
					|  |  |                                             return result; |  |  |                                             return result; | 
			
		
	
		
		
			
				
					|  |  |                                         } |  |  |                                         } | 
			
		
	
		
		
			
				
					|  |  |                                         // 社区获取
 |  |  |                                         // 社区获取
 | 
			
		
	
		
		
			
				
					
					|  |  |                                         if (!CollectionUtils.isEmpty(fourChild.getChildren())){ |  |  |                                         if (!CollectionUtils.isEmpty(fourChild.getChildren())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                                             for (AreaCodeDictResultDTO fiveChild : fourChild.getChildren()) { |  |  |                                             for (AreaCodeDictResultDTO fiveChild : fourChild.getChildren()) { | 
			
		
	
		
		
			
				
					
					|  |  |                                                 if (rootAreaCode.equals(fiveChild.getCode())){ |  |  |                                                 if (rootAreaCode.equals(fiveChild.getCode())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                                                     result.add(fiveChild); |  |  |                                                     result.add(fiveChild); | 
			
		
	
		
		
			
				
					|  |  |                                                     return result; |  |  |                                                     return result; | 
			
		
	
		
		
			
				
					|  |  |                                                 } |  |  |                                                 } | 
			
		
	
	
		
		
			
				
					|  | @ -304,40 +300,40 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     @Override |  |  |     @Override | 
			
		
	
		
		
			
				
					
					|  |  |     public List<AreaCodeDictResultDTO> areaCodeDictTreePlus(AreaCodeDictFormDTO formDTO){ |  |  |     public List<AreaCodeDictResultDTO> areaCodeDictTreePlus(AreaCodeDictFormDTO formDTO) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |         List<AreaCodeDictResultDTO> tree = new ArrayList<>(); |  |  |         List<AreaCodeDictResultDTO> tree = new ArrayList<>(); | 
			
		
	
		
		
			
				
					|  |  |         String s = areaCodeRedis.get(AreaCodeConstant.THREE_SCREEN_TREE); |  |  |         String s = areaCodeRedis.get(AreaCodeConstant.THREE_SCREEN_TREE); | 
			
		
	
		
		
			
				
					
					|  |  |         if (StringUtils.isNotBlank(s)){ |  |  |         if (StringUtils.isNotBlank(s)) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             tree = JSON.parseArray(s,AreaCodeDictResultDTO.class); |  |  |             tree = JSON.parseArray(s, AreaCodeDictResultDTO.class); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |         }else { |  |  |         } else { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |             List<AreaCodeDictResultDTO> threeTree = beforeThreeTree(); |  |  |             List<AreaCodeDictResultDTO> threeTree = beforeThreeTree(); | 
			
		
	
		
		
			
				
					
					|  |  |             areaCodeRedis.set(AreaCodeConstant.THREE_SCREEN_TREE,threeTree); |  |  |             areaCodeRedis.set(AreaCodeConstant.THREE_SCREEN_TREE, threeTree); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |             tree = threeTree; |  |  |             tree = threeTree; | 
			
		
	
		
		
			
				
					|  |  |         } |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |         if (StringUtils.isBlank(formDTO.getRootAreaCode())){ |  |  |         if (StringUtils.isBlank(formDTO.getRootAreaCode())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |             return tree; |  |  |             return tree; | 
			
		
	
		
		
			
				
					|  |  |         } |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |         if (StringUtils.isBlank(formDTO.getRootAreaLevel())){ |  |  |         if (StringUtils.isBlank(formDTO.getRootAreaLevel())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |             throw new RenException(AreaCodeConstant.ROOT_AGENCY_LEVEL_IS_LEVEL); |  |  |             throw new RenException(AreaCodeConstant.ROOT_AGENCY_LEVEL_IS_LEVEL); | 
			
		
	
		
		
			
				
					|  |  |         } |  |  |         } | 
			
		
	
		
		
			
				
					|  |  |         // 传参为街道-社区级
 |  |  |         // 传参为街道-社区级
 | 
			
		
	
		
		
			
				
					
					|  |  |         if (formDTO.getRootAreaLevel().equals(AreaCodeConstant.STREET) || formDTO.getRootAreaLevel().equals(AreaCodeConstant.COMMUNITY)){ |  |  |         if (formDTO.getRootAreaLevel().equals(AreaCodeConstant.STREET) || formDTO.getRootAreaLevel().equals(AreaCodeConstant.COMMUNITY)) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |             tree = disposeAfterTwoLevel(formDTO); |  |  |             tree = disposeAfterTwoLevel(formDTO); | 
			
		
	
		
		
			
				
					
					|  |  |         }else if (formDTO.getRootAreaLevel().equals(AreaCodeConstant.PROVINCE) || formDTO.getRootAreaLevel().equals(AreaCodeConstant.CITY) || formDTO.getRootAreaLevel().equals(AreaCodeConstant.DISTRICT)){ |  |  |         } else if (formDTO.getRootAreaLevel().equals(AreaCodeConstant.PROVINCE) || formDTO.getRootAreaLevel().equals(AreaCodeConstant.CITY) || formDTO.getRootAreaLevel().equals(AreaCodeConstant.DISTRICT)) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             tree = disposeBeforeThreeLevelFinal(formDTO,tree); |  |  |             tree = disposeBeforeThreeLevelFinal(formDTO, tree); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |         }else { |  |  |         } else { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             throw new RenException(String.format(AreaCodeConstant.LEVEL_ERROR,formDTO.getRootAreaLevel())); |  |  |             throw new RenException(String.format(AreaCodeConstant.LEVEL_ERROR, formDTO.getRootAreaLevel())); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |         } |  |  |         } | 
			
		
	
		
		
			
				
					|  |  |         return tree; |  |  |         return tree; | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     /** |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |      * @Description  省市区三级联动查询 |  |  |      * @Description 省市区三级联动查询 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |      * @Param |  |  |      * @Param | 
			
		
	
		
		
			
				
					|  |  |      * @author zxc |  |  |      * @author zxc | 
			
		
	
		
		
			
				
					|  |  |      * @date 2021/1/11 上午9:35 |  |  |      * @date 2021/1/11 上午9:35 | 
			
		
	
		
		
			
				
					|  |  |      */ |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |     public List<AreaCodeDictResultDTO> beforeThreeTree(){ |  |  |     public List<AreaCodeDictResultDTO> beforeThreeTree() { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |         // 查询所有省市区
 |  |  |         // 查询所有省市区
 | 
			
		
	
		
		
			
				
					|  |  |         List<AreaCodeDTO> areaCodeDTOS = baseDao.selectAllArea(); |  |  |         List<AreaCodeDTO> areaCodeDTOS = baseDao.selectAllArea(); | 
			
		
	
		
		
			
				
					|  |  |         Map<String, List<AreaCodeDTO>> groupByCity = areaCodeDTOS.stream().collect(Collectors.groupingBy(AreaCodeDTO::getCityCode)); |  |  |         Map<String, List<AreaCodeDTO>> groupByCity = areaCodeDTOS.stream().collect(Collectors.groupingBy(AreaCodeDTO::getCityCode)); | 
			
		
	
	
		
		
			
				
					|  | @ -362,13 +358,13 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn | 
			
		
	
		
		
			
				
					|  |  |             cityDto.setChildren(threeSort); |  |  |             cityDto.setChildren(threeSort); | 
			
		
	
		
		
			
				
					|  |  |             cityResult.add(cityDto); |  |  |             cityResult.add(cityDto); | 
			
		
	
		
		
			
				
					|  |  |         }); |  |  |         }); | 
			
		
	
		
		
			
				
					
					|  |  |         groupByProvince.forEach((p,v) -> { |  |  |         groupByProvince.forEach((p, v) -> { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |             AreaCodeDictResultDTO dto = new AreaCodeDictResultDTO(); |  |  |             AreaCodeDictResultDTO dto = new AreaCodeDictResultDTO(); | 
			
		
	
		
		
			
				
					|  |  |             dto.setCode(p); |  |  |             dto.setCode(p); | 
			
		
	
		
		
			
				
					|  |  |             dto.setName(v.get(NumConstant.ZERO).getProvinceName()); |  |  |             dto.setName(v.get(NumConstant.ZERO).getProvinceName()); | 
			
		
	
		
		
			
				
					|  |  |             List<AreaCodeDictResultDTO> cityOnceResult = new ArrayList<>(); |  |  |             List<AreaCodeDictResultDTO> cityOnceResult = new ArrayList<>(); | 
			
		
	
		
		
			
				
					|  |  |             cityResult.forEach(c -> { |  |  |             cityResult.forEach(c -> { | 
			
		
	
		
		
			
				
					
					|  |  |                 if (dto.getCode().equals(c.getParentCode())){ |  |  |                 if (dto.getCode().equals(c.getParentCode())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                     cityOnceResult.add(c); |  |  |                     cityOnceResult.add(c); | 
			
		
	
		
		
			
				
					|  |  |                 } |  |  |                 } | 
			
		
	
		
		
			
				
					|  |  |             }); |  |  |             }); | 
			
		
	
	
		
		
			
				
					|  | @ -383,12 +379,12 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     /** |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |      * @Description  街道-社区组织树查询 |  |  |      * @Description 街道-社区组织树查询 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |      * @Param |  |  |      * @Param | 
			
		
	
		
		
			
				
					|  |  |      * @author zxc |  |  |      * @author zxc | 
			
		
	
		
		
			
				
					|  |  |      * @date 2021/1/11 上午9:48 |  |  |      * @date 2021/1/11 上午9:48 | 
			
		
	
		
		
			
				
					|  |  |      */ |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |     public List<AreaCodeDictResultDTO> afterTwoTree(AreaCodeDictFormDTO form){ |  |  |     public List<AreaCodeDictResultDTO> afterTwoTree(AreaCodeDictFormDTO form) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |         // 查询所有街道、社区
 |  |  |         // 查询所有街道、社区
 | 
			
		
	
		
		
			
				
					|  |  |         List<AreaCodeChildDTO> areaCodeChildDTOS = childDao.selectAllChild(form.getRootAreaCode()); |  |  |         List<AreaCodeChildDTO> areaCodeChildDTOS = childDao.selectAllChild(form.getRootAreaCode()); | 
			
		
	
		
		
			
				
					|  |  |         List<AreaCodeDictResultDTO> fourResult = new ArrayList<>(); |  |  |         List<AreaCodeDictResultDTO> fourResult = new ArrayList<>(); | 
			
		
	
	
		
		
			
				
					|  | @ -399,7 +395,7 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn | 
			
		
	
		
		
			
				
					|  |  |         List<AreaCodeChildDTO> levelFive = org.apache.commons.collections4.CollectionUtils.isNotEmpty(groupByLevel.get(NumConstant.FIVE)) ? groupByLevel.get(NumConstant.FIVE) : new ArrayList<>(); |  |  |         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)); |  |  |         Map<String, List<AreaCodeChildDTO>> groupByPCode = CollectionUtils.isEmpty(levelFive) ? new HashMap<>() : levelFive.stream().collect(Collectors.groupingBy(AreaCodeChildDTO::getPCode)); | 
			
		
	
		
		
			
				
					|  |  |         //街道
 |  |  |         //街道
 | 
			
		
	
		
		
			
				
					
					|  |  |         List<AreaCodeChildDTO> levelFour = org.apache.commons.collections4.CollectionUtils.isNotEmpty(groupByLevel.get(NumConstant.FOUR)) ?groupByLevel.get(NumConstant.FOUR):new ArrayList<>(); |  |  |         List<AreaCodeChildDTO> levelFour = org.apache.commons.collections4.CollectionUtils.isNotEmpty(groupByLevel.get(NumConstant.FOUR)) ? groupByLevel.get(NumConstant.FOUR) : new ArrayList<>(); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |         // 6级
 |  |  |         // 6级
 | 
			
		
	
		
		
			
				
					|  |  |         List<AreaCodeChildDTO> levelSix = groupByLevel.get(NumConstant.SIX); |  |  |         List<AreaCodeChildDTO> levelSix = groupByLevel.get(NumConstant.SIX); | 
			
		
	
		
		
			
				
					|  |  |         Map<String, List<AreaCodeChildDTO>> groupBySixPCode = CollectionUtils.isEmpty(levelSix) ? new HashMap<>() : levelSix.stream().collect(Collectors.groupingBy(AreaCodeChildDTO::getPCode)); |  |  |         Map<String, List<AreaCodeChildDTO>> groupBySixPCode = CollectionUtils.isEmpty(levelSix) ? new HashMap<>() : levelSix.stream().collect(Collectors.groupingBy(AreaCodeChildDTO::getPCode)); | 
			
		
	
	
		
		
			
				
					|  | @ -409,8 +405,8 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn | 
			
		
	
		
		
			
				
					|  |  |             dto.setCode(f.getCode()); |  |  |             dto.setCode(f.getCode()); | 
			
		
	
		
		
			
				
					|  |  |             dto.setName(f.getName()); |  |  |             dto.setName(f.getName()); | 
			
		
	
		
		
			
				
					|  |  |             dto.setParentCode(f.getPCode()); |  |  |             dto.setParentCode(f.getPCode()); | 
			
		
	
		
		
			
				
					
					|  |  |             groupBySixPCode.forEach((k,v) -> { |  |  |             groupBySixPCode.forEach((k, v) -> { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                 if (dto.getCode().equals(k)){ |  |  |                 if (dto.getCode().equals(k)) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |                     List<AreaCodeDictResultDTO> six = new ArrayList<>(); |  |  |                     List<AreaCodeDictResultDTO> six = new ArrayList<>(); | 
			
		
	
		
		
			
				
					|  |  |                     v.forEach(s -> { |  |  |                     v.forEach(s -> { | 
			
		
	
		
		
			
				
					|  |  |                         AreaCodeDictResultDTO sixDto = new AreaCodeDictResultDTO(); |  |  |                         AreaCodeDictResultDTO sixDto = new AreaCodeDictResultDTO(); | 
			
		
	
	
		
		
			
				
					|  | @ -431,8 +427,8 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn | 
			
		
	
		
		
			
				
					|  |  |             dto.setCode(four.getCode()); |  |  |             dto.setCode(four.getCode()); | 
			
		
	
		
		
			
				
					|  |  |             dto.setName(four.getName()); |  |  |             dto.setName(four.getName()); | 
			
		
	
		
		
			
				
					|  |  |             dto.setParentCode(four.getPCode()); |  |  |             dto.setParentCode(four.getPCode()); | 
			
		
	
		
		
			
				
					
					|  |  |             groupByFivePCode.forEach((pCode,v) -> { |  |  |             groupByFivePCode.forEach((pCode, v) -> { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                 if (dto.getCode().equals(pCode)){ |  |  |                 if (dto.getCode().equals(pCode)) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |                     dto.setChildren(v); |  |  |                     dto.setChildren(v); | 
			
		
	
		
		
			
				
					|  |  |                 } |  |  |                 } | 
			
		
	
		
		
			
				
					|  |  |             }); |  |  |             }); | 
			
		
	
	
		
		
			
				
					|  | @ -443,28 +439,28 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     /** |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |      * @Description  街道-社区组织树处理 |  |  |      * @Description 街道-社区组织树处理 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |      * @Param form |  |  |      * @Param form | 
			
		
	
		
		
			
				
					|  |  |      * @author zxc |  |  |      * @author zxc | 
			
		
	
		
		
			
				
					|  |  |      * @date 2021/1/11 上午9:58 |  |  |      * @date 2021/1/11 上午9:58 | 
			
		
	
		
		
			
				
					|  |  |      */ |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |     public List<AreaCodeDictResultDTO> disposeAfterTwoLevel(AreaCodeDictFormDTO form){ |  |  |     public List<AreaCodeDictResultDTO> disposeAfterTwoLevel(AreaCodeDictFormDTO form) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |         List<AreaCodeDictResultDTO> result = new ArrayList<>(); |  |  |         List<AreaCodeDictResultDTO> result = new ArrayList<>(); | 
			
		
	
		
		
			
				
					|  |  |         List<AreaCodeDictResultDTO> areaCodeDictResultDTOS = afterTwoTree(form); |  |  |         List<AreaCodeDictResultDTO> areaCodeDictResultDTOS = afterTwoTree(form); | 
			
		
	
		
		
			
				
					
					|  |  |         if (CollectionUtils.isEmpty(areaCodeDictResultDTOS)){ |  |  |         if (CollectionUtils.isEmpty(areaCodeDictResultDTOS)) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |             return new ArrayList<>(); |  |  |             return new ArrayList<>(); | 
			
		
	
		
		
			
				
					|  |  |         } |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |         if (form.getRootAreaLevel().equals(AreaCodeConstant.STREET)){ |  |  |         if (form.getRootAreaLevel().equals(AreaCodeConstant.STREET)) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |             for (AreaCodeDictResultDTO dto : areaCodeDictResultDTOS) { |  |  |             for (AreaCodeDictResultDTO dto : areaCodeDictResultDTOS) { | 
			
		
	
		
		
			
				
					
					|  |  |                 if (dto.getCode().equals(form.getRootAreaCode())){ |  |  |                 if (dto.getCode().equals(form.getRootAreaCode())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                     result.add(dto); |  |  |                     result.add(dto); | 
			
		
	
		
		
			
				
					|  |  |                 } |  |  |                 } | 
			
		
	
		
		
			
				
					|  |  |             } |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |         }else { |  |  |         } else { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |             for (AreaCodeDictResultDTO dto : areaCodeDictResultDTOS) { |  |  |             for (AreaCodeDictResultDTO dto : areaCodeDictResultDTOS) { | 
			
		
	
		
		
			
				
					
					|  |  |                 if (!CollectionUtils.isEmpty(dto.getChildren())){ |  |  |                 if (!CollectionUtils.isEmpty(dto.getChildren())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                     for (AreaCodeDictResultDTO child : dto.getChildren()) { |  |  |                     for (AreaCodeDictResultDTO child : dto.getChildren()) { | 
			
		
	
		
		
			
				
					
					|  |  |                         if (child.getCode().equals(form.getRootAreaCode())){ |  |  |                         if (child.getCode().equals(form.getRootAreaCode())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                             result.add(child); |  |  |                             result.add(child); | 
			
		
	
		
		
			
				
					|  |  |                         } |  |  |                         } | 
			
		
	
		
		
			
				
					|  |  |                     } |  |  |                     } | 
			
		
	
	
		
		
			
				
					|  | @ -475,42 +471,42 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     /** |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |      * @Description  省市区获取 |  |  |      * @Description 省市区获取 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |      * @Param form |  |  |      * @Param form | 
			
		
	
		
		
			
				
					|  |  |      * @Param tree |  |  |      * @Param tree | 
			
		
	
		
		
			
				
					|  |  |      * @author zxc |  |  |      * @author zxc | 
			
		
	
		
		
			
				
					|  |  |      * @date 2021/1/12 上午9:22 |  |  |      * @date 2021/1/12 上午9:22 | 
			
		
	
		
		
			
				
					|  |  |      */ |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |     public List<AreaCodeDictResultDTO> disposeBeforeThreeLevel(AreaCodeDictFormDTO form,List<AreaCodeDictResultDTO> tree){ |  |  |     public List<AreaCodeDictResultDTO> disposeBeforeThreeLevel(AreaCodeDictFormDTO form, List<AreaCodeDictResultDTO> tree) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |         List<AreaCodeDictResultDTO> result = new ArrayList<>(); |  |  |         List<AreaCodeDictResultDTO> result = new ArrayList<>(); | 
			
		
	
		
		
			
				
					
					|  |  |         if (CollectionUtils.isEmpty(tree)){ |  |  |         if (CollectionUtils.isEmpty(tree)) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |             return new ArrayList<>(); |  |  |             return new ArrayList<>(); | 
			
		
	
		
		
			
				
					|  |  |         } |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |         if (form.getRootAreaLevel().equals(AreaCodeConstant.PROVINCE)){ |  |  |         if (form.getRootAreaLevel().equals(AreaCodeConstant.PROVINCE)) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |             for (AreaCodeDictResultDTO dto : tree) { |  |  |             for (AreaCodeDictResultDTO dto : tree) { | 
			
		
	
		
		
			
				
					
					|  |  |                 if (dto.getCode().equals(form.getRootAreaCode())){ |  |  |                 if (dto.getCode().equals(form.getRootAreaCode())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                     result.add(dto); |  |  |                     result.add(dto); | 
			
		
	
		
		
			
				
					|  |  |                     return result; |  |  |                     return result; | 
			
		
	
		
		
			
				
					|  |  |                 } |  |  |                 } | 
			
		
	
		
		
			
				
					|  |  |             } |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |         }else if (form.getRootAreaLevel().equals(AreaCodeConstant.CITY)){ |  |  |         } else if (form.getRootAreaLevel().equals(AreaCodeConstant.CITY)) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |             for (AreaCodeDictResultDTO dto : tree) { |  |  |             for (AreaCodeDictResultDTO dto : tree) { | 
			
		
	
		
		
			
				
					
					|  |  |                 if (!CollectionUtils.isEmpty(dto.getChildren())){ |  |  |                 if (!CollectionUtils.isEmpty(dto.getChildren())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                     for (AreaCodeDictResultDTO city : dto.getChildren()) { |  |  |                     for (AreaCodeDictResultDTO city : dto.getChildren()) { | 
			
		
	
		
		
			
				
					
					|  |  |                         if (city.getCode().equals(form.getRootAreaCode())){ |  |  |                         if (city.getCode().equals(form.getRootAreaCode())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                             result.add(city); |  |  |                             result.add(city); | 
			
		
	
		
		
			
				
					|  |  |                             return result; |  |  |                             return result; | 
			
		
	
		
		
			
				
					|  |  |                         } |  |  |                         } | 
			
		
	
		
		
			
				
					|  |  |                     } |  |  |                     } | 
			
		
	
		
		
			
				
					|  |  |                 } |  |  |                 } | 
			
		
	
		
		
			
				
					|  |  |             } |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |         }else if (form.getRootAreaLevel().equals(AreaCodeConstant.DISTRICT)){ |  |  |         } else if (form.getRootAreaLevel().equals(AreaCodeConstant.DISTRICT)) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |             for (AreaCodeDictResultDTO dto : tree) { |  |  |             for (AreaCodeDictResultDTO dto : tree) { | 
			
		
	
		
		
			
				
					
					|  |  |                 if (!CollectionUtils.isEmpty(dto.getChildren())){ |  |  |                 if (!CollectionUtils.isEmpty(dto.getChildren())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                     for (AreaCodeDictResultDTO city : dto.getChildren()) { |  |  |                     for (AreaCodeDictResultDTO city : dto.getChildren()) { | 
			
		
	
		
		
			
				
					
					|  |  |                         if (!CollectionUtils.isEmpty(city.getChildren())){ |  |  |                         if (!CollectionUtils.isEmpty(city.getChildren())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                             for (AreaCodeDictResultDTO child : city.getChildren()) { |  |  |                             for (AreaCodeDictResultDTO child : city.getChildren()) { | 
			
		
	
		
		
			
				
					
					|  |  |                                 if (child.getCode().equals(form.getRootAreaCode())){ |  |  |                                 if (child.getCode().equals(form.getRootAreaCode())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                                     result.add(child); |  |  |                                     result.add(child); | 
			
		
	
		
		
			
				
					|  |  |                                     return result; |  |  |                                     return result; | 
			
		
	
		
		
			
				
					|  |  |                                 } |  |  |                                 } | 
			
		
	
	
		
		
			
				
					|  | @ -524,29 +520,29 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     /** |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |      * @Description  拼接 街道-社区 |  |  |      * @Description 拼接 街道-社区 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |      * @Param form |  |  |      * @Param form | 
			
		
	
		
		
			
				
					|  |  |      * @Param tree |  |  |      * @Param tree | 
			
		
	
		
		
			
				
					|  |  |      * @author zxc |  |  |      * @author zxc | 
			
		
	
		
		
			
				
					|  |  |      * @date 2021/1/12 上午9:21 |  |  |      * @date 2021/1/12 上午9:21 | 
			
		
	
		
		
			
				
					|  |  |      */ |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |     public List<AreaCodeDictResultDTO> disposeBeforeThreeLevelFinal(AreaCodeDictFormDTO form,List<AreaCodeDictResultDTO> tree){ |  |  |     public List<AreaCodeDictResultDTO> disposeBeforeThreeLevelFinal(AreaCodeDictFormDTO form, List<AreaCodeDictResultDTO> tree) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |         List<AreaCodeDictResultDTO> threeDto = disposeBeforeThreeLevel(form, tree); |  |  |         List<AreaCodeDictResultDTO> threeDto = disposeBeforeThreeLevel(form, tree); | 
			
		
	
		
		
			
				
					|  |  |         List<AreaCodeDictResultDTO> twoDto = afterTwoTree(form); |  |  |         List<AreaCodeDictResultDTO> twoDto = afterTwoTree(form); | 
			
		
	
		
		
			
				
					
					|  |  |         if (CollectionUtils.isEmpty(threeDto)){ |  |  |         if (CollectionUtils.isEmpty(threeDto)) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |             return new ArrayList<>(); |  |  |             return new ArrayList<>(); | 
			
		
	
		
		
			
				
					|  |  |         } |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |         if (!CollectionUtils.isEmpty(twoDto)){ |  |  |         if (!CollectionUtils.isEmpty(twoDto)) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             if (form.getRootAreaLevel().equals(AreaCodeConstant.PROVINCE)){ |  |  |             if (form.getRootAreaLevel().equals(AreaCodeConstant.PROVINCE)) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |                 for (AreaCodeDictResultDTO dto : tree) { |  |  |                 for (AreaCodeDictResultDTO dto : tree) { | 
			
		
	
		
		
			
				
					
					|  |  |                     if (dto.getCode().equals(form.getRootAreaCode())){ |  |  |                     if (dto.getCode().equals(form.getRootAreaCode())) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                         if (!CollectionUtils.isEmpty(dto.getChildren())){ |  |  |                         if (!CollectionUtils.isEmpty(dto.getChildren())) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |                             for (AreaCodeDictResultDTO city : dto.getChildren()) { |  |  |                             for (AreaCodeDictResultDTO city : dto.getChildren()) { | 
			
		
	
		
		
			
				
					
					|  |  |                                 if (!CollectionUtils.isEmpty(city.getChildren())){ |  |  |                                 if (!CollectionUtils.isEmpty(city.getChildren())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                                     for (AreaCodeDictResultDTO child : city.getChildren()) { |  |  |                                     for (AreaCodeDictResultDTO child : city.getChildren()) { | 
			
		
	
		
		
			
				
					|  |  |                                         List<AreaCodeDictResultDTO> areaList = new ArrayList<>(); |  |  |                                         List<AreaCodeDictResultDTO> areaList = new ArrayList<>(); | 
			
		
	
		
		
			
				
					|  |  |                                         for (AreaCodeDictResultDTO area : twoDto) { |  |  |                                         for (AreaCodeDictResultDTO area : twoDto) { | 
			
		
	
		
		
			
				
					
					|  |  |                                             if (child.getCode().equals(area.getParentCode())){ |  |  |                                             if (child.getCode().equals(area.getParentCode())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                                                 areaList.add(area); |  |  |                                                 areaList.add(area); | 
			
		
	
		
		
			
				
					|  |  |                                             } |  |  |                                             } | 
			
		
	
		
		
			
				
					|  |  |                                         } |  |  |                                         } | 
			
		
	
	
		
		
			
				
					|  | @ -557,13 +553,13 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn | 
			
		
	
		
		
			
				
					|  |  |                         } |  |  |                         } | 
			
		
	
		
		
			
				
					|  |  |                     } |  |  |                     } | 
			
		
	
		
		
			
				
					|  |  |                 } |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |             }else if (form.getRootAreaLevel().equals(AreaCodeConstant.CITY)){ |  |  |             } else if (form.getRootAreaLevel().equals(AreaCodeConstant.CITY)) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                 for (AreaCodeDictResultDTO dto : threeDto) { |  |  |                 for (AreaCodeDictResultDTO dto : threeDto) { | 
			
		
	
		
		
			
				
					
					|  |  |                     if (!CollectionUtils.isEmpty(dto.getChildren())){ |  |  |                     if (!CollectionUtils.isEmpty(dto.getChildren())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                         for (AreaCodeDictResultDTO child : dto.getChildren()) { |  |  |                         for (AreaCodeDictResultDTO child : dto.getChildren()) { | 
			
		
	
		
		
			
				
					|  |  |                             List<AreaCodeDictResultDTO> areaList = new ArrayList<>(); |  |  |                             List<AreaCodeDictResultDTO> areaList = new ArrayList<>(); | 
			
		
	
		
		
			
				
					|  |  |                             for (AreaCodeDictResultDTO area : twoDto) { |  |  |                             for (AreaCodeDictResultDTO area : twoDto) { | 
			
		
	
		
		
			
				
					
					|  |  |                                 if (child.getCode().equals(area.getParentCode())){ |  |  |                                 if (child.getCode().equals(area.getParentCode())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                                     areaList.add(area); |  |  |                                     areaList.add(area); | 
			
		
	
		
		
			
				
					|  |  |                                 } |  |  |                                 } | 
			
		
	
		
		
			
				
					|  |  |                             } |  |  |                             } | 
			
		
	
	
		
		
			
				
					|  | @ -571,11 +567,11 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn | 
			
		
	
		
		
			
				
					|  |  |                         } |  |  |                         } | 
			
		
	
		
		
			
				
					|  |  |                     } |  |  |                     } | 
			
		
	
		
		
			
				
					|  |  |                 } |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |             }else{ |  |  |             } else { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                 for (AreaCodeDictResultDTO dto : threeDto) { |  |  |                 for (AreaCodeDictResultDTO dto : threeDto) { | 
			
		
	
		
		
			
				
					|  |  |                     List<AreaCodeDictResultDTO> areaList = new ArrayList<>(); |  |  |                     List<AreaCodeDictResultDTO> areaList = new ArrayList<>(); | 
			
		
	
		
		
			
				
					|  |  |                     for (AreaCodeDictResultDTO area : twoDto) { |  |  |                     for (AreaCodeDictResultDTO area : twoDto) { | 
			
		
	
		
		
			
				
					
					|  |  |                         if (dto.getCode().equals(area.getParentCode())){ |  |  |                         if (dto.getCode().equals(area.getParentCode())) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                             areaList.add(area); |  |  |                             areaList.add(area); | 
			
		
	
		
		
			
				
					|  |  |                         } |  |  |                         } | 
			
		
	
		
		
			
				
					|  |  |                     } |  |  |                     } | 
			
		
	
	
		
		
			
				
					|  | @ -677,35 +673,35 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn | 
			
		
	
		
		
			
				
					|  |  |         String areaCode = ""; |  |  |         String areaCode = ""; | 
			
		
	
		
		
			
				
					|  |  |         switch (formDTO.getCurrentAreaLevel()) { |  |  |         switch (formDTO.getCurrentAreaLevel()) { | 
			
		
	
		
		
			
				
					|  |  |             case AreaCodeConstant.DISTRICT: |  |  |             case AreaCodeConstant.DISTRICT: | 
			
		
	
		
		
			
				
					
					|  |  |                 areaCode = addDistrictAreaCode(formDTO.getParentAreaCode(),formDTO.getName()); |  |  |                 areaCode = addDistrictAreaCode(formDTO.getParentAreaCode(), formDTO.getName()); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                 break; |  |  |                 break; | 
			
		
	
		
		
			
				
					|  |  |             case AreaCodeConstant.STREET: |  |  |             case AreaCodeConstant.STREET: | 
			
		
	
		
		
			
				
					
					|  |  |                 areaCode = addStreetCommAreaCode(ConvertUtils.sourceToTarget(formDTO,AddAreaCodeDictFormDTO.class)); |  |  |                 areaCode = addStreetCommAreaCode(ConvertUtils.sourceToTarget(formDTO, AddAreaCodeDictFormDTO.class)); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                 break; |  |  |                 break; | 
			
		
	
		
		
			
				
					|  |  |             case AreaCodeConstant.COMMUNITY: |  |  |             case AreaCodeConstant.COMMUNITY: | 
			
		
	
		
		
			
				
					
					|  |  |                 areaCode = addStreetCommAreaCode(ConvertUtils.sourceToTarget(formDTO,AddAreaCodeDictFormDTO.class)); |  |  |                 areaCode = addStreetCommAreaCode(ConvertUtils.sourceToTarget(formDTO, AddAreaCodeDictFormDTO.class)); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                 break; |  |  |                 break; | 
			
		
	
		
		
			
				
					|  |  |             default: |  |  |             default: | 
			
		
	
		
		
			
				
					
					|  |  |                 log.info("currentAreaLevel值为"+formDTO.getCurrentAreaLevel()); |  |  |                 log.info("currentAreaLevel值为" + formDTO.getCurrentAreaLevel()); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |         } |  |  |         } | 
			
		
	
		
		
			
				
					|  |  |         return areaCode; |  |  |         return areaCode; | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     @Override |  |  |     @Override | 
			
		
	
		
		
			
				
					|  |  |     public List<AreaCodeResultDTO> nextArea(AreaCodeFormDTO formDTO) { |  |  |     public List<AreaCodeResultDTO> nextArea(AreaCodeFormDTO formDTO) { | 
			
		
	
		
		
			
				
					
					|  |  |         if(StringUtils.isBlank(formDTO.getParentAreaCode())&&StringUtils.isBlank(formDTO.getParentLevel())){ |  |  |         if (StringUtils.isBlank(formDTO.getParentAreaCode()) && StringUtils.isBlank(formDTO.getParentLevel())) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             String pKey=RedisKeys.getNextAreaCodeKey(NumConstant.ZERO_STR); |  |  |             String pKey = RedisKeys.getNextAreaCodeKey(NumConstant.ZERO_STR); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             List<AreaCodeResultDTO> list=areaCodeRedis.getNextAreaCodeKey(pKey); |  |  |             List<AreaCodeResultDTO> list = areaCodeRedis.getNextAreaCodeKey(pKey); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             if(org.apache.commons.collections4.CollectionUtils.isNotEmpty(list)){ |  |  |             if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list)) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |                 return list; |  |  |                 return list; | 
			
		
	
		
		
			
				
					|  |  |             } |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |             List<AreaCodeResultDTO> pList=baseDao.selectProvince(); |  |  |             List<AreaCodeResultDTO> pList = baseDao.selectProvince(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             areaCodeRedis.setNextAreaCodeKey(pKey,pList); |  |  |             areaCodeRedis.setNextAreaCodeKey(pKey, pList); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |             return pList; |  |  |             return pList; | 
			
		
	
		
		
			
				
					|  |  |         } |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |         String key=RedisKeys.getNextAreaCodeKey(formDTO.getParentAreaCode()); |  |  |         String key = RedisKeys.getNextAreaCodeKey(formDTO.getParentAreaCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |         List<AreaCodeResultDTO> list=areaCodeRedis.getNextAreaCodeKey(key); |  |  |         List<AreaCodeResultDTO> list = areaCodeRedis.getNextAreaCodeKey(key); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |         if(org.apache.commons.collections4.CollectionUtils.isNotEmpty(list)){ |  |  |         if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list)) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |             return list; |  |  |             return list; | 
			
		
	
		
		
			
				
					|  |  |         } |  |  |         } | 
			
		
	
		
		
			
				
					|  |  |         switch (formDTO.getParentLevel()) { |  |  |         switch (formDTO.getParentLevel()) { | 
			
		
	
	
		
		
			
				
					|  | @ -723,17 +719,116 @@ public class AreaCodeServiceImpl extends BaseServiceImpl<AreaCodeDao, AreaCodeEn | 
			
		
	
		
		
			
				
					|  |  |                 break; |  |  |                 break; | 
			
		
	
		
		
			
				
					|  |  |             case AreaCodeConstant.COMMUNITY: |  |  |             case AreaCodeConstant.COMMUNITY: | 
			
		
	
		
		
			
				
					|  |  |                 log.info("社区无下级"); |  |  |                 log.info("社区无下级"); | 
			
		
	
		
		
			
				
					
					|  |  |                 list=null; |  |  |                 list = null; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                 break; |  |  |                 break; | 
			
		
	
		
		
			
				
					|  |  |             default: |  |  |             default: | 
			
		
	
		
		
			
				
					
					|  |  |                 log.warn("parentLevel错误:"+formDTO.getParentLevel()); |  |  |                 log.warn("parentLevel错误:" + formDTO.getParentLevel()); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |         } |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |         if(org.apache.commons.collections4.CollectionUtils.isNotEmpty(list)){ |  |  |         if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list)) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             areaCodeRedis.setNextAreaCodeKey(key,list); |  |  |             areaCodeRedis.setNextAreaCodeKey(key, list); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |         } |  |  |         } | 
			
		
	
		
		
			
				
					|  |  |         return list; |  |  |         return list; | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     @Override | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     public AreaCodeResultDTO getAreaCodeDetail(AreaCodeDetailFormDTO formDTO) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         AreaCodeResultDTO result = new AreaCodeResultDTO(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         switch (formDTO.getLevel()) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             case AreaCodeConstant.PROVINCE: | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 AreaCodeDTO province = baseDao.selectByProvinceCode(formDTO.getAreaCode()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 if (province != null) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setAreaName(province.getProvinceName()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setAreaCode(province.getProvinceCode()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setParentCode(NumConstant.ZERO_STR); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setLevel(AreaCodeConstant.PROVINCE); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 break; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             case AreaCodeConstant.CITY: | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 AreaCodeDTO city = baseDao.selectByCityCode(formDTO.getAreaCode()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 if (city != null) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setAreaName(city.getCityName()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setAreaCode(city.getCityName()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setParentCode(city.getProvinceCode()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setLevel(AreaCodeConstant.CITY); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 break; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             case AreaCodeConstant.DISTRICT: | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 AreaCodeDTO county = baseDao.selectByCountyCode(formDTO.getAreaCode()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 if (county != null) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setAreaName(county.getCountyName()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setAreaCode(county.getCountyCode()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setParentCode(county.getCityCode()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setLevel(AreaCodeConstant.DISTRICT); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 break; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             case AreaCodeConstant.STREET: | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 result = baseDao.selectByStreetCode(formDTO.getAreaCode()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 break; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             case AreaCodeConstant.COMMUNITY: | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 result = baseDao.selectByCommunityCode(formDTO.getAreaCode()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 break; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             default: | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 log.warn("Level错误:" + formDTO.getLevel()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         return result; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     @Override | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     public List<CustomerTreeDTO> getAreaCodeTree(CustomerTreeDTO formDTO) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         List<AreaCodeResultDTO> tree = new ArrayList<>(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         areaCodeHandle(formDTO.getLevel(), formDTO.getAreaCode(), tree); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         return ConvertUtils.sourceToTarget(tree, CustomerTreeDTO.class); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     private void areaCodeHandle(String level, String areaCode, List<AreaCodeResultDTO> tree) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         AreaCodeResultDTO result = new AreaCodeResultDTO(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         switch (level) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             case AreaCodeConstant.PROVINCE: | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 AreaCodeDTO province = baseDao.selectByProvinceCode(areaCode); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 if (province != null) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setAreaName(province.getProvinceName()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setAreaCode(province.getProvinceCode()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setParentCode(NumConstant.ZERO_STR); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setLevel(AreaCodeConstant.PROVINCE); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     tree.add(result); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 break; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             case AreaCodeConstant.CITY: | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 AreaCodeDTO city = baseDao.selectByCityCode(areaCode); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 if (city != null) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setAreaName(city.getCityName()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setAreaCode(city.getCityCode()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setParentCode(city.getProvinceCode()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setLevel(AreaCodeConstant.CITY); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     tree.add(result); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     areaCodeHandle(AreaCodeConstant.PROVINCE, city.getProvinceCode(), tree); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 break; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             case AreaCodeConstant.DISTRICT: | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 AreaCodeDTO county = baseDao.selectByCountyCode(areaCode); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 if (county != null) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setAreaName(county.getCountyName()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setAreaCode(county.getCountyCode()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setParentCode(county.getCityCode()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     result.setLevel(AreaCodeConstant.DISTRICT); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     tree.add(result); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                     areaCodeHandle(AreaCodeConstant.CITY, county.getCityCode(), tree); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 break; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             case AreaCodeConstant.STREET: | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 result = baseDao.selectByStreetCode(areaCode); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 tree.add(result); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 areaCodeHandle(AreaCodeConstant.DISTRICT, result.getParentCode(), tree); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 break; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             case AreaCodeConstant.COMMUNITY: | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 result = baseDao.selectByCommunityCode(areaCode); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 tree.add(result); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 areaCodeHandle(AreaCodeConstant.STREET, result.getParentCode(), tree); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 break; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             default: | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                 log.warn("Level错误:" + level); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     private String addDistrictAreaCode(String cityCode, String countyName) { |  |  |     private String addDistrictAreaCode(String cityCode, String countyName) { | 
			
		
	
		
		
			
				
					|  |  |         AreaCodeDTO city = baseDao.selectByCityCode(cityCode); |  |  |         AreaCodeDTO city = baseDao.selectByCityCode(cityCode); | 
			
		
	
	
		
		
			
				
					|  | 
 |