Commit 13e708ccfd830b068de9817db583edf1bebc66cd

Authored by 潘钊
2 parents 13e8707e efeb96b0

Merge branch 'master' of 192.168.168.201:panzhaov5/bsth_control

Showing 31 changed files with 4055 additions and 774 deletions
src/main/java/com/bsth/controller/SectionRouteController.java
1 package com.bsth.controller; 1 package com.bsth.controller;
2 2
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import org.springframework.beans.factory.annotation.Autowired;
3 import org.springframework.web.bind.annotation.RequestMapping; 7 import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
  9 +import org.springframework.web.bind.annotation.RequestParam;
4 import org.springframework.web.bind.annotation.RestController; 10 import org.springframework.web.bind.annotation.RestController;
5 11
6 import com.bsth.entity.SectionRoute; 12 import com.bsth.entity.SectionRoute;
  13 +import com.bsth.service.SectionRouteService;
7 14
8 /** 15 /**
9 * 16 *
@@ -24,5 +31,13 @@ import com.bsth.entity.SectionRoute; @@ -24,5 +31,13 @@ import com.bsth.entity.SectionRoute;
24 @RestController 31 @RestController
25 @RequestMapping("sectionroute") 32 @RequestMapping("sectionroute")
26 public class SectionRouteController extends BaseController<SectionRoute, Integer> { 33 public class SectionRouteController extends BaseController<SectionRoute, Integer> {
27 - 34 +
  35 + @Autowired
  36 + SectionRouteService routeService;
  37 +
  38 + @RequestMapping(value = "/findSection" , method = RequestMethod.GET)
  39 + public List<Map<String, Object>> findPoints(@RequestParam Map<String, Object> map) {
  40 + return routeService.getSectionRoute(map);
  41 + }
  42 +
28 } 43 }
src/main/java/com/bsth/controller/StationController.java
@@ -54,6 +54,15 @@ public class StationController extends BaseController&lt;Station, Integer&gt; { @@ -54,6 +54,15 @@ public class StationController extends BaseController&lt;Station, Integer&gt; {
54 54
55 } 55 }
56 56
  57 + @RequestMapping(value="stationUpdate" , method = RequestMethod.POST)
  58 + public Map<String, Object> stationUpdate(@RequestParam Map<String, Object> map) {
  59 +
  60 + map.put("updateBy", "");
  61 +
  62 + return service.stationUpdate(map);
  63 +
  64 + }
  65 +
57 @RequestMapping(value="getStationCode" , method = RequestMethod.GET) 66 @RequestMapping(value="getStationCode" , method = RequestMethod.GET)
58 public int getStationCode() { 67 public int getStationCode() {
59 68
src/main/java/com/bsth/controller/StationRouteController.java
@@ -38,7 +38,7 @@ public class StationRouteController extends BaseController&lt;StationRoute, Integer @@ -38,7 +38,7 @@ public class StationRouteController extends BaseController&lt;StationRoute, Integer
38 @Autowired 38 @Autowired
39 StationRouteService service; 39 StationRouteService service;
40 40
41 - @RequestMapping(method = RequestMethod.GET) 41 + /*@RequestMapping(method = RequestMethod.GET)
42 public Page<StationRoute> list(@RequestParam Map<String, Object> map, 42 public Page<StationRoute> list(@RequestParam Map<String, Object> map,
43 @RequestParam(defaultValue = "0") int page, 43 @RequestParam(defaultValue = "0") int page,
44 @RequestParam(defaultValue = "5") int size, 44 @RequestParam(defaultValue = "5") int size,
@@ -53,10 +53,20 @@ public class StationRouteController extends BaseController&lt;StationRoute, Integer @@ -53,10 +53,20 @@ public class StationRouteController extends BaseController&lt;StationRoute, Integer
53 d = Direction.DESC; 53 d = Direction.DESC;
54 54
55 return service.list(map, new PageRequest(page, size, new Sort(d, order))); 55 return service.list(map, new PageRequest(page, size, new Sort(d, order)));
56 - } 56 + }*/
57 57
58 @RequestMapping(value = "/findStations" , method = RequestMethod.GET) 58 @RequestMapping(value = "/findStations" , method = RequestMethod.GET)
59 public List<Map<String, Object>> findPoints(@RequestParam Map<String, Object> map) { 59 public List<Map<String, Object>> findPoints(@RequestParam Map<String, Object> map) {
60 return service.findPoints(map); 60 return service.findPoints(map);
61 } 61 }
  62 +
  63 + @RequestMapping(value = "/systemQuote" , method = RequestMethod.POST)
  64 + public Map<String, Object> systemQuote(@RequestParam Map<String, Object> map) {
  65 + return service.systemQuote(map);
  66 + }
  67 +
  68 + @RequestMapping(value = "/findUpStationRouteCode" , method = RequestMethod.GET)
  69 + public List<Map<String, Object>> findUpStationRouteCode(@RequestParam Map<String, Object> map) {
  70 + return service.findUpStationRouteCode(map);
  71 + }
62 } 72 }
src/main/java/com/bsth/entity/StationRoute.java
@@ -83,6 +83,9 @@ public class StationRoute { @@ -83,6 +83,9 @@ public class StationRoute {
83 // 版本号 83 // 版本号
84 private Integer versions; 84 private Integer versions;
85 85
  86 + // 是否撤销
  87 + private Integer destroy;
  88 +
86 // 描述 89 // 描述
87 private String descriptions; 90 private String descriptions;
88 91
@@ -204,7 +207,7 @@ public class StationRoute { @@ -204,7 +207,7 @@ public class StationRoute {
204 public void setDirections(Integer directions) { 207 public void setDirections(Integer directions) {
205 this.directions = directions; 208 this.directions = directions;
206 } 209 }
207 - 210 +
208 public Integer getVersions() { 211 public Integer getVersions() {
209 return versions; 212 return versions;
210 } 213 }
@@ -212,6 +215,14 @@ public class StationRoute { @@ -212,6 +215,14 @@ public class StationRoute {
212 public void setVersions(Integer versions) { 215 public void setVersions(Integer versions) {
213 this.versions = versions; 216 this.versions = versions;
214 } 217 }
  218 +
  219 + public Integer getDestroy() {
  220 + return destroy;
  221 + }
  222 +
  223 + public void setDestroy(Integer destroy) {
  224 + this.destroy = destroy;
  225 + }
215 226
216 public String getDescriptions() { 227 public String getDescriptions() {
217 return descriptions; 228 return descriptions;
src/main/java/com/bsth/repository/SectionRouteRepository.java
@@ -2,6 +2,7 @@ package com.bsth.repository; @@ -2,6 +2,7 @@ package com.bsth.repository;
2 2
3 import java.util.List; 3 import java.util.List;
4 4
  5 +import org.springframework.data.jpa.repository.Query;
5 import org.springframework.stereotype.Repository; 6 import org.springframework.stereotype.Repository;
6 7
7 import com.bsth.entity.SectionRoute; 8 import com.bsth.entity.SectionRoute;
@@ -25,5 +26,38 @@ import com.bsth.entity.SectionRoute; @@ -25,5 +26,38 @@ import com.bsth.entity.SectionRoute;
25 @Repository 26 @Repository
26 public interface SectionRouteRepository extends BaseRepository<SectionRoute, Integer> { 27 public interface SectionRouteRepository extends BaseRepository<SectionRoute, Integer> {
27 28
  29 + @Query(value ="SELECT a.sectionrouteId," +
  30 + "a.sectionrouteLine," +
  31 + " a.sectionrouteLineCode," +
  32 + " a.sectionrouteSection," +
  33 + " a.sectionrouteSectionCode," +
  34 + " a.sectionrouteCode," +
  35 + " a.sectionrouteDirections," +
  36 + " b.id AS sectionId," +
  37 + " b.section_code AS sectionCode," +
  38 + " b.section_name AS sectionName," +
  39 + " b.croses_road AS sectionRoad," +
  40 + " b.end_node AS sectionEndNode," +
  41 + " b.start_node AS sectionStartNode," +
  42 + " b.middle_node AS sectionMiddleNode," +
  43 + " b.section_type AS sectionType," +
  44 + " b.csection_vector AS sectionCsectionVector," +
  45 + " AsText(b.bsection_vector) AS sectionBsectionVector," +
  46 + " AsText(b.gsection_vector) sectionGsectionVector," +
  47 + " b.road_coding AS sectionRoadCoding," +
  48 + " b.section_distance AS sectionDistance," +
  49 + " b.section_time AS sectionTime," +
  50 + " b.db_type AS sectiondbType," +
  51 + " b.speed_limit AS sectionSpeedLimet FROM (" +
  52 + "SELECT r.id AS sectionrouteId," +
  53 + "r.line AS sectionrouteLine," +
  54 + "r.line_code AS sectionrouteLineCode," +
  55 + "r.section AS sectionrouteSection," +
  56 + "r.section_code AS sectionrouteSectionCode," +
  57 + "r.sectionroute_code AS sectionrouteCode," +
  58 + "r.directions AS sectionrouteDirections" +
  59 + " FROM bsth_c_sectionroute r where r.line = ?1 and r.directions = ?2 ) a " +
  60 + " LEFT JOIN bsth_c_section b ON a.sectionrouteSection = b.id", nativeQuery=true)
  61 + List<Object[]> getSectionRoute(int lineId, int directions);
28 62
29 } 63 }
src/main/java/com/bsth/repository/StationRepository.java
1 package com.bsth.repository; 1 package com.bsth.repository;
2 2
  3 +import java.util.List;
  4 +
3 import org.springframework.data.jpa.repository.Modifying; 5 import org.springframework.data.jpa.repository.Modifying;
4 import org.springframework.data.jpa.repository.Query; 6 import org.springframework.data.jpa.repository.Query;
5 import org.springframework.stereotype.Repository; 7 import org.springframework.stereotype.Repository;
@@ -26,22 +28,24 @@ import com.bsth.entity.Station; @@ -26,22 +28,24 @@ import com.bsth.entity.Station;
26 @Repository 28 @Repository
27 public interface StationRepository extends BaseRepository<Station, Integer> { 29 public interface StationRepository extends BaseRepository<Station, Integer> {
28 30
29 - // CONVERT(substring(astext(BDLONGANDLAT),10,length(astext(BDLONGANDLAT))-11) USING gb2312) as BDLONGANDLAT,  
30 -  
31 // 查询最大ID 31 // 查询最大ID
32 @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_station) k" 32 @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_station) k"
33 , nativeQuery=true) 33 , nativeQuery=true)
34 - public int stationMaxId(); 34 + int stationMaxId();
  35 +
  36 + @Query(value = "SELECT * FROM bsth_c_station s where s.station_name = ?1"
  37 + , nativeQuery=true)
  38 + List<Object[]> findStationName(String stationName);
35 39
36 // 站点保存 40 // 站点保存
37 @Transactional 41 @Transactional
38 @Modifying 42 @Modifying
39 @Query(value="INSERT INTO bsth_c_station (" + 43 @Query(value="INSERT INTO bsth_c_station (" +
40 "station_cod , station_name , road_coding , db_type , b_jwpoints , " + 44 "station_cod , station_name , road_coding , db_type , b_jwpoints , " +
41 - "g_lonx , g_laty , x , y , g_polygon_grid,b_polygon_grid " + 45 + "g_lonx , g_laty , x , y , g_polygon_grid,b_polygon_grid, " +
42 "destroy , radius , shapes_type , versions , descriptions," + 46 "destroy , radius , shapes_type , versions , descriptions," +
43 "create_by,update_by) " + 47 "create_by,update_by) " +
44 - "VALUES(" + 48 + " VALUES(" +
45 "?1 , ?2 , ?3 , ?4 , ?5," + 49 "?1 , ?2 , ?3 , ?4 , ?5," +
46 "?6 , ?7 , ?8 , ?9 , GeomFromText(?10),GeomFromText(?11)," + 50 "?6 , ?7 , ?8 , ?9 , GeomFromText(?10),GeomFromText(?11)," +
47 "?12 ,?13, ?14, ?15, ?16," + 51 "?12 ,?13, ?14, ?15, ?16," +
@@ -51,6 +55,33 @@ public interface StationRepository extends BaseRepository&lt;Station, Integer&gt; { @@ -51,6 +55,33 @@ public interface StationRepository extends BaseRepository&lt;Station, Integer&gt; {
51 Float gLonx, Float gLaty, Float x,Float y, String gPloygonGrid, String bPloygonGrid, 55 Float gLonx, Float gLaty, Float x,Float y, String gPloygonGrid, String bPloygonGrid,
52 56
53 Integer destroy,Integer radius,String shapesType,Integer versions,String descriptions,Integer createBy,Integer updateBy); 57 Integer destroy,Integer radius,String shapesType,Integer versions,String descriptions,Integer createBy,Integer updateBy);
  58 +
  59 + // 站点更新
  60 + @Transactional
  61 + @Modifying
  62 + @Query(value="UPDATE bsth_c_station SET " +
  63 + "station_cod = ?1 , " +
  64 + "station_name = ?2 , " +
  65 + "road_coding = ?3 , " +
  66 + "db_type = ?4 , " +
  67 + "b_jwpoints = ?5 , " +
  68 + "g_lonx = ?6 , " +
  69 + "g_laty = ?7 , " +
  70 + "x = ?8 , " +
  71 + "y = ?9 , " +
  72 + "b_polygon_grid = GeomFromText(?10) , " +
  73 + "g_polygon_grid = GeomFromText(?11) , " +
  74 + "destroy = ?12 , " +
  75 + "radius = ?13 , " +
  76 + "shapes_type = ?14 , " +
  77 + "versions = ?15 , " +
  78 + "descriptions = ?16 " +
  79 + " WHERE id = ?17 ", nativeQuery=true)
  80 + public void stationUpdate(String stationCod,String stationName,String roadCoding,String dbType,String bJwpoints,
  81 +
  82 + String gLonx,String gLaty,Float x,Float y, String bPolygonGrid,String gPolygonGrid,
  83 +
  84 + Integer destroy, Integer radius,String shapesType, Integer versions,String descriptions,Integer stationId);
54 85
55 86
56 } 87 }
src/main/java/com/bsth/repository/StationRouteRepository.java
@@ -26,43 +26,61 @@ import com.bsth.entity.StationRoute; @@ -26,43 +26,61 @@ import com.bsth.entity.StationRoute;
26 @Repository 26 @Repository
27 public interface StationRouteRepository extends BaseRepository<StationRoute, Integer> { 27 public interface StationRouteRepository extends BaseRepository<StationRoute, Integer> {
28 28
29 - @Query(value = "SELECT a.id,"+  
30 - "a.line,"+  
31 - "a.station,"+  
32 - "a.station_name,"+  
33 - "a.station_route_code,"+  
34 - "a.line_code,"+  
35 - "a.station_code,"+  
36 - "a.station_mark,"+  
37 - "b.b_jwpoints as 'station.b_jwpoints' ,"+  
38 - "b.g_laty AS 'station.g_laty',"+  
39 - "b.g_lonx AS 'station.g_lonx',"+  
40 - "b.g_polygon_grid AS 'station.g_polygon_grid',"+  
41 - "b.radius AS 'station.radius',"+  
42 - "b.shapes_type AS 'station.shapes_type',"+  
43 - "b.destroy AS 'station.destroy',"+  
44 - "b.versions AS 'station.versions' FROM ("+  
45 - "SELECT "+  
46 - "r.id,"+  
47 - "r.line,"+  
48 - "r.station,"+  
49 - "r.station_name,"+  
50 - "r.station_route_code,"+  
51 - "r.line_code,"+  
52 - "r.station_code,"+  
53 - "r.station_mark,"+  
54 - "r.directions,"+  
55 - "r.distances,"+  
56 - "r.to_time," +  
57 - "r.end_time," +  
58 - "r.descriptions,"+  
59 - "r.create_by,"+  
60 - "r.create_date,"+  
61 - "r.update_by,"+  
62 - "r.first_time,"+  
63 - "r.versions,"+  
64 - "r.out_station_nmber,"+  
65 - "r.update_date FROM bsth_c_stationroute r where r.line = ?1 and r.directions = ?2) a"+  
66 - " LEFT JOIN bsth_c_station b on a.station=b.id", nativeQuery=true) 29 + @Query(value = "SELECT a.`stationRoute.id`," +
  30 + "a.`stationRoute.line`," +
  31 + "a.`stationRoute.station`," +
  32 + "a.`stationRoute.stationName`," +
  33 + "a.`stationRoute.stationRouteCode`," +
  34 + "a.`stationRoute.lineCode`," +
  35 + "a.`stationRoute.stationMark`," +
  36 + "a.`stationRoute.outStationNmber`," +
  37 + "a.`stationRoute.directions`," +
  38 + "a.`stationRoute.distances`," +
  39 + "a.`stationRoute.toTime`," +
  40 + "a.`stationRoute.firstTime`," +
  41 + "a.`stationRoute.endTime`," +
  42 + "a.`stationRoute.descriptions`," +
  43 + "a.`stationRoute.versions`," +
  44 + "b.id AS 'station.id'," +
  45 + "b.station_cod AS 'station.stationCod'," +
  46 + "b.station_name AS 'station.stationName'," +
  47 + "b.road_coding AS 'station.roadCoding'," +
  48 + "b.db_type AS 'station.dbType'," +
  49 + "b.b_jwpoints AS 'station.bJwpoints'," +
  50 + "b.g_lonx AS 'station.gLonx'," +
  51 + "b.g_lonx AS 'station.gLaty'," +
  52 + "b.x AS 'station.x'," +
  53 + "b.y AS 'station.y'," +
  54 + "b.shapes_type AS 'station.shapesType'," +
  55 + "b.radius AS 'station.radius'," +
  56 + "AsText(b.g_polygon_grid) AS 'station.gPolygonGrid'," +
  57 + "AsText(b.b_polygon_grid) AS 'station.bPolygonGrid'," +
  58 + "b.destroy AS 'station.destroy'," +
  59 + "b.versions AS 'station.versions'," +
  60 + "b.descriptions AS 'station.descriptions' FROM (" +
  61 + "SELECT r.id AS 'stationRoute.id'," +
  62 + " r.line AS 'stationRoute.line'," +
  63 + "r.station AS 'stationRoute.station'," +
  64 + "r.station_name AS 'stationRoute.stationName'," +
  65 + "r.station_route_code as 'stationRoute.stationRouteCode'," +
  66 + "r.line_code AS 'stationRoute.lineCode'," +
  67 + "r.station_mark AS 'stationRoute.stationMark'," +
  68 + "r.out_station_nmber AS 'stationRoute.outStationNmber'," +
  69 + "r.directions AS 'stationRoute.directions'," +
  70 + "r.distances AS 'stationRoute.distances'," +
  71 + "r.to_time AS 'stationRoute.toTime'," +
  72 + "r.first_time AS 'stationRoute.firstTime'," +
  73 + "r.end_time AS 'stationRoute.endTime'," +
  74 + "r.descriptions AS 'stationRoute.descriptions'," +
  75 + "r.versions AS 'stationRoute.versions' FROM bsth_c_stationroute r WHERE r.line = ?1 and r.directions = ?2) a " +
  76 + "LEFT JOIN bsth_c_station b " +
  77 + "ON a.`stationRoute.station` = b.id ORDER BY a.`stationRoute.stationRouteCode` ASC", nativeQuery=true)
67 List<Object[]> findPoints(int line,int directions); 78 List<Object[]> findPoints(int line,int directions);
  79 +
  80 +
  81 + @Query(value = "select t.station_route_code,t.station_mark from bsth_c_stationroute t where " +
  82 + " t.station_route_code =(" +
  83 + "select MAX(station_route_code) as stationRouteCode from bsth_c_stationroute r WHERE " +
  84 + "r.line=?1 and r.directions =?2 and station_route_code< ?3 ) and t.line=?1 and t.directions = ?2", nativeQuery=true)
  85 + List<Object[]> findUpStationRouteCode(Integer lineId,Integer direction,Integer stationRouteCode);
68 } 86 }
src/main/java/com/bsth/service/SectionRouteService.java
1 package com.bsth.service; 1 package com.bsth.service;
2 2
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
3 import com.bsth.entity.SectionRoute; 6 import com.bsth.entity.SectionRoute;
4 7
5 /** 8 /**
@@ -18,5 +21,6 @@ import com.bsth.entity.SectionRoute; @@ -18,5 +21,6 @@ import com.bsth.entity.SectionRoute;
18 * 21 *
19 */ 22 */
20 public interface SectionRouteService extends BaseService<SectionRoute, Integer> { 23 public interface SectionRouteService extends BaseService<SectionRoute, Integer> {
21 - 24 +
  25 + List<Map<String, Object>> getSectionRoute(Map<String, Object> map);
22 } 26 }
src/main/java/com/bsth/service/StationRouteService.java
@@ -23,4 +23,8 @@ import com.bsth.entity.StationRoute; @@ -23,4 +23,8 @@ import com.bsth.entity.StationRoute;
23 public interface StationRouteService extends BaseService<StationRoute, Integer> { 23 public interface StationRouteService extends BaseService<StationRoute, Integer> {
24 24
25 List<Map<String, Object>> findPoints(Map<String, Object> map); 25 List<Map<String, Object>> findPoints(Map<String, Object> map);
  26 +
  27 + Map<String, Object> systemQuote(Map<String, Object> map);
  28 +
  29 + List<Map<String, Object>> findUpStationRouteCode(Map<String, Object> map);
26 } 30 }
src/main/java/com/bsth/service/StationService.java
@@ -27,4 +27,6 @@ public interface StationService extends BaseService&lt;Station, Integer&gt; { @@ -27,4 +27,6 @@ public interface StationService extends BaseService&lt;Station, Integer&gt; {
27 27
28 Map<String, Object> stationSaveMap(Map<String, Object> map); 28 Map<String, Object> stationSaveMap(Map<String, Object> map);
29 29
  30 + Map<String, Object> stationUpdate(Map<String, Object> map);
  31 +
30 } 32 }
src/main/java/com/bsth/service/impl/SectionRouteServiceImpl.java
1 package com.bsth.service.impl; 1 package com.bsth.service.impl;
2 2
  3 +import java.util.ArrayList;
  4 +import java.util.HashMap;
  5 +import java.util.List;
  6 +import java.util.Map;
  7 +
  8 +import org.springframework.beans.factory.annotation.Autowired;
3 import org.springframework.stereotype.Service; 9 import org.springframework.stereotype.Service;
4 10
5 import com.bsth.entity.SectionRoute; 11 import com.bsth.entity.SectionRoute;
  12 +import com.bsth.repository.SectionRouteRepository;
6 import com.bsth.service.SectionRouteService; 13 import com.bsth.service.SectionRouteService;
7 14
8 /** 15 /**
@@ -23,5 +30,57 @@ import com.bsth.service.SectionRouteService; @@ -23,5 +30,57 @@ import com.bsth.service.SectionRouteService;
23 30
24 @Service 31 @Service
25 public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integer> implements SectionRouteService{ 32 public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integer> implements SectionRouteService{
  33 +
  34 + @Autowired
  35 + SectionRouteRepository repository;
  36 +
  37 + @Override
  38 + public List<Map<String, Object>> getSectionRoute(Map<String, Object> map) {
  39 +
  40 + int lineId = map.get("line.id_eq").equals("") ? 0 : Integer.parseInt(map.get("line.id_eq").toString());
  41 +
  42 + int directions = map.get("directions_eq").equals("") ? 0 : Integer.parseInt(map.get("directions_eq").toString());
  43 +
  44 + List<Object[]> listObjArray = repository.getSectionRoute(lineId, directions);
  45 +
  46 + List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
  47 +
  48 + if(listObjArray.size()>0) {
  49 +
  50 + for(int i = 0 ; i<listObjArray.size() ; i++){
  51 +
  52 + Map<String, Object> tempM = new HashMap<String, Object>();
  53 +
  54 + tempM.put("sectionrouteId",listObjArray.get(i)[0]);
  55 + tempM.put("sectionrouteLine",listObjArray.get(i)[1]);
  56 + tempM.put("sectionrouteLineCode",listObjArray.get(i)[2]);
  57 + tempM.put("sectionrouteSection",listObjArray.get(i)[3]);
  58 + tempM.put("sectionrouteSectionCode",listObjArray.get(i)[4]);
  59 + tempM.put("sectionrouteCode",listObjArray.get(i)[5]);
  60 + tempM.put("sectionrouteDirections",listObjArray.get(i)[6]);
  61 + tempM.put("sectionId",listObjArray.get(i)[7]);
  62 + tempM.put("sectionCode",listObjArray.get(i)[8]);
  63 + tempM.put("sectionName",listObjArray.get(i)[9]);
  64 + tempM.put("sectionCrosesRoad",listObjArray.get(i)[10]);
  65 + tempM.put("sectionEndNode",listObjArray.get(i)[11]);
  66 + tempM.put("sectionStartNode",listObjArray.get(i)[12]);
  67 + tempM.put("sectionMiddleNode",listObjArray.get(i)[13]);
  68 + tempM.put("sectionType",listObjArray.get(i)[14]);
  69 + tempM.put("sectionCsectionVector",listObjArray.get(i)[15]);
  70 + tempM.put("sectionBsectionVector",listObjArray.get(i)[16]);
  71 + tempM.put("sectionGsectionVector",listObjArray.get(i)[17]);
  72 + tempM.put("sectionRoadCoding",listObjArray.get(i)[18]);
  73 + tempM.put("sectionDistance",listObjArray.get(i)[19]);
  74 + tempM.put("sectionTime",listObjArray.get(i)[20]);
  75 + tempM.put("sectiondbType",listObjArray.get(i)[21]);
  76 + tempM.put("sectionSpeedLimet",listObjArray.get(i)[22]);
  77 + resultList.add(tempM);
  78 +
  79 + }
  80 +
  81 + }
  82 +
  83 + return resultList;
  84 + }
26 85
27 } 86 }
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
@@ -8,7 +8,15 @@ import java.util.Map; @@ -8,7 +8,15 @@ import java.util.Map;
8 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.stereotype.Service; 9 import org.springframework.stereotype.Service;
10 10
  11 +import antlr.collections.impl.LList;
  12 +
  13 +import com.bsth.common.ResponseCode;
  14 +import com.bsth.entity.Line;
  15 +import com.bsth.entity.Station;
11 import com.bsth.entity.StationRoute; 16 import com.bsth.entity.StationRoute;
  17 +import com.bsth.repository.LineRepository;
  18 +import com.bsth.repository.SectionRouteRepository;
  19 +import com.bsth.repository.StationRepository;
12 import com.bsth.repository.StationRouteRepository; 20 import com.bsth.repository.StationRouteRepository;
13 import com.bsth.service.StationRouteService; 21 import com.bsth.service.StationRouteService;
14 22
@@ -34,6 +42,15 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -34,6 +42,15 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
34 @Autowired 42 @Autowired
35 private StationRouteRepository repository; 43 private StationRouteRepository repository;
36 44
  45 + @Autowired
  46 + private SectionRouteRepository routeRepository;
  47 +
  48 + @Autowired
  49 + private LineRepository lineRepository;
  50 +
  51 + @Autowired
  52 + private StationRepository stationRepository;
  53 +
37 @Override 54 @Override
38 public List<Map<String, Object>> findPoints(Map<String, Object> map) { 55 public List<Map<String, Object>> findPoints(Map<String, Object> map) {
39 56
@@ -45,82 +62,288 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -45,82 +62,288 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
45 62
46 int directions= Integer.parseInt(directionsStr); 63 int directions= Integer.parseInt(directionsStr);
47 64
48 - List<Object[]> list = repository.findPoints(line, directions);  
49 -  
50 - List<Map<String,Object>> resultList = new ArrayList<Map<String,Object>>();  
51 -  
52 - List<Map<String, Object>> children = new ArrayList<Map<String,Object>>();  
53 -  
54 - Map<String, Object> listMap = new HashMap<String,Object>(); 65 + List<Object[]> stationList = repository.findPoints(line, directions);
55 66
56 - listMap.put("container", "pjax-container"); 67 + List<Object[]> sectionList = routeRepository.getSectionRoute(line, directions);
57 68
58 - listMap.put("enable", true);  
59 69
60 - listMap.put("groupType", "1"); 70 + List<Map<String, Object>> resultList= new ArrayList<Map<String, Object>>();
  71 + Map<String, Object> resultMap = new HashMap<String, Object>();
61 72
62 - listMap.put("icon", ""); 73 + List<Map<String, Object>> childrenTwo = new ArrayList<Map<String, Object>>();
  74 + Map<String, Object> childrenStationMap = new HashMap<String, Object>();
63 75
64 - listMap.put("id", 100);  
65 76
66 - listMap.put("pId", null); 77 + List<Map<String, Object>> staitonChildren= new ArrayList<Map<String, Object>>();
67 78
68 - listMap.put("name", "途径站点");  
69 -  
70 - listMap.put("text", "途径站点");  
71 -  
72 -  
73 -  
74 - if(list.size()>0) { 79 + if(stationList.size()>0) {
75 80
76 - for(int i = 0 ; i < list.size(); i++) { 81 + for(int i = 0 ; i < stationList.size(); i++) {
77 82
78 Map<String, Object> tempM = new HashMap<String, Object>(); 83 Map<String, Object> tempM = new HashMap<String, Object>();
79 84
80 - tempM.put("id", list.get(i)[0]); 85 + // stationRoute.id
  86 + tempM.put("stationRouteId", stationList.get(i)[0]);
  87 +
  88 + // stationRoute.line
  89 + tempM.put("stationRouteLine", stationList.get(i)[1]);
  90 +
  91 + // stationRoute.station
  92 + tempM.put("stationRouteStation", stationList.get(i)[2]);
  93 +
  94 + // stationRoute.stationName
  95 + tempM.put("stationRouteStationName", stationList.get(i)[3]);
  96 +
  97 + // stationRoute.stationRouteCode
  98 + tempM.put("stationRouteStationRouteCode", stationList.get(i)[4]);
  99 +
  100 + // stationRoute.lineCode
  101 + tempM.put("stationRouteLineCode", stationList.get(i)[5]);
  102 +
  103 + // stationRoute.stationMark
  104 + tempM.put("stationRouteStationMark", stationList.get(i)[6]);
  105 +
  106 + // stationRoute.outStationNmber
  107 + tempM.put("stationRouteOutStationNmber", stationList.get(i)[7]);
  108 +
  109 + // stationRoute.directions
  110 + tempM.put("stationRouteDirections", stationList.get(i)[8]);
  111 +
  112 + // stationRoute.distances
  113 + tempM.put("stationRouteDistances", stationList.get(i)[9]);
81 114
82 - //tempM.put("id", 2); 115 + // stationRoute.toTime
  116 + tempM.put("stationRouteToTime", stationList.get(i)[10]);
83 117
84 - tempM.put("line", list.get(i)[1]); 118 + // stationRoute.firstTime
  119 + tempM.put("stationRouteFirstTime", stationList.get(i)[11]);
85 120
86 - tempM.put("station", list.get(i)[2]); 121 + // stationRoute.endTime
  122 + tempM.put("stationRouteEndTime", stationList.get(i)[12]);
87 123
88 - tempM.put("station_name", list.get(i)[3]); 124 + // stationRoute.descriptions
  125 + tempM.put("stationRouteDescriptions", stationList.get(i)[13]);
89 126
90 - tempM.put("name", list.get(i)[3]); 127 + // stationRoute.versions
  128 + tempM.put("stationRouteVersions", stationList.get(i)[14]);
91 129
92 - tempM.put("text", list.get(i)[3]); 130 + // station.id
  131 + tempM.put("stationId", stationList.get(i)[15]);
93 132
94 - tempM.put("station_route_code", list.get(i)[4]); 133 + // station.stationCod
  134 + tempM.put("stationStationCod", stationList.get(i)[16]);
95 135
96 - tempM.put("station_mark", list.get(i)[7]); 136 + // station.stationName
  137 + tempM.put("stationStationName", stationList.get(i)[17]);
97 138
98 - tempM.put("b_jwpoints", list.get(i)[8]); 139 + // station.roadCoding
  140 + tempM.put("stationRoadCoding", stationList.get(i)[18]);
99 141
100 - tempM.put("g_polygon_grid", list.get(i)[11]); 142 + // station.dbType
  143 + tempM.put("stationDbType", stationList.get(i)[19]);
101 144
102 - tempM.put("radius", list.get(i)[12]); 145 + // station.bJwpoints
  146 + tempM.put("stationBJwpoints", stationList.get(i)[20]);
103 147
104 - tempM.put("shapes_type", list.get(i)[13]); 148 + // station.gLonx
  149 + tempM.put("stationGLonx", stationList.get(i)[21]);
105 150
  151 + // station.gLaty
  152 + tempM.put("stationGLaty", stationList.get(i)[22]);
  153 +
  154 + // station.x
  155 + tempM.put("stationx", stationList.get(i)[23]);
  156 +
  157 + // station.y
  158 + tempM.put("stationy", stationList.get(i)[24]);
  159 +
  160 + // station.shapesType
  161 + tempM.put("stationShapesType", stationList.get(i)[25]);
  162 +
  163 + // station.radius
  164 + tempM.put("stationRadius", stationList.get(i)[26]);
  165 +
  166 + // station.gPolygonGrid
  167 + tempM.put("stationGPolygonGrid", stationList.get(i)[27]);
  168 +
  169 + // station.bPolygonGrid
  170 + tempM.put("stationBPolygonGrid", stationList.get(i)[28]);
  171 +
  172 + // station.destroy
  173 + tempM.put("stationDestroy", stationList.get(i)[29]);
  174 +
  175 + // station.versions
  176 + tempM.put("stationVersions", stationList.get(i)[30]);
  177 +
  178 + // station.descriptions
  179 + tempM.put("stationDescriptions", stationList.get(i)[31]);
  180 +
  181 + tempM.put("name", stationList.get(i)[17]);
  182 +
  183 + tempM.put("text", stationList.get(i)[17]);
  184 +
106 tempM.put("icon", "fa fa-bus"); 185 tempM.put("icon", "fa fa-bus");
107 186
108 - tempM.put("pId", 100); 187 + tempM.put("pId", 200);
  188 +
  189 + tempM.put("id", i+1);
  190 +
  191 + tempM.put("groupType", "3");
109 192
110 - tempM.put("groupType", "2"); 193 + tempM.put("chaildredType", "station");
111 194
112 tempM.put("enable", true); 195 tempM.put("enable", true);
113 196
114 - children.add(tempM); 197 + staitonChildren.add(tempM);
115 } 198 }
  199 + }
  200 +
  201 +
  202 + List<Map<String, Object>> sectionChildren = new ArrayList<Map<String, Object>>();
  203 +
  204 + if(sectionList.size()>0) {
116 205
  206 + for(int i = 0 ; i<sectionList.size() ; i++){
  207 +
  208 + Map<String, Object> tempM = new HashMap<String, Object>();
  209 + tempM.put("sectionrouteId",sectionList.get(i)[0]);
  210 + tempM.put("sectionrouteLine",sectionList.get(i)[1]);
  211 + tempM.put("sectionrouteLineCode",sectionList.get(i)[2]);
  212 + tempM.put("sectionrouteSection",sectionList.get(i)[3]);
  213 + tempM.put("sectionrouteSectionCode",sectionList.get(i)[4]);
  214 + tempM.put("sectionrouteCode",sectionList.get(i)[5]);
  215 + tempM.put("sectionrouteDirections",sectionList.get(i)[6]);
  216 + tempM.put("sectionId",sectionList.get(i)[7]);
  217 + tempM.put("sectionCode",sectionList.get(i)[8]);
  218 + tempM.put("sectionName",sectionList.get(i)[9]);
  219 + tempM.put("sectionCrosesRoad",sectionList.get(i)[10]);
  220 + tempM.put("sectionEndNode",sectionList.get(i)[11]);
  221 + tempM.put("sectionStartNode",sectionList.get(i)[12]);
  222 + tempM.put("sectionMiddleNode",sectionList.get(i)[13]);
  223 + tempM.put("sectionType",sectionList.get(i)[14]);
  224 + tempM.put("sectionCsectionVector",sectionList.get(i)[15]);
  225 + tempM.put("sectionBsectionVector",sectionList.get(i)[16]);
  226 + tempM.put("sectionGsectionVector",sectionList.get(i)[17]);
  227 + tempM.put("sectionRoadCoding",sectionList.get(i)[18]);
  228 + tempM.put("sectionDistance",sectionList.get(i)[19]);
  229 + tempM.put("sectionTime",sectionList.get(i)[20]);
  230 + tempM.put("sectiondbType",sectionList.get(i)[21]);
  231 + tempM.put("sectionSpeedLimet",sectionList.get(i)[22]);
  232 + tempM.put("name", sectionList.get(i)[9]);
  233 +
  234 + tempM.put("text", sectionList.get(i)[9]);
  235 +
  236 + tempM.put("icon", null);
  237 +
  238 + tempM.put("pId", 300);
  239 +
  240 + tempM.put("id", (i+1)*1000);
  241 +
  242 + tempM.put("groupType", "3");
  243 + tempM.put("chaildredType", "section");
  244 + tempM.put("enable", true);
  245 + sectionChildren.add(tempM);
  246 +
  247 + }
117 } 248 }
118 249
119 - listMap.put("children", children); 250 + childrenStationMap.put("children", staitonChildren);
  251 + childrenStationMap.put("container", "pjax-container");
  252 + childrenStationMap.put("enable", true);
  253 + childrenStationMap.put("groupType", "2");
  254 + childrenStationMap.put("chaildredType", null);
  255 +
  256 + childrenStationMap.put("icon", null);
  257 + childrenStationMap.put("id", 200);
  258 + childrenStationMap.put("name", "站点");
  259 + childrenStationMap.put("pId", 100);
  260 + childrenStationMap.put("text", "站点");
  261 + childrenTwo.add(childrenStationMap);
  262 +
  263 + Map<String, Object> childrenSectionMap = new HashMap<String, Object>();
  264 + childrenSectionMap.put("children", sectionChildren);
  265 + childrenSectionMap.put("container", "pjax-container");
  266 + childrenSectionMap.put("enable", true);
  267 + childrenSectionMap.put("groupType", "2");
  268 + childrenSectionMap.put("chaildredType", null);
  269 + childrenSectionMap.put("icon", null);
  270 + childrenSectionMap.put("id", 300);
  271 + childrenSectionMap.put("name", "路段");
  272 + childrenSectionMap.put("pId", 100);
  273 + childrenSectionMap.put("text", "路段");
  274 + childrenTwo.add(childrenSectionMap);
  275 +
  276 + resultMap.put("children", childrenTwo);
  277 + resultMap.put("container", "pjax-container");
  278 + resultMap.put("enable", true);
  279 + resultMap.put("groupType", "1");
  280 + resultMap.put("chaildredType", null);
  281 + resultMap.put("icon", null);
  282 + resultMap.put("id", 100);
  283 + resultMap.put("name", "站点与路段");
  284 + resultMap.put("pId", null);
  285 + resultMap.put("text", "站点与路段");
  286 + resultList.add(resultMap);
120 287
121 - resultList.add(listMap);  
122 288
123 return resultList; 289 return resultList;
124 } 290 }
125 291
  292 + @Override
  293 + public Map<String, Object> systemQuote(Map<String, Object> map) {
  294 + Map<String, Object> resultmap = new HashMap<>();
  295 + try{
  296 +
  297 + StationRoute route = new StationRoute();
  298 +
  299 + Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString());
  300 +
  301 + Integer stationId = map.get("stationId").equals("") ? null : Integer.parseInt(map.get("stationId").toString());
  302 +
  303 + Line line = lineRepository.findOne(lineId);
  304 +
  305 + Station station = stationRepository.findOne(stationId);
  306 +
  307 + route.setLine(line);
  308 +
  309 + route.setStation(station);
  310 +
  311 + //baseRepository.save(t);
  312 + resultmap.put("status", ResponseCode.SUCCESS);
  313 + }catch(Exception e){
  314 + resultmap.put("status", ResponseCode.ERROR);
  315 + logger.error("save erro.", e);
  316 + }
  317 + return resultmap;
  318 + }
  319 +
  320 + @Override
  321 + public List<Map<String, Object>> findUpStationRouteCode(Map<String, Object> map) {
  322 +
  323 + Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString());
  324 +
  325 + Integer direction = map.get("direction").equals("") ? null : Integer.parseInt(map.get("direction").toString());
  326 +
  327 + Integer stationRouteCode = map.get("stationRouteCode").equals("") ? null : Integer.parseInt(map.get("stationRouteCode").toString());
  328 +
  329 + List<Object[]> reslutList = repository.findUpStationRouteCode(lineId, direction, stationRouteCode);
  330 +
  331 + List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
  332 +
  333 + if(reslutList.size()>0) {
  334 +
  335 + for(int i = 0 ; i <reslutList.size() ;i++){
  336 + Map<String, Object> tempM = new HashMap<String, Object>();
  337 + tempM.put("stationRouteCode", reslutList.get(i)[0]);
  338 + tempM.put("stationRouteMarke", reslutList.get(i)[1]);
  339 +
  340 + list.add(tempM);
  341 +
  342 + }
  343 +
  344 + }
  345 +
  346 + return list;
  347 + }
  348 +
126 } 349 }
src/main/java/com/bsth/service/impl/StationServiceImpl.java
1 package com.bsth.service.impl; 1 package com.bsth.service.impl;
2 2
  3 +import java.math.BigDecimal;
3 import java.util.ArrayList; 4 import java.util.ArrayList;
4 import java.util.HashMap; 5 import java.util.HashMap;
5 import java.util.List; 6 import java.util.List;
6 import java.util.Map; 7 import java.util.Map;
7 8
8 -import javax.persistence.criteria.CriteriaBuilder.In;  
9 -  
10 import org.slf4j.Logger; 9 import org.slf4j.Logger;
11 import org.slf4j.LoggerFactory; 10 import org.slf4j.LoggerFactory;
12 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
@@ -105,50 +104,28 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -105,50 +104,28 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
105 104
106 if(stationsArray.size()>0) { 105 if(stationsArray.size()>0) {
107 106
108 - // 站点信息  
109 - List<Station> paramStationList = new ArrayList<Station>();  
110 -  
111 - // 站点路由信息  
112 - List<StationRoute> paramStationRouteList = new ArrayList<StationRoute>();  
113 -  
114 - // 查询最大站点ID  
115 - int stationMaxId = repository.stationMaxId();  
116 -  
117 for(int i = 0;i <stationsArray.size();i++) { 107 for(int i = 0;i <stationsArray.size();i++) {
118 108
119 - // 初始化站点对象  
120 - Station arg0 = new Station();  
121 -  
122 // 站点名称 109 // 站点名称
123 String stationName = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("name").toString(); 110 String stationName = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("name").toString();
124 - arg0.setStationName(stationName);  
125 111
126 - arg0.setDbType(dbType); 112 + Double distance = stationsArray.getJSONObject(i).get("distance").equals("") ? 0 : Double.parseDouble(stationsArray.getJSONObject(i).get("distance").toString());
127 113
128 - // 站点地理位置WGS坐标经度  
129 - String gLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lng").toString();  
130 - arg0.setgLonx(Float.parseFloat(gLonx)); 114 + // 转成公里
  115 + distance = distance/1000;
131 116
132 - // 站点地理位置WGS坐标纬度  
133 - String gLaty = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lat").toString();  
134 - arg0.setgLaty(Float.parseFloat(gLaty)); 117 + BigDecimal d = new BigDecimal(distance);
135 118
136 - // 半径  
137 - int radius = map.get("radius").equals("") ? 0 : Integer.parseInt(map.get("radius").toString());  
138 - arg0.setRadius(radius); 119 + distance = d.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
139 120
140 - // 图形类型  
141 - String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString();  
142 - arg0.setShapesType(shapesType); 121 + Double duration = stationsArray.getJSONObject(i).get("duration").equals("") ? 0 : Double.parseDouble(stationsArray.getJSONObject(i).get("duration").toString());
143 122
144 - // 站点编码  
145 - arg0.setStationCod(String.valueOf(stationMaxId+1+i)); 123 + // 转成分钟
  124 + duration = duration/60;
146 125
147 - // 是否想撤销  
148 - arg0.setDestroy(destroy); 126 + BigDecimal t = new BigDecimal(duration);
149 127
150 - // 版本号  
151 - arg0.setVersions(versions); 128 + duration = t.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
152 129
153 // 百度经纬度坐标 130 // 百度经纬度坐标
154 String bJwpoints = ""; 131 String bJwpoints = "";
@@ -161,9 +138,65 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -161,9 +138,65 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
161 138
162 // 百度经纬度 139 // 百度经纬度
163 bJwpoints = bLonx + " " + bLatx; 140 bJwpoints = bLonx + " " + bLatx;
164 - arg0.setbJwpoints(bJwpoints);  
165 141
166 - paramStationList.add(arg0); 142 + List<Object[]> stationNameList = repository.findStationName(stationName);
  143 +
  144 + boolean isHave = isHaveStationname(bJwpoints,stationNameList);
  145 +
  146 + // 初始化站点对象
  147 + Station arg0 = new Station();
  148 +
  149 + // 站点编码
  150 + int stationCode = 0;
  151 +
  152 + if(isHave) {
  153 +
  154 + Integer stationId = Integer.parseInt(stationNameList.get(0)[1].toString());
  155 +
  156 + arg0 = repository.findOne(stationId);
  157 +
  158 + stationCode = Integer.parseInt(arg0.getStationCod());
  159 +
  160 + }else {
  161 +
  162 + stationCode = repository.stationMaxId();
  163 +
  164 + arg0.setStationName(stationName);
  165 +
  166 + // 原坐标类型
  167 + arg0.setDbType(dbType);
  168 +
  169 + // 站点地理位置WGS坐标经度
  170 + String gLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lng").toString();
  171 + arg0.setgLonx(Float.parseFloat(gLonx));
  172 +
  173 + // 站点地理位置WGS坐标纬度
  174 + String gLaty = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lat").toString();
  175 + arg0.setgLaty(Float.parseFloat(gLaty));
  176 +
  177 + // 半径
  178 + int radius = map.get("radius").equals("") ? 0 : Integer.parseInt(map.get("radius").toString());
  179 + arg0.setRadius(radius);
  180 +
  181 + // 图形类型
  182 + String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString();
  183 + arg0.setShapesType(shapesType);
  184 +
  185 + // 站点编码
  186 + arg0.setStationCod(String.valueOf(stationCode+1));
  187 +
  188 + // 是否想撤销
  189 + arg0.setDestroy(destroy);
  190 +
  191 + // 版本号
  192 + arg0.setVersions(versions);
  193 +
  194 + arg0.setbJwpoints(bJwpoints);
  195 +
  196 + // 插入站点信息
  197 + repository.save(arg0);
  198 +
  199 + }
167 200
168 // 站点路由对象 201 // 站点路由对象
169 StationRoute route = new StationRoute(); 202 StationRoute route = new StationRoute();
@@ -171,11 +204,16 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -171,11 +204,16 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
171 // 站点名称 204 // 站点名称
172 route.setStationName(stationName); 205 route.setStationName(stationName);
173 206
  207 + route.setDistances(distance);
  208 +
  209 + route.setToTime(duration);
  210 +
  211 +
174 // 站点编码 212 // 站点编码
175 - route.setStationCode(String.valueOf(stationMaxId+1+i)); 213 + route.setStationCode(arg0.getStationCod());
176 214
177 // 站点序号 215 // 站点序号
178 - route.setStationRouteCode(i+1); 216 + route.setStationRouteCode((i+1)*10);
179 217
180 // 站点类型 218 // 站点类型
181 if(i==0) { 219 if(i==0) {
@@ -210,15 +248,12 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -210,15 +248,12 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
210 // 线路编码 248 // 线路编码
211 route.setLineCode(resultLine.getLineCode()); 249 route.setLineCode(resultLine.getLineCode());
212 250
213 - paramStationRouteList.add(route); 251 +
  252 + // 插入站点路由信息
  253 + routeRepository.save(route);
214 254
215 } 255 }
216 256
217 - // 插入站点信息  
218 - repository.save(paramStationList);  
219 -  
220 - // 插入站点路由信息  
221 - routeRepository.save(paramStationRouteList);  
222 } 257 }
223 258
224 } 259 }
@@ -267,8 +302,20 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -267,8 +302,20 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
267 302
268 String sectionCode = String.valueOf(sectionMaxId+1); 303 String sectionCode = String.valueOf(sectionMaxId+1);
269 304
  305 + String upOrDownStr = "";
  306 +
  307 + if(directions==0){
  308 +
  309 + upOrDownStr = "上行路段";
  310 +
  311 + }else if(directions==1){
  312 +
  313 + upOrDownStr = "下行路段";
  314 +
  315 + }
  316 +
270 // 路段名称 317 // 路段名称
271 - String sectionName = resultLine.getName(); 318 + String sectionName = resultLine.getName()+upOrDownStr;
272 319
273 // 交出路 320 // 交出路
274 String crosesRoad = ""; 321 String crosesRoad = "";
@@ -309,6 +356,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -309,6 +356,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
309 // 说明 356 // 说明
310 String descriptions = ""; 357 String descriptions = "";
311 358
  359 +
312 sectionRepository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, 360 sectionRepository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode,
313 361
314 middleNode, gsectionVector, bsectionVector, sectionType, csectionVector, 362 middleNode, gsectionVector, bsectionVector, sectionType, csectionVector,
@@ -316,6 +364,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -316,6 +364,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
316 roadCoding, sectionDistance, sectionTime, dbType, speedLimit, 364 roadCoding, sectionDistance, sectionTime, dbType, speedLimit,
317 365
318 descriptions, versions); 366 descriptions, versions);
  367 +
319 368
320 369
321 Section section = sectionRepository.findOne(Integer.parseInt(sectionCode)); 370 Section section = sectionRepository.findOne(Integer.parseInt(sectionCode));
@@ -336,7 +385,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -336,7 +385,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
336 sectionRoute.setLine(resultLine); 385 sectionRoute.setLine(resultLine);
337 386
338 // 路段编码 387 // 路段编码
339 - sectionRoute.setSectionCode(section.getSectionCode()); 388 + sectionRoute.setSectionCode(sectionCode);
340 389
341 // 版本 390 // 版本
342 sectionRoute.setVersions(versions); 391 sectionRoute.setVersions(versions);
@@ -344,7 +393,6 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -344,7 +393,6 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
344 // 方向 393 // 方向
345 sectionRoute.setDirections(directions); 394 sectionRoute.setDirections(directions);
346 395
347 -  
348 sectionRouteRepository.save(sectionRoute); 396 sectionRouteRepository.save(sectionRoute);
349 } 397 }
350 398
@@ -360,7 +408,36 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -360,7 +408,36 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
360 408
361 return resultMap; 409 return resultMap;
362 } 410 }
363 - 411 +
  412 +
  413 + public boolean isHaveStationname(String bJwpoints,List<Object[]> stationNameList) {
  414 +
  415 + boolean temp = true;
  416 +
  417 + if(stationNameList.size()>0) {
  418 +
  419 + for(int k = 0 ; k <stationNameList.size();k++) {
  420 +
  421 + if(bJwpoints.equals(stationNameList.get(k)[0])){
  422 +
  423 + return temp;
  424 +
  425 + }else {
  426 +
  427 + temp = false;
  428 +
  429 + }
  430 +
  431 + }
  432 +
  433 + }else {
  434 +
  435 + temp = false;
  436 + }
  437 +
  438 + return temp;
  439 + }
  440 +
364 @Override 441 @Override
365 public int getStationCode() { 442 public int getStationCode() {
366 443
@@ -376,7 +453,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -376,7 +453,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
376 try { 453 try {
377 454
378 // 站点编码 455 // 站点编码
379 - String stationCode = map.get("stationCode").equals("") ? "" : map.get("stationCode").toString(); 456 + String stationCod = map.get("stationCod").equals("") ? "" : map.get("stationCod").toString();
380 457
381 // 站点名称 458 // 站点名称
382 String stationName = map.get("stationName").equals("") ? "" : map.get("stationName").toString(); 459 String stationName = map.get("stationName").equals("") ? "" : map.get("stationName").toString();
@@ -390,11 +467,31 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -390,11 +467,31 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
390 // 原坐标点 467 // 原坐标点
391 String bJwpoints = map.get("bJwpoints").equals("") ? "" : map.get("bJwpoints").toString(); 468 String bJwpoints = map.get("bJwpoints").equals("") ? "" : map.get("bJwpoints").toString();
392 469
393 - // WGS经度  
394 - Float gLonx = map.get("gLonx").equals("") ? null : Float.parseFloat(map.get("gLonx").toString()); 470 + // WGS经纬度
  471 + String gJwpoints = map.get("gJwpoints").equals("") ? null : map.get("gJwpoints").toString();
  472 +
  473 + String gJwpointsArray []= null;
  474 +
  475 + if(gJwpoints!=null) {
  476 +
  477 + gJwpointsArray = gJwpoints.split(" ");
  478 +
  479 + }
  480 +
  481 + // 方向
  482 + Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString());
  483 +
  484 + // 距离
  485 + Double distances = map.get("distances").equals("") ? null : Double.parseDouble(map.get("distances").toString());
  486 +
  487 + // 时间
  488 + Double toTime = map.get("toTime").equals("") ? null : Double.parseDouble(map.get("toTime").toString());
  489 +
  490 + // WGS经纬度
  491 + Float gLonx = Float.parseFloat(gJwpointsArray[0]);
395 492
396 // WGS纬度 493 // WGS纬度
397 - Float gLaty = map.get("gLaty").equals("") ? null : Float.parseFloat(map.get("gLaty").toString()); 494 + Float gLaty = Float.parseFloat(gJwpointsArray[1]);
398 495
399 // 城建坐标经度 496 // 城建坐标经度
400 Float x = map.get("x").equals("") ? null : Float.parseFloat(map.get("x").toString()); 497 Float x = map.get("x").equals("") ? null : Float.parseFloat(map.get("x").toString());
@@ -403,10 +500,10 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -403,10 +500,10 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
403 Float y = map.get("y").equals("") ? null : Float.parseFloat(map.get("y").toString()); 500 Float y = map.get("y").equals("") ? null : Float.parseFloat(map.get("y").toString());
404 501
405 // 多边形WGS坐标点集合 502 // 多边形WGS坐标点集合
406 - String gPloygonGrid = map.get("gPloygonGrid").equals("") ? "" : map.get("gPloygonGrid").toString(); 503 + String gPloygonGrid = map.get("gPolygonGrid").equals("") ? "" : map.get("gPolygonGrid").toString();
407 504
408 // 多边形原坐标点集合 505 // 多边形原坐标点集合
409 - String bPloygonGrid = map.get("bPloygonGrid").equals("") ? "" : map.get("bPloygonGrid").toString(); 506 + String bPloygonGrid = map.get("bPolygonGrid").equals("") ? "" : map.get("bPolygonGrid").toString();
410 507
411 // 是否撤销 508 // 是否撤销
412 Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString()); 509 Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString());
@@ -427,15 +524,65 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -427,15 +524,65 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
427 Integer createBy = map.get("createBy").equals("") ? null : Integer.parseInt(map.get("createBy").toString()); 524 Integer createBy = map.get("createBy").equals("") ? null : Integer.parseInt(map.get("createBy").toString());
428 525
429 // 修改人 526 // 修改人
430 - Integer updateBy = map.get("updateBy").equals("") ? null : Integer.parseInt(map.get("updateBy").toString()); 527 + Integer updateBy = map.get("updateBy").equals("") ? null : Integer.parseInt(map.get("updateBy").toString());
431 528
432 - /*  
433 - repository.stationSave(stationCode, stationName, roadCoding, dbType, bJwpoints,  
434 - 529 + int line = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString());
  530 +
  531 + // 线路信息
  532 + Line resultLine = lineRepository.findOne(line);
  533 +
  534 + String stationRouteCode = map.get("stationRouteCode").equals("") ? "" : map.get("stationRouteCode").toString();
  535 +
  536 + String stationMark = map.get("stationMark").equals("") ? "" : map.get("stationMark").toString();
  537 +
  538 + String stationRouteCodeArray [] = null;
  539 +
  540 +
  541 + if(stationRouteCode!="") {
  542 +
  543 + stationRouteCodeArray= stationRouteCode.split("_");
  544 +
  545 + }
  546 +
  547 +
  548 +
  549 + repository.stationSave(stationCod, stationName, roadCoding, dbType, bJwpoints,
  550 +
435 gLonx, gLaty, x, y, gPloygonGrid,bPloygonGrid, destroy, radius, 551 gLonx, gLaty, x, y, gPloygonGrid,bPloygonGrid, destroy, radius,
436 552
437 shapesType, versions, descriptions, createBy, updateBy); 553 shapesType, versions, descriptions, createBy, updateBy);
438 - */ 554 +
  555 +
  556 +
  557 + int staitonId = repository.stationMaxId();
  558 +
  559 + Station station = repository.findOne(staitonId);
  560 +
  561 + StationRoute arg0 = new StationRoute();
  562 +
  563 + arg0.setLine(resultLine);
  564 +
  565 + arg0.setStation(station);
  566 +
  567 + arg0.setStationName(stationName);
  568 +
  569 + arg0.setStationCode(station.getStationCod());
  570 +
  571 + arg0.setStationRouteCode(Integer.parseInt(stationRouteCodeArray[0])+1);
  572 +
  573 + arg0.setStationMark(stationMark);
  574 +
  575 + arg0.setDirections(directions);
  576 +
  577 + arg0.setDistances(distances);
  578 +
  579 + arg0.setToTime(toTime);
  580 +
  581 + arg0.setVersions(versions);
  582 +
  583 + arg0.setDescriptions(descriptions);
  584 +
  585 + routeRepository.save(arg0);
439 586
440 resultMap.put("status", ResponseCode.SUCCESS); 587 resultMap.put("status", ResponseCode.SUCCESS);
441 588
@@ -454,4 +601,171 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -454,4 +601,171 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
454 return resultMap; 601 return resultMap;
455 } 602 }
456 603
  604 + @Override
  605 + public Map<String, Object> stationUpdate(Map<String, Object> map) {
  606 +
  607 + Map<String, Object> resultMap = new HashMap<String, Object>();
  608 +
  609 + try {
  610 +
  611 + // 站点Id
  612 + Integer stationId = map.get("stationId").equals("") ? null : Integer.parseInt(map.get("stationId").toString());
  613 +
  614 + String stationCod = map.get("stationCod").equals("") ? "" : map.get("stationCod").toString();
  615 +
  616 + // 站点名称
  617 + String stationName = map.get("stationName").equals("") ? "" : map.get("stationName").toString();
  618 +
  619 + // 所在道路编码
  620 + String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString();
  621 +
  622 + // 经纬坐标类型
  623 + String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString();
  624 +
  625 + // 百度经纬度坐标
  626 + String bJwpoints = map.get("bJwpoints").equals("") ? "" : map.get("bJwpoints").toString();
  627 +
  628 + // WGS经纬度坐标
  629 + String gJwpoints = map.get("gJwpoints").equals("") ? "" : map.get("gJwpoints").toString();
  630 +
  631 + // 站点地理位置WGS坐标经度
  632 + String gLonx = "";
  633 +
  634 + // 站点地理位置WGS坐标纬度
  635 + String gLaty = "";
  636 +
  637 + if(gJwpoints!=null) {
  638 +
  639 + String gJwpointsArray[] = gJwpoints.split(" ");
  640 +
  641 + gLonx = gJwpointsArray[0];
  642 +
  643 + gLaty = gJwpointsArray[1];
  644 +
  645 + }
  646 +
  647 + // 图形类型
  648 + String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString();
  649 +
  650 + // 圆形半径
  651 + Integer radius = map.get("radius").equals("") ? null : Integer.parseInt(map.get("radius").toString());
  652 +
  653 + // 多边形空间WGS坐标点集合
  654 + String gPolygonGrid = map.get("gPolygonGrid").equals("") ? "" : map.get("gPolygonGrid").toString();
  655 +
  656 + // 多边形空间原坐标坐标点集合
  657 + String bPolygonGrid = map.get("bPolygonGrid").equals("") ? "" : map.get("bPolygonGrid").toString();
  658 +
  659 + // 是否撤销
  660 + Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString());
  661 +
  662 + // 版本号
  663 + Integer versions = map.get("versions").equals("") ? null : Integer.parseInt(map.get("versions").toString());
  664 +
  665 + // 描述与说明
  666 + String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString();
  667 +
  668 + Float x = map.get("x").equals("") ? null : Float.parseFloat(map.get("x").toString());
  669 +
  670 + Float y = map.get("y").equals("") ? null : Float.parseFloat(map.get("y").toString());
  671 +
  672 + // 更新
  673 + repository.stationUpdate(stationCod, stationName, roadCoding, dbType, bJwpoints, gLonx, gLaty, x, y, bPolygonGrid, gPolygonGrid, destroy, radius, shapesType, versions, descriptions, stationId);
  674 +
  675 + // 站点路由Id
  676 + Integer stationRouteId = map.get("stationRouteId").equals("") ? null : Integer.parseInt(map.get("stationRouteId").toString());
  677 +
  678 + StationRoute resultS = routeRepository.findOne(stationRouteId);
  679 +
  680 + // 站点路由序号
  681 + String stationRouteCodeStr = map.get("stationRouteCode").equals("") ? null : map.get("stationRouteCode").toString();
  682 +
  683 + Integer stationRouteCode = null;
  684 +
  685 + if(stationRouteCodeStr!=null) {
  686 +
  687 + String stationRouteCodeAraay[] = stationRouteCodeStr.split("_");
  688 +
  689 + Integer old_code = resultS.getStationRouteCode();
  690 +
  691 + Integer new_code = Integer.parseInt(stationRouteCodeAraay[0].toString())+10;
  692 +
  693 + if(new_code==old_code){
  694 +
  695 + stationRouteCode = new_code;
  696 +
  697 + }else if(new_code>old_code) {
  698 +
  699 + stationRouteCode = new_code+1;
  700 +
  701 + }else if(new_code<old_code) {
  702 +
  703 + stationRouteCode = new_code-1;
  704 +
  705 + }
  706 +
  707 +
  708 + // stationRouteCode = Integer.parseInt(stationRouteCodeAraay[0].toString()) + 10;
  709 +
  710 + }
  711 +
  712 + stationRouteCode = stationRouteCode == null ? 10 : stationRouteCode;
  713 +
  714 + Integer LineId = map.get("stationRouteLine").equals("") ? null : Integer.parseInt(map.get("stationRouteLine").toString());
  715 +
  716 + String stationMark = map.get("stationMark").equals("") ? null : map.get("stationMark").toString();
  717 +
  718 + Double distances = map.get("distances").equals("") ? null : Double.parseDouble(map.get("distances").toString());
  719 +
  720 + Double toTime = map.get("toTime").equals("") ? null : Double.parseDouble(map.get("toTime").toString());
  721 +
  722 + Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString());
  723 +
  724 + Station station = repository.findOne(stationId);
  725 +
  726 + Line line = lineRepository.findOne(LineId);
  727 +
  728 +
  729 + StationRoute stationRoute = new StationRoute();
  730 +
  731 + stationRoute.setStationName(stationName);
  732 +
  733 + stationRoute.setId(stationRouteId);
  734 +
  735 + stationRoute.setStationRouteCode(stationRouteCode);
  736 +
  737 + stationRoute.setStation(station);
  738 +
  739 + stationRoute.setStationCode(station.getStationCod());
  740 +
  741 + stationRoute.setLine(line);
  742 +
  743 + stationRoute.setLineCode(line.getLineCode());
  744 +
  745 + stationRoute.setStationMark(stationMark);
  746 +
  747 + stationRoute.setDistances(distances);
  748 +
  749 + stationRoute.setToTime(toTime);
  750 +
  751 + stationRoute.setDirections(directions);
  752 +
  753 + stationRoute.setVersions(versions);
  754 +
  755 + stationRoute.setDescriptions(descriptions);
  756 +
  757 + routeRepository.save(stationRoute);
  758 +
  759 + resultMap.put("status", ResponseCode.SUCCESS);
  760 +
  761 + } catch (Exception e) {
  762 +
  763 + resultMap.put("status", ResponseCode.ERROR);
  764 +
  765 + logger.error("save erro.", e);
  766 +
  767 + }
  768 + return resultMap;
  769 + }
  770 +
457 } 771 }
src/main/resources/static/pages/base/line/list.html
@@ -148,7 +148,7 @@ @@ -148,7 +148,7 @@
148 <a href="/pages/base/lineinformation/list.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 查看 </a> 148 <a href="/pages/base/lineinformation/list.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 查看 </a>
149 </td> 149 </td>
150 <td> 150 <td>
151 - <a href="/pages/base/stationroute/list.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 查看 </a> 151 + <a href="/pages/base/stationroute/list.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 查看 </a>
152 </td> 152 </td>
153 <td> 153 <td>
154 <a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 详细 </a> 154 <a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 详细 </a>
src/main/resources/static/pages/base/section/js/section-list-table.js 0 → 100644
  1 +/**
  2 + *
  3 + * @JSName : list.js(线路信息list.html页面js)
  4 + *
  5 + * @Author : bsth@lq
  6 + *
  7 + * @Description : TODO(线路信息list.html页面js)
  8 + *
  9 + * @Data : 2016年4月28日 上午9:21:17
  10 + *
  11 + * @Version 公交调度系统BS版 0.1
  12 + *
  13 + */
  14 +
  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 +
  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 + /**
  72 + * -----page : 当前页
  73 + *
  74 + * -----initPag :
  75 + *
  76 + */
  77 + var page = 0,initPag;
  78 +
  79 + // 选择框
  80 + var icheckOptions = {
  81 + checkboxClass: 'icheckbox_flat-blue',
  82 + increaseArea: '20%'
  83 + };
  84 +
  85 + // 表格数据分页加载
  86 + loadTableDate(null,true);
  87 +
  88 + /**
  89 + * 重置按钮事件
  90 + *
  91 + */
  92 + $('tr.filter .filter-cancel').on('click',function(){
  93 + // 清空搜索框值
  94 + $('tr.filter input,select').val('').change();
  95 + // 重新加载表格数据
  96 + loadTableDate(null,true);
  97 + });
  98 +
  99 + /**
  100 + * 搜索按钮事件
  101 + *
  102 + */
  103 + $('tr.filter .filter-submit').on('click',function(){
  104 + // cells 集合返回表格中所有(列)单元格的一个数组
  105 + var cells = $('tr.filter')[0].cells;
  106 + // 搜索参数集合
  107 + var params = {};
  108 + // 搜索字段名称
  109 + var name;
  110 + // 遍历cells数组
  111 + $.each(cells, function(i, cell){
  112 + // 获取第i列的input或者select集合
  113 + var items = $('input,select', cell);
  114 + // 遍历items集合
  115 + for(var j = 0, item; item = items[j++];){
  116 + // 获取字段名称
  117 + name = $(item).attr('name');
  118 + if(name){
  119 + // 赋取相对应的值
  120 + params[name] = $(item).val();
  121 + }
  122 + }
  123 + });
  124 + page = 0;
  125 +
  126 + console.log(params);
  127 + loadTableDate(params,true);
  128 + });
  129 +
  130 + /**
  131 + * 表格数据分页加载事件
  132 + *
  133 + * ------@param : 查询参数
  134 + *
  135 + * ------@isPon : 是否重新分页
  136 + *
  137 + */
  138 + function loadTableDate(param,isPon){
  139 + // 搜索参数
  140 + var params = {};
  141 + if(param)
  142 + params = param;
  143 + // 排序(按更新时间)
  144 + params['order'] = 'id';
  145 + // 记录当前页数
  146 + params['page'] = page;
  147 + // 弹出正在加载层
  148 + var i = layer.load(2);
  149 + // 异步请求获取表格数据
  150 + $.get('/sectionroute',params,function(result){
  151 +
  152 + console.log(result);
  153 +
  154 + // 把数据填充到模版中
  155 + var tbodyHtml = template('sectionInfo_list_table_temp',{list:result.content});
  156 + // 把渲染好的模版html文本追加到表格中
  157 + $('#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 + // 是重新分页且返回数据长度大于0
  163 + if(isPon && result.content.length > 0){
  164 + // 重新分页
  165 + initPag = true;
  166 + // 分页栏
  167 + showPagination(result);
  168 + }
  169 + // 关闭弹出加载层
  170 + layer.close(i);
  171 + });
  172 + }
  173 +
  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 +
  191 + /**
  192 + * 分页栏组件
  193 + *
  194 + */
  195 + function showPagination(data){
  196 + // 分页组件
  197 + $('#pagination').jqPaginator({
  198 + // 总页数
  199 + totalPages: data.totalPages,
  200 + // 中间显示页数
  201 + visiblePages: 6,
  202 + // 当前页
  203 + currentPage: page + 1,
  204 + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
  205 + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
  206 + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
  207 + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
  208 + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
  209 + onPageChange: function (num, type) {
  210 + if(initPag){
  211 + initPag = false;
  212 + return;
  213 + }
  214 + page = num - 1;
  215 + loadTableDate(null, false);
  216 + }
  217 + });
  218 + }
  219 +})();
0 \ No newline at end of file 220 \ No newline at end of file
src/main/resources/static/pages/base/section/list.html
1 <div class="page-head"> 1 <div class="page-head">
2 <div class="page-title"> 2 <div class="page-title">
3 - <h1>站点信息</h1> 3 + <h1>路段信息</h1>
4 </div> 4 </div>
5 </div> 5 </div>
6 6
7 <ul class="page-breadcrumb breadcrumb"> 7 <ul class="page-breadcrumb breadcrumb">
8 <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> 8 <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
9 <li><span class="active">基础信息</span> <i class="fa fa-circle"></i></li> 9 <li><span class="active">基础信息</span> <i class="fa fa-circle"></i></li>
10 - <li><span class="active">站点信息</span></li> 10 + <li><span class="active">路段信息</span></li>
11 </ul> 11 </ul>
12 12
13 <div class="row"> 13 <div class="row">
@@ -16,11 +16,11 @@ @@ -16,11 +16,11 @@
16 <div class="portlet-title"> 16 <div class="portlet-title">
17 <div class="caption"> 17 <div class="caption">
18 <i class="fa fa-info-circle font-dark"></i> 18 <i class="fa fa-info-circle font-dark"></i>
19 - <span class="caption-subject font-dark sbold uppercase">站点信息</span> 19 + <span class="caption-subject font-dark sbold uppercase">路段信息</span>
20 </div> 20 </div>
21 <div class="actions"> 21 <div class="actions">
22 <div class="btn-group btn-group-devided" data-toggle="buttons"> 22 <div class="btn-group btn-group-devided" data-toggle="buttons">
23 - <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加站点</a> 23 + <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加路段</a>
24 </div> 24 </div>
25 </div> 25 </div>
26 </div> 26 </div>
@@ -30,15 +30,14 @@ @@ -30,15 +30,14 @@
30 <thead> 30 <thead>
31 <tr role="row" class="heading"> 31 <tr role="row" class="heading">
32 <th width="3%">#</th> 32 <th width="3%">#</th>
33 - <th width="8%">线路编</th> 33 + <th width="8%">线路编</th>
34 <th width="8%">线路名称</th> 34 <th width="8%">线路名称</th>
35 - <th width="8%">站点名称</th>  
36 - <th width="8%">停车场编码</th>  
37 - <th width="8%">起始站名称</th>  
38 - <th width="8%">终点站名称</th>  
39 - <th width="8%">所属分公司</th>  
40 - <th width="8%">所属公司</th>  
41 - <th width="8%">运营状态</th> 35 + <th width="8%">线路方向</th>
  36 + <th width="8%">路段名称</th>
  37 + <th width="8%">路段编码</th>
  38 + <th width="8%">路段序号</th>
  39 + <th width="8%">版本号</th>
  40 + <th width="8%">是否撤销</th>
42 <th width="15%">操作</th> 41 <th width="15%">操作</th>
43 </tr> 42 </tr>
44 <tr role="row" class="filter"> 43 <tr role="row" class="filter">
@@ -62,9 +61,6 @@ @@ -62,9 +61,6 @@
62 <input type="text" class="form-control form-filter input-sm" name="endStationName"> 61 <input type="text" class="form-control form-filter input-sm" name="endStationName">
63 </td> 62 </td>
64 <td> 63 <td>
65 - <input type="text" class="form-control form-filter input-sm" name="brancheCompany">  
66 - </td>  
67 - <td>  
68 <input type="text" class="form-control form-filter input-sm" name="company"> 64 <input type="text" class="form-control form-filter input-sm" name="company">
69 </td> 65 </td>
70 <td> 66 <td>
@@ -95,7 +91,7 @@ @@ -95,7 +91,7 @@
95 </div> 91 </div>
96 </div> 92 </div>
97 </div> 93 </div>
98 -<script type="text/html" id="line_list_temp"> 94 +<script type="text/html" id="sectionInfo_list_table_temp">
99 {{each list as obj i }} 95 {{each list as obj i }}
100 <tr> 96 <tr>
101 <td style="vertical-align: middle;"> 97 <td style="vertical-align: middle;">
@@ -105,31 +101,29 @@ @@ -105,31 +101,29 @@
105 {{obj.lineCode}} 101 {{obj.lineCode}}
106 </td> 102 </td>
107 <td> 103 <td>
108 - {{obj.name}}  
109 - </td>  
110 - <td>  
111 - {{obj.carSumNumber}} 104 + {{obj.line.name}}
112 </td> 105 </td>
113 <td> 106 <td>
114 - {{obj.carParkCode}} 107 + {{obj.directions}}
115 </td> 108 </td>
116 <td> 109 <td>
117 - {{obj.startStationName}} 110 + {{obj.section.sectionName}}
118 </td> 111 </td>
119 <td> 112 <td>
120 - {{obj.endStationName}} 113 + {{obj.sectionCode}}
121 </td> 114 </td>
122 <td> 115 <td>
123 - {{obj.company}} 116 + {{obj.sectionrouteCode}}
124 </td> 117 </td>
125 <td> 118 <td>
126 - {{obj.brancheCompany}} 119 + {{obj.versions}}
127 </td> 120 </td>
128 <td> 121 <td>
129 {{obj.destroy}} 122 {{obj.destroy}}
130 </td> 123 </td>
131 <td> 124 <td>
132 - <a href="edit.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 详细 </a> 125 + <a href="edit.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 定位 </a>
  126 + <a href="edit.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 修改 </a>
133 </td> 127 </td>
134 </tr> 128 </tr>
135 {{/each}} 129 {{/each}}
@@ -139,4 +133,4 @@ @@ -139,4 +133,4 @@
139 </tr> 133 </tr>
140 {{/if}} 134 {{/if}}
141 </script> 135 </script>
142 -<script src="/pages/base/line/js/list.js"></script>  
143 \ No newline at end of file 136 \ No newline at end of file
  137 +<script src="/pages/base/section/js/section-list-table.js"></script>
144 \ No newline at end of file 138 \ No newline at end of file
src/main/resources/static/pages/base/station/js/station-list-table.js 0 → 100644
  1 +/**
  2 + *
  3 + * @JSName : list.js(线路信息list.html页面js)
  4 + *
  5 + * @Author : bsth@lq
  6 + *
  7 + * @Description : TODO(线路信息list.html页面js)
  8 + *
  9 + * @Data : 2016年4月28日 上午9:21:17
  10 + *
  11 + * @Version 公交调度系统BS版 0.1
  12 + *
  13 + */
  14 +
  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 +
  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 + /**
  72 + * -----page : 当前页
  73 + *
  74 + * -----initPag :
  75 + *
  76 + */
  77 + var page = 0,initPag;
  78 +
  79 + // 选择框
  80 + var icheckOptions = {
  81 + checkboxClass: 'icheckbox_flat-blue',
  82 + increaseArea: '20%'
  83 + };
  84 +
  85 + // 表格数据分页加载
  86 + loadTableDate(null,true);
  87 +
  88 + /**
  89 + * 重置按钮事件
  90 + *
  91 + */
  92 + $('tr.filter .filter-cancel').on('click',function(){
  93 + // 清空搜索框值
  94 + $('tr.filter input,select').val('').change();
  95 + // 重新加载表格数据
  96 + loadTableDate(null,true);
  97 + });
  98 +
  99 + /**
  100 + * 搜索按钮事件
  101 + *
  102 + */
  103 + $('tr.filter .filter-submit').on('click',function(){
  104 + // cells 集合返回表格中所有(列)单元格的一个数组
  105 + var cells = $('tr.filter')[0].cells;
  106 + // 搜索参数集合
  107 + var params = {};
  108 + // 搜索字段名称
  109 + var name;
  110 + // 遍历cells数组
  111 + $.each(cells, function(i, cell){
  112 + // 获取第i列的input或者select集合
  113 + var items = $('input,select', cell);
  114 + // 遍历items集合
  115 + for(var j = 0, item; item = items[j++];){
  116 + // 获取字段名称
  117 + name = $(item).attr('name');
  118 + if(name){
  119 + // 赋取相对应的值
  120 + params[name] = $(item).val();
  121 + }
  122 + }
  123 + });
  124 + page = 0;
  125 +
  126 + console.log(params);
  127 + loadTableDate(params,true);
  128 + });
  129 +
  130 + /**
  131 + * 表格数据分页加载事件
  132 + *
  133 + * ------@param : 查询参数
  134 + *
  135 + * ------@isPon : 是否重新分页
  136 + *
  137 + */
  138 + function loadTableDate(param,isPon){
  139 + // 搜索参数
  140 + var params = {};
  141 + if(param)
  142 + params = param;
  143 + // 排序(按更新时间)
  144 + params['order'] = 'id';
  145 + // 记录当前页数
  146 + params['page'] = page;
  147 + // 弹出正在加载层
  148 + var i = layer.load(2);
  149 + // 异步请求获取表格数据
  150 + $.get('/stationroute',params,function(result){
  151 +
  152 + console.log(result);
  153 +
  154 + // 把数据填充到模版中
  155 + var tbodyHtml = template('staitonInfo_list_table_temp',{list:result.content});
  156 + // 把渲染好的模版html文本追加到表格中
  157 + $('#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 + // 是重新分页且返回数据长度大于0
  163 + if(isPon && result.content.length > 0){
  164 + // 重新分页
  165 + initPag = true;
  166 + // 分页栏
  167 + showPagination(result);
  168 + }
  169 + // 关闭弹出加载层
  170 + layer.close(i);
  171 + });
  172 + }
  173 +
  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 +
  191 + /**
  192 + * 分页栏组件
  193 + *
  194 + */
  195 + function showPagination(data){
  196 + // 分页组件
  197 + $('#pagination').jqPaginator({
  198 + // 总页数
  199 + totalPages: data.totalPages,
  200 + // 中间显示页数
  201 + visiblePages: 6,
  202 + // 当前页
  203 + currentPage: page + 1,
  204 + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
  205 + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
  206 + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
  207 + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
  208 + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
  209 + onPageChange: function (num, type) {
  210 + if(initPag){
  211 + initPag = false;
  212 + return;
  213 + }
  214 + page = num - 1;
  215 + loadTableDate(null, false);
  216 + }
  217 + });
  218 + }
  219 +})();
0 \ No newline at end of file 220 \ No newline at end of file
src/main/resources/static/pages/base/station/list.html
@@ -30,10 +30,13 @@ @@ -30,10 +30,13 @@
30 <thead> 30 <thead>
31 <tr role="row" class="heading"> 31 <tr role="row" class="heading">
32 <th width="3%">#</th> 32 <th width="3%">#</th>
33 - <th width="8%">站点编码</th> 33 + <th width="8%">线路编号</th>
  34 + <th width="8%">线路名称</th>
  35 + <th width="8%">线路方向</th>
34 <th width="8%">站点名称</th> 36 <th width="8%">站点名称</th>
35 - <th width="8%">图形类型</th>  
36 - <th width="8%">圆形半径</th> 37 + <th width="8%">站点编码</th>
  38 + <th width="8%">站点序号</th>
  39 + <th width="8%">站点类型</th>
37 <th width="8%">版本号</th> 40 <th width="8%">版本号</th>
38 <th width="8%">是否撤销</th> 41 <th width="8%">是否撤销</th>
39 <th width="15%">操作</th> 42 <th width="15%">操作</th>
@@ -53,6 +56,15 @@ @@ -53,6 +56,15 @@
53 <input type="text" class="form-control form-filter input-sm" name="brancheCompany"> 56 <input type="text" class="form-control form-filter input-sm" name="brancheCompany">
54 </td> 57 </td>
55 <td> 58 <td>
  59 + <input type="text" class="form-control form-filter input-sm" name="startStationName">
  60 + </td>
  61 + <td>
  62 + <input type="text" class="form-control form-filter input-sm" name="endStationName">
  63 + </td>
  64 + <td>
  65 + <input type="text" class="form-control form-filter input-sm" name="brancheCompany">
  66 + </td>
  67 + <td>
56 <input type="text" class="form-control form-filter input-sm" name="company"> 68 <input type="text" class="form-control form-filter input-sm" name="company">
57 </td> 69 </td>
58 <td> 70 <td>
@@ -83,7 +95,7 @@ @@ -83,7 +95,7 @@
83 </div> 95 </div>
84 </div> 96 </div>
85 </div> 97 </div>
86 -<script type="text/html" id="line_list_temp"> 98 +<script type="text/html" id="staitonInfo_list_table_temp">
87 {{each list as obj i }} 99 {{each list as obj i }}
88 <tr> 100 <tr>
89 <td style="vertical-align: middle;"> 101 <td style="vertical-align: middle;">
@@ -93,31 +105,32 @@ @@ -93,31 +105,32 @@
93 {{obj.lineCode}} 105 {{obj.lineCode}}
94 </td> 106 </td>
95 <td> 107 <td>
96 - {{obj.name}} 108 + {{obj.line.name}}
97 </td> 109 </td>
98 <td> 110 <td>
99 - {{obj.carSumNumber}} 111 + {{obj.directions}}
100 </td> 112 </td>
101 <td> 113 <td>
102 - {{obj.carParkCode}} 114 + {{obj.stationName}}
103 </td> 115 </td>
104 <td> 116 <td>
105 - {{obj.startStationName}} 117 + {{obj.stationCode}}
106 </td> 118 </td>
107 <td> 119 <td>
108 - {{obj.endStationName}} 120 + {{obj.stationRouteCode}}
109 </td> 121 </td>
110 <td> 122 <td>
111 - {{obj.company}} 123 + {{obj.stationMark}}
112 </td> 124 </td>
113 <td> 125 <td>
114 - {{obj.brancheCompany}} 126 + {{obj.versions}}
115 </td> 127 </td>
116 <td> 128 <td>
117 {{obj.destroy}} 129 {{obj.destroy}}
118 </td> 130 </td>
119 <td> 131 <td>
120 - <a href="edit.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 详细 </a> 132 + <a href="edit.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 定位 </a>
  133 + <a href="edit.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 修改 </a>
121 </td> 134 </td>
122 </tr> 135 </tr>
123 {{/each}} 136 {{/each}}
@@ -127,4 +140,4 @@ @@ -127,4 +140,4 @@
127 </tr> 140 </tr>
128 {{/if}} 141 {{/if}}
129 </script> 142 </script>
130 -<script src="/pages/base/line/js/list.js"></script>  
131 \ No newline at end of file 143 \ No newline at end of file
  144 +<script src="/pages/base/station/js/station-list-table.js"></script>
132 \ No newline at end of file 145 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/add.html
@@ -18,6 +18,19 @@ @@ -18,6 +18,19 @@
18 您的输入有误,请检查下面的输入项 18 您的输入有误,请检查下面的输入项
19 </div> 19 </div>
20 20
  21 + <!-- 线路ID -->
  22 + <input type="hidden" name="lineId" id="lineIdInput" />
  23 +
  24 + <input type="hidden" name="bPolygonGrid" id="bPolygonGridInput" />
  25 +
  26 + <input type="hidden" name="gPolygonGrid" id="gPolygonGridInput" />
  27 +
  28 + <input type="hidden" name="dbType" id="dbTypeInput" value="b"/>
  29 +
  30 + <input type="hidden" name="x" id="xInput" value=""/>
  31 +
  32 + <input type="hidden" name="y" id="yInput" value=""/>
  33 +
21 <!-- 站点名称 --> 34 <!-- 站点名称 -->
22 <div class="form-body"> 35 <div class="form-body">
23 <div class="form-group"> 36 <div class="form-group">
@@ -50,7 +63,7 @@ @@ -50,7 +63,7 @@
50 </label> 63 </label>
51 <div class="col-md-6"> 64 <div class="col-md-6">
52 <select name="stationRouteCode" class="form-control" id="stationrouteSelect"></select> 65 <select name="stationRouteCode" class="form-control" id="stationrouteSelect"></select>
53 - <span class="help-block"> 选择的站点将作为本站序号的参考,成为选择站点的下一站。 </span> 66 + <span class="help-block"> *说明:选择的站点将作为本站序号的参考,成为选择站点的下一站。 </span>
54 </div> 67 </div>
55 </div> 68 </div>
56 </div> 69 </div>
@@ -89,12 +102,32 @@ @@ -89,12 +102,32 @@
89 </div> 102 </div>
90 </div> 103 </div>
91 104
  105 + <!-- 道路编码-->
  106 + <div class="form-body">
  107 + <div class="form-group">
  108 + <label class="control-label col-md-3">道路编码:</label>
  109 + <div class="col-md-6">
  110 + <input type="text" class="form-control" name="roadCoding" id="roadCodingCodInput">
  111 + </div>
  112 + </div>
  113 + </div>
  114 +
92 <!-- 中心位置坐标点 --> 115 <!-- 中心位置坐标点 -->
93 <div class="form-body"> 116 <div class="form-body">
94 <div class="form-group"> 117 <div class="form-group">
95 - <label class="col-md-3 control-label">中心位置坐标点:</label> 118 + <label class="col-md-3 control-label">经纬度坐标点:</label>
  119 + <div class="col-md-6">
  120 + <input type="text" class="form-control" name="bJwpoints" id="bJwpointsInput">
  121 + </div>
  122 + </div>
  123 + </div>
  124 +
  125 + <!-- 站点WGS经纬度 -->
  126 + <div class="form-body">
  127 + <div class="form-group">
  128 + <label class="col-md-3 control-label">站点WGS经纬度:</label>
96 <div class="col-md-6"> 129 <div class="col-md-6">
97 - <input type="text" class="form-control" name="points" id="pointsInput"> 130 + <input type="text" class="form-control" name="gJwpoints" id="gJwpointsInput">
98 </div> 131 </div>
99 </div> 132 </div>
100 </div> 133 </div>
@@ -113,6 +146,27 @@ @@ -113,6 +146,27 @@
113 </div> 146 </div>
114 </div> 147 </div>
115 148
  149 + <!-- 范围图形类型 -->
  150 + <div class="form-body">
  151 + <div class="form-group">
  152 + <label class="col-md-3 control-label">圆形半径:</label>
  153 + <div class="col-md-6">
  154 + <select name="radius" class="form-control" id="radiusSelect">
  155 + <option value="">-- 请选择圆形半径 --</option>
  156 + <option value="50">50</option>
  157 + <option value="100">100</option>
  158 + <option value="150">150</option>
  159 + <option value="200">200</option>
  160 + <option value="250">250</option>
  161 + <option value="300">300</option>
  162 + <option value="350">350</option>
  163 + <option value="400">400</option>
  164 + <option value="450">450</option>
  165 + </select>
  166 + </div>
  167 + </div>
  168 + </div>
  169 +
116 <!-- 到站时间 --> 170 <!-- 到站时间 -->
117 <div class="form-body"> 171 <div class="form-body">
118 <div class="form-group"> 172 <div class="form-group">
@@ -145,6 +199,20 @@ @@ -145,6 +199,20 @@
145 </div> 199 </div>
146 </div> 200 </div>
147 201
  202 + <!-- 范围图形类型 -->
  203 + <div class="form-body">
  204 + <div class="form-group">
  205 + <label class="col-md-3 control-label">是否撤销:</label>
  206 + <div class="col-md-6">
  207 + <select name="destroy" class="form-control" id="destroySelect">
  208 + <option value="">-- 请选择撤销类型 --</option>
  209 + <option value="0">否</option>
  210 + <option value="1">是</option>
  211 + </select>
  212 + </div>
  213 + </div>
  214 + </div>
  215 +
148 <!-- 描述/说明 --> 216 <!-- 描述/说明 -->
149 <div class="form-group"> 217 <div class="form-group">
150 <label class="control-label col-md-3"> 描述/说明: </label> 218 <label class="control-label col-md-3"> 描述/说明: </label>
@@ -155,7 +223,7 @@ @@ -155,7 +223,7 @@
155 </form> 223 </form>
156 </div> 224 </div>
157 <div class="modal-footer"> 225 <div class="modal-footer">
158 - <button type="button" class="btn default" data-dismiss="modal">取消</button> 226 + <button type="button" class="btn default" data-dismiss="modal" id="addMobalHiden">取消</button>
159 <button type="button" class="btn btn-primary" id="addStationButton">提交数据</button> 227 <button type="button" class="btn btn-primary" id="addStationButton">提交数据</button>
160 </div> 228 </div>
161 </div> 229 </div>
@@ -164,47 +232,95 @@ @@ -164,47 +232,95 @@
164 <script type="text/javascript"> 232 <script type="text/javascript">
165 $(function(){ 233 $(function(){
166 234
167 - // 获取站点序号元素,并添加下拉属性值  
168 - GetAjaxData.getStation(id,dir,function(treeData) {  
169 -  
170 - var options = '<option value="">请选择...</option>';  
171 -  
172 - var dArray = treeData[0].children; 235 + // 延迟加载
  236 + setTimeout(function(){
173 237
174 - for(var i = 0 ; i<dArray.length; i++){  
175 -  
176 - options += '<option value="'+dArray[i].station_route_code+ '_'+ dArray[i].station_mark+'">'+dArray[i].name+'</option>' 238 + // 显示mobal
  239 + $('#add_station_mobal').modal({
177 240
178 - }  
179 -  
180 - $('#stationrouteSelect').html(options); 241 + show : true,
  242 +
  243 + backdrop: 'static',
  244 +
  245 + keyboard: false
  246 +
  247 + });
181 248
182 - }); 249 + },200);
183 250
184 -  
185 - // 获取站点编码元素,添加站点编码值  
186 - GetAjaxData.getStationCode(function(stationCode) { 251 + // 当调用 hide 实例方法时触发
  252 + $('#add_station_mobal').on('hide.bs.modal', function () {
  253 +
  254 + addStaitonParmas = {};
187 255
188 - $('#stationCodInput').val(stationCode).attr('Readonly','Readonly'); 256 + mapB.clearOverlays();
  257 +
  258 + linePanlThree(id,dir);
189 259
190 }); 260 });
191 261
192 262
193 - // 延迟加载  
194 - setTimeout(function(){ 263 + // 当模态框对用户可见时触发(将等待 CSS 过渡效果完成)。
  264 + $('#add_station_mobal').on('show.bs.modal', function () {
195 265
196 - // 显示mobal  
197 - $('#add_station_mobal').modal({ 266 + // 线路ID
  267 + $('#lineIdInput').val(id);
  268 +
  269 + // WGS坐标点图形集合
  270 + $('#bPolygonGridInput').val(addStaitonParmas.bPolygonGridInput);
  271 +
  272 + // 百度坐标点图形集合
  273 + $('#gPolygonGridInput').val(addStaitonParmas.gPolygonGridInput);
  274 +
  275 + // 获取站点名称元素设值
  276 + $('#stationNameInput').val(addStaitonParmas.stationNamebootbox).attr('Readonly','Readonly');
  277 +
  278 + // 选择系统生成方式新增站点时的站点坐标
  279 + //$('#pointsInput').val(addStaitonParmas.stationPointInput).attr('Readonly','Readonly');
  280 +
  281 + // 百度地图经纬度坐标中心点
  282 + $('#bJwpointsInput').val(addStaitonParmas.stationPointInput).attr('Readonly','Readonly');
  283 +
  284 + // WGS经纬度
  285 + $('#gJwpointsInput').val(addStaitonParmas.gLonx + ' '+ addStaitonParmas.gLaty).attr('Readonly','Readonly');
  286 +
  287 + // 获取图形类型元素,并添加值
  288 + $('#shapesTypeSelect').val(addStaitonParmas.shapesTypeInput).attr('Readonly','Readonly');
  289 +
  290 + // 获取方向元素,并添加值
  291 + $('#stationdirSelect').val(dir).attr('Readonly','Readonly');
  292 +
  293 + // 获取方向元素,并添加值
  294 + $('#radiusSelect').val(addStaitonParmas.radiusInput).attr('Readonly','Readonly');
  295 +
  296 + // 是否撤销
  297 + $('#destroySelect').val(addStaitonParmas.destroyInput).attr('Readonly','Readonly');
  298 +
  299 + // 获取站点序号元素,并添加下拉属性值
  300 + GetAjaxData.getStation(id,dir,function(treeData) {
198 301
199 - show : true, 302 + var options = '<option value="">请选择...</option>';
200 303
201 - backdrop: 'static', 304 + var dArray = treeData[0].children[0].children;
202 305
203 - keyboard: false 306 + for(var i = 0 ; i<dArray.length; i++){
  307 +
  308 + options += '<option value="'+dArray[i].stationRouteStationRouteCode+ '_'+ dArray[i].stationRouteStationMark+'">'+dArray[i].stationRouteStationName+'</option>'
  309 +
  310 + }
  311 +
  312 + $('#stationrouteSelect').html(options);
204 313
205 }); 314 });
206 315
207 - },150); 316 + // 获取站点编码元素,添加站点编码值
  317 + GetAjaxData.getStationCode(function(stationCode) {
  318 +
  319 + $('#stationCodInput').val(stationCode).attr('Readonly','Readonly');
  320 +
  321 + });
  322 +
  323 + })
208 324
209 // 站点序号值改变事件 325 // 站点序号值改变事件
210 $('#stationrouteSelect').on('change',function() { 326 $('#stationrouteSelect').on('change',function() {
@@ -215,6 +331,8 @@ $(function(){ @@ -215,6 +331,8 @@ $(function(){
215 331
216 var tempStr = stationRValue.split('_'); 332 var tempStr = stationRValue.split('_');
217 333
  334 + console.log(tempStr);
  335 +
218 if(tempStr[1] == 'E') { 336 if(tempStr[1] == 'E') {
219 337
220 $('#stationMarkSelect').val('E'); 338 $('#stationMarkSelect').val('E');
@@ -229,28 +347,6 @@ $(function(){ @@ -229,28 +347,6 @@ $(function(){
229 347
230 }); 348 });
231 349
232 - // 获取方向元素,并添加值  
233 - $('#stationdirSelect').val(dir).attr('Readonly','Readonly');  
234 -  
235 - // 获取范围图形类型元素,并添加值  
236 - $('#shapesTypeSelect').val(polyType).attr('Readonly','Readonly');  
237 -  
238 - // 如果站点名称不为空,获取站点名称元素设值  
239 - if(addStationNameValue) {  
240 -  
241 - // 获取站点名称元素设值  
242 - $('#stationNameInput').val(addStationNameValue).attr('Readonly','Readonly');  
243 -  
244 - }  
245 -  
246 - // 选择系统生成方式新增站点时的站点坐标  
247 - if(addSttationPoints){  
248 -  
249 - // 获取站点位置元素设值  
250 - $('#pointsInput').val(addSttationPoints).attr('Readonly','Readonly');  
251 -  
252 - }  
253 -  
254 // 获取表单元素 350 // 获取表单元素
255 var form = $('#add_station_form'); 351 var form = $('#add_station_form');
256 352
@@ -376,179 +472,31 @@ $(function(){ @@ -376,179 +472,31 @@ $(function(){
376 472
377 error.hide(); 473 error.hide();
378 474
379 - // 站点保存参数  
380 - var stationParams = {};  
381 -  
382 - // 站点名称  
383 - stationParams.stationName = params.stationName;  
384 -  
385 - // 站点编码  
386 - stationParams.stationCode = params.stationCod;  
387 -  
388 - // 原坐标类型  
389 - stationParams.dbType = 'b';  
390 -  
391 - // 坐标中心点  
392 - stationParams.bJwpoints = params.points;  
393 -  
394 - stationParams.x = '';  
395 -  
396 - stationParams.y = '';  
397 -  
398 - stationParams.roadCoding = '';  
399 -  
400 - // 是否撤销  
401 - stationParams.destroy = 0;  
402 -  
403 - // 版本号  
404 - stationParams.versions = params.versions;  
405 -  
406 - // 描述  
407 - stationParams.descriptions = params.descriptions;  
408 -  
409 - var shapesTypeValue = params.shapesType;  
410 -  
411 - // 图形类型  
412 - stationParams.shapesType = shapesTypeValue;  
413 -  
414 - if(shapesTypeValue == 'r') {  
415 -  
416 - // 圆形半径  
417 - stationParams.radius = 300;  
418 -  
419 - // 多边形空间坐标点集合  
420 - stationParams.gPloygonGrid = '';  
421 -  
422 - stationParams.bPloygonGrid = ''; 475 + // 保存
  476 + GetAjaxData.stationSave(params,function(data) {
423 477
424 - var pointsStr = params.points.split(' ');  
425 -  
426 - var pointsZlist = [{potion:{lng:pointsStr[0],lat:pointsStr[1]}}];  
427 -  
428 - GetAjaxData.getFormPointEToWGS(pointsZlist,function(p) { 478 + if(data.status=='SUCCESS') {
429 479
430 - stationParams.gLonx = p[0].WGSpotion.Lng; 480 + // 弹出添加成功提示消息
  481 + layer.msg('添加成功...');
431 482
432 - stationParams.gLaty = p[0].WGSpotion.Lat; 483 + // 刷行左边树
  484 + resjtreeDate(id,params.directions);
433 485
434 - GetAjaxData.stationSave(stationParams,function(data) {  
435 -  
436 - if(data.status=='SUCCESS') {  
437 -  
438 - // 弹出添加成功提示消息  
439 - layer.msg('添加成功...');  
440 -  
441 - // 刷行左边树  
442 -  
443 - // 隐藏moble  
444 - hideMoble();  
445 -  
446 - }else {  
447 -  
448 - // 弹出添加失败提示消息  
449 - layer.msg('添加失败...');  
450 -  
451 - // 刷行左边树  
452 -  
453 - // 隐藏moble  
454 - hideMoble();  
455 -  
456 - }  
457 -  
458 -  
459 - }); 486 + linePanlThree(id,params.directions);
460 487
461 - });  
462 -  
463 -  
464 - }else if(shapesTypeValue == 'd') {  
465 -  
466 - // 圆形半径  
467 - stationParams.radius = 0;  
468 -  
469 - var centreArrray = params.points.split(' ');  
470 -  
471 - var centre = [{potion:{lng:centreArrray[0],lat:centreArrray[1]}}];  
472 -  
473 - var PointsList = [];  
474 -  
475 - for ( var i = 0; i < pointE.getPath().length; i++) { 488 + }else {
476 489
477 - PointsList.push({potion: {lng: pointE.getPath()[i].lng, lat: pointE.getPath()[i].lat}});  
478 -  
479 - }  
480 -  
481 - GetAjaxData.getFormPointEToWGS(PointsList,function(resultdata) { 490 + // 弹出添加失败提示消息
  491 + layer.msg('添加失败...');
482 492
483 - GetAjaxData.getFormPointEToWGS(centre,function(p) {  
484 -  
485 - stationParams.gLonx = p[0].WGSpotion.Lng;  
486 -  
487 - stationParams.gLaty = p[0].WGSpotion.Lat;  
488 -  
489 - var gPloygonGrid = '';  
490 -  
491 - var bPloygonGrid = '';  
492 -  
493 - for(var k =0;k<resultdata.length;k++) {  
494 -  
495 - if(k==0) {  
496 -  
497 - gPloygonGrid = resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat;  
498 -  
499 - bPloygonGrid = resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat;  
500 -  
501 - }else {  
502 -  
503 - gPloygonGrid = gPloygonGrid + ',' + resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat;  
504 -  
505 - bPloygonGrid = bPloygonGrid + ',' + resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat;  
506 -  
507 -  
508 -  
509 - }  
510 -  
511 - }  
512 -  
513 - stationParams.gPloygonGrid = 'POLYGON((' + gPloygonGrid + '))';  
514 -  
515 - stationParams.bPloygonGrid = 'POLYGON(('+ bPloygonGrid + '))';  
516 -  
517 - console.log(stationParams);  
518 -  
519 - GetAjaxData.stationSave(stationParams,function(data) {  
520 -  
521 - if(data.status=='SUCCESS') {  
522 -  
523 - // 弹出添加成功提示消息  
524 - layer.msg('添加成功...');  
525 -  
526 - // 刷行左边树  
527 -  
528 - // 隐藏moble  
529 - hideMoble();  
530 -  
531 - }else {  
532 -  
533 - // 弹出添加失败提示消息  
534 - layer.msg('添加失败...'); 493 + }
535 494
536 - // 刷行左边树  
537 -  
538 - // 隐藏moble  
539 - hideMoble();  
540 -  
541 - }  
542 -  
543 - });  
544 -  
545 - });  
546 -  
547 - }); 495 + // 隐藏moble
  496 + hideMoble();
548 497
549 - }  
550 -  
551 - 498 +
  499 + });
552 } 500 }
553 }); 501 });
554 502
src/main/resources/static/pages/base/stationroute/add_manual_select.html 0 → 100644
  1 +<!-- 手动规划线路站点方式 -->
  2 +<div class="modal fade" id="add_manual_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" 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 +
  25 + <div class="form-group">
  26 + <label class="col-md-3 control-label">手动规划方式:</label>
  27 + <div class="col-md-9">
  28 + <div class="icheck-list">
  29 + <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文件
  34 + </label>
  35 + </div>
  36 + </div>
  37 + </div>
  38 + </form>
  39 + </div>
  40 + <div class="modal-footer">
  41 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
  42 + <button type="button" class="btn btn-primary" id="addManualSelectnextButton">下一步</button>
  43 + </div>
  44 + </div>
  45 + </div>
  46 +</div>
  47 +<script type="text/javascript">
  48 +$(function(){
  49 +
  50 + $('#add_manual_mobal').modal({
  51 +
  52 + show : true,
  53 +
  54 + backdrop: 'static',
  55 +
  56 + keyboard: false
  57 +
  58 +
  59 + });
  60 +
  61 + $('.modal-footer #addManualSelectnextButton').on('click',function() {
  62 +
  63 + $('#add_manual_mobal').modal('hide');
  64 +
  65 + layer.msg('该功能正在开发过程中...请暂时使用系统规划');
  66 +
  67 + });
  68 +
  69 +});
  70 +</script>
0 \ No newline at end of file 71 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/add_select.html
1 -<!-- 新增选择站点 --> 1 +<!-- 选择站点新增方式 -->
2 <div class="modal fade" id="add_select_mobal" tabindex="-1" role="basic" aria-hidden="true"> 2 <div class="modal fade" id="add_select_mobal" tabindex="-1" role="basic" aria-hidden="true">
3 3
4 <div class="modal-dialog"> 4 <div class="modal-dialog">
@@ -7,31 +7,27 @@ @@ -7,31 +7,27 @@
7 7
8 <div class="modal-header"> 8 <div class="modal-header">
9 <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> 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 </div> 11 </div>
12 12
13 <div class="modal-body"> 13 <div class="modal-body">
14 14
15 <form class="form-horizontal" action="/" method="post" id="formBootbox" role="form"> 15 <form class="form-horizontal" action="/" method="post" id="formBootbox" role="form">
  16 +
16 <div class="alert alert-danger display-hide" id="requiredname"> 17 <div class="alert alert-danger display-hide" id="requiredname">
17 <button class="close" data-close="alert"></button> 18 <button class="close" data-close="alert"></button>
18 站点名称为必填项 19 站点名称为必填项
19 </div> 20 </div>
20 - <div class="alert alert-danger display-hide" id="serchrname">  
21 - <button class="close" data-close="alert"></button>  
22 - 系统无法生成,请选择其他方式新增  
23 - </div>  
24 -  
25 - <input type="hidden" name="stationPoint" id="stationPoint" />  
26 -  
27 21
  22 + <!-- 站点名称 -->
28 <div class="form-group" id="formRequ"> 23 <div class="form-group" id="formRequ">
29 <label class="col-md-3 control-label"><span class="required"> * </span>站点名称:</label> 24 <label class="col-md-3 control-label"><span class="required"> * </span>站点名称:</label>
30 - <div class="col-md-9" id="errorInfo"> 25 + <div class="col-md-9">
31 <input type="text" class="form-control input-medium" id="stationNamebootbox" name="stationNamebootbox"> 26 <input type="text" class="form-control input-medium" id="stationNamebootbox" name="stationNamebootbox">
32 </div> 27 </div>
33 </div> 28 </div>
34 29
  30 + <!-- 新增方式 -->
35 <div class="form-group"> 31 <div class="form-group">
36 <label class="col-md-3 control-label">新增方式:</label> 32 <label class="col-md-3 control-label">新增方式:</label>
37 <div class="col-md-9"> 33 <div class="col-md-9">
@@ -48,11 +44,20 @@ @@ -48,11 +44,20 @@
48 </div> 44 </div>
49 </div> 45 </div>
50 </div> 46 </div>
  47 +
  48 + <div class="form-group">
  49 + <div class="alert alert-info font-blue-chambray" style="background-color: #2C3E50">
  50 + <h5 class="block"><span class="help-block"> * 新增方式说明: </span></h5>
  51 + <p><span class="help-block"> a)系统生成:根据站点名称自动生成以300米为半径范围的圆.</span> </p>
  52 + <p><span class="help-block"> b)手动添加:手动在地图上画出站点范围,然后双击鼠标右键保存.</span> </p>
  53 + <p><span class="help-block"> c)选择引用:从系统中选择已有的站点进行引用.</span> </p>
  54 + </div>
  55 + </div>
51 </form> 56 </form>
52 </div> 57 </div>
53 <div class="modal-footer"> 58 <div class="modal-footer">
54 <button type="button" class="btn default" data-dismiss="modal">取消</button> 59 <button type="button" class="btn default" data-dismiss="modal">取消</button>
55 - <button type="button" class="btn btn-primary" id="nextButton">下一步</button> 60 + <button type="button" class="btn btn-primary" id="addSelectnextButton">下一步</button>
56 </div> 61 </div>
57 </div> 62 </div>
58 </div> 63 </div>
@@ -60,6 +65,7 @@ @@ -60,6 +65,7 @@
60 <script type="text/javascript"> 65 <script type="text/javascript">
61 $(function(){ 66 $(function(){
62 67
  68 + // 加载显示mobal
63 $('#add_select_mobal').modal({ 69 $('#add_select_mobal').modal({
64 70
65 show : true, 71 show : true,
@@ -71,18 +77,54 @@ $(function(){ @@ -71,18 +77,54 @@ $(function(){
71 77
72 }); 78 });
73 79
  80 + // 站点名称改变事件
  81 + $('#stationNamebootbox').on('change',function() {
  82 +
  83 + var stationNameV = $('#stationNamebootbox').val();
  84 +
  85 + WorldsBMap.localSearchFromAdreesToPoint(stationNameV,mapB,function(Points) {
  86 +
  87 + if(Points) {
  88 +
  89 + var BJwpointsArray = Points.split(' ');
  90 +
  91 + var stationNameChangePoint = new BMap.Point(BJwpointsArray[0], BJwpointsArray[1]);
  92 +
  93 + var marker_stargt2 = new BMap.Marker(stationNameChangePoint);
  94 +
  95 + var PanOptions ={noAnimation :true};
  96 +
  97 + mapB.panTo(stationNameChangePoint,PanOptions);
  98 +
  99 + mapB.panBy(0,100);
  100 +
  101 + // 将标注添加到地图中
  102 + mapB.addOverlay(marker_stargt2);
  103 +
  104 + //跳动的动画
  105 + marker_stargt2.setAnimation(BMAP_ANIMATION_BOUNCE);
  106 +
  107 + }
  108 +
  109 + });
  110 +
  111 + });
  112 +
  113 + // 获取表单元素
74 var form = $('#formBootbox'); 114 var form = $('#formBootbox');
75 115
  116 + // 错误提示元素
76 var requiredname = $('#requiredname', form); 117 var requiredname = $('#requiredname', form);
77 118
78 - //提交  
79 - $('#nextButton').on('click', function() { 119 + // 下一步点击事件
  120 + $('#addSelectnextButton').on('click', function() {
80 121
  122 + // 表单提交
81 form.submit(); 123 form.submit();
82 124
83 }); 125 });
84 126
85 - //form validate 127 + // 表单验证
86 form.validate({ 128 form.validate({
87 129
88 errorElement : 'span', 130 errorElement : 'span',
@@ -133,91 +175,118 @@ $(function(){ @@ -133,91 +175,118 @@ $(function(){
133 175
134 submitHandler : function(f) { 176 submitHandler : function(f) {
135 177
  178 + // 隐藏错误提示
  179 + requiredname.hide();
  180 +
  181 + // 表单序列化
136 var params = form.serializeJSON(); 182 var params = form.serializeJSON();
137 183
  184 + // 获取站点名称
138 var stationNamebootbox = params.stationNamebootbox; 185 var stationNamebootbox = params.stationNamebootbox;
139 186
  187 + // 获取新增站点方式
140 var baseRes = params.baseRes; 188 var baseRes = params.baseRes;
141 189
142 - if(baseRes == 0) { 190 + // 查询是否存在输入的站点名称
  191 + GetAjaxData.getLikeStationName(stationNamebootbox,function(data) {
143 192
144 - WorldsBMap.localSearchFromAdreesToPoint(stationNamebootbox,mapB,function(Points) {  
145 -  
146 - if(Points) {  
147 -  
148 - addStationNameValue = stationNamebootbox; 193 + // 站点名称
  194 + addStaitonParmas.stationNamebootbox = stationNamebootbox;
  195 +
  196 + // 系统生成
  197 + if(baseRes == 0) {
  198 +
  199 + // 验证系统是存在该站点名称
  200 + var tempblm = isHaveStationName(data);
  201 +
  202 + if(tempblm) {
149 203
150 - addSttationPoints = Points; 204 + WorldsBMap.localSearchFromAdreesToPoint(stationNamebootbox,mapB,function(Points) {
  205 +
  206 + if(Points) {
  207 +
  208 + var pointsArray = Points.split(' ');
  209 +
  210 + var paramCentre = [{potion:{lng:pointsArray[0],lat:pointsArray[1]}}];
  211 +
  212 + GetAjaxData.getFormPointEToWGS(paramCentre,function(p) {
  213 +
  214 + // 设置值
  215 + setFormInputValue(Points, p[0].WGSpotion.Lng,p[0].WGSpotion.Lat,'','','r',300);
  216 +
  217 + // 以藏站点新增方式mobal
  218 + $('#add_select_mobal').modal('hide');
  219 +
  220 + // 加载add页面
  221 + $.get('add.html', function(m){$(pjaxContainer).append(m);});
  222 +
  223 + });
  224 +
  225 + } else {
  226 +
  227 + // 返回坐标为空
  228 + layer.confirm('【系统无法生成,请选择其他方式新增】', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){
  229 +
  230 + layer.close(index);
  231 +
  232 + });
  233 +
  234 + }
  235 +
  236 + });
151 237
152 - requiredname.hide(); 238 + }
  239 +
  240 + // 手动添加
  241 + }else if(baseRes==1) {
  242 +
  243 + // 验证系统是存在该站点名称
  244 + var tempblm = isHaveStationName(data);
  245 +
  246 + if(tempblm) {
153 247
  248 + // 以藏站点新增方式mobal
154 $('#add_select_mobal').modal('hide'); 249 $('#add_select_mobal').modal('hide');
155 250
156 - polyType = 'r';  
157 -  
158 - $.get('add.html', function(m){$(pjaxContainer).append(m);}); 251 + status = 'add';
159 252
160 - } else { 253 + WorldsBMap.drawingManagerOpen();
161 254
162 - // 缺少ID  
163 - layer.confirm('【系统无法生成,请选择其他方式新增】', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){  
164 -  
165 - layer.close(index);  
166 -  
167 - });  
168 255
169 } 256 }
170 -  
171 - });  
172 -  
173 - }else if(baseRes==1) {  
174 -  
175 - // 手动添加  
176 -  
177 - addStationNameValue = stationNamebootbox;  
178 -  
179 - requiredname.hide();  
180 -  
181 - $('#add_select_mobal').modal('hide');  
182 -  
183 - drawingManager.open();  
184 -  
185 - drawingManager.setDrawingMode(BMAP_DRAWING_POLYGON);  
186 -  
187 - drawingManager.addEventListener('polygoncomplete', function(e) {  
188 -  
189 - if (e.getPath().length <= 2) {  
190 -  
191 - alert('坐标点不能小于等于两个');  
192 -  
193 - // 清除地图覆盖物  
194 -  
195 - map.clearOverlays();  
196 -  
197 - // 加载该线路下所有站点位置添加到地图上  
198 - return;  
199 - }  
200 -  
201 - pointE = e;  
202 -  
203 - polyType = 'd';  
204 -  
205 - addSttationPoints = pointE.getBounds().getCenter().lng+ ' ' + pointE.getBounds().getCenter().lat;  
206 -  
207 - $.get('add.html', function(m){$(pjaxContainer).append(m);});  
208 -  
209 - });  
210 -  
211 -  
212 - }else if(baseRes==2) { 257 +
  258 +
  259 + }else if(baseRes==2) {
  260 +
  261 + // 系统引用
  262 +
  263 + $('#add_select_mobal').modal('hide');
  264 +
  265 + $.get('station_tabledate.html', function(m){$(pjaxContainer).append(m);});
  266 + }
  267 + });
  268 + }
  269 + });
  270 +
  271 + function isHaveStationName(data) {
  272 +
  273 + if(data.length>0) {
  274 +
  275 + layer.confirm('系统已存在【'+ data[0].stationName +'】该站点位置名称,请选择【系统引用】或者更改站点名称进行新增!', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){
213 276
214 - // 系统引用 277 + layer.close(index);
215 278
216 - } 279 + });
  280 +
  281 + return false;
  282 +
  283 + }else {
  284 +
  285 + return true;
217 286
218 -  
219 } 287 }
220 - }); 288 +
  289 + }
221 290
222 }); 291 });
223 </script> 292 </script>
224 \ No newline at end of file 293 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/css/bmap_base.css
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 overflow: hidden; 7 overflow: hidden;
8 } 8 }
9 9
10 -body{ 10 +html,body{
11 overflow:hidden; 11 overflow:hidden;
12 } 12 }
13 13
@@ -38,4 +38,52 @@ body{ @@ -38,4 +38,52 @@ body{
38 border:0px solid; 38 border:0px solid;
39 39
40 box-shadow: 0 12px 15px 0 rgba(204, 204, 204, 0.33),0 17px 50px 0 rgba(204, 204, 204, 0.33); 40 box-shadow: 0 12px 15px 0 rgba(204, 204, 204, 0.33),0 17px 50px 0 rgba(204, 204, 204, 0.33);
  41 +}
  42 +
  43 +.BMap_pop div:nth-child(1) ,
  44 +.BMap_pop div:nth-child(2) ,
  45 +.BMap_pop div:nth-child(3) ,
  46 +.BMap_pop div:nth-child(4) ,
  47 +.BMap_pop div:nth-child(5) ,
  48 +.BMap_pop div:nth-child(6) ,
  49 +.BMap_pop div:nth-child(7) {
  50 +
  51 + border:0px solid rgb(255, 255, 255) !important;
  52 + background-color:#3B3F51 !important;
  53 +
  54 +}
  55 +
  56 +.BMap_pop div:nth-child(3){
  57 +
  58 + width:23px !important;
  59 +
  60 +}
  61 +
  62 +.BMap_pop div:nth-child(7) {
  63 +
  64 + width:23px !important;
  65 +
  66 + height:24px !important;
  67 +
  68 +}
  69 +
  70 +.BMap_pop div:nth-child(5) {
  71 +
  72 + height:24px !important;
  73 +
  74 +}
  75 +
  76 +/* 图片以后在弄,先隐藏div */
  77 +.BMap_pop div:nth-child(8) {
  78 +
  79 + height:0px !important;
  80 + /* background:url('/pages/base/stationroute/css/img/iw3-1.png') no-repeat !important; */
  81 + /* background-image:url('/pages/base/stationroute/css/img/windowinfo_b.jpg') !important; */
  82 +
  83 +}
  84 +
  85 +.BMap_pop {
  86 +
  87 + box-shadow: 0 12px 15px 0 rgba(204, 204, 204, 0.33),0 17px 50px 0 rgba(204, 204, 204, 0.33)!important;
  88 +
41 } 89 }
42 \ No newline at end of file 90 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/edit.html
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 7
8 <div class="modal-header"> 8 <div class="modal-header">
9 <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> 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 </div> 11 </div>
12 12
13 <div class="modal-body"> 13 <div class="modal-body">
@@ -18,14 +18,59 @@ @@ -18,14 +18,59 @@
18 您的输入有误,请检查下面的输入项 18 您的输入有误,请检查下面的输入项
19 </div> 19 </div>
20 20
  21 + <!-- 线路ID -->
  22 +
  23 + <input type="hidden" name="stationId" id="stationIdInput">
  24 +
  25 + <input type="hidden" name="stationRouteId" id="stationRouteIdInput">
  26 +
  27 + <input type="hidden" name="stationRouteLine" id="stationRouteLineInput">
  28 +
  29 + <input type="hidden" name="lineCode" id="lineCodeInput">
  30 +
  31 + <input type="hidden" name="bPolygonGrid" id="bPolygonGridInput" />
  32 +
  33 + <input type="hidden" name="gPolygonGrid" id="gPolygonGridInput" />
  34 +
  35 + <input type="hidden" name="dbType" id="dbTypeInput" value="b"/>
  36 +
  37 + <input type="hidden" name="x" id="xInput" value=""/>
  38 +
  39 + <input type="hidden" name="y" id="yInput" value=""/>
  40 +
21 <!-- 站点名称 --> 41 <!-- 站点名称 -->
22 <div class="form-body"> 42 <div class="form-body">
23 <div class="form-group"> 43 <div class="form-group">
24 <label class="control-label col-md-3"> 44 <label class="control-label col-md-3">
25 - <span class="required"> * </span>站点名称: 45 + <span class="required"> * </span> 站点名称:
  46 + </label>
  47 + <div class="col-md-6">
  48 + <input type="text" class="form-control" name="stationName" id="stationNameInput" placeholder="站点名称">
  49 + </div>
  50 + </div>
  51 + </div>
  52 +
  53 + <!-- 站点编码 -->
  54 + <div class="form-body">
  55 + <div class="form-group">
  56 + <label class="control-label col-md-3">
  57 + <span class="required"> * </span>站点编码:
  58 + </label>
  59 + <div class="col-md-6">
  60 + <input type="text" class="form-control" name="stationCod" id="stationCodInput" placeholder="站点编码">
  61 + </div>
  62 + </div>
  63 + </div>
  64 +
  65 + <!-- 站点序号 -->
  66 + <div class="form-body">
  67 + <div class="form-group">
  68 + <label class="control-label col-md-3">
  69 + <span class="required"> * </span>上一站点:
26 </label> 70 </label>
27 - <div class="col-md-9">  
28 - <input type="text" class="form-control input-medium" name="stationName" id="stationNameInput" placeholder="站点名称"> 71 + <div class="col-md-6">
  72 + <select name="stationRouteCode" class="form-control" id="stationrouteSelect"></select>
  73 + <span class="help-block"> *说明:选择的站点将作为本站序号的参考,成为选择站点的下一站。 </span>
29 </div> 74 </div>
30 </div> 75 </div>
31 </div> 76 </div>
@@ -36,72 +81,130 @@ @@ -36,72 +81,130 @@
36 <label class="control-label col-md-3"> 81 <label class="control-label col-md-3">
37 <span class="required"> * </span>站点类型: 82 <span class="required"> * </span>站点类型:
38 </label> 83 </label>
39 - <div class="col-md-9">  
40 - <select name="stationMark" class="form-control input-medium" id="stationMarkSelect"> 84 + <div class="col-md-6">
  85 + <select name="stationMark" class="form-control" id="stationMarkSelect">
41 <option value="">-- 请选择站点类型 --</option> 86 <option value="">-- 请选择站点类型 --</option>
42 <option value="B">起点站</option> 87 <option value="B">起点站</option>
43 <option value="Z">中途站</option> 88 <option value="Z">中途站</option>
44 <option value="E">终点站</option> 89 <option value="E">终点站</option>
45 - <option value="T">停车场</option> 90 + <!-- <option value="T">停车场</option> -->
46 </select> 91 </select>
47 </div> 92 </div>
48 </div> 93 </div>
49 </div> 94 </div>
50 95
  96 + <!-- 站点方向 -->
51 <div class="form-body"> 97 <div class="form-body">
52 <div class="form-group"> 98 <div class="form-group">
53 <label class="control-label col-md-3"> 99 <label class="control-label col-md-3">
54 - <span class="required"> * </span>站点序号 100 + <span class="required"> * </span>站点方向
55 </label> 101 </label>
56 - <div class="col-md-9">  
57 - <select name="stationRouteCode" class="form-control input-medium" id="stationRouteCodeSelect"></select> 102 + <div class="col-md-6">
  103 + <select name="directions" class="form-control" id="stationdirSelect">
  104 + <option value="">-- 请选择站点类型 --</option>
  105 + <option value="0">上行</option>
  106 + <option value="1">下行</option>
  107 + </select>
58 </div> 108 </div>
59 </div> 109 </div>
60 </div> 110 </div>
61 111
  112 + <!-- 道路编码-->
62 <div class="form-body"> 113 <div class="form-body">
63 <div class="form-group"> 114 <div class="form-group">
64 - <label class="control-label col-md-3">  
65 - <span class="required"> * </span>站点编码:  
66 - </label>  
67 - <div class="col-md-9">  
68 - <input type="text" class="form-control input-medium" name="name" > 115 + <label class="control-label col-md-3">道路编码:</label>
  116 + <div class="col-md-6">
  117 + <input type="text" class="form-control" name="roadCoding" id="roadCodingCodInput" placeholder="道路编码">
69 </div> 118 </div>
70 </div> 119 </div>
71 </div> 120 </div>
72 121
  122 + <!-- 中心位置坐标点 -->
73 <div class="form-body"> 123 <div class="form-body">
74 <div class="form-group"> 124 <div class="form-group">
75 - <label class="col-md-3 control-label">站点方向</label>  
76 - <div class="col-md-9">  
77 - <input type="text" class="form-control input-medium" name="name" > 125 + <label class="col-md-3 control-label">经纬度坐标点:</label>
  126 + <div class="col-md-6">
  127 + <input type="text" class="form-control" name="bJwpoints" id="bJwpointsInput" placeholder="经纬度坐标点">
  128 + </div>
  129 + </div>
  130 + </div>
  131 +
  132 + <!-- 站点WGS经纬度 -->
  133 + <div class="form-body">
  134 + <div class="form-group">
  135 + <label class="col-md-3 control-label">站点WGS经纬度:</label>
  136 + <div class="col-md-6">
  137 + <input type="text" class="form-control" name="gJwpoints" id="gJwpointsInput" placeholder="站点WGS经纬度">
  138 + </div>
  139 + </div>
  140 + </div>
  141 +
  142 + <!-- 范围图形类型 -->
  143 + <div class="form-body">
  144 + <div class="form-group">
  145 + <label class="col-md-3 control-label">范围图形类型:</label>
  146 + <div class="col-md-6">
  147 + <select name="shapesType" class="form-control" id="shapesTypeSelect">
  148 + <option value="">-- 请选择站点类型 --</option>
  149 + <option value="r">圆形</option>
  150 + <option value="d">多变形</option>
  151 + </select>
78 </div> 152 </div>
79 </div> 153 </div>
80 </div> 154 </div>
81 155
  156 + <!-- 范围图形类型 -->
82 <div class="form-body"> 157 <div class="form-body">
83 <div class="form-group"> 158 <div class="form-group">
84 - <label class="col-md-3 control-label">到站时间</label>  
85 - <div class="col-md-9">  
86 - <input type="text" class="form-control input-medium" name="name" > 159 + <label class="col-md-3 control-label">圆形半径:</label>
  160 + <div class="col-md-6">
  161 + <input type="text" class="form-control" name="radius" id="radiusInput" placeholder="圆形半径">
87 </div> 162 </div>
88 </div> 163 </div>
89 </div> 164 </div>
90 165
  166 + <!-- 到站时间 -->
91 <div class="form-body"> 167 <div class="form-body">
92 <div class="form-group"> 168 <div class="form-group">
93 - <label class="col-md-3 control-label">到站距离</label>  
94 - <div class="col-md-9">  
95 - <input type="text" class="form-control input-medium" name="name" > 169 + <label class="col-md-3 control-label">到站时间:</label>
  170 + <div class="col-md-6">
  171 + <input type="text" class="form-control" name="toTime" id="toTimeInput" placeholder="到站时间">
  172 + <span class="help-block">单位:分钟</span>
96 </div> 173 </div>
97 </div> 174 </div>
98 </div> 175 </div>
99 176
  177 + <!-- 到站距离 -->
100 <div class="form-body"> 178 <div class="form-body">
101 <div class="form-group"> 179 <div class="form-group">
102 - <label class="col-md-3 control-label">版本号</label>  
103 - <div class="col-md-9">  
104 - <input type="text" class="form-control input-medium" name="name" > 180 + <label class="col-md-3 control-label">到站距离:</label>
  181 + <div class="col-md-6">
  182 + <input type="text" class="form-control" name="distances" id="distancesInput" placeholder="到站距离">
  183 + <span class="help-block">单位:公里</span>
  184 + </div>
  185 + </div>
  186 + </div>
  187 +
  188 + <!-- 版本号 -->
  189 + <div class="form-body">
  190 + <div class="form-group">
  191 + <label class="col-md-3 control-label">版本号:</label>
  192 + <div class="col-md-6">
  193 + <input type="text" class="form-control" name="versions" value='1' Readonly>
  194 + </div>
  195 + </div>
  196 + </div>
  197 +
  198 + <!-- 范围图形类型 -->
  199 + <div class="form-body">
  200 + <div class="form-group">
  201 + <label class="col-md-3 control-label">是否撤销:</label>
  202 + <div class="col-md-6">
  203 + <select name="destroy" class="form-control" id="destroySelect">
  204 + <option value="">-- 请选择撤销类型 --</option>
  205 + <option value="0">否</option>
  206 + <option value="1">是</option>
  207 + </select>
105 </div> 208 </div>
106 </div> 209 </div>
107 </div> 210 </div>
@@ -109,17 +212,15 @@ @@ -109,17 +212,15 @@
109 <!-- 描述/说明 --> 212 <!-- 描述/说明 -->
110 <div class="form-group"> 213 <div class="form-group">
111 <label class="control-label col-md-3"> 描述/说明: </label> 214 <label class="control-label col-md-3"> 描述/说明: </label>
112 - <div class="col-md-4">  
113 - <textarea class="form-control input-medium" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea> 215 + <div class="col-md-6">
  216 + <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea>
114 </div> 217 </div>
115 </div> 218 </div>
116 -  
117 -  
118 </form> 219 </form>
119 </div> 220 </div>
120 <div class="modal-footer"> 221 <div class="modal-footer">
121 <button type="button" class="btn default" data-dismiss="modal">取消</button> 222 <button type="button" class="btn default" data-dismiss="modal">取消</button>
122 - <button type="button" class="btn btn-primary" id="addStationButton">提交数据</button> 223 + <button type="button" class="btn btn-primary" id="editStationButton">提交数据</button>
123 </div> 224 </div>
124 </div> 225 </div>
125 </div> 226 </div>
@@ -127,36 +228,147 @@ @@ -127,36 +228,147 @@
127 <script type="text/javascript"> 228 <script type="text/javascript">
128 $(function(){ 229 $(function(){
129 230
130 - //写入表单数据 231 + console.log(editStationParmas);
131 232
132 - /* var sel = getCurrSelNode(); 233 + function setFormValue() {
  234 +
  235 + // 站点ID
  236 + $('#stationIdInput').val(editStationParmas.editUp_stationId);
  237 +
  238 + // 站点路由ID
  239 + $('#stationRouteIdInput').val(editStationParmas.stationRouteId);
  240 +
  241 + // 站点路由线路Id
  242 + $('#stationRouteLineInput').val(editStationParmas.stationRouteLine);
  243 +
  244 + // 线路编码
  245 + $('#lineCodeInput').val(editStationParmas.stationRouteLineCode);
  246 +
  247 + // WGS坐标点图形集合
  248 + $('#bPolygonGridInput').val(editStationParmas.bPolygonGridInput);
  249 +
  250 + // 百度坐标点图形集合
  251 + $('#gPolygonGridInput').val(editStationParmas.gPolygonGridInput);
  252 +
  253 + // 获取站点名称元素设值
  254 + $('#stationNameInput').val(editStationParmas.stationNamebootbox);
  255 +
  256 + // 获取站点编码元素设值
  257 + $('#stationCodInput').val(editStationParmas.editUp_stationStationCod);
  258 +
  259 + // 获取站点类型元素设值
  260 + $('#stationMarkSelect').val(editStationParmas.stationRouteStationMark);
  261 +
  262 + // 获取站点方向元素设值
  263 + $('#stationdirSelect').val(editStationParmas.stationRouteDirections);
  264 +
  265 + // 获取站点道路编码元素设值
  266 + $('#roadCodingCodInput').val(editStationParmas.stationRoadCoding);
  267 +
  268 + // 百度地图经纬度坐标中心点
  269 + $('#bJwpointsInput').val(editStationParmas.stationPointInput);
  270 +
  271 + // WGS经纬度
  272 + $('#gJwpointsInput').val(editStationParmas.gLonx + ' ' + editStationParmas.gLaty);
  273 +
  274 + // 获取图形类型元素,并添加值
  275 + $('#shapesTypeSelect').val(editStationParmas.shapesTypeInput);
  276 +
  277 + // 获取方向元素,并添加值
  278 + $('#stationdirSelect').val(editStationParmas.stationRouteDirections);
  279 +
  280 + // 获取半径元素,并添加值
  281 + $('#radiusInput').val(editStationParmas.radiusInput);
  282 +
  283 + // 是否撤销
  284 + $('#destroySelect').val(editStationParmas.destroyInput);
  285 +
  286 + // 到站时间
  287 + $('#toTimeInput').val(editStationParmas.stationRouteToTime);
  288 +
  289 + // 到站距离
  290 + $('#distancesInput').val(editStationParmas.stationRouteToTime);
  291 +
  292 + // 描述/说明
  293 + $('#descriptionsTextarea').val(editStationParmas.stationRouteDescriptions);
  294 +
  295 + }
133 296
134 - if(sel.length > 0){ 297 + setFormValue();
  298 +
  299 + // 获取站点序号元素,并添加下拉属性值
  300 + GetAjaxData.getStation(id,dir,function(treeData) {
135 301
136 - //drawFormData(sel[0].original, '#group_edit_form'); 302 + var options = '<option value="">请选择...</option>';
137 303
138 - }else { 304 + var dArray = treeData[0].children[0].children;
139 305
140 - alert('没有选择节点...'); 306 + var eq_stationRouteCode = editStationParmas.stationRouteStationRouteCode + '_' +editStationParmas.stationRouteStationMark;
  307 +
  308 + for(var i = 0 ; i<dArray.length; i++){
  309 +
  310 + var ptions_v = dArray[i].stationRouteStationRouteCode+ '_'+ dArray[i].stationRouteStationMark;
  311 +
  312 + // 排除本站
  313 + if(eq_stationRouteCode == ptions_v){
  314 +
  315 + continue;
  316 +
  317 + }
  318 +
  319 + options += '<option value="'+ ptions_v +'">'+dArray[i].stationRouteStationName+'</option>'
  320 +
  321 + }
  322 +
  323 + $('#stationrouteSelect').html(options);
  324 +
  325 + GetAjaxData.findUpStationRouteCode(id,dir,editStationParmas.stationRouteStationRouteCode,function(str) {
  326 +
  327 + if(str.length>0){
  328 +
  329 + var upStationRouteCode = str[0].stationRouteCode + '_' + str[0].stationRouteMarke;
  330 +
  331 + $('#stationrouteSelect').val(upStationRouteCode);
  332 +
  333 + }
  334 +
  335 + });
141 336
142 - } */  
143 337
  338 + });
144 339
145 - $('#edit_station_mobal').modal('show'); 340 + // 显示mobal
  341 + $('#edit_station_mobal').modal({show : true,backdrop: 'static',keyboard: false});
146 342
  343 + // 当调用 hide 实例方法时触发
  344 + $('#edit_station_mobal').on('hide.bs.modal', function () {
  345 +
  346 + var diractionV = $('#stationdirSelect').val();
  347 +
  348 + linePanlThree(id,diractionV);
  349 +
  350 + editStationParmas = {};
  351 +
  352 + mapB.clearOverlays();
  353 +
  354 + });
  355 +
  356 +
  357 + // 编辑表单元素
147 var form = $('#edit_station_form'); 358 var form = $('#edit_station_form');
148 359
  360 + // 获取错误提示元素
149 var error = $('.alert-danger', form); 361 var error = $('.alert-danger', form);
150 362
151 -  
152 - //提交  
153 - $('#editGroupModuleButton').on('click', function() { 363 + // 提交数据按钮事件
  364 + $('#editStationButton').on('click', function() {
154 365
  366 + // 表单提交
155 form.submit(); 367 form.submit();
156 368
157 }); 369 });
158 370
159 - //form validate 371 + // 表单验证
160 form.validate({ 372 form.validate({
161 373
162 errorElement : 'span', 374 errorElement : 'span',
@@ -167,16 +379,74 @@ $(function(){ @@ -167,16 +379,74 @@ $(function(){
167 379
168 rules : { 380 rules : {
169 381
170 - name : { 382 + // 站点名称
  383 + 'stationName' : {
  384 +
  385 + // 必填项
  386 + required : true
171 387
172 - minlength : 2, 388 + },
  389 +
  390 + // 站点类型
  391 + 'stationMark' : {
173 392
  393 + // 必填项
  394 + required : true
  395 +
  396 + },
  397 +
  398 + // 站点序号
  399 + 'stationRouteCode' : {
  400 +
  401 + isStart : true
  402 +
  403 + },
  404 +
  405 + // 站点编码
  406 + 'stationCod': {
  407 +
  408 + // 必填项
174 required : true, 409 required : true,
175 410
176 - maxlength : 10 411 + // 必须输入合法的数字(负数,小数)。
  412 + number : true
  413 +
  414 + },
  415 +
  416 + // 站点方向
  417 + 'directions' : {
  418 +
  419 + // 必填项
  420 + required : true,
  421 +
  422 + // 方向选择限制
  423 + dirIs : true
  424 +
  425 + },
  426 +
  427 + // 到站距离
  428 + 'distances' : {
  429 +
  430 + // 必须输入合法的数字(负数,小数)。
  431 + number : true
  432 +
  433 + },
  434 +
  435 + // 到站时间
  436 + 'toTime' : {
  437 +
  438 + // 必须输入合法的数字(负数,小数)。
  439 + number : true
  440 +
  441 + },
  442 +
  443 + // 描述与说明
  444 + 'descriptions' : {
  445 +
  446 + // 最大长度
  447 + maxlength: 150
177 448
178 } 449 }
179 -  
180 }, 450 },
181 451
182 invalidHandler : function(event, validator) { 452 invalidHandler : function(event, validator) {
@@ -211,28 +481,104 @@ $(function(){ @@ -211,28 +481,104 @@ $(function(){
211 481
212 error.hide(); 482 error.hide();
213 483
214 - $post('/module', params, function(res){  
215 -  
216 - layer.msg('修改分组成功.'); 484 + GetAjaxData.stationUpdate(params,function(resuntDate) {
217 485
218 - refreshJsTree(); 486 + if(resuntDate.status=='SUCCESS') {
  487 +
  488 + // 弹出添加成功提示消息
  489 + layer.msg('修改成功...');
  490 +
  491 + // 刷行左边树
  492 + resjtreeDate(id,params.directions);
  493 +
  494 + linePanlThree(id,params.directions);
  495 +
  496 + }else {
  497 +
  498 + // 弹出添加失败提示消息
  499 + layer.msg('修改失败...');
  500 +
  501 + }
219 502
220 $('#edit_station_mobal').modal('hide'); 503 $('#edit_station_mobal').modal('hide');
221 504
222 }); 505 });
  506 +
223 } 507 }
224 }); 508 });
225 509
226 - //将数据写入表单  
227 - function drawFormData(json, fId){  
228 - json.enable = json.enable==true? 1 : 0;  
229 - for(var att in json){  
230 - var f = 'name=' +att  
231 - ,elem = $('input['+f+'],select['+f+']', fId);  
232 - if(elem.length > 0){  
233 - elem.val(json[att]).change(); 510 + // 站点序号值改变事件
  511 + $('#stationrouteSelect').on('change',function() {
  512 +
  513 + var stationRValue = $('#stationrouteSelect').val();
  514 +
  515 + if(stationRValue) {
  516 +
  517 + var tempStr = stationRValue.split('_');
  518 +
  519 + console.log(tempStr);
  520 +
  521 + if(tempStr[1] == 'E') {
  522 +
  523 + $('#stationMarkSelect').val('E');
  524 +
  525 + }else {
  526 +
  527 + $('#stationMarkSelect').val('Z');
  528 +
234 } 529 }
  530 +
235 } 531 }
236 - } 532 +
  533 + });
  534 +
  535 +
  536 + // 当站点类型为中途站或者终点站时,上一站点为必填项!
  537 + $.validator.addMethod("isStart", function(value,element) {
  538 +
  539 + var tel = false;
  540 +
  541 + var stationMarkV = $('#stationMarkSelect').val();
  542 +
  543 + var stationrouteSelectV = $('#stationrouteSelect').val();
  544 +
  545 + if(stationMarkV =='B'){
  546 +
  547 + tel = true;
  548 +
  549 + return tel;
  550 +
  551 + }else if(stationMarkV =='Z' || stationMarkV =='E'){
  552 +
  553 +
  554 + if(stationrouteSelectV!=''){
  555 +
  556 + tel = true;
  557 +
  558 + return tel;
  559 +
  560 + }
  561 +
  562 + }
  563 +
  564 + return tel;
  565 + }, '当站点类型为中途站或者终点站时,上一站点为必填项!');
  566 +
  567 + // 方向
  568 + $.validator.addMethod("dirIs", function(value,element) {
  569 +
  570 + var tel = true;
  571 +
  572 + var stationMarkV = $('#stationdirSelect').val();
  573 +
  574 + if(stationMarkV!=editStationParmas.stationRouteDirections){
  575 +
  576 + tel = false;
  577 +
  578 + }
  579 +
  580 + return tel;
  581 + }, '方向必须一致!');
  582 +
237 }); 583 });
238 </script> 584 </script>
239 \ No newline at end of file 585 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/edit_select.html
@@ -7,24 +7,23 @@ @@ -7,24 +7,23 @@
7 7
8 <div class="modal-header"> 8 <div class="modal-header">
9 <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> 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 </div> 11 </div>
12 12
13 <div class="modal-body"> 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"> 15 + <form class="form-horizontal" action="/" method="post" id="edit_select" role="form">
  16 +
  17 + <div class="alert alert-danger display-hide" id="editSelectrequired">
17 <button class="close" data-close="alert"></button> 18 <button class="close" data-close="alert"></button>
18 站点名称为必填项 19 站点名称为必填项
19 </div> 20 </div>
  21 +
20 <div class="alert alert-danger display-hide" id="serchrname"> 22 <div class="alert alert-danger display-hide" id="serchrname">
21 <button class="close" data-close="alert"></button> 23 <button class="close" data-close="alert"></button>
22 系统无法生成,请选择其他方式新增 24 系统无法生成,请选择其他方式新增
23 </div> 25 </div>
24 26
25 - <input type="hidden" name="stationPoint" id="stationPoint" />  
26 -  
27 -  
28 <div class="form-group" id="formRequ"> 27 <div class="form-group" id="formRequ">
29 <label class="col-md-3 control-label"><span class="required"> * </span>站点名称:</label> 28 <label class="col-md-3 control-label"><span class="required"> * </span>站点名称:</label>
30 <div class="col-md-9" id="errorInfo"> 29 <div class="col-md-9" id="errorInfo">
@@ -33,53 +32,72 @@ @@ -33,53 +32,72 @@
33 </div> 32 </div>
34 33
35 <div class="form-group"> 34 <div class="form-group">
36 - <label class="col-md-3 control-label">新增方式:</label> 35 + <label class="col-md-3 control-label">修改方式:</label>
37 <div class="col-md-9"> 36 <div class="col-md-9">
38 <div class="icheck-list"> 37 <div class="icheck-list">
39 <label> 38 <label>
40 - <input type="radio" class="icheck" name="baseRes" value=0 checked> 重新编辑 39 + <input type="radio" class="icheck" name="editselect" value=0> 手动规划
  40 + </label>
  41 + <label>
  42 + <input type="radio" class="icheck" name="editselect" value=1 checked> 重新编辑
41 </label> 43 </label>
42 <label > 44 <label >
43 - <input type="radio" class="icheck" name="baseRes" value=1 > 选择更换 45 + <input type="radio" class="icheck" name="editselect" value=2 > 选择引用
44 </label> 46 </label>
45 </div> 47 </div>
46 </div> 48 </div>
47 </div> 49 </div>
  50 + <div class="form-group">
  51 + <div class="alert alert-info font-blue-chambray" style="background-color: #2C3E50">
  52 + <h5 class="block"><span class="help-block"> * 修改方式说明: </span></h5>
  53 + <p><span class="help-block"> a)手动添加:手动在地图上画出站点范围,然后双击鼠标右键保存.</span> </p>
  54 + <p><span class="help-block"> b)重新编辑:编辑原始位置与站点信息.</span> </p>
  55 + <p><span class="help-block"> c)选择引用:从系统中选择已有的站点进行引用.</span> </p>
  56 + </div>
  57 + </div>
48 </form> 58 </form>
49 </div> 59 </div>
50 <div class="modal-footer"> 60 <div class="modal-footer">
51 <button type="button" class="btn default" data-dismiss="modal">取消</button> 61 <button type="button" class="btn default" data-dismiss="modal">取消</button>
52 - <button type="button" class="btn btn-primary" id="nextButton">下一步</button> 62 + <button type="button" class="btn btn-primary" id="editselectStationNextButton">下一步</button>
53 </div> 63 </div>
54 </div> 64 </div>
55 </div> 65 </div>
56 </div> 66 </div>
57 <script type="text/javascript"> 67 <script type="text/javascript">
  68 +
58 $(function(){ 69 $(function(){
59 70
60 - $('#edit_select_mobal').modal({  
61 -  
62 - show : true,  
63 -  
64 - backdrop: 'static',  
65 -  
66 - keyboard: false  
67 -  
68 -  
69 - }); 71 + // 显示选择修改方式弹出层
  72 + $('#edit_select_mobal').modal({show : true,backdrop: 'static',keyboard: false});
  73 +
  74 + // 获取选中站点
  75 + var sel = getCurrSelNode(dir);
70 76
71 - var form = $('#formBootbox'); 77 + // 设值修改时的参数集合
  78 + editSetStationParmas(sel);
72 79
73 - var requiredname = $('#requiredname', form); 80 + // 获取站点名称元素并赋值
  81 + $('#stationNamebootbox').val(sel[0].original.stationStationName);
74 82
75 - //提交  
76 - $('#nextButton').on('click', function() { 83 + // 定义站点图形
  84 + var stationShapesTypeV = sel[0].original.stationShapesType;
  85 +
  86 + // 获取表单元素
  87 + var form = $('#edit_select');
  88 +
  89 + // 获取错误提示元素
  90 + var editSelectrequired = $('#editSelectrequired', form);
  91 +
  92 + // 下一步操作事件
  93 + $('#editselectStationNextButton').on('click', function() {
77 94
  95 + // 表单提交
78 form.submit(); 96 form.submit();
79 97
80 }); 98 });
81 99
82 - //form validate 100 + //form 表单验证
83 form.validate({ 101 form.validate({
84 102
85 errorElement : 'span', 103 errorElement : 'span',
@@ -104,7 +122,7 @@ $(function(){ @@ -104,7 +122,7 @@ $(function(){
104 122
105 invalidHandler : function(event, validator) { 123 invalidHandler : function(event, validator) {
106 124
107 - requiredname.show(); 125 + editSelectrequired.show();
108 126
109 App.scrollTo(requiredname, -200); 127 App.scrollTo(requiredname, -200);
110 128
@@ -130,89 +148,43 @@ $(function(){ @@ -130,89 +148,43 @@ $(function(){
130 148
131 submitHandler : function(f) { 149 submitHandler : function(f) {
132 150
  151 + // 隐藏弹出层
  152 + $('#edit_select_mobal').modal('hide');
  153 +
  154 + // 表单序列
133 var params = form.serializeJSON(); 155 var params = form.serializeJSON();
134 156
135 - var stationNamebootbox = params.stationNamebootbox;  
136 -  
137 - var baseRes = params.baseRes;  
138 -  
139 - if(baseRes == 0) {  
140 -  
141 - WorldsBMap.localSearchFromAdreesToPoint(stationNamebootbox,mapB,function(Points) {  
142 -  
143 - if(Points) {  
144 -  
145 - addStationNameValue = stationNamebootbox;  
146 -  
147 - addSttationPoints = Points;  
148 -  
149 - requiredname.hide();  
150 -  
151 - $('#add_select_mobal').modal('hide');  
152 -  
153 - polyType = 'r';  
154 -  
155 - $.get('add.html', function(m){$(pjaxContainer).append(m);});  
156 -  
157 - } else {  
158 -  
159 - // 缺少ID  
160 - layer.confirm('【系统无法生成,请选择其他方式新增】', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){  
161 -  
162 - layer.close(index);  
163 -  
164 - });  
165 -  
166 - }  
167 -  
168 - });  
169 -  
170 - }else if(baseRes==1) {  
171 -  
172 - // 手动添加  
173 -  
174 - addStationNameValue = stationNamebootbox;  
175 -  
176 - requiredname.hide();  
177 -  
178 - $('#add_select_mobal').modal('hide');  
179 -  
180 - drawingManager.open();  
181 -  
182 - drawingManager.setDrawingMode(BMAP_DRAWING_POLYGON);  
183 -  
184 - drawingManager.addEventListener('polygoncomplete', function(e) {  
185 -  
186 - if (e.getPath().length <= 2) {  
187 -  
188 - alert('坐标点不能小于等于两个');  
189 -  
190 - // 清除地图覆盖物  
191 -  
192 - map.clearOverlays();  
193 -  
194 - // 加载该线路下所有站点位置添加到地图上  
195 - return;  
196 - }  
197 -  
198 - pointE = e;  
199 -  
200 - polyType = 'd';  
201 -  
202 - addSttationPoints = pointE.getBounds().getCenter().lng+ ' ' + pointE.getBounds().getCenter().lat;  
203 -  
204 - $.get('add.html', function(m){$(pjaxContainer).append(m);});  
205 -  
206 - });  
207 -  
208 -  
209 - }else if(baseRes==2) {  
210 -  
211 - // 系统引用 157 + // 站点名称
  158 + var editStationName = params.stationNamebootbox;
  159 +
  160 + if(params.editselect==0){
  161 +
  162 + status = 'edit';
  163 +
  164 + // 站点名称
  165 + editStationParmas.stationNamebootbox = editStationName;
  166 +
  167 + WorldsBMap.drawingManagerOpen();
  168 +
  169 +
  170 + }else if(params.editselect==1){
  171 +
  172 + // 弹出添加失败提示消息,2秒关闭(如果不配置,默认是3秒)
  173 + var mindex = layer.msg('编辑完图形后,请双击图形区域保存',{ offset: '126px',
  174 + shift: 0,time: 10000});
  175 +
  176 + WorldsBMap.coloseWindowsInfo(editStationName,stationShapesTypeV,mindex);
  177 +
  178 + }else if(params.editselect==2){
  179 +
  180 + // 系统引用
  181 + $('#edit_select_mobal').modal('hide');
  182 +
  183 + $.get('station_tabledate.html', function(m){$(pjaxContainer).append(m);});
  184 +
212 185
213 } 186 }
214 187
215 -  
216 } 188 }
217 }); 189 });
218 190
src/main/resources/static/pages/base/stationroute/js/stationroute-ajax-getdata.js
@@ -8,7 +8,7 @@ var GetAjaxData = function(){ @@ -8,7 +8,7 @@ var GetAjaxData = function(){
8 var treeDateJson = []; 8 var treeDateJson = [];
9 9
10 $get('/stationroute/findStations',{'line.id_eq' : id_ , 'directions_eq' : dir_},function(resultdata) { 10 $get('/stationroute/findStations',{'line.id_eq' : id_ , 'directions_eq' : dir_},function(resultdata) {
11 - 11 +
12 treeDateJson = createTreeData(resultdata); 12 treeDateJson = createTreeData(resultdata);
13 13
14 callback && callback(treeDateJson); 14 callback && callback(treeDateJson);
@@ -17,6 +17,16 @@ var GetAjaxData = function(){ @@ -17,6 +17,16 @@ var GetAjaxData = function(){
17 17
18 }, 18 },
19 19
  20 + getLikeStationName : function (stationName,callback) {
  21 +
  22 + $get('/station/all', {stationName_eq: stationName}, function(array){
  23 +
  24 + callback && callback(array);
  25 +
  26 + });
  27 +
  28 + },
  29 +
20 getStationCode : function(callback) { 30 getStationCode : function(callback) {
21 31
22 $get('/station/getStationCode',null,function(stationCode) { 32 $get('/station/getStationCode',null,function(stationCode) {
@@ -31,6 +41,16 @@ var GetAjaxData = function(){ @@ -31,6 +41,16 @@ var GetAjaxData = function(){
31 41
32 }, 42 },
33 43
  44 + findUpStationRouteCode : function(lineId,diraction,stationRouteCode,callback) {
  45 +
  46 + $get('/stationroute/findUpStationRouteCode',{lineId:lineId,direction:diraction,stationRouteCode:stationRouteCode},function(result) {
  47 +
  48 + callback && callback(result);
  49 +
  50 + });
  51 +
  52 + },
  53 +
34 getFormPointEToWGS(points,callback) { 54 getFormPointEToWGS(points,callback) {
35 55
36 // 获取长度 56 // 获取长度
@@ -90,6 +110,97 @@ var GetAjaxData = function(){ @@ -90,6 +110,97 @@ var GetAjaxData = function(){
90 110
91 }); 111 });
92 112
  113 + },
  114 +
  115 + stationUpdate : function(station,callback) {
  116 +
  117 + $post('/station/stationUpdate',station,function(data) {
  118 +
  119 + callback && callback(data);
  120 +
  121 + });
  122 +
  123 + },
  124 +
  125 + // 获取线路名称
  126 + getIdLineName : function (id,callback) {
  127 +
  128 + $get('/line/' + id ,null, function(result){
  129 +
  130 + callback && callback(result);
  131 +
  132 + });
  133 +
  134 + },
  135 +
  136 + BpolyGonArrayToWGS : function(polyGonArray,callback) {
  137 +
  138 + if(polyGonArray) {
  139 +
  140 + // 获取长度
  141 + var len = polyGonArray.length;
  142 +
  143 + (function(){
  144 +
  145 + if (!arguments.callee.count) {
  146 +
  147 + arguments.callee.count = 0;
  148 +
  149 + }
  150 +
  151 + arguments.callee.count++;
  152 +
  153 + var index = parseInt(arguments.callee.count) - 1;
  154 +
  155 + if (index >= len) {
  156 +
  157 + callback && callback(polyGonArray);
  158 +
  159 + return;
  160 + }
  161 +
  162 + var f = arguments.callee;
  163 +
  164 + $.ajax({
  165 +
  166 + // 百度坐标获取WGS坐标
  167 + url: 'http://api.zdoz.net/bd2wgs.aspx',
  168 +
  169 + data: {lat: polyGonArray[index].lat , lng: polyGonArray[index].lng},
  170 +
  171 + dataType: 'jsonp',
  172 +
  173 + success: function(r){
  174 +
  175 + if(r) {
  176 +
  177 + polyGonArray[index].WGSpotion = r;
  178 +
  179 + }
  180 +
  181 + f();
  182 + }
  183 + });
  184 +
  185 + })();
  186 +
  187 + }else {
  188 +
  189 + callback && callback(false);
  190 +
  191 + }
  192 +
  193 +
  194 + },
  195 +
  196 + getSectionRouteInfo : function(lineId,direction,callback) {
  197 +
  198 + $get('/sectionroute/findSection',{'line.id_eq' : lineId , 'directions_eq' : direction},function(resultdata) {
  199 +
  200 + callback && callback(resultdata);
  201 +
  202 + });
  203 +
93 } 204 }
94 205
95 } 206 }
src/main/resources/static/pages/base/stationroute/js/stationroute-list-events.js
1 -$(function(){ 1 +/** 树选择事件 */
  2 +function getCurrSelNode(diraction){
  3 +
  4 + var array = [];
  5 +
  6 + try {
  7 +
  8 + if(diraction=='0'){
  9 +
  10 + array = $.jstree.reference("#station_Up_tree").get_selected(true);
  11 +
  12 + }else if(diraction=='1'){
  13 +
  14 + array = $.jstree.reference("#station_Down_tree").get_selected(true);
  15 +
  16 + }
  17 +
  18 +
  19 + } catch (e) {
  20 +
  21 + console.log(e);
  22 +
  23 + }
2 24
3 - function getCurrSelNode(){ 25 + return array;
  26 +
  27 +}
  28 +
  29 +function resjtreeDate(id,directionData){
  30 +
  31 + // 刷新表格数据
  32 + GetAjaxData.getStation(id,directionData,function(treeDateJson) {
4 33
5 - var array = []; 34 + var len = treeDateJson[0].children.length;
  35 +
  36 + // 上行
  37 + if(directionData==0){
  38 +
  39 + if(len>0) {
  40 +
  41 + $('#upToolsMobal').hide();
  42 +
  43 + $('#uptreeMobal').show();
  44 +
  45 + }else {
  46 +
  47 + $('#upToolsMobal').show();
  48 +
  49 + $('#uptreeMobal').hide();
  50 +
  51 + }
  52 +
  53 + StationTreeData.upreloadeTree(treeDateJson);
  54 +
  55 + // 下行
  56 + }else if(directionData==1){
  57 +
  58 + if(len>0) {
  59 +
  60 + $('#downToolsMobal').hide();
  61 +
  62 + $('#DowntreeMobal').show();
  63 +
  64 + }else {
  65 +
  66 + $('#downToolsMobal').show();
  67 +
  68 + $('#DowntreeMobal').hide();
  69 +
  70 + }
  71 +
  72 + StationTreeData.dwonreloadeTree(treeDateJson);
  73 +
  74 + }
  75 +
  76 + });
  77 +
  78 +}
  79 +
  80 +
  81 +function editSetStationParmas(sel) {
  82 +
  83 + // 站点名称
  84 + editStationParmas.stationNamebootbox = sel[0].original.stationStationName;
  85 +
  86 + // 百度地图经纬度坐标中心点
  87 + editStationParmas.stationPointInput = sel[0].original.stationBJwpoints;
  88 +
  89 + // 站点WGS经度
  90 + editStationParmas.gLonx = sel[0].original.stationGLonx;
  91 +
  92 + // WGS纬度
  93 + editStationParmas.gLaty = sel[0].original.stationGLaty;
  94 +
  95 + // WGS图形坐标
  96 + editStationParmas.gPolygonGridInput = sel[0].original.stationGPolygonGrid;
  97 +
  98 + // 百度图形坐标
  99 + editStationParmas.bPolygonGridInput = sel[0].original.stationBPolygonGrid;
  100 +
  101 + // 站点图形类型
  102 + editStationParmas.shapesTypeInput = sel[0].original.stationShapesType;
  103 +
  104 + // 半径
  105 + editStationParmas.radiusInput = sel[0].original.stationRadius;
  106 +
  107 + // 是否撤销
  108 + editStationParmas.destroyInput = sel[0].original.stationDestroy;
  109 +
  110 + // 站点ID
  111 + editStationParmas.editUp_stationId = sel[0].original.stationId;
  112 +
  113 + // 站点编码
  114 + editStationParmas.editUp_stationStationCod = sel[0].original.stationStationCod;
  115 +
  116 + // 坐标类型
  117 + editStationParmas.editUp_stationDbType = sel[0].original.stationDbType;
  118 +
  119 + // 站点描述说明
  120 + editStationParmas.editUp_stationDescriptions = sel[0].original.stationDescriptions;
  121 +
  122 + // 站点是否撤销
  123 + editStationParmas.editUp_stationDestroy = sel[0].original.stationDestroy;
  124 +
  125 + // 站点道路编码
  126 + editStationParmas.stationRoadCoding = sel[0].original.stationRoadCoding;
  127 +
  128 + // 站点路由方向
  129 + editStationParmas.stationRouteDirections = sel[0].original.stationRouteDirections;
  130 +
  131 + // 站点路由距离
  132 + editStationParmas.stationRouteDistances = sel[0].original.stationRouteDistances;
  133 +
  134 + // 站点路由时间
  135 + editStationParmas.stationRouteToTime = sel[0].original.stationRouteToTime;
  136 +
  137 + // 站点路由ID
  138 + editStationParmas.stationRouteId = sel[0].original.stationRouteId;
  139 +
  140 + // 站点路由线路ID
  141 + editStationParmas.stationRouteLine = sel[0].original.stationRouteLine;
  142 +
  143 + // 站点路由线路编码
  144 + editStationParmas.stationRouteLineCode = sel[0].original.stationRouteLineCode;
  145 +
  146 + // 站点路由站点Id
  147 + editStationParmas.stationRouteStation = sel[0].original.stationRouteStation;
  148 +
  149 + // 站点路由类型
  150 + editStationParmas.stationRouteStationMark = sel[0].original.stationRouteStationMark;
  151 +
  152 + // 站点路由站点名称
  153 + editStationParmas.stationRouteStationName = sel[0].original.stationRouteStationName;
  154 +
  155 + // 站点路由序号
  156 + editStationParmas.stationRouteStationRouteCode = sel[0].original.stationRouteStationRouteCode;
  157 +
  158 + // 站点路由版本
  159 + editStationParmas.stationRouteVersions = sel[0].original.stationRouteVersions;
  160 +
  161 + // 站点编码
  162 + editStationParmas.stationStationCod = sel[0].original.stationStationCod;
  163 +
  164 + // 站点版本
  165 + editStationParmas.stationVersions = sel[0].original.stationVersions;
  166 +
  167 + // 站点路由说明
  168 + editStationParmas.stationRouteDescriptions = sel[0].original.stationRouteDescriptions;
  169 +
  170 +}
  171 +
  172 +function setFormInputValue(points,gLonx,gLaty,bPolygonGridValue,gPolygonGridVlaue,shapesTypeValue,radiusValue) {
  173 +
  174 + // 百度地图经纬度坐标中心点
  175 + addStaitonParmas.stationPointInput = points;
  176 +
  177 + // WGS经度
  178 + addStaitonParmas.gLonx = gLonx;
  179 +
  180 + // WGS经度
  181 + addStaitonParmas.gLaty = gLaty;
  182 +
  183 + // 百度坐标点图形集合
  184 + addStaitonParmas.bPolygonGridInput = bPolygonGridValue;
  185 +
  186 + // WGS坐标点图形集合
  187 + addStaitonParmas.gPolygonGridInput = gPolygonGridVlaue;
  188 +
  189 + // 图形类型
  190 + addStaitonParmas.shapesTypeInput = shapesTypeValue;
  191 +
  192 + // 圆形半径
  193 + addStaitonParmas.radiusInput = radiusValue;
  194 +
  195 + // 是否撤销
  196 + addStaitonParmas.destroyInput = 0;
  197 +
  198 +}
  199 +
  200 +
  201 +function editSeteditStationParmasValue(points,gLonx,gLaty,bPolygonGridValue,gPolygonGridVlaue,shapesTypeValue,radiusValue) {
  202 +
  203 + // 百度地图经纬度坐标中心点
  204 + editStationParmas.stationPointInput = points;
  205 +
  206 + // WGS经度
  207 + editStationParmas.gLonx = gLonx;
  208 +
  209 + // WGS经度
  210 + editStationParmas.gLaty = gLaty;
  211 +
  212 + // 百度坐标点图形集合
  213 + editStationParmas.bPolygonGridInput = bPolygonGridValue;
  214 +
  215 + // WGS坐标点图形集合
  216 + editStationParmas.gPolygonGridInput = gPolygonGridVlaue;
  217 +
  218 + // 图形类型
  219 + editStationParmas.shapesTypeInput = shapesTypeValue;
  220 +
  221 + // 圆形半径
  222 + editStationParmas.radiusInput = radiusValue;
  223 +
  224 + // 是否撤销
  225 + editStationParmas.destroyInput = 0;
  226 +}
  227 +
  228 +function systemLineStation(lineNameV,directionData) {
  229 +
  230 + // 从百度地图获取线路信息
  231 + WorldsBMap.lineInfoPanl(lineNameV,directionData,mapB,function(BusLine){
6 232
7 - try { 233 + // 如果线路信息不为空
  234 + if(BusLine) {
  235 +
  236 + // 获取公交线几何对象, 仅当结果自动添加到地图上时有效
  237 + var Polygon = BusLine.getPolyline();
  238 +
  239 + // 返回多边型的点数组(自1.2新增)
  240 + var polyGonArray = Polygon.getPath();
  241 +
  242 + // 获取公交站点个数(自 1.2 新增)
  243 + var stationNumber = BusLine.getNumBusStations();
8 244
9 - array = $.jstree.reference("#station_tree").get_selected(true); 245 + // 定义线路信息集合
  246 + var stationInfo = [];
10 247
11 - } catch (e) { 248 + // 遍历
  249 + for(var k = 0 ; k < stationNumber; k++) {
  250 +
  251 + // 定义线路信息集合
  252 + var tempM = {};
  253 +
  254 + // 添加站点名称
  255 + tempM.name = BusLine.getBusStation(k).name;
  256 +
  257 + // 添加站点坐标
  258 + tempM.potion = BusLine.getBusStation(k).position;
  259 +
  260 + // 添加
  261 + stationInfo.push(tempM);
  262 +
  263 + }
12 264
13 - console.log(e); 265 + // 百度站点坐标获取WGS坐标
  266 + GetAjaxData.getFormPointEToWGS(stationInfo,function(result) {
  267 +
  268 + if(result) {
  269 +
  270 + GetAjaxData.BpolyGonArrayToWGS(polyGonArray,function(arraydata) {
  271 +
  272 + WorldsBMap.getDistanceAndDuration(result,function(json) {
  273 +
  274 + json[0].distance = '';
  275 +
  276 + json[0].duration = '';
  277 +
  278 + // 定义站点信息JSON字符串
  279 + var stationJSON = JSON.stringify(json);
  280 +
  281 + // 定义路段信息字符串
  282 + var sectionJSON = JSON.stringify(arraydata);
  283 +
  284 + // 参数集合
  285 + var params = {};
  286 +
  287 + // 站点信息JSON字符串
  288 + params.stationJSON = stationJSON;
  289 +
  290 + // 线路ID
  291 + params.lineId = id;
  292 +
  293 + // 方向
  294 + params.directions = directionData;
  295 +
  296 + // 原始坐标类型
  297 + params.dbType = 'b';
  298 +
  299 + // 圆形半径
  300 + params.radius = '300';
  301 +
  302 + // 图形类型(r:圆形;p:多边形)
  303 + params.shapesType = 'r';
  304 +
  305 + // destroy:是否撤销
  306 + params.destroy = '0';
  307 +
  308 + // versions:版本号
  309 + params.versions = '1';
  310 +
  311 + // 路段信息JSON字符串
  312 + params.sectionJSON = sectionJSON;
  313 +
  314 + // 限速
  315 + params.speedLimit = '60';
  316 +
  317 + console.log(params);
  318 +
  319 + // 保存
  320 + $post('/station/collectionSave',params,function(rd) {
  321 +
  322 +
  323 + if(rd.status='SUCCESS') {
  324 +
  325 + // 关闭弹出层
  326 + layer.closeAll();
  327 +
  328 + // 显示表格
  329 + $('#hide_table').show();
  330 +
  331 + // 刷新树
  332 + resjtreeDate(id,directionData);
  333 +
  334 + }else {
  335 +
  336 + // 保存失败
  337 +
  338 +
  339 + }
  340 +
  341 + });
  342 +
  343 + });
  344 +
  345 + });
  346 +
  347 + }
  348 +
  349 + });
14 350
15 } 351 }
16 352
17 - return array; 353 + });
  354 +
  355 +}
  356 +
  357 +$(function(){
  358 +
  359 + // 系统规划上行站点
  360 + $('.upSystem').on('click',function() {
  361 +
  362 + // 获取方向 (0:上行;1:下行)
  363 + var directionData = $('.upSystem').data('direction');
  364 +
  365 + $('#upToolsMobal').hide();
  366 +
  367 + // 弹出正在加载层
  368 + var i = layer.load(0,{offset:['200px', '280px']});
  369 +
  370 + systemSaveStation(directionData);
  371 +
  372 + });
  373 +
  374 + // 系统规划下行站点
  375 + $('.downSystem').on('click',function() {
  376 + // 获取方向 (0:上行;1:下行)
  377 + var directionData = $('.downSystem').data('direction');
  378 +
  379 + $('#downToolsMobal').hide();
  380 +
  381 + // 弹出正在加载层
  382 + var i = layer.load(0,{offset:['200px', '280px']});
  383 +
  384 + systemSaveStation(directionData);
  385 +
  386 + });
  387 +
  388 + function systemSaveStation(directionData) {
  389 +
  390 + // 根据线路ID获取线路名称
  391 + GetAjaxData.getIdLineName(id,function(data) {
  392 +
  393 + if(data) {
  394 +
  395 + // 定义线路名称
  396 + var lineNameV = data.name;
  397 +
  398 + if(lineNameV.indexOf('区间')>0){
  399 +
  400 + var lineNameNew = lineNameV.replace('区间','');
  401 +
  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 {
  428 +
  429 + systemLineStation(lineNameV,directionData);
  430 +
  431 + }
  432 +
  433 + }else {
  434 +
  435 + alert('线路名称为空');
  436 +
  437 + }
  438 +
  439 +
  440 + });
18 441
19 } 442 }
20 443
21 444
22 - // 新增站点mobal页面  
23 - $('.module_tools #addStation').on('click', function() { 445 + // 手动规划上行站点
  446 + $('.upManual').on('click',function() {
  447 +
  448 + $.get('add_manual_select.html', function(m){$(pjaxContainer).append(m);});
  449 +
  450 + });
  451 +
  452 + // 上行站点新增事件
  453 + $('.module_tools #addUpStation').on('click', function() {
24 454
  455 + // 线路方向
25 dir = $('#stationUp').data('direction'); 456 dir = $('#stationUp').data('direction');
26 457
  458 + // 加载选择新增方式mobal
27 $.get('add_select.html', function(m){$(pjaxContainer).append(m);}); 459 $.get('add_select.html', function(m){$(pjaxContainer).append(m);});
28 460
29 }); 461 });
30 462
  463 + // 下行站点新增事件
  464 + $('.module_tools #addDownStation').on('click', function() {
  465 +
  466 + // 线路方向
  467 + dir = $('#stationDown').data('direction');
  468 +
  469 + // 加载选择新增方式mobal
  470 + $.get('add_select.html', function(m){$(pjaxContainer).append(m);});
  471 +
  472 + });
31 473
32 //删除 474 //删除
33 - $('.module_tools #deleteStation').on('click', function(){  
34 - if(getCurrSelNode().length == 0){  
35 - layer.msg('请先选择要删除的节点!'); 475 + $('.module_tools #deleteUpStation').on('click', function(){
  476 +
  477 + var obj = getCurrSelNode('0');
  478 +
  479 + if(obj.length == 0 || obj[0].original.chaildredType !='station'){
  480 + layer.msg('请先选择要删除的站点!');
36 return; 481 return;
37 } 482 }
38 - var sel = getCurrSelNode();  
39 - removeConfirm('你确定要删除【'+sel[0].text+'】模块吗?', '/module/' + sel[0].id  
40 - ,refreshJsTree) 483 +
  484 + removeConfirm('你确定要删除【'+obj[0].text+'】模块吗?', '/module/' + obj[0].id
  485 + ,function() {
  486 +
  487 + });
  488 + });
  489 +
  490 + // 修改上行站点mobal页面
  491 + $('.module_tools #editUpStation').on('click', function(){
  492 +
  493 + dir = '0';
  494 +
  495 + var sel = getCurrSelNode(dir);
  496 +
  497 + if(sel.length==0 || sel[0].original.chaildredType !='station'){
  498 +
  499 + layer.msg('请先选择要编辑的上行站点!');
  500 +
  501 + return;
  502 + }
  503 +
  504 + $.get('edit_select.html', function(m){$(pjaxContainer).append(m);});
  505 +
41 }); 506 });
42 507
43 - // 修改站点mobal页面  
44 - $('.module_tools #editStation').on('click', function(){ 508 + // 修改下行站点mobal页面
  509 + $('.module_tools #editDownStation').on('click', function(){
  510 +
  511 + dir = '1';
45 512
46 - var sel = getCurrSelNode(); 513 + var sel = getCurrSelNode(dir);
47 514
48 - if(sel.length == 0){ 515 + if(sel.length==0 || sel[0].original.chaildredType !='station'){
49 516
50 - layer.msg('请先选择要编辑的站点!'); 517 + layer.msg('请先选择要编辑的下行站点!');
51 518
52 return; 519 return;
53 } 520 }
@@ -56,4 +523,48 @@ $(function(){ @@ -56,4 +523,48 @@ $(function(){
56 523
57 }); 524 });
58 525
  526 +
  527 + // 编辑线路走向
  528 + $('.module_tools #editUplineTrend').on('click', function(){
  529 +
  530 + // 开启线路编辑
  531 + polyUpline.enableEditing();
  532 +
  533 + // 弹出添加失败提示消息,2秒关闭(如果不配置,默认是3秒)
  534 + var yindex = layer.msg('编辑完线路走向后,请双击线路走向区域保存',{ offset: '126px',shift: 0,time: 10000});
  535 +
  536 + // 添加双击折线保存事件
  537 + polyUpline.addEventListener('dblclick',function(e) {
  538 +
  539 + // 关闭
  540 + layer.close(yindex);
  541 +
  542 + // 获取折线坐标集合
  543 + var editPloyLineArray = polyUpline.getPath();
  544 +
  545 + // 坐标转换WGS坐标
  546 + GetAjaxData.BpolyGonArrayToWGS(editPloyLineArray,function(arraydata) {
  547 +
  548 + console.log(arraydata);
  549 +
  550 + });
  551 +
  552 + });
  553 +
  554 + });
  555 +
  556 + // 线路上行
  557 + $('#leftUpOrDown #upLine').on('click', function(){
  558 +
  559 + linePanlThree(id,'0');
  560 +
  561 + });
  562 +
  563 + // 线路下行
  564 + $('#leftUpOrDown #downLine').on('click', function(){
  565 +
  566 + linePanlThree(id,'1');
  567 +
  568 + });
  569 +
59 }); 570 });
60 \ No newline at end of file 571 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/js/stationroute-list-map.js
@@ -5,7 +5,7 @@ var WorldsBMap = function () { @@ -5,7 +5,7 @@ var WorldsBMap = function () {
5 var busline = new BMap.BusLineSearch(map,{ 5 var busline = new BMap.BusLineSearch(map,{
6 6
7 // 搜索结果呈现的配置 7 // 搜索结果呈现的配置
8 - renderOptions:{map:map}, 8 + // renderOptions:{map:map},
9 9
10 // 设置公交列表查询后的回调函数。参数:rs: BusListResult类型 10 // 设置公交列表查询后的回调函数。参数:rs: BusListResult类型
11 onGetBusListComplete:function(BusListResult) { 11 onGetBusListComplete:function(BusListResult) {
@@ -27,10 +27,31 @@ var WorldsBMap = function () { @@ -27,10 +27,31 @@ var WorldsBMap = function () {
27 27
28 // 如果不为空 28 // 如果不为空
29 if(BusListResult){ 29 if(BusListResult){
30 - 30 +
31 //获取第一个公交列表显示到map上 31 //获取第一个公交列表显示到map上
32 var fstLine = BusListResult.getBusListItem(i); 32 var fstLine = BusListResult.getBusListItem(i);
33 33
  34 + if(fstLine==undefined){
  35 +
  36 + layer.confirm('系统无法生成该线路【'+lineNameValue+'】的站点与路段!请点击返回选择手动规划', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){
  37 +
  38 + layer.closeAll();
  39 +
  40 + if(i==0){
  41 +
  42 + $('#upToolsMobal').show();
  43 +
  44 + }else if(i==1){
  45 +
  46 + $('#downToolsMobal').show();
  47 +
  48 + }
  49 +
  50 + return;
  51 + });
  52 +
  53 + }
  54 +
34 busline.getBusLine(fstLine); 55 busline.getBusLine(fstLine);
35 56
36 } 57 }
@@ -55,7 +76,6 @@ var WorldsBMap = function () { @@ -55,7 +76,6 @@ var WorldsBMap = function () {
55 76
56 } 77 }
57 78
58 -  
59 function setMapEvent(map) { 79 function setMapEvent(map) {
60 //启用地图拖拽事件,默认启用(可不写) 80 //启用地图拖拽事件,默认启用(可不写)
61 map.enableDragging(); 81 map.enableDragging();
@@ -97,6 +117,99 @@ var WorldsBMap = function () { @@ -97,6 +117,99 @@ var WorldsBMap = function () {
97 polygonOptions : styleOptions 117 polygonOptions : styleOptions
98 }); 118 });
99 119
  120 + // 添加绘画完成事件
  121 + drawingManager.addEventListener('polygoncomplete', function(e) {
  122 +
  123 + if (e.getPath().length <= 2) {
  124 +
  125 + // 弹出提示消息
  126 + layer.msg('坐标点不能小于等于两个...');
  127 +
  128 + // 清除地图覆盖物
  129 + map.clearOverlays();
  130 +
  131 + // 加载该线路下所有站点位置添加到地图上
  132 + return false;
  133 +
  134 + }else {
  135 +
  136 + var pointE = e;
  137 +
  138 + // 多变行质心点
  139 + var addSttationPoints_ = pointE.getBounds().getCenter().lng+ ' ' + pointE.getBounds().getCenter().lat;
  140 +
  141 + var PointsList = [];
  142 +
  143 + for ( var i = 0; i < pointE.getPath().length; i++) {
  144 +
  145 + PointsList.push({potion: {lng: pointE.getPath()[i].lng, lat: pointE.getPath()[i].lat}});
  146 +
  147 + }
  148 +
  149 + PointsList.push({potion: {lng: pointE.getPath()[0].lng, lat: pointE.getPath()[0].lat}});
  150 +
  151 + var centre = [{potion:{lng:pointE.getBounds().getCenter().lng,lat:pointE.getBounds().getCenter().lat}}];
  152 +
  153 + GetAjaxData.getFormPointEToWGS(PointsList,function(resultdata) {
  154 +
  155 + var gPloygonGrid = '';
  156 +
  157 + var bPloygonGrid = '';
  158 +
  159 + for(var k =0;k<resultdata.length;k++) {
  160 +
  161 + if(k==0) {
  162 +
  163 + gPloygonGrid = resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat;
  164 +
  165 + bPloygonGrid = resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat;
  166 +
  167 + }else {
  168 +
  169 + gPloygonGrid = gPloygonGrid + ',' + resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat;
  170 +
  171 + bPloygonGrid = bPloygonGrid + ',' + resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat;
  172 +
  173 + }
  174 +
  175 + }
  176 +
  177 + gPloygonGrid = 'POLYGON((' + gPloygonGrid + '))';
  178 +
  179 + bPloygonGrid = 'POLYGON((' + bPloygonGrid + '))';
  180 +
  181 + GetAjaxData.getFormPointEToWGS(centre,function(p) {
  182 +
  183 + var gLonx = p[0].WGSpotion.Lng;
  184 +
  185 + var gLaty = p[0].WGSpotion.Lat;
  186 +
  187 + if(status=='add'){
  188 +
  189 + setFormInputValue(addSttationPoints_,gLonx,gLaty,bPloygonGrid,gPloygonGrid,'d','');
  190 +
  191 + status = '';
  192 +
  193 + $.get('add.html', function(m){$(pjaxContainer).append(m);});
  194 +
  195 + }else if(status=='edit'){
  196 +
  197 + editSeteditStationParmasValue(addSttationPoints_,gLonx,gLaty,bPloygonGrid,gPloygonGrid,'d','');
  198 +
  199 + status = '';
  200 +
  201 + $.get('edit.html', function(m){$(pjaxContainer).append(m);});
  202 +
  203 + }
  204 +
  205 + });
  206 +
  207 + });
  208 +
  209 + }
  210 +
  211 + });
  212 +
100 } 213 }
101 214
102 var Bmap = { 215 var Bmap = {
@@ -140,49 +253,244 @@ var WorldsBMap = function () { @@ -140,49 +253,244 @@ var WorldsBMap = function () {
140 253
141 }, 254 },
142 255
143 - // 多边形  
144 - pointsPolygon : function(Polygon,map) { 256 + getDistanceAndDuration : function(points,callback){
145 257
146 - },  
147 -  
148 - // 圆  
149 - pointsCircle : function(Circle,map) { 258 + // 获取长度
  259 + var len = points.length;
150 260
151 - var len = Circle.length; 261 + (function(){
  262 +
  263 + if (!arguments.callee.count) {
  264 +
  265 + arguments.callee.count = 0;
  266 +
  267 + }
  268 +
  269 + arguments.callee.count++;
  270 +
  271 + var index = parseInt(arguments.callee.count) - 1;
  272 +
  273 + if (index >= len-1) {
  274 +
  275 + callback && callback(points);
  276 +
  277 + return;
  278 + }
  279 +
  280 + var f = arguments.callee;
  281 +
  282 + var origin = points[index].potion.lat + ',' + points[index].potion.lng;
  283 +
  284 + var destination = points[index+1].potion.lat + ',' + points[index+1].potion.lng;
  285 +
  286 + var region = '上海';
  287 +
  288 + var origin_region = '上海';
  289 +
  290 + var destination_region = '上海';
  291 +
  292 + var output = 'json';
  293 +
  294 + var ak_My = '7BZ7eHZfCHUSVRHZilSQv6BGiUjOgGYE';
  295 +
  296 + var paramsB = {origin:origin,destination:destination,region:region,origin_region:origin_region,destination_region:destination_region,output:output,ak:ak_My};
  297 +
  298 + // var url_ = 'http://api.map.baidu.com/direction/v1?mode=transit&origin='+origin+ '&destination='+destination+ '&region='+region+ '&output='+output+ '&ak='+ak_My;
  299 +
  300 + $.ajax({
  301 +
  302 + // 百度坐标获取WGS坐标
  303 + url: 'http://api.map.baidu.com/direction/v1?mode=transit',
  304 +
  305 + data: paramsB,
  306 +
  307 + dataType: 'jsonp',
  308 +
  309 + success: function(r){
  310 +
  311 + if(r) {
  312 +
  313 + if(r.message=='ok') {
  314 +
  315 + points[index+1].distance = r.result.taxi.distance+500;
  316 +
  317 + points[index+1].duration = r.result.taxi.duration+240;
  318 +
  319 + }
  320 +
  321 + }
  322 +
  323 + f();
  324 + }
  325 + });
  326 +
  327 + })();
152 328
153 - var pointsCircle = ""; 329 + },
  330 +
  331 + // 多边形
  332 + pointsPolygon : function(objStation,map) {
154 333
155 - if(len==1){ 334 + if(objStation) {
156 335
157 - pointsCircle = Circle[0].original; 336 + map.clearOverlays();
158 337
159 - var pointStr = Circle[0].original.b_jwpoints.split(' '); 338 + var testpointStr = objStation.stationBJwpoints;
160 339
161 - if (pointStr.length<=0) {  
162 -  
163 - return ;  
164 -  
165 - }else {  
166 -  
167 - point = new BMap.Point(pointStr[0], pointStr[1]);  
168 -  
169 - //创建圆  
170 - circle = new BMap.Circle(point,Circle[0].original.radius,{strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5});  
171 -  
172 - map.addOverlay(circle);  
173 -  
174 - } 340 + var BJwpointsPolygon = testpointStr.split(' ');
  341 +
  342 + var pointPolygon = new BMap.Point(BJwpointsPolygon[0], BJwpointsPolygon[1]);
  343 +
  344 + var stationBPolygonGrid = objStation.stationBPolygonGrid;
  345 +
  346 + var stationBPolygonGridStr = stationBPolygonGrid.substring(9,stationBPolygonGrid.length-2);
175 347
  348 + var pointPolygonArray = stationBPolygonGridStr.split(',');
  349 +
  350 + var polygonP = [];
  351 +
  352 + for(var v = 0;v<pointPolygonArray.length;v++) {
  353 +
  354 + polygonP.push(new BMap.Point(pointPolygonArray[v].split(" ")[0],pointPolygonArray[v].split(" ")[1]));
  355 +
  356 + }
176 357
  358 + polygon = new BMap.Polygon(polygonP, {
  359 + strokeColor : "blue",
  360 + strokeWeight : 2,
  361 + strokeOpacity : 0.5
  362 + });
177 363
178 - }else if(len>1) { 364 + map.addOverlay(polygon); //增加多边形
179 365
180 - pointsCircle = Circle; 366 + var opts_polygon = {
  367 +
  368 + // 信息窗口宽度
  369 + width : 200,
  370 +
  371 + // 信息窗口高度
  372 + height : 400,
  373 +
  374 + //标题
  375 + title : '<h4 style="color:#FFFFFF">'+objStation.stationStationName+'站详情</h4>',
  376 +
  377 + //设置不允许信窗发送短息
  378 + enableMessage : false,
  379 +
  380 + //是否开启点击地图关闭信息窗口
  381 + enableCloseOnClick : false
  382 + };
  383 +
  384 + var infoWindow_target = new BMap.InfoWindow('<HR style="border:1 dashed #987cb9" width="100%" color=#987cb9 SIZE=1>'+
  385 + '<span style="color:#DDD;font-size: 15px;">站点名称:' + objStation.stationStationName + '</span>' +
  386 + '<span class="help-block" style="color:#DDD;font-size: 15px;">站点编码:' + objStation.stationStationCod + '</span>' +
  387 + '<span class="help-block" style="color:#DDD;font-size: 15px;">站点序号:' + objStation.stationRouteStationRouteCode + '</span>' +
  388 + '<span class="help-block" style="color:#DDD;font-size: 15px;">纬度坐标:' + objStation.stationBJwpoints + '</span>' +
  389 + '<span class="help-block" style="color:#DDD;font-size: 15px;">范围半径:' + objStation.stationRadius + '</span>' +
  390 + '<span class="help-block" style="color:#DDD;font-size: 15px;">版本 号:' + objStation.stationVersions + '</span>' +
  391 + '<span class="help-block" style="width: 100%;font-size: 15px;;color:#DDD; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; " title="'+ 'ddd' +'" >说明/描述:' + 'ddd' + '</span>' , opts_polygon);
  392 + // 自定义标注物图片
  393 + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20));
  394 +
  395 + // 创建点
  396 + marker = new BMap.Marker(pointPolygon,{icon : icon_target});
  397 +
  398 + // 把标注添物加到地图上
  399 + map.addOverlay(marker);
  400 +
  401 + // marker.disableMassClear();
  402 +
  403 + var PanOptions_ ={noAnimation :true};
  404 +
  405 + map.panTo(pointPolygon,PanOptions_);
  406 +
  407 + map.panBy(10,110,PanOptions_);
  408 +
  409 + //开启信息窗口
  410 + marker.openInfoWindow(infoWindow_target,pointPolygon);
181 411
182 } 412 }
183 413
184 }, 414 },
185 415
  416 + // 画圆
  417 + pointsCircle : function(objStation,map) {
  418 +
  419 + if(objStation) {
  420 +
  421 + map.clearOverlays();
  422 +
  423 + var BJwpoints = objStation.stationBJwpoints.split(' ');
  424 +
  425 + var point = new BMap.Point(BJwpoints[0], BJwpoints[1]);
  426 +
  427 + //设置中心点
  428 + // map.centerAndZoom(point,16);
  429 +
  430 + //创建圆
  431 + circle = new BMap.Circle(point,objStation.stationRadius,{strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5});
  432 +
  433 + circle.enableMassClear();
  434 +
  435 + map.addOverlay(circle);
  436 +
  437 + var opts = {
  438 +
  439 + // 信息窗口宽度
  440 + width : 200,
  441 +
  442 + // 信息窗口高度
  443 + height : 400,
  444 +
  445 + //标题
  446 + title : '<h4 style="color:#FFFFFF">'+objStation.stationStationName+'站详情</h4>',
  447 +
  448 + //设置不允许信窗发送短息
  449 + enableMessage : false,
  450 +
  451 + //是否开启点击地图关闭信息窗口
  452 + enableCloseOnClick : false
  453 + };
  454 +
  455 + var infoWindow_target = new BMap.InfoWindow('<HR style="border:1 dashed #987cb9" width="100%" color=#987cb9 SIZE=1>'+
  456 + '<span style="color:#DDD;font-size: 15px;">站点名称:' + objStation.stationStationName + '</span>' +
  457 + '<span class="help-block" style="color:#DDD;font-size: 15px;">站点编码:' + objStation.stationStationCod + '</span>' +
  458 + '<span class="help-block" style="color:#DDD;font-size: 15px;">站点序号:' + objStation.stationRouteStationRouteCode + '</span>' +
  459 + '<span class="help-block" style="color:#DDD;font-size: 15px;">纬度坐标:' + objStation.stationBJwpoints + '</span>' +
  460 + '<span class="help-block" style="color:#DDD;font-size: 15px;">范围半径:' + objStation.stationRadius + '</span>' +
  461 + '<span class="help-block" style="color:#DDD;font-size: 15px;">版本 号:' + objStation.stationVersions + '</span>' +
  462 + '<span class="help-block" style="width: 100%;font-size: 15px;;color:#DDD; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; " title="'+ 'ddd' +'" >说明/描述:' + 'ddd' + '</span>' , opts);
  463 + // 自定义标注物图片
  464 + icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20));
  465 +
  466 + // 创建点
  467 + marker = new BMap.Marker(point,{icon : icon_target});
  468 +
  469 + // 把标注添物加到地图上
  470 + map.addOverlay(marker);
  471 +
  472 + // marker.disableMassClear();
  473 +
  474 + var PanOptions_ ={noAnimation :true};
  475 +
  476 + map.panTo(point,PanOptions_);
  477 +
  478 + map.panBy(10,110,PanOptions_);
  479 +
  480 + //开启信息窗口
  481 + marker.openInfoWindow(infoWindow_target,point);
  482 +
  483 + // 添加标志物监听事件
  484 + marker.addEventListener("click",function() {
  485 +
  486 + //开启信息窗口
  487 + marker.openInfoWindow(infoWindow_target,point);
  488 +
  489 + });
  490 +
  491 + }
  492 +
  493 + },
186 localSearchFromAdreesToPoint(Address,map,callback) { 494 localSearchFromAdreesToPoint(Address,map,callback) {
187 495
188 var localSearch = new BMap.LocalSearch(map); 496 var localSearch = new BMap.LocalSearch(map);
@@ -191,25 +499,177 @@ var WorldsBMap = function () { @@ -191,25 +499,177 @@ var WorldsBMap = function () {
191 499
192 var resultPoints = ''; 500 var resultPoints = '';
193 501
194 - var poi = searchResult.getPoi(0);  
195 -  
196 - if(poi) { 502 + if(searchResult) {
  503 +
  504 + var poi = searchResult.getPoi(0);
197 505
198 - //获取经度和纬度  
199 - resultPoints = poi.point.lng + ' ' + poi.point.lat; 506 + if(poi) {
  507 +
  508 +
  509 + //获取经度和纬度
  510 + resultPoints = poi.point.lng + ' ' + poi.point.lat;
  511 +
  512 + callback && callback(resultPoints);
  513 +
  514 + }else {
  515 +
  516 + callback && callback(false);
  517 +
  518 + }
200 519
201 - callback && callback(resultPoints);  
202 520
203 }else { 521 }else {
204 522
205 callback && callback(false); 523 callback && callback(false);
206 -  
207 } 524 }
208 525
  526 +
  527 +
  528 +
209  }); 529  });
210 530
211  localSearch.search(Address); 531  localSearch.search(Address);
212 532
  533 + },
  534 +
  535 + coloseWindowsInfo : function(editStationName,stationShapesTypeV,mindex) {
  536 +
  537 + marker.closeInfoWindow();
  538 +
  539 + mapB.removeOverlay(marker);
  540 +
  541 + if(stationShapesTypeV =='r') {
  542 +
  543 + circle.enableEditing();
  544 +
  545 + circle.addEventListener('dblclick',function() {
  546 +
  547 + layer.close(mindex);
  548 +
  549 + var newRadius = circle.getRadius();
  550 +
  551 + var newCenter = circle.getCenter().lng + ' ' + circle.getCenter().lat;
  552 +
  553 + var centre_New = [{potion:{lng:circle.getCenter().lng,lat:circle.getCenter().lat}}];
  554 +
  555 + GetAjaxData.getFormPointEToWGS(centre_New,function(p) {
  556 +
  557 + editSeteditStationParmasValue(newCenter, p[0].WGSpotion.Lng , p[0].WGSpotion.Lat,'','','r',Math.round(newRadius));
  558 +
  559 + $.get('edit.html', function(m){$(pjaxContainer).append(m);});
  560 +
  561 + });
  562 +
  563 + });
  564 +
  565 + }else if(stationShapesTypeV =='d') {
  566 +
  567 + polygon.enableEditing();
  568 +
  569 + polygon.addEventListener('dblclick',function(e) {
  570 +
  571 + var edit_pointE = polygon;
  572 +
  573 + var eidt_PointsList = [];
  574 +
  575 + for ( var i = 0; i < edit_pointE.getPath().length; i++) {
  576 +
  577 + eidt_PointsList.push({potion: {lng: edit_pointE.getPath()[i].lng, lat: edit_pointE.getPath()[i].lat}});
  578 +
  579 + }
  580 +
  581 + eidt_PointsList.push({potion: {lng: edit_pointE.getPath()[0].lng, lat: edit_pointE.getPath()[0].lat}});
  582 +
  583 + var editSttationPoints_ = edit_pointE.getBounds().getCenter().lng+ ' ' + edit_pointE.getBounds().getCenter().lat;
  584 +
  585 + var edit_centre = [{potion:{lng:edit_pointE.getBounds().getCenter().lng,lat:edit_pointE.getBounds().getCenter().lat}}];
  586 +
  587 + var centre_points = edit_pointE.getBounds().getCenter().lng + ' ' + edit_pointE.getBounds().getCenter().lat;
  588 +
  589 + GetAjaxData.getFormPointEToWGS(eidt_PointsList,function(resultdata) {
  590 +
  591 + var eidt_gPloygonGrid = '';
  592 +
  593 + var edit_bPloygonGrid = '';
  594 +
  595 + for(var k =0;k<resultdata.length;k++) {
  596 +
  597 + if(k==0) {
  598 +
  599 + eidt_gPloygonGrid = resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat;
  600 +
  601 + edit_bPloygonGrid = resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat;
  602 +
  603 + }else {
  604 +
  605 + eidt_gPloygonGrid = eidt_gPloygonGrid + ',' + resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat;
  606 +
  607 + edit_bPloygonGrid = edit_bPloygonGrid + ',' + resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat;
  608 +
  609 + }
  610 +
  611 + }
  612 +
  613 + eidt_gPloygonGrid = 'POLYGON((' + eidt_gPloygonGrid + '))';
  614 +
  615 + edit_bPloygonGrid = 'POLYGON((' + edit_bPloygonGrid + '))';
  616 +
  617 + GetAjaxData.getFormPointEToWGS(edit_centre,function(p) {
  618 +
  619 + var edit_gLonx = p[0].WGSpotion.Lng;
  620 +
  621 + var edit_gLaty = p[0].WGSpotion.Lat;
  622 +
  623 + editSeteditStationParmasValue(centre_points,edit_gLonx,edit_gLaty,edit_bPloygonGrid,eidt_gPloygonGrid,'d','');
  624 +
  625 + $.get('edit.html', function(m){$(pjaxContainer).append(m);});
  626 +
  627 + });
  628 +
  629 + });
  630 +
  631 +
  632 + });
  633 +
  634 + }
  635 +
  636 + },
  637 +
  638 + // 在地图上画出上行线路走向
  639 + drawingUpline : function (polylineArray) {
  640 +
  641 + mapB.clearOverlays();
  642 +
  643 + // 创建线路走向
  644 + polyUpline = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 4,strokeOpacity : 0.5});
  645 +
  646 + // 把折线添加到地图上
  647 + mapB.addOverlay(polyUpline);
  648 +
  649 + // 自定义标注物图片
  650 + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20));
  651 +
  652 + // 创建标注物
  653 + var markers_target = new BMap.Marker(polylineArray[0],{icon : icon_target});
  654 +
  655 + // 把标注添物加到地图上
  656 + mapB.addOverlay(markers_target);
  657 +
  658 + //设置中心点
  659 + mapB.centerAndZoom(polylineArray[0],16);
  660 +
  661 + },
  662 +
  663 + drawingManagerOpen : function() {
  664 +
  665 + mapB.clearOverlays();
  666 +
  667 + // 打开鼠标绘画工具
  668 + drawingManager.open();
  669 +
  670 + // 设置属性
  671 + drawingManager.setDrawingMode(BMAP_DRAWING_POLYGON);
  672 +
213 } 673 }
214 674
215 } 675 }
src/main/resources/static/pages/base/stationroute/js/stationroute-list-reload.js
  1 +function linePanlThree(lineId,diraction) {
  2 + GetAjaxData.getSectionRouteInfo(lineId,diraction,function(data) {
  3 +
  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 = [];
  13 +
  14 + for(var i = 0;i<lineArray.length;i++) {
  15 +
  16 + polylineArray.push(new BMap.Point(lineArray[i].split(' ')[0],lineArray[i].split(' ')[1]));
  17 +
  18 + }
  19 + WorldsBMap.drawingUpline(polylineArray);
  20 + }
  21 +
  22 + });
  23 +
  24 +}
  25 +
  26 +/** 加载树 */
  27 +function TreeUpOrDown(lineId,diraction) {
  28 +
  29 + GetAjaxData.getStation(lineId,diraction,function(treeDateJson) {
  30 +
  31 + var len = treeDateJson[0].children[0].children.length;
  32 +
  33 + // 上行
  34 + if(diraction == 0) {
  35 +
  36 + var stationUpTree = $('#station_Up_tree');
  37 +
  38 + StationTreeData.upInit(treeDateJson,stationUpTree,mapB);
  39 +
  40 + if(len>0) {
  41 +
  42 + $('#upToolsMobal').hide();
  43 +
  44 + $('#uptreeMobal').show();
  45 +
  46 + }else {
  47 +
  48 + $('#upToolsMobal').show();
  49 +
  50 + $('#uptreeMobal').hide();
  51 +
  52 + }
  53 +
  54 +
  55 + // 下行
  56 + }else if(diraction ==1) {
  57 +
  58 + var stationDownTree = $('#station_Down_tree');
  59 +
  60 + StationTreeData.downInit(treeDateJson,stationDownTree,mapB);
  61 +
  62 + if(len>0) {
  63 +
  64 + $('#downToolsMobal').hide();
  65 +
  66 + $('#DowntreeMobal').show();
  67 +
  68 + }else {
  69 +
  70 + $('#downToolsMobal').show();
  71 +
  72 + $('#DowntreeMobal').hide();
  73 +
  74 + }
  75 +
  76 + }
  77 +
  78 + });
  79 +
  80 +}
  81 +
1 $(function(){ 82 $(function(){
2 83
3 // 获取参数ID 84 // 获取参数ID
4 - //var id = $.url().param('lineId');  
5 -  
6 - id = '492'; 85 + id = $.url().param('no');
7 86
8 dir = '0'; 87 dir = '0';
9 88
10 - var station_tree = $('#station_tree');  
11 -  
12 if(id) { 89 if(id) {
13 90
14 // 初始化地图和表格 91 // 初始化地图和表格
@@ -20,28 +97,11 @@ $(function(){ @@ -20,28 +97,11 @@ $(function(){
20 // 全局变量 97 // 全局变量
21 window.mapB = mapB; 98 window.mapB = mapB;
22 99
23 - GetAjaxData.getStation(id,dir,function(treeDateJson) {  
24 -  
25 - var len = treeDateJson.length;  
26 -  
27 - if(len>0) {  
28 -  
29 - StationTreeData.init(treeDateJson,station_tree,mapB);  
30 -  
31 - $('#upToolsMobal').hide();  
32 -  
33 - $('#uptreeMobal').show();  
34 -  
35 - }else {  
36 -  
37 - $('#upToolsMobal').show();  
38 -  
39 - $('#uptreeMobal').hide();  
40 -  
41 - }  
42 -  
43 -  
44 - }); 100 + TreeUpOrDown(id,'0');
  101 +
  102 + TreeUpOrDown(id,'1');
  103 +
  104 + linePanlThree(id,'0');
45 105
46 },500); 106 },500);
47 107
src/main/resources/static/pages/base/stationroute/js/stationroute-list-treedata.js
1 var StationTreeData = function(){ 1 var StationTreeData = function(){
2 2
3 -  
4 var stationTree = { 3 var stationTree = {
5 4
6 - init : function(treeDateJson,station_tree,map) { 5 + upInit : function(treeDateJson,station_tree,map) {
7 6
8 if(treeDateJson) { 7 if(treeDateJson) {
9 8
10 - station_tree.jstree({ 9 + $('#station_Up_tree').on('loaded.jstree', function(e, data){
  10 +
  11 + $.jstree.reference("#station_Up_tree").open_all();
  12 +
  13 + }).jstree({
11 14
12 'core' : { 15 'core' : {
13 'themes' : { 16 'themes' : {
@@ -35,17 +38,120 @@ var StationTreeData = function(){ @@ -35,17 +38,120 @@ var StationTreeData = function(){
35 38
36 //单击事件 39 //单击事件
37 40
38 - var treeOjb = $.jstree.reference("#station_tree").get_selected(true); 41 + layer.closeAll();
  42 +
  43 + var treeOjb = $.jstree.reference("#station_Up_tree").get_selected(true);
39 44
40 var len = treeOjb.length; 45 var len = treeOjb.length;
41 46
42 if(len>0) { 47 if(len>0) {
43 48
44 - WorldsBMap.pointsCircle(treeOjb,map); 49 + var shapesTypeT = treeOjb[0].original.stationShapesType;
  50 +
  51 + var objStation = treeOjb[0].original;
  52 +
  53 + // 如果是圆
  54 + if(shapesTypeT =='r') {
  55 +
  56 + WorldsBMap.pointsCircle(objStation,map);
  57 +
  58 + }else if(shapesTypeT == 'd') {
  59 +
  60 + WorldsBMap.pointsPolygon(objStation,map);
  61 +
  62 + }
  63 +
45 64
46 } 65 }
47 }); 66 });
48 } 67 }
  68 + },
  69 +
  70 + downInit : function(treeDateJson,station_tree,map) {
  71 +
  72 + if(treeDateJson) {
  73 +
  74 + $('#station_Down_tree').on('loaded.jstree', function(e, data){
  75 +
  76 + $.jstree.reference("#station_Down_tree").open_all();
  77 +
  78 + }).jstree({
  79 +
  80 + 'core' : {
  81 + 'themes' : {
  82 + 'responsive': false
  83 + },
  84 + 'data': treeDateJson,
  85 + 'multiple':false
  86 + },
  87 + 'types' : {
  88 + "default" : {
  89 + "icon" : false
  90 + },
  91 + 'enable_true' : {
  92 + "icon" : 'fa fa-check icon-lg'
  93 + },
  94 + 'enable_false' : {
  95 + 'icon' : 'fa fa-close icon-lg'
  96 + },
  97 + 'group':{
  98 + 'icon' : 'fa fa-object-group icon-lg'
  99 + }
  100 + },
  101 + 'plugins': ['types']
  102 + }).bind('click.jstree', function(event) {
  103 +
  104 + //单击事件
  105 +
  106 + layer.closeAll();
  107 +
  108 + var treeOjb = $.jstree.reference("#station_Down_tree").get_selected(true);
  109 +
  110 + var len = treeOjb.length;
  111 +
  112 + if(len>0) {
  113 +
  114 + var shapesTypeT = treeOjb[0].original.stationShapesType;
  115 +
  116 + var objStation = treeOjb[0].original;
  117 +
  118 + // 如果是圆
  119 + if(shapesTypeT =='r') {
  120 +
  121 + WorldsBMap.pointsCircle(objStation,map);
  122 +
  123 + }else if(shapesTypeT == 'd') {
  124 +
  125 + WorldsBMap.pointsPolygon(objStation,map);
  126 +
  127 + }
  128 +
  129 +
  130 + }
  131 + });
  132 + }
  133 + },
  134 +
  135 + upreloadeTree : function (treeDateJson) {
  136 +
  137 + var tree = $.jstree.reference('#station_Up_tree');
  138 +
  139 + tree.settings.core.data = treeDateJson;
  140 +
  141 + tree.refresh();
  142 +
  143 +
  144 + },
  145 +
  146 + dwonreloadeTree : function (treeDateJson) {
  147 +
  148 + var tree = $.jstree.reference('#station_Down_tree');
  149 +
  150 + tree.settings.core.data = treeDateJson;
  151 +
  152 + tree.refresh();
  153 +
  154 +
49 } 155 }
50 156
51 } 157 }
src/main/resources/static/pages/base/stationroute/list.html
1 <link href="/pages/base/stationroute/css/bmap_base.css" rel="stylesheet" type="text/css" /> 1 <link href="/pages/base/stationroute/css/bmap_base.css" rel="stylesheet" type="text/css" />
  2 +
2 <div class="portlet-body"> 3 <div class="portlet-body">
  4 +
3 <!-- 地图 --> 5 <!-- 地图 -->
4 <div id="bmap_basic" class="bmaps"></div> 6 <div id="bmap_basic" class="bmaps"></div>
5 - <div class="portlet box protlet-box">  
6 - <!-- 栏标题 --> 7 +
  8 +
  9 + <div class="portlet box protlet-box" style="top:20px">
  10 +
  11 + <!-- 左边标题栏 -->
7 <div class="portlet-title" style="background-color:#3B3F51"> 12 <div class="portlet-title" style="background-color:#3B3F51">
8 <div class="caption"> 13 <div class="caption">
9 途径站点 14 途径站点
@@ -12,23 +17,28 @@ @@ -12,23 +17,28 @@
12 <a href="javascript:;" class="collapse" data-original-title="" title=""> </a> 17 <a href="javascript:;" class="collapse" data-original-title="" title=""> </a>
13 </div> 18 </div>
14 </div> 19 </div>
  20 +
  21 +
15 <!-- 左边栏 --> 22 <!-- 左边栏 -->
16 <div class="portlet-body" style="border: 1px solid rgb(255, 255, 255); display: block;min-height: 200px;"> 23 <div class="portlet-body" style="border: 1px solid rgb(255, 255, 255); display: block;min-height: 200px;">
  24 +
17 <div class="row"> 25 <div class="row">
18 - <!-- 左边栏标题 --> 26 +
  27 + <!-- 上下行栏 -->
19 <div class="col-md-3 col-sm-3 col-xs-3"> 28 <div class="col-md-3 col-sm-3 col-xs-3">
20 - <ul class="nav nav-tabs tabs-left"> 29 + <ul class="nav nav-tabs tabs-left" id="leftUpOrDown">
21 <li class="active"> 30 <li class="active">
22 - <a href="#stationUp" data-toggle="tab" aria-expanded="true"> 上行 </a> 31 + <a href="#stationUp" data-toggle="tab" id="upLine" aria-expanded="true"> 上行 </a>
23 </li> 32 </li>
24 <li class=""> 33 <li class="">
25 - <a href="#stationDown" data-toggle="tab" aria-expanded="false"> 下行 </a> 34 + <a href="#stationDown" data-toggle="tab" id="downLine" aria-expanded="false"> 下行 </a>
26 </li> 35 </li>
27 </ul> 36 </ul>
28 </div> 37 </div>
29 38
30 <div class="col-md-9 col-sm-9 col-xs-9"> 39 <div class="col-md-9 col-sm-9 col-xs-9">
31 <div class="tab-content"> 40 <div class="tab-content">
  41 +
32 <!-- 左边栏上行 --> 42 <!-- 左边栏上行 -->
33 <div class="tab-pane active in" id="stationUp" data-direction="0"> 43 <div class="tab-pane active in" id="stationUp" data-direction="0">
34 <div class="portlet-body" id="uptreeMobal" style="display: none"> 44 <div class="portlet-body" id="uptreeMobal" style="display: none">
@@ -43,15 +53,19 @@ @@ -43,15 +53,19 @@
43 </a> 53 </a>
44 <ul class="dropdown-menu pull-right" style="min-width:100px"> 54 <ul class="dropdown-menu pull-right" style="min-width:100px">
45 <li> 55 <li>
46 - <a href="javascript:;" id="addStation"><i class="fa fa-plus"></i> 添加</a> 56 + <a href="javascript:;" id="addUpStation"><i class="fa fa-plus"></i> 添加站点</a>
47 </li> 57 </li>
48 <li class="divider"> </li> 58 <li class="divider"> </li>
49 <li> 59 <li>
50 - <a href="javascript:;" id="editStation"><i class="fa fa-pencil"></i> 修改</a> 60 + <a href="javascript:;" id="editUpStation"><i class="fa fa-pencil"></i> 修改站点</a>
51 </li> 61 </li>
52 - <li class="divider"> </li> 62 + <li class="divider"> </li>
  63 + <li>
  64 + <a href="javascript:;" id="deleteUpStation"><i class="fa fa-close"></i> 删除站点</a>
  65 + </li>
  66 + <li class="divider"> </li>
53 <li> 67 <li>
54 - <a href="javascript:;" id="deleteStation"><i class="fa fa-close"></i> 删除</a> 68 + <a href="javascript:;" id="editUplineTrend"><i class="fa fa-close"></i> 编辑走向</a>
55 </li> 69 </li>
56 </ul> 70 </ul>
57 </div> 71 </div>
@@ -62,49 +76,121 @@ @@ -62,49 +76,121 @@
62 </div> 76 </div>
63 <!-- 树 --> 77 <!-- 树 -->
64 <div class="portlet-body"> 78 <div class="portlet-body">
65 - <div id="station_tree"></div> 79 + <div id="station_Up_tree" style="height: 550px;overflow-y: auto;"></div>
66 </div> 80 </div>
67 </div> 81 </div>
68 82
69 - <!-- --> 83 + <!-- 无上行站点添加方式 -->
70 <div id="upToolsMobal" class="portlet-body" style="display:none"> 84 <div id="upToolsMobal" class="portlet-body" style="display:none">
71 - <div class="col-md-6" style="float: right;">  
72 - <div class="btn-group" style="float: right;"> 85 + <div class="row">
  86 + <div class="col-md-6" style="float: right;">
  87 + <div class="btn-group" style="float: right;">
  88 + <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>
  92 + <ul class="dropdown-menu pull-right" style="min-width:100px">
  93 + <li>
  94 + <a class="upSystem" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-wrench"></i> 系统规划</a>
  95 + </li>
  96 + <li class="divider"> </li>
  97 + <li>
  98 + <a class="upManual" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-pencil"></i> 手动规划</a>
  99 + </li>
  100 + </ul>
  101 + </div>
  102 + </div>
  103 + </div>
  104 + </div>
  105 + <div class="row" style="margin-top: 10px;">
  106 + <div class="col-md-12">
  107 + <!-- 提示 -->
  108 + <div class="alert alert-warning">
  109 + <strong>系统未初始化该线路上行站点!</strong> 请从上方工具里选择任意一种方式规划该线路上行站点 </div>
  110 + </div>
  111 + </div>
  112 + </div>
  113 +
  114 + </div>
  115 +
  116 + <!-- 下行 -->
  117 + <div class="tab-pane fade" id="stationDown" data-direction="1">
  118 + <div class="portlet-body" id="DowntreeMobal" style="display: none">
  119 + <div class="table-toolbar">
  120 + <div class="row">
  121 + <div class="col-md-6" style="float: right;">
  122 + <div class="btn-group" style="float: right;">
  123 + <div class="actions module_tools">
  124 + <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"> 工具
  126 + <i class="fa fa-angle-down"></i>
  127 + </a>
  128 + <ul class="dropdown-menu pull-right" style="min-width:100px">
  129 + <li>
  130 + <a href="javascript:;" id="addDownStation"><i class="fa fa-plus"></i> 添加站点</a>
  131 + </li>
  132 + <li class="divider"> </li>
  133 + <li>
  134 + <a href="javascript:;" id="editDownStation"><i class="fa fa-pencil"></i> 修改站点</a>
  135 + </li>
  136 + <li class="divider"> </li>
  137 + <li>
  138 + <a href="javascript:;" id="deleteDownStation"><i class="fa fa-close"></i> 删除站点</a>
  139 + </li>
  140 + <li class="divider"> </li>
  141 + <li>
  142 + <a href="javascript:;" id="editDownlineTrend"><i class="fa fa-close"></i> 编辑走向</a>
  143 + </li>
  144 + </ul>
  145 + </div>
  146 + </div>
  147 + </div>
  148 + </div>
  149 + </div>
  150 + </div>
  151 + <!-- 树 -->
  152 + <div class="portlet-body">
  153 + <div id="station_Down_tree" style="height: 550px;overflow-y: auto;"></div>
  154 + </div>
  155 + </div>
  156 +
  157 + <!-- 无上行站点添加方式 -->
  158 + <div id="downToolsMobal" class="portlet-body" style="display:none">
  159 + <div class="row">
  160 + <div class="col-md-6" style="float: right;">
  161 + <div class="btn-group" style="float: right;">
73 <div class="actions"> 162 <div class="actions">
74 <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"> 工具 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"> 工具
75 <i class="fa fa-angle-down"></i> 164 <i class="fa fa-angle-down"></i>
76 </a> 165 </a>
77 <ul class="dropdown-menu pull-right" style="min-width:100px"> 166 <ul class="dropdown-menu pull-right" style="min-width:100px">
78 <li> 167 <li>
79 - <a class="system" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-wrench"></i> 系统规划</a> 168 + <a class="downSystem" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-wrench"></i> 系统规划</a>
80 </li> 169 </li>
81 <li class="divider"> </li> 170 <li class="divider"> </li>
82 <li> 171 <li>
83 - <a class="manual" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-pencil"></i> 手动规划</a> 172 + <a class="downManual" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-pencil"></i> 手动规划</a>
84 </li> 173 </li>
85 </ul> 174 </ul>
86 -  
87 - </div> 175 + </div>
88 </div> 176 </div>
89 </div> 177 </div>
90 - <div class="col-md-6"> 178 + </div>
  179 + <div class="row" style="margin-top: 10px;">
  180 + <div class="col-md-12">
91 <!-- 提示 --> 181 <!-- 提示 -->
92 - <div class="alert alert-danger ">  
93 - <span class="help-block"> 请从右边选择任意一种方式规划线路上行站点 </span>  
94 - </div> 182 + <div class="alert alert-warning">
  183 + <strong>系统未初始化该线路下行站点!</strong> 请从上方工具里选择任意一种方式规划该线路下行站点
  184 + </div>
95 </div> 185 </div>
96 - </div>  
97 -  
98 - </div>  
99 -  
100 - <!-- 下行 -->  
101 - <div class="tab-pane fade" id="stationDown"></div>  
102 - 186 + </div>
  187 + </div>
103 </div> 188 </div>
104 </div> 189 </div>
105 - </div>  
106 - </div> 190 + </div>
  191 + </div>
107 </div> 192 </div>
  193 + </div>
108 </div> 194 </div>
109 <script type="text/javascript"> 195 <script type="text/javascript">
110 196
@@ -116,16 +202,24 @@ @@ -116,16 +202,24 @@
116 * 202 *
117 * - - - - - > map :地图 203 * - - - - - > map :地图
118 * 204 *
119 - * - - - - - > polyType:图形类型  
120 - *  
121 * - - - - - > drawingManager:鼠标绘制完成返回数据 205 * - - - - - > drawingManager:鼠标绘制完成返回数据
122 * 206 *
123 * - - - - - > addStationNameValue:新增选择系统生成新增方式的站点名称 207 * - - - - - > addStationNameValue:新增选择系统生成新增方式的站点名称
124 * 208 *
125 - * - - - - - > addSttationPoints:新增选择系统生成新增方式的站点名称 209 + * - - - - - > circle:圆
  210 + *
  211 + * - - - - - > polygon:多边形
  212 + *
  213 + * - - - - - > polyUpline 线路上行走向
  214 + *
  215 + * - - - - - > addStaitonParmas 新增站点保存参数集合
  216 + *
  217 + * - - - - - > editStationParmas 编辑站点保存参数集合
  218 + *
  219 + * - - - - - > status 绘画状态:新增与编辑
126 */ 220 */
127 - var id = '';dir = '';polyType='';map = '', drawingManager = '',pointE = '',addStationNameValue = '',  
128 - addSttationPoints = ''; 221 + var id = '',dir = '',map = '', drawingManager = '',addStationNameValue = '',
  222 + circle='',marker = '',polyUpline='',addStaitonParmas = {},editStationParmas={},status='';
129 223
130 224
131 </script> 225 </script>
src/main/resources/static/pages/base/stationroute/station_tabledate.html 0 → 100644
  1 +<!-- 新增站点选择系统引用 -->
  2 +<div class="modal fade" id="station_tableDate_mobal" tabindex="-1" role="basic" aria-hidden="true">
  3 +
  4 + <div class="modal-dialog" style="width:800px;">
  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 + <div class="portlet-body">
  15 + <div class="table-container" style="margin-top: 10px">
  16 + <table class="table table-striped table-bordered table-hover table-checkable" id="station_select_tabledate">
  17 + <thead>
  18 + <tr role="row" class="heading">
  19 + <th width="3%">#</th>
  20 + <th width="15%">站点名称</th>
  21 + <th width="17%">站点编码</th>
  22 + <th width="12%">经纬度</th>
  23 + <th width="12%">图形类型</th>
  24 + <th width="30%">操作</th>
  25 + </tr>
  26 + <tr role="row" class="filter">
  27 + <td></td>
  28 + <td>
  29 + <input type="text" class="form-control form-filter input-sm" id="stationName_eq" name="stationName_eq">
  30 + </td>
  31 + <td>
  32 + <input type="text" class="form-control form-filter input-sm" id="stationCod_like" name="stationCod_like">
  33 + </td>
  34 +
  35 + <td>
  36 + </td>
  37 + <td>
  38 + </td>
  39 + <td>
  40 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" >
  41 + <i class="fa fa-search"></i> 搜索
  42 + </button>
  43 +
  44 + <button class="btn btn-sm red btn-outline filter-cancel">
  45 + <i class="fa fa-times"></i> 重置
  46 + </button>
  47 + </td>
  48 + </tr>
  49 + </thead>
  50 + <tbody></tbody>
  51 + </table>
  52 + <div style="text-align: right;">
  53 + <ul id="pagination" class="pagination"></ul>
  54 + </div>
  55 + </div>
  56 + </div>
  57 + </div>
  58 + <div class="modal-footer">
  59 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
  60 + <button type="button" class="btn btn-primary" id="stationTabledatenextButton">确定</button>
  61 + </div>
  62 + </div>
  63 + </div>
  64 +</div>
  65 +<script type="text/html" id="station_tabledate_temp">
  66 + {{each list as obj i }}
  67 + <tr>
  68 + <td style="vertical-align: middle;">
  69 + <input type="checkbox" class="group-checkable icheck" data-id="{{obj.id}}" data-stationName="{{obj.stationName}}" data-stationCod="{{obj.stationCod}}">
  70 + </td>
  71 + <td>
  72 + {{obj.stationName}}
  73 + </td>
  74 + <td>
  75 + {{obj.stationCod}}
  76 + </td>
  77 + <td>
  78 + {{obj.bJwpoints}}
  79 + </td>
  80 + <td>
  81 + {{obj.shapesType}}
  82 + </td>
  83 + <td>
  84 + </td>
  85 + </tr>
  86 + {{/each}}
  87 + {{if list.length == 0}}
  88 + <tr>
  89 + <td colspan=8><h6 class="muted">没有找到相关数据</h6></td>
  90 + </tr>
  91 + {{/if}}
  92 +</script>
  93 +<script type="text/javascript">
  94 +
  95 +$(function(){
  96 +
  97 + // 延迟加载
  98 + setTimeout(function(){
  99 +
  100 + $('#station_tableDate_mobal').modal({
  101 +
  102 + show : true,
  103 +
  104 + width : 'auto',
  105 +
  106 + backdrop: 'static',
  107 +
  108 + keyboard: false
  109 +
  110 +
  111 + });
  112 +
  113 + },200);
  114 +
  115 +
  116 + // 选择确定事件
  117 + $('#stationTabledatenextButton').on('click',function() {
  118 +
  119 + // 获取选中行元素
  120 + var arrChk = $("input[type='checkbox']:checked");
  121 +
  122 + if(arrChk.length==0) {
  123 +
  124 + // 弹出框 (0:感叹号;1:对号;2:错号;3:问号;4:锁;5:苦脸;6:笑脸)
  125 + layer.confirm('【请选择一行...】', {btn : [ '确定' ],icon: 0, title:'温馨提示'}, function(index) {
  126 +
  127 + // 关闭提示框
  128 + layer.close(index);
  129 +
  130 + });
  131 +
  132 + }else if(arrChk.length>1){
  133 +
  134 + // 弹出框 (0:感叹号;1:对号;2:错号;3:问号;4:锁;5:苦脸;6:笑脸)
  135 + layer.confirm('【请只选择一行...】', {btn : [ '确定' ],icon: 0, title:'温馨提示'}, function(index) {
  136 +
  137 + // 关闭提示框
  138 + layer.close(index);
  139 +
  140 + });
  141 +
  142 + }else {
  143 +
  144 + var stationId = arrChk.data('id');
  145 +
  146 + $post('/stationroute/systemQuote',{lineId:id,stationId:stationId},function() {
  147 +
  148 +
  149 + });
  150 + console.log();
  151 +
  152 + }
  153 +
  154 + });
  155 +
  156 + var stationNamebootbox = $('#stationNamebootbox').val();
  157 +
  158 + $('#stationName_eq').val(stationNamebootbox);
  159 +
  160 + /**
  161 + * -----page : 当前页
  162 + *
  163 + * -----initPag :
  164 + *
  165 + */
  166 + var page = 0,initPag;
  167 +
  168 + // 选择框
  169 + var icheckOptions = {
  170 + checkboxClass: 'icheckbox_flat-blue',
  171 + increaseArea: '20%'
  172 + };
  173 +
  174 + // 表格数据分页加载
  175 + loadTableDate({stationName_eq:stationNamebootbox},true);
  176 +
  177 + /**
  178 + * 重置按钮事件
  179 + *
  180 + */
  181 + $('tr.filter .filter-cancel').on('click',function(){
  182 + // 清空搜索框值
  183 + $('tr.filter input,select').val('').change();
  184 + // 重新加载表格数据
  185 + loadTableDate(null,true);
  186 + });
  187 +
  188 + /**
  189 + * 搜索按钮事件
  190 + *
  191 + */
  192 + $('tr.filter .filter-submit').on('click',function(){
  193 + // cells 集合返回表格中所有(列)单元格的一个数组
  194 + var cells = $('tr.filter')[0].cells;
  195 + // 搜索参数集合
  196 + var params = {};
  197 + // 搜索字段名称
  198 + var name;
  199 + // 遍历cells数组
  200 + $.each(cells, function(i, cell){
  201 + // 获取第i列的input或者select集合
  202 + var items = $('input,select', cell);
  203 + // 遍历items集合
  204 + for(var j = 0, item; item = items[j++];){
  205 + // 获取字段名称
  206 + name = $(item).attr('name');
  207 + if(name){
  208 + // 赋取相对应的值
  209 + params[name] = $(item).val();
  210 + }
  211 + }
  212 + });
  213 + page = 0;
  214 +
  215 + loadTableDate(params,true);
  216 + });
  217 +
  218 + /**
  219 + * 表格数据分页加载事件
  220 + *
  221 + * ------@param : 查询参数
  222 + *
  223 + * ------@isPon : 是否重新分页
  224 + *
  225 + */
  226 + function loadTableDate(param,isPon){
  227 + // 搜索参数
  228 + var params = {};
  229 + if(param)
  230 + params = param;
  231 + // 排序(按更新时间)
  232 + params['order'] = 'id';
  233 + // 记录当前页数
  234 + params['page'] = page;
  235 + // 弹出正在加载层
  236 + var i = layer.load(2);
  237 + // 异步请求获取表格数据
  238 + $.get('/station',params,function(result){
  239 + console.log(result);
  240 + // 把数据填充到模版中
  241 + var tbodyHtml = template('station_tabledate_temp',{list:result.content});
  242 + // 把渲染好的模版html文本追加到表格中
  243 + $('#station_select_tabledate tbody').html(tbodyHtml);
  244 + // 制定复选框
  245 + $('#station_select_tabledate tbody').find('.icheck').iCheck(icheckOptions);
  246 + // 复选框改变事件
  247 + $('#station_select_tabledate tbody').find('.icheck').on('ifChanged', iCheckChange);
  248 + // 是重新分页且返回数据长度大于0
  249 + if(isPon && result.content.length > 0){
  250 + // 重新分页
  251 + initPag = true;
  252 + // 分页栏
  253 + showPagination(result);
  254 + }
  255 + // 关闭弹出加载层
  256 + layer.close(i);
  257 + });
  258 + }
  259 +
  260 + /**
  261 + * 复选框组件
  262 + *
  263 + */
  264 + function iCheckChange(){
  265 + // 获取当前的父节点tr
  266 + var tr = $(this).parents('tr');
  267 +
  268 + // 判断当前是否选中
  269 + if(this.checked)
  270 + // 选中,则增添父节点tr的样式
  271 + tr.addClass('row-active');
  272 + else
  273 + // 未选中,则删除父节点tr的样式
  274 + tr.removeClass('row-active');
  275 + }
  276 +
  277 + /**
  278 + * 分页栏组件
  279 + *
  280 + */
  281 + function showPagination(data){
  282 + // 分页组件
  283 + $('#pagination').jqPaginator({
  284 + // 总页数
  285 + totalPages: data.totalPages,
  286 + // 中间显示页数
  287 + visiblePages: 6,
  288 + // 当前页
  289 + currentPage: page + 1,
  290 + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
  291 + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
  292 + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
  293 + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
  294 + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
  295 + onPageChange: function (num, type) {
  296 + if(initPag){
  297 + initPag = false;
  298 + return;
  299 + }
  300 + page = num - 1;
  301 + loadTableDate(null, false);
  302 + }
  303 + });
  304 + }
  305 +
  306 +});
  307 +</script>
0 \ No newline at end of file 308 \ No newline at end of file