| 
					
				 | 
			
			
				@@ -13,6 +13,7 @@ import com.xiesx.fastboot.base.pagination.PaginationHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.xiesx.fastboot.base.pagination.PaginationResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.xiesx.fastboot.base.pagination.PaginationVo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.xiesx.fastboot.core.jpa.JpaPlusRepository; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.apache.commons.lang3.ArrayUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.data.domain.Page; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -175,38 +176,44 @@ public class LandService extends BaseService<Land,Long> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return townStatList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public PaginationResult list(String district, Integer townId, PaginationVo page, String cropType){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public PaginationResult list(Double[] sure,String district, Integer townId, PaginationVo page, String cropType){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String wkt = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(townId != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              wkt = townService.findWktById(townId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }else if(StringUtils.isNotBlank(district)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              wkt = districtRepository.findWktByCode(district); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(wkt == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Predicate predicate = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Pageable pageable = PageRequest.of(page.getPage(), page.getLimit(), Sort.by(Land.FIELDS.id)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            QLand qLand = QLand.land; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Page<Land> pageData = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(StringUtils.isNotBlank(cropType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                pageData = landRepository.findAll(qLand.crop_type.eq(cropType), pageable); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                pageData = landRepository.findAll(pageable); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return PaginationHelper.create(pageData.getContent(), pageData.getTotalPages(), pageData.getPageable().getPageNumber()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            List<Land> data = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            int count; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            int start = page.getLimit() * page.getPage(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(StringUtils.isNotBlank(cropType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                data = landRepository.findListByWktAndCropType(wkt, cropType, page.getLimit(), start); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                count = landRepository.findCountByWktAndCropType(wkt, cropType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                data = landRepository.findListByWkt(wkt, page.getLimit(), start); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                count = landRepository.findCountByWkt(wkt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return PaginationHelper.create(data, count, page.page); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<Land> data = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int count; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int start = page.getLimit() * page.getPage(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        StringBuffer countSql = new StringBuffer(100); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        StringBuffer sql = new StringBuffer(100); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        countSql.append("select count(1) from  leizhou_land where 1=1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sql.append("select * from  leizhou_land where 1=1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(wkt != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            countSql.append(" and St_within(geom,st_geomfromtext('"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            countSql.append(wkt).append("',4326))"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            sql.append(" and St_within(geom,st_geomfromtext('"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            sql.append(wkt).append("',4326))"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(StringUtils.isNotBlank(cropType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            countSql.append(" and crop_type = '").append(cropType).append("'"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            sql.append(" and crop_type = '").append(cropType).append("'"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(ArrayUtils.isNotEmpty(sure)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            countSql.append(" and crop_sure >= ").append(sure[0]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            countSql.append(" and crop_sure <= ").append(sure[1]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            sql.append(" and crop_sure >= ").append(sure[0]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            sql.append(" and crop_sure <= ").append(sure[1]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sql.append(" limit ").append(page.getLimit()).append(" OFFSET ").append(start); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        count = Integer.valueOf(mEntityManager.createNativeQuery(countSql.toString()).getSingleResult().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        data = mEntityManager.createNativeQuery(sql.toString(), Land.class).getResultList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return PaginationHelper.create(data, count, page.page); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public Land findByPoint(Double[] point){ 
			 |