Administrator 2 gadi atpakaļ
vecāks
revīzija
caab0e32f9

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

@@ -67,9 +67,9 @@ public class CropLandController extends ServiceContext {
 
     @RequestMapping("/getGeoJson")
     @ResponseBody
-    public BaseResult getGeojson(String tableNames, Double x1, Double y1,Double x2, Double y2){
+    public BaseResult getGeojson(String tableNames, Double x1, Double y1,Double x2, Double y2, String status){
 //        String[] tableNames = mLandRangeIndexService.getTableNames(x1,y1,x2,y2);
-        List<CropPoint> cropLandList = cityLandService.findCropLandNoGeomByTableNamesAndBBox(tableNames, x1,y1,x2,y2);
+        List<CropPoint> cropLandList = cityLandService.findCropLandNoGeomByTableNamesAndBBox(tableNames, x1,y1,x2,y2, status);
         return R.succ(cropLandList);
     }
 

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

@@ -102,10 +102,13 @@ public class CropLandService extends BaseService<CropLand, Long> {
     }
 
     @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 statusString){
         String wkt = bboxToWkt(x1, y1 , x2, y2);
         String sql = " select  "+ CropPoint.selectColumns;
         sql += " from p_crop  where ST_Intersects(geom,st_geomfromtext('"+wkt+"',4326)) ";
+        if(ObjectUtils.isNotEmpty(statusString)){
+            sql += " and \"status\" in ("+statusString+") ";
+        }
         List<CropPoint> cropPointList = mEntityManager.createNativeQuery(sql, CropPoint.class).getResultList();
         return cropPointList;
     }

+ 6 - 6
src/main/java/com/sysu/admin/utils/TextUtil.java

@@ -201,28 +201,28 @@ public class TextUtil {
 		return resArray;
 	}
 
-	public static Long[] splitIds(String text,String regex) {
+	public static Integer[] splitIds(String text,String regex) {
 		int index = 0;
 		if(text == null) {
-			return new Long[0];
+			return new Integer[0];
 		}
 		String[] codeArray = text.split(regex);
 
 		if(text.equals("") || codeArray.length == 0) {
-			return new Long[0];
+			return new Integer[0];
 		}
 
-		Long[] tempArray=new Long[codeArray.length];
+		Integer[] tempArray=new Integer[codeArray.length];
 		for(int i = 0;i < codeArray.length; i++) {
 
 			if(!codeArray[i].trim().equals("")) {
 
-				tempArray[index] = Long.valueOf(codeArray[i]);
+				tempArray[index] = Integer.valueOf(codeArray[i]);
 				index++;
 			}
 
 		}
-		Long[] resArray = new Long[index];
+		Integer[] resArray = new Integer[index];
 		for(int i = 0; i < index; i++) {
 			resArray[i] = tempArray[i];
 		}

+ 10 - 3
src/main/webapp/WEB-INF/jsp/comm/admin2.jsp

@@ -136,7 +136,7 @@
                 };
 
                 var zNodes =[
-                    { id:1, pId:0, name:"耕地地块",icon :"${base}/static/images/cloudy20x20.png", Action: CityLandAction},
+                    <%--{ id:1, pId:0, name:"耕地地块",icon :"${base}/static/images/cloudy20x20.png", Action: CityLandAction},--%>
                     <%--{ id:2, pId:0, name:"作物类型", icon :"${base}/static/images/cloudy20x20.png"},--%>
                     <%--{ id:21, pId:2, name:"种植结构",icon :"${base}/static/images/tree-point.png", Action: QyzAction},--%>
                     <%--{ id:22, pId:2, name:"水稻",icon :"${base}/static/images/tree-point.png"},--%>
@@ -168,6 +168,7 @@
                         }
                     }});
                 geoServerContext.createAction("3", CityAction).start();
+                geoServerContext.createAction("1", CityLandAction).start();
                 $("#gray-shade").hide()
             });
 
@@ -188,14 +189,20 @@
                     <div class="label-bg general-font1 date"><img height="25" width="25" src="${base}/static/images/cloudy1.png" />星期六 2022/08/20</div>
                 </div>
                 <div class="box-center">
-                    <h1 class="general-font2 inline">广东省</h1><h3 class="general-font1 inline">农业专题信息一张图</h3>
+                    <h1 class="general-font2 inline">重庆市</h1><h3 class="general-font1 inline">农业专题信息一张图</h3>
                 </div>
                 <div class="box-right">
-                    <div class="label-bg general-font1 logout-info">
+                    <div class="box-right-item label-bg general-font1 logout-info">
                         <img height="25" width="25" src="${base}/static/images/boy-2.png" />
                             ${user.nickname},
                             <a class="yse-events" href="${base}/logout">退出</a>
                     </div>
+                    <div onmousemove="$('#menu-pop').show()" class="box-right-item label-bg yse-events">
+                        <a class="cursor-default yse-events" >功能</a>
+                        <div id="menu-pop" onmouseout="$(this).hide()" class="menu-pop label-bg yse-events">
+                            <div id="menu-pop-list" class="list"></div>
+                        </div>
+                    </div>
                 </div>
             </div>
             <div class="timeline-box no-events">

+ 33 - 0
src/main/webapp/static/css/admin2.css

@@ -1,4 +1,27 @@
 
+.cursor-default{
+    cursor:default;
+}
+.menu-pop{
+    margin-top:2px;
+    background-color:white;
+    position: absolute;
+    width: 200px;
+    height: 150px;
+    display: none;
+}
+.menu-pop .list{
+    height: 100%;
+    width: 100%;
+}
+.menu-pop .list .item{
+    width: 45%;
+    float: left;
+    margin: 2px;
+    background-color: #5f5d5d;
+    border-radius: 5px;
+}
+
 
 .bottom-map{
     position: absolute;
@@ -32,6 +55,9 @@
     pointer-events: auto;
     color: #e3e306;
 }
+.yse-events:hover{
+    color: #efb403;
+}
 
 .inline{
     display: inline;
@@ -99,6 +125,13 @@
     height: calc(100% - 40px);
 }
 
+.head-box .box-right .box-right-item{
+    float: right;
+    margin-right: 2px;
+    min-width: 40px;
+    text-align: center;
+}
+
 .head-box .box-right .logout-info{
     min-width: 140px;
     float: right;

+ 58 - 4
src/main/webapp/static/package/cityland.js

@@ -18,6 +18,7 @@ CityLandAction.prototype = {
         this.obj.createTileLayer()
         this.tempVectorLayer = this.loadTempVectorLayer()
         this.drawMultiPolygon = new DrawMultiPolygon({vector: this.tempVectorLayer, map: this.context.currentMap,wkt: this.context.wkt})
+        this.selectStatusGroup = new SelectStatusGroup({vector: this.tempVectorLayer, cityLandAction : this})
 
         this.popup = new Popup({map: this.context.currentMap,
             close(){
@@ -49,6 +50,7 @@ CityLandAction.prototype = {
         this.obj.addTileLayer(this.context.currentMap)
         this.context.currentMap.addLayer(this.tempVectorLayer)
         this.drawMultiPolygon.show()
+        this.selectStatusGroup.show()
         this.context.landFilter()
         this.context.getSldStyleSign(this.obj.wmsData.params.STYLE)
         this.startStatus = true;
@@ -64,6 +66,7 @@ CityLandAction.prototype = {
         this.obj.removeTileLayer(this.context.currentMap)
         console.log("drawMultiPolygon close")
         this.drawMultiPolygon.close()
+        this.selectStatusGroup.close()
         console.log("tempVectorLayer cleared")
         this.context.clicks[this.id] = null
         console.log("remove click")
@@ -165,9 +168,11 @@ CityLandAction.prototype = {
                     return;
                 }
                 let typeNames = that.obj.getVisibleLayers()
+                let statusGroupString = that.selectStatusGroup.getStatusGroupString();
                 console.log("typeNames",typeNames)
+                console.log("statusGroup",statusGroupString)
                 const xhr = new XMLHttpRequest();
-                xhr.open('GET', "/crop/getGeoJson?tableNames="+typeNames + "&x1=" + extent[0] + "&y1=" + extent[1]+"&x2=" + extent[2] + "&y2="+extent[3]);
+                xhr.open('GET', "/crop/getGeoJson?tableNames="+typeNames + "&x1=" + extent[0] + "&y1=" + extent[1]+"&x2=" + extent[2] + "&y2="+extent[3] + "&status="+statusGroupString);
                 const onError = function() {
                     vectorSource.removeLoadedExtent(extent);
                     failure();
@@ -278,7 +283,7 @@ function CityLand(opt){
     this.layerData = {
         layer : [],
         source : [],
-        always : false
+        always : true
     }
 }
 
@@ -396,8 +401,8 @@ function DrawMultiPolygon(option){
     this.map = option.map
     this.wkt = option.wkt
     let that = this
-    let html = "<a href='javascript:void(0)' id='drawMultiPolygon' style='color: white;position: absolute;top: 0px;right: 100px;z-index: 10' >绘制多边形</a>";
-    $(document.body).append(html)
+    let html = "<div class='item'><a href='javascript:void(0)' id='drawMultiPolygon' class='yse-events' >绘制多边形</a></div>";
+    $("#menu-pop-list").append(html)
     this.initDraw()
     $("#drawMultiPolygon").on("click",function(){
         that.vector.getSource().clear()
@@ -435,6 +440,55 @@ DrawMultiPolygon.prototype = {
     }
 }
 
+function SelectStatusGroup(option){
+    this.vector = option.vector
+    this.cityLandAction = option.cityLandAction
+    let that = this
+    this.statusGroup = [0,1,2,3]
+    let html = "<div class='item'><input type='checkbox' value='0'  name='layerStatus'  checked=''>未发布的</div>";
+    html += "<div class='item'><input type='checkbox' value='1' name='layerStatus'  checked=''>已发布的</div>";
+    html += "<div class='item'><input type='checkbox' value='3' name='layerStatus'  checked=''>已完成的</div>";
+    $("#menu-pop-list").append(html)
+    $("input[name='layerStatus']").on("click",function(item){
+        that.updateStatusGroup()
+    })
+}
+
+SelectStatusGroup.prototype = {
+    updateStatusGroup(){
+        this.statusGroup = [2]
+        let objs = $("input[name='layerStatus']");
+        for(let obj of objs){
+            if(obj.checked){
+                this.statusGroup.push(obj.value)
+            }
+        }
+        if(this.statusGroup.length == 1){
+            this.vector.setVisible(false)
+        }else{
+            this.vector.setVisible(true)
+            this.cityLandAction.context.landFilter(true)
+        }
+    },
+    getStatusGroupString(){
+        let res = "";
+        for(let i=0;i<this.statusGroup.length;i++){
+            if(i != 0){
+                res+=","
+            }
+            res += this.statusGroup[i];
+        }
+        return res;
+    },
+    show(){
+        $("#menu-pop-list").show()
+    },
+    close(){
+        $("#menu-pop-list").hide()
+    }
+}
+
+
 
 
 

+ 2 - 3
src/main/webapp/static/package/geo_server_context.js

@@ -118,11 +118,10 @@ GeoServerContext.prototype = {
                     html += '</div>'
                 }
                 $("#cutline-items").html(html)
-                console.log($("#cutline-items").html())
             }
         });
     },
-    landFilter(){
+    landFilter(must){
         let that = this
         let bbox = that.currentView.calculateExtent(that.currentMap.getSize());
         $.ajax({
@@ -136,7 +135,7 @@ GeoServerContext.prototype = {
                     if(action && action.obj && action.obj.visibleWMTS){
                         let tableNames = res.data;
                         action.obj.visibleWMTS(tableNames)
-                        if(that.changeBbox(bbox)){
+                        if(must || that.changeBbox(bbox)){
                             that.vectorSwitch = true
                             action.tempVectorLayer.getSource().refresh()
                         }else{