|
@@ -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")
|