Commit 49180b5d828c4a4404fb7c4ff304e16fec951596

Authored by 娄高锋
2 parents 04cc4d9d 41b11750

Merge branch 'minhang' of 192.168.168.201:panzhaov5/bsth_control into minhang

Too many changes to show.

To preserve performance only 9 of 15 files are displayed.

src/main/java/com/bsth/controller/realcontrol/RealMapController.java
1 -package com.bsth.controller.realcontrol;  
2 -  
3 -import com.bsth.service.realcontrol.RealMapService;  
4 -import org.springframework.beans.factory.annotation.Autowired;  
5 -import org.springframework.web.bind.annotation.RequestMapping;  
6 -import org.springframework.web.bind.annotation.RequestParam;  
7 -import org.springframework.web.bind.annotation.RestController;  
8 -  
9 -import java.util.Map;  
10 -  
11 -/**  
12 - * 线调 地图监控相关  
13 - * Created by panzhao on 2016/11/23.  
14 - */  
15 -@RestController  
16 -@RequestMapping("realMap")  
17 -public class RealMapController {  
18 -  
19 - @Autowired  
20 - RealMapService realMapService;  
21 -  
22 - /**  
23 - * 根据线路获取站点路由及空间数据  
24 - */  
25 - @RequestMapping(value = "/stationSpatialData")  
26 - public Map<String, Object> stationSpatialData(@RequestParam String idx){  
27 - return realMapService.stationSpatialData(idx);  
28 - }  
29 -} 1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import com.bsth.service.realcontrol.RealMapService;
  4 +import org.springframework.beans.factory.annotation.Autowired;
  5 +import org.springframework.web.bind.annotation.RequestMapping;
  6 +import org.springframework.web.bind.annotation.RequestParam;
  7 +import org.springframework.web.bind.annotation.RestController;
  8 +
  9 +import java.util.Map;
  10 +
  11 +/**
  12 + * 线调 地图监控相关
  13 + * Created by panzhao on 2016/11/23.
  14 + */
  15 +@RestController
  16 +@RequestMapping("realMap")
  17 +public class RealMapController {
  18 +
  19 + @Autowired
  20 + RealMapService realMapService;
  21 +
  22 + /**
  23 + * 根据线路获取站点路由及空间数据
  24 + */
  25 + @RequestMapping(value = "/stationSpatialData")
  26 + public Map<String, Object> stationSpatialData(@RequestParam String idx){
  27 + return realMapService.stationSpatialData(idx);
  28 + }
  29 +}
src/main/java/com/bsth/controller/realcontrol/dto/StationSpatialData.java
1 -package com.bsth.controller.realcontrol.dto;  
2 -  
3 -/**  
4 - * Created by panzhao on 2016/11/23.  
5 - */  
6 -public class StationSpatialData {  
7 -  
8 - private String lineCode;  
9 -  
10 - private String stationName;  
11 -  
12 - private String stationCode;  
13 -  
14 - private String stationMark;  
15 -  
16 - private int directions;  
17 -  
18 - private Float distances;  
19 -  
20 - private Float toTime;  
21 -  
22 - private Integer versions;  
23 -  
24 - private Float gLonx;  
25 -  
26 - private Float gLaty;  
27 -  
28 - private Float radius;  
29 -  
30 - private String shapesType;  
31 -  
32 - private String gPolygonGrid;  
33 -  
34 - private Integer stationRouteCode;  
35 -  
36 - public String getLineCode() {  
37 - return lineCode;  
38 - }  
39 -  
40 - public void setLineCode(String lineCode) {  
41 - this.lineCode = lineCode;  
42 - }  
43 -  
44 - public String getStationName() {  
45 - return stationName;  
46 - }  
47 -  
48 - public void setStationName(String stationName) {  
49 - this.stationName = stationName;  
50 - }  
51 -  
52 - public String getStationCode() {  
53 - return stationCode;  
54 - }  
55 -  
56 - public void setStationCode(String stationCode) {  
57 - this.stationCode = stationCode;  
58 - }  
59 -  
60 - public String getStationMark() {  
61 - return stationMark;  
62 - }  
63 -  
64 - public void setStationMark(String stationMark) {  
65 - this.stationMark = stationMark;  
66 - }  
67 -  
68 - public int getDirections() {  
69 - return directions;  
70 - }  
71 -  
72 - public void setDirections(int directions) {  
73 - this.directions = directions;  
74 - }  
75 -  
76 - public Float getDistances() {  
77 - return distances;  
78 - }  
79 -  
80 - public void setDistances(Float distances) {  
81 - this.distances = distances;  
82 - }  
83 -  
84 - public Float getToTime() {  
85 - return toTime;  
86 - }  
87 -  
88 - public void setToTime(Float toTime) {  
89 - this.toTime = toTime;  
90 - }  
91 -  
92 - public Integer getVersions() {  
93 - return versions;  
94 - }  
95 -  
96 - public void setVersions(Integer versions) {  
97 - this.versions = versions;  
98 - }  
99 -  
100 - public Float getgLonx() {  
101 - return gLonx;  
102 - }  
103 -  
104 - public void setgLonx(Float gLonx) {  
105 - this.gLonx = gLonx;  
106 - }  
107 -  
108 - public Float getgLaty() {  
109 - return gLaty;  
110 - }  
111 -  
112 - public void setgLaty(Float gLaty) {  
113 - this.gLaty = gLaty;  
114 - }  
115 -  
116 - public Float getRadius() {  
117 - return radius;  
118 - }  
119 -  
120 - public void setRadius(Float radius) {  
121 - this.radius = radius;  
122 - }  
123 -  
124 - public String getShapesType() {  
125 - return shapesType;  
126 - }  
127 -  
128 - public void setShapesType(String shapesType) {  
129 - this.shapesType = shapesType;  
130 - }  
131 -  
132 - public String getgPolygonGrid() {  
133 - return gPolygonGrid;  
134 - }  
135 -  
136 - public void setgPolygonGrid(String gPolygonGrid) {  
137 - this.gPolygonGrid = gPolygonGrid;  
138 - }  
139 -  
140 - public Integer getStationRouteCode() {  
141 - return stationRouteCode;  
142 - }  
143 -  
144 - public void setStationRouteCode(Integer stationRouteCode) {  
145 - this.stationRouteCode = stationRouteCode;  
146 - }  
147 -} 1 +package com.bsth.controller.realcontrol.dto;
  2 +
  3 +/**
  4 + * Created by panzhao on 2016/11/23.
  5 + */
  6 +public class StationSpatialData {
  7 +
  8 + private String lineCode;
  9 +
  10 + private String stationName;
  11 +
  12 + private String stationCode;
  13 +
  14 + private String stationMark;
  15 +
  16 + private int directions;
  17 +
  18 + private Float distances;
  19 +
  20 + private Float toTime;
  21 +
  22 + private Integer versions;
  23 +
  24 + private Float gLonx;
  25 +
  26 + private Float gLaty;
  27 +
  28 + private Float radius;
  29 +
  30 + private String shapesType;
  31 +
  32 + private String gPolygonGrid;
  33 +
  34 + private Integer stationRouteCode;
  35 +
  36 + public String getLineCode() {
  37 + return lineCode;
  38 + }
  39 +
  40 + public void setLineCode(String lineCode) {
  41 + this.lineCode = lineCode;
  42 + }
  43 +
  44 + public String getStationName() {
  45 + return stationName;
  46 + }
  47 +
  48 + public void setStationName(String stationName) {
  49 + this.stationName = stationName;
  50 + }
  51 +
  52 + public String getStationCode() {
  53 + return stationCode;
  54 + }
  55 +
  56 + public void setStationCode(String stationCode) {
  57 + this.stationCode = stationCode;
  58 + }
  59 +
  60 + public String getStationMark() {
  61 + return stationMark;
  62 + }
  63 +
  64 + public void setStationMark(String stationMark) {
  65 + this.stationMark = stationMark;
  66 + }
  67 +
  68 + public int getDirections() {
  69 + return directions;
  70 + }
  71 +
  72 + public void setDirections(int directions) {
  73 + this.directions = directions;
  74 + }
  75 +
  76 + public Float getDistances() {
  77 + return distances;
  78 + }
  79 +
  80 + public void setDistances(Float distances) {
  81 + this.distances = distances;
  82 + }
  83 +
  84 + public Float getToTime() {
  85 + return toTime;
  86 + }
  87 +
  88 + public void setToTime(Float toTime) {
  89 + this.toTime = toTime;
  90 + }
  91 +
  92 + public Integer getVersions() {
  93 + return versions;
  94 + }
  95 +
  96 + public void setVersions(Integer versions) {
  97 + this.versions = versions;
  98 + }
  99 +
  100 + public Float getgLonx() {
  101 + return gLonx;
  102 + }
  103 +
  104 + public void setgLonx(Float gLonx) {
  105 + this.gLonx = gLonx;
  106 + }
  107 +
  108 + public Float getgLaty() {
  109 + return gLaty;
  110 + }
  111 +
  112 + public void setgLaty(Float gLaty) {
  113 + this.gLaty = gLaty;
  114 + }
  115 +
  116 + public Float getRadius() {
  117 + return radius;
  118 + }
  119 +
  120 + public void setRadius(Float radius) {
  121 + this.radius = radius;
  122 + }
  123 +
  124 + public String getShapesType() {
  125 + return shapesType;
  126 + }
  127 +
  128 + public void setShapesType(String shapesType) {
  129 + this.shapesType = shapesType;
  130 + }
  131 +
  132 + public String getgPolygonGrid() {
  133 + return gPolygonGrid;
  134 + }
  135 +
  136 + public void setgPolygonGrid(String gPolygonGrid) {
  137 + this.gPolygonGrid = gPolygonGrid;
  138 + }
  139 +
  140 + public Integer getStationRouteCode() {
  141 + return stationRouteCode;
  142 + }
  143 +
  144 + public void setStationRouteCode(Integer stationRouteCode) {
  145 + this.stationRouteCode = stationRouteCode;
  146 + }
  147 +}
src/main/java/com/bsth/data/arrival/ArrivalData_GPS.java
@@ -41,8 +41,8 @@ public class ArrivalData_GPS implements CommandLineRunner{ @@ -41,8 +41,8 @@ public class ArrivalData_GPS implements CommandLineRunner{
41 41
42 @Override 42 @Override
43 public void run(String... arg0) throws Exception { 43 public void run(String... arg0) throws Exception {
44 - logger.info("ArrivalData_GPS,30,10");  
45 - //Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 40, 10, TimeUnit.SECONDS); 44 + logger.info("ArrivalData_GPS,30,06");
  45 + //Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 40, 6, TimeUnit.SECONDS);
46 } 46 }
47 47
48 @Component 48 @Component
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
1 package com.bsth.data.gpsdata; 1 package com.bsth.data.gpsdata;
2 2
3 -import java.io.BufferedReader;  
4 -import java.io.InputStreamReader;  
5 -import java.util.*;  
6 -import java.util.concurrent.TimeUnit;  
7 - 3 +import com.alibaba.fastjson.JSON;
  4 +import com.alibaba.fastjson.JSONObject;
  5 +import com.bsth.data.BasicData;
  6 +import com.bsth.data.forecast.ForecastRealServer;
  7 +import com.bsth.data.schedule.DayOfSchedule;
  8 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  9 +import com.bsth.util.ConfigUtil;
  10 +import com.google.common.collect.TreeMultimap;
8 import org.apache.commons.lang3.StringUtils; 11 import org.apache.commons.lang3.StringUtils;
9 import org.apache.http.HttpEntity; 12 import org.apache.http.HttpEntity;
10 import org.apache.http.client.methods.CloseableHttpResponse; 13 import org.apache.http.client.methods.CloseableHttpResponse;
@@ -17,15 +20,9 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -17,15 +20,9 @@ import org.springframework.beans.factory.annotation.Autowired;
17 import org.springframework.boot.CommandLineRunner; 20 import org.springframework.boot.CommandLineRunner;
18 import org.springframework.stereotype.Component; 21 import org.springframework.stereotype.Component;
19 22
20 -import com.alibaba.fastjson.JSON;  
21 -import com.alibaba.fastjson.JSONObject;  
22 -import com.bsth.Application;  
23 -import com.bsth.data.BasicData;  
24 -import com.bsth.data.forecast.ForecastRealServer;  
25 -import com.bsth.data.schedule.DayOfSchedule;  
26 -import com.bsth.entity.realcontrol.ScheduleRealInfo;  
27 -import com.bsth.util.ConfigUtil;  
28 -import com.google.common.collect.TreeMultimap; 23 +import java.io.BufferedReader;
  24 +import java.io.InputStreamReader;
  25 +import java.util.*;
29 26
30 /** 27 /**
31 * 28 *
@@ -68,7 +65,7 @@ public class GpsRealData implements CommandLineRunner{ @@ -68,7 +65,7 @@ public class GpsRealData implements CommandLineRunner{
68 @Override 65 @Override
69 public void run(String... arg0) throws Exception { 66 public void run(String... arg0) throws Exception {
70 logger.info("gpsDataLoader,20,6"); 67 logger.info("gpsDataLoader,20,6");
71 - Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 5, TimeUnit.SECONDS); 68 + //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 5, TimeUnit.SECONDS);
72 } 69 }
73 70
74 public GpsEntity add(GpsEntity gps) { 71 public GpsEntity add(GpsEntity gps) {
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
1 package com.bsth.data.schedule; 1 package com.bsth.data.schedule;
2 2
3 -import java.text.ParseException;  
4 -import java.text.SimpleDateFormat;  
5 -import java.util.ArrayList;  
6 -import java.util.Collection;  
7 -import java.util.Collections;  
8 -import java.util.HashMap;  
9 -import java.util.HashSet;  
10 -import java.util.Iterator;  
11 -import java.util.LinkedList;  
12 -import java.util.List;  
13 -import java.util.Map;  
14 -import java.util.Set;  
15 -import java.util.concurrent.TimeUnit;  
16 -  
17 -import com.bsth.data.schedule.thread.SubmitToTrafficManage;  
18 -import org.apache.commons.lang3.StringUtils;  
19 -import org.joda.time.DateTime;  
20 -import org.joda.time.format.DateTimeFormat;  
21 -import org.joda.time.format.DateTimeFormatter;  
22 -import org.slf4j.Logger;  
23 -import org.slf4j.LoggerFactory;  
24 -import org.springframework.beans.factory.annotation.Autowired;  
25 -import org.springframework.boot.CommandLineRunner;  
26 -import org.springframework.stereotype.Component;  
27 -  
28 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
29 import com.alibaba.fastjson.JSONArray; 4 import com.alibaba.fastjson.JSONArray;
30 import com.bsth.Application; 5 import com.bsth.Application;
@@ -34,6 +9,7 @@ import com.bsth.data.gpsdata.GpsRealData; @@ -34,6 +9,7 @@ import com.bsth.data.gpsdata.GpsRealData;
34 import com.bsth.data.schedule.thread.ScheduleLateThread; 9 import com.bsth.data.schedule.thread.ScheduleLateThread;
35 import com.bsth.data.schedule.thread.SchedulePstThread; 10 import com.bsth.data.schedule.thread.SchedulePstThread;
36 import com.bsth.data.schedule.thread.ScheduleRefreshThread; 11 import com.bsth.data.schedule.thread.ScheduleRefreshThread;
  12 +import com.bsth.data.schedule.thread.SubmitToTrafficManage;
37 import com.bsth.entity.realcontrol.LineConfig; 13 import com.bsth.entity.realcontrol.LineConfig;
38 import com.bsth.entity.realcontrol.ScheduleRealInfo; 14 import com.bsth.entity.realcontrol.ScheduleRealInfo;
39 import com.bsth.entity.schedule.SchedulePlanInfo; 15 import com.bsth.entity.schedule.SchedulePlanInfo;
@@ -44,6 +20,19 @@ import com.bsth.util.DateUtils; @@ -44,6 +20,19 @@ import com.bsth.util.DateUtils;
44 import com.bsth.websocket.handler.SendUtils; 20 import com.bsth.websocket.handler.SendUtils;
45 import com.google.common.collect.ArrayListMultimap; 21 import com.google.common.collect.ArrayListMultimap;
46 import com.google.common.collect.TreeMultimap; 22 import com.google.common.collect.TreeMultimap;
  23 +import org.apache.commons.lang3.StringUtils;
  24 +import org.joda.time.format.DateTimeFormat;
  25 +import org.joda.time.format.DateTimeFormatter;
  26 +import org.slf4j.Logger;
  27 +import org.slf4j.LoggerFactory;
  28 +import org.springframework.beans.factory.annotation.Autowired;
  29 +import org.springframework.boot.CommandLineRunner;
  30 +import org.springframework.stereotype.Component;
  31 +
  32 +import java.text.ParseException;
  33 +import java.text.SimpleDateFormat;
  34 +import java.util.*;
  35 +import java.util.concurrent.TimeUnit;
47 36
48 /** 37 /**
49 * 38 *
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
@@ -47,11 +47,6 @@ public class ScheduleRealInfo { @@ -47,11 +47,6 @@ public class ScheduleRealInfo {
47 47
48 /** 车辆自编号 */ 48 /** 车辆自编号 */
49 private String clZbh; 49 private String clZbh;
50 -  
51 - /** 报道时间(格式 HH:mm)  
52 - private String bdTime; */  
53 - /** 出场时间(格式 HH:mm)  
54 - private String ccTime;*/  
55 50
56 /** 驾驶员工号 */ 51 /** 驾驶员工号 */
57 private String jGh; 52 private String jGh;
@@ -141,15 +136,6 @@ public class ScheduleRealInfo { @@ -141,15 +136,6 @@ public class ScheduleRealInfo {
141 @Transient 136 @Transient
142 private boolean late; 137 private boolean late;
143 138
144 - /**实际里程*/  
145 - private Float realMileage;  
146 -  
147 - /** 增加公里 */  
148 - private Float addMileage;  
149 -  
150 - /** 抽减公里 */  
151 - private Float remMileage;  
152 -  
153 /** 备注*/ 139 /** 备注*/
154 private String remarks; 140 private String remarks;
155 141
@@ -167,11 +153,13 @@ public class ScheduleRealInfo { @@ -167,11 +153,13 @@ public class ScheduleRealInfo {
167 private Integer opDirectiveState; 153 private Integer opDirectiveState;
168 154
169 /** 起点站计划到达时间 */ 155 /** 起点站计划到达时间 */
  156 + @Transient
170 private String qdzArrDatejh; 157 private String qdzArrDatejh;
171 - 158 +
172 /** 起点站实际到达时间 */ 159 /** 起点站实际到达时间 */
  160 + @Transient
173 private String qdzArrDatesj; 161 private String qdzArrDatesj;
174 - 162 +
175 /** 子任务 */ 163 /** 子任务 */
176 @OneToMany(fetch = FetchType.LAZY/*, cascade = CascadeType.ALL*/) 164 @OneToMany(fetch = FetchType.LAZY/*, cascade = CascadeType.ALL*/)
177 private Set<ChildTaskPlan> cTasks = new HashSet<>(); 165 private Set<ChildTaskPlan> cTasks = new HashSet<>();
@@ -566,30 +554,6 @@ public class ScheduleRealInfo { @@ -566,30 +554,6 @@ public class ScheduleRealInfo {
566 this.status = status; 554 this.status = status;
567 } 555 }
568 556
569 - public Float getRealMileage() {  
570 - return realMileage;  
571 - }  
572 -  
573 - public void setRealMileage(Float realMileage) {  
574 - this.realMileage = realMileage;  
575 - }  
576 -  
577 - public Float getAddMileage() {  
578 - return addMileage;  
579 - }  
580 -  
581 - public void setAddMileage(Float addMileage) {  
582 - this.addMileage = addMileage;  
583 - }  
584 -  
585 - public Float getRemMileage() {  
586 - return remMileage;  
587 - }  
588 -  
589 - public void setRemMileage(Float remMileage) {  
590 - this.remMileage = remMileage;  
591 - }  
592 -  
593 public String getRemarks() { 557 public String getRemarks() {
594 return remarks; 558 return remarks;
595 } 559 }
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
@@ -29,8 +29,9 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -29,8 +29,9 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
29 @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 order by bcs") 29 @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 order by bcs")
30 List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName); 30 List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName);
31 31
  32 + //把sum(addMileage) 替换为0 数据表去掉了 add_mileage 字段
32 @Query(value="select new map(clZbh as clZbh,jGh as jGh,jName as jName,sum(jhlc) as zgl," 33 @Query(value="select new map(clZbh as clZbh,jGh as jGh,jName as jName,sum(jhlc) as zgl,"
33 - + "sum(addMileage) as ksgl,count(jName) as bcs) from ScheduleRealInfo s where" 34 + + " 0 as ksgl,count(jName) as bcs) from ScheduleRealInfo s where"
34 + " s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 group by clZbh,jGh,jName") 35 + " s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 group by clZbh,jGh,jName")
35 List<Map<String, Object>> dailyInfo(String line,String date); 36 List<Map<String, Object>> dailyInfo(String line,String date);
36 37
src/main/java/com/bsth/service/realcontrol/RealMapService.java
1 -package com.bsth.service.realcontrol;  
2 -  
3 -import java.util.Map;  
4 -  
5 -/**  
6 - * Created by panzhao on 2016/11/23.  
7 - */  
8 -public interface RealMapService {  
9 - Map<String, Object> stationSpatialData(String idx);  
10 -} 1 +package com.bsth.service.realcontrol;
  2 +
  3 +import java.util.Map;
  4 +
  5 +/**
  6 + * Created by panzhao on 2016/11/23.
  7 + */
  8 +public interface RealMapService {
  9 + Map<String, Object> stationSpatialData(String idx);
  10 +}
src/main/java/com/bsth/service/realcontrol/impl/RealMapServiceImpl.java
1 -package com.bsth.service.realcontrol.impl;  
2 -  
3 -import com.bsth.common.ResponseCode;  
4 -import com.bsth.controller.realcontrol.dto.StationSpatialData;  
5 -import com.bsth.service.realcontrol.RealMapService;  
6 -import com.google.common.base.Splitter;  
7 -import org.slf4j.Logger;  
8 -import org.slf4j.LoggerFactory;  
9 -import org.springframework.beans.factory.annotation.Autowired;  
10 -import org.springframework.jdbc.core.BeanPropertyRowMapper;  
11 -import org.springframework.jdbc.core.JdbcTemplate;  
12 -import org.springframework.stereotype.Service;  
13 -  
14 -import java.util.HashMap;  
15 -import java.util.List;  
16 -import java.util.Map;  
17 -  
18 -/**  
19 - * Created by panzhao on 2016/11/23.  
20 - */  
21 -@Service  
22 -public class RealMapServiceImpl implements RealMapService {  
23 -  
24 - @Autowired  
25 - JdbcTemplate jdbcTemplate;  
26 -  
27 - Logger logger = LoggerFactory.getLogger(this.getClass());  
28 -  
29 - @Override  
30 - public Map<String, Object> stationSpatialData(String idx) {  
31 - Map<String, Object> rs = new HashMap();  
32 -  
33 - try {  
34 - List<String> idArray = Splitter.on(",").splitToList(idx);  
35 - //拼接in语句  
36 - String inStr = "";  
37 - for (String code : idArray) {  
38 - inStr += (",'" + code+"'");  
39 - }  
40 - inStr = " (" + inStr.substring(1) + ")";  
41 -  
42 - 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 from bsth_c_stationroute r inner join bsth_c_station s on r.station=s.id where r.line_code in "+inStr+" and r.destroy=0";  
43 -  
44 - List<StationSpatialData> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(StationSpatialData.class));  
45 - rs.put("status", ResponseCode.SUCCESS);  
46 - rs.put("list", list);  
47 - } catch (Exception e) {  
48 - logger.error("", e);  
49 - rs.put("status", ResponseCode.ERROR);  
50 - rs.put("msg", "查询站点空间数据出现异常!");  
51 - }  
52 -  
53 - return rs;  
54 - }  
55 -} 1 +package com.bsth.service.realcontrol.impl;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.controller.realcontrol.dto.StationSpatialData;
  5 +import com.bsth.service.realcontrol.RealMapService;
  6 +import com.google.common.base.Splitter;
  7 +import org.slf4j.Logger;
  8 +import org.slf4j.LoggerFactory;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
  11 +import org.springframework.jdbc.core.JdbcTemplate;
  12 +import org.springframework.stereotype.Service;
  13 +
  14 +import java.util.HashMap;
  15 +import java.util.List;
  16 +import java.util.Map;
  17 +
  18 +/**
  19 + * Created by panzhao on 2016/11/23.
  20 + */
  21 +@Service
  22 +public class RealMapServiceImpl implements RealMapService {
  23 +
  24 + @Autowired
  25 + JdbcTemplate jdbcTemplate;
  26 +
  27 + Logger logger = LoggerFactory.getLogger(this.getClass());
  28 +
  29 + @Override
  30 + public Map<String, Object> stationSpatialData(String idx) {
  31 + Map<String, Object> rs = new HashMap();
  32 +
  33 + try {
  34 + List<String> idArray = Splitter.on(",").splitToList(idx);
  35 + //拼接in语句
  36 + String inStr = "";
  37 + for (String code : idArray) {
  38 + inStr += (",'" + code+"'");
  39 + }
  40 + inStr = " (" + inStr.substring(1) + ")";
  41 +
  42 + 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 from bsth_c_stationroute r inner join bsth_c_station s on r.station=s.id where r.line_code in "+inStr+" and r.destroy=0";
  43 +
  44 + List<StationSpatialData> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(StationSpatialData.class));
  45 + rs.put("status", ResponseCode.SUCCESS);
  46 + rs.put("list", list);
  47 + } catch (Exception e) {
  48 + logger.error("", e);
  49 + rs.put("status", ResponseCode.ERROR);
  50 + rs.put("msg", "查询站点空间数据出现异常!");
  51 + }
  52 +
  53 + return rs;
  54 + }
  55 +}