| 
														
															@@ -6,9 +6,13 @@ import com.querydsl.core.types.QBean; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.querydsl.core.types.QList; 
														 | 
														
														 | 
														
															 import com.querydsl.core.types.QList; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.querydsl.jpa.impl.JPAQuery; 
														 | 
														
														 | 
														
															 import com.querydsl.jpa.impl.JPAQuery; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.sysu.admin.controller.city.*; 
														 | 
														
														 | 
														
															 import com.sysu.admin.controller.city.*; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.sysu.admin.controller.crop.executor_table.ExecutorTable; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.sysu.admin.controller.crop.executor_table.ExecutorTableService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.sysu.admin.controller.crop.executor_table.PKRP; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.sysu.admin.controller.crop.images.CropImage; 
														 | 
														
														 | 
														
															 import com.sysu.admin.controller.crop.images.CropImage; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.sysu.admin.controller.crop.images.CropImageService; 
														 | 
														
														 | 
														
															 import com.sysu.admin.controller.crop.images.CropImageService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.sysu.admin.controller.crop.images.ImageType; 
														 | 
														
														 | 
														
															 import com.sysu.admin.controller.crop.images.ImageType; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.sysu.admin.controller.crop.interceptor.DynamicTableNames; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.sysu.admin.controller.crop.range.AutoTableNameInterceptor; 
														 | 
														
														 | 
														
															 import com.sysu.admin.controller.crop.range.AutoTableNameInterceptor; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.sysu.admin.controller.crop.range.LandRangeIndexService; 
														 | 
														
														 | 
														
															 import com.sysu.admin.controller.crop.range.LandRangeIndexService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.sysu.admin.controller.geo.land.LandTaskStatus; 
														 | 
														
														 | 
														
															 import com.sysu.admin.controller.geo.land.LandTaskStatus; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -53,37 +57,37 @@ public class CropLandService extends BaseService<CropLand, Long> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     DistrictRepository districtRepository; 
														 | 
														
														 | 
														
															     DistrictRepository districtRepository; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Autowired 
														 | 
														
														 | 
														
															     @Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     LandRangeIndexService landRangeIndexService; 
														 | 
														
														 | 
														
															     LandRangeIndexService landRangeIndexService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    ExecutorTableService executorTableService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Override 
														 | 
														
														 | 
														
															     @Override 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @DynamicTableNames(value = "aLong") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public CropLand findOne(Long aLong) { 
														 | 
														
														 | 
														
															     public CropLand findOne(Long aLong) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        AutoTableNameInterceptor.myTable.set(landRangeIndexService.getTableName(aLong)); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         CropLand bean = super.findOne(aLong); 
														 | 
														
														 | 
														
															         CropLand bean = super.findOne(aLong); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return bean; 
														 | 
														
														 | 
														
															         return bean; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Override 
														 | 
														
														 | 
														
															     @Override 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @DynamicTableNames(value = "entity") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public <S extends CropLand> S save(S entity) { 
														 | 
														
														 | 
														
															     public <S extends CropLand> S save(S entity) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        AutoTableNameInterceptor.myTable.set(landRangeIndexService.getTableName(entity.getId())); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return super.save(entity); 
														 | 
														
														 | 
														
															         return super.save(entity); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @DynamicTableNames(value = "point") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public List<CropPoint> findByBuffer(Double[] point, Integer meter){ 
														 | 
														
														 | 
														
															     public List<CropPoint> findByBuffer(Double[] point, Integer meter){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        AutoTableNameInterceptor.myTable.set(landRangeIndexService.getTableName(point)); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         double degree = meter / (2 * Math.PI * 6371004) * 360; 
														 | 
														
														 | 
														
															         double degree = meter / (2 * Math.PI * 6371004) * 360; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return mCropPointRepository.findByBufferAndStatus("Point("+point[0]+" "+point[1]+")",degree, new Integer[]{ 
														 | 
														
														 | 
														
															         return mCropPointRepository.findByBufferAndStatus("Point("+point[0]+" "+point[1]+")",degree, new Integer[]{ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 LandTaskStatus.published.ordinal(),LandTaskStatus.receive.ordinal() 
														 | 
														
														 | 
														
															                 LandTaskStatus.published.ordinal(),LandTaskStatus.receive.ordinal() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         }); 
														 | 
														
														 | 
														
															         }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @DynamicTableNames(executor = "executor") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public List<CropLand> findIdAndNameByExecutor(Long executor){ 
														 | 
														
														 | 
														
															     public List<CropLand> findIdAndNameByExecutor(Long executor){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        QCropLand qCropLand = QCropLand.cropLand; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        QBean<CropLand> selectBean = Projections.fields(qCropLand, qCropLand.id, qCropLand.name, qCropLand.updateDate); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        JPAQuery<CropLand> jpaQuery = mJPAQueryFactory.select(selectBean) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                .from(qCropLand) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                .where(qCropLand.executor.eq(executor)); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        return jpaQuery.fetch(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        Query query =mEntityManager.createQuery("select c.id,c.name,c.updateDate from CropLand c where c.executor = " + executor); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return query.getResultList(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @DynamicTableNames(value = "point") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public CropLand findByPoint(Double[] point){ 
														 | 
														
														 | 
														
															     public CropLand findByPoint(Double[] point){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         CropLand cityLand = mCropLandRepository.findByPoint("Point("+point[0]+" "+point[1]+")"); 
														 | 
														
														 | 
														
															         CropLand cityLand = mCropLandRepository.findByPoint("Point("+point[0]+" "+point[1]+")"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return cityLand; 
														 | 
														
														 | 
														
															         return cityLand; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -94,15 +98,16 @@ public class CropLandService extends BaseService<CropLand, Long> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return mCropPointRepository.getBuffer("Point("+point[0]+" "+point[1]+")", degree); 
														 | 
														
														 | 
														
															         return mCropPointRepository.getBuffer("Point("+point[0]+" "+point[1]+")", degree); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @DynamicTableNames(value = "tableNames") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public List<CropPoint> findCropLandNoGeomByTableNamesAndBBox(String tableNames, Double x1, Double y1, Double x2, Double y2){ 
														 | 
														
														 | 
														
															     public List<CropPoint> findCropLandNoGeomByTableNamesAndBBox(String tableNames, Double x1, Double y1, Double x2, Double y2){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         String wkt = bboxToWkt(x1, y1 , x2, y2); 
														 | 
														
														 | 
														
															         String wkt = bboxToWkt(x1, y1 , x2, y2); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        AutoTableNameInterceptor.myTable.set(tableNames); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         String sql = " select  "+ CropPoint.selectColumns; 
														 | 
														
														 | 
														
															         String sql = " select  "+ CropPoint.selectColumns; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         sql += " from p_crop  where ST_Intersects(geom,st_geomfromtext('"+wkt+"',4326)) "; 
														 | 
														
														 | 
														
															         sql += " from p_crop  where ST_Intersects(geom,st_geomfromtext('"+wkt+"',4326)) "; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         List<CropPoint> cropPointList = mEntityManager.createNativeQuery(sql, CropPoint.class).getResultList(); 
														 | 
														
														 | 
														
															         List<CropPoint> cropPointList = mEntityManager.createNativeQuery(sql, CropPoint.class).getResultList(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return cropPointList; 
														 | 
														
														 | 
														
															         return cropPointList; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @DynamicTableNames(value = "id") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Transactional 
														 | 
														
														 | 
														
															     @Transactional 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public void updateStatus(Long id, Integer status, Long updateUserId){ 
														 | 
														
														 | 
														
															     public void updateStatus(Long id, Integer status, Long updateUserId){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         CropLand bean = mCropLandRepository.findOne(id); 
														 | 
														
														 | 
														
															         CropLand bean = mCropLandRepository.findOne(id); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -111,17 +116,9 @@ public class CropLandService extends BaseService<CropLand, Long> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             bean.setReceiveDate(new Date()); 
														 | 
														
														 | 
														
															             bean.setReceiveDate(new Date()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             bean.setReceiver(updateUserId); 
														 | 
														
														 | 
														
															             bean.setReceiver(updateUserId); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        mCropLandRepository.save(bean); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        mCropLandRepository.saveAndFlush(bean); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    @Transactional 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    public int updateCenterPoint(Long id){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        return  mCropLandRepository.updateCenterPoint(id); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    public Point getCenterPoint(Long id){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        return (Point)GeoCastUtil.wktToGeom(mCropLandRepository.getCenterPoint(id)); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public Point getCenterPoint(Geometry geometry){ 
														 | 
														
														 | 
														
															     public Point getCenterPoint(Geometry geometry){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         geometry.setSRID(4326); 
														 | 
														
														 | 
														
															         geometry.setSRID(4326); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return (Point)GeoCastUtil.wktToGeom(mCropLandRepository.getCenterPoint(geometry)); 
														 | 
														
														 | 
														
															         return (Point)GeoCastUtil.wktToGeom(mCropLandRepository.getCenterPoint(geometry)); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -135,6 +132,7 @@ public class CropLandService extends BaseService<CropLand, Long> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         bean.setDistrict(district.getCode()); 
														 | 
														
														 | 
														
															         bean.setDistrict(district.getCode()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @DynamicTableNames(value = "bean") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Transactional 
														 | 
														
														 | 
														
															     @Transactional 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public void saveCropAndImages(CropLand bean){ 
														 | 
														
														 | 
														
															     public void saveCropAndImages(CropLand bean){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         CropImage fay = bean.getFay(); 
														 | 
														
														 | 
														
															         CropImage fay = bean.getFay(); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -143,7 +141,10 @@ public class CropLandService extends BaseService<CropLand, Long> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         saveImage(fay, bean.getId(), ImageType.fay, bean.getExecutor()); 
														 | 
														
														 | 
														
															         saveImage(fay, bean.getId(), ImageType.fay, bean.getExecutor()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         saveImage(center, bean.getId(), ImageType.center, bean.getExecutor()); 
														 | 
														
														 | 
														
															         saveImage(center, bean.getId(), ImageType.center, bean.getExecutor()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         saveImage(near, bean.getId(), ImageType.near, bean.getExecutor()); 
														 | 
														
														 | 
														
															         saveImage(near, bean.getId(), ImageType.near, bean.getExecutor()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        mCropLandRepository.save(bean); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        String tableName = AutoTableNameInterceptor.myTable.get(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        ExecutorTable executorTable = new ExecutorTable().setPk(new PKRP().tableName(tableName).executor(bean.getExecutor())); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        mCropLandRepository.saveAndFlush(bean); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        executorTableService.save(executorTable); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private void saveImage(CropImage image, Long cropId, ImageType type, Long userId){ 
														 | 
														
														 | 
														
															     private void saveImage(CropImage image, Long cropId, ImageType type, Long userId){ 
														 |