Browse Source

git-svn-id: https://192.168.57.71/svn/qt@47 12fe181a-e57f-b044-8676-16dc139aa63e

ld_zhoutl 9 năm trước cách đây
mục cha
commit
e1b416f2f8

+ 34 - 2
jdc/jdcweb/trunk/src/main/java/com/jsjty/jdc/web/basic/ctl/BasicDataCtl.java

@@ -4,11 +4,13 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 
+import com.jsjty.jdc.common.Constants;
 import com.jsjty.jdc.util.Tree;
 import com.jsjty.jdc.web.basic.entity.TJdcBw;
 import com.jsjty.jdc.web.basic.entity.TJdcGk;
@@ -17,6 +19,12 @@ import com.jsjty.jdc.web.basic.entity.TbasicInfo;
 import com.jsjty.jdc.web.basic.entity.TdetailRailstation;
 import com.jsjty.jdc.web.basic.entity.TeventInfo;
 import com.jsjty.jdc.web.basic.service.BasicDataService;
+import com.jsjty.jdc.web.command.entity.Resource;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.GeometryFactory;
+import com.vividsolutions.jts.geom.LineString;
+import com.vividsolutions.jts.geom.PrecisionModel;
 import com.xtframe.util.StringUtils;
 
 /**
@@ -27,6 +35,8 @@ public class BasicDataCtl {
 
     @Autowired
     private BasicDataService basicDataService;
+    
+    private GeometryFactory geometryFactory = new GeometryFactory(new PrecisionModel(), 4326);
 
     @RequestMapping("/basicInfo")
     @ResponseBody
@@ -36,8 +46,30 @@ public class BasicDataCtl {
 
     @RequestMapping("/eventInfo")
     @ResponseBody
-    public List<TeventInfo> eventInfo(String type){
-        return basicDataService.findEventByType(type);
+    public List<TeventInfo> eventInfo(String type, String lonlatStr){
+    	List<TeventInfo> eventList = basicDataService.findEventByType(type);
+    	if(StringUtils.isNotEmpty(lonlatStr)) {
+	    	List<TeventInfo> retList = new ArrayList<TeventInfo>();
+	        String[] para = lonlatStr.split(";");
+	    	Coordinate[] coordinates = new Coordinate[para.length];
+	        for (int i = 0; i < para.length; i++) {
+	            String[] p = para[i].split(",");
+	            coordinates[i] = new Coordinate(Double.parseDouble(p[0]), Double.parseDouble(p[1]));
+	        }
+	        LineString line = new GeometryFactory().createLineString(coordinates);
+	        Geometry geometry = line.buffer(Constants.DIST_RANGE);
+	    	for (TeventInfo f : eventList) {
+	    		if(null == f.getLon() || null == f.getLat()) {
+	    			continue;
+	    		}
+	            if (geometry.contains(geometryFactory.createPoint(new Coordinate(f.getLon(), f.getLat())))) {
+	            	retList.add(f);
+	            }
+	        }
+	        return retList;
+    	} else {
+    		return eventList;
+    	}
     }
 
     @RequestMapping("/gangqubygk")

+ 2 - 2
jdc/jdcweb/trunk/src/main/java/com/jsjty/jdc/web/sys/terminal/service/impl/TerminalServiceImpl.java

@@ -74,7 +74,7 @@ public class TerminalServiceImpl implements TerminalService {
         Map<String, Object> params = new HashMap<>();
         String strSql = "select a.lon,a.lat,a.updtime time "
                 + " from t_jdc_terminal_trail a "
-                + " where a.device_id = "+deviceId
+                + " where a.device_id = '"+deviceId+"'"
                 + " and a.recvdate >= curdate()"
                 + " order by a.updtime desc";
         List<Map<String, Object>> mapList = template.queryForList(strSql, params);
@@ -92,7 +92,7 @@ public class TerminalServiceImpl implements TerminalService {
         Map<String, Object> params = new HashMap<>();
         String strSql = "select a.lon,a.lat,a.updtime time "
                 + " from t_jdc_terminal_trail a "
-                + " where a.user_id = "+deviceId
+                + " where a.user_id = '"+deviceId+"'"
                 + " and a.recvdate > '"+execTime+"'";
         if(StringUtils.isNotEmpty(finishTime)) {
         	strSql += " and a.recvdate < '"+finishTime+"'";

+ 2 - 2
jdc/jdcweb/trunk/src/main/webapp/WEB-INF/view/sys/airCamera.jsp

@@ -72,10 +72,10 @@
 	<div class="easyui-layout" style="width: 100%; height: 100%;">
 		<div data-options="region:'east',split:true" title=" " style="width: 320px;">
 			<div id="accDiv" class="easyui-accordion" data-options="fit:true,border:false">
-				<div title="视频监控列表" data-options="selected:true,collapsible:true" style="padding: 10px;">
+				<div title="视频监控列表" data-options="selected:true,collapsible:true" style="padding: 10px;width: 320px;">
 					<ul id="cameraTree" class="easyui-tree"></ul>
 				</div>
-				<div title="视频监控列表筛选" data-options="collapsible:true" style="padding: 10px;">
+				<div title="视频监控列表筛选" data-options="collapsible:true" style="padding: 10px;width: 320px;">
 					<table style="width: 300px;">
 						<tr>
 							<td style="width: 120px;">所属地区</td>

+ 19 - 2
jdc/jdcweb/trunk/src/main/webapp/static/xt/js/sys/basic_info.js

@@ -1328,12 +1328,29 @@ function showFjcwt(xingh) {
  */
 function initEventInfoEvent(basicType) {
     var targetMarkerLayer;
-    if (basicType == "tfsjchk") {
+    if (basicType == tc_tfsjchk) {
         targetMarkerLayer = tfsjMarkerlayer;
     } else {
         targetMarkerLayer = glyhMarkerlayer;
     }
-    $.get(basePath + "/eventInfo", {type: basicType}, function (result) {
+    var lonlatStr = "";
+	if(nullToEmpty(roadId) != "") {
+    	var selectFeature1 = getRoadFeature(roadId);
+    	if(null != selectFeature1) {
+    		var components = selectFeature1.geometry.components;
+    		for(var i=0;i<components.length;i++) {
+    			if(typeof(components[i].components) != "undefined") {
+    				for(var j=0;j<components[i].components.length;j++) {
+    					var childComponents = components[i].components[j];
+            			lonlatStr += childComponents.x +","+childComponents.y +";";
+            		}
+    			} else {
+    				lonlatStr += components[i].x +","+components[i].y +";";
+    			}
+    		}
+    	}
+	}
+	$.post(basePath + "/eventInfo", {type: basicType, lonlatStr:lonlatStr}, function (result) {
         var len = result.length;
         targetMarkerLayer.clearMarkers();
         for (var i = 0; i < len; i++) {

+ 21 - 3
jdc/jdcweb/trunk/src/main/webapp/static/xt/js/sys/common_road.js

@@ -379,6 +379,16 @@ function setRoadRel() {
         targetlayer.clearMarkers();
         initRoadBasicInfoEvent(tc_camera, basicType);
     }
+    if($("#"+tc_tfsjchk).prop("checked")==true) {
+        var targetlayer = tfsjMarkerlayer;
+        targetlayer.clearMarkers();
+        initEventInfoEvent(tc_tfsjchk);
+    }
+    if($("#"+tc_yhsgchk).prop("checked")==true) {
+        var targetlayer = glyhMarkerlayer;
+        targetlayer.clearMarkers();
+        initEventInfoEvent(tc_yhsgchk);
+    }
 }
 
 function showRoadList() {
@@ -458,12 +468,20 @@ function getRoadInfoContent(attr) {
     itemdir += $.formatString('<div class="item"> <div class="header">公路终点:{0}</div></div>', attr["zd"]);
     itemdir += $.formatString('<div class="item"> <div class="header">途径地区:{0}</div></div>', attr["tjdq"]);
     itemdir += $.formatString('<div class="speratelineDiv"></div>');
-    itemdir += $.formatString('<div class="item"><div class="header" align="center">' +
-            '<a class="aline" href="#" onclick="showRoadCameras(\'{0}\',\'{1}\')">视频监控</a> </div></div>', attr["name"], attr["mc"]);
+//    itemdir += $.formatString('<div class="item"><div class="header" align="center">' +
+//            '<a class="aline" href="#" onclick="showRoadCameras(\'{0}\',\'{1}\')">视频监控</a> </div></div>', attr["name"], attr["mc"]);
+	itemdir += $.formatString('<div class="item"><div class="header" align="center">' +
+			'<a class="aline" href="#" onclick="showRelCamera(\'{0}\',\'{1}\')">视频监控</a> </div></div>', attr["name"], attr["mc"]);
 
     return content + itemdir + '</div>';
 }
 
+function showRelCamera() {
+	var targetlayer = $.getBasicLayer(tc_camera, basicType);
+    targetlayer.clearMarkers();
+    initRoadBasicInfoEvent(tc_camera, basicType);
+}
+
 function getRoadFeature(name) {
     for (var i = 0; i < roadFeatures.length; i++) {
         if (name == roadFeatures[i].attributes.nameb) {
@@ -498,7 +516,7 @@ function getEventItems() {
             initEventInfoEvent(this.name);
         },
         onUnchecked: function () {
-            if (this.name == "tfsjchk") {
+            if (this.name == tc_tfsjchk) {
                 tfsjMarkerlayer.clearMarkers();
             } else {
                 glyhMarkerlayer.clearMarkers();