Commit 72e5c26fdbc837a57f7bea907df732a6a23b28d0
1 parent
f386d7bf
基础数据功能代码完善
Showing
25 changed files
with
1556 additions
and
342 deletions
pom.xml
| ... | ... | @@ -158,6 +158,13 @@ |
| 158 | 158 | <repositories> |
| 159 | 159 | <repository> |
| 160 | 160 | <id>spring-snapshots</id> |
| 161 | + <url>http://repo1.maven.org/maven2</url> | |
| 162 | + <snapshots> | |
| 163 | + <enabled>true</enabled> | |
| 164 | + </snapshots> | |
| 165 | + </repository> | |
| 166 | + <!-- <repository> | |
| 167 | + <id>spring-snapshots</id> | |
| 161 | 168 | <url>http://repo.spring.io/snapshot</url> |
| 162 | 169 | <snapshots> |
| 163 | 170 | <enabled>true</enabled> |
| ... | ... | @@ -166,7 +173,7 @@ |
| 166 | 173 | <repository> |
| 167 | 174 | <id>spring-milestones</id> |
| 168 | 175 | <url>http://repo.spring.io/milestone</url> |
| 169 | - </repository> | |
| 176 | + </repository> --> | |
| 170 | 177 | </repositories> |
| 171 | 178 | <pluginRepositories> |
| 172 | 179 | <pluginRepository> | ... | ... |
src/main/java/com/bsth/controller/SectionController.java
| 1 | 1 | package com.bsth.controller; |
| 2 | 2 | |
| 3 | +import java.util.Map; | |
| 4 | + | |
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 3 | 6 | import org.springframework.web.bind.annotation.RequestMapping; |
| 7 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 8 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 4 | 9 | import org.springframework.web.bind.annotation.RestController; |
| 5 | 10 | |
| 6 | 11 | import com.bsth.entity.Section; |
| 12 | +import com.bsth.service.SectionService; | |
| 7 | 13 | |
| 8 | 14 | /** |
| 9 | 15 | * |
| ... | ... | @@ -24,5 +30,17 @@ import com.bsth.entity.Section; |
| 24 | 30 | @RestController |
| 25 | 31 | @RequestMapping("section") |
| 26 | 32 | public class SectionController extends BaseController<Section, Integer> { |
| 33 | + | |
| 34 | + @Autowired | |
| 35 | + SectionService service; | |
| 36 | + | |
| 37 | + @RequestMapping(value="sectionUpdate" , method = RequestMethod.POST) | |
| 38 | + public Map<String, Object> sectionUpdate(@RequestParam Map<String, Object> map) { | |
| 39 | + | |
| 40 | + map.put("updateBy", ""); | |
| 41 | + | |
| 42 | + return service.sectionUpdate(map); | |
| 43 | + | |
| 44 | + } | |
| 27 | 45 | |
| 28 | 46 | } | ... | ... |
src/main/java/com/bsth/controller/StationController.java
| ... | ... | @@ -43,6 +43,13 @@ public class StationController extends BaseController<Station, Integer> { |
| 43 | 43 | |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | + @RequestMapping(value="manualSave" , method = RequestMethod.POST) | |
| 47 | + public Map<String, Object> manualSave(@RequestParam Map<String, Object> map) { | |
| 48 | + | |
| 49 | + return service.manualSave(map); | |
| 50 | + | |
| 51 | + } | |
| 52 | + | |
| 46 | 53 | @RequestMapping(value="stationSave" , method = RequestMethod.POST) |
| 47 | 54 | public Map<String, Object> stationSave(@RequestParam Map<String, Object> map) { |
| 48 | 55 | ... | ... |
src/main/java/com/bsth/controller/StationRouteController.java
| ... | ... | @@ -38,22 +38,6 @@ public class StationRouteController extends BaseController<StationRoute, Integer |
| 38 | 38 | @Autowired |
| 39 | 39 | StationRouteService service; |
| 40 | 40 | |
| 41 | - /*@RequestMapping(method = RequestMethod.GET) | |
| 42 | - public Page<StationRoute> list(@RequestParam Map<String, Object> map, | |
| 43 | - @RequestParam(defaultValue = "0") int page, | |
| 44 | - @RequestParam(defaultValue = "5") int size, | |
| 45 | - @RequestParam(defaultValue = "id") String order, | |
| 46 | - @RequestParam(defaultValue = "DESC") String direction){ | |
| 47 | - | |
| 48 | - Direction d; | |
| 49 | - | |
| 50 | - if(null != direction && direction.equals("ASC")) | |
| 51 | - d = Direction.ASC; | |
| 52 | - else | |
| 53 | - d = Direction.DESC; | |
| 54 | - | |
| 55 | - return service.list(map, new PageRequest(page, size, new Sort(d, order))); | |
| 56 | - }*/ | |
| 57 | 41 | |
| 58 | 42 | @RequestMapping(value = "/findStations" , method = RequestMethod.GET) |
| 59 | 43 | public List<Map<String, Object>> findPoints(@RequestParam Map<String, Object> map) { |
| ... | ... | @@ -69,4 +53,14 @@ public class StationRouteController extends BaseController<StationRoute, Integer |
| 69 | 53 | public List<Map<String, Object>> findUpStationRouteCode(@RequestParam Map<String, Object> map) { |
| 70 | 54 | return service.findUpStationRouteCode(map); |
| 71 | 55 | } |
| 56 | + | |
| 57 | + @RequestMapping(value = "/getStationRouteCenterPoints" , method = RequestMethod.GET) | |
| 58 | + public List<Map<String, Object>> getStationRouteCenterPoints(@RequestParam Map<String, Object> map) { | |
| 59 | + return service.getStationRouteCenterPoints(map); | |
| 60 | + } | |
| 61 | + | |
| 62 | + @RequestMapping(value = "/stationRouteIsDestroy" , method = RequestMethod.POST) | |
| 63 | + public Map<String, Object> stationRouteIsDestroy(@RequestParam Map<String, Object> map) { | |
| 64 | + return service.stationRouteIsDestroy(map); | |
| 65 | + } | |
| 72 | 66 | } | ... | ... |
src/main/java/com/bsth/repository/SectionRepository.java
| ... | ... | @@ -61,5 +61,11 @@ public interface SectionRepository extends BaseRepository<Section, Integer> { |
| 61 | 61 | String descriptions, int versions); |
| 62 | 62 | |
| 63 | 63 | |
| 64 | + @Transactional | |
| 65 | + @Modifying | |
| 66 | + @Query(value="UPDATE bsth_c_section SET " + | |
| 67 | + "gsection_vector = GEOMFROMTEXT(?2) , " + | |
| 68 | + "bsection_vector = GEOMFROMTEXT(?3) WHERE id = ?1", nativeQuery=true) | |
| 69 | + public void sectionUpdate(Integer sectionId,String gsectionVector,String bsectionVector); | |
| 64 | 70 | |
| 65 | 71 | } | ... | ... |
src/main/java/com/bsth/repository/StationRouteRepository.java
| ... | ... | @@ -2,8 +2,10 @@ package com.bsth.repository; |
| 2 | 2 | |
| 3 | 3 | import java.util.List; |
| 4 | 4 | |
| 5 | +import org.springframework.data.jpa.repository.Modifying; | |
| 5 | 6 | import org.springframework.data.jpa.repository.Query; |
| 6 | 7 | import org.springframework.stereotype.Repository; |
| 8 | +import org.springframework.transaction.annotation.Transactional; | |
| 7 | 9 | |
| 8 | 10 | import com.bsth.entity.StationRoute; |
| 9 | 11 | |
| ... | ... | @@ -83,4 +85,16 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int |
| 83 | 85 | "select MAX(station_route_code) as stationRouteCode from bsth_c_stationroute r WHERE " + |
| 84 | 86 | "r.line=?1 and r.directions =?2 and station_route_code< ?3 ) and t.line=?1 and t.directions = ?2", nativeQuery=true) |
| 85 | 87 | List<Object[]> findUpStationRouteCode(Integer lineId,Integer direction,Integer stationRouteCode); |
| 88 | + | |
| 89 | + | |
| 90 | + @Query(value = "SELECT s.b_jwpoints FROM (" + | |
| 91 | + "SELECT b.station FROM bsth_c_stationroute b where b.line =?1 and b.directions = ?2) r " + | |
| 92 | + "LEFT JOIN bsth_c_station s on r.station = s.id", nativeQuery=true) | |
| 93 | + List<Object[]> getSelectStationRouteCenterPoints(Integer lineId,Integer direction); | |
| 94 | + | |
| 95 | + @Transactional | |
| 96 | + @Modifying | |
| 97 | + @Query(value="UPDATE bsth_c_stationroute SET " + | |
| 98 | + "destroy = ?2 WHERE id = ?1", nativeQuery=true) | |
| 99 | + public void stationRouteIsDestroyUpd(Integer stationRouteId, Integer destroy); | |
| 86 | 100 | } | ... | ... |
src/main/java/com/bsth/service/SectionService.java
| 1 | 1 | package com.bsth.service; |
| 2 | 2 | |
| 3 | +import java.util.Map; | |
| 4 | + | |
| 3 | 5 | import com.bsth.entity.Section; |
| 4 | 6 | |
| 5 | 7 | /** |
| ... | ... | @@ -18,5 +20,6 @@ import com.bsth.entity.Section; |
| 18 | 20 | * |
| 19 | 21 | */ |
| 20 | 22 | public interface SectionService extends BaseService<Section, Integer> { |
| 21 | - | |
| 23 | + | |
| 24 | + Map<String, Object> sectionUpdate(Map<String, Object> map); | |
| 22 | 25 | } | ... | ... |
src/main/java/com/bsth/service/StationRouteService.java
| ... | ... | @@ -27,4 +27,8 @@ public interface StationRouteService extends BaseService<StationRoute, Integer> |
| 27 | 27 | Map<String, Object> systemQuote(Map<String, Object> map); |
| 28 | 28 | |
| 29 | 29 | List<Map<String, Object>> findUpStationRouteCode(Map<String, Object> map); |
| 30 | + | |
| 31 | + List<Map<String, Object>> getStationRouteCenterPoints(Map<String, Object> map); | |
| 32 | + | |
| 33 | + Map<String, Object> stationRouteIsDestroy(Map<String, Object> map); | |
| 30 | 34 | } | ... | ... |
src/main/java/com/bsth/service/StationService.java
| ... | ... | @@ -23,6 +23,8 @@ public interface StationService extends BaseService<Station, Integer> { |
| 23 | 23 | |
| 24 | 24 | Map<String, Object> systemSaveStations(Map<String, Object> map); |
| 25 | 25 | |
| 26 | + Map<String, Object> manualSave(Map<String, Object> map); | |
| 27 | + | |
| 26 | 28 | int getStationCode(); |
| 27 | 29 | |
| 28 | 30 | Map<String, Object> stationSaveMap(Map<String, Object> map); | ... | ... |
src/main/java/com/bsth/service/impl/SectionServiceImpl.java
| 1 | 1 | package com.bsth.service.impl; |
| 2 | 2 | |
| 3 | +import java.util.HashMap; | |
| 4 | +import java.util.Map; | |
| 5 | + | |
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 3 | 7 | import org.springframework.stereotype.Service; |
| 4 | 8 | |
| 9 | +import com.alibaba.fastjson.JSONArray; | |
| 10 | +import com.alibaba.fastjson.JSONObject; | |
| 11 | +import com.bsth.common.ResponseCode; | |
| 5 | 12 | import com.bsth.entity.Section; |
| 13 | +import com.bsth.repository.SectionRepository; | |
| 6 | 14 | import com.bsth.service.SectionService; |
| 7 | 15 | |
| 8 | 16 | /** |
| ... | ... | @@ -23,5 +31,81 @@ import com.bsth.service.SectionService; |
| 23 | 31 | |
| 24 | 32 | @Service |
| 25 | 33 | public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implements SectionService{ |
| 34 | + | |
| 35 | + @Autowired | |
| 36 | + SectionRepository repository; | |
| 37 | + | |
| 38 | + @Override | |
| 39 | + public Map<String, Object> sectionUpdate(Map<String, Object> map) { | |
| 40 | + Map<String, Object> resultMap = new HashMap<String, Object>(); | |
| 41 | + | |
| 42 | + try { | |
| 43 | + | |
| 44 | + Integer sectionId = map.get("sectionId").equals("") ? 0 : Integer.parseInt(map.get("sectionId").toString()); | |
| 45 | + | |
| 46 | + // 路段信息字符串 | |
| 47 | + String sectionJSON = map.get("sectionJSON").toString().equals("") ? "" : map.get("sectionJSON").toString(); | |
| 48 | + | |
| 49 | + // 如果路段信息JSON字符串不为空 | |
| 50 | + if(!sectionJSON.equals("")) { | |
| 51 | + | |
| 52 | + | |
| 53 | + // 转换成JSON数组 | |
| 54 | + JSONArray sectionsArray = JSONArray.parseArray(sectionJSON); | |
| 55 | + | |
| 56 | + // 原始线状图形坐标集合 | |
| 57 | + String sectionsBpoints = ""; | |
| 58 | + | |
| 59 | + // WGS线状图形坐标集合 | |
| 60 | + String sectionsWJPpoints = ""; | |
| 61 | + | |
| 62 | + // 遍历 | |
| 63 | + for(int s = 0 ;s<sectionsArray.size();s++) { | |
| 64 | + | |
| 65 | + String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString(); | |
| 66 | + | |
| 67 | + String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString(); | |
| 68 | + | |
| 69 | + String WGSLngStr = JSONObject.parseObject(sectionsArray.getJSONObject(s).get("WGSpotion").toString()).get("Lng").toString(); | |
| 70 | + | |
| 71 | + String WGSLatStr = JSONObject.parseObject(sectionsArray.getJSONObject(s).get("WGSpotion").toString()).get("Lat").toString(); | |
| 72 | + | |
| 73 | + if(s==0) { | |
| 74 | + | |
| 75 | + sectionsBpoints = pointsLngStr + " " + pointsLatStr; | |
| 76 | + | |
| 77 | + sectionsWJPpoints = WGSLngStr + " " + WGSLatStr; | |
| 78 | + | |
| 79 | + }else { | |
| 80 | + | |
| 81 | + sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr; | |
| 82 | + | |
| 83 | + sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr; | |
| 84 | + | |
| 85 | + } | |
| 86 | + | |
| 87 | + | |
| 88 | + } | |
| 89 | + | |
| 90 | + // WGS坐标点集合 | |
| 91 | + String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; | |
| 92 | + | |
| 93 | + // 原坐标点集合 | |
| 94 | + String bsectionVector = "LINESTRING(" + sectionsBpoints + ")"; | |
| 95 | + repository.sectionUpdate(sectionId, gsectionVector, bsectionVector); | |
| 96 | + } | |
| 97 | + | |
| 98 | + resultMap.put("status", ResponseCode.SUCCESS); | |
| 99 | + | |
| 100 | + } catch (Exception e) { | |
| 101 | + | |
| 102 | + resultMap.put("status", ResponseCode.ERROR); | |
| 103 | + | |
| 104 | + logger.error("save erro.", e); | |
| 105 | + | |
| 106 | + } | |
| 107 | + | |
| 108 | + return resultMap; | |
| 109 | + } | |
| 26 | 110 | |
| 27 | 111 | } | ... | ... |
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
| ... | ... | @@ -346,4 +346,57 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 346 | 346 | return list; |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | + @Override | |
| 350 | + public List<Map<String, Object>> getStationRouteCenterPoints(Map<String, Object> map) { | |
| 351 | + | |
| 352 | + List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>(); | |
| 353 | + | |
| 354 | + Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString()); | |
| 355 | + | |
| 356 | + Integer direction = map.get("direction").equals("") ? null : Integer.parseInt(map.get("direction").toString()); | |
| 357 | + | |
| 358 | + List<Object[]> list = repository.getSelectStationRouteCenterPoints(lineId, direction); | |
| 359 | + | |
| 360 | + if(list.size()>0) { | |
| 361 | + | |
| 362 | + for(int i = 0;i<list.size();i++) { | |
| 363 | + | |
| 364 | + Map<String, Object> tempM = new HashMap<String,Object>(); | |
| 365 | + | |
| 366 | + tempM.put("bJwpoints", list.get(i)); | |
| 367 | + | |
| 368 | + resultList.add(tempM); | |
| 369 | + | |
| 370 | + } | |
| 371 | + | |
| 372 | + } | |
| 373 | + | |
| 374 | + return resultList; | |
| 375 | + } | |
| 376 | + | |
| 377 | + @Override | |
| 378 | + public Map<String, Object> stationRouteIsDestroy(Map<String, Object> map) { | |
| 379 | + Map<String, Object> resultMap = new HashMap<String,Object>(); | |
| 380 | + | |
| 381 | + try { | |
| 382 | + | |
| 383 | + Integer stationRouteId = map.get("stationRouteId").equals("") ? 0 : Integer.parseInt(map.get("stationRouteId").toString()); | |
| 384 | + | |
| 385 | + Integer destroy = map.get("destroy").equals("") ? 0 : Integer.parseInt(map.get("destroy").toString()); | |
| 386 | + | |
| 387 | + repository.stationRouteIsDestroyUpd(stationRouteId, destroy); | |
| 388 | + | |
| 389 | + resultMap.put("status", ResponseCode.SUCCESS); | |
| 390 | + | |
| 391 | + } catch (Exception e) { | |
| 392 | + | |
| 393 | + resultMap.put("status", ResponseCode.ERROR); | |
| 394 | + | |
| 395 | + logger.error("save erro.", e); | |
| 396 | + | |
| 397 | + } | |
| 398 | + | |
| 399 | + return resultMap; | |
| 400 | + } | |
| 401 | + | |
| 349 | 402 | } | ... | ... |
src/main/java/com/bsth/service/impl/StationServiceImpl.java
| ... | ... | @@ -95,6 +95,10 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 95 | 95 | // 线路ID |
| 96 | 96 | int lineId = map.get("lineId").toString().equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); |
| 97 | 97 | |
| 98 | + Double sectionDistance = 0.0; | |
| 99 | + | |
| 100 | + Double sectionDuration = 0.0; | |
| 101 | + | |
| 98 | 102 | // 线路信息 |
| 99 | 103 | Line resultLine = lineRepository.findOne(lineId); |
| 100 | 104 | |
| ... | ... | @@ -118,6 +122,8 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 118 | 122 | |
| 119 | 123 | distance = d.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| 120 | 124 | |
| 125 | + sectionDistance= distance + sectionDistance; | |
| 126 | + | |
| 121 | 127 | Double duration = stationsArray.getJSONObject(i).get("duration").equals("") ? 0 : Double.parseDouble(stationsArray.getJSONObject(i).get("duration").toString()); |
| 122 | 128 | |
| 123 | 129 | // 转成分钟 |
| ... | ... | @@ -127,6 +133,8 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 127 | 133 | |
| 128 | 134 | duration = t.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| 129 | 135 | |
| 136 | + sectionDuration = duration + sectionDuration; | |
| 137 | + | |
| 130 | 138 | // 百度经纬度坐标 |
| 131 | 139 | String bJwpoints = ""; |
| 132 | 140 | |
| ... | ... | @@ -213,7 +221,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 213 | 221 | route.setStationCode(arg0.getStationCod()); |
| 214 | 222 | |
| 215 | 223 | // 站点序号 |
| 216 | - route.setStationRouteCode((i+1)*10); | |
| 224 | + route.setStationRouteCode((i+1)*100); | |
| 217 | 225 | |
| 218 | 226 | // 站点类型 |
| 219 | 227 | if(i==0) { |
| ... | ... | @@ -248,6 +256,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 248 | 256 | // 线路编码 |
| 249 | 257 | route.setLineCode(resultLine.getLineCode()); |
| 250 | 258 | |
| 259 | + route.setDestroy(destroy); | |
| 251 | 260 | |
| 252 | 261 | // 插入站点路由信息 |
| 253 | 262 | routeRepository.save(route); |
| ... | ... | @@ -345,10 +354,10 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 345 | 354 | String roadCoding = ""; |
| 346 | 355 | |
| 347 | 356 | // 路段距离 |
| 348 | - double sectionDistance = 0; | |
| 357 | + // double sectionDistance = 0; | |
| 349 | 358 | |
| 350 | 359 | // 路段时间 |
| 351 | - double sectionTime = 0; | |
| 360 | + // double sectionTime = 0; | |
| 352 | 361 | |
| 353 | 362 | // 限速 |
| 354 | 363 | double speedLimit = Double.parseDouble(speedLimitStr); |
| ... | ... | @@ -361,7 +370,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 361 | 370 | |
| 362 | 371 | middleNode, gsectionVector, bsectionVector, sectionType, csectionVector, |
| 363 | 372 | |
| 364 | - roadCoding, sectionDistance, sectionTime, dbType, speedLimit, | |
| 373 | + roadCoding, sectionDistance, sectionDuration, dbType, speedLimit, | |
| 365 | 374 | |
| 366 | 375 | descriptions, versions); |
| 367 | 376 | |
| ... | ... | @@ -768,4 +777,341 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 768 | 777 | return resultMap; |
| 769 | 778 | } |
| 770 | 779 | |
| 780 | + | |
| 781 | + @Override | |
| 782 | + public Map<String, Object> manualSave(Map<String, Object> map) { | |
| 783 | + | |
| 784 | + Map<String, Object> resultMap = new HashMap<String,Object>(); | |
| 785 | + | |
| 786 | + try { | |
| 787 | + | |
| 788 | + // 站点信息字符传 | |
| 789 | + String stationJSON = map.get("stationJSON").equals("") ? "" : map.get("stationJSON").toString(); | |
| 790 | + | |
| 791 | + // 路段信息字符串 | |
| 792 | + String sectionJSON = map.get("sectionJSON").equals("") ? "" : map.get("sectionJSON").toString(); | |
| 793 | + | |
| 794 | + // 方向 | |
| 795 | + int directions = Integer.parseInt(map.get("directions").toString()); | |
| 796 | + | |
| 797 | + // 是否撤销 | |
| 798 | + int destroy = map.get("destroy").equals("") ? 0 : Integer.parseInt(map.get("destroy").toString()); | |
| 799 | + | |
| 800 | + // 版本 | |
| 801 | + int versions = map.get("versions").equals("") ? 0 : Integer.parseInt(map.get("versions").toString()); | |
| 802 | + | |
| 803 | + // 坐标类型 | |
| 804 | + String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); | |
| 805 | + | |
| 806 | + // 限速 | |
| 807 | + String speedLimitStr = map.get("speedLimit").equals("") ? "" : map.get("speedLimit").toString(); | |
| 808 | + | |
| 809 | + // 线路ID | |
| 810 | + int lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); | |
| 811 | + | |
| 812 | + // 线路信息 | |
| 813 | + Line resultLine = lineRepository.findOne(lineId); | |
| 814 | + | |
| 815 | + Double distance = 0.0; | |
| 816 | + | |
| 817 | + Double duration = 0.0; | |
| 818 | + | |
| 819 | + if(!stationJSON.equals("")) { | |
| 820 | + | |
| 821 | + JSONArray stationsArray = JSONArray.parseArray(stationJSON); | |
| 822 | + | |
| 823 | + for(int i = 0;i <stationsArray.size();i++) { | |
| 824 | + | |
| 825 | + // 站点名称 | |
| 826 | + String stationName = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("name").toString(); | |
| 827 | + | |
| 828 | + String distanceStr = stationsArray.getJSONObject(i).get("distance").equals("") ? "" : stationsArray.getJSONObject(i).get("distance").toString(); | |
| 829 | + | |
| 830 | + String durationStr = stationsArray.getJSONObject(i).get("duration").equals("") ? "" : stationsArray.getJSONObject(i).get("duration").toString(); | |
| 831 | + | |
| 832 | + if(!distanceStr.equals("")){ | |
| 833 | + | |
| 834 | + distance = Double.parseDouble(distanceStr.replaceAll("公里", "")); | |
| 835 | + | |
| 836 | + } | |
| 837 | + | |
| 838 | + if(!durationStr.equals("")){ | |
| 839 | + | |
| 840 | + duration = Double.parseDouble(durationStr.replaceAll("分钟", "")); | |
| 841 | + | |
| 842 | + } | |
| 843 | + // 百度经纬度坐标 | |
| 844 | + String bJwpoints = ""; | |
| 845 | + | |
| 846 | + // 百度坐标经度 | |
| 847 | + String bLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lng").toString(); | |
| 848 | + | |
| 849 | + // 百度坐标纬度 | |
| 850 | + String bLatx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lat").toString(); | |
| 851 | + | |
| 852 | + // 百度经纬度 | |
| 853 | + bJwpoints = bLonx + " " + bLatx; | |
| 854 | + | |
| 855 | + List<Object[]> stationNameList = repository.findStationName(stationName); | |
| 856 | + | |
| 857 | + boolean isHave = isHaveStationname(bJwpoints,stationNameList); | |
| 858 | + | |
| 859 | + // 初始化站点对象 | |
| 860 | + Station arg0 = new Station(); | |
| 861 | + | |
| 862 | + // 站点编码 | |
| 863 | + int stationCode = 0; | |
| 864 | + | |
| 865 | + if(isHave) { | |
| 866 | + | |
| 867 | + Integer stationId = Integer.parseInt(stationNameList.get(0)[1].toString()); | |
| 868 | + | |
| 869 | + arg0 = repository.findOne(stationId); | |
| 870 | + | |
| 871 | + stationCode = Integer.parseInt(arg0.getStationCod()); | |
| 872 | + | |
| 873 | + }else { | |
| 874 | + | |
| 875 | + stationCode = repository.stationMaxId(); | |
| 876 | + | |
| 877 | + arg0.setStationName(stationName); | |
| 878 | + | |
| 879 | + // 原坐标类型 | |
| 880 | + arg0.setDbType(dbType); | |
| 881 | + | |
| 882 | + // 站点地理位置WGS坐标经度 | |
| 883 | + String gLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lng").toString(); | |
| 884 | + arg0.setgLonx(Float.parseFloat(gLonx)); | |
| 885 | + | |
| 886 | + // 站点地理位置WGS坐标纬度 | |
| 887 | + String gLaty = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lat").toString(); | |
| 888 | + arg0.setgLaty(Float.parseFloat(gLaty)); | |
| 889 | + | |
| 890 | + // 半径 | |
| 891 | + int radius = map.get("radius").equals("") ? 0 : Integer.parseInt(map.get("radius").toString()); | |
| 892 | + arg0.setRadius(radius); | |
| 893 | + | |
| 894 | + // 图形类型 | |
| 895 | + String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString(); | |
| 896 | + arg0.setShapesType(shapesType); | |
| 897 | + | |
| 898 | + // 站点编码 | |
| 899 | + arg0.setStationCod(String.valueOf(stationCode+1)); | |
| 900 | + | |
| 901 | + // 是否想撤销 | |
| 902 | + arg0.setDestroy(destroy); | |
| 903 | + | |
| 904 | + // 版本号 | |
| 905 | + arg0.setVersions(versions); | |
| 906 | + | |
| 907 | + arg0.setbJwpoints(bJwpoints); | |
| 908 | + | |
| 909 | + // 插入站点信息 | |
| 910 | + repository.save(arg0); | |
| 911 | + // 站点路由对象 | |
| 912 | + StationRoute route = new StationRoute(); | |
| 913 | + | |
| 914 | + // 站点名称 | |
| 915 | + route.setStationName(stationName); | |
| 916 | + | |
| 917 | + route.setDistances(distance); | |
| 918 | + | |
| 919 | + route.setToTime(duration); | |
| 920 | + | |
| 921 | + | |
| 922 | + // 站点编码 | |
| 923 | + route.setStationCode(arg0.getStationCod()); | |
| 924 | + | |
| 925 | + // 站点序号 | |
| 926 | + route.setStationRouteCode((i+1)*10); | |
| 927 | + | |
| 928 | + // 站点类型 | |
| 929 | + if(i==0) { | |
| 930 | + | |
| 931 | + // 起始站 | |
| 932 | + route.setStationMark("B"); | |
| 933 | + | |
| 934 | + }else if(i==stationsArray.size()-1) { | |
| 935 | + | |
| 936 | + // 终点站 | |
| 937 | + route.setStationMark("E"); | |
| 938 | + | |
| 939 | + }else { | |
| 940 | + | |
| 941 | + // 中途站 | |
| 942 | + route.setStationMark("Z"); | |
| 943 | + | |
| 944 | + } | |
| 945 | + | |
| 946 | + // 版本号 | |
| 947 | + route.setVersions(versions); | |
| 948 | + | |
| 949 | + // 站点ID | |
| 950 | + route.setStation(arg0); | |
| 951 | + | |
| 952 | + // 方向 | |
| 953 | + route.setDirections(directions); | |
| 954 | + | |
| 955 | + // 线路ID | |
| 956 | + route.setLine(resultLine); | |
| 957 | + | |
| 958 | + // 线路编码 | |
| 959 | + route.setLineCode(resultLine.getLineCode()); | |
| 960 | + | |
| 961 | + | |
| 962 | + // 插入站点路由信息 | |
| 963 | + routeRepository.save(route); | |
| 964 | + | |
| 965 | + } | |
| 966 | + } | |
| 967 | + } | |
| 968 | + | |
| 969 | + // 如果路段信息JSON字符串不为空 | |
| 970 | + if(!sectionJSON.equals("")) { | |
| 971 | + | |
| 972 | + // 转换成JSON数组 | |
| 973 | + JSONArray sectionsArray = JSONArray.parseArray(sectionJSON); | |
| 974 | + | |
| 975 | + // 遍历 | |
| 976 | + for(int s = 0 ;s<sectionsArray.size();s++) { | |
| 977 | + | |
| 978 | + // 站点名称 | |
| 979 | + String sectionName = sectionsArray.getJSONObject(s).equals("") ? "" : sectionsArray.getJSONObject(s).get("sectionName").toString(); | |
| 980 | + | |
| 981 | + String pointsStr = sectionsArray.getJSONObject(s).equals("") ? "" : sectionsArray.getJSONObject(s).get("points").toString(); | |
| 982 | + | |
| 983 | + // 原始线状图形坐标集合 | |
| 984 | + String sectionsBpoints = ""; | |
| 985 | + | |
| 986 | + // WGS线状图形坐标集合 | |
| 987 | + String sectionsWJPpoints = ""; | |
| 988 | + | |
| 989 | + if(!pointsStr.equals("")){ | |
| 990 | + | |
| 991 | + JSONArray pointsArray = JSONArray.parseArray(pointsStr); | |
| 992 | + | |
| 993 | + for(int p =0;p<pointsArray.size();p++){ | |
| 994 | + | |
| 995 | + if(p==pointsArray.size()-1){ | |
| 996 | + | |
| 997 | + sectionsBpoints = sectionsBpoints + pointsArray.getJSONObject(p).get("lng").toString() + " " +pointsArray.getJSONObject(p).get("lat").toString(); | |
| 998 | + | |
| 999 | + sectionsWJPpoints = sectionsWJPpoints + pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lng") + " " +pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lat"); | |
| 1000 | + | |
| 1001 | + }else { | |
| 1002 | + | |
| 1003 | + sectionsBpoints = sectionsBpoints + pointsArray.getJSONObject(p).get("lng").toString() + " " +pointsArray.getJSONObject(p).get("lat").toString()+","; | |
| 1004 | + | |
| 1005 | + sectionsWJPpoints = sectionsWJPpoints + pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lng") + " " +pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lat") +","; | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + } | |
| 1009 | + | |
| 1010 | + } | |
| 1011 | + | |
| 1012 | + } | |
| 1013 | + System.out.println(sectionName); | |
| 1014 | + | |
| 1015 | + System.out.println(sectionsBpoints); | |
| 1016 | + | |
| 1017 | + System.out.println(sectionsWJPpoints); | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + int sectionMaxId = sectionRepository.sectionMaxId(); | |
| 1021 | + | |
| 1022 | + String sectionCode = String.valueOf(sectionMaxId+1); | |
| 1023 | + | |
| 1024 | + // 交出路 | |
| 1025 | + String crosesRoad = ""; | |
| 1026 | + | |
| 1027 | + // 终止节点 | |
| 1028 | + String endNode = ""; | |
| 1029 | + | |
| 1030 | + // 开始节点 | |
| 1031 | + String startNode = ""; | |
| 1032 | + | |
| 1033 | + // 中间节点 | |
| 1034 | + String middleNode = ""; | |
| 1035 | + | |
| 1036 | + // WGS坐标点集合 | |
| 1037 | + String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; | |
| 1038 | + | |
| 1039 | + // 原坐标点集合 | |
| 1040 | + String bsectionVector = "LINESTRING(" + sectionsBpoints + ")"; | |
| 1041 | + | |
| 1042 | + // 城建坐标点集合 | |
| 1043 | + String csectionVector = ""; | |
| 1044 | + | |
| 1045 | + // 路段类型 | |
| 1046 | + String sectionType = ""; | |
| 1047 | + | |
| 1048 | + // 道路编码 | |
| 1049 | + String roadCoding = ""; | |
| 1050 | + | |
| 1051 | + // 路段距离 | |
| 1052 | + double sectionDistance = distance; | |
| 1053 | + | |
| 1054 | + // 路段时间 | |
| 1055 | + double sectionTime = duration; | |
| 1056 | + | |
| 1057 | + // 限速 | |
| 1058 | + double speedLimit = Double.parseDouble(speedLimitStr); | |
| 1059 | + | |
| 1060 | + // 说明 | |
| 1061 | + String descriptions = ""; | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + sectionRepository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, | |
| 1065 | + | |
| 1066 | + middleNode, gsectionVector, bsectionVector, sectionType, csectionVector, | |
| 1067 | + | |
| 1068 | + roadCoding, sectionDistance, sectionTime, dbType, speedLimit, | |
| 1069 | + | |
| 1070 | + descriptions, versions); | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + Section section = sectionRepository.findOne(Integer.parseInt(sectionCode)); | |
| 1075 | + | |
| 1076 | + // 路段路由 | |
| 1077 | + SectionRoute sectionRoute = new SectionRoute(); | |
| 1078 | + | |
| 1079 | + // 路段序号 | |
| 1080 | + sectionRoute.setSectionrouteCode(1); | |
| 1081 | + | |
| 1082 | + // 线路编码 | |
| 1083 | + sectionRoute.setLineCode(resultLine.getLineCode()); | |
| 1084 | + | |
| 1085 | + // 路段ID | |
| 1086 | + sectionRoute.setSection(section); | |
| 1087 | + | |
| 1088 | + // 线路ID | |
| 1089 | + sectionRoute.setLine(resultLine); | |
| 1090 | + | |
| 1091 | + // 路段编码 | |
| 1092 | + sectionRoute.setSectionCode(sectionCode); | |
| 1093 | + | |
| 1094 | + // 版本 | |
| 1095 | + sectionRoute.setVersions(versions); | |
| 1096 | + | |
| 1097 | + // 方向 | |
| 1098 | + sectionRoute.setDirections(directions); | |
| 1099 | + | |
| 1100 | + sectionRouteRepository.save(sectionRoute); | |
| 1101 | + } | |
| 1102 | + } | |
| 1103 | + | |
| 1104 | + resultMap.put("status", ResponseCode.SUCCESS); | |
| 1105 | + | |
| 1106 | + } catch (Exception e) { | |
| 1107 | + | |
| 1108 | + resultMap.put("status", ResponseCode.ERROR); | |
| 1109 | + | |
| 1110 | + logger.error("save erro.", e); | |
| 1111 | + | |
| 1112 | + } | |
| 1113 | + | |
| 1114 | + return resultMap; | |
| 1115 | + } | |
| 1116 | + | |
| 771 | 1117 | } | ... | ... |
src/main/resources/static/pages/base/line/js/line-list-table.js
src/main/resources/static/pages/base/section/js/section-list-table.js
| ... | ... | @@ -13,61 +13,7 @@ |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | 15 | (function(){ |
| 16 | - | |
| 17 | - // 填充公司下拉框选择值 | |
| 18 | - $get('/business/all', {upCode_eq: '88'}, function(array){ | |
| 19 | - | |
| 20 | - // 公司下拉options属性值 | |
| 21 | - var options = '<option value="">请选择...</option>'; | |
| 22 | - | |
| 23 | - // 遍历array | |
| 24 | - $.each(array, function(i,d){ | |
| 25 | - | |
| 26 | - options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>'; | |
| 27 | - | |
| 28 | - }); | |
| 29 | - | |
| 30 | - // 填充公司下拉框options,并添加公司下拉框值改变事件setbrancheCompanySelectOptions | |
| 31 | - $('#companySelect').html(options).on('change', setbrancheCompanySelectOptions); | |
| 32 | - | |
| 33 | - }); | |
| 34 | - | |
| 35 | - // 填充分公司下拉框 | |
| 36 | - setbrancheCompanySelectOptions(); | |
| 37 | 16 | |
| 38 | - // 填充分公司下拉框选择值 | |
| 39 | - function setbrancheCompanySelectOptions(){ | |
| 40 | - | |
| 41 | - // 获取公司下拉框选择值 | |
| 42 | - var businessCode = $('#companySelect').val(); | |
| 43 | - | |
| 44 | - // 分公司下拉框options属性值 | |
| 45 | - var options = '<option value="">请选择...</option>'; | |
| 46 | - | |
| 47 | - // 如果公司选择为空则分公司为空 ; 否则查询出所属公司下的分公司名称和相应分公司代码 | |
| 48 | - if(businessCode == null || businessCode ==''){ | |
| 49 | - | |
| 50 | - // 填充分公司下拉框options | |
| 51 | - $('#brancheCompanySelect').html(options); | |
| 52 | - | |
| 53 | - } else { | |
| 54 | - | |
| 55 | - // 查询出所属公司下的分公司名称和相应分公司代码 | |
| 56 | - $get('/business/all', {upCode_eq: businessCode}, function(array){ | |
| 57 | - | |
| 58 | - // 遍历array | |
| 59 | - $.each(array, function(i,d){ | |
| 60 | - | |
| 61 | - options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>'; | |
| 62 | - | |
| 63 | - // 填充分公司下拉框options | |
| 64 | - $('#brancheCompanySelect').html(options); | |
| 65 | - | |
| 66 | - }); | |
| 67 | - }); | |
| 68 | - } | |
| 69 | - } | |
| 70 | - | |
| 71 | 17 | /** |
| 72 | 18 | * -----page : 当前页 |
| 73 | 19 | * |
| ... | ... | @@ -76,12 +22,6 @@ |
| 76 | 22 | */ |
| 77 | 23 | var page = 0,initPag; |
| 78 | 24 | |
| 79 | - // 选择框 | |
| 80 | - var icheckOptions = { | |
| 81 | - checkboxClass: 'icheckbox_flat-blue', | |
| 82 | - increaseArea: '20%' | |
| 83 | - }; | |
| 84 | - | |
| 85 | 25 | // 表格数据分页加载 |
| 86 | 26 | loadTableDate(null,true); |
| 87 | 27 | |
| ... | ... | @@ -149,16 +89,13 @@ |
| 149 | 89 | // 异步请求获取表格数据 |
| 150 | 90 | $.get('/sectionroute',params,function(result){ |
| 151 | 91 | |
| 152 | - console.log(result); | |
| 92 | + // 添加序号 | |
| 93 | + result.content.page = page; | |
| 153 | 94 | |
| 154 | 95 | // 把数据填充到模版中 |
| 155 | 96 | var tbodyHtml = template('sectionInfo_list_table_temp',{list:result.content}); |
| 156 | 97 | // 把渲染好的模版html文本追加到表格中 |
| 157 | 98 | $('#datatable_line tbody').html(tbodyHtml); |
| 158 | - // 制定复选框 | |
| 159 | - $('#datatable_line tbody').find('.icheck').iCheck(icheckOptions); | |
| 160 | - // 复选框改变事件 | |
| 161 | - $('#datatable_line tbody').find('.icheck').on('ifChanged', iCheckChange); | |
| 162 | 99 | // 是重新分页且返回数据长度大于0 |
| 163 | 100 | if(isPon && result.content.length > 0){ |
| 164 | 101 | // 重新分页 |
| ... | ... | @@ -171,22 +108,6 @@ |
| 171 | 108 | }); |
| 172 | 109 | } |
| 173 | 110 | |
| 174 | - /** | |
| 175 | - * 复选框组件 | |
| 176 | - * | |
| 177 | - */ | |
| 178 | - function iCheckChange(){ | |
| 179 | - // 获取当前的父节点tr | |
| 180 | - var tr = $(this).parents('tr'); | |
| 181 | - | |
| 182 | - // 判断当前是否选中 | |
| 183 | - if(this.checked) | |
| 184 | - // 选中,则增添父节点tr的样式 | |
| 185 | - tr.addClass('row-active'); | |
| 186 | - else | |
| 187 | - // 未选中,则删除父节点tr的样式 | |
| 188 | - tr.removeClass('row-active'); | |
| 189 | - } | |
| 190 | 111 | |
| 191 | 112 | /** |
| 192 | 113 | * 分页栏组件 | ... | ... |
src/main/resources/static/pages/base/section/list.html
src/main/resources/static/pages/base/station/js/station-list-table.js
| ... | ... | @@ -13,61 +13,7 @@ |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | 15 | (function(){ |
| 16 | - | |
| 17 | - // 填充公司下拉框选择值 | |
| 18 | - $get('/business/all', {upCode_eq: '88'}, function(array){ | |
| 19 | - | |
| 20 | - // 公司下拉options属性值 | |
| 21 | - var options = '<option value="">请选择...</option>'; | |
| 22 | - | |
| 23 | - // 遍历array | |
| 24 | - $.each(array, function(i,d){ | |
| 25 | - | |
| 26 | - options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>'; | |
| 27 | - | |
| 28 | - }); | |
| 29 | - | |
| 30 | - // 填充公司下拉框options,并添加公司下拉框值改变事件setbrancheCompanySelectOptions | |
| 31 | - $('#companySelect').html(options).on('change', setbrancheCompanySelectOptions); | |
| 32 | - | |
| 33 | - }); | |
| 34 | - | |
| 35 | - // 填充分公司下拉框 | |
| 36 | - setbrancheCompanySelectOptions(); | |
| 37 | 16 | |
| 38 | - // 填充分公司下拉框选择值 | |
| 39 | - function setbrancheCompanySelectOptions(){ | |
| 40 | - | |
| 41 | - // 获取公司下拉框选择值 | |
| 42 | - var businessCode = $('#companySelect').val(); | |
| 43 | - | |
| 44 | - // 分公司下拉框options属性值 | |
| 45 | - var options = '<option value="">请选择...</option>'; | |
| 46 | - | |
| 47 | - // 如果公司选择为空则分公司为空 ; 否则查询出所属公司下的分公司名称和相应分公司代码 | |
| 48 | - if(businessCode == null || businessCode ==''){ | |
| 49 | - | |
| 50 | - // 填充分公司下拉框options | |
| 51 | - $('#brancheCompanySelect').html(options); | |
| 52 | - | |
| 53 | - } else { | |
| 54 | - | |
| 55 | - // 查询出所属公司下的分公司名称和相应分公司代码 | |
| 56 | - $get('/business/all', {upCode_eq: businessCode}, function(array){ | |
| 57 | - | |
| 58 | - // 遍历array | |
| 59 | - $.each(array, function(i,d){ | |
| 60 | - | |
| 61 | - options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>'; | |
| 62 | - | |
| 63 | - // 填充分公司下拉框options | |
| 64 | - $('#brancheCompanySelect').html(options); | |
| 65 | - | |
| 66 | - }); | |
| 67 | - }); | |
| 68 | - } | |
| 69 | - } | |
| 70 | - | |
| 71 | 17 | /** |
| 72 | 18 | * -----page : 当前页 |
| 73 | 19 | * |
| ... | ... | @@ -76,11 +22,7 @@ |
| 76 | 22 | */ |
| 77 | 23 | var page = 0,initPag; |
| 78 | 24 | |
| 79 | - // 选择框 | |
| 80 | - var icheckOptions = { | |
| 81 | - checkboxClass: 'icheckbox_flat-blue', | |
| 82 | - increaseArea: '20%' | |
| 83 | - }; | |
| 25 | + | |
| 84 | 26 | |
| 85 | 27 | // 表格数据分页加载 |
| 86 | 28 | loadTableDate(null,true); |
| ... | ... | @@ -149,16 +91,13 @@ |
| 149 | 91 | // 异步请求获取表格数据 |
| 150 | 92 | $.get('/stationroute',params,function(result){ |
| 151 | 93 | |
| 152 | - console.log(result); | |
| 94 | + // 添加序号 | |
| 95 | + result.content.page = page; | |
| 153 | 96 | |
| 154 | 97 | // 把数据填充到模版中 |
| 155 | 98 | var tbodyHtml = template('staitonInfo_list_table_temp',{list:result.content}); |
| 156 | 99 | // 把渲染好的模版html文本追加到表格中 |
| 157 | 100 | $('#datatable_line tbody').html(tbodyHtml); |
| 158 | - // 制定复选框 | |
| 159 | - $('#datatable_line tbody').find('.icheck').iCheck(icheckOptions); | |
| 160 | - // 复选框改变事件 | |
| 161 | - $('#datatable_line tbody').find('.icheck').on('ifChanged', iCheckChange); | |
| 162 | 101 | // 是重新分页且返回数据长度大于0 |
| 163 | 102 | if(isPon && result.content.length > 0){ |
| 164 | 103 | // 重新分页 |
| ... | ... | @@ -172,23 +111,6 @@ |
| 172 | 111 | } |
| 173 | 112 | |
| 174 | 113 | /** |
| 175 | - * 复选框组件 | |
| 176 | - * | |
| 177 | - */ | |
| 178 | - function iCheckChange(){ | |
| 179 | - // 获取当前的父节点tr | |
| 180 | - var tr = $(this).parents('tr'); | |
| 181 | - | |
| 182 | - // 判断当前是否选中 | |
| 183 | - if(this.checked) | |
| 184 | - // 选中,则增添父节点tr的样式 | |
| 185 | - tr.addClass('row-active'); | |
| 186 | - else | |
| 187 | - // 未选中,则删除父节点tr的样式 | |
| 188 | - tr.removeClass('row-active'); | |
| 189 | - } | |
| 190 | - | |
| 191 | - /** | |
| 192 | 114 | * 分页栏组件 |
| 193 | 115 | * |
| 194 | 116 | */ | ... | ... |
src/main/resources/static/pages/base/station/list.html
| ... | ... | @@ -29,7 +29,7 @@ |
| 29 | 29 | <table class="table table-striped table-bordered table-hover table-checkable" id="datatable_line"> |
| 30 | 30 | <thead> |
| 31 | 31 | <tr role="row" class="heading"> |
| 32 | - <th width="3%">#</th> | |
| 32 | + <th width="3%">序号</th> | |
| 33 | 33 | <th width="8%">线路编号</th> |
| 34 | 34 | <th width="8%">线路名称</th> |
| 35 | 35 | <th width="8%">线路方向</th> |
| ... | ... | @@ -42,7 +42,7 @@ |
| 42 | 42 | <th width="15%">操作</th> |
| 43 | 43 | </tr> |
| 44 | 44 | <tr role="row" class="filter"> |
| 45 | - <td></td> | |
| 45 | + <td>#</td> | |
| 46 | 46 | <td> |
| 47 | 47 | <input type="text" class="form-control form-filter input-sm" name="carParkCode"> |
| 48 | 48 | </td> |
| ... | ... | @@ -99,7 +99,7 @@ |
| 99 | 99 | {{each list as obj i }} |
| 100 | 100 | <tr> |
| 101 | 101 | <td style="vertical-align: middle;"> |
| 102 | - <input type="checkbox" class="group-checkable icheck" data-id="{{obj.id}}"> | |
| 102 | + {{(list.page*10)+(i+1)}} | |
| 103 | 103 | </td> |
| 104 | 104 | <td> |
| 105 | 105 | {{obj.lineCode}} | ... | ... |
src/main/resources/static/pages/base/stationroute/add_manual_select.html
| 1 | -<!-- 手动规划线路站点方式 --> | |
| 1 | +<!-- 其他规划方式 --> | |
| 2 | 2 | <div class="modal fade" id="add_manual_mobal" tabindex="-1" role="basic" aria-hidden="true"> |
| 3 | 3 | |
| 4 | 4 | <div class="modal-dialog"> |
| ... | ... | @@ -7,34 +7,27 @@ |
| 7 | 7 | |
| 8 | 8 | <div class="modal-header"> |
| 9 | 9 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> |
| 10 | - <h4 class="modal-title">手动规划线路站点方式</h4> | |
| 10 | + <h4 class="modal-title">选择规划方式</h4> | |
| 11 | 11 | </div> |
| 12 | 12 | |
| 13 | 13 | <div class="modal-body"> |
| 14 | 14 | |
| 15 | - <form class="form-horizontal" action="/" method="post" id="formBootbox" role="form"> | |
| 16 | - <div class="alert alert-danger display-hide" id="requiredname"> | |
| 17 | - <button class="close" data-close="alert"></button> | |
| 18 | - 站点名称为必填项 | |
| 19 | - </div> | |
| 20 | - <div class="alert alert-danger display-hide" id="serchrname"> | |
| 21 | - <button class="close" data-close="alert"></button> | |
| 22 | - 系统无法生成,请选择其他方式新增 | |
| 23 | - </div> | |
| 24 | - | |
| 15 | + <form class="form-horizontal" action="/" method="post" id="add_manual_form" role="form"> | |
| 16 | + | |
| 25 | 17 | <div class="form-group"> |
| 26 | - <label class="col-md-3 control-label">手动规划方式:</label> | |
| 18 | + <label class="col-md-3 control-label">规划方式:</label> | |
| 27 | 19 | <div class="col-md-9"> |
| 28 | 20 | <div class="icheck-list"> |
| 29 | 21 | <label > |
| 30 | - <input type="radio" class="icheck" name="addManualRadio" value=1 checked> 模板添加 | |
| 31 | - </label> | |
| 32 | - <label> | |
| 33 | - <input type="radio" class="icheck" name="addManualRadio" value=0 checked> 导入Excel文件 | |
| 22 | + <input type="radio" class="icheck" name="addManualRadio" value=0 checked> 手动添加站点 | |
| 34 | 23 | </label> |
| 24 | + <!-- <label> | |
| 25 | + <input type="radio" class="icheck" name="addManualRadio" value=1> 导入Excel文件 | |
| 26 | + </label> --> | |
| 35 | 27 | </div> |
| 36 | 28 | </div> |
| 37 | 29 | </div> |
| 30 | + | |
| 38 | 31 | </form> |
| 39 | 32 | </div> |
| 40 | 33 | <div class="modal-footer"> |
| ... | ... | @@ -47,22 +40,34 @@ |
| 47 | 40 | <script type="text/javascript"> |
| 48 | 41 | $(function(){ |
| 49 | 42 | |
| 50 | - $('#add_manual_mobal').modal({ | |
| 51 | - | |
| 52 | - show : true, | |
| 53 | - | |
| 54 | - backdrop: 'static', | |
| 55 | - | |
| 56 | - keyboard: false | |
| 57 | - | |
| 58 | - | |
| 59 | - }); | |
| 43 | + // 显示其他规划方式弹出层 | |
| 44 | + $('#add_manual_mobal').modal({show : true,backdrop: 'static', keyboard: false}); | |
| 45 | + | |
| 46 | + // 获取表单元素 | |
| 47 | + var form = $('#add_manual_form'); | |
| 60 | 48 | |
| 49 | + // 表单序列化 | |
| 50 | + var params = form.serializeJSON(); | |
| 51 | + | |
| 52 | + // 下一步点击事件 | |
| 61 | 53 | $('.modal-footer #addManualSelectnextButton').on('click',function() { |
| 62 | 54 | |
| 55 | + // 获取其他规划方式值 | |
| 56 | + var addManualRadioV = params.addManualRadio; | |
| 57 | + | |
| 58 | + // 隐藏其他规划方式弹出层 | |
| 63 | 59 | $('#add_manual_mobal').modal('hide'); |
| 64 | 60 | |
| 65 | - layer.msg('该功能正在开发过程中...请暂时使用系统规划'); | |
| 61 | + if(addManualRadioV==0){ | |
| 62 | + | |
| 63 | + // 加载模板手动添加站点页面 | |
| 64 | + $.get('addstationstemplate.html', function(m){$(pjaxContainer).append(m);}); | |
| 65 | + | |
| 66 | + }else if(addManualRadioV==1) { | |
| 67 | + | |
| 68 | + | |
| 69 | + } | |
| 70 | + | |
| 66 | 71 | |
| 67 | 72 | }); |
| 68 | 73 | ... | ... |
src/main/resources/static/pages/base/stationroute/addstationstemplate.html
0 → 100644
| 1 | +<!-- 手动添加站点 --> | |
| 2 | +<div class="modal fade" id="add_station_template_mobal" tabindex="-1" role="basic" aria-hidden="true"> | |
| 3 | + | |
| 4 | + <div class="modal-dialog"> | |
| 5 | + | |
| 6 | + <div class="modal-content"> | |
| 7 | + | |
| 8 | + <div class="modal-header"> | |
| 9 | + <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> | |
| 10 | + <h4 class="modal-title">手动添加站点</h4> | |
| 11 | + </div> | |
| 12 | + | |
| 13 | + <div class="modal-body"> | |
| 14 | + | |
| 15 | + <form class="form-horizontal" role="form" id="save_station_template_form" action="/module" method="post"> | |
| 16 | + | |
| 17 | + <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button> | |
| 18 | + 您的输入有误,请检查下面的输入项 | |
| 19 | + </div> | |
| 20 | + | |
| 21 | + <!-- 站点名称 --> | |
| 22 | + <div class="form-body"> | |
| 23 | + | |
| 24 | + <div class="form-group"> | |
| 25 | + <label class="control-label col-md-3"> | |
| 26 | + <span class="required"> * </span> 站点名称: | |
| 27 | + </label> | |
| 28 | + <div class="col-md-6"> | |
| 29 | + <textarea class="form-control" rows="10" name="stations" id="stationsInput" placeholder="站点名称"></textarea> | |
| 30 | + </div> | |
| 31 | + </div> | |
| 32 | + | |
| 33 | + </div> | |
| 34 | + | |
| 35 | + <div class="form-group"> | |
| 36 | + <div class="alert alert-info font-blue-chambray" style="background-color: #2C3E50"> | |
| 37 | + <h5 class="block"><span class="help-block"> * 手动添加站点规划说明: </span></h5> | |
| 38 | + <p><span class="help-block"> 请在文本域中按站点顺序依次输入站点名称,每输入完一个站名时请按回车键(Enter)换行.</span> </p> | |
| 39 | + </div> | |
| 40 | + </div> | |
| 41 | + </form> | |
| 42 | + </div> | |
| 43 | + <div class="modal-footer"> | |
| 44 | + <button type="button" class="btn default" data-dismiss="modal" id="addMobalHiden">取消</button> | |
| 45 | + <button type="button" class="btn btn-primary" id="templateSaveData">提交数据</button> | |
| 46 | + </div> | |
| 47 | + </div> | |
| 48 | + </div> | |
| 49 | +</div> | |
| 50 | +<script type="text/javascript"> | |
| 51 | +$(function(){ | |
| 52 | + | |
| 53 | + function eachSectionList(sectiondata,cb) { | |
| 54 | + | |
| 55 | + var dataLen_ = sectiondata.length; | |
| 56 | + | |
| 57 | + (function(){ | |
| 58 | + | |
| 59 | + if (!arguments.callee.count) { | |
| 60 | + | |
| 61 | + arguments.callee.count = 0; | |
| 62 | + | |
| 63 | + } | |
| 64 | + | |
| 65 | + arguments.callee.count++; | |
| 66 | + | |
| 67 | + var index_ = parseInt(arguments.callee.count) - 1; | |
| 68 | + | |
| 69 | + if (index_ > dataLen_ -1) { | |
| 70 | + | |
| 71 | + cb && cb(sectiondata); | |
| 72 | + return; | |
| 73 | + | |
| 74 | + } | |
| 75 | + | |
| 76 | + var p = arguments.callee; | |
| 77 | + | |
| 78 | + GetAjaxData.MuneBpointsArrayToWGS(sectiondata[index_].points,function(polyGonArray_) { | |
| 79 | + | |
| 80 | + sectiondata[index_].points = polyGonArray_; | |
| 81 | + | |
| 82 | + p(); | |
| 83 | + }); | |
| 84 | + | |
| 85 | + })(); | |
| 86 | + | |
| 87 | + } | |
| 88 | + | |
| 89 | + // 延迟加载显示mobal | |
| 90 | + setTimeout(function(){$('#add_station_template_mobal').modal({show : true,backdrop: 'static', keyboard: false});},200); | |
| 91 | + | |
| 92 | + var directionData = $('.upManual').data('direction'); | |
| 93 | + | |
| 94 | + // console.log(); | |
| 95 | + | |
| 96 | + // 获取表单元素 | |
| 97 | + var form = $('#save_station_template_form'); | |
| 98 | + | |
| 99 | + // 获取错误提示信息元素 | |
| 100 | + var error = $('.alert-danger', form); | |
| 101 | + | |
| 102 | + // 提交数据点击事件 | |
| 103 | + $('.modal-footer #templateSaveData').on('click',function() { | |
| 104 | + | |
| 105 | + // 表单提交 | |
| 106 | + form.submit(); | |
| 107 | + | |
| 108 | + }); | |
| 109 | + | |
| 110 | + // 表单验证 | |
| 111 | + form.validate({ | |
| 112 | + | |
| 113 | + errorElement : 'span', | |
| 114 | + | |
| 115 | + errorClass : 'help-block help-block-error', | |
| 116 | + | |
| 117 | + focusInvalid : false, | |
| 118 | + | |
| 119 | + rules : { | |
| 120 | + | |
| 121 | + 'stations' : { | |
| 122 | + | |
| 123 | + required : true, | |
| 124 | + | |
| 125 | + } | |
| 126 | + | |
| 127 | + }, | |
| 128 | + | |
| 129 | + invalidHandler : function(event, validator) { | |
| 130 | + | |
| 131 | + error.show(); | |
| 132 | + | |
| 133 | + App.scrollTo(error, -200); | |
| 134 | + | |
| 135 | + }, | |
| 136 | + | |
| 137 | + highlight : function(element) { | |
| 138 | + | |
| 139 | + $(element).closest('.form-group').addClass('has-error'); | |
| 140 | + | |
| 141 | + }, | |
| 142 | + | |
| 143 | + unhighlight : function(element) { | |
| 144 | + | |
| 145 | + $(element).closest('.form-group').removeClass('has-error'); | |
| 146 | + | |
| 147 | + }, | |
| 148 | + | |
| 149 | + success : function(label) { | |
| 150 | + | |
| 151 | + label.closest('.form-group').removeClass('has-error'); | |
| 152 | + | |
| 153 | + }, | |
| 154 | + | |
| 155 | + submitHandler : function(f) { | |
| 156 | + | |
| 157 | + // 表单序列画 | |
| 158 | + var params = form.serializeJSON(); | |
| 159 | + | |
| 160 | + var paramsStationsArray = params.stations.split('\r\n'); | |
| 161 | + | |
| 162 | + WorldsBMap.stationsNameToPoints(paramsStationsArray,function(resultJson) { | |
| 163 | + | |
| 164 | + WorldsBMap.getDistanceAndTotime(resultJson,function(stationdataList) { | |
| 165 | + | |
| 166 | + WorldsBMap.getSectionListPlonly(stationdataList,function(sectiondata) { | |
| 167 | + | |
| 168 | + | |
| 169 | + eachSectionList(sectiondata,function(successdata) { | |
| 170 | + | |
| 171 | + GetAjaxData.getFormPointEToWGS(stationdataList,function(stationdata) { | |
| 172 | + | |
| 173 | + console.log(stationdata); | |
| 174 | + | |
| 175 | + console.log(); | |
| 176 | + | |
| 177 | + // 定义站点信息JSON字符串 | |
| 178 | + var stationJSON = JSON.stringify(stationdata); | |
| 179 | + | |
| 180 | + // 定义路段信息字符串 | |
| 181 | + var sectionJSON = JSON.stringify(successdata); | |
| 182 | + | |
| 183 | + // 参数集合 | |
| 184 | + var params = {}; | |
| 185 | + | |
| 186 | + // 站点信息JSON字符串 | |
| 187 | + params.stationJSON = stationJSON; | |
| 188 | + | |
| 189 | + // 线路ID | |
| 190 | + params.lineId = id; | |
| 191 | + | |
| 192 | + // 方向 | |
| 193 | + params.directions = directionData; | |
| 194 | + | |
| 195 | + // 原始坐标类型 | |
| 196 | + params.dbType = 'b'; | |
| 197 | + | |
| 198 | + // 圆形半径 | |
| 199 | + params.radius = '300'; | |
| 200 | + | |
| 201 | + // 限速 | |
| 202 | + params.speedLimit = '60'; | |
| 203 | + | |
| 204 | + // 图形类型(r:圆形;p:多边形) | |
| 205 | + params.shapesType = 'r'; | |
| 206 | + | |
| 207 | + // destroy:是否撤销 | |
| 208 | + params.destroy = '0'; | |
| 209 | + | |
| 210 | + // versions:版本号 | |
| 211 | + params.versions = '1'; | |
| 212 | + | |
| 213 | + // 路段信息JSON字符串 | |
| 214 | + params.sectionJSON = sectionJSON; | |
| 215 | + | |
| 216 | + | |
| 217 | + // 保存 | |
| 218 | + $post('/station/manualSave',params,function(rd) { | |
| 219 | + | |
| 220 | + if(rd.status='SUCCESS') { | |
| 221 | + | |
| 222 | + // 关闭弹出层 | |
| 223 | + // layer.closeAll(); | |
| 224 | + | |
| 225 | + // 显示表格 | |
| 226 | + // $('#hide_table').show(); | |
| 227 | + | |
| 228 | + // 刷新树 | |
| 229 | + resjtreeDate(id,directionData); | |
| 230 | + | |
| 231 | + }else { | |
| 232 | + | |
| 233 | + // 保存失败 | |
| 234 | + | |
| 235 | + | |
| 236 | + } | |
| 237 | + | |
| 238 | + | |
| 239 | + }); | |
| 240 | + | |
| 241 | + }); | |
| 242 | + | |
| 243 | + | |
| 244 | + }); | |
| 245 | + // console.log(sectiondata); | |
| 246 | + | |
| 247 | + }); | |
| 248 | + | |
| 249 | + /* GetAjaxData.getFormPointEToWGS(stationdataList,function(stationdata) { | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + }); */ | |
| 255 | + | |
| 256 | + | |
| 257 | + /* // 百度站点坐标获取WGS坐标 | |
| 258 | + GetAjaxData.getFormPointEToWGS(stationdataList,function(stationdata) { | |
| 259 | + | |
| 260 | + eachSectionList(sectiondata,function(successdata) { | |
| 261 | + | |
| 262 | + console.log(successdata); | |
| 263 | + | |
| 264 | + // 定义站点信息JSON字符串 | |
| 265 | + var stationJSON = JSON.stringify(stationdata); | |
| 266 | + | |
| 267 | + // 定义路段信息字符串 | |
| 268 | + var sectionJSON = JSON.stringify(successdata); | |
| 269 | + | |
| 270 | + // 参数集合 | |
| 271 | + var params = {}; | |
| 272 | + | |
| 273 | + // 站点信息JSON字符串 | |
| 274 | + params.stationJSON = stationJSON; | |
| 275 | + | |
| 276 | + // 线路ID | |
| 277 | + params.lineId = id; | |
| 278 | + | |
| 279 | + // 方向 | |
| 280 | + params.directions = directionData; | |
| 281 | + | |
| 282 | + // 原始坐标类型 | |
| 283 | + params.dbType = 'b'; | |
| 284 | + | |
| 285 | + // 圆形半径 | |
| 286 | + params.radius = '300'; | |
| 287 | + | |
| 288 | + // 限速 | |
| 289 | + params.speedLimit = '60'; | |
| 290 | + | |
| 291 | + // 图形类型(r:圆形;p:多边形) | |
| 292 | + params.shapesType = 'r'; | |
| 293 | + | |
| 294 | + // destroy:是否撤销 | |
| 295 | + params.destroy = '0'; | |
| 296 | + | |
| 297 | + // versions:版本号 | |
| 298 | + params.versions = '1'; | |
| 299 | + | |
| 300 | + // 路段信息JSON字符串 | |
| 301 | + params.sectionJSON = sectionJSON; | |
| 302 | + | |
| 303 | + | |
| 304 | + // 保存 | |
| 305 | + $post('/station/manualSave',params,function(rd) { | |
| 306 | + | |
| 307 | + if(rd.status='SUCCESS') { | |
| 308 | + | |
| 309 | + // 关闭弹出层 | |
| 310 | + // layer.closeAll(); | |
| 311 | + | |
| 312 | + // 显示表格 | |
| 313 | + // $('#hide_table').show(); | |
| 314 | + | |
| 315 | + // 刷新树 | |
| 316 | + resjtreeDate(id,directionData); | |
| 317 | + | |
| 318 | + }else { | |
| 319 | + | |
| 320 | + // 保存失败 | |
| 321 | + | |
| 322 | + | |
| 323 | + } | |
| 324 | + | |
| 325 | + | |
| 326 | + }); | |
| 327 | + | |
| 328 | + | |
| 329 | + }) | |
| 330 | + | |
| 331 | + }); | |
| 332 | + */ | |
| 333 | + }); | |
| 334 | + | |
| 335 | + }); | |
| 336 | + | |
| 337 | + } | |
| 338 | + }); | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | +}); | |
| 343 | +</script> | |
| 0 | 344 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-ajax-getdata.js
| ... | ... | @@ -17,6 +17,16 @@ var GetAjaxData = function(){ |
| 17 | 17 | |
| 18 | 18 | }, |
| 19 | 19 | |
| 20 | + getStationRoutePoint : function(id_,dir_,callback) { | |
| 21 | + | |
| 22 | + $get('/stationroute/getStationRouteCenterPoints',{lineId:id_,direction:dir_},function(result) { | |
| 23 | + | |
| 24 | + callback && callback(result); | |
| 25 | + | |
| 26 | + }); | |
| 27 | + | |
| 28 | + }, | |
| 29 | + | |
| 20 | 30 | getLikeStationName : function (stationName,callback) { |
| 21 | 31 | |
| 22 | 32 | $get('/station/all', {stationName_eq: stationName}, function(array){ |
| ... | ... | @@ -122,6 +132,21 @@ var GetAjaxData = function(){ |
| 122 | 132 | |
| 123 | 133 | }, |
| 124 | 134 | |
| 135 | + stationRouteIsDestroy : function(stationRoute,callback) { | |
| 136 | + | |
| 137 | + | |
| 138 | + }, | |
| 139 | + | |
| 140 | + sectionUpdate:function(section,callback) { | |
| 141 | + | |
| 142 | + $post('/section/sectionUpdate',section,function(data) { | |
| 143 | + | |
| 144 | + callback && callback(data); | |
| 145 | + | |
| 146 | + }) | |
| 147 | + | |
| 148 | + }, | |
| 149 | + | |
| 125 | 150 | // 获取线路名称 |
| 126 | 151 | getIdLineName : function (id,callback) { |
| 127 | 152 | |
| ... | ... | @@ -193,6 +218,66 @@ var GetAjaxData = function(){ |
| 193 | 218 | |
| 194 | 219 | }, |
| 195 | 220 | |
| 221 | + MuneBpointsArrayToWGS : function(polyGonArray,callback) { | |
| 222 | + | |
| 223 | + if(polyGonArray) { | |
| 224 | + | |
| 225 | + // 获取长度 | |
| 226 | + var len = polyGonArray.length; | |
| 227 | + | |
| 228 | + (function(){ | |
| 229 | + | |
| 230 | + if (!arguments.callee.count) { | |
| 231 | + | |
| 232 | + arguments.callee.count = 0; | |
| 233 | + | |
| 234 | + } | |
| 235 | + | |
| 236 | + arguments.callee.count++; | |
| 237 | + | |
| 238 | + var index = parseInt(arguments.callee.count) - 1; | |
| 239 | + | |
| 240 | + if (index >= len) { | |
| 241 | + | |
| 242 | + callback && callback(polyGonArray); | |
| 243 | + | |
| 244 | + return; | |
| 245 | + } | |
| 246 | + | |
| 247 | + var f = arguments.callee; | |
| 248 | + | |
| 249 | + $.ajax({ | |
| 250 | + | |
| 251 | + // 百度坐标获取WGS坐标 | |
| 252 | + url: 'http://api.zdoz.net/bd2wgs.aspx', | |
| 253 | + | |
| 254 | + data: {lat: polyGonArray[index].lat , lng: polyGonArray[index].lng}, | |
| 255 | + | |
| 256 | + dataType: 'jsonp', | |
| 257 | + | |
| 258 | + success: function(r){ | |
| 259 | + | |
| 260 | + if(r) { | |
| 261 | + | |
| 262 | + polyGonArray[index].WGSpotion = r; | |
| 263 | + | |
| 264 | + } | |
| 265 | + | |
| 266 | + f(); | |
| 267 | + } | |
| 268 | + }); | |
| 269 | + | |
| 270 | + })(); | |
| 271 | + | |
| 272 | + }else { | |
| 273 | + | |
| 274 | + callback && callback(''); | |
| 275 | + | |
| 276 | + } | |
| 277 | + | |
| 278 | + | |
| 279 | + }, | |
| 280 | + | |
| 196 | 281 | getSectionRouteInfo : function(lineId,direction,callback) { |
| 197 | 282 | |
| 198 | 283 | $get('/sectionroute/findSection',{'line.id_eq' : lineId , 'directions_eq' : direction},function(resultdata) { | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-events.js
| ... | ... | @@ -268,9 +268,10 @@ function systemLineStation(lineNameV,directionData) { |
| 268 | 268 | if(result) { |
| 269 | 269 | |
| 270 | 270 | GetAjaxData.BpolyGonArrayToWGS(polyGonArray,function(arraydata) { |
| 271 | - | |
| 272 | 271 | WorldsBMap.getDistanceAndDuration(result,function(json) { |
| 273 | 272 | |
| 273 | + // console.log(arraydata); | |
| 274 | + | |
| 274 | 275 | json[0].distance = ''; |
| 275 | 276 | |
| 276 | 277 | json[0].duration = ''; |
| ... | ... | @@ -314,12 +315,11 @@ function systemLineStation(lineNameV,directionData) { |
| 314 | 315 | // 限速 |
| 315 | 316 | params.speedLimit = '60'; |
| 316 | 317 | |
| 317 | - console.log(params); | |
| 318 | + // console.log(params); | |
| 318 | 319 | |
| 319 | 320 | // 保存 |
| 320 | 321 | $post('/station/collectionSave',params,function(rd) { |
| 321 | 322 | |
| 322 | - | |
| 323 | 323 | if(rd.status='SUCCESS') { |
| 324 | 324 | |
| 325 | 325 | // 关闭弹出层 |
| ... | ... | @@ -337,7 +337,7 @@ function systemLineStation(lineNameV,directionData) { |
| 337 | 337 | |
| 338 | 338 | |
| 339 | 339 | } |
| 340 | - | |
| 340 | + | |
| 341 | 341 | }); |
| 342 | 342 | |
| 343 | 343 | }); |
| ... | ... | @@ -387,57 +387,43 @@ $(function(){ |
| 387 | 387 | |
| 388 | 388 | function systemSaveStation(directionData) { |
| 389 | 389 | |
| 390 | - // 根据线路ID获取线路名称 | |
| 391 | - GetAjaxData.getIdLineName(id,function(data) { | |
| 390 | + // 定义线路名称 | |
| 391 | + var lineNameV = $('.portlet-title .caption').text(); | |
| 392 | + | |
| 393 | + if(lineNameV.indexOf('区间')>0){ | |
| 392 | 394 | |
| 393 | - if(data) { | |
| 395 | + var lineNameNew = lineNameV.replace('区间',''); | |
| 396 | + | |
| 397 | + layer.confirm('系统无法生成该线路【'+lineNameV+'】的站点与路段!自动修改为如下线路名称【'+lineNameNew+'】生成', { | |
| 398 | + btn : [ '确认提示并提交', '取消' ] | |
| 399 | + }, function(index) { | |
| 400 | + | |
| 401 | + layer.close(index); | |
| 394 | 402 | |
| 395 | - // 定义线路名称 | |
| 396 | - var lineNameV = data.name; | |
| 403 | + lineNameV = lineNameNew; | |
| 397 | 404 | |
| 398 | - if(lineNameV.indexOf('区间')>0){ | |
| 405 | + systemLineStation(lineNameV,directionData); | |
| 406 | + },function(){ | |
| 407 | + | |
| 408 | + layer.closeAll(); | |
| 409 | + | |
| 410 | + if(directionData==0){ | |
| 399 | 411 | |
| 400 | - var lineNameNew = lineNameV.replace('区间',''); | |
| 412 | + $('#upToolsMobal').show(); | |
| 401 | 413 | |
| 402 | - layer.confirm('系统无法生成该线路【'+lineNameV+'】的站点与路段!自动修改为如下线路名称【'+lineNameNew+'】生成', { | |
| 403 | - btn : [ '确认提示并提交', '取消' ] | |
| 404 | - }, function(index) { | |
| 405 | - | |
| 406 | - layer.close(index); | |
| 407 | - | |
| 408 | - lineNameV = lineNameNew; | |
| 409 | - | |
| 410 | - systemLineStation(lineNameV,directionData); | |
| 411 | - },function(){ | |
| 412 | - | |
| 413 | - layer.closeAll(); | |
| 414 | - | |
| 415 | - if(directionData==0){ | |
| 416 | - | |
| 417 | - $('#upToolsMobal').show(); | |
| 418 | - | |
| 419 | - }else if(directionData==1){ | |
| 420 | - | |
| 421 | - $('#downToolsMobal').show(); | |
| 422 | - | |
| 423 | - } | |
| 424 | - | |
| 425 | - | |
| 426 | - }); | |
| 427 | - }else { | |
| 414 | + }else if(directionData==1){ | |
| 428 | 415 | |
| 429 | - systemLineStation(lineNameV,directionData); | |
| 416 | + $('#downToolsMobal').show(); | |
| 430 | 417 | |
| 431 | 418 | } |
| 432 | 419 | |
| 433 | - }else { | |
| 434 | - | |
| 435 | - alert('线路名称为空'); | |
| 436 | 420 | |
| 437 | - } | |
| 421 | + }); | |
| 422 | + }else { | |
| 438 | 423 | |
| 424 | + systemLineStation(lineNameV,directionData); | |
| 439 | 425 | |
| 440 | - }); | |
| 426 | + } | |
| 441 | 427 | |
| 442 | 428 | } |
| 443 | 429 | |
| ... | ... | @@ -471,7 +457,7 @@ $(function(){ |
| 471 | 457 | |
| 472 | 458 | }); |
| 473 | 459 | |
| 474 | - //删除 | |
| 460 | + // 撤销 | |
| 475 | 461 | $('.module_tools #deleteUpStation').on('click', function(){ |
| 476 | 462 | |
| 477 | 463 | var obj = getCurrSelNode('0'); |
| ... | ... | @@ -481,10 +467,30 @@ $(function(){ |
| 481 | 467 | return; |
| 482 | 468 | } |
| 483 | 469 | |
| 484 | - removeConfirm('你确定要删除【'+obj[0].text+'】模块吗?', '/module/' + obj[0].id | |
| 485 | - ,function() { | |
| 470 | + layer.confirm('你确定要撤销【'+obj[0].text+'】站点吗?', {btn : [ '确定撤销','返回' ],icon: 3, title:'提示' }, function(index){ | |
| 471 | + | |
| 472 | + var stationRouteId = obj[0].original.stationRouteId; | |
| 473 | + | |
| 474 | + var params = {stationRouteId:stationRouteId,destroy:'1'}; | |
| 475 | + | |
| 476 | + GetAjaxData.stationRouteIsDestroy(params,function(result) { | |
| 477 | + | |
| 478 | + layer.close(index); | |
| 479 | + | |
| 480 | + if(result.status=='SUCCESS'){ | |
| 481 | + | |
| 482 | + layer.msg('撤销上行站点【'+obj[0].text+'】成功!'); | |
| 483 | + | |
| 484 | + }else{ | |
| 485 | + | |
| 486 | + layer.msg('撤销上行站点【'+obj[0].text+'】失败!'); | |
| 487 | + | |
| 488 | + } | |
| 489 | + | |
| 490 | + }); | |
| 486 | 491 | |
| 487 | 492 | }); |
| 493 | + | |
| 488 | 494 | }); |
| 489 | 495 | |
| 490 | 496 | // 修改上行站点mobal页面 |
| ... | ... | @@ -527,6 +533,20 @@ $(function(){ |
| 527 | 533 | // 编辑线路走向 |
| 528 | 534 | $('.module_tools #editUplineTrend').on('click', function(){ |
| 529 | 535 | |
| 536 | + var sel = getCurrSelNode(dir); | |
| 537 | + | |
| 538 | + if(sel.length==0 || sel[0].original.chaildredType !='section'){ | |
| 539 | + | |
| 540 | + layer.msg('请先选中要编辑的上行路段!'); | |
| 541 | + | |
| 542 | + return; | |
| 543 | + } | |
| 544 | + | |
| 545 | + var sectionId = sel[0].original.sectionId; | |
| 546 | + | |
| 547 | + | |
| 548 | + var sectionrouteDirections = sel[0].original.sectionrouteDirections; | |
| 549 | + | |
| 530 | 550 | // 开启线路编辑 |
| 531 | 551 | polyUpline.enableEditing(); |
| 532 | 552 | |
| ... | ... | @@ -539,13 +559,45 @@ $(function(){ |
| 539 | 559 | // 关闭 |
| 540 | 560 | layer.close(yindex); |
| 541 | 561 | |
| 562 | + polyUpline.disableEditing(); | |
| 563 | + | |
| 564 | + // 弹出正在加载层 | |
| 565 | + var i = layer.load(0,{title :'我是标题'}); | |
| 566 | + | |
| 542 | 567 | // 获取折线坐标集合 |
| 543 | 568 | var editPloyLineArray = polyUpline.getPath(); |
| 544 | 569 | |
| 545 | 570 | // 坐标转换WGS坐标 |
| 546 | 571 | GetAjaxData.BpolyGonArrayToWGS(editPloyLineArray,function(arraydata) { |
| 547 | 572 | |
| 548 | - console.log(arraydata); | |
| 573 | + // 定义路段信息字符串 | |
| 574 | + var sectionJSON = JSON.stringify(arraydata); | |
| 575 | + | |
| 576 | + var params = {sectionId:sectionId,sectionJSON:sectionJSON} | |
| 577 | + | |
| 578 | + GetAjaxData.sectionUpdate(params,function(result) { | |
| 579 | + | |
| 580 | + layer.close(i); | |
| 581 | + | |
| 582 | + if(result.status=='SUCCESS'){ | |
| 583 | + | |
| 584 | + layer.msg('修改上行路段成功!'); | |
| 585 | + | |
| 586 | + }else{ | |
| 587 | + | |
| 588 | + layer.msg('修改上行路段失败!'); | |
| 589 | + | |
| 590 | + } | |
| 591 | + mapB.clearOverlays(); | |
| 592 | + GetAjaxData.getSectionRouteInfo(id,sectionrouteDirections,function(data) { | |
| 593 | + | |
| 594 | + // 刷新树 | |
| 595 | + resjtreeDate(id,sectionrouteDirections); | |
| 596 | + | |
| 597 | + linePanlThree(data,sectionrouteDirections); | |
| 598 | + | |
| 599 | + }); | |
| 600 | + }); | |
| 549 | 601 | |
| 550 | 602 | }); |
| 551 | 603 | |
| ... | ... | @@ -556,14 +608,25 @@ $(function(){ |
| 556 | 608 | // 线路上行 |
| 557 | 609 | $('#leftUpOrDown #upLine').on('click', function(){ |
| 558 | 610 | |
| 559 | - linePanlThree(id,'0'); | |
| 611 | + mapB.clearOverlays(); | |
| 612 | + | |
| 613 | + GetAjaxData.getSectionRouteInfo(id,'0',function(data) { | |
| 614 | + | |
| 615 | + linePanlThree(data,'0'); | |
| 616 | + | |
| 617 | + }); | |
| 560 | 618 | |
| 561 | 619 | }); |
| 562 | 620 | |
| 563 | 621 | // 线路下行 |
| 564 | 622 | $('#leftUpOrDown #downLine').on('click', function(){ |
| 623 | + mapB.clearOverlays(); | |
| 565 | 624 | |
| 566 | - linePanlThree(id,'1'); | |
| 625 | + GetAjaxData.getSectionRouteInfo(id,'1',function(data) { | |
| 626 | + | |
| 627 | + linePanlThree(data,'1'); | |
| 628 | + | |
| 629 | + }); | |
| 567 | 630 | |
| 568 | 631 | }); |
| 569 | 632 | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-map.js
| ... | ... | @@ -7,7 +7,7 @@ var WorldsBMap = function () { |
| 7 | 7 | // 搜索结果呈现的配置 |
| 8 | 8 | // renderOptions:{map:map}, |
| 9 | 9 | |
| 10 | - // 设置公交列表查询后的回调函数。参数:rs: BusListResult类型 | |
| 10 | + /* // 设置公交列表查询后的回调函数。参数:rs: BusListResult类型 | |
| 11 | 11 | onGetBusListComplete:function(BusListResult) { |
| 12 | 12 | |
| 13 | 13 | // 如果不为空 |
| ... | ... | @@ -20,8 +20,7 @@ var WorldsBMap = function () { |
| 20 | 20 | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - }, | |
| 24 | - | |
| 23 | + },*/ | |
| 25 | 24 | // 设置公交列表查询后的回调函数。参数:rs: BusListResult类型 |
| 26 | 25 | onGetBusListComplete:function(BusListResult) { |
| 27 | 26 | |
| ... | ... | @@ -33,7 +32,7 @@ var WorldsBMap = function () { |
| 33 | 32 | |
| 34 | 33 | if(fstLine==undefined){ |
| 35 | 34 | |
| 36 | - layer.confirm('系统无法生成该线路【'+lineNameValue+'】的站点与路段!请点击返回选择手动规划', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){ | |
| 35 | + layer.confirm('系统无法生成该线路【'+lineNameValue+'】的站点与路段!请点击返回选择其它方式规划', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){ | |
| 37 | 36 | |
| 38 | 37 | layer.closeAll(); |
| 39 | 38 | |
| ... | ... | @@ -413,6 +412,46 @@ var WorldsBMap = function () { |
| 413 | 412 | |
| 414 | 413 | }, |
| 415 | 414 | |
| 415 | + pointsThread : function(obj,map) { | |
| 416 | + | |
| 417 | + mapB.clearOverlays(); | |
| 418 | + | |
| 419 | + if(obj) { | |
| 420 | + | |
| 421 | + var tempStr = obj.substring(11,obj.length-1); | |
| 422 | + | |
| 423 | + var lineArray = tempStr.split(','); | |
| 424 | + | |
| 425 | + var polylineArray = []; | |
| 426 | + | |
| 427 | + for(var i = 0;i<lineArray.length;i++) { | |
| 428 | + | |
| 429 | + polylineArray.push(new BMap.Point(lineArray[i].split(' ')[0],lineArray[i].split(' ')[1])); | |
| 430 | + | |
| 431 | + } | |
| 432 | + | |
| 433 | + // 创建线路走向 | |
| 434 | + polyUpline = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 4,strokeOpacity : 0.5}); | |
| 435 | + | |
| 436 | + // 把折线添加到地图上 | |
| 437 | + mapB.addOverlay(polyUpline); | |
| 438 | + | |
| 439 | + // 自定义标注物图片 | |
| 440 | + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); | |
| 441 | + | |
| 442 | + // 创建标注物 | |
| 443 | + var markers_target = new BMap.Marker(polylineArray[0],{icon : icon_target}); | |
| 444 | + | |
| 445 | + // 把标注添物加到地图上 | |
| 446 | + mapB.addOverlay(markers_target); | |
| 447 | + | |
| 448 | + //设置中心点 | |
| 449 | + mapB.centerAndZoom(polylineArray[0],16); | |
| 450 | + | |
| 451 | + } | |
| 452 | + | |
| 453 | + }, | |
| 454 | + | |
| 416 | 455 | // 画圆 |
| 417 | 456 | pointsCircle : function(objStation,map) { |
| 418 | 457 | |
| ... | ... | @@ -440,8 +479,8 @@ var WorldsBMap = function () { |
| 440 | 479 | width : 200, |
| 441 | 480 | |
| 442 | 481 | // 信息窗口高度 |
| 443 | - height : 400, | |
| 444 | - | |
| 482 | + height : 450, | |
| 483 | + offset: new BMap.Size(500,120), | |
| 445 | 484 | //标题 |
| 446 | 485 | title : '<h4 style="color:#FFFFFF">'+objStation.stationStationName+'站详情</h4>', |
| 447 | 486 | |
| ... | ... | @@ -449,7 +488,9 @@ var WorldsBMap = function () { |
| 449 | 488 | enableMessage : false, |
| 450 | 489 | |
| 451 | 490 | //是否开启点击地图关闭信息窗口 |
| 452 | - enableCloseOnClick : false | |
| 491 | + enableCloseOnClick : false, | |
| 492 | + | |
| 493 | + enableAutoPan:false | |
| 453 | 494 | }; |
| 454 | 495 | |
| 455 | 496 | var infoWindow_target = new BMap.InfoWindow('<HR style="border:1 dashed #987cb9" width="100%" color=#987cb9 SIZE=1>'+ |
| ... | ... | @@ -469,16 +510,21 @@ var WorldsBMap = function () { |
| 469 | 510 | // 把标注添物加到地图上 |
| 470 | 511 | map.addOverlay(marker); |
| 471 | 512 | |
| 513 | + setTimeout(function(){ | |
| 514 | + //开启信息窗口 | |
| 515 | + marker.openInfoWindow(infoWindow_target,point); | |
| 516 | + | |
| 517 | + },100); | |
| 518 | + | |
| 472 | 519 | // marker.disableMassClear(); |
| 473 | 520 | |
| 474 | 521 | var PanOptions_ ={noAnimation :true}; |
| 475 | 522 | |
| 476 | 523 | map.panTo(point,PanOptions_); |
| 477 | 524 | |
| 478 | - map.panBy(10,110,PanOptions_); | |
| 525 | + //map.panBy(10,-50,PanOptions_); | |
| 526 | + | |
| 479 | 527 | |
| 480 | - //开启信息窗口 | |
| 481 | - marker.openInfoWindow(infoWindow_target,point); | |
| 482 | 528 | |
| 483 | 529 | // 添加标志物监听事件 |
| 484 | 530 | marker.addEventListener("click",function() { |
| ... | ... | @@ -505,7 +551,6 @@ var WorldsBMap = function () { |
| 505 | 551 | |
| 506 | 552 | if(poi) { |
| 507 | 553 | |
| 508 | - | |
| 509 | 554 | //获取经度和纬度 |
| 510 | 555 | resultPoints = poi.point.lng + ' ' + poi.point.lat; |
| 511 | 556 | |
| ... | ... | @@ -517,15 +562,11 @@ var WorldsBMap = function () { |
| 517 | 562 | |
| 518 | 563 | } |
| 519 | 564 | |
| 520 | - | |
| 521 | 565 | }else { |
| 522 | 566 | |
| 523 | 567 | callback && callback(false); |
| 524 | 568 | } |
| 525 | 569 | |
| 526 | - | |
| 527 | - | |
| 528 | - | |
| 529 | 570 | }); |
| 530 | 571 | |
| 531 | 572 | localSearch.search(Address); |
| ... | ... | @@ -636,27 +677,56 @@ var WorldsBMap = function () { |
| 636 | 677 | }, |
| 637 | 678 | |
| 638 | 679 | // 在地图上画出上行线路走向 |
| 639 | - drawingUpline : function (polylineArray) { | |
| 680 | + drawingUpline : function (polylineArray,resultdata) { | |
| 640 | 681 | |
| 641 | - mapB.clearOverlays(); | |
| 682 | + // mapB.clearOverlays(); | |
| 642 | 683 | |
| 643 | 684 | // 创建线路走向 |
| 644 | - polyUpline = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 4,strokeOpacity : 0.5}); | |
| 685 | + polyUpline = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 6,strokeOpacity : 0.5}); | |
| 645 | 686 | |
| 646 | 687 | // 把折线添加到地图上 |
| 647 | 688 | mapB.addOverlay(polyUpline); |
| 648 | 689 | |
| 649 | - // 自定义标注物图片 | |
| 650 | - var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); | |
| 690 | + if(resultdata.length>0) { | |
| 691 | + | |
| 692 | + for(var s = 0 ; s<resultdata.length;s++) { | |
| 693 | + | |
| 694 | + var bJwpointsStr = resultdata[s].bJwpoints; | |
| 695 | + | |
| 696 | + var bJwpointsArray = bJwpointsStr.split(' '); | |
| 697 | + | |
| 698 | + var point_center = new BMap.Point(bJwpointsArray[0],bJwpointsArray[1]); | |
| 699 | + | |
| 700 | + // 自定义标注物图片 | |
| 701 | + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); | |
| 702 | + | |
| 703 | + // 创建标注物 | |
| 704 | + var markers_target = new BMap.Marker(point_center,{icon : icon_target}); | |
| 705 | + | |
| 706 | + mapB.addOverlay(markers_target); | |
| 707 | + | |
| 708 | + } | |
| 709 | + | |
| 710 | + } | |
| 711 | + | |
| 712 | + var ceter_index = Math.round(resultdata.length / 2); | |
| 651 | 713 | |
| 652 | - // 创建标注物 | |
| 653 | - var markers_target = new BMap.Marker(polylineArray[0],{icon : icon_target}); | |
| 714 | + var ceterPointsStr = resultdata[ceter_index].bJwpoints; | |
| 654 | 715 | |
| 655 | - // 把标注添物加到地图上 | |
| 656 | - mapB.addOverlay(markers_target); | |
| 716 | + var ceterPointsArray = ceterPointsStr.split(' '); | |
| 717 | + | |
| 718 | + var polyline_center = new BMap.Point(ceterPointsArray[0],ceterPointsArray[1]); | |
| 657 | 719 | |
| 658 | - //设置中心点 | |
| 659 | - mapB.centerAndZoom(polylineArray[0],16); | |
| 720 | + var PanOptions_ ={noAnimation :true}; | |
| 721 | + | |
| 722 | + mapB.reset(); | |
| 723 | + | |
| 724 | + mapB.panTo(polyline_center,PanOptions_); | |
| 725 | + | |
| 726 | + mapB.panBy(500,-510,PanOptions_); | |
| 727 | + | |
| 728 | + mapB.setZoom(14); | |
| 729 | + | |
| 660 | 730 | |
| 661 | 731 | }, |
| 662 | 732 | |
| ... | ... | @@ -670,8 +740,198 @@ var WorldsBMap = function () { |
| 670 | 740 | // 设置属性 |
| 671 | 741 | drawingManager.setDrawingMode(BMAP_DRAWING_POLYGON); |
| 672 | 742 | |
| 673 | - } | |
| 743 | + }, | |
| 744 | + | |
| 745 | + stationsNameToPoints : function(arra,callback) { | |
| 746 | + | |
| 747 | + // 获取长度 | |
| 748 | + var len = arra.length; | |
| 749 | + | |
| 750 | + var stationList = []; | |
| 751 | + | |
| 752 | + (function(){ | |
| 753 | + | |
| 754 | + if (!arguments.callee.count) { | |
| 755 | + | |
| 756 | + arguments.callee.count = 0; | |
| 757 | + | |
| 758 | + } | |
| 759 | + | |
| 760 | + arguments.callee.count++; | |
| 761 | + | |
| 762 | + var index = parseInt(arguments.callee.count) - 1; | |
| 763 | + | |
| 764 | + if (index >= len) { | |
| 765 | + | |
| 766 | + callback && callback(stationList); | |
| 767 | + | |
| 768 | + return; | |
| 769 | + } | |
| 770 | + | |
| 771 | + var f = arguments.callee; | |
| 772 | + | |
| 773 | + if(arra[index]!=''){ | |
| 774 | + | |
| 775 | + var localSearch = new BMap.LocalSearch(mapB); | |
| 776 | + | |
| 777 | + localSearch.search(arra[index]); | |
| 778 | + | |
| 779 | + localSearch.setSearchCompleteCallback(function (searchResult) { | |
| 780 | + | |
| 781 | + var poi = searchResult.getPoi(0); | |
| 782 | + | |
| 783 | + | |
| 784 | + if(poi) { | |
| 785 | + | |
| 786 | + stationList.push({name:arra[index],potion:{lng:poi.point.lng,lat:poi.point.lat}}); | |
| 787 | + | |
| 788 | + f(); | |
| 789 | + | |
| 790 | + } | |
| 791 | + | |
| 792 | + }); | |
| 793 | + }else { | |
| 794 | + | |
| 795 | + f(); | |
| 796 | + | |
| 797 | + } | |
| 798 | + | |
| 799 | + })(); | |
| 800 | + | |
| 801 | + }, | |
| 802 | + | |
| 803 | + getDistanceAndTotime : function(stationList,cb) { | |
| 804 | + | |
| 805 | + stationList[0].distance = ''; | |
| 806 | + | |
| 807 | + stationList[0].duration = ''; | |
| 808 | + | |
| 809 | + // var sectionList = []; | |
| 810 | + | |
| 811 | + // 获取长度 | |
| 812 | + var len = stationList.length; | |
| 813 | + | |
| 814 | + (function(){ | |
| 815 | + | |
| 816 | + if (!arguments.callee.count) { | |
| 817 | + | |
| 818 | + arguments.callee.count = 0; | |
| 819 | + | |
| 820 | + } | |
| 821 | + | |
| 822 | + arguments.callee.count++; | |
| 823 | + | |
| 824 | + var index = parseInt(arguments.callee.count) - 1; | |
| 825 | + | |
| 826 | + if (index >= len-1) { | |
| 827 | + | |
| 828 | + // cb && cb(stationList,sectionList); | |
| 829 | + cb && cb(stationList); | |
| 830 | + return; | |
| 831 | + } | |
| 832 | + | |
| 833 | + var f = arguments.callee; | |
| 834 | + | |
| 835 | + var poiOne = new BMap.Point(stationList[index].potion.lng,stationList[index].potion.lat); | |
| 836 | + | |
| 837 | + var poiTwo = new BMap.Point(stationList[index+1].potion.lng,stationList[index+1].potion.lat); | |
| 838 | + | |
| 839 | + var transit = new BMap.TransitRoute(mapB, {renderOptions: {map: mapB},onSearchComplete: searchComplete}); | |
| 840 | + | |
| 841 | + transit.search(poiOne,poiTwo); | |
| 842 | + | |
| 843 | + function searchComplete(results){ | |
| 844 | + | |
| 845 | + var plan = results.getPlan(0); | |
| 846 | + | |
| 847 | + if (transit.getStatus() != BMAP_STATUS_SUCCESS){ | |
| 848 | + | |
| 849 | + stationList[index+1].distance = ''; | |
| 850 | + | |
| 851 | + stationList[index+1].duration = ''; | |
| 852 | + | |
| 853 | + // sectionList.push({sectionName:stationList[index].name+stationList[index+1].name,points:''}); | |
| 854 | + | |
| 855 | + }else { | |
| 856 | + | |
| 857 | + stationList[index+1].distance = plan.getDistance(true); | |
| 858 | + | |
| 859 | + stationList[index+1].duration = plan.getDuration(true); | |
| 860 | + | |
| 861 | + // var line = plan.getRoute(0); | |
| 862 | + | |
| 863 | + // sectionList.push({sectionName:stationList[index].name+stationList[index+1].name,points:line.getPath()}); | |
| 864 | + | |
| 865 | + } | |
| 866 | + | |
| 867 | + f(); | |
| 868 | + } | |
| 869 | + | |
| 870 | + })(); | |
| 871 | + | |
| 872 | + }, | |
| 674 | 873 | |
| 874 | + getSectionListPlonly : function(stationsPoint,cb) { | |
| 875 | + | |
| 876 | + var len = stationsPoint.length; | |
| 877 | + | |
| 878 | + var sectionList = []; | |
| 879 | + | |
| 880 | + (function(){ | |
| 881 | + | |
| 882 | + if (!arguments.callee.count) { | |
| 883 | + | |
| 884 | + arguments.callee.count = 0; | |
| 885 | + | |
| 886 | + } | |
| 887 | + | |
| 888 | + arguments.callee.count++; | |
| 889 | + | |
| 890 | + var index = parseInt(arguments.callee.count) - 1; | |
| 891 | + | |
| 892 | + if (index >= len-1 ) { | |
| 893 | + | |
| 894 | + cb && cb(sectionList); | |
| 895 | + return; | |
| 896 | + } | |
| 897 | + | |
| 898 | + var f = arguments.callee; | |
| 899 | + | |
| 900 | + var poiOne = new BMap.Point(stationsPoint[index].potion.lng,stationsPoint[index].potion.lat); | |
| 901 | + | |
| 902 | + var poiTwo = new BMap.Point(stationsPoint[index+1].potion.lng,stationsPoint[index+1].potion.lat); | |
| 903 | + | |
| 904 | + var transit = new BMap.TransitRoute(mapB, {renderOptions: {map: mapB},onPolylinesSet: searchPolylinesSet}); | |
| 905 | + | |
| 906 | + function searchPolylinesSet(results){ | |
| 907 | + | |
| 908 | + if (transit.getStatus() != BMAP_STATUS_SUCCESS){ | |
| 909 | + | |
| 910 | + | |
| 911 | + }else { | |
| 912 | + | |
| 913 | + var sectionArrayList = []; | |
| 914 | + for (i = 0; i < results.length; i++){ | |
| 915 | + | |
| 916 | + // console.log(results[i].getPolyline().getPath()); | |
| 917 | + sectionArrayList = sectionArrayList.concat(results[i].getPolyline().getPath()); | |
| 918 | + | |
| 919 | + } | |
| 920 | + | |
| 921 | + var sectionName = stationsPoint[index].name + '至' + stationsPoint[index+1].name; | |
| 922 | + | |
| 923 | + sectionList.push({sectionName:sectionName,points:sectionArrayList}); | |
| 924 | + | |
| 925 | + } | |
| 926 | + | |
| 927 | + f(); | |
| 928 | + } | |
| 929 | + | |
| 930 | + transit.search(poiOne,poiTwo); | |
| 931 | + | |
| 932 | + })(); | |
| 933 | + | |
| 934 | + } | |
| 675 | 935 | } |
| 676 | 936 | |
| 677 | 937 | return Bmap; | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-reload.js
| 1 | -function linePanlThree(lineId,diraction) { | |
| 2 | - GetAjaxData.getSectionRouteInfo(lineId,diraction,function(data) { | |
| 1 | +function linePanlThree(data,direction) { | |
| 2 | + | |
| 3 | + GetAjaxData.getStationRoutePoint(id,direction,function(resultdata) { | |
| 3 | 4 | |
| 4 | - if(data.length>0) { | |
| 5 | - | |
| 6 | - var sectionBsectionVectorStr = data[0].sectionBsectionVector; | |
| 7 | - | |
| 8 | - var tempStr = sectionBsectionVectorStr.substring(11,sectionBsectionVectorStr.length-1); | |
| 9 | - | |
| 10 | - var lineArray = tempStr.split(','); | |
| 11 | - | |
| 12 | - var polylineArray = []; | |
| 5 | + var dataLen = data.length; | |
| 6 | + | |
| 7 | + if(dataLen>0) { | |
| 13 | 8 | |
| 14 | - for(var i = 0;i<lineArray.length;i++) { | |
| 9 | + for(var d= 0; d<dataLen;d++){ | |
| 10 | + | |
| 11 | + var sectionBsectionVectorStr = data[d].sectionBsectionVector; | |
| 15 | 12 | |
| 16 | - polylineArray.push(new BMap.Point(lineArray[i].split(' ')[0],lineArray[i].split(' ')[1])); | |
| 13 | + if(sectionBsectionVectorStr==null) { | |
| 14 | + | |
| 15 | + continue; | |
| 16 | + | |
| 17 | + } | |
| 18 | + | |
| 19 | + var tempStr = sectionBsectionVectorStr.substring(11,sectionBsectionVectorStr.length-1); | |
| 20 | + | |
| 21 | + var lineArray = tempStr.split(','); | |
| 22 | + | |
| 23 | + var polylineArray = []; | |
| 24 | + | |
| 25 | + for(var i = 0;i<lineArray.length;i++) { | |
| 26 | + | |
| 27 | + polylineArray.push(new BMap.Point(lineArray[i].split(' ')[0],lineArray[i].split(' ')[1])); | |
| 28 | + | |
| 29 | + } | |
| 30 | + WorldsBMap.drawingUpline(polylineArray,resultdata); | |
| 17 | 31 | |
| 18 | 32 | } |
| 19 | - WorldsBMap.drawingUpline(polylineArray); | |
| 33 | + | |
| 20 | 34 | } |
| 21 | 35 | |
| 22 | 36 | }); |
| ... | ... | @@ -79,29 +93,50 @@ function TreeUpOrDown(lineId,diraction) { |
| 79 | 93 | |
| 80 | 94 | } |
| 81 | 95 | |
| 96 | +function setTiteText(lineId) { | |
| 97 | + | |
| 98 | + | |
| 99 | + // 根据线路ID获取线路名称 | |
| 100 | + GetAjaxData.getIdLineName(lineId,function(data) { | |
| 101 | + | |
| 102 | + // 定义线路名称 | |
| 103 | + var lineNameV = data.name; | |
| 104 | + | |
| 105 | + $('.portlet-title .caption').text(lineNameV); | |
| 106 | + | |
| 107 | + | |
| 108 | + }); | |
| 109 | + | |
| 110 | +} | |
| 111 | + | |
| 82 | 112 | $(function(){ |
| 83 | 113 | |
| 84 | 114 | // 获取参数ID |
| 85 | 115 | id = $.url().param('no'); |
| 86 | 116 | |
| 87 | 117 | dir = '0'; |
| 88 | - | |
| 118 | + | |
| 89 | 119 | if(id) { |
| 90 | 120 | |
| 91 | 121 | // 初始化地图和表格 |
| 92 | 122 | setTimeout(function(){ |
| 93 | 123 | |
| 124 | + setTiteText(id); | |
| 125 | + | |
| 94 | 126 | // 地图初始化 |
| 95 | 127 | var mapB = WorldsBMap.init(map); |
| 96 | 128 | |
| 97 | 129 | // 全局变量 |
| 98 | 130 | window.mapB = mapB; |
| 99 | - | |
| 100 | 131 | TreeUpOrDown(id,'0'); |
| 101 | 132 | |
| 102 | 133 | TreeUpOrDown(id,'1'); |
| 103 | 134 | |
| 104 | - linePanlThree(id,'0'); | |
| 135 | + GetAjaxData.getSectionRouteInfo(id,'0',function(data) { | |
| 136 | + | |
| 137 | + linePanlThree(data,'0'); | |
| 138 | + | |
| 139 | + }); | |
| 105 | 140 | |
| 106 | 141 | },500); |
| 107 | 142 | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-treedata.js
| ... | ... | @@ -36,33 +36,60 @@ var StationTreeData = function(){ |
| 36 | 36 | 'plugins': ['types'] |
| 37 | 37 | }).bind('click.jstree', function(event) { |
| 38 | 38 | |
| 39 | - //单击事件 | |
| 40 | - | |
| 41 | 39 | layer.closeAll(); |
| 42 | 40 | |
| 43 | 41 | var treeOjb = $.jstree.reference("#station_Up_tree").get_selected(true); |
| 44 | 42 | |
| 45 | 43 | var len = treeOjb.length; |
| 46 | 44 | |
| 45 | + | |
| 47 | 46 | if(len>0) { |
| 48 | 47 | |
| 49 | - var shapesTypeT = treeOjb[0].original.stationShapesType; | |
| 50 | - | |
| 51 | 48 | var objStation = treeOjb[0].original; |
| 52 | 49 | |
| 53 | - // 如果是圆 | |
| 54 | - if(shapesTypeT =='r') { | |
| 55 | - | |
| 56 | - WorldsBMap.pointsCircle(objStation,map); | |
| 50 | + var chaildredType = objStation.chaildredType; | |
| 51 | + if(chaildredType =='station') { | |
| 57 | 52 | |
| 58 | - }else if(shapesTypeT == 'd') { | |
| 53 | + mapB.setZoom(16); | |
| 54 | + | |
| 55 | + var shapesTypeT = treeOjb[0].original.stationShapesType; | |
| 59 | 56 | |
| 60 | - WorldsBMap.pointsPolygon(objStation,map); | |
| 57 | + var objStation = treeOjb[0].original; | |
| 61 | 58 | |
| 62 | - } | |
| 59 | + // 如果是圆 | |
| 60 | + if(shapesTypeT =='r') { | |
| 61 | + | |
| 62 | + | |
| 63 | + WorldsBMap.pointsCircle(objStation,map); | |
| 64 | + | |
| 65 | + }else if(shapesTypeT == 'd') { | |
| 66 | + | |
| 67 | + WorldsBMap.pointsPolygon(objStation,map); | |
| 68 | + | |
| 69 | + } | |
| 70 | + | |
| 71 | + }else if(chaildredType =='section'){ | |
| 72 | + | |
| 73 | + var objSection = treeOjb[0].original.sectionBsectionVector; | |
| 74 | + | |
| 75 | + var polylineArray = []; | |
| 76 | + | |
| 77 | + polylineArray.push(treeOjb[0].original); | |
| 78 | + | |
| 79 | + var dire_ = treeOjb[0].original.sectionrouteDirections; | |
| 80 | + | |
| 81 | + mapB.clearOverlays(); | |
| 82 | + | |
| 83 | + linePanlThree(polylineArray,dire_); | |
| 84 | + | |
| 85 | + }else if(chaildredType ==null){ | |
| 63 | 86 | |
| 87 | + return; | |
| 88 | + | |
| 89 | + } | |
| 64 | 90 | |
| 65 | 91 | } |
| 92 | + | |
| 66 | 93 | }); |
| 67 | 94 | } |
| 68 | 95 | }, | ... | ... |
src/main/resources/static/pages/base/stationroute/list.html
| ... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 | <!-- 左边标题栏 --> |
| 12 | 12 | <div class="portlet-title" style="background-color:#3B3F51"> |
| 13 | 13 | <div class="caption"> |
| 14 | - 途径站点 | |
| 14 | + <!-- 途径站点 --> | |
| 15 | 15 | </div> |
| 16 | 16 | <div class="tools"> |
| 17 | 17 | <a href="javascript:;" class="collapse" data-original-title="" title=""> </a> |
| ... | ... | @@ -41,6 +41,7 @@ |
| 41 | 41 | |
| 42 | 42 | <!-- 左边栏上行 --> |
| 43 | 43 | <div class="tab-pane active in" id="stationUp" data-direction="0"> |
| 44 | + | |
| 44 | 45 | <div class="portlet-body" id="uptreeMobal" style="display: none"> |
| 45 | 46 | <div class="table-toolbar"> |
| 46 | 47 | <div class="row"> |
| ... | ... | @@ -48,9 +49,14 @@ |
| 48 | 49 | <div class="btn-group" style="float: right;"> |
| 49 | 50 | <div class="actions module_tools"> |
| 50 | 51 | <div class="btn-group"> |
| 51 | - <a class="btn green-haze btn-outline btn-circle btn-sm" style="background-color:#3B3F51;border-color:#FFFFFF;color:#FFFFFF" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true" aria-expanded="true"> 工具 | |
| 52 | + <!-- <a class="btn green-haze btn-outline btn-circle btn-sm" style="background-color:#3B3F51;border-color:#FFFFFF;color:#FFFFFF" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true" aria-expanded="true"> 工具 | |
| 52 | 53 | <i class="fa fa-angle-down"></i> |
| 53 | - </a> | |
| 54 | + </a> --> | |
| 55 | + <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false"> | |
| 56 | + <i class="fa fa-share"></i> | |
| 57 | + <span>上行操作</span> | |
| 58 | + <i class="fa fa-angle-down"></i> | |
| 59 | + </a> | |
| 54 | 60 | <ul class="dropdown-menu pull-right" style="min-width:100px"> |
| 55 | 61 | <li> |
| 56 | 62 | <a href="javascript:;" id="addUpStation"><i class="fa fa-plus"></i> 添加站点</a> |
| ... | ... | @@ -61,11 +67,11 @@ |
| 61 | 67 | </li> |
| 62 | 68 | <li class="divider"> </li> |
| 63 | 69 | <li> |
| 64 | - <a href="javascript:;" id="deleteUpStation"><i class="fa fa-close"></i> 删除站点</a> | |
| 70 | + <a href="javascript:;" id="deleteUpStation"><i class="fa fa-close"></i> 撤销站点</a> | |
| 65 | 71 | </li> |
| 66 | 72 | <li class="divider"> </li> |
| 67 | 73 | <li> |
| 68 | - <a href="javascript:;" id="editUplineTrend"><i class="fa fa-close"></i> 编辑走向</a> | |
| 74 | + <a href="javascript:;" id="editUplineTrend"><i class="fa fa-edit"></i> 编辑走向</a> | |
| 69 | 75 | </li> |
| 70 | 76 | </ul> |
| 71 | 77 | </div> |
| ... | ... | @@ -86,16 +92,18 @@ |
| 86 | 92 | <div class="col-md-6" style="float: right;"> |
| 87 | 93 | <div class="btn-group" style="float: right;"> |
| 88 | 94 | <div class="actions"> |
| 89 | - <a class="btn green-haze btn-outline btn-circle btn-sm" style="background-color:#3B3F51;border-color:#FFFFFF;color:#FFFFFF" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true" aria-expanded="true"> 工具 | |
| 90 | - <i class="fa fa-angle-down"></i> | |
| 91 | - </a> | |
| 95 | + <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false"> | |
| 96 | + <i class="fa fa-share"></i> | |
| 97 | + <span>上行规划选择</span> | |
| 98 | + <i class="fa fa-angle-down"></i> | |
| 99 | + </a> | |
| 92 | 100 | <ul class="dropdown-menu pull-right" style="min-width:100px"> |
| 93 | 101 | <li> |
| 94 | 102 | <a class="upSystem" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-wrench"></i> 系统规划</a> |
| 95 | 103 | </li> |
| 96 | 104 | <li class="divider"> </li> |
| 97 | 105 | <li> |
| 98 | - <a class="upManual" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-pencil"></i> 手动规划</a> | |
| 106 | + <a class="upManual" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-pencil"></i> 其它方式</a> | |
| 99 | 107 | </li> |
| 100 | 108 | </ul> |
| 101 | 109 | </div> |
| ... | ... | @@ -105,8 +113,9 @@ |
| 105 | 113 | <div class="row" style="margin-top: 10px;"> |
| 106 | 114 | <div class="col-md-12"> |
| 107 | 115 | <!-- 提示 --> |
| 108 | - <div class="alert alert-warning"> | |
| 109 | - <strong>系统未初始化该线路上行站点!</strong> 请从上方工具里选择任意一种方式规划该线路上行站点 </div> | |
| 116 | + <div class="alert alert-warning" style="background-color: #22313F;border-color: #FFFFFF;color: #2ab4c0;"> | |
| 117 | + <strong>系统未初始化该线路上行站点!</strong> 请从上方【上行规划选择】里选择任意一种方式规划该线路上行站点. | |
| 118 | + </div> | |
| 110 | 119 | </div> |
| 111 | 120 | </div> |
| 112 | 121 | </div> |
| ... | ... | @@ -122,9 +131,14 @@ |
| 122 | 131 | <div class="btn-group" style="float: right;"> |
| 123 | 132 | <div class="actions module_tools"> |
| 124 | 133 | <div class="btn-group"> |
| 125 | - <a class="btn green-haze btn-outline btn-circle btn-sm" style="background-color:#3B3F51;border-color:#FFFFFF;color:#FFFFFF" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true" aria-expanded="true"> 工具 | |
| 134 | + <!-- <a class="btn green-haze btn-outline btn-circle btn-sm" style="background-color:#3B3F51;border-color:#FFFFFF;color:#FFFFFF" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true" aria-expanded="true"> 工具 | |
| 126 | 135 | <i class="fa fa-angle-down"></i> |
| 127 | - </a> | |
| 136 | + </a> --> | |
| 137 | + <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false"> | |
| 138 | + <i class="fa fa-share"></i> | |
| 139 | + <span>下行操作</span> | |
| 140 | + <i class="fa fa-angle-down"></i> | |
| 141 | + </a> | |
| 128 | 142 | <ul class="dropdown-menu pull-right" style="min-width:100px"> |
| 129 | 143 | <li> |
| 130 | 144 | <a href="javascript:;" id="addDownStation"><i class="fa fa-plus"></i> 添加站点</a> |
| ... | ... | @@ -135,7 +149,7 @@ |
| 135 | 149 | </li> |
| 136 | 150 | <li class="divider"> </li> |
| 137 | 151 | <li> |
| 138 | - <a href="javascript:;" id="deleteDownStation"><i class="fa fa-close"></i> 删除站点</a> | |
| 152 | + <a href="javascript:;" id="deleteDownStation"><i class="fa fa-close"></i> 撤销站点</a> | |
| 139 | 153 | </li> |
| 140 | 154 | <li class="divider"> </li> |
| 141 | 155 | <li> |
| ... | ... | @@ -160,16 +174,18 @@ |
| 160 | 174 | <div class="col-md-6" style="float: right;"> |
| 161 | 175 | <div class="btn-group" style="float: right;"> |
| 162 | 176 | <div class="actions"> |
| 163 | - <a class="btn green-haze btn-outline btn-circle btn-sm" style="background-color:#3B3F51;border-color:#FFFFFF;color:#FFFFFF" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true" aria-expanded="true"> 工具 | |
| 164 | - <i class="fa fa-angle-down"></i> | |
| 165 | - </a> | |
| 177 | + <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false"> | |
| 178 | + <i class="fa fa-share"></i> | |
| 179 | + <span>下行规划选择</span> | |
| 180 | + <i class="fa fa-angle-down"></i> | |
| 181 | + </a> | |
| 166 | 182 | <ul class="dropdown-menu pull-right" style="min-width:100px"> |
| 167 | 183 | <li> |
| 168 | 184 | <a class="downSystem" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-wrench"></i> 系统规划</a> |
| 169 | 185 | </li> |
| 170 | 186 | <li class="divider"> </li> |
| 171 | 187 | <li> |
| 172 | - <a class="downManual" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-pencil"></i> 手动规划</a> | |
| 188 | + <a class="downManual" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-pencil"></i> 其它方式</a> | |
| 173 | 189 | </li> |
| 174 | 190 | </ul> |
| 175 | 191 | </div> |
| ... | ... | @@ -179,9 +195,9 @@ |
| 179 | 195 | <div class="row" style="margin-top: 10px;"> |
| 180 | 196 | <div class="col-md-12"> |
| 181 | 197 | <!-- 提示 --> |
| 182 | - <div class="alert alert-warning"> | |
| 183 | - <strong>系统未初始化该线路下行站点!</strong> 请从上方工具里选择任意一种方式规划该线路下行站点 | |
| 184 | - </div> | |
| 198 | + <div class="alert alert-warning" style="background-color: #22313F;border-color: #FFFFFF;color: #2ab4c0;"> | |
| 199 | + <strong>系统未初始化该线路下行站点!</strong> 请从上方【下行规划选择】里选择任意一种方式规划该线路下行站点. | |
| 200 | + </div> | |
| 185 | 201 | </div> |
| 186 | 202 | </div> |
| 187 | 203 | </div> | ... | ... |