| 
														
															@@ -1,40 +1,34 @@ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 package com.sysu.admin.controller.crop; 
														 | 
														
														 | 
														
															 package com.sysu.admin.controller.crop; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import com.alibaba.fastjson.JSON; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import com.querydsl.core.BooleanBuilder; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.alibaba.excel.EasyExcel; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.querydsl.core.types.Predicate; 
														 | 
														
														 | 
														
															 import com.querydsl.core.types.Predicate; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import com.querydsl.core.types.dsl.BooleanExpression; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import com.querydsl.core.types.dsl.PathBuilder; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.querydsl.jpa.impl.JPAUpdateClause; 
														 | 
														
														 | 
														
															 import com.querydsl.jpa.impl.JPAUpdateClause; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import com.sysu.admin.api.crop.CropVo; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import com.sysu.admin.api.interceptor.LogAspect; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.sysu.admin.controller.city.*; 
														 | 
														
														 | 
														
															 import com.sysu.admin.controller.city.*; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import com.sysu.admin.controller.crop.CropLand; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import com.sysu.admin.controller.crop.CropLandService; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import com.sysu.admin.controller.crop.CropLandVo; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.sysu.admin.controller.crop.range.LandRangeIndexService; 
														 | 
														
														 | 
														
															 import com.sysu.admin.controller.crop.range.LandRangeIndexService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.sysu.admin.controller.crop.xls.CropExcel; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.sysu.admin.controller.crop.xls.CropExcelService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.sysu.admin.controller.crop.xls.PublishCropExcelListener; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.sysu.admin.controller.geo.land.LandTaskStatus; 
														 | 
														
														 | 
														
															 import com.sysu.admin.controller.geo.land.LandTaskStatus; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import com.sysu.admin.support.base.BaseVo; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.sysu.admin.support.base.ServiceContext; 
														 | 
														
														 | 
														
															 import com.sysu.admin.support.base.ServiceContext; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.sysu.admin.support.shiro.ShiroService; 
														 | 
														
														 | 
														
															 import com.sysu.admin.support.shiro.ShiroService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import com.sysu.admin.utils.GenericsUtil; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.sysu.admin.utils.shape.GeoCastUtil; 
														 | 
														
														 | 
														
															 import com.sysu.admin.utils.shape.GeoCastUtil; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.xiesx.fastboot.base.result.BaseResult; 
														 | 
														
														 | 
														
															 import com.xiesx.fastboot.base.result.BaseResult; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.xiesx.fastboot.base.result.R; 
														 | 
														
														 | 
														
															 import com.xiesx.fastboot.base.result.R; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.xiesx.fastboot.utils.CopyUtils; 
														 | 
														
														 | 
														
															 import com.xiesx.fastboot.utils.CopyUtils; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import org.apache.commons.lang3.StringUtils; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.locationtech.jts.geom.MultiPolygon; 
														 | 
														
														 | 
														
															 import org.locationtech.jts.geom.MultiPolygon; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.springframework.beans.BeanUtils; 
														 | 
														
														 | 
														
															 import org.springframework.beans.BeanUtils; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.springframework.beans.factory.annotation.Autowired; 
														 | 
														
														 | 
														
															 import org.springframework.beans.factory.annotation.Autowired; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import org.springframework.data.domain.Sort; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.springframework.stereotype.Controller; 
														 | 
														
														 | 
														
															 import org.springframework.stereotype.Controller; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.springframework.web.bind.annotation.RequestMapping; 
														 | 
														
														 | 
														
															 import org.springframework.web.bind.annotation.RequestMapping; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.springframework.web.bind.annotation.ResponseBody; 
														 | 
														
														 | 
														
															 import org.springframework.web.bind.annotation.ResponseBody; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import org.springframework.web.bind.annotation.RestController; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import javax.servlet.http.HttpServletResponse; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import javax.transaction.Transactional; 
														 | 
														
														 | 
														
															 import javax.transaction.Transactional; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import java.io.IOException; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import java.net.URLEncoder; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import java.nio.file.Path; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import java.util.*; 
														 | 
														
														 | 
														
															 import java.util.*; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import java.util.concurrent.Executor; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import java.util.concurrent.Executors; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 /** 
														 | 
														
														 | 
														
															 /** 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  * 读取地图数据信息 
														 | 
														
														 | 
														
															  * 读取地图数据信息 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -53,6 +47,8 @@ public class CropLandController extends ServiceContext { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     DistrictRepository districtRepository; 
														 | 
														
														 | 
														
															     DistrictRepository districtRepository; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Autowired 
														 | 
														
														 | 
														
															     @Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     CityRepository cityRepository; 
														 | 
														
														 | 
														
															     CityRepository cityRepository; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    CropExcelService cropExcelService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @RequestMapping("/getInfo") 
														 | 
														
														 | 
														
															     @RequestMapping("/getInfo") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @ResponseBody 
														 | 
														
														 | 
														
															     @ResponseBody 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -128,27 +124,52 @@ public class CropLandController extends ServiceContext { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @RequestMapping("/batchPublish") 
														 | 
														
														 | 
														
															     @RequestMapping("/batchPublish") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @ResponseBody 
														 | 
														
														 | 
														
															     @ResponseBody 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Transactional 
														 | 
														
														 | 
														
															     @Transactional 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    public BaseResult batchPublish(CropLandVo vo){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        QCropLand qCropLand = QCropLand.cropLand; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        JPAUpdateClause jpaUpdateClause = mJPAQueryFactory.update(qCropLand); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        jpaUpdateClause.set(qCropLand.status, LandTaskStatus.published.ordinal()); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        jpaUpdateClause.set(qCropLand.updateDate, new Date()); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        Predicate predicate = null; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if(vo.getProvinceId() != null){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            predicate = qCropLand.province.eq(vo.getProvinceId()); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if(vo.getCityId() != null){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            predicate = qCropLand.city.eq(vo.getCityId()).and(predicate); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public BaseResult batchPublish(CropLandVo vo, String fileBase64){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if(StringUtils.isNotBlank(fileBase64)){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            Path path = cityLandService.fileByBase64(fileBase64,"xls",mShiroService.getPrincipalId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            PublishCropExcelListener publishCropExcelListener = new PublishCropExcelListener(mLandRangeIndexService); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            EasyExcel.read(path.toFile(), CropExcel.class,publishCropExcelListener).doReadAllSync(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            Map<String,List<Long>> stringListMap = publishCropExcelListener.getTableIdsMap(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            for(String tableName : stringListMap.keySet()) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                cityLandService.batchPublishByIds(tableName, stringListMap.get(tableName)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        }else{ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if(vo.getDistrictId() != null) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                String tableName = mLandRangeIndexService.getTableNameByCode(vo.getDistrictId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                cityLandService.batchPublishByTableName(tableName); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if(vo.getDistrictId() != null){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            predicate = qCropLand.district.eq(vo.getDistrictId()).and(predicate); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return R.succ(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @RequestMapping("/export_index") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public String exportIndex(){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return "page/export"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @RequestMapping("/export") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @ResponseBody 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @Transactional 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public void export(CropLandVo vo, HttpServletResponse response){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        String tableNames; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if(vo.getDistrictId() == null){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            tableNames = mLandRangeIndexService.getAllTableNames(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        }else{ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            tableNames = mLandRangeIndexService.getTableNameByCode(vo.getDistrictId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if(predicate != null){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            predicate = qCropLand.status.eq(LandTaskStatus.unpublished.ordinal()).and(predicate); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            jpaUpdateClause.where(predicate); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            jpaUpdateClause.execute(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        List<CropLand> cropLandList = cityLandService.findAllByStatusAndDistrict(tableNames, vo.getStatus()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        List<CropExcel> cropExcelList = cropExcelService.cropLandToCropExcel(cropLandList); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        String mimetype = "application/x-msdownload"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        String downFileName = "重庆耕地信息.xlsx"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        String inlineType = "attachment"; // 是否内联附件 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        response.setContentType(mimetype); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        response.setHeader("Content-Disposition", inlineType 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                + ";filename=" + URLEncoder.encode(downFileName)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        try { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            EasyExcel.write(response.getOutputStream(), CropExcel.class).sheet("sheet1").doWrite(cropExcelList); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } catch (IOException e) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            e.printStackTrace(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        return R.succ(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @RequestMapping("/addTest") 
														 | 
														
														 | 
														
															     @RequestMapping("/addTest") 
														 |