Commit efeb96b0cba0b4845dfe45870ff29c75434d08cd

Authored by 李强
1 parent 8dd6f47c

基础数据功能模块完善

Showing 26 changed files with 2923 additions and 669 deletions

Too many changes to show.

To preserve performance only 26 of 31 files are displayed.

src/main/java/com/bsth/controller/SectionRouteController.java
1 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 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 10 import org.springframework.web.bind.annotation.RestController;
5 11  
6 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 31 @RestController
25 32 @RequestMapping("sectionroute")
26 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 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 66 @RequestMapping(value="getStationCode" , method = RequestMethod.GET)
58 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 38 @Autowired
39 39 StationRouteService service;
40 40  
41   - @RequestMapping(method = RequestMethod.GET)
  41 + /*@RequestMapping(method = RequestMethod.GET)
42 42 public Page<StationRoute> list(@RequestParam Map<String, Object> map,
43 43 @RequestParam(defaultValue = "0") int page,
44 44 @RequestParam(defaultValue = "5") int size,
... ... @@ -53,10 +53,20 @@ public class StationRouteController extends BaseController&lt;StationRoute, Integer
53 53 d = Direction.DESC;
54 54  
55 55 return service.list(map, new PageRequest(page, size, new Sort(d, order)));
56   - }
  56 + }*/
57 57  
58 58 @RequestMapping(value = "/findStations" , method = RequestMethod.GET)
59 59 public List<Map<String, Object>> findPoints(@RequestParam Map<String, Object> map) {
60 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 83 // 版本号
84 84 private Integer versions;
85 85  
  86 + // 是否撤销
  87 + private Integer destroy;
  88 +
86 89 // 描述
87 90 private String descriptions;
88 91  
... ... @@ -204,7 +207,7 @@ public class StationRoute {
204 207 public void setDirections(Integer directions) {
205 208 this.directions = directions;
206 209 }
207   -
  210 +
208 211 public Integer getVersions() {
209 212 return versions;
210 213 }
... ... @@ -212,6 +215,14 @@ public class StationRoute {
212 215 public void setVersions(Integer versions) {
213 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 227 public String getDescriptions() {
217 228 return descriptions;
... ...
src/main/java/com/bsth/repository/SectionRouteRepository.java
... ... @@ -2,6 +2,7 @@ package com.bsth.repository;
2 2  
3 3 import java.util.List;
4 4  
  5 +import org.springframework.data.jpa.repository.Query;
5 6 import org.springframework.stereotype.Repository;
6 7  
7 8 import com.bsth.entity.SectionRoute;
... ... @@ -25,5 +26,38 @@ import com.bsth.entity.SectionRoute;
25 26 @Repository
26 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 1 package com.bsth.repository;
2 2  
  3 +import java.util.List;
  4 +
3 5 import org.springframework.data.jpa.repository.Modifying;
4 6 import org.springframework.data.jpa.repository.Query;
5 7 import org.springframework.stereotype.Repository;
... ... @@ -26,22 +28,24 @@ import com.bsth.entity.Station;
26 28 @Repository
27 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 31 // 查询最大ID
32 32 @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_station) k"
33 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 41 @Transactional
38 42 @Modifying
39 43 @Query(value="INSERT INTO bsth_c_station (" +
40 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 46 "destroy , radius , shapes_type , versions , descriptions," +
43 47 "create_by,update_by) " +
44   - "VALUES(" +
  48 + " VALUES(" +
45 49 "?1 , ?2 , ?3 , ?4 , ?5," +
46 50 "?6 , ?7 , ?8 , ?9 , GeomFromText(?10),GeomFromText(?11)," +
47 51 "?12 ,?13, ?14, ?15, ?16," +
... ... @@ -51,6 +55,33 @@ public interface StationRepository extends BaseRepository&lt;Station, Integer&gt; {
51 55 Float gLonx, Float gLaty, Float x,Float y, String gPloygonGrid, String bPloygonGrid,
52 56  
53 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 26 @Repository
27 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 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 1 package com.bsth.service;
2 2  
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
3 6 import com.bsth.entity.SectionRoute;
4 7  
5 8 /**
... ... @@ -18,5 +21,6 @@ import com.bsth.entity.SectionRoute;
18 21 *
19 22 */
20 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 23 public interface StationRouteService extends BaseService<StationRoute, Integer> {
24 24  
25 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 27  
28 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 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 9 import org.springframework.stereotype.Service;
4 10  
5 11 import com.bsth.entity.SectionRoute;
  12 +import com.bsth.repository.SectionRouteRepository;
6 13 import com.bsth.service.SectionRouteService;
7 14  
8 15 /**
... ... @@ -23,5 +30,57 @@ import com.bsth.service.SectionRouteService;
23 30  
24 31 @Service
25 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 8 import org.springframework.beans.factory.annotation.Autowired;
9 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 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 20 import com.bsth.repository.StationRouteRepository;
13 21 import com.bsth.service.StationRouteService;
14 22  
... ... @@ -34,6 +42,15 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
34 42 @Autowired
35 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 54 @Override
38 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 62  
46 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 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 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 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 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 1 package com.bsth.service.impl;
2 2  
  3 +import java.math.BigDecimal;
3 4 import java.util.ArrayList;
4 5 import java.util.HashMap;
5 6 import java.util.List;
6 7 import java.util.Map;
7 8  
8   -import javax.persistence.criteria.CriteriaBuilder.In;
9   -
10 9 import org.slf4j.Logger;
11 10 import org.slf4j.LoggerFactory;
12 11 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -105,50 +104,28 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
105 104  
106 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 107 for(int i = 0;i <stationsArray.size();i++) {
118 108  
119   - // 初始化站点对象
120   - Station arg0 = new Station();
121   -
122 109 // 站点名称
123 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 131 String bJwpoints = "";
... ... @@ -161,9 +138,65 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
161 138  
162 139 // 百度经纬度
163 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 202 StationRoute route = new StationRoute();
... ... @@ -171,11 +204,16 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
171 204 // 站点名称
172 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 219 if(i==0) {
... ... @@ -210,15 +248,12 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
210 248 // 线路编码
211 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 302  
268 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 321 String crosesRoad = "";
... ... @@ -309,6 +356,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
309 356 // 说明
310 357 String descriptions = "";
311 358  
  359 +
312 360 sectionRepository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode,
313 361  
314 362 middleNode, gsectionVector, bsectionVector, sectionType, csectionVector,
... ... @@ -316,6 +364,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
316 364 roadCoding, sectionDistance, sectionTime, dbType, speedLimit,
317 365  
318 366 descriptions, versions);
  367 +
319 368  
320 369  
321 370 Section section = sectionRepository.findOne(Integer.parseInt(sectionCode));
... ... @@ -336,7 +385,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
336 385 sectionRoute.setLine(resultLine);
337 386  
338 387 // 路段编码
339   - sectionRoute.setSectionCode(section.getSectionCode());
  388 + sectionRoute.setSectionCode(sectionCode);
340 389  
341 390 // 版本
342 391 sectionRoute.setVersions(versions);
... ... @@ -344,7 +393,6 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
344 393 // 方向
345 394 sectionRoute.setDirections(directions);
346 395  
347   -
348 396 sectionRouteRepository.save(sectionRoute);
349 397 }
350 398  
... ... @@ -360,7 +408,36 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
360 408  
361 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 441 @Override
365 442 public int getStationCode() {
366 443  
... ... @@ -376,7 +453,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
376 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 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 467 // 原坐标点
391 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 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 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 500 Float y = map.get("y").equals("") ? null : Float.parseFloat(map.get("y").toString());
404 501  
405 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 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 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 551 gLonx, gLaty, x, y, gPloygonGrid,bPloygonGrid, destroy, radius,
436 552  
437 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 587 resultMap.put("status", ResponseCode.SUCCESS);
441 588  
... ... @@ -454,4 +601,171 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
454 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 148 <a href="/pages/base/lineinformation/list.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 查看 </a>
149 149 </td>
150 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 152 </td>
153 153 <td>
154 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 220 \ No newline at end of file
... ...
src/main/resources/static/pages/base/section/list.html
1 1 <div class="page-head">
2 2 <div class="page-title">
3   - <h1>站点信息</h1>
  3 + <h1>路段信息</h1>
4 4 </div>
5 5 </div>
6 6  
7 7 <ul class="page-breadcrumb breadcrumb">
8 8 <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
9 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 11 </ul>
12 12  
13 13 <div class="row">
... ... @@ -16,11 +16,11 @@
16 16 <div class="portlet-title">
17 17 <div class="caption">
18 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 20 </div>
21 21 <div class="actions">
22 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 24 </div>
25 25 </div>
26 26 </div>
... ... @@ -30,15 +30,14 @@
30 30 <thead>
31 31 <tr role="row" class="heading">
32 32 <th width="3%">#</th>
33   - <th width="8%">线路编</th>
  33 + <th width="8%">线路编</th>
34 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 41 <th width="15%">操作</th>
43 42 </tr>
44 43 <tr role="row" class="filter">
... ... @@ -62,9 +61,6 @@
62 61 <input type="text" class="form-control form-filter input-sm" name="endStationName">
63 62 </td>
64 63 <td>
65   - <input type="text" class="form-control form-filter input-sm" name="brancheCompany">
66   - </td>
67   - <td>
68 64 <input type="text" class="form-control form-filter input-sm" name="company">
69 65 </td>
70 66 <td>
... ... @@ -95,7 +91,7 @@
95 91 </div>
96 92 </div>
97 93 </div>
98   -<script type="text/html" id="line_list_temp">
  94 +<script type="text/html" id="sectionInfo_list_table_temp">
99 95 {{each list as obj i }}
100 96 <tr>
101 97 <td style="vertical-align: middle;">
... ... @@ -105,31 +101,29 @@
105 101 {{obj.lineCode}}
106 102 </td>
107 103 <td>
108   - {{obj.name}}
109   - </td>
110   - <td>
111   - {{obj.carSumNumber}}
  104 + {{obj.line.name}}
112 105 </td>
113 106 <td>
114   - {{obj.carParkCode}}
  107 + {{obj.directions}}
115 108 </td>
116 109 <td>
117   - {{obj.startStationName}}
  110 + {{obj.section.sectionName}}
118 111 </td>
119 112 <td>
120   - {{obj.endStationName}}
  113 + {{obj.sectionCode}}
121 114 </td>
122 115 <td>
123   - {{obj.company}}
  116 + {{obj.sectionrouteCode}}
124 117 </td>
125 118 <td>
126   - {{obj.brancheCompany}}
  119 + {{obj.versions}}
127 120 </td>
128 121 <td>
129 122 {{obj.destroy}}
130 123 </td>
131 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 127 </td>
134 128 </tr>
135 129 {{/each}}
... ... @@ -139,4 +133,4 @@
139 133 </tr>
140 134 {{/if}}
141 135 </script>
142   -<script src="/pages/base/line/js/list.js"></script>
143 136 \ No newline at end of file
  137 +<script src="/pages/base/section/js/section-list-table.js"></script>
144 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 220 \ No newline at end of file
... ...
src/main/resources/static/pages/base/station/list.html
... ... @@ -30,10 +30,13 @@
30 30 <thead>
31 31 <tr role="row" class="heading">
32 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 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 40 <th width="8%">版本号</th>
38 41 <th width="8%">是否撤销</th>
39 42 <th width="15%">操作</th>
... ... @@ -53,6 +56,15 @@
53 56 <input type="text" class="form-control form-filter input-sm" name="brancheCompany">
54 57 </td>
55 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 68 <input type="text" class="form-control form-filter input-sm" name="company">
57 69 </td>
58 70 <td>
... ... @@ -83,7 +95,7 @@
83 95 </div>
84 96 </div>
85 97 </div>
86   -<script type="text/html" id="line_list_temp">
  98 +<script type="text/html" id="staitonInfo_list_table_temp">
87 99 {{each list as obj i }}
88 100 <tr>
89 101 <td style="vertical-align: middle;">
... ... @@ -93,31 +105,32 @@
93 105 {{obj.lineCode}}
94 106 </td>
95 107 <td>
96   - {{obj.name}}
  108 + {{obj.line.name}}
97 109 </td>
98 110 <td>
99   - {{obj.carSumNumber}}
  111 + {{obj.directions}}
100 112 </td>
101 113 <td>
102   - {{obj.carParkCode}}
  114 + {{obj.stationName}}
103 115 </td>
104 116 <td>
105   - {{obj.startStationName}}
  117 + {{obj.stationCode}}
106 118 </td>
107 119 <td>
108   - {{obj.endStationName}}
  120 + {{obj.stationRouteCode}}
109 121 </td>
110 122 <td>
111   - {{obj.company}}
  123 + {{obj.stationMark}}
112 124 </td>
113 125 <td>
114   - {{obj.brancheCompany}}
  126 + {{obj.versions}}
115 127 </td>
116 128 <td>
117 129 {{obj.destroy}}
118 130 </td>
119 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 134 </td>
122 135 </tr>
123 136 {{/each}}
... ... @@ -127,4 +140,4 @@
127 140 </tr>
128 141 {{/if}}
129 142 </script>
130   -<script src="/pages/base/line/js/list.js"></script>
131 143 \ No newline at end of file
  144 +<script src="/pages/base/station/js/station-list-table.js"></script>
132 145 \ No newline at end of file
... ...
src/main/resources/static/pages/base/stationroute/add.html
... ... @@ -18,6 +18,19 @@
18 18 您的输入有误,请检查下面的输入项
19 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 35 <div class="form-body">
23 36 <div class="form-group">
... ... @@ -50,7 +63,7 @@
50 63 </label>
51 64 <div class="col-md-6">
52 65 <select name="stationRouteCode" class="form-control" id="stationrouteSelect"></select>
53   - <span class="help-block"> 选择的站点将作为本站序号的参考,成为选择站点的下一站。 </span>
  66 + <span class="help-block"> *说明:选择的站点将作为本站序号的参考,成为选择站点的下一站。 </span>
54 67 </div>
55 68 </div>
56 69 </div>
... ... @@ -89,12 +102,32 @@
89 102 </div>
90 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 116 <div class="form-body">
94 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 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 131 </div>
99 132 </div>
100 133 </div>
... ... @@ -113,6 +146,27 @@
113 146 </div>
114 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 171 <div class="form-body">
118 172 <div class="form-group">
... ... @@ -145,6 +199,20 @@
145 199 </div>
146 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 217 <div class="form-group">
150 218 <label class="control-label col-md-3"> 描述/说明: </label>
... ... @@ -155,7 +223,7 @@
155 223 </form>
156 224 </div>
157 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 227 <button type="button" class="btn btn-primary" id="addStationButton">提交数据</button>
160 228 </div>
161 229 </div>
... ... @@ -164,47 +232,95 @@
164 232 <script type="text/javascript">
165 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 326 $('#stationrouteSelect').on('change',function() {
... ... @@ -215,6 +331,8 @@ $(function(){
215 331  
216 332 var tempStr = stationRValue.split('_');
217 333  
  334 + console.log(tempStr);
  335 +
218 336 if(tempStr[1] == 'E') {
219 337  
220 338 $('#stationMarkSelect').val('E');
... ... @@ -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 351 var form = $('#add_station_form');
256 352  
... ... @@ -376,179 +472,31 @@ $(function(){
376 472  
377 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 71 \ No newline at end of file
... ...
src/main/resources/static/pages/base/stationroute/add_select.html
1   -<!-- 新增选择站点 -->
  1 +<!-- 选择站点新增方式 -->
2 2 <div class="modal fade" id="add_select_mobal" tabindex="-1" role="basic" aria-hidden="true">
3 3  
4 4 <div class="modal-dialog">
... ... @@ -7,31 +7,27 @@
7 7  
8 8 <div class="modal-header">
9 9 <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
10   - <h4 class="modal-title">新增站点</h4>
  10 + <h4 class="modal-title">站点新增方式</h4>
11 11 </div>
12 12  
13 13 <div class="modal-body">
14 14  
15 15 <form class="form-horizontal" action="/" method="post" id="formBootbox" role="form">
  16 +
16 17 <div class="alert alert-danger display-hide" id="requiredname">
17 18 <button class="close" data-close="alert"></button>
18 19 站点名称为必填项
19 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 23 <div class="form-group" id="formRequ">
29 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 26 <input type="text" class="form-control input-medium" id="stationNamebootbox" name="stationNamebootbox">
32 27 </div>
33 28 </div>
34 29  
  30 + <!-- 新增方式 -->
35 31 <div class="form-group">
36 32 <label class="col-md-3 control-label">新增方式:</label>
37 33 <div class="col-md-9">
... ... @@ -48,11 +44,20 @@
48 44 </div>
49 45 </div>
50 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 56 </form>
52 57 </div>
53 58 <div class="modal-footer">
54 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 61 </div>
57 62 </div>
58 63 </div>
... ... @@ -60,6 +65,7 @@
60 65 <script type="text/javascript">
61 66 $(function(){
62 67  
  68 + // 加载显示mobal
63 69 $('#add_select_mobal').modal({
64 70  
65 71 show : true,
... ... @@ -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 114 var form = $('#formBootbox');
75 115  
  116 + // 错误提示元素
76 117 var requiredname = $('#requiredname', form);
77 118  
78   - //提交
79   - $('#nextButton').on('click', function() {
  119 + // 下一步点击事件
  120 + $('#addSelectnextButton').on('click', function() {
80 121  
  122 + // 表单提交
81 123 form.submit();
82 124  
83 125 });
84 126  
85   - //form validate
  127 + // 表单验证
86 128 form.validate({
87 129  
88 130 errorElement : 'span',
... ... @@ -133,91 +175,118 @@ $(function(){
133 175  
134 176 submitHandler : function(f) {
135 177  
  178 + // 隐藏错误提示
  179 + requiredname.hide();
  180 +
  181 + // 表单序列化
136 182 var params = form.serializeJSON();
137 183  
  184 + // 获取站点名称
138 185 var stationNamebootbox = params.stationNamebootbox;
139 186  
  187 + // 获取新增站点方式
140 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 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 292 </script>
224 293 \ No newline at end of file
... ...
src/main/resources/static/pages/base/stationroute/css/bmap_base.css
... ... @@ -7,7 +7,7 @@
7 7 overflow: hidden;
8 8 }
9 9  
10   -body{
  10 +html,body{
11 11 overflow:hidden;
12 12 }
13 13  
... ... @@ -38,4 +38,52 @@ body{
38 38 border:0px solid;
39 39  
40 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 90 \ No newline at end of file
... ...
src/main/resources/static/pages/base/stationroute/edit.html
... ... @@ -7,7 +7,7 @@
7 7  
8 8 <div class="modal-header">
9 9 <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
10   - <h4 class="modal-title">新增站点</h4>
  10 + <h4 class="modal-title">编辑站点</h4>
11 11 </div>
12 12  
13 13 <div class="modal-body">
... ... @@ -18,14 +18,59 @@
18 18 您的输入有误,请检查下面的输入项
19 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 42 <div class="form-body">
23 43 <div class="form-group">
24 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 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 74 </div>
30 75 </div>
31 76 </div>
... ... @@ -36,72 +81,130 @@
36 81 <label class="control-label col-md-3">
37 82 <span class="required"> * </span>站点类型:
38 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 86 <option value="">-- 请选择站点类型 --</option>
42 87 <option value="B">起点站</option>
43 88 <option value="Z">中途站</option>
44 89 <option value="E">终点站</option>
45   - <option value="T">停车场</option>
  90 + <!-- <option value="T">停车场</option> -->
46 91 </select>
47 92 </div>
48 93 </div>
49 94 </div>
50 95  
  96 + <!-- 站点方向 -->
51 97 <div class="form-body">
52 98 <div class="form-group">
53 99 <label class="control-label col-md-3">
54   - <span class="required"> * </span>站点序号
  100 + <span class="required"> * </span>站点方向
55 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 108 </div>
59 109 </div>
60 110 </div>
61 111  
  112 + <!-- 道路编码-->
62 113 <div class="form-body">
63 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 118 </div>
70 119 </div>
71 120 </div>
72 121  
  122 + <!-- 中心位置坐标点 -->
73 123 <div class="form-body">
74 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 152 </div>
79 153 </div>
80 154 </div>
81 155  
  156 + <!-- 范围图形类型 -->
82 157 <div class="form-body">
83 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 162 </div>
88 163 </div>
89 164 </div>
90 165  
  166 + <!-- 到站时间 -->
91 167 <div class="form-body">
92 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 173 </div>
97 174 </div>
98 175 </div>
99 176  
  177 + <!-- 到站距离 -->
100 178 <div class="form-body">
101 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 208 </div>
106 209 </div>
107 210 </div>
... ... @@ -109,17 +212,15 @@
109 212 <!-- 描述/说明 -->
110 213 <div class="form-group">
111 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 217 </div>
115 218 </div>
116   -
117   -
118 219 </form>
119 220 </div>
120 221 <div class="modal-footer">
121 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 224 </div>
124 225 </div>
125 226 </div>
... ... @@ -127,36 +228,147 @@
127 228 <script type="text/javascript">
128 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 358 var form = $('#edit_station_form');
148 359  
  360 + // 获取错误提示元素
149 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 367 form.submit();
156 368  
157 369 });
158 370  
159   - //form validate
  371 + // 表单验证
160 372 form.validate({
161 373  
162 374 errorElement : 'span',
... ... @@ -167,16 +379,74 @@ $(function(){
167 379  
168 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 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 452 invalidHandler : function(event, validator) {
... ... @@ -211,28 +481,104 @@ $(function(){
211 481  
212 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 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 584 </script>
239 585 \ No newline at end of file
... ...
src/main/resources/static/pages/base/stationroute/edit_select.html
... ... @@ -7,24 +7,23 @@
7 7  
8 8 <div class="modal-header">
9 9 <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
10   - <h4 class="modal-title">新增站点</h4>
  10 + <h4 class="modal-title">选择修改站点方式</h4>
11 11 </div>
12 12  
13 13 <div class="modal-body">
14 14  
15   - <form class="form-horizontal" action="/" method="post" id="formBootbox" role="form">
16   - <div class="alert alert-danger display-hide" id="requiredname">
  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 18 <button class="close" data-close="alert"></button>
18 19 站点名称为必填项
19 20 </div>
  21 +
20 22 <div class="alert alert-danger display-hide" id="serchrname">
21 23 <button class="close" data-close="alert"></button>
22 24 系统无法生成,请选择其他方式新增
23 25 </div>
24 26  
25   - <input type="hidden" name="stationPoint" id="stationPoint" />
26   -
27   -
28 27 <div class="form-group" id="formRequ">
29 28 <label class="col-md-3 control-label"><span class="required"> * </span>站点名称:</label>
30 29 <div class="col-md-9" id="errorInfo">
... ... @@ -33,53 +32,72 @@
33 32 </div>
34 33  
35 34 <div class="form-group">
36   - <label class="col-md-3 control-label">新增方式:</label>
  35 + <label class="col-md-3 control-label">修改方式:</label>
37 36 <div class="col-md-9">
38 37 <div class="icheck-list">
39 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 43 </label>
42 44 <label >
43   - <input type="radio" class="icheck" name="baseRes" value=1 > 选择更换
  45 + <input type="radio" class="icheck" name="editselect" value=2 > 选择引用
44 46 </label>
45 47 </div>
46 48 </div>
47 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 58 </form>
49 59 </div>
50 60 <div class="modal-footer">
51 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 63 </div>
54 64 </div>
55 65 </div>
56 66 </div>
57 67 <script type="text/javascript">
  68 +
58 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 96 form.submit();
79 97  
80 98 });
81 99  
82   - //form validate
  100 + //form 表单验证
83 101 form.validate({
84 102  
85 103 errorElement : 'span',
... ... @@ -104,7 +122,7 @@ $(function(){
104 122  
105 123 invalidHandler : function(event, validator) {
106 124  
107   - requiredname.show();
  125 + editSelectrequired.show();
108 126  
109 127 App.scrollTo(requiredname, -200);
110 128  
... ... @@ -130,89 +148,43 @@ $(function(){
130 148  
131 149 submitHandler : function(f) {
132 150  
  151 + // 隐藏弹出层
  152 + $('#edit_select_mobal').modal('hide');
  153 +
  154 + // 表单序列
133 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 8 var treeDateJson = [];
9 9  
10 10 $get('/stationroute/findStations',{'line.id_eq' : id_ , 'directions_eq' : dir_},function(resultdata) {
11   -
  11 +
12 12 treeDateJson = createTreeData(resultdata);
13 13  
14 14 callback && callback(treeDateJson);
... ... @@ -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 30 getStationCode : function(callback) {
21 31  
22 32 $get('/station/getStationCode',null,function(stationCode) {
... ... @@ -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 54 getFormPointEToWGS(points,callback) {
35 55  
36 56 // 获取长度
... ... @@ -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 456 dir = $('#stationUp').data('direction');
26 457  
  458 + // 加载选择新增方式mobal
27 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 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 519 return;
53 520 }
... ... @@ -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 571 \ No newline at end of file
... ...