Commit 1495dab1922c475102bb4f23a5d457e536530524

Authored by lizhuojun
1 parent ad966189

GPS轨迹回放历史版本

src/main/java/com/bsth/controller/realcontrol/RealMapController.java
@@ -27,6 +27,11 @@ public class RealMapController { @@ -27,6 +27,11 @@ public class RealMapController {
27 return realMapService.stationSpatialData(idx); 27 return realMapService.stationSpatialData(idx);
28 } 28 }
29 29
  30 + @RequestMapping(value = "/stationVersionSpatialData")
  31 + public Map<String, Object> stationVersionSpatialData(@RequestParam String idx) {
  32 + return realMapService.stationVersionSpatialData(idx);
  33 + }
  34 +
30 /** 35 /**
31 * 停车场 36 * 停车场
32 * 37 *
src/main/java/com/bsth/service/realcontrol/RealMapService.java
@@ -8,6 +8,8 @@ import java.util.Map; @@ -8,6 +8,8 @@ import java.util.Map;
8 public interface RealMapService { 8 public interface RealMapService {
9 Map<String, Object> stationSpatialData(String idx); 9 Map<String, Object> stationSpatialData(String idx);
10 10
  11 + Map<String, Object> stationVersionSpatialData(String idx);
  12 +
11 Map<String,Object> carParkSpatialData(); 13 Map<String,Object> carParkSpatialData();
12 14
13 Map<String, Object> findRouteByLine(String idx); 15 Map<String, Object> findRouteByLine(String idx);
src/main/java/com/bsth/service/realcontrol/impl/RealMapServiceImpl.java
@@ -57,6 +57,33 @@ public class RealMapServiceImpl implements RealMapService { @@ -57,6 +57,33 @@ public class RealMapServiceImpl implements RealMapService {
57 } 57 }
58 58
59 @Override 59 @Override
  60 + public Map<String, Object> stationVersionSpatialData(String idx) {
  61 + Map<String, Object> rs = new HashMap();
  62 + try {
  63 + //拼接in语句
  64 + List<String> idArray = Splitter.on(",").splitToList(idx);
  65 + StringBuffer inStr = new StringBuffer();
  66 + for (String code : idArray) {
  67 + inStr.append(",'");
  68 + inStr.append(code);
  69 + inStr.append("'");
  70 + }
  71 + String inStrs = " (" + inStr.toString().substring(1) + ")";
  72 + String sql = "select r.LINE_CODE,r.STATION_NAME,r.STATION_CODE,r.STATION_MARK,r.DIRECTIONS,r.DISTANCES,r.TO_TIME, r.VERSIONS,s.G_LONX,s.G_LATY,s.RADIUS,s.SHAPES_TYPE,ST_AsText(s.G_POLYGON_GRID) as G_POLYGON_GRID, r.STATION_ROUTE_CODE,r.versions from bsth_c_ls_stationroute r inner join bsth_c_station s on r.station=s.id where r.line_code in " + inStrs + " and r.destroy=0";
  73 +
  74 + List<StationSpatialData> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(StationSpatialData.class));
  75 + rs.put("status", ResponseCode.SUCCESS);
  76 + rs.put("list", list);
  77 + } catch (Exception e) {
  78 + logger.error("", e);
  79 + rs.put("status", ResponseCode.ERROR);
  80 + rs.put("msg", "查询站点空间数据出现异常!");
  81 + }
  82 +
  83 + return rs;
  84 + }
  85 +
  86 + @Override
60 public Map<String, Object> carParkSpatialData() { 87 public Map<String, Object> carParkSpatialData() {
61 Map<String, Object> rs = new HashMap(); 88 Map<String, Object> rs = new HashMap();
62 89
@@ -142,7 +169,7 @@ public class RealMapServiceImpl implements RealMapService { @@ -142,7 +169,7 @@ public class RealMapServiceImpl implements RealMapService {
142 } 169 }
143 inCond.deleteCharAt(inCond.length() - 1).append(")"); 170 inCond.deleteCharAt(inCond.length() - 1).append(")");
144 171
145 - String sql = "SELECT r.ID,r.LINE_CODE,r.SECTION_CODE,r.SECTIONROUTE_CODE,r.DIRECTIONS,s.SECTION_NAME,ST_AsText(s.GSECTION_VECTOR) GSECTION_VECTOR,s.SECTION_DISTANCE,s.SECTION_TIME,r.versions FROM bsth_c_sectionroute r INNER JOIN bsth_c_section s on r.section_code=s.section_code WHERE r.line_code in "+inCond.toString()+" and r.destroy=0 order by sectionroute_code"; 172 + String sql = "SELECT r.ID,r.LINE_CODE,r.SECTION_CODE,r.SECTIONROUTE_CODE,r.DIRECTIONS,s.SECTION_NAME,ST_AsText(s.GSECTION_VECTOR) GSECTION_VECTOR,s.SECTION_DISTANCE,s.SECTION_TIME,r.versions FROM bsth_c_ls_sectionroute r INNER JOIN bsth_c_section s on r.section_code=s.section_code WHERE r.line_code in "+inCond.toString()+" and r.destroy=0 order by sectionroute_code";
146 List<SectionRouteCoords> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(SectionRouteCoords.class)); 173 List<SectionRouteCoords> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(SectionRouteCoords.class));
147 174
148 //排序 175 //排序
src/main/resources/static/real_control_v2/mapmonitor/js/spatial_data.js
@@ -22,7 +22,7 @@ var gb_map_spatial_data = (function () { @@ -22,7 +22,7 @@ var gb_map_spatial_data = (function () {
22 22
23 var init = function () { 23 var init = function () {
24 //加载站点路由数据 24 //加载站点路由数据
25 - gb_common.$get('/realMap/stationSpatialData', {idx: line_idx}, function (rs) { 25 + gb_common.$get('/realMap/stationVersionSpatialData', {idx: line_idx}, function (rs) {
26 var list = rs.list; 26 var list = rs.list;
27 $.each(list, function () { 27 $.each(list, function () {
28 this.lat = this.gLaty; 28 this.lat = this.gLaty;
@@ -296,7 +296,30 @@ var gb_map_spatial_data = (function () { @@ -296,7 +296,30 @@ var gb_map_spatial_data = (function () {
296 } 296 }
297 return treeData; 297 return treeData;
298 }; 298 };
  299 + var get_st_route_tree_data_version = function () {
  300 + var treeData = [];
299 301
  302 + for (var lineCode in lineVersionStationArr) {
  303 + name = gb_data_basic.codeToLine[lineCode].name;
  304 + treeData.push({
  305 + 'text': name,
  306 + 'open': true,
  307 + 'children': [
  308 + {
  309 + 'text': '上行',
  310 + 'children': grabs(lineVersionStationArr[lineCode][0]),
  311 + 'id': lineCode + '_0_st'
  312 + },
  313 + {
  314 + 'text': '下行',
  315 + 'children': grabs(lineVersionStationArr[lineCode][1]),
  316 + 'id': lineCode + '_1_st'
  317 + }
  318 + ]
  319 + })
  320 + }
  321 + return treeData;
  322 + };
300 var get_st_carpark_tree_data = function () { 323 var get_st_carpark_tree_data = function () {
301 var treeData = []; 324 var treeData = [];
302 325