Administrator 2 роки тому
батько
коміт
3a6a01a487

+ 1 - 0
src/main/java/com/sysu/admin/api/crop/CropVo.java

@@ -37,6 +37,7 @@ public class CropVo {
     private String desc;
     private String name;
     private String address;
+    private Integer confirm;
 
     @NotNull(message = "token为空!", groups = {ApiReqValid.TokenCheckValid.class})
     private String token;

+ 3 - 0
src/main/java/com/sysu/admin/controller/crop/CropLand.java

@@ -107,6 +107,9 @@ public class CropLand {
     @Column
     private Integer status;
 
+    @Column
+    private Integer confirm;
+
     /**
      * 描述
      */

+ 54 - 33
src/main/java/com/sysu/admin/controller/crop/CropLandController.java

@@ -1,40 +1,34 @@
 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.dsl.BooleanExpression;
-import com.querydsl.core.types.dsl.PathBuilder;
 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.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.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.support.base.BaseVo;
 import com.sysu.admin.support.base.ServiceContext;
 import com.sysu.admin.support.shiro.ShiroService;
-import com.sysu.admin.utils.GenericsUtil;
 import com.sysu.admin.utils.shape.GeoCastUtil;
 import com.xiesx.fastboot.base.result.BaseResult;
 import com.xiesx.fastboot.base.result.R;
 import com.xiesx.fastboot.utils.CopyUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.locationtech.jts.geom.MultiPolygon;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Sort;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletResponse;
 import javax.transaction.Transactional;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.nio.file.Path;
 import java.util.*;
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
 
 /**
  * 读取地图数据信息
@@ -53,6 +47,8 @@ public class CropLandController extends ServiceContext {
     DistrictRepository districtRepository;
     @Autowired
     CityRepository cityRepository;
+    @Autowired
+    CropExcelService cropExcelService;
 
     @RequestMapping("/getInfo")
     @ResponseBody
@@ -128,27 +124,52 @@ public class CropLandController extends ServiceContext {
     @RequestMapping("/batchPublish")
     @ResponseBody
     @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")

+ 66 - 1
src/main/java/com/sysu/admin/controller/crop/CropLandService.java

@@ -1,10 +1,12 @@
 package com.sysu.admin.controller.crop;
 
 import com.mysql.jdbc.StringUtils;
+import com.querydsl.core.types.Predicate;
 import com.querydsl.core.types.Projections;
 import com.querydsl.core.types.QBean;
 import com.querydsl.core.types.QList;
 import com.querydsl.jpa.impl.JPAQuery;
+import com.querydsl.jpa.impl.JPAUpdateClause;
 import com.sysu.admin.controller.city.*;
 import com.sysu.admin.controller.crop.executor_table.ExecutorTable;
 import com.sysu.admin.controller.crop.executor_table.ExecutorTableService;
@@ -38,6 +40,7 @@ import javax.transaction.Transactional;
 import java.io.File;
 import java.io.IOException;
 import java.nio.file.Files;
+import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.nio.file.StandardOpenOption;
 import java.util.*;
@@ -83,7 +86,7 @@ public class CropLandService extends BaseService<CropLand, Long> {
 
     @DynamicTableNames(executor = "executor")
     public List<CropLand> findIdAndNameByExecutor(Long executor){
-        Query query =mEntityManager.createQuery("select c.id,c.name,c.updateDate from CropLand c where c.executor = " + executor);
+        Query query =mEntityManager.createQuery("select c.id,c.name,c.updateDate,c.confirm from CropLand c where c.executor = " + executor);
         return query.getResultList();
     }
 
@@ -157,6 +160,42 @@ public class CropLandService extends BaseService<CropLand, Long> {
         }
     }
 
+    @DynamicTableNames(value = "tableName")
+    public void batchPublishByIds(String tableName, List<Long> ids){
+        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(ObjectUtils.isNotEmpty(ids)){
+            predicate = qCropLand.id.in(ids);
+        }
+        if(predicate != null){
+            predicate = qCropLand.status.eq(LandTaskStatus.unpublished.ordinal()).and(predicate);
+            jpaUpdateClause.where(predicate);
+            jpaUpdateClause.execute();
+        }
+    }
+
+    @DynamicTableNames(value = "tableName")
+    public void batchPublishByTableName(String tableName){
+        QCropLand qCropLand = QCropLand.cropLand;
+        JPAUpdateClause jpaUpdateClause = mJPAQueryFactory.update(qCropLand);
+        jpaUpdateClause.set(qCropLand.status, LandTaskStatus.published.ordinal());
+        jpaUpdateClause.set(qCropLand.updateDate, new Date());
+        if(tableName != null){
+            Predicate predicate = qCropLand.status.eq(LandTaskStatus.unpublished.ordinal());
+            jpaUpdateClause.where(predicate);
+            jpaUpdateClause.execute();
+        }
+    }
+
+    @DynamicTableNames(value = "tableNames")
+    public List<CropLand> findAllByStatusAndDistrict(String tableNames, Integer status){
+        Query query =mEntityManager.createQuery("select c.id,c.name,c.address,c.desc,c.growingPeriod,c.district,c.cropType from CropLand c where c.status = " + status);
+        return query.getResultList();
+    }
+
     /**
      * 把base64转化为文件.
      *
@@ -182,6 +221,32 @@ public class CropLandService extends BaseService<CropLand, Long> {
         return newFileName;
     }
 
+    /**
+     * 把base64转化为文件.
+     *
+     * @param base64   base64
+     * @return boolean isTrue
+     */
+    public Path fileByBase64(String base64, String sign, Long userId) {
+        if (StringUtils.isNullOrEmpty(base64)) {
+            return null;
+        }
+        int index = base64.indexOf(",");
+        if(index > -1){
+            base64 = base64.substring(index + 1);
+        }
+        String imageDirPath = configContext.getImageDirPath();
+        String newFileName = System.currentTimeMillis() + "_" + userId+"_"+sign;
+        Path path = null;
+        try {
+            path = Files.write(Paths.get(imageDirPath+ newFileName),
+                    Base64.decodeBase64(base64), StandardOpenOption.CREATE);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return path;
+    }
+
 
     public static String bboxToWkt(Double x1, Double y1, Double x2, Double y2){
         return "POLYGON (("+x1+" "+y1+", "+x1+" "+y2+", "+x2+" "+y2+", "+x2+" "+y1+", "+x1+" "+y1+"))";

+ 1 - 1
src/main/java/com/sysu/admin/controller/crop/CropPointRepository.java

@@ -11,7 +11,7 @@ public interface CropPointRepository extends JpaPlusRepository<CropPoint, Long>
 
     @Query(value = "select id,gridcode,crop_type,st_asgeojson(center_point) as geojson,status,receiver,name,address,growing_period from p_crop where status in ?3 and St_within(center_point," +
             " ST_Buffer(st_geomfromtext(?1,4326),?2, 'quad_segs=8')" +
-            ");",nativeQuery = true)
+            ") limit 50",nativeQuery = true)
     List<CropPoint> findByBufferAndStatus(String pointWKT, Double degree, Integer[] status);
 
 

+ 3 - 0
src/main/java/com/sysu/admin/controller/crop/range/LandRangeIndexRepository.java

@@ -23,4 +23,7 @@ public interface LandRangeIndexRepository extends JpaPlusRepository<LandRangeInd
             ",geom);",nativeQuery = true)
     String[] findTableNameByWkt(String wkt);
 
+    @Query(value = "SELECT table_name from p_land_range_index;",nativeQuery = true)
+    String[] findAllTableName();
+
 }

+ 23 - 3
src/main/java/com/sysu/admin/controller/crop/range/LandRangeIndexService.java

@@ -33,16 +33,24 @@ public class LandRangeIndexService extends BaseService<LandRangeIndex, PKRP> {
     }
 
     public String getTableName(Long id){
+        return getByCropId(id).getTableName();
+    }
+
+    public LandRangeIndex getByCropId(Long id){
         if(id == null){
-            return null;
+            throw new NullPointerException("getByCropId(id) id is null");
         }
         QLandRangeIndex qLandRangeIndex = QLandRangeIndex.landRangeIndex;
         Predicate predicate = qLandRangeIndex.pk.start.loe(id).and(qLandRangeIndex.pk.end.goe(id));
         Optional<LandRangeIndex>  landRangeIndex = mLandRangeIndexRepository.findOne(predicate);
         if(landRangeIndex.isPresent()){
-            return landRangeIndex.get().getTableName();
+            return landRangeIndex.get();
         }
-        return defaultTableName;
+        LandRangeIndex res = new LandRangeIndex();
+        res.setPk(new PKRP().end(0L).start(0L));
+        res.setName("其他地区");
+        res.setTableName(defaultTableName);
+        return res;
     }
 
     public String getTableNameByCode(Integer code){
@@ -58,6 +66,18 @@ public class LandRangeIndexService extends BaseService<LandRangeIndex, PKRP> {
         return mLandRangeIndexRepository.findTableNameByPoint("Point("+point[0]+" "+point[1]+")");
     }
 
+    public String getAllTableNames(){
+        String[] resArray = mLandRangeIndexRepository.findAllTableName();
+        StringBuffer res = new StringBuffer(resArray.length * 15);
+        for(int i=0;i<resArray.length;i++){
+            if(i > 0){
+                res.append(",");
+            }
+            res.append(resArray[i]);
+        }
+        return res.toString();
+    }
+
 
 
     @Override

+ 52 - 0
src/main/java/com/sysu/admin/controller/crop/xls/CropExcelService.java

@@ -0,0 +1,52 @@
+package com.sysu.admin.controller.crop.xls;
+
+import com.sysu.admin.controller.city.DistrictRepository;
+import com.sysu.admin.controller.crop.CropLand;
+import com.sysu.admin.controller.crop.class_item.CropClassItem;
+import com.sysu.admin.controller.crop.class_item.CropItemService;
+import com.sysu.admin.controller.crop.period.CropPeriod;
+import com.sysu.admin.controller.crop.period.CropPeriodService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.transaction.Transactional;
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class CropExcelService {
+
+    @Autowired
+    private CropItemService cropItemService;
+    @Autowired
+    private DistrictRepository districtRepository;
+    @Autowired
+    private CropPeriodService cropPeriodService;
+
+    @Transactional()
+    public List<CropExcel> cropLandToCropExcel(List<CropLand> cropLandList){
+        List<CropExcel> res = new ArrayList<>(cropLandList.size());
+        for(CropLand cropLand : cropLandList){
+            CropExcel cropExcel = new CropExcel();
+            cropExcel.setId(cropLand.getId());
+            cropExcel.setName(cropLand.getName());
+            cropExcel.setAddress(cropLand.getAddress());
+            if(cropLand.getCropType() != null) {
+                CropClassItem cropClassItem = cropItemService.findOne(cropLand.getCropType());
+                cropExcel.setCropType(cropClassItem != null ? null : cropClassItem.getName());
+            }
+
+            cropExcel.setDistrict(districtRepository.findByCode(cropLand.getDistrict().intValue()).getName());
+
+            if(cropLand.getGrowingPeriod() != null) {
+                CropPeriod cropPeriod = cropPeriodService.findOne(cropLand.getGrowingPeriod());
+                cropExcel.setGrowingPeriod(cropPeriod == null ? null : cropPeriod.getName());
+            }
+            cropExcel.setDesc(cropLand.getDesc());
+            res.add(cropExcel);
+        }
+        return res;
+    }
+
+
+}

+ 58 - 0
src/main/java/com/sysu/admin/controller/crop/xls/PublishCropExcelListener.java

@@ -0,0 +1,58 @@
+package com.sysu.admin.controller.crop.xls;
+
+import com.alibaba.excel.context.AnalysisContext;
+import com.alibaba.excel.event.AnalysisEventListener;
+import com.sysu.admin.controller.crop.range.LandRangeIndex;
+import com.sysu.admin.controller.crop.range.LandRangeIndexService;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class PublishCropExcelListener extends AnalysisEventListener<CropExcel> {
+
+    public PublishCropExcelListener(LandRangeIndexService landRangeIndexService){
+        this.landRangeIndexService = landRangeIndexService;
+    }
+
+    private LandRangeIndexService landRangeIndexService;
+    private Map<String,List<Long>> tableIdsMap = new HashMap<>();
+    private List<LandRangeIndex> rangeIndexList = new ArrayList<>();
+
+    public  Map<String,List<Long>> getTableIdsMap(){
+        return tableIdsMap;
+    }
+
+    @Override
+    public void invoke(CropExcel publishCropExcel, AnalysisContext analysisContext) {
+        if(publishCropExcel.getId() != null) {
+            String tableName = getTableName(publishCropExcel.getId());
+            addId(tableName, publishCropExcel.getId());
+        }
+    }
+
+    private void addId(String tableName, Long id){
+        List<Long> ids = tableIdsMap.get(tableName);
+        if(ids == null){
+            ids = new ArrayList<>();
+            tableIdsMap.put(tableName, ids);
+        }
+        ids.add(id);
+    }
+
+    private String getTableName(Long id){
+        for(LandRangeIndex landRangeIndex : rangeIndexList){
+            if(landRangeIndex.getPk().start() <= id && landRangeIndex.getPk().end() >= id){
+                return landRangeIndex.getTableName();
+            }
+        }
+        LandRangeIndex landRangeIndex = landRangeIndexService.getByCropId(id);
+        rangeIndexList.add(landRangeIndex);
+        return landRangeIndex.getTableName();
+    }
+
+    @Override
+    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
+    }
+}

+ 1 - 1
src/main/resources/application.yml

@@ -7,7 +7,7 @@ jsp-servlet:
 spring:
   profiles:
     # 激活:本地 dev、后台 adm。服务api
-    active: dev
+    active: adm
   mvc:
     view:
       prefix: /WEB-INF/jsp/

+ 2 - 1
src/main/webapp/WEB-INF/jsp/comm/admin2.jsp

@@ -35,6 +35,7 @@
     <fb:script src="${base}/static/package/task_action.js"></fb:script>
     <fb:script src="${base}/static/package/style.js"></fb:script>
     <fb:script src="${base}/static/package/publish_task_action.js"></fb:script>
+    <fb:script src="${base}/static/package/export_action.js"></fb:script>
 
 
     <fb:script type="text/javascript">
@@ -147,7 +148,7 @@
                     <%--{ id:32, pId:3, status:2, name:"已接受的",icon :"${base}/static/images/cloudy20x20.png", Action:TaskLandAction},--%>
                     <%--{ id:33, pId:3, status:3, name:"已完成的",icon :"${base}/static/images/cloudy20x20.png", Action:TaskLandAction},--%>
                     { id:34, pId:0, name:"批量发布",icon :"${base}/static/images/cloudy20x20.png", Action: PublishTaskAction},
-                    { id:4, pId:0, name:"批量下载",icon :"${base}/static/images/cloudy20x20.png", Action: PublishTaskAction},
+                    { id:4, pId:0, name:"批量导出",icon :"${base}/static/images/cloudy20x20.png", Action: ExportAction},
                     <%--{ id:5, pId:0, name:"农业灾害风险",icon :"${base}/static/images/cloudy20x20.png"},--%>
                     <%--{ id:6, pId:0, name:"土壤要素",icon :"${base}/static/images/cloudy20x20.png"},--%>
                     <%--{ id:7, pId:0, name:"适应性评估",icon :"${base}/static/images/cloudy20x20.png"}--%>

+ 45 - 0
src/main/webapp/WEB-INF/jsp/page/export.jsp

@@ -0,0 +1,45 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8" trimDirectiveWhitespaces="true"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fastboot" prefix="fb"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+<%@ taglib uri="http://shiro.apache.org/tags" prefix="shiro"%>
+<fb:ui src="base/main">
+    <fb:property name="title">批量发布任务</fb:property>
+    <fb:css href="${base}/static/js/city-picker/city-picker.css"></fb:css>
+    <fb:script src="${base}/static/js/city-picker/city-picker.data.js"></fb:script>
+    <fb:script type="text/javascript">
+        <script>
+            layui.use([ 'tool', 'form', 'city' ], function() {
+                var $ = layui.$, tool = layui.tool, form = layui.form, city= layui.city;
+                let currentPicker = new city("#city-picker", {
+                    getValListener: function(item){}});
+            });
+            function exportCrop(){
+                let data = $("#form1").serializeArray();
+                console.log(data)
+                let src = '${base}/crop/export?';
+                for(let item of data){
+                    src += item.name + "=" + item.value + "&"
+                }
+                window.open(src)
+            }
+        </script>
+
+    </fb:script>
+    <fb:layout>
+        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
+            <legend>导出耕地信息</legend>
+        </fieldset>
+        <form class="layui-form" id="form1" action="">
+            <div class="layui-form-item">
+                <div class="layui-inline">
+                    <label class="layui-form-label">地区</label>
+                    <div class="layui-input-inline">
+                        <input  id="city-picker"    class="layui-input">
+                    </div>
+                </div>
+            </div>
+            <input type="hidden" name="status" value="3" />
+            <input type="button" onclick="exportCrop()" id="submit" style="display: none"  />
+        </form>
+    </fb:layout>
+</fb:ui>

+ 37 - 31
src/main/webapp/WEB-INF/jsp/page/publish_task.jsp

@@ -14,9 +14,14 @@
                 let currentPicker = new city("#city-picker", {
                     getValListener: function(item){}});
                 document.getElementById("file").onchange = function(){
-                    var blob = document.getElementById("file").files[0];
-                    console.log(blob)
+                    let blob = document.getElementById("file").files[0];
                     $("#filename").val(blob.name)
+                    let reader = new FileReader();
+                    reader.readAsDataURL(blob);
+                    reader.onload = function(){
+                        console.log(reader.result); //获取到base64格式图片
+                        $("#fileBase64").val(reader.result)
+                    };
                 }
 
                 $("#select").on("click",function(){
@@ -25,25 +30,26 @@
                 $("#clean").on("click",function(){
                     document.getElementById("file").value = ""
                     $("#filename").val("")
+                    $("#fileBase64").val("")
                 })
 
-                tool.loadSelect("${base}/crop_class/list",{
-                    id:"cropClassId",
-                    data: {},
-                    valueField: 'id',
-                    textField: 'name',
-                    defaultOption:'<option value="">请选择分类</option>'
-                })
+                <%--tool.loadSelect("${base}/crop_class/list",{--%>
+                <%--    id:"cropClassId",--%>
+                <%--    data: {},--%>
+                <%--    valueField: 'id',--%>
+                <%--    textField: 'name',--%>
+                <%--    defaultOption:'<option value="">请选择分类</option>'--%>
+                <%--})--%>
 
-                form.on('select(cropClassId)', function (data) {
-                    tool.loadSelect("${base}/crop_item/list",{
-                        id:"cropItemId",
-                        data: {classId: data.value},
-                        valueField: 'id',
-                        textField: 'name',
-                        defaultOption:'<option value="">请选择作物</option>'
-                    })
-                });
+                <%--form.on('select(cropClassId)', function (data) {--%>
+                <%--    tool.loadSelect("${base}/crop_item/list",{--%>
+                <%--        id:"cropItemId",--%>
+                <%--        data: {classId: data.value},--%>
+                <%--        valueField: 'id',--%>
+                <%--        textField: 'name',--%>
+                <%--        defaultOption:'<option value="">请选择作物</option>'--%>
+                <%--    })--%>
+                <%--});--%>
             });
             function publish(){
                 let data = $("#form1").serializeArray();
@@ -65,17 +71,17 @@
                     </div>
                 </div>
             </div>
-            <div class="layui-form-item">
-                <label class="layui-form-label">作物种类</label>
-                <div class="layui-input-inline">
-                    <select lay-filter="cropClassId" id="cropClassId" name="cropClassId">
-                    </select>
-                </div>
-                <div class="layui-input-inline">
-                    <select id="cropItemId" name="cropItemId">
-                    </select>
-                </div>
-            </div>
+<%--            <div class="layui-form-item">--%>
+<%--                <label class="layui-form-label">作物种类</label>--%>
+<%--                <div class="layui-input-inline">--%>
+<%--                    <select lay-filter="cropClassId" id="cropClassId" name="cropClassId">--%>
+<%--                    </select>--%>
+<%--                </div>--%>
+<%--                <div class="layui-input-inline">--%>
+<%--                    <select id="cropItemId" name="cropItemId">--%>
+<%--                    </select>--%>
+<%--                </div>--%>
+<%--            </div>--%>
 
             <div class="layui-form-item">
                 <div class="layui-inline">
@@ -91,8 +97,8 @@
                     </div>
                 </div>
             </div>
-
-            <input type="file" id="file" style="display: none"  />
+            <input type="hidden" id="fileBase64" name="fileBase64"   />
+            <input type="file" id="file"  style="display: none"  />
             <input type="button" onclick="publish()" id="submit" style="display: none"  />
         </form>
     </fb:layout>

+ 1 - 1
src/main/webapp/static/package/cityland.js

@@ -299,7 +299,7 @@ CityLand.prototype = {
     layerNames:['wuhan:p_land_banan','wuhan:p_land_beibei','wuhan:p_land_bishan','wuhan:p_land_changshou','wuhan:p_land_chengkou','wuhan:p_land_dadukou','wuhan:p_land_dazu','wuhan:p_land_dianjiang','wuhan:p_land_fengdu','wuhan:p_land_fengjie','wuhan:p_land_fuling','wuhan:p_land_hechuan','wuhan:p_land_jiangbei','wuhan:p_land_jiangjin','wuhan:p_land_jiulongpo','wuhan:p_land_kaizhou','wuhan:p_land_liangping','wuhan:p_land_nanan','wuhan:p_land_nanchuan','wuhan:p_land_pengshui','wuhan:p_land_qianjiang','wuhan:p_land_qijiang','wuhan:p_land_qiuyang','wuhan:p_land_rongchang','wuhan:p_land_shapingba','wuhan:p_land_shizhu','wuhan:p_land_tongliang','wuhan:p_land_tongnan','wuhan:p_land_wanzhou','wuhan:p_land_wulong','wuhan:p_land_wushan','wuhan:p_land_wuxi','wuhan:p_land_xiushan','wuhan:p_land_yongchuan','wuhan:p_land_yubei','wuhan:p_land_yunyang','wuhan:p_land_yuzhong','wuhan:p_land_zhong','wuhan:p_crop'],
     createTileLayer(){
         for(let layer of this.layerNames){
-            this.getWMS(layer)
+            this.getWMTS(layer)
         }
     },
     addTileLayer(map){

+ 27 - 0
src/main/webapp/static/package/export_action.js

@@ -0,0 +1,27 @@
+function ExportAction(context, id){
+    this.context = context
+    this.id = id
+}
+
+ExportAction.prototype = {
+    startStatus : false,
+    create(){
+
+    },
+    start(){
+        layui.tool.dialog2("/crop/export_index","40%","70%",{buttons:["导出","取消"],funs:[
+            function(index) {
+                    let iframeBody = parent.layer.getChildFrame('body', index);
+                    iframeBody.find('#submit').click();
+            }]})
+        this.startStatus = true;
+    },
+    stop(){
+        if(!this.startStatus){
+            console.log("startStatus is false")
+            return
+        }
+        console.log("remove click")
+        this.startStatus = false;
+    }
+}

+ 3 - 1
src/test/java/com/sysu/admin/utils/shape/postgis/Main.java

@@ -13,7 +13,9 @@ public class Main {
 //        postGisUtilTest.layers();
 //        postGisUtilTest.updateCenterPoint();
 //        postGisUtilTest.updateSrid();
-        postGisUtilTest.ST_Extent();
+//        postGisUtilTest.ST_Extent();
+//        postGisUtilTest.createIndex();
+        postGisUtilTest.createCOLUMN();
 
     }
 }

+ 16 - 0
src/test/java/com/sysu/admin/utils/shape/postgis/PostGisUtilTest.java

@@ -157,6 +157,22 @@ public class PostGisUtilTest extends BaseTest {
         }
     }
 
+    public void createIndex(){
+        for(String tableName : getTableNames()) {
+            System.out.println("CREATE INDEX IF NOT EXISTS "+tableName+"_status_index ON public."+tableName+" USING hash(status) TABLESPACE pg_default;");
+        }
+    }
+
+
+    public void createCOLUMN(){
+        for(String tableName : getTableNames()) {
+            System.out.println("ALTER TABLE IF EXISTS public."+tableName+" ADD COLUMN confirm integer;");
+        }
+    }
+
+
+
+