Commit b611c3d147b822f3abd1eb5663e27a6c9830e318

Authored by 王通
1 parent 6df5f7ab

1.

src/main/java/com/bsth/service/impl/LsStationRouteServiceImpl.java
@@ -130,10 +130,10 @@ public class LsStationRouteServiceImpl extends BaseServiceImpl<LsStationRoute, I @@ -130,10 +130,10 @@ public class LsStationRouteServiceImpl extends BaseServiceImpl<LsStationRoute, I
130 if (line == null) { 130 if (line == null) {
131 throw new RuntimeException(String.format("未找到ID为%d的线路信息", lineId)); 131 throw new RuntimeException(String.format("未找到ID为%d的线路信息", lineId));
132 } 132 }
133 - stationRoutesHandle(line, versions, directions, stationRoutes); 133 + List<Station> stations = stationRoutesHandle(line, versions, directions, stationRoutes);
134 List<Section> sections = sectionRoutesHandle(line, versions, directions, sectionRoutes); 134 List<Section> sections = sectionRoutesHandle(line, versions, directions, sectionRoutes);
135 135
136 - //stationRepository.saveAll(stations); 136 + stationRepository.saveAll(stations);
137 sectionRepository.saveAll(sections); 137 sectionRepository.saveAll(sections);
138 lsStationRouteRepository.saveAll(stationRoutes); 138 lsStationRouteRepository.saveAll(stationRoutes);
139 lsSectionRouteRepository.saveAll(sectionRoutes); 139 lsSectionRouteRepository.saveAll(sectionRoutes);
@@ -144,8 +144,9 @@ public class LsStationRouteServiceImpl extends BaseServiceImpl&lt;LsStationRoute, I @@ -144,8 +144,9 @@ public class LsStationRouteServiceImpl extends BaseServiceImpl&lt;LsStationRoute, I
144 return result; 144 return result;
145 } 145 }
146 146
147 - private void stationRoutesHandle(Line line, Integer versions, Integer directions, List<LsStationRoute> stationRoutes) {  
148 - int count = 0; 147 + private List<Station> stationRoutesHandle(Line line, Integer versions, Integer directions, List<LsStationRoute> stationRoutes) {
  148 + List<Station> stations = new ArrayList<>();
  149 + int currentId = stationRepository.findLatestStationId(), count = 0;
149 for (int len = stationRoutes.size();count < len;) { 150 for (int len = stationRoutes.size();count < len;) {
150 LsStationRoute stationRoute = stationRoutes.get(count); 151 LsStationRoute stationRoute = stationRoutes.get(count);
151 stationRoute.setStationMark(count == 0 ? "B" : count == len - 1 ? "E" : "Z"); 152 stationRoute.setStationMark(count == 0 ? "B" : count == len - 1 ? "E" : "Z");
@@ -156,7 +157,18 @@ public class LsStationRouteServiceImpl extends BaseServiceImpl&lt;LsStationRoute, I @@ -156,7 +157,18 @@ public class LsStationRouteServiceImpl extends BaseServiceImpl&lt;LsStationRoute, I
156 stationRoute.setLineCode(line.getLineCode()); 157 stationRoute.setLineCode(line.getLineCode());
157 stationRoute.setStationRouteCode(100 * count); 158 stationRoute.setStationRouteCode(100 * count);
158 stationRoute.setStationCode(stationRoute.getStation().getStationCode()); 159 stationRoute.setStationCode(stationRoute.getStation().getStationCode());
  160 +
  161 + Station station = stationRoute.getStation();
  162 + if (station.getId() == null) {
  163 + station.setId(currentId + count);
  164 + station.setStationCode(station.getId().toString());
  165 + stationRoute.setStationCode(station.getStationCode());
  166 + centerPoint(station);
  167 + stations.add(station);
  168 + }
159 } 169 }
  170 +
  171 + return stations;
160 } 172 }
161 173
162 private List<Section> sectionRoutesHandle(Line line, Integer versions, Integer directions, List<LsSectionRoute> sectionRoutes) { 174 private List<Section> sectionRoutesHandle(Line line, Integer versions, Integer directions, List<LsSectionRoute> sectionRoutes) {
src/main/java/com/bsth/service/impl/StationServiceImpl.java
@@ -106,23 +106,18 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -106,23 +106,18 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
106 for (Station s : stations) { 106 for (Station s : stations) {
107 Location location = CoordinateConverter.LocationMake(s.getCenterPointWkt()); 107 Location location = CoordinateConverter.LocationMake(s.getCenterPointWkt());
108 Point point = new Point(location.getLng(), location.getLat()); 108 Point point = new Point(location.getLng(), location.getLat());
109 - double minDistance = Double.MAX_VALUE, matchDistance = 60;  
110 - Station target = null; 109 + double matchDistance = 60;
111 for (Station s1 : stations1) { 110 for (Station s1 : stations1) {
112 Location location1 = CoordinateConverter.LocationMake(s1.getCenterPoint().toString()); 111 Location location1 = CoordinateConverter.LocationMake(s1.getCenterPoint().toString());
113 Point point1 = new Point(location1.getLng(), location1.getLat()); 112 Point point1 = new Point(location1.getLng(), location1.getLat());
114 double distance = GeoUtils.getDistance(point, point1); 113 double distance = GeoUtils.getDistance(point, point1);
115 if (distance <= matchDistance) { 114 if (distance <= matchDistance) {
116 - target = s1; 115 + s.setId(s1.getId());
  116 + s.setStationCode(s1.getStationCode());
  117 + s.setStationName(s1.getStationName());
117 break; 118 break;
118 } 119 }
119 - if (distance < minDistance) {  
120 - target = s1;  
121 - }  
122 } 120 }
123 - s.setId(target.getId());  
124 - s.setStationCode(target.getStationCode());  
125 - s.setStationName(target.getStationName());  
126 } 121 }
127 } 122 }
128 123
src/main/resources/static/pages/base/stationroute/add_routes_template.html
@@ -226,7 +226,7 @@ $(&#39;#add_routes_template_modal&#39;).on(&#39;modal.show&#39;, function(e,_WorldsBMap,_GetAjax @@ -226,7 +226,7 @@ $(&#39;#add_routes_template_modal&#39;).on(&#39;modal.show&#39;, function(e,_WorldsBMap,_GetAjax
226 let sectionListTemp = arrayFormat.sectionList; 226 let sectionListTemp = arrayFormat.sectionList;
227 let sectionList = []; 227 let sectionList = [];
228 // 隔30个取一个点(相当于30s) 228 // 隔30个取一个点(相当于30s)
229 - let typeNum = type == 0 ? 30:1; 229 + let typeNum = 1;
230 for(let i = 0; i * typeNum < sectionListTemp.length; i++) { 230 for(let i = 0; i * typeNum < sectionListTemp.length; i++) {
231 sectionList[i] = sectionListTemp[i * typeNum]; 231 sectionList[i] = sectionListTemp[i * typeNum];
232 } 232 }
src/main/resources/static/pages/base/stationroute/destroy_stationroute.html
@@ -215,7 +215,6 @@ $(&#39;#delete_station_mobal&#39;).on(&#39;deleteStationMobal.show&#39;,function(e, ajaxd, line, @@ -215,7 +215,6 @@ $(&#39;#delete_station_mobal&#39;).on(&#39;deleteStationMobal.show&#39;,function(e, ajaxd, line,
215 var i = layer.load(2); 215 var i = layer.load(2);
216 // 异步请求获取表格数据 216 // 异步请求获取表格数据
217 $.get('/api/lsstationroute/findPageByParams', params, function(result) { 217 $.get('/api/lsstationroute/findPageByParams', params, function(result) {
218 - debugger  
219 // 添加序号 218 // 添加序号
220 if (!result.content) { 219 if (!result.content) {
221 result.content = new Array(); 220 result.content = new Array();
src/main/resources/static/pages/base/stationroute/js/stationroute-list-events.js
@@ -148,7 +148,6 @@ $(function(){ @@ -148,7 +148,6 @@ $(function(){
148 var Line = LineObj.getLineObj(); 148 var Line = LineObj.getLineObj();
149 console.log($($("#versions").find("option:selected")[0]).attr("status")); 149 console.log($($("#versions").find("option:selected")[0]).attr("status"));
150 var params = {lineId: Line.id, version: $('#versions').val(), direction: 1, otherDirection: 0}; 150 var params = {lineId: Line.id, version: $('#versions').val(), direction: 1, otherDirection: 0};
151 - debugger  
152 quote(params,index); 151 quote(params,index);
153 }); 152 });
154 153
src/main/resources/static/pages/base/stationroute/js/stationroute-list-map.js
@@ -643,9 +643,7 @@ window.WorldsBMap = function () { @@ -643,9 +643,7 @@ window.WorldsBMap = function () {
643 localtionRoad: function (sectionName, callback) { 643 localtionRoad: function (sectionName, callback) {
644 // 关闭信息窗口 644 // 关闭信息窗口
645 mapBValue.closeInfoWindow(); 645 mapBValue.closeInfoWindow();
646 - debugger  
647 GetAjaxData.findSectionByName(sectionName, function (sections) { 646 GetAjaxData.findSectionByName(sectionName, function (sections) {
648 - debugger  
649 var marker; 647 var marker;
650 if (sections.length > 0) { 648 if (sections.length > 0) {
651 var points = new Array(); 649 var points = new Array();