Administrator 2 years ago
parent
commit
bcd77bbb82

+ 2 - 0
src/main/java/com/sysu/admin/controller/crop/CropLandVo.java

@@ -64,6 +64,8 @@ public class CropLandVo{
     private String name;
     private String address;
 
+    private String fileBase64;
+
 
 
 

+ 8 - 37
src/main/java/com/sysu/admin/site/SiteCropLandController.java

@@ -64,8 +64,8 @@ public class SiteCropLandController extends ServiceContext {
 
     @RequestMapping("/getInfo")
     @ResponseBody
-    public BaseResult getInfo(Double x, Double y){
-        CropLand cityLand = cityLandService.findByPoint(new Double[]{x,y});
+    public BaseResult getInfo(@RequestBody CommonVo commonVo){
+        CropLand cityLand = cityLandService.findByPoint(new Double[]{commonVo.getX1(), commonVo.getY1()});
         if(cityLand == null){
             return R.fail();
         }
@@ -81,30 +81,6 @@ public class SiteCropLandController extends ServiceContext {
         return R.succ(cropLandList);
     }
 
-    @RequestMapping("/getBuffer")
-    @ResponseBody
-    public BaseResult getBuffer(Double x, Double y, Integer m){
-        return R.succ(cityLandService.getBuffer(new Double[]{x, y}, m));
-    }
-
-    @RequestMapping("/save")
-    @ResponseBody
-    public BaseResult save(CropLandVo vo){
-        CropLand bean = cityLandService.findOne(vo.getId());
-        if(bean.getStatus().intValue() == LandTaskStatus.unpublished.ordinal()){
-            bean.setCreator(shiroService.getPrincipalId());
-            bean.setCreateDate(new Date());
-        }
-        BeanUtils.copyProperties(vo, bean, CopyUtils.nullNames(vo));
-        bean.setWkt(GeoCastUtil.geomToWkt(bean.getGeom()));
-        bean.setCenterPoint(cityLandService.getCenterPoint(bean.getGeom()));
-        District district = districtRepository.findByPoint(bean.getCenterPoint());
-        if(district != null){
-            cityLandService.setCity(bean, district);
-        }
-        cityLandService.save(bean);
-        return R.succ(bean);
-    }
 
     @RequestMapping("/publish")
     @ResponseBody
@@ -126,19 +102,12 @@ public class SiteCropLandController extends ServiceContext {
         return R.succ();
     }
 
-
-
-    @RequestMapping("/publish_index")
-    public String publishIndex(){
-        return "page/publish_task";
-    }
-
     @RequestMapping("/batchPublish")
     @ResponseBody
     @Transactional
-    public BaseResult batchPublish(CropLandVo vo, String fileBase64){
-        if(StringUtils.isNotBlank(fileBase64)){
-            Path path = cityLandService.fileByBase64(fileBase64,"xls",mShiroService.getPrincipalId());
+    public BaseResult batchPublish(@RequestBody CropLandVo vo){
+        if(StringUtils.isNotBlank(vo.getFileBase64())){
+            Path path = cityLandService.fileByBase64(vo.getFileBase64(),"xls",mShiroService.getPrincipalId());
             PublishCropExcelListener publishCropExcelListener = new PublishCropExcelListener(mLandRangeIndexService);
             EasyExcel.read(path.toFile(), CropExcel.class,publishCropExcelListener).doReadAllSync();
             Map<String,List<Long>> stringListMap = publishCropExcelListener.getTableIdsMap();
@@ -149,6 +118,8 @@ public class SiteCropLandController extends ServiceContext {
             if(vo.getDistrictId() != null) {
                 String tableName = mLandRangeIndexService.getTableNameByCode(vo.getDistrictId());
                 cityLandService.batchPublishByTableName(tableName);
+            }else{
+                return R.fail("请选择区县!");
             }
         }
         return R.succ();
@@ -162,7 +133,7 @@ public class SiteCropLandController extends ServiceContext {
     @RequestMapping("/export")
     @ResponseBody
     @Transactional
-    public void export(CropLandVo vo, HttpServletResponse response){
+    public void export(@RequestBody CropLandVo vo, HttpServletResponse response){
         String tableNames;
         if(vo.getDistrictId() == null){
             tableNames = mLandRangeIndexService.getAllTableNames();