|  | @@ -261,6 +261,33 @@ public class LandService extends BaseService<Land,Long> {
 | 
	
		
			
				|  |  |          return townStatSoilList;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    public List<StatEstimate> getEstimate(String districtCode, String city, String cropType){
 | 
	
		
			
				|  |  | +        List<Object[]> res = null;
 | 
	
		
			
				|  |  | +        Map<Integer,String> namesMap = null;
 | 
	
		
			
				|  |  | +        if(StringUtils.isNotBlank(districtCode)){
 | 
	
		
			
				|  |  | +            namesMap = townService.getNames(districtCode);
 | 
	
		
			
				|  |  | +            res = landRepository.statTownEstimate(districtCode, cropType);
 | 
	
		
			
				|  |  | +            return getEstimate(res, namesMap);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if(StringUtils.isNotBlank(city)){
 | 
	
		
			
				|  |  | +            namesMap = districtService.getNames(city);
 | 
	
		
			
				|  |  | +            res = landRepository.statDistrictEstimate(city.substring(0,4) + "%", cropType);
 | 
	
		
			
				|  |  | +            return getEstimate(res, namesMap);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        throw new RuntimeException("district 和 city 至少需要一个");
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public List<StatEstimate> getEstimate(List<Object[]> res, Map<Integer,String> namesMap){
 | 
	
		
			
				|  |  | +        List<StatEstimate> list = new ArrayList<>();
 | 
	
		
			
				|  |  | +        for(Object[] objects : res){
 | 
	
		
			
				|  |  | +            StatEstimate statEstimate = new StatEstimate();
 | 
	
		
			
				|  |  | +            statEstimate.setTownId(Integer.valueOf(objects[0].toString()));
 | 
	
		
			
				|  |  | +            statEstimate.setTownName(namesMap.get(statEstimate.getTownId()));
 | 
	
		
			
				|  |  | +            statEstimate.setValue(Double.valueOf(objects[1].toString()));
 | 
	
		
			
				|  |  | +            list.add(statEstimate);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return list;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 |