| | |
| | | |
| | | @Override |
| | | public void getAdministrativeDivision() { |
| | | // TODO: 获取行政区域数据 |
| | | String administrativeDivisionsUrl = tengxunMapProperties.getAdministrativeDivisionsUrl(); |
| | | System.out.println(administrativeDivisionsUrl); |
| | | //可以单独传入http参数,这样参数会自动做URL编码,拼接在URL中 |
| | | HashMap<String, Object> paramMap = new HashMap<>(); |
| | | |
| | |
| | | |
| | | List<TengxunDistrict> allDistricts = response.getResult(); |
| | | // 将腾讯地图返回的数据格式转换成标准的三层结构 |
| | | List<TengxunDistrict> formatterDistrict =normalizeTreeToThreeLevels(allDistricts); |
| | | // List<TengxunDistrict> formatterDistrict =normalizeTreeToThreeLevels(allDistricts); |
| | | // |
| | | // List<TengxunDistrict> allTengxunDistricts = new ArrayList<>(); |
| | | // // 递归遍历所有的节点,然后把所有节点加入到 allDistricts 列表中 |
| | | // for (TengxunDistrict tengxunDistrict : formatterDistrict){ |
| | | // addDistrictToList(tengxunDistrict, null, allTengxunDistricts); // 从根节点开始,父节点 ID 为 null |
| | | // } |
| | | |
| | | // List<TengxunDistrict> formatterDistrict =normalizeTreeToThreeLevels(allDistricts); |
| | | |
| | | List<TengxunDistrict> allTengxunDistricts = new ArrayList<>(); |
| | | // 递归遍历所有的节点,然后把所有节点加入到 allDistricts 列表中 |
| | | for (TengxunDistrict tengxunDistrict : formatterDistrict){ |
| | | for (TengxunDistrict tengxunDistrict : allDistricts){ |
| | | addDistrictToList(tengxunDistrict, null, allTengxunDistricts); // 从根节点开始,父节点 ID 为 null |
| | | } |
| | | |
| | | List<DistrictTengxunDO> districtTengxunDOList= ConverterUtil.transList(allTengxunDistricts, DistrictTengxunDO.class); |
| | | |
| | | districtTengxunService.saveRemoteDistricts(districtTengxunDOList); |