|  | @@ -0,0 +1,50 @@
 | 
	
		
			
				|  |  | +package com.sysu.admin.api.city;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import com.sysu.admin.controller.city.*;
 | 
	
		
			
				|  |  | +import com.sysu.admin.controller.crop.CropLandService;
 | 
	
		
			
				|  |  | +import com.sysu.admin.controller.crop.range.LandRangeIndexService;
 | 
	
		
			
				|  |  | +import com.sysu.admin.site.CommonVo;
 | 
	
		
			
				|  |  | +import com.sysu.admin.utils.shape.GeoCastUtil;
 | 
	
		
			
				|  |  | +import com.xiesx.fastboot.base.result.BaseResult;
 | 
	
		
			
				|  |  | +import com.xiesx.fastboot.base.result.R;
 | 
	
		
			
				|  |  | +import org.locationtech.jts.geom.Point;
 | 
	
		
			
				|  |  | +import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import org.springframework.stereotype.Controller;
 | 
	
		
			
				|  |  | +import org.springframework.ui.Model;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.RequestMapping;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.ResponseBody;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import java.util.List;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/**
 | 
	
		
			
				|  |  | + * 镇区域
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  | +@RequestMapping("/api/city")
 | 
	
		
			
				|  |  | +@Controller("ApiCityController2")
 | 
	
		
			
				|  |  | +public class ApiCityController {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    ProvinceRepository provinceRepository;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    CityRepository cityRepository;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    DistrictRepository districtRepository;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @RequestMapping(value = "/data")
 | 
	
		
			
				|  |  | +    @ResponseBody
 | 
	
		
			
				|  |  | +    public BaseResult data(){
 | 
	
		
			
				|  |  | +        Province province = provinceRepository.find("440000");
 | 
	
		
			
				|  |  | +        List<City> cityList = cityRepository.findListByCode(province.getCode().substring(0, 2) + "%");
 | 
	
		
			
				|  |  | +        province.setCityList(cityList);
 | 
	
		
			
				|  |  | +        cityList.stream().forEach(city -> {
 | 
	
		
			
				|  |  | +            List<District> districts =districtRepository.findList(city.getCode().substring(0,4) + "%");
 | 
	
		
			
				|  |  | +            city.setDistricts(districts);
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +        return R.succ(province);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +}
 |