Commit b157ac5c1da161a14771482fa87b58a06fa88a32

Authored by 王通
1 parent 1c831cc3

1.浦东公交站点和路由数据结构变更

src/main/java/com/bsth/server_rs/base_info/station/buffer/StationRefreshThread.java
1 -package com.bsth.server_rs.base_info.station.buffer;  
2 -  
3 -import com.bsth.server_rs.base_info.station.entity.Station;  
4 -import com.bsth.server_rs.base_info.station.entity.StationRotue;  
5 -import org.slf4j.Logger;  
6 -import org.slf4j.LoggerFactory;  
7 -import org.springframework.beans.factory.annotation.Autowired;  
8 -import org.springframework.jdbc.core.BeanPropertyRowMapper;  
9 -import org.springframework.jdbc.core.JdbcTemplate;  
10 -import org.springframework.stereotype.Component;  
11 -  
12 -import java.util.List;  
13 -  
14 -/**  
15 - * Created by panzhao on 2017/3/27.  
16 - */  
17 -@Component  
18 -public class StationRefreshThread extends Thread{  
19 -  
20 - @Autowired  
21 - JdbcTemplate jdbcTemplate;  
22 -  
23 - Logger logger = LoggerFactory.getLogger(this.getClass());  
24 -  
25 - @Override  
26 - public void run() {  
27 -  
28 - try {  
29 - //站点信息  
30 - List<Station> stationList = jdbcTemplate.query("SELECT station_cod AS station_code,station_name,g_lonx AS lon,g_laty AS lat,shapes_type,radius,ST_AsText(g_polygon_grid) AS polygon_grid,versions FROM bsth_c_station where destroy=0 ",  
31 - BeanPropertyRowMapper.newInstance(Station.class));  
32 -  
33 - if(stationList == null || stationList.size() == 0)  
34 - return;  
35 - StationBufferData.replaceAll(stationList);  
36 -  
37 - //站点路由信息  
38 - List<StationRotue> routeList = jdbcTemplate.query("select id, line, station_route_code, line_code,station_code,station_mark,distances, to_time,directions,station_name from bsth_c_stationroute where destroy=0",  
39 - BeanPropertyRowMapper.newInstance(StationRotue.class));  
40 -  
41 - for(StationRotue sr : routeList){  
42 - sr.setStation(StationBufferData.findOne(sr.getStationCode()));  
43 - }  
44 - StationBufferData.replaceRoutes(routeList);  
45 - }catch (Exception e){  
46 - logger.error("", e);  
47 - }  
48 - }  
49 -} 1 +package com.bsth.server_rs.base_info.station.buffer;
  2 +
  3 +import com.bsth.server_rs.base_info.station.entity.Station;
  4 +import com.bsth.server_rs.base_info.station.entity.StationRotue;
  5 +import org.slf4j.Logger;
  6 +import org.slf4j.LoggerFactory;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
  9 +import org.springframework.jdbc.core.JdbcTemplate;
  10 +import org.springframework.stereotype.Component;
  11 +
  12 +import java.util.List;
  13 +
  14 +/**
  15 + * Created by panzhao on 2017/3/27.
  16 + */
  17 +@Component
  18 +public class StationRefreshThread extends Thread{
  19 +
  20 + @Autowired
  21 + JdbcTemplate jdbcTemplate;
  22 +
  23 + Logger logger = LoggerFactory.getLogger(this.getClass());
  24 +
  25 + @Override
  26 + public void run() {
  27 +
  28 + try {
  29 + //站点信息
  30 + List<Station> stationList = jdbcTemplate.query("SELECT station_cod AS station_code,station_name,g_lonx AS lon,g_laty AS lat,versions FROM bsth_c_station where destroy=0 ",
  31 + BeanPropertyRowMapper.newInstance(Station.class));
  32 +
  33 + if(stationList == null || stationList.size() == 0)
  34 + return;
  35 + StationBufferData.replaceAll(stationList);
  36 +
  37 + //站点路由信息
  38 + List<StationRotue> routeList = jdbcTemplate.query("select id, line, station_route_code, line_code,station_code,station_mark,distances, to_time,directions,station_name,shaped_type as shapes_type,radius,ST_AsText(buffer_polygon_wgs) AS polygon_grid from bsth_c_stationroute where destroy=0",
  39 + BeanPropertyRowMapper.newInstance(StationRotue.class));
  40 +
  41 + for(StationRotue sr : routeList){
  42 + sr.setStation(StationBufferData.findOne(sr.getStationCode()));
  43 + }
  44 + StationBufferData.replaceRoutes(routeList);
  45 + }catch (Exception e){
  46 + logger.error("", e);
  47 + }
  48 + }
  49 +}
src/main/java/com/bsth/server_rs/base_info/station/entity/Station.java
1 -package com.bsth.server_rs.base_info.station.entity;  
2 -  
3 -/**  
4 - * 站点信息  
5 - * Created by panzhao on 2017/8/31.  
6 - */  
7 -public class Station {  
8 -  
9 - /** 站点编码 */  
10 - private String stationCode;  
11 -  
12 - /** 站点名称 */  
13 - private String stationName;  
14 -  
15 - /** WGS 经度 */  
16 - private Float lon;  
17 -  
18 - /** WGS 纬度 */  
19 - private Float lat;  
20 -  
21 - /**  
22 - * 电子围栏类型  
23 - *  
24 - * ------ r:圆形  
25 - *  
26 - * ------ d:多边形  
27 - */  
28 - private String shapesType;  
29 -  
30 - /** 圆形半径 */  
31 - private Integer radius;  
32 -  
33 - /** 多边形 WGS 坐标 */  
34 - private String polygonGrid;  
35 -  
36 - /** 版本号 */  
37 - private Integer versions;  
38 -  
39 -  
40 - public String getStationName() {  
41 - return stationName;  
42 - }  
43 -  
44 - public void setStationName(String stationName) {  
45 - this.stationName = stationName;  
46 - }  
47 -  
48 - public String getShapesType() {  
49 - return shapesType;  
50 - }  
51 -  
52 - public void setShapesType(String shapesType) {  
53 - this.shapesType = shapesType;  
54 - }  
55 -  
56 - public Integer getRadius() {  
57 - return radius;  
58 - }  
59 -  
60 - public void setRadius(Integer radius) {  
61 - this.radius = radius;  
62 - }  
63 -  
64 -  
65 - public Integer getVersions() {  
66 - return versions;  
67 - }  
68 -  
69 - public void setVersions(Integer versions) {  
70 - this.versions = versions;  
71 - }  
72 -  
73 - public String getStationCode() {  
74 - return stationCode;  
75 - }  
76 -  
77 - public void setStationCode(String stationCode) {  
78 - this.stationCode = stationCode;  
79 - }  
80 -  
81 - public Float getLon() {  
82 - return lon;  
83 - }  
84 -  
85 - public void setLon(Float lon) {  
86 - this.lon = lon;  
87 - }  
88 -  
89 - public Float getLat() {  
90 - return lat;  
91 - }  
92 -  
93 - public void setLat(Float lat) {  
94 - this.lat = lat;  
95 - }  
96 -  
97 - public String getPolygonGrid() {  
98 - return polygonGrid;  
99 - }  
100 -  
101 - public void setPolygonGrid(String polygonGrid) {  
102 - this.polygonGrid = polygonGrid;  
103 - }  
104 -} 1 +package com.bsth.server_rs.base_info.station.entity;
  2 +
  3 +/**
  4 + * 站点信息
  5 + * Created by panzhao on 2017/8/31.
  6 + */
  7 +public class Station {
  8 +
  9 + /** 站点编码 */
  10 + private String stationCode;
  11 +
  12 + /** 站点名称 */
  13 + private String stationName;
  14 +
  15 + /** WGS 经度 */
  16 + private Float lon;
  17 +
  18 + /** WGS 纬度 */
  19 + private Float lat;
  20 +
  21 + /** 版本号 */
  22 + private Integer versions;
  23 +
  24 +
  25 + public String getStationName() {
  26 + return stationName;
  27 + }
  28 +
  29 + public void setStationName(String stationName) {
  30 + this.stationName = stationName;
  31 + }
  32 +
  33 + public Integer getVersions() {
  34 + return versions;
  35 + }
  36 +
  37 + public void setVersions(Integer versions) {
  38 + this.versions = versions;
  39 + }
  40 +
  41 + public String getStationCode() {
  42 + return stationCode;
  43 + }
  44 +
  45 + public void setStationCode(String stationCode) {
  46 + this.stationCode = stationCode;
  47 + }
  48 +
  49 + public Float getLon() {
  50 + return lon;
  51 + }
  52 +
  53 + public void setLon(Float lon) {
  54 + this.lon = lon;
  55 + }
  56 +
  57 + public Float getLat() {
  58 + return lat;
  59 + }
  60 +
  61 + public void setLat(Float lat) {
  62 + this.lat = lat;
  63 + }
  64 +}
src/main/java/com/bsth/server_rs/base_info/station/entity/StationRotue.java
1 -package com.bsth.server_rs.base_info.station.entity;  
2 -  
3 -/**  
4 - * Created by panzhao on 2017/8/31.  
5 - */  
6 -public class StationRotue {  
7 -  
8 - /** 线路编码 */  
9 - private String lineCode;  
10 -  
11 - /** 站点路由序号 */  
12 - private Integer stationRouteCode;  
13 -  
14 - private String stationCode;  
15 -  
16 - private String stationName;  
17 -  
18 - private Station station;  
19 -  
20 - /**  
21 - * 站点类型  
22 - * ------ B:起点站  
23 - * ------ Z:中途站  
24 - * ------ E:终点站  
25 - * ------ T:停车场  
26 - */  
27 - private String stationMark;  
28 -  
29 - /** 站点路由到站距离 */  
30 - private Double distances;  
31 -  
32 - /** 站点路由到站时间 */  
33 - private Double toTime;  
34 -  
35 - /** 首班时间 */  
36 - private String firstTime;  
37 -  
38 - /** 末班时间 */  
39 - private String endTime;  
40 -  
41 - /** 站点路由方向 */  
42 - private Integer directions;  
43 -  
44 - /** 版本号 */  
45 - private Integer versions;  
46 -  
47 - public String getLineCode() {  
48 - return lineCode;  
49 - }  
50 -  
51 - public void setLineCode(String lineCode) {  
52 - this.lineCode = lineCode;  
53 - }  
54 -  
55 - public Integer getStationRouteCode() {  
56 - return stationRouteCode;  
57 - }  
58 -  
59 - public void setStationRouteCode(Integer stationRouteCode) {  
60 - this.stationRouteCode = stationRouteCode;  
61 - }  
62 -  
63 - public Station getStation() {  
64 - return station;  
65 - }  
66 -  
67 - public void setStation(Station station) {  
68 - this.station = station;  
69 - }  
70 -  
71 - public String getStationMark() {  
72 - return stationMark;  
73 - }  
74 -  
75 - public void setStationMark(String stationMark) {  
76 - this.stationMark = stationMark;  
77 - }  
78 -  
79 - public Double getDistances() {  
80 - return distances;  
81 - }  
82 -  
83 - public void setDistances(Double distances) {  
84 - this.distances = distances;  
85 - }  
86 -  
87 - public Double getToTime() {  
88 - return toTime;  
89 - }  
90 -  
91 - public void setToTime(Double toTime) {  
92 - this.toTime = toTime;  
93 - }  
94 -  
95 - public String getFirstTime() {  
96 - return firstTime;  
97 - }  
98 -  
99 - public void setFirstTime(String firstTime) {  
100 - this.firstTime = firstTime;  
101 - }  
102 -  
103 - public String getEndTime() {  
104 - return endTime;  
105 - }  
106 -  
107 - public void setEndTime(String endTime) {  
108 - this.endTime = endTime;  
109 - }  
110 -  
111 - public Integer getDirections() {  
112 - return directions;  
113 - }  
114 -  
115 - public void setDirections(Integer directions) {  
116 - this.directions = directions;  
117 - }  
118 -  
119 - public Integer getVersions() {  
120 - return versions;  
121 - }  
122 -  
123 - public void setVersions(Integer versions) {  
124 - this.versions = versions;  
125 - }  
126 -  
127 - public String getStationCode() {  
128 - return stationCode;  
129 - }  
130 -  
131 - public void setStationCode(String stationCode) {  
132 - this.stationCode = stationCode;  
133 - }  
134 -  
135 - public String getStationName() {  
136 - return stationName;  
137 - }  
138 -  
139 - public void setStationName(String stationName) {  
140 - this.stationName = stationName;  
141 - }  
142 -} 1 +package com.bsth.server_rs.base_info.station.entity;
  2 +
  3 +/**
  4 + * Created by panzhao on 2017/8/31.
  5 + */
  6 +public class StationRotue {
  7 +
  8 + /** 线路编码 */
  9 + private String lineCode;
  10 +
  11 + /** 站点路由序号 */
  12 + private Integer stationRouteCode;
  13 +
  14 + private String stationCode;
  15 +
  16 + private String stationName;
  17 +
  18 + private Station station;
  19 +
  20 + /**
  21 + * 站点类型
  22 + * ------ B:起点站
  23 + * ------ Z:中途站
  24 + * ------ E:终点站
  25 + * ------ T:停车场
  26 + */
  27 + private String stationMark;
  28 +
  29 + /** 站点路由到站距离 */
  30 + private Double distances;
  31 +
  32 + /** 站点路由到站时间 */
  33 + private Double toTime;
  34 +
  35 + /** 首班时间 */
  36 + private String firstTime;
  37 +
  38 + /** 末班时间 */
  39 + private String endTime;
  40 +
  41 + /** 站点路由方向 */
  42 + private Integer directions;
  43 +
  44 + /** 版本号 */
  45 + private Integer versions;
  46 +
  47 + /**
  48 + * 电子围栏类型
  49 + *
  50 + * ------ r:圆形
  51 + *
  52 + * ------ d:多边形
  53 + */
  54 + private String shapesType;
  55 +
  56 + /** 圆形半径 */
  57 + private Integer radius;
  58 +
  59 + /** 多边形 WGS 坐标 */
  60 + private String polygonGrid;
  61 +
  62 + public String getLineCode() {
  63 + return lineCode;
  64 + }
  65 +
  66 + public void setLineCode(String lineCode) {
  67 + this.lineCode = lineCode;
  68 + }
  69 +
  70 + public Integer getStationRouteCode() {
  71 + return stationRouteCode;
  72 + }
  73 +
  74 + public void setStationRouteCode(Integer stationRouteCode) {
  75 + this.stationRouteCode = stationRouteCode;
  76 + }
  77 +
  78 + public Station getStation() {
  79 + return station;
  80 + }
  81 +
  82 + public void setStation(Station station) {
  83 + this.station = station;
  84 + }
  85 +
  86 + public String getStationMark() {
  87 + return stationMark;
  88 + }
  89 +
  90 + public void setStationMark(String stationMark) {
  91 + this.stationMark = stationMark;
  92 + }
  93 +
  94 + public Double getDistances() {
  95 + return distances;
  96 + }
  97 +
  98 + public void setDistances(Double distances) {
  99 + this.distances = distances;
  100 + }
  101 +
  102 + public Double getToTime() {
  103 + return toTime;
  104 + }
  105 +
  106 + public void setToTime(Double toTime) {
  107 + this.toTime = toTime;
  108 + }
  109 +
  110 + public String getFirstTime() {
  111 + return firstTime;
  112 + }
  113 +
  114 + public void setFirstTime(String firstTime) {
  115 + this.firstTime = firstTime;
  116 + }
  117 +
  118 + public String getEndTime() {
  119 + return endTime;
  120 + }
  121 +
  122 + public void setEndTime(String endTime) {
  123 + this.endTime = endTime;
  124 + }
  125 +
  126 + public Integer getDirections() {
  127 + return directions;
  128 + }
  129 +
  130 + public void setDirections(Integer directions) {
  131 + this.directions = directions;
  132 + }
  133 +
  134 + public Integer getVersions() {
  135 + return versions;
  136 + }
  137 +
  138 + public void setVersions(Integer versions) {
  139 + this.versions = versions;
  140 + }
  141 +
  142 + public String getStationCode() {
  143 + return stationCode;
  144 + }
  145 +
  146 + public void setStationCode(String stationCode) {
  147 + this.stationCode = stationCode;
  148 + }
  149 +
  150 + public String getStationName() {
  151 + return stationName;
  152 + }
  153 +
  154 + public void setStationName(String stationName) {
  155 + this.stationName = stationName;
  156 + }
  157 +
  158 + public String getShapesType() {
  159 + return shapesType;
  160 + }
  161 +
  162 + public void setShapesType(String shapesType) {
  163 + this.shapesType = shapesType;
  164 + }
  165 +
  166 + public Integer getRadius() {
  167 + return radius;
  168 + }
  169 +
  170 + public void setRadius(Integer radius) {
  171 + this.radius = radius;
  172 + }
  173 +
  174 + public String getPolygonGrid() {
  175 + return polygonGrid;
  176 + }
  177 +
  178 + public void setPolygonGrid(String polygonGrid) {
  179 + this.polygonGrid = polygonGrid;
  180 + }
  181 +}