|  | @@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 | 
												
													
														
															|  |  import org.springframework.web.bind.annotation.RestController;
 |  |  import org.springframework.web.bind.annotation.RestController;
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |  import java.util.ArrayList;
 |  |  import java.util.ArrayList;
 | 
												
													
														
															|  | 
 |  | +import java.util.Arrays;
 | 
												
													
														
															|  |  import java.util.List;
 |  |  import java.util.List;
 | 
												
													
														
															|  |  import java.util.stream.Collectors;
 |  |  import java.util.stream.Collectors;
 | 
												
													
														
															|  |  
 |  |  
 | 
												
											
												
													
														
															|  | @@ -28,7 +29,22 @@ public class AreaApiService implements AreaApi {
 | 
												
													
														
															|  |      @Override
 |  |      @Override
 | 
												
													
														
															|  |      @RequestMapping("/getInfoLikeKeywordsAndSubdistrict")
 |  |      @RequestMapping("/getInfoLikeKeywordsAndSubdistrict")
 | 
												
													
														
															|  |      public List<AreaInfo> getInfoLikeKeywordsAndSubdistrict(String keywords, Integer subdistrict) {
 |  |      public List<AreaInfo> getInfoLikeKeywordsAndSubdistrict(String keywords, Integer subdistrict) {
 | 
												
													
														
															|  | -        return GaoDeWebUtil.getInfoLikeKeywordsAndSubdistrict(keywords, subdistrict);
 |  | 
 | 
												
													
														
															|  | 
 |  | +        List<SysRegion> list = sysRegionService.list();
 | 
												
													
														
															|  | 
 |  | +        if (!Collections.isEmpty(list)) {
 | 
												
													
														
															|  | 
 |  | +            List<AreaInfo> collect = list.stream().filter(o->o.getAdcode().equals(keywords) || o.getName().contains(keywords)).map(o -> {
 | 
												
													
														
															|  | 
 |  | +                AreaInfo areaInfo = new AreaInfo();
 | 
												
													
														
															|  | 
 |  | +                BeanUtils.copyProperties(o, areaInfo);
 | 
												
													
														
															|  | 
 |  | +                return areaInfo;
 | 
												
													
														
															|  | 
 |  | +            }).collect(Collectors.toList());
 | 
												
													
														
															|  | 
 |  | +            for (AreaInfo areaInfo : collect) {
 | 
												
													
														
															|  | 
 |  | +                List<AreaInfo> areaInfos = buildData(Arrays.asList(areaInfo), list);
 | 
												
													
														
															|  | 
 |  | +                // 构建树
 | 
												
													
														
															|  | 
 |  | +                areaInfo.setDistricts(buildTree(areaInfos, list));
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +            return collect;
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        return new ArrayList<>();
 | 
												
													
														
															|  | 
 |  | +//        return GaoDeWebUtil.getInfoLikeKeywordsAndSubdistrict(keywords, subdistrict);
 | 
												
													
														
															|  |      }
 |  |      }
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |      /**
 |  |      /**
 | 
												
											
												
													
														
															|  | @@ -46,10 +62,9 @@ public class AreaApiService implements AreaApi {
 | 
												
													
														
															|  |                  BeanUtils.copyProperties(o, areaInfo);
 |  |                  BeanUtils.copyProperties(o, areaInfo);
 | 
												
													
														
															|  |                  return areaInfo;
 |  |                  return areaInfo;
 | 
												
													
														
															|  |              }).collect(Collectors.toList());
 |  |              }).collect(Collectors.toList());
 | 
												
													
														
															|  | -            List<SysRegion> listAll = sysRegionService.list();
 |  | 
 | 
												
													
														
															|  | -            List<AreaInfo> areaInfos = buildData(collect, listAll);
 |  | 
 | 
												
													
														
															|  | 
 |  | +            List<AreaInfo> areaInfos = buildData(collect, list);
 | 
												
													
														
															|  |              // 构建树
 |  |              // 构建树
 | 
												
													
														
															|  | -            return buildTree(areaInfos, listAll);
 |  | 
 | 
												
													
														
															|  | 
 |  | +            return buildTree(areaInfos, list);
 | 
												
													
														
															|  |          }
 |  |          }
 | 
												
													
														
															|  |          return new ArrayList<>();
 |  |          return new ArrayList<>();
 | 
												
													
														
															|  |  //        return GaoDeWebUtil.getProvinces();
 |  |  //        return GaoDeWebUtil.getProvinces();
 |