Commit 2874f143630b628aa44745f789a303908012420d

Authored by 李强
1 parent 87f6daff

李强

src/main/java/com/bsth/service/impl/StationServiceImpl.java
@@ -192,7 +192,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem @@ -192,7 +192,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem
192 192
193 } 193 }
194 194
195 - if(resultLine.getStartStationName()==null){ 195 + if(resultLine.getStartStationName().equals("")){
196 196
197 for(int k =0;k<sizeL;k++) { 197 for(int k =0;k<sizeL;k++) {
198 198
@@ -209,7 +209,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -209,7 +209,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
209 209
210 }; 210 };
211 211
212 - if(resultLine.getEndStationName()==null) { 212 + if(resultLine.getEndStationName().equals("")) {
213 213
214 for(int k =0;k<sizeL;k++) { 214 for(int k =0;k<sizeL;k++) {
215 215
@@ -1334,153 +1334,8 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -1334,153 +1334,8 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1334 if(!stationJSON.equals("")) { 1334 if(!stationJSON.equals("")) {
1335 1335
1336 // 保存站点与站点路由信息 1336 // 保存站点与站点路由信息
1337 - resultSaveMapm = savaStationAndStationRouteInfo( stationJSON, sectionDistance, sectionDuration, dbType,radius, shapesType, destroy, versions, sumUpOrDownMileage, directions, resultLine);  
1338 -  
1339 - /* 1337 + // resultSaveMapm = savaStationAndStationRouteInfo( stationJSON, sectionDistance, sectionDuration, dbType,radius, shapesType, destroy, versions, sumUpOrDownMileage, directions, resultLine);
1340 1338
1341 - JSONArray stationsArray = JSONArray.parseArray(stationJSON);  
1342 -  
1343 - for(int i = 0;i <stationsArray.size();i++) {  
1344 -  
1345 - // 站点名称  
1346 - String stationName = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("name").toString();  
1347 -  
1348 - String distanceStr = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("distance").toString();  
1349 -  
1350 - String durationStr = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("duration").toString();  
1351 -  
1352 - // 百度经纬度坐标  
1353 - String bJwpoints = "";  
1354 -  
1355 - // 百度坐标经度  
1356 - String bLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lng").toString();  
1357 -  
1358 - // 百度坐标纬度  
1359 - String bLatx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lat").toString();  
1360 -  
1361 - // 百度经纬度  
1362 - bJwpoints = bLonx + " " + bLatx;  
1363 -  
1364 - List<Object[]> stationNameList = repository.findStationName(stationName);  
1365 -  
1366 - boolean isHave = isHaveStationname(bJwpoints,stationNameList);  
1367 -  
1368 - // 初始化站点对象  
1369 - Station arg0 = new Station();  
1370 -  
1371 - // 站点编码  
1372 - long stationCode = 0L;  
1373 -  
1374 - if(isHave) {  
1375 -  
1376 - Integer stationId = Integer.parseInt(stationNameList.get(0)[1].toString());  
1377 -  
1378 - arg0 = repository.findOne(stationId);  
1379 -  
1380 - stationCode = Integer.parseInt(arg0.getStationCod());  
1381 -  
1382 - }else {  
1383 -  
1384 - stationCode = GetUIDAndCode.getStationId();  
1385 -  
1386 - int stationId = (int) (stationCode);  
1387 -  
1388 - arg0.setId(stationId);  
1389 -  
1390 - arg0.setStationName(stationName);  
1391 -  
1392 - // 原坐标类型  
1393 - arg0.setDbType(dbType);  
1394 -  
1395 - // 站点地理位置WGS坐标经度  
1396 - String gLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lng").toString();  
1397 - arg0.setgLonx(Float.parseFloat(gLonx));  
1398 -  
1399 - // 站点地理位置WGS坐标纬度  
1400 - String gLaty = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lat").toString();  
1401 - arg0.setgLaty(Float.parseFloat(gLaty));  
1402 -  
1403 - // 半径  
1404 - int radius = map.get("radius").equals("") ? 0 : Integer.parseInt(map.get("radius").toString());  
1405 - arg0.setRadius(radius);  
1406 -  
1407 - // 图形类型  
1408 - String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString();  
1409 - arg0.setShapesType(shapesType);  
1410 -  
1411 - // 站点编码  
1412 - arg0.setStationCod(String.valueOf(stationCode));  
1413 -  
1414 - // 是否想撤销  
1415 - arg0.setDestroy(destroy);  
1416 -  
1417 - // 版本号  
1418 - arg0.setVersions(versions);  
1419 -  
1420 - arg0.setbJwpoints(bJwpoints);  
1421 -  
1422 - // 插入站点信息  
1423 - repository.save(arg0);  
1424 -  
1425 -  
1426 - // 站点路由对象  
1427 - StationRoute route = new StationRoute();  
1428 -  
1429 - // 站点名称  
1430 - route.setStationName(stationName);  
1431 -  
1432 - route.setDistances(distance);  
1433 -  
1434 - route.setToTime(duration);  
1435 -  
1436 - route.setDestroy(destroy);  
1437 -  
1438 - // 站点编码  
1439 - route.setStationCode(arg0.getStationCod());  
1440 -  
1441 - // 站点序号  
1442 - route.setStationRouteCode((i+1)*100);  
1443 -  
1444 - // 站点类型  
1445 - if(i==0) {  
1446 -  
1447 - // 起始站  
1448 - route.setStationMark("B");  
1449 -  
1450 - }else if(i==stationsArray.size()-1) {  
1451 -  
1452 - // 终点站  
1453 - route.setStationMark("E");  
1454 -  
1455 - }else {  
1456 -  
1457 - // 中途站  
1458 - route.setStationMark("Z");  
1459 -  
1460 - }  
1461 -  
1462 - // 版本号  
1463 - route.setVersions(versions);  
1464 -  
1465 - // 站点ID  
1466 - route.setStation(arg0);  
1467 -  
1468 - // 方向  
1469 - route.setDirections(directions);  
1470 -  
1471 - // 线路ID  
1472 - route.setLine(resultLine);  
1473 -  
1474 - // 线路编码  
1475 - route.setLineCode(resultLine.getLineCode());  
1476 -  
1477 -  
1478 - // 插入站点路由信息  
1479 - routeRepository.save(route);  
1480 -  
1481 - }  
1482 - }  
1483 - */  
1484 } 1339 }
1485 1340
1486 // 路段长度 1341 // 路段长度
@@ -1492,7 +1347,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -1492,7 +1347,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1492 // 如果路段信息JSON字符串不为空 1347 // 如果路段信息JSON字符串不为空
1493 if(!sectionJSON.equals("")) { 1348 if(!sectionJSON.equals("")) {
1494 1349
1495 - manualSaveSectionAndSectionRoute(sectionJSON, speedLimitStr, sectionDistance, sectionDuration, dbType, versions, resultLine, destroy, directions); 1350 + // manualSaveSectionAndSectionRoute(sectionJSON, speedLimitStr, sectionDistance, sectionDuration, dbType, versions, resultLine, destroy, directions);
1496 1351
1497 } 1352 }
1498 1353
@@ -1504,11 +1359,11 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -1504,11 +1359,11 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1504 sumUpOrDownMileage = s.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); 1359 sumUpOrDownMileage = s.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
1505 1360
1506 // 更新里程 1361 // 更新里程
1507 - updateLineInfoUpOrDownMileage( resultLine , directions, sumUpOrDownMileage); 1362 + // updateLineInfoUpOrDownMileage( resultLine , directions, sumUpOrDownMileage);
1508 1363
1509 if(directions==0) { 1364 if(directions==0) {
1510 1365
1511 - lineUpdateStationName(resultLine); 1366 + // lineUpdateStationName(resultLine);
1512 1367
1513 } 1368 }
1514 1369
src/main/resources/static/pages/base/stationroute/addstationstemplate.html
@@ -33,6 +33,26 @@ @@ -33,6 +33,26 @@
33 </div> 33 </div>
34 34
35 <div class="form-group"> 35 <div class="form-group">
  36 + <label class="col-md-3 control-label">坐标系类型:</label>
  37 + <div class="col-md-9">
  38 + <div class="icheck-list">
  39 + <label>
  40 + <input type="radio" class="icheck" name="baseRes" value='No'> 暂无坐标系
  41 + </label>
  42 + <label>
  43 + <input type="radio" class="icheck" name="baseRes" value='GCJ-02' > 火星坐标系
  44 + </label>
  45 + <label >
  46 + <input type="radio" class="icheck" name="baseRes" value='BD-09'> 百度坐标系
  47 + </label>
  48 + <label >
  49 + <input type="radio" class="icheck" name="baseRes" value='WGS84' checked> WGS84坐标系
  50 + </label>
  51 + </div>
  52 + </div>
  53 + </div>
  54 +
  55 + <div class="form-group">
36 <div class="alert alert-info font-blue-chambray" style="background-color: #2C3E50"> 56 <div class="alert alert-info font-blue-chambray" style="background-color: #2C3E50">
37 <h5 class="block"><span class="help-block" style="color:#1bbc9b;"> * 手动添加站点规划说明: </span></h5> 57 <h5 class="block"><span class="help-block" style="color:#1bbc9b;"> * 手动添加站点规划说明: </span></h5>
38 <p> 58 <p>
@@ -146,21 +166,135 @@ $(&#39;#add_station_template_mobal&#39;).on(&#39;AddStationTempMobal.show&#39;, function(e,map,a @@ -146,21 +166,135 @@ $(&#39;#add_station_template_mobal&#39;).on(&#39;AddStationTempMobal.show&#39;, function(e,map,a
146 // 弹出正在加载层 166 // 弹出正在加载层
147 var i = layer.load(0,{offset:['200px', '280px']}); 167 var i = layer.load(0,{offset:['200px', '280px']});
148 168
149 - // 表单序列 169 + // 表单序列
150 var params = form.serializeJSON(); 170 var params = form.serializeJSON();
151 171
  172 + var baseResValue = params.baseRes;
  173 +
152 // 站点名称字符串切割 174 // 站点名称字符串切割
153 var paramsStationsArray = params.stations.split('\r\n'); 175 var paramsStationsArray = params.stations.split('\r\n');
154 176
155 - var stationList = [];  
156 -  
157 var len = paramsStationsArray.length; 177 var len = paramsStationsArray.length;
158 178
159 - if(len>0) { 179 + if(baseResValue=='No'){
160 180
161 - for(var k =0;k<len;k++) { 181 + debugger;
  182 +
  183 + var stationList = [];
  184 +
  185 + for(var k =0;k<len;k++)
  186 + stationList.push({name:paramsStationsArray[k]+'公交车站'});
  187 +
  188 +
  189 + console.log(stationList);
  190 +
  191 + return;
  192 +
  193 + // 根据站点名称获取百度坐标
  194 + map.stationsNameToPoints(stationList,function(resultJson) {
162 195
163 - debugger; 196 + // 根据坐标点获取两点之间的时间与距离
  197 + map.getDistanceAndDuration(resultJson,function(stationdataList) {
  198 +
  199 + // 根据坐标点获取两点之间的折线路段
  200 + map.getSectionListPlonly(stationdataList,function(sectiondata) {
  201 +
  202 + var addLine = LineObj.getLineObj();
  203 +
  204 + // 设置第一个站的距离
  205 + stationdataList[0].distance = '';
  206 +
  207 + // 设置第一个站的时间
  208 + stationdataList[0].duration = '';
  209 +
  210 + // 定义站点信息JSON字符串
  211 + var stationJSON = JSON.stringify(stationdataList);
  212 +
  213 + // 定义路段信息字符串
  214 + var sectionJSON = JSON.stringify(sectiondata);
  215 +
  216 + // 参数集合
  217 + var params = {};
  218 +
  219 + // 站点信息JSON字符串
  220 + params.stationJSON = stationJSON;
  221 +
  222 + // 线路ID
  223 + params.lineId = addLine.id;
  224 +
  225 + // 方向
  226 + params.directions = directionData;
  227 +
  228 + // 原始坐标类型
  229 + params.dbType = 'b';
  230 +
  231 + // 圆形半径
  232 + params.radius = '100';
  233 +
  234 + // 限速
  235 + params.speedLimit = '60';
  236 +
  237 + // 图形类型(r:圆形;p:多边形)
  238 + params.shapesType = 'r';
  239 +
  240 + // destroy:是否撤销
  241 + params.destroy = '0';
  242 +
  243 + // versions:版本号
  244 + params.versions = '1';
  245 +
  246 + // 路段信息JSON字符串
  247 + params.sectionJSON = sectionJSON;
  248 +
  249 + // 保存
  250 + ajaxd.manualSave(params,function(rd) {
  251 +
  252 + if(rd.status='SUCCESS') {
  253 +
  254 + layer.msg('保存成功!');
  255 +
  256 + }else {
  257 +
  258 + layer.msg('保存失败!');
  259 +
  260 + }
  261 +
  262 + // 关闭弹出层
  263 + layer.closeAll();
  264 +
  265 + // 清除地图覆盖物
  266 + map.clearMarkAndOverlays();
  267 +
  268 + // 刷新树
  269 + fun.resjtreeDate(addLine.id,directionData);
  270 +
  271 + // 查询上行路段信息
  272 + ajaxd.getSectionRouteInfo(addLine.id,directionData,function(data) {
  273 +
  274 + // 在地图上画出线路走向
  275 + fun.linePanlThree(data,directionData);
  276 +
  277 + });
  278 +
  279 + });
  280 +
  281 + });
  282 +
  283 + });
  284 +
  285 + });
  286 +
  287 + }else {
  288 +
  289 +
  290 +
  291 +
  292 + }
  293 +
  294 +
  295 + /* if(len>0) {
  296 +
  297 + for(var k =0;k<len;k++) {
164 298
165 if(paramsStationsArray[k]=="") 299 if(paramsStationsArray[k]=="")
166 continue; 300 continue;
@@ -185,102 +319,7 @@ $(&#39;#add_station_template_mobal&#39;).on(&#39;AddStationTempMobal.show&#39;, function(e,map,a @@ -185,102 +319,7 @@ $(&#39;#add_station_template_mobal&#39;).on(&#39;AddStationTempMobal.show&#39;, function(e,map,a
185 319
186 return; 320 return;
187 321
188 - }  
189 - console.log(stationList);  
190 - // 根据站点名称获取百度坐标  
191 - map.stationsNameToPoints(stationList,function(resultJson) {  
192 - console.log(resultJson);  
193 - debugger;  
194 - // 根据坐标点获取两点之间的时间与距离  
195 - map.getDistanceAndDuration(resultJson,function(stationdataList) {  
196 -  
197 - // 根据坐标点获取两点之间的折线路段  
198 - map.getSectionListPlonly(stationdataList,function(sectiondata) {  
199 -  
200 - var addLine = LineObj.getLineObj();  
201 -  
202 - // 设置第一个站的距离  
203 - stationdataList[0].distance = '';  
204 -  
205 - // 设置第一个站的时间  
206 - stationdataList[0].duration = '';  
207 -  
208 - // 定义站点信息JSON字符串  
209 - var stationJSON = JSON.stringify(stationdataList);  
210 -  
211 - // 定义路段信息字符串  
212 - var sectionJSON = JSON.stringify(sectiondata);  
213 -  
214 - // 参数集合  
215 - var params = {};  
216 -  
217 - // 站点信息JSON字符串  
218 - params.stationJSON = stationJSON;  
219 -  
220 - // 线路ID  
221 - params.lineId = addLine.id;  
222 -  
223 - // 方向  
224 - params.directions = directionData;  
225 -  
226 - // 原始坐标类型  
227 - params.dbType = 'b';  
228 -  
229 - // 圆形半径  
230 - params.radius = '100';  
231 -  
232 - // 限速  
233 - params.speedLimit = '60';  
234 -  
235 - // 图形类型(r:圆形;p:多边形)  
236 - params.shapesType = 'r';  
237 -  
238 - // destroy:是否撤销  
239 - params.destroy = '0';  
240 -  
241 - // versions:版本号  
242 - params.versions = '1';  
243 -  
244 - // 路段信息JSON字符串  
245 - params.sectionJSON = sectionJSON;  
246 -  
247 - // 保存  
248 - ajaxd.manualSave(params,function(rd) {  
249 -  
250 - if(rd.status='SUCCESS') {  
251 -  
252 - layer.msg('保存成功!');  
253 -  
254 - }else {  
255 -  
256 - layer.msg('保存失败!');  
257 -  
258 - }  
259 -  
260 - // 关闭弹出层  
261 - layer.closeAll();  
262 -  
263 - // 清除地图覆盖物  
264 - map.clearMarkAndOverlays();  
265 -  
266 - // 刷新树  
267 - fun.resjtreeDate(addLine.id,directionData);  
268 -  
269 - // 查询上行路段信息  
270 - ajaxd.getSectionRouteInfo(addLine.id,directionData,function(data) {  
271 -  
272 - // 在地图上画出线路走向  
273 - fun.linePanlThree(data,directionData);  
274 -  
275 - });  
276 -  
277 - });  
278 -  
279 - });  
280 -  
281 - });  
282 -  
283 - }); 322 + } */
284 323
285 } 324 }
286 325
src/main/resources/static/pages/base/stationroute/js/stationroute-list-function.js
@@ -301,11 +301,14 @@ var PublicFunctions = function () { @@ -301,11 +301,14 @@ var PublicFunctions = function () {
301 // 添加站点坐标 301 // 添加站点坐标
302 tempM.potion = BusLine.getBusStation(k).position; 302 tempM.potion = BusLine.getBusStation(k).position;
303 303
  304 + tempM.wgs = {x:'',y:''};
  305 +
304 // 添加 306 // 添加
305 stationInfo.push(tempM); 307 stationInfo.push(tempM);
306 308
307 } 309 }
308 - 310 + console.log(stationInfo);
  311 + debugger;
309 // 获取站点之间的距离与时间 312 // 获取站点之间的距离与时间
310 WorldsBMap.getDistanceAndDuration(stationInfo,function(json) { 313 WorldsBMap.getDistanceAndDuration(stationInfo,function(json) {
311 314