Commit 6f70835d350a427791936c34c655cc737ecb7212

Authored by 李强
1 parent ef7e1afd

基础数据功能完善

Showing 34 changed files with 1414 additions and 371 deletions
@@ -102,7 +102,12 @@ @@ -102,7 +102,12 @@
102 <artifactId>guava</artifactId> 102 <artifactId>guava</artifactId>
103 <version>19.0</version> 103 <version>19.0</version>
104 </dependency> 104 </dependency>
105 - 105 + <!-- ftp文件上传包 -->
  106 + <dependency>
  107 + <groupId>commons-net</groupId>
  108 + <artifactId>commons-net</artifactId>
  109 + <version>3.5</version>
  110 + </dependency>
106 <!-- drools 6依赖 --> 111 <!-- drools 6依赖 -->
107 <dependency> 112 <dependency>
108 <groupId>org.kie</groupId> 113 <groupId>org.kie</groupId>
src/main/java/com/bsth/controller/LineController.java
1 package com.bsth.controller; 1 package com.bsth.controller;
2 2
  3 +import java.util.Map;
  4 +
3 import org.springframework.beans.factory.annotation.Autowired; 5 import org.springframework.beans.factory.annotation.Autowired;
4 import org.springframework.web.bind.annotation.RequestMapping; 6 import org.springframework.web.bind.annotation.RequestMapping;
5 import org.springframework.web.bind.annotation.RequestMethod; 7 import org.springframework.web.bind.annotation.RequestMethod;
@@ -7,6 +9,7 @@ import org.springframework.web.bind.annotation.RestController; @@ -7,6 +9,7 @@ import org.springframework.web.bind.annotation.RestController;
7 9
8 import com.bsth.entity.Line; 10 import com.bsth.entity.Line;
9 import com.bsth.service.LineService; 11 import com.bsth.service.LineService;
  12 +import com.bsth.util.GetUIDAndCode;
10 13
11 /** 14 /**
12 * 15 *
@@ -31,12 +34,25 @@ public class LineController extends BaseController&lt;Line, Integer&gt; { @@ -31,12 +34,25 @@ public class LineController extends BaseController&lt;Line, Integer&gt; {
31 private LineService service; 34 private LineService service;
32 35
33 /** 36 /**
34 - * 获取线路编码 37 + * 获取线路编码与ID
35 * 38 *
36 * @return int <lineCode:线路编码> 39 * @return int <lineCode:线路编码>
37 */ 40 */
38 @RequestMapping(value = "getLineCode", method = RequestMethod.GET) 41 @RequestMapping(value = "getLineCode", method = RequestMethod.GET)
39 - public int getLineCode() {  
40 - return service.selectMaxIdToLineCode(); 42 + public long getLineCode() {
  43 + return GetUIDAndCode.getLineId();
41 } 44 }
  45 +
  46 + /**
  47 + *
  48 + * 保存
  49 + *
  50 + */
  51 + @RequestMapping(method = RequestMethod.POST)
  52 + public Map<String, Object> save(Line t){
  53 +
  54 + t.setId(Integer.valueOf(t.getLineCode()));
  55 +
  56 + return service.save(t);
  57 + }
42 } 58 }
src/main/java/com/bsth/controller/SectionRouteController.java
@@ -47,4 +47,17 @@ public class SectionRouteController extends BaseController&lt;SectionRoute, Integer @@ -47,4 +47,17 @@ public class SectionRouteController extends BaseController&lt;SectionRoute, Integer
47 return routeService.getSectionRoute(map); 47 return routeService.getSectionRoute(map);
48 } 48 }
49 49
  50 +
  51 + /**
  52 + * @Description : TODO(根据路段路由Id查询详情)
  53 + *
  54 + * @param map <id:路段路由ID>
  55 + *
  56 + * @return List<Map<String, Object>>
  57 + */
  58 + @RequestMapping(value = "/findSectionRouteInfoFormId",method = RequestMethod.GET)
  59 + public List<Map<String, Object>> findSectionRouteInfoFormId(@RequestParam Map<String, Object> map) {
  60 +
  61 + return routeService.findSectionRouteInfoFormId(map);
  62 + }
50 } 63 }
src/main/java/com/bsth/controller/StationController.java
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController; @@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
10 10
11 import com.bsth.entity.Station; 11 import com.bsth.entity.Station;
12 import com.bsth.service.StationService; 12 import com.bsth.service.StationService;
  13 +import com.bsth.util.GetUIDAndCode;
13 14
14 /** 15 /**
15 * 16 *
@@ -127,8 +128,8 @@ public class StationController extends BaseController&lt;Station, Integer&gt; { @@ -127,8 +128,8 @@ public class StationController extends BaseController&lt;Station, Integer&gt; {
127 * @return int <stationCode站点编码> 128 * @return int <stationCode站点编码>
128 */ 129 */
129 @RequestMapping(value="getStationCode" , method = RequestMethod.GET) 130 @RequestMapping(value="getStationCode" , method = RequestMethod.GET)
130 - public int getStationCode() {  
131 - return service.getStationCode(); 131 + public long getStationCode() {
  132 + return GetUIDAndCode.getStationId();
132 133
133 } 134 }
134 } 135 }
src/main/java/com/bsth/controller/StationRouteController.java
@@ -87,4 +87,31 @@ public class StationRouteController extends BaseController&lt;StationRoute, Integer @@ -87,4 +87,31 @@ public class StationRouteController extends BaseController&lt;StationRoute, Integer
87 return service.stationRouteIsDestroy(map); 87 return service.stationRouteIsDestroy(map);
88 } 88 }
89 89
  90 + /**
  91 + * @Description : TODO(根据线路ID生成行单)
  92 + *
  93 + * @param map <id:线路ID>
  94 + *
  95 + * @return Map<String, Object> <SUCCESS ; ERROR>
  96 + */
  97 + @RequestMapping(value = "/usingSingle",method = RequestMethod.POST)
  98 + public Map<String, Object> usingSingle(@RequestParam Map<String, Object> map) {
  99 +
  100 + return service.usingSingle(map);
  101 + }
  102 +
  103 +
  104 + /**
  105 + * @Description : TODO(根据站点路由Id查询详情)
  106 + *
  107 + * @param map <id:站点路由ID>
  108 + *
  109 + * @return List<Map<String, Object>>
  110 + */
  111 + @RequestMapping(value = "/findStationRouteInfo",method = RequestMethod.GET)
  112 + public List<Map<String, Object>> findStationRouteInfo(@RequestParam Map<String, Object> map) {
  113 +
  114 + return service.findStationRouteInfo(map);
  115 + }
  116 +
90 } 117 }
src/main/java/com/bsth/entity/CarPark.java
1 package com.bsth.entity; 1 package com.bsth.entity;
2 2
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Column;
3 import javax.persistence.Entity; 6 import javax.persistence.Entity;
4 import javax.persistence.GeneratedValue; 7 import javax.persistence.GeneratedValue;
5 import javax.persistence.Id; 8 import javax.persistence.Id;
@@ -8,7 +11,7 @@ import javax.persistence.Table; @@ -8,7 +11,7 @@ import javax.persistence.Table;
8 11
9 /** 12 /**
10 * 13 *
11 - * @ClassName: Line(停车场类) 14 + * @ClassName: CarPark(停车场类)
12 * 15 *
13 * @Description: TODO(停车场) 16 * @Description: TODO(停车场)
14 * 17 *
@@ -34,14 +37,70 @@ public class CarPark { @@ -34,14 +37,70 @@ public class CarPark {
34 // 停车场名称 37 // 停车场名称
35 private String parkName; 38 private String parkName;
36 39
37 - // 地理位置  
38 - private String parkPoint; 40 + // 地理位置(百度坐标)
  41 + private String bParkPoint;
  42 +
  43 + // 地理位置中心点(百度坐标)
  44 + private String bCenterPoint;
  45 +
  46 + // 地理位置(WGS坐标)
  47 + private String gParkPoint;
  48 +
  49 + // 地理位置中心点(WGS坐标)
  50 + private String gCenterPoint;
  51 +
  52 + /**
  53 + * 经纬坐标类型
  54 + *
  55 + * --------- b:百度坐标系
  56 + *
  57 + * --------- d:高德坐标系
  58 + */
  59 + private String dbType;
  60 +
  61 + /**
  62 + * 图形类型
  63 + *
  64 + * ------ r:圆形
  65 + *
  66 + * ------ p:多边形
  67 + */
  68 + private String shapesType;
  69 +
  70 + // 圆形半径
  71 + private Integer radius;
39 72
40 // 面积 73 // 面积
41 private double area; 74 private double area;
42 75
43 // 所属公司 76 // 所属公司
44 private String company; 77 private String company;
  78 +
  79 + // 分公司
  80 + private String brancheCompany;
  81 +
  82 + // 是否撤销
  83 + private Integer destroy;
  84 +
  85 + // 版本号
  86 + private Integer versions;
  87 +
  88 + // 描述
  89 + private String descriptions;
  90 +
  91 + // 创建人
  92 + private Integer createBy;
  93 +
  94 + // 修改人
  95 + private Integer updateBy;
  96 +
  97 + // 创建日期
  98 + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  99 + private Date createDate;
  100 +
  101 + // 修改日期
  102 + @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
  103 + private Date updateDate;
45 104
46 public Integer getId() { 105 public Integer getId() {
47 return id; 106 return id;
@@ -66,13 +125,61 @@ public class CarPark { @@ -66,13 +125,61 @@ public class CarPark {
66 public void setParkName(String parkName) { 125 public void setParkName(String parkName) {
67 this.parkName = parkName; 126 this.parkName = parkName;
68 } 127 }
  128 +
  129 + public String getbParkPoint() {
  130 + return bParkPoint;
  131 + }
  132 +
  133 + public void setbParkPoint(String bParkPoint) {
  134 + this.bParkPoint = bParkPoint;
  135 + }
  136 +
  137 + public String getbCenterPoint() {
  138 + return bCenterPoint;
  139 + }
  140 +
  141 + public void setbCenterPoint(String bCenterPoint) {
  142 + this.bCenterPoint = bCenterPoint;
  143 + }
  144 +
  145 + public String getgParkPoint() {
  146 + return gParkPoint;
  147 + }
  148 +
  149 + public void setgParkPoint(String gParkPoint) {
  150 + this.gParkPoint = gParkPoint;
  151 + }
  152 +
  153 + public String getDbType() {
  154 + return dbType;
  155 + }
  156 +
  157 + public void setDbType(String dbType) {
  158 + this.dbType = dbType;
  159 + }
  160 +
  161 + public String getShapesType() {
  162 + return shapesType;
  163 + }
  164 +
  165 + public void setShapesType(String shapesType) {
  166 + this.shapesType = shapesType;
  167 + }
  168 +
  169 + public Integer getRadius() {
  170 + return radius;
  171 + }
69 172
70 - public String getParkPoint() {  
71 - return parkPoint; 173 + public void setRadius(Integer radius) {
  174 + this.radius = radius;
72 } 175 }
73 176
74 - public void setParkPoint(String parkPoint) {  
75 - this.parkPoint = parkPoint; 177 + public String getgCenterPoint() {
  178 + return gCenterPoint;
  179 + }
  180 +
  181 + public void setgCenterPoint(String gCenterPoint) {
  182 + this.gCenterPoint = gCenterPoint;
76 } 183 }
77 184
78 public double getArea() { 185 public double getArea() {
@@ -82,6 +189,14 @@ public class CarPark { @@ -82,6 +189,14 @@ public class CarPark {
82 public void setArea(double area) { 189 public void setArea(double area) {
83 this.area = area; 190 this.area = area;
84 } 191 }
  192 +
  193 + public String getBrancheCompany() {
  194 + return brancheCompany;
  195 + }
  196 +
  197 + public void setBrancheCompany(String brancheCompany) {
  198 + this.brancheCompany = brancheCompany;
  199 + }
85 200
86 public String getCompany() { 201 public String getCompany() {
87 return company; 202 return company;
@@ -90,4 +205,61 @@ public class CarPark { @@ -90,4 +205,61 @@ public class CarPark {
90 public void setCompany(String company) { 205 public void setCompany(String company) {
91 this.company = company; 206 this.company = company;
92 } 207 }
  208 +
  209 + public Integer getDestroy() {
  210 + return destroy;
  211 + }
  212 +
  213 + public void setDestroy(Integer destroy) {
  214 + this.destroy = destroy;
  215 + }
  216 +
  217 + public Integer getVersions() {
  218 + return versions;
  219 + }
  220 +
  221 + public void setVersions(Integer versions) {
  222 + this.versions = versions;
  223 + }
  224 +
  225 + public String getDescriptions() {
  226 + return descriptions;
  227 + }
  228 +
  229 + public void setDescriptions(String descriptions) {
  230 + this.descriptions = descriptions;
  231 + }
  232 +
  233 + public Integer getCreateBy() {
  234 + return createBy;
  235 + }
  236 +
  237 + public void setCreateBy(Integer createBy) {
  238 + this.createBy = createBy;
  239 + }
  240 +
  241 + public Integer getUpdateBy() {
  242 + return updateBy;
  243 + }
  244 +
  245 + public void setUpdateBy(Integer updateBy) {
  246 + this.updateBy = updateBy;
  247 + }
  248 +
  249 + public Date getCreateDate() {
  250 + return createDate;
  251 + }
  252 +
  253 + public void setCreateDate(Date createDate) {
  254 + this.createDate = createDate;
  255 + }
  256 +
  257 + public Date getUpdateDate() {
  258 + return updateDate;
  259 + }
  260 +
  261 + public void setUpdateDate(Date updateDate) {
  262 + this.updateDate = updateDate;
  263 + }
  264 +
93 } 265 }
src/main/java/com/bsth/entity/Line.java
@@ -27,7 +27,7 @@ public class Line implements Serializable { @@ -27,7 +27,7 @@ public class Line implements Serializable {
27 27
28 // 线路ID 28 // 线路ID
29 @Id 29 @Id
30 - @GeneratedValue(strategy = GenerationType.IDENTITY) 30 + /*@GeneratedValue(strategy = GenerationType.IDENTITY)*/
31 private Integer id; 31 private Integer id;
32 32
33 // 线路名称 33 // 线路名称
src/main/java/com/bsth/entity/Section.java
@@ -28,7 +28,7 @@ import javax.persistence.Table; @@ -28,7 +28,7 @@ import javax.persistence.Table;
28 public class Section { 28 public class Section {
29 29
30 @Id 30 @Id
31 - @GeneratedValue(strategy = GenerationType.IDENTITY) 31 + /*@GeneratedValue(strategy = GenerationType.IDENTITY)*/
32 private Integer id; 32 private Integer id;
33 33
34 // 路段编码 34 // 路段编码
src/main/java/com/bsth/entity/Station.java
@@ -29,7 +29,7 @@ import javax.persistence.Table; @@ -29,7 +29,7 @@ import javax.persistence.Table;
29 public class Station { 29 public class Station {
30 30
31 @Id 31 @Id
32 - @GeneratedValue(strategy = GenerationType.IDENTITY) 32 + /*@GeneratedValue(strategy = GenerationType.IDENTITY)*/
33 private Integer id; 33 private Integer id;
34 34
35 // 站点编码 35 // 站点编码
src/main/java/com/bsth/repository/LineInformationRepository.java
@@ -5,6 +5,7 @@ import java.util.List; @@ -5,6 +5,7 @@ import java.util.List;
5 import org.springframework.data.jpa.repository.Query; 5 import org.springframework.data.jpa.repository.Query;
6 import org.springframework.stereotype.Repository; 6 import org.springframework.stereotype.Repository;
7 7
  8 +import com.bsth.entity.Line;
8 import com.bsth.entity.LineInformation; 9 import com.bsth.entity.LineInformation;
9 10
10 /** 11 /**
@@ -28,4 +29,6 @@ public interface LineInformationRepository extends BaseRepository&lt;LineInformatio @@ -28,4 +29,6 @@ public interface LineInformationRepository extends BaseRepository&lt;LineInformatio
28 29
29 @Query("select i from LineInformation i where i.line.lineCode in ?1") 30 @Query("select i from LineInformation i where i.line.lineCode in ?1")
30 List<LineInformation> findByLine(List<String> lineCodes); 31 List<LineInformation> findByLine(List<String> lineCodes);
  32 +
  33 + List<LineInformation> findByLine(Line line);
31 } 34 }
src/main/java/com/bsth/repository/LineRepository.java
@@ -23,11 +23,12 @@ import com.bsth.entity.Line; @@ -23,11 +23,12 @@ import com.bsth.entity.Line;
23 @Repository 23 @Repository
24 public interface LineRepository extends BaseRepository<Line, Integer> { 24 public interface LineRepository extends BaseRepository<Line, Integer> {
25 25
  26 +
26 /** 27 /**
27 * 获取线路编码 28 * 获取线路编码
28 * 29 *
29 * @return int <lineCode:线路编码> 30 * @return int <lineCode:线路编码>
30 */ 31 */
31 - @Query(value = " SELECT MAX(id)+1 from bsth_c_line ", nativeQuery = true)  
32 - public int selectMaxIdToLineCode(); 32 + @Query(value = " SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_line) k ", nativeQuery = true)
  33 + public long selectMaxIdToLineCode();
33 } 34 }
src/main/java/com/bsth/repository/SectionRepository.java
@@ -30,7 +30,7 @@ public interface SectionRepository extends BaseRepository&lt;Section, Integer&gt; { @@ -30,7 +30,7 @@ public interface SectionRepository extends BaseRepository&lt;Section, Integer&gt; {
30 // 查询最大ID 30 // 查询最大ID
31 @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_section) k" 31 @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_section) k"
32 , nativeQuery=true) 32 , nativeQuery=true)
33 - public int sectionMaxId(); 33 + public long sectionMaxId();
34 34
35 35
36 /** 36 /**
@@ -54,7 +54,7 @@ public interface SectionRepository extends BaseRepository&lt;Section, Integer&gt; { @@ -54,7 +54,7 @@ public interface SectionRepository extends BaseRepository&lt;Section, Integer&gt; {
54 54
55 "road_coding , section_distance , section_time , db_type, speed_limit ,"+ 55 "road_coding , section_distance , section_time , db_type, speed_limit ,"+
56 56
57 - "descriptions , versions) "+ 57 + "descriptions , versions,id) "+
58 58
59 "VALUES (?1 , ?2 , ?3 , ?4 , ?5 , "+ 59 "VALUES (?1 , ?2 , ?3 , ?4 , ?5 , "+
60 60
@@ -62,7 +62,7 @@ public interface SectionRepository extends BaseRepository&lt;Section, Integer&gt; { @@ -62,7 +62,7 @@ public interface SectionRepository extends BaseRepository&lt;Section, Integer&gt; {
62 62
63 "?11 , ?12 , ?13 , ?14 , ?15 ,"+ 63 "?11 , ?12 , ?13 , ?14 , ?15 ,"+
64 64
65 - "?16 , ?17 "+ 65 + "?16 , ?17, ?18"+
66 ")", nativeQuery=true) 66 ")", nativeQuery=true)
67 public void systemSave(String sectionCode , String sectionName , String crosesRoad , String endNode , String startNode, 67 public void systemSave(String sectionCode , String sectionName , String crosesRoad , String endNode , String startNode,
68 68
@@ -70,7 +70,7 @@ public interface SectionRepository extends BaseRepository&lt;Section, Integer&gt; { @@ -70,7 +70,7 @@ public interface SectionRepository extends BaseRepository&lt;Section, Integer&gt; {
70 70
71 String roadCoding,double sectionDistance,double sectionTime,String dbType,double speedLimit, 71 String roadCoding,double sectionDistance,double sectionTime,String dbType,double speedLimit,
72 72
73 - String descriptions, int versions); 73 + String descriptions, int versions,int id);
74 74
75 75
76 /** 76 /**
src/main/java/com/bsth/repository/SectionRouteRepository.java
@@ -69,4 +69,63 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int @@ -69,4 +69,63 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int
69 " LEFT JOIN bsth_c_section b ON a.sectionrouteSection = b.id", nativeQuery=true) 69 " LEFT JOIN bsth_c_section b ON a.sectionrouteSection = b.id", nativeQuery=true)
70 List<Object[]> getSectionRoute(int lineId, int directions); 70 List<Object[]> getSectionRoute(int lineId, int directions);
71 71
  72 +
  73 + /**
  74 + * @Description :TODO(查询路段信息)
  75 + *
  76 + * @param map <id:路段路由ID>
  77 + *
  78 + * @return List<Object[]>
  79 + */
  80 + @Query(value ="SELECT a.sectionRouteId," +
  81 + "a.sectionRouteLineCode," +
  82 + "a.sectionRouteCode," +
  83 + "a.sectionRouteDirections," +
  84 + "a.sectionRouteLine," +
  85 + "a.sectionRouteSection," +
  86 + "a.sectionRouteDescriptions," +
  87 + "a.sectionRouteCreateBy," +
  88 + "a.sectionRouteCreateDate," +
  89 + "a.sectionRouteUpdateBy," +
  90 + "a.sectionRouteUpdateDate," +
  91 + "a.sectionRouteVersions," +
  92 + "a.sectionRouteDestroy," +
  93 + "b.id AS sectionId," +
  94 + "b.section_code AS sectionCode," +
  95 + "b.section_name AS sectionName," +
  96 + "b.road_coding AS sectionRoadCoding," +
  97 + "b.end_node AS sectionEndCode," +
  98 + "b.start_node AS sectionStartNode," +
  99 + "b.middle_node AS sectionMiddleNode," +
  100 + "b.section_type AS sectionType," +
  101 + "AsText(b.csection_vector) AS sectionCsectionVector," +
  102 + "AsText(b.bsection_vector) AS sectionBsectionVector," +
  103 + "AsText(b.gsection_vector) AS sectionGsectionVector," +
  104 + "b.section_distance AS sectionDistance," +
  105 + "b.section_time AS sectionTime," +
  106 + "b.db_type AS sectionDbtype," +
  107 + "b.speed_limit AS sectionSpeedLimit," +
  108 + "b.descriptions AS sectionDescriptions," +
  109 + "b.create_by AS sectionCreateBy," +
  110 + "b.create_date AS sectionCreateDate," +
  111 + "b.update_by AS sectionUpdateBy," +
  112 + "b.update_date AS sectionUpdateDate," +
  113 + "b.versions AS sectionVersion FROM (" +
  114 + " SELECT s.id AS sectionRouteId," +
  115 + "s.line_code AS sectionRouteLineCode," +
  116 + "s.sectionroute_code AS sectionRouteCode," +
  117 + "s.directions AS sectionRouteDirections," +
  118 + "s.line AS sectionRouteLine," +
  119 + "s.section AS sectionRouteSection," +
  120 + "s.descriptions AS sectionRouteDescriptions," +
  121 + "s.create_by AS sectionRouteCreateBy," +
  122 + "s.create_date AS sectionRouteCreateDate," +
  123 + "s.update_by AS sectionRouteUpdateBy," +
  124 + "s.update_date AS sectionRouteUpdateDate," +
  125 + "s.versions AS sectionRouteVersions," +
  126 + "s.destroy AS sectionRouteDestroy" +
  127 + " FROM bsth_c_sectionroute s where s.id =?1) a " +
  128 + " LEFT JOIN bsth_c_section b on a.sectionRouteSection = b.id", nativeQuery=true)
  129 + List<Object[]> findSectionRouteInfoFormId(int id);
  130 +
72 } 131 }
src/main/java/com/bsth/repository/StationRepository.java
@@ -35,7 +35,7 @@ public interface StationRepository extends BaseRepository&lt;Station, Integer&gt; { @@ -35,7 +35,7 @@ public interface StationRepository extends BaseRepository&lt;Station, Integer&gt; {
35 */ 35 */
36 @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_station) k" 36 @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_station) k"
37 , nativeQuery=true) 37 , nativeQuery=true)
38 - int stationMaxId(); 38 + long stationMaxId();
39 39
40 @Query(value = "SELECT * FROM bsth_c_station s where s.station_name = ?1" 40 @Query(value = "SELECT * FROM bsth_c_station s where s.station_name = ?1"
41 , nativeQuery=true) 41 , nativeQuery=true)
@@ -63,12 +63,12 @@ public interface StationRepository extends BaseRepository&lt;Station, Integer&gt; { @@ -63,12 +63,12 @@ public interface StationRepository extends BaseRepository&lt;Station, Integer&gt; {
63 "?1 , ?2 , ?3 , ?4 , ?5," + 63 "?1 , ?2 , ?3 , ?4 , ?5," +
64 "?6 , ?7 , ?8 , ?9 , GeomFromText(?10),GeomFromText(?11)," + 64 "?6 , ?7 , ?8 , ?9 , GeomFromText(?10),GeomFromText(?11)," +
65 "?12 ,?13, ?14, ?15, ?16," + 65 "?12 ,?13, ?14, ?15, ?16," +
66 - "?17,?18)", nativeQuery=true) 66 + "?17,?18,?19)", nativeQuery=true)
67 public void stationSave(String stationCode,String stationName,String roadCoding,String dbType,String bJwpoints, 67 public void stationSave(String stationCode,String stationName,String roadCoding,String dbType,String bJwpoints,
68 68
69 Float gLonx, Float gLaty, Float x,Float y, String gPloygonGrid, String bPloygonGrid, 69 Float gLonx, Float gLaty, Float x,Float y, String gPloygonGrid, String bPloygonGrid,
70 70
71 - Integer destroy,Integer radius,String shapesType,Integer versions,String descriptions,Integer createBy,Integer updateBy); 71 + Integer destroy,Integer radius,String shapesType,Integer versions,String descriptions,Integer createBy,Integer updateBy,int id);
72 72
73 /** 73 /**
74 * @Description :TODO(站点更新) 74 * @Description :TODO(站点更新)
src/main/java/com/bsth/repository/StationRouteRepository.java
@@ -118,4 +118,98 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int @@ -118,4 +118,98 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
118 "destroy = ?2 WHERE id = ?1", nativeQuery=true) 118 "destroy = ?2 WHERE id = ?1", nativeQuery=true)
119 public void stationRouteIsDestroyUpd(Integer stationRouteId, Integer destroy); 119 public void stationRouteIsDestroyUpd(Integer stationRouteId, Integer destroy);
120 120
  121 +
  122 + /**
  123 + * @Description : TODO(根据线路ID生成行单)
  124 + *
  125 + * @param lineId:线路ID
  126 + *
  127 + * @return List<Object[]>
  128 + */
  129 + @Query(value = "SELECT * FROM ("+
  130 + "SELECT b.g_lonx," +
  131 + "b.g_laty,b.b_jwpoints," +
  132 + "a.station_mark," +
  133 + "a.station_route_code," +
  134 + "b.station_cod," +
  135 + "a.distances,"+
  136 + "b.station_name," +
  137 + "a.directions FROM (SELECT " +
  138 + "s.station_mark," +
  139 + "s.station_route_code," +
  140 + "s.directions," +
  141 + "s.distances,"+
  142 + "s.station FROM bsth_c_stationroute s where s.line = ?1) a " +
  143 + "LEFT JOIN bsth_c_station b " +
  144 + " on a.station = b.id ORDER BY a.directions ASC ) k ORDER BY k.directions,k.station_route_code ASC", nativeQuery=true)
  145 + List<Object[]> usingSingle(Integer lineId);
  146 +
  147 + /**
  148 + * @Description : TODO(根据站点路由Id查询详情)
  149 + *
  150 + * @param id:站点路由ID
  151 + *
  152 + * @return List<Object[]>
  153 + */
  154 + @Query(value = "SELECT a.stationRouteLine," +
  155 + " a.stationRouteStation," +
  156 + " a.stationRouteCode," +
  157 + " a.stationRouteLIneCode," +
  158 + " a.stationRouteStationMark," +
  159 + " a.stationOutStationNmber," +
  160 + " a.stationRoutedirections," +
  161 + " a.stationRouteDistances," +
  162 + " a.stationRouteToTime," +
  163 + " a.staitonRouteFirstTime," +
  164 + " a.stationRouteEndTime," +
  165 + " a.stationRouteDescriptions," +
  166 + " a.stationRouteDestroy," +
  167 + " a.stationRouteVersions," +
  168 + " a.stationRouteCreateBy," +
  169 + " a.stationRouteCreateDate," +
  170 + " a.stationRouteUpdateBy," +
  171 + " a.stationRouteUpdateDate," +
  172 + " b.id AS stationId," +
  173 + " b.station_cod AS stationCode," +
  174 + " b.station_name AS stationName," +
  175 + " b.road_coding AS stationRoadCoding," +
  176 + " b.db_type AS stationDbType," +
  177 + " b.b_jwpoints AS stationJwpoints," +
  178 + " b.g_lonx AS stationGlonx," +
  179 + " b.g_laty AS stationGlaty," +
  180 + " b.x AS stationX," +
  181 + " b.y AS stationY," +
  182 + " AsText(b.b_polygon_grid) as stationBPolyonGrid," +
  183 + " AsText(b.g_polygon_grid) AS stationGPloyonGrid, " +
  184 + " b.destroy AS stationDestroy," +
  185 + " b.radius AS stationRadius," +
  186 + " b.shapes_type AS stationShapesType," +
  187 + " b.versions AS stationVersions," +
  188 + " b.descriptions AS sttationDescriptions," +
  189 + " b.create_by AS stationCreateBy," +
  190 + " b.create_date AS stationCreateDate," +
  191 + " b.update_by AS stationUpdateBy," +
  192 + " b.update_date AS stationUpdateDate," +
  193 + " a.stationRouteId"+
  194 + " FROM ( SELECT s.id AS stationRouteId," +
  195 + " s.line AS stationRouteLine," +
  196 + " s.station as stationRouteStation," +
  197 + " s.station_route_code as stationRouteCode," +
  198 + " s.line_code AS stationRouteLIneCode," +
  199 + " s.station_mark AS stationRouteStationMark," +
  200 + " s.out_station_nmber AS stationOutStationNmber," +
  201 + " s.directions AS stationRoutedirections," +
  202 + " s.distances AS stationRouteDistances," +
  203 + " s.to_time AS stationRouteToTime," +
  204 + " s.first_time AS staitonRouteFirstTime," +
  205 + " s.end_time AS stationRouteEndTime," +
  206 + " s.descriptions AS stationRouteDescriptions," +
  207 + " s.destroy AS stationRouteDestroy," +
  208 + " s.versions AS stationRouteVersions," +
  209 + " s.create_by AS stationRouteCreateBy," +
  210 + " s.create_date AS stationRouteCreateDate," +
  211 + " s.update_by AS stationRouteUpdateBy," +
  212 + " s.update_date AS stationRouteUpdateDate FROM bsth_c_stationroute s WHERE s.id = ?1 ) a " +
  213 + " LEFT JOIN bsth_c_station b ON a.stationRouteStation = b.id", nativeQuery=true)
  214 + List<Object[]> findStationRouteInfo(Integer id);
121 } 215 }
src/main/java/com/bsth/service/LineService.java
@@ -22,7 +22,7 @@ public interface LineService extends BaseService&lt;Line, Integer&gt; { @@ -22,7 +22,7 @@ public interface LineService extends BaseService&lt;Line, Integer&gt; {
22 /** 22 /**
23 * 获取线路编码 23 * 获取线路编码
24 * 24 *
25 - * @return int <lineCode:线路编码> 25 + * @return long <lineCode:线路编码>
26 */ 26 */
27 - int selectMaxIdToLineCode(); 27 + long selectMaxIdToLineCode();
28 } 28 }
src/main/java/com/bsth/service/SectionRouteService.java
@@ -23,4 +23,13 @@ import com.bsth.entity.SectionRoute; @@ -23,4 +23,13 @@ import com.bsth.entity.SectionRoute;
23 public interface SectionRouteService extends BaseService<SectionRoute, Integer> { 23 public interface SectionRouteService extends BaseService<SectionRoute, Integer> {
24 24
25 List<Map<String, Object>> getSectionRoute(Map<String, Object> map); 25 List<Map<String, Object>> getSectionRoute(Map<String, Object> map);
  26 +
  27 + /**
  28 + * @Description : TODO(根据路段路由Id查询详情)
  29 + *
  30 + * @param map <id:路段路由ID>
  31 + *
  32 + * @return List<Map<String, Object>>
  33 + */
  34 + List<Map<String, Object>> findSectionRouteInfoFormId(Map<String, Object> map);
26 } 35 }
src/main/java/com/bsth/service/StationRouteService.java
@@ -59,4 +59,23 @@ public interface StationRouteService extends BaseService&lt;StationRoute, Integer&gt; @@ -59,4 +59,23 @@ public interface StationRouteService extends BaseService&lt;StationRoute, Integer&gt;
59 * @return Map<String, Object> <SUCCESS ; ERROR> 59 * @return Map<String, Object> <SUCCESS ; ERROR>
60 */ 60 */
61 Map<String, Object> stationRouteIsDestroy(Map<String, Object> map); 61 Map<String, Object> stationRouteIsDestroy(Map<String, Object> map);
  62 +
  63 + /**
  64 + * @Description : TODO(根据线路ID生成行单)
  65 + *
  66 + * @param map <id:线路ID>
  67 + *
  68 + * @return Map<String, Object> <SUCCESS ; ERROR>
  69 + */
  70 + Map<String, Object> usingSingle(Map<String, Object> map);
  71 +
  72 +
  73 + /**
  74 + * @Description : TODO(根据站点路由Id查询详情)
  75 + *
  76 + * @param map <id:站点路由ID>
  77 + *
  78 + * @return List<Map<String, Object>>
  79 + */
  80 + List<Map<String, Object>> findStationRouteInfo(Map<String, Object> map);
62 } 81 }
src/main/java/com/bsth/service/StationService.java
@@ -34,7 +34,6 @@ public interface StationService extends BaseService&lt;Station, Integer&gt; { @@ -34,7 +34,6 @@ public interface StationService extends BaseService&lt;Station, Integer&gt; {
34 34
35 Map<String, Object> manualSave(Map<String, Object> map); 35 Map<String, Object> manualSave(Map<String, Object> map);
36 36
37 - int getStationCode();  
38 37
39 /** 38 /**
40 * @Description :TODO(新增站点保存) 39 * @Description :TODO(新增站点保存)
src/main/java/com/bsth/service/impl/LineServiceImpl.java
@@ -34,7 +34,7 @@ public class LineServiceImpl extends BaseServiceImpl&lt;Line, Integer&gt; implements L @@ -34,7 +34,7 @@ public class LineServiceImpl extends BaseServiceImpl&lt;Line, Integer&gt; implements L
34 * 34 *
35 * @return int <lineCode:线路编码> 35 * @return int <lineCode:线路编码>
36 */ 36 */
37 - public int selectMaxIdToLineCode() { 37 + public long selectMaxIdToLineCode() {
38 // TODO Auto-generated method stub 38 // TODO Auto-generated method stub
39 return repository.selectMaxIdToLineCode(); 39 return repository.selectMaxIdToLineCode();
40 } 40 }
src/main/java/com/bsth/service/impl/SectionRouteServiceImpl.java
@@ -91,4 +91,104 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ @@ -91,4 +91,104 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ
91 return resultList; 91 return resultList;
92 } 92 }
93 93
  94 + /**
  95 + * @Description : TODO(根据路段路由Id查询详情)
  96 + *
  97 + * @param map <id:路段路由ID>
  98 + *
  99 + * @return List<Map<String, Object>>
  100 + */
  101 + @Override
  102 + public List<Map<String, Object>> findSectionRouteInfoFormId(Map<String, Object> map) {
  103 +
  104 + // 获取线路ID
  105 + Integer id = map.get("id").equals("") ? 0 : Integer.parseInt(map.get("id").toString());
  106 +
  107 + List<Object[]> objects = repository.findSectionRouteInfoFormId(id);
  108 +
  109 + List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
  110 +
  111 + int len = objects.size();
  112 +
  113 + if(objects.size()>0) {
  114 +
  115 + for(int i = 0 ; i < len; i++) {
  116 + Map<String, Object> tempM = new HashMap<String,Object>();
  117 +
  118 + tempM.put("sectionRouteId", objects.get(i)[0]);
  119 +
  120 + tempM.put("sectionRouteLineCode", objects.get(i)[1]);
  121 +
  122 + tempM.put("sectionRouteCode", objects.get(i)[2]);
  123 +
  124 + tempM.put("sectionRouteDirections", objects.get(i)[3]);
  125 +
  126 + tempM.put("sectionRouteLine", objects.get(i)[4]);
  127 +
  128 + tempM.put("sectionRouteSection", objects.get(i)[5]);
  129 +
  130 + tempM.put("sectionRouteDescriptions", objects.get(i)[6]);
  131 +
  132 + tempM.put("sectionRouteCreateBy", objects.get(i)[7]);
  133 +
  134 + tempM.put("sectionRouteCreateDate", objects.get(i)[8]);
  135 +
  136 + tempM.put("sectionRouteUpdateBy", objects.get(i)[9]);
  137 +
  138 + tempM.put("sectionRouteUpdateDate", objects.get(i)[10]);
  139 +
  140 + tempM.put("sectionRouteVersions", objects.get(i)[11]);
  141 +
  142 + tempM.put("sectionRouteDestroy", objects.get(i)[12]);
  143 +
  144 + tempM.put("sectionId", objects.get(i)[13]);
  145 +
  146 + tempM.put("sectionCode", objects.get(i)[14]);
  147 +
  148 + tempM.put("sectionName", objects.get(i)[15]);
  149 +
  150 + tempM.put("sectionRoadCoding", objects.get(i)[16]);
  151 +
  152 + tempM.put("sectionEndCode", objects.get(i)[17]);
  153 +
  154 + tempM.put("sectionStartNode", objects.get(i)[18]);
  155 +
  156 + tempM.put("sectionMiddleNode", objects.get(i)[19]);
  157 +
  158 + tempM.put("sectionType", objects.get(i)[20]);
  159 +
  160 + tempM.put("sectionCsectionVector", objects.get(i)[21]);
  161 +
  162 + tempM.put("sectionBsectionVector", objects.get(i)[22]);
  163 +
  164 + tempM.put("sectionGsectionVector", objects.get(i)[23]);
  165 +
  166 + tempM.put("sectionDistance", objects.get(i)[24]);
  167 +
  168 + tempM.put("sectionTime", objects.get(i)[25]);
  169 +
  170 + tempM.put("sectionDbtype", objects.get(i)[26]);
  171 +
  172 + tempM.put("sectionSpeedLimit", objects.get(i)[27]);
  173 +
  174 + tempM.put("sectionDescriptions", objects.get(i)[28]);
  175 +
  176 + tempM.put("sectionCreateBy", objects.get(i)[29]);
  177 +
  178 + tempM.put("sectionCreateDate", objects.get(i)[30]);
  179 +
  180 + tempM.put("sectionUpdateBy", objects.get(i)[31]);
  181 +
  182 + tempM.put("sectionUpdateDate", objects.get(i)[32]);
  183 +
  184 + tempM.put("sectionVersion", objects.get(i)[33]);
  185 +
  186 + resultList.add(tempM);
  187 + }
  188 +
  189 + }
  190 +
  191 + return resultList;
  192 + }
  193 +
94 } 194 }
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
1 package com.bsth.service.impl; 1 package com.bsth.service.impl;
2 2
  3 +import java.io.ByteArrayInputStream;
  4 +import java.io.InputStream;
3 import java.util.ArrayList; 5 import java.util.ArrayList;
4 import java.util.HashMap; 6 import java.util.HashMap;
5 import java.util.List; 7 import java.util.List;
@@ -17,6 +19,7 @@ import com.bsth.repository.SectionRouteRepository; @@ -17,6 +19,7 @@ import com.bsth.repository.SectionRouteRepository;
17 import com.bsth.repository.StationRepository; 19 import com.bsth.repository.StationRepository;
18 import com.bsth.repository.StationRouteRepository; 20 import com.bsth.repository.StationRouteRepository;
19 import com.bsth.service.StationRouteService; 21 import com.bsth.service.StationRouteService;
  22 +import com.bsth.util.FTPClientUtils;
20 23
21 /** 24 /**
22 * 25 *
@@ -482,4 +485,220 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -482,4 +485,220 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
482 485
483 return resultMap; 486 return resultMap;
484 } 487 }
  488 +
  489 + /**
  490 + * @Description : TODO(根据线路ID生成行单)
  491 + *
  492 + * @param map <lineId:线路ID>
  493 + *
  494 + * @return Map<String, Object> <SUCCESS ; ERROR>
  495 + */
  496 + @Override
  497 + public Map<String, Object> usingSingle(Map<String, Object> map) {
  498 +
  499 + Map<String, Object> resultMap = new HashMap<String,Object>();
  500 +
  501 + try {
  502 +
  503 + // 获取线路ID
  504 + Integer lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString());
  505 +
  506 + Line line = lineRepository.findOne(lineId);
  507 +
  508 + List<Object[]> objects = repository.usingSingle(lineId);
  509 +
  510 + String stationRStr = "";
  511 +
  512 + // windows下的文本文件换行符
  513 + String enterStr = "\r\n";
  514 +
  515 + // linux/unix下的文本文件换行符
  516 + // String enterStr = "\r";
  517 +
  518 + if(objects.size()>0) {
  519 +
  520 + for(int i = 0; i<objects.size();i++) {
  521 +
  522 + // 经度
  523 + String lng = objects.get(i)[0].toString();
  524 +
  525 + // 纬度
  526 + String lat = " " + objects.get(i)[1].toString();
  527 +
  528 + // 站点类型
  529 + String stationMake = objects.get(i)[3].toString();
  530 +
  531 + if(stationMake.equals("E")) {
  532 +
  533 + stationMake = " " + "2";
  534 +
  535 + }else {
  536 +
  537 + stationMake =" " + "1";
  538 +
  539 + }
  540 +
  541 + // 站点序号
  542 + String stationNo = " " + objects.get(i)[4].toString();
  543 +
  544 + // 站点编码
  545 + String stationCode = " " + objects.get(i)[5].toString();
  546 +
  547 + double tempd = Double.parseDouble(objects.get(i)[6].toString())*1000;
  548 +
  549 + // 站点距离
  550 + String staitondistance = " " + String.valueOf((int) tempd);
  551 +
  552 + // 限速
  553 + String sleepStr = " " + "60";
  554 +
  555 + // 站点名称
  556 + String staitonName = " " + objects.get(i)[7].toString();
  557 +
  558 + stationRStr = stationRStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + staitonName + enterStr;
  559 +
  560 + }
  561 +
  562 + }
  563 +
  564 + System.out.println(stationRStr);
  565 +
  566 + FTPClientUtils ftpClientUtils = new FTPClientUtils();
  567 +
  568 + String url = "192.168.168.101";
  569 +
  570 + int port = 21;
  571 +
  572 + String username = "testftpservice";
  573 +
  574 + String password = "123";
  575 +
  576 + String path = "C:/ftptest";
  577 +
  578 + String filename = line.getLineCode() + ".txt";
  579 +
  580 + stationRStr = line.getName() + enterStr + stationRStr;
  581 +
  582 + InputStream input = new ByteArrayInputStream(stationRStr.getBytes("utf-8"));
  583 +
  584 + boolean b = ftpClientUtils.uploadFile(url, port, username, password, path, filename, input);
  585 +
  586 + System.out.println(b);
  587 +
  588 + resultMap.put("status", ResponseCode.SUCCESS);
  589 +
  590 + } catch (Exception e) {
  591 +
  592 + resultMap.put("status", ResponseCode.ERROR);
  593 +
  594 + logger.error("save erro.", e);
  595 +
  596 + }
  597 + return resultMap;
  598 + }
  599 +
  600 + @Override
  601 + public List<Map<String, Object>> findStationRouteInfo(Map<String, Object> map) {
  602 +
  603 + // 获取线路ID
  604 + Integer id = map.get("id").equals("") ? 0 : Integer.parseInt(map.get("id").toString());
  605 +
  606 + List<Object[]> objects = repository.findStationRouteInfo(id);
  607 +
  608 + List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
  609 +
  610 + int len = objects.size();
  611 +
  612 + if(objects.size()>0) {
  613 +
  614 + for(int i = 0 ; i < len; i++) {
  615 + Map<String, Object> tempM = new HashMap<String,Object>();
  616 +
  617 + tempM.put("stationRouteLine", objects.get(i)[0]);
  618 +
  619 + tempM.put("stationRouteStation", objects.get(i)[1]);
  620 +
  621 + tempM.put("stationRouteCode", objects.get(i)[2]);
  622 +
  623 + tempM.put("stationRouteLIneCode", objects.get(i)[3]);
  624 +
  625 + tempM.put("stationRouteStationMark", objects.get(i)[4]);
  626 +
  627 + tempM.put("stationOutStationNmber", objects.get(i)[5]);
  628 +
  629 + tempM.put("stationRoutedirections", objects.get(i)[6]);
  630 +
  631 + tempM.put("stationRouteDistances", objects.get(i)[7]);
  632 +
  633 + tempM.put("stationRouteToTime", objects.get(i)[8]);
  634 +
  635 + tempM.put("staitonRouteFirstTime", objects.get(i)[9]);
  636 +
  637 + tempM.put("stationRouteEndTime", objects.get(i)[10]);
  638 +
  639 + tempM.put("stationRouteDescriptions", objects.get(i)[11]);
  640 +
  641 + tempM.put("stationRouteDestroy", objects.get(i)[12]);
  642 +
  643 + tempM.put("stationRouteVersions", objects.get(i)[13]);
  644 +
  645 + tempM.put("stationRouteCreateBy", objects.get(i)[14]);
  646 +
  647 + tempM.put("stationRouteCreateDate", objects.get(i)[15]);
  648 +
  649 + tempM.put("stationRouteUpdateBy", objects.get(i)[16]);
  650 +
  651 + tempM.put("stationRouteUpdateDate", objects.get(i)[17]);
  652 +
  653 + tempM.put("stationId", objects.get(i)[18]);
  654 +
  655 + tempM.put("stationCode", objects.get(i)[19]);
  656 +
  657 + tempM.put("stationName", objects.get(i)[20]);
  658 +
  659 + tempM.put("stationRoadCoding", objects.get(i)[21]);
  660 +
  661 + tempM.put("stationDbType", objects.get(i)[22]);
  662 +
  663 + tempM.put("stationJwpoints", objects.get(i)[23]);
  664 +
  665 + tempM.put("stationGlonx", objects.get(i)[24]);
  666 +
  667 + tempM.put("stationGlaty", objects.get(i)[25]);
  668 +
  669 + tempM.put("stationX", objects.get(i)[26]);
  670 +
  671 + tempM.put("stationY", objects.get(i)[27]);
  672 +
  673 + tempM.put("stationBPolyonGrid", objects.get(i)[28]);
  674 +
  675 + tempM.put("stationGPloyonGrid", objects.get(i)[29]);
  676 +
  677 + tempM.put("stationDestroy", objects.get(i)[30]);
  678 +
  679 + tempM.put("stationRadius", objects.get(i)[31]);
  680 +
  681 + tempM.put("stationShapesType", objects.get(i)[32]);
  682 +
  683 + tempM.put("stationVersions", objects.get(i)[33]);
  684 +
  685 + tempM.put("sttationDescriptions", objects.get(i)[34]);
  686 +
  687 + tempM.put("stationCreateBy", objects.get(i)[35]);
  688 +
  689 + tempM.put("stationCreateDate", objects.get(i)[36]);
  690 +
  691 + tempM.put("stationUpdateBy", objects.get(i)[37]);
  692 +
  693 + tempM.put("stationUpdateDate", objects.get(i)[38]);
  694 +
  695 + tempM.put("stationRouteId", objects.get(i)[39]);
  696 +
  697 + resultList.add(tempM);
  698 + }
  699 +
  700 + }
  701 +
  702 + return resultList;
  703 + }
485 } 704 }
src/main/java/com/bsth/service/impl/StationServiceImpl.java
@@ -16,16 +16,19 @@ import com.alibaba.fastjson.JSONArray; @@ -16,16 +16,19 @@ import com.alibaba.fastjson.JSONArray;
16 import com.alibaba.fastjson.JSONObject; 16 import com.alibaba.fastjson.JSONObject;
17 import com.bsth.common.ResponseCode; 17 import com.bsth.common.ResponseCode;
18 import com.bsth.entity.Line; 18 import com.bsth.entity.Line;
  19 +import com.bsth.entity.LineInformation;
19 import com.bsth.entity.Section; 20 import com.bsth.entity.Section;
20 import com.bsth.entity.SectionRoute; 21 import com.bsth.entity.SectionRoute;
21 import com.bsth.entity.Station; 22 import com.bsth.entity.Station;
22 import com.bsth.entity.StationRoute; 23 import com.bsth.entity.StationRoute;
  24 +import com.bsth.repository.LineInformationRepository;
23 import com.bsth.repository.LineRepository; 25 import com.bsth.repository.LineRepository;
24 import com.bsth.repository.SectionRepository; 26 import com.bsth.repository.SectionRepository;
25 import com.bsth.repository.SectionRouteRepository; 27 import com.bsth.repository.SectionRouteRepository;
26 import com.bsth.repository.StationRepository; 28 import com.bsth.repository.StationRepository;
27 import com.bsth.repository.StationRouteRepository; 29 import com.bsth.repository.StationRouteRepository;
28 import com.bsth.service.StationService; 30 import com.bsth.service.StationService;
  31 +import com.bsth.util.GetUIDAndCode;
29 32
30 /** 33 /**
31 * 34 *
@@ -52,6 +55,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -52,6 +55,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
52 @Autowired 55 @Autowired
53 private StationRouteRepository routeRepository; 56 private StationRouteRepository routeRepository;
54 57
  58 + @Autowired
  59 + private LineInformationRepository informationRepository;
  60 +
55 @Autowired 61 @Autowired
56 private LineRepository lineRepository; 62 private LineRepository lineRepository;
57 63
@@ -103,327 +109,521 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -103,327 +109,521 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
103 // 线路ID 109 // 线路ID
104 int lineId = map.get("lineId").toString().equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); 110 int lineId = map.get("lineId").toString().equals("") ? 0 : Integer.parseInt(map.get("lineId").toString());
105 111
106 - Double sectionDistance = 0.0; 112 + // 半径
  113 + int radius = map.get("radius").equals("") ? 0 : Integer.parseInt(map.get("radius").toString());
  114 +
  115 + // 图形类型
  116 + String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString();
  117 +
  118 + // 路段距离
  119 + Double sectionDistance = 0.0d;
107 120
108 - Double sectionDuration = 0.0; 121 + // 路段时长
  122 + Double sectionDuration = 0.0d;
  123 +
  124 + // 里程(上或者下)
  125 + double sumUpOrDownMileage = 0.0d;
109 126
110 // 线路信息 127 // 线路信息
111 Line resultLine = lineRepository.findOne(lineId); 128 Line resultLine = lineRepository.findOne(lineId);
112 129
  130 + Map<String, Object> resultSaveMapm = new HashMap<String,Object>();
  131 +
113 if(!stationJSON.equals("")) { 132 if(!stationJSON.equals("")) {
114 133
115 - JSONArray stationsArray = JSONArray.parseArray(stationJSON);  
116 -  
117 - if(stationsArray.size()>0) {  
118 -  
119 - for(int i = 0;i <stationsArray.size();i++) {  
120 -  
121 - // 站点名称  
122 - String stationName = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("name").toString();  
123 -  
124 - Double distance = stationsArray.getJSONObject(i).get("distance").equals("") ? 0 : Double.parseDouble(stationsArray.getJSONObject(i).get("distance").toString());  
125 -  
126 - // 转成公里  
127 - distance = distance/1000;  
128 -  
129 - BigDecimal d = new BigDecimal(distance);  
130 -  
131 - distance = d.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();  
132 -  
133 - sectionDistance= distance + sectionDistance;  
134 -  
135 - Double duration = stationsArray.getJSONObject(i).get("duration").equals("") ? 0 : Double.parseDouble(stationsArray.getJSONObject(i).get("duration").toString());  
136 -  
137 - // 转成分钟  
138 - duration = duration/60;  
139 -  
140 - BigDecimal t = new BigDecimal(duration);  
141 -  
142 - duration = t.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();  
143 -  
144 - sectionDuration = duration + sectionDuration;  
145 -  
146 - // 百度经纬度坐标  
147 - String bJwpoints = "";  
148 -  
149 - // 百度坐标经度  
150 - String bLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lng").toString();  
151 -  
152 - // 百度坐标纬度  
153 - String bLatx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lat").toString();  
154 -  
155 - // 百度经纬度  
156 - bJwpoints = bLonx + " " + bLatx;  
157 -  
158 - List<Object[]> stationNameList = repository.findStationName(stationName);  
159 -  
160 - boolean isHave = isHaveStationname(bJwpoints,stationNameList);  
161 -  
162 - // 初始化站点对象  
163 - Station arg0 = new Station();  
164 -  
165 - // 站点编码  
166 - int stationCode = 0;  
167 -  
168 - if(isHave) {  
169 -  
170 - Integer stationId = Integer.parseInt(stationNameList.get(0)[1].toString());  
171 -  
172 - arg0 = repository.findOne(stationId);  
173 -  
174 - stationCode = Integer.parseInt(arg0.getStationCod());  
175 -  
176 - }else {  
177 -  
178 - stationCode = repository.stationMaxId();  
179 -  
180 - arg0.setStationName(stationName);  
181 -  
182 - // 原坐标类型  
183 - arg0.setDbType(dbType);  
184 -  
185 - // 站点地理位置WGS坐标经度  
186 - String gLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lng").toString();  
187 - arg0.setgLonx(Float.parseFloat(gLonx));  
188 -  
189 - // 站点地理位置WGS坐标纬度  
190 - String gLaty = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lat").toString();  
191 - arg0.setgLaty(Float.parseFloat(gLaty));  
192 -  
193 - // 半径  
194 - int radius = map.get("radius").equals("") ? 0 : Integer.parseInt(map.get("radius").toString());  
195 - arg0.setRadius(radius);  
196 -  
197 - // 图形类型  
198 - String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString();  
199 - arg0.setShapesType(shapesType);  
200 -  
201 - // 站点编码  
202 - arg0.setStationCod(String.valueOf(stationCode+1));  
203 -  
204 - // 是否想撤销  
205 - arg0.setDestroy(destroy);  
206 -  
207 - // 版本号  
208 - arg0.setVersions(versions);  
209 -  
210 - arg0.setbJwpoints(bJwpoints);  
211 -  
212 - // 插入站点信息  
213 - repository.save(arg0);  
214 -  
215 - }  
216 -  
217 - // 站点路由对象  
218 - StationRoute route = new StationRoute();  
219 -  
220 - // 站点名称  
221 - route.setStationName(stationName);  
222 -  
223 - route.setDistances(distance);  
224 -  
225 - route.setToTime(duration);  
226 -  
227 -  
228 - // 站点编码  
229 - route.setStationCode(arg0.getStationCod());  
230 -  
231 - // 站点序号  
232 - route.setStationRouteCode((i+1)*100);  
233 -  
234 - // 站点类型  
235 - if(i==0) {  
236 -  
237 - // 起始站  
238 - route.setStationMark("B");  
239 -  
240 - }else if(i==stationsArray.size()-1) {  
241 -  
242 - // 终点站  
243 - route.setStationMark("E");  
244 -  
245 - }else {  
246 -  
247 - // 中途站  
248 - route.setStationMark("Z");  
249 -  
250 - }  
251 -  
252 - // 版本号  
253 - route.setVersions(versions);  
254 -  
255 - // 站点ID  
256 - route.setStation(arg0);  
257 -  
258 - // 方向  
259 - route.setDirections(directions);  
260 -  
261 - // 线路ID  
262 - route.setLine(resultLine);  
263 -  
264 - // 线路编码  
265 - route.setLineCode(resultLine.getLineCode());  
266 -  
267 - route.setDestroy(destroy);  
268 -  
269 - // 插入站点路由信息  
270 - routeRepository.save(route);  
271 -  
272 - }  
273 -  
274 - } 134 + resultSaveMapm = savaStationAndStationRouteInfo( stationJSON, sectionDistance, sectionDuration, dbType,radius, shapesType, destroy, versions, sumUpOrDownMileage, directions, resultLine);
275 135
276 } 136 }
277 137
  138 + sectionDistance = Double.valueOf(resultSaveMapm.get("sectionDistance").toString());
  139 +
  140 + sectionDuration= Double.valueOf(resultSaveMapm.get("sectionDuration").toString());
  141 +
278 // 如果路段信息JSON字符串不为空 142 // 如果路段信息JSON字符串不为空
279 if(!sectionJSON.equals("")) { 143 if(!sectionJSON.equals("")) {
280 144
281 - // 转换成JSON数组  
282 - JSONArray sectionsArray = JSONArray.parseArray(sectionJSON); 145 + saveSectionAndSectionRouteInfo( sectionJSON, directions, resultLine, speedLimitStr,sectionDistance, sectionDuration, dbType, versions, destroy);
  146 + }
  147 +
  148 + sumUpOrDownMileage = Double.valueOf(resultSaveMapm.get("sumUpOrDownMileage").toString());
  149 +
  150 + updateLineInfoUpOrDownMileage( resultLine , directions, sumUpOrDownMileage);
  151 +
  152 + resultMap.put("status", ResponseCode.SUCCESS);
  153 +
  154 + } catch (Exception e) {
  155 +
  156 + resultMap.put("status", ResponseCode.ERROR);
  157 +
  158 + logger.error("save erro.", e);
  159 +
  160 + }
  161 +
  162 + return resultMap;
  163 + }
  164 +
  165 +
  166 + /**
  167 + * @Description :保存站点和站点路由信息(系统规划)
  168 + *
  169 + * @param stationJSON:站点和站点路由json数据
  170 + *
  171 + * @param sectionDistance: 总距离
  172 + *
  173 + * @param sectionDuration: 总时长
  174 + *
  175 + * @param dbType:原坐标类型
  176 + *
  177 + * @param radius:半径
  178 + *
  179 + * @param shapesType:图形类型
  180 + *
  181 + * @param destroy:是否撤销
  182 + *
  183 + * @param versions:版本
  184 + *
  185 + * @param sumUpOrDownMileage:里程(上或者下)
  186 + *
  187 + * @param directions:方向
  188 + *
  189 + * @param resultLine:线路实体类
  190 + *
  191 + * @return
  192 + *
  193 + * @throws Exception
  194 + */
  195 + public Map<String, Object> savaStationAndStationRouteInfo(String stationJSON,double sectionDistance,double sectionDuration,String dbType,
  196 +
  197 + int radius,String shapesType,int destroy,int versions,double sumUpOrDownMileage,int directions,Line resultLine) throws Exception{
  198 +
  199 + Map<String, Object> paramsMeleageAndDistncDura = new HashMap<String,Object>();
  200 +
  201 + JSONArray stationsArray = JSONArray.parseArray(stationJSON);
  202 +
  203 + if(stationsArray.size()>0) {
  204 +
  205 + for(int i = 0;i <stationsArray.size();i++) {
283 206
284 - // 原始线状图形坐标集合  
285 - String sectionsBpoints = ""; 207 + // 站点名称
  208 + String stationName = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("name").toString();
286 209
287 - // WGS线状图形坐标集合  
288 - String sectionsWJPpoints = ""; 210 + Double distance = stationsArray.getJSONObject(i).get("distance").equals("") ? 0 : Double.parseDouble(stationsArray.getJSONObject(i).get("distance").toString());
289 211
290 - // 遍历  
291 - for(int s = 0 ;s<sectionsArray.size();s++) { 212 + // 转成公里
  213 + distance = distance/1000;
  214 +
  215 + BigDecimal d = new BigDecimal(distance);
  216 +
  217 + distance = d.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
  218 +
  219 + sectionDistance= distance + sectionDistance;
  220 +
  221 + Double duration = stationsArray.getJSONObject(i).get("duration").equals("") ? 0 : Double.parseDouble(stationsArray.getJSONObject(i).get("duration").toString());
  222 +
  223 + // 转成分钟
  224 + duration = duration/60;
  225 +
  226 + BigDecimal t = new BigDecimal(duration);
  227 +
  228 + duration = t.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
  229 +
  230 + sectionDuration = duration + sectionDuration;
  231 +
  232 + // 百度经纬度坐标
  233 + String bJwpoints = "";
  234 +
  235 + // 百度坐标经度
  236 + String bLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lng").toString();
  237 +
  238 + // 百度坐标纬度
  239 + String bLatx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lat").toString();
  240 +
  241 + // 百度经纬度
  242 + bJwpoints = bLonx + " " + bLatx;
  243 +
  244 + List<Object[]> stationNameList = repository.findStationName(stationName);
  245 +
  246 + boolean isHave = isHaveStationname(bJwpoints,stationNameList);
  247 +
  248 + // 初始化站点对象
  249 + Station arg0 = new Station();
  250 +
  251 + // 站点编码
  252 + long stationCode = 0L;
  253 +
  254 + if(isHave) {
292 255
293 - String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString(); 256 + Integer stationId = Integer.parseInt(stationNameList.get(0)[1].toString());
294 257
295 - String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString(); 258 + arg0 = repository.findOne(stationId);
296 259
297 - String WGSLngStr = JSONObject.parseObject(sectionsArray.getJSONObject(s).get("WGSpotion").toString()).get("Lng").toString(); 260 + }else {
298 261
299 - String WGSLatStr = JSONObject.parseObject(sectionsArray.getJSONObject(s).get("WGSpotion").toString()).get("Lat").toString(); 262 + stationCode = GetUIDAndCode.getStationId();
300 263
301 - if(s==0) {  
302 -  
303 - sectionsBpoints = pointsLngStr + " " + pointsLatStr;  
304 -  
305 - sectionsWJPpoints = WGSLngStr + " " + WGSLatStr;  
306 -  
307 - }else {  
308 -  
309 - sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr;  
310 -  
311 - sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr;  
312 -  
313 - } 264 + arg0.setStationCod(String.valueOf(stationCode));
  265 +
  266 + arg0.setId((int)stationCode);
  267 +
  268 + arg0.setStationName(stationName);
  269 +
  270 + // 原坐标类型
  271 + arg0.setDbType(dbType);
  272 +
  273 + // 站点地理位置WGS坐标经度
  274 + String gLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lng").toString();
  275 + arg0.setgLonx(Float.parseFloat(gLonx));
  276 +
  277 + // 站点地理位置WGS坐标纬度
  278 + String gLaty = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lat").toString();
  279 + arg0.setgLaty(Float.parseFloat(gLaty));
  280 +
  281 + arg0.setRadius(radius);
  282 +
  283 +
  284 + arg0.setShapesType(shapesType);
314 285
  286 + // 是否想撤销
  287 + arg0.setDestroy(destroy);
  288 +
  289 + // 版本号
  290 + arg0.setVersions(versions);
  291 +
  292 + arg0.setbJwpoints(bJwpoints);
  293 +
  294 + // 插入站点信息
  295 + repository.save(arg0);
315 296
316 } 297 }
317 298
318 - int sectionMaxId = sectionRepository.sectionMaxId(); 299 + // 站点路由对象
  300 + StationRoute route = new StationRoute();
  301 +
  302 + // 站点名称
  303 + route.setStationName(stationName);
  304 +
  305 + route.setDistances(distance);
  306 +
  307 + sumUpOrDownMileage = sumUpOrDownMileage + distance;
319 308
320 - String sectionCode = String.valueOf(sectionMaxId+1); 309 + route.setToTime(duration);
321 310
322 - String upOrDownStr = "";  
323 311
324 - if(directions==0){ 312 + // 站点编码
  313 + route.setStationCode(arg0.getStationCod());
  314 +
  315 + // 站点序号
  316 + route.setStationRouteCode((i+1)*100);
  317 +
  318 + // 站点类型
  319 + if(i==0) {
  320 +
  321 + // 起始站
  322 + route.setStationMark("B");
325 323
326 - upOrDownStr = "上行路段"; 324 + }else if(i==stationsArray.size()-1) {
327 325
328 - }else if(directions==1){ 326 + // 终点站
  327 + route.setStationMark("E");
  328 +
  329 + }else {
329 330
330 - upOrDownStr = "下行路段"; 331 + // 中途站
  332 + route.setStationMark("Z");
331 333
332 } 334 }
333 335
334 - // 路段名称  
335 - String sectionName = resultLine.getName()+upOrDownStr; 336 + // 版本号
  337 + route.setVersions(versions);
336 338
337 - // 交出路  
338 - String crosesRoad = ""; 339 + // 站点ID
  340 + route.setStation(arg0);
339 341
340 - // 终止节点  
341 - String endNode = ""; 342 + // 方向
  343 + route.setDirections(directions);
342 344
343 - // 开始节点  
344 - String startNode = ""; 345 + // 线路ID
  346 + route.setLine(resultLine);
345 347
346 - // 中间节点  
347 - String middleNode = ""; 348 + // 线路编码
  349 + route.setLineCode(resultLine.getLineCode());
348 350
349 - // WGS坐标点集合  
350 - String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; 351 + route.setDestroy(destroy);
351 352
352 - // 原坐标点集合  
353 - String bsectionVector = "LINESTRING(" + sectionsBpoints + ")"; 353 + // 插入站点路由信息
  354 + routeRepository.save(route);
  355 +
  356 + }
  357 +
  358 + paramsMeleageAndDistncDura.put("sumUpOrDownMileage", sumUpOrDownMileage);
  359 +
  360 + paramsMeleageAndDistncDura.put("sectionDistance", sectionDistance);
  361 +
  362 + paramsMeleageAndDistncDura.put("sectionDuration", sectionDuration);
  363 +
  364 + }
  365 +
  366 + return paramsMeleageAndDistncDura;
  367 +
  368 + }
  369 +
  370 + /**
  371 + *
  372 + *
  373 + * @param resultLine:线路实体类
  374 + *
  375 + * @param directions:方向
  376 + *
  377 + * @param sumUpOrDownMileage:里程(上或者下)
  378 + */
  379 + public void updateLineInfoUpOrDownMileage(Line resultLine ,int directions,double sumUpOrDownMileage) {
  380 +
  381 + List<LineInformation> listLineInfo = informationRepository.findByLine(resultLine);
  382 +
  383 + int listLineSize = listLineInfo.size();
  384 +
  385 + // 不存在线路标准信息则插入
  386 + if(listLineSize==0) {
  387 +
  388 + LineInformation paramInfo = new LineInformation();
  389 +
  390 + // 上行
  391 + if(directions==0) {
354 392
355 - // 城建坐标点集合  
356 - String csectionVector = ""; 393 + paramInfo.setUpMileage(sumUpOrDownMileage);
357 394
358 - // 路段类型  
359 - String sectionType = ""; 395 + paramInfo.setDownMileage(0.0d);
360 396
361 - // 道路编码  
362 - String roadCoding = ""; 397 + paramInfo.setTotalMileage(sumUpOrDownMileage+0.0d);
363 398
364 - // 限速  
365 - double speedLimit = Double.parseDouble(speedLimitStr); 399 + paramInfo.setType("zc");
366 400
367 - // 说明  
368 - String descriptions = ""; 401 + paramInfo.setLine(resultLine);
369 402
370 - // 路段保存  
371 - sectionRepository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode,  
372 -  
373 - middleNode, gsectionVector, bsectionVector, sectionType, csectionVector,  
374 -  
375 - roadCoding, sectionDistance, sectionDuration, dbType, speedLimit,  
376 -  
377 - descriptions, versions);  
378 - 403 + // 下行
  404 + }else if(directions==1) {
379 405
  406 + paramInfo.setUpMileage(0.0d);
380 407
381 - Section section = sectionRepository.findOne(Integer.parseInt(sectionCode)); 408 + paramInfo.setDownMileage(sumUpOrDownMileage);
382 409
383 - // 路段路由  
384 - SectionRoute sectionRoute = new SectionRoute(); 410 + paramInfo.setTotalMileage(sumUpOrDownMileage+0.0d);
385 411
386 - // 路段序号  
387 - sectionRoute.setSectionrouteCode(100); 412 + paramInfo.setType("zc");
388 413
389 - // 线路编码  
390 - sectionRoute.setLineCode(resultLine.getLineCode()); 414 + paramInfo.setLine(resultLine);
391 415
392 - // 路段ID  
393 - sectionRoute.setSection(section); 416 + }
  417 +
  418 + informationRepository.save(paramInfo);
  419 +
  420 + // 存在则更新
  421 + }else if(listLineSize>0) {
  422 +
  423 + for(int s =0;s<listLineSize;s++) {
394 424
395 - sectionRoute.setDestroy(destroy); 425 + LineInformation lineInformation = listLineInfo.get(s);
396 426
397 - // 线路ID  
398 - sectionRoute.setLine(resultLine); 427 + double tempUp = lineInformation.getUpMileage();
399 428
400 - // 路段编码  
401 - sectionRoute.setSectionCode(sectionCode); 429 + double tempDown = lineInformation.getDownMileage();
402 430
403 - // 版本  
404 - sectionRoute.setVersions(versions); 431 + // 上行
  432 + if(directions==0) {
  433 +
  434 + if(tempUp>0.0d){
  435 +
  436 + continue;
  437 + }
  438 +
  439 +
  440 + lineInformation.setUpMileage(sumUpOrDownMileage);
  441 +
  442 + lineInformation.setTotalMileage(sumUpOrDownMileage+tempDown);
  443 +
  444 +
  445 + }else if(directions==1) {
  446 +
  447 + if(tempDown>0.0d){
  448 +
  449 + continue;
  450 + }
  451 +
  452 + lineInformation.setDownMileage(sumUpOrDownMileage);
  453 +
  454 + lineInformation.setTotalMileage(sumUpOrDownMileage+tempUp);
  455 +
  456 + }
405 457
406 - // 方向  
407 - sectionRoute.setDirections(directions); 458 + informationRepository.save(lineInformation);
408 459
409 - // 路段路由保存  
410 - sectionRouteRepository.save(sectionRoute);  
411 } 460 }
412 461
413 - resultMap.put("status", ResponseCode.SUCCESS); 462 + }
  463 +
  464 + }
  465 +
  466 + /**
  467 + * @Description 保存路段与路段路由信息
  468 + *
  469 + * @param sectionJSON:路段与路段路由json字符串数据
  470 + *
  471 + * @param directions:方向
  472 + *
  473 + * @param resultLine:线路实体类
  474 + *
  475 + * @param speedLimitStr:限速
  476 + *
  477 + * @param sectionDistance:总距离
  478 + *
  479 + * @param sectionDuration:总时长
  480 + *
  481 + * @param dbType:原中坐标类型
  482 + *
  483 + * @param versions:版本号
  484 + *
  485 + * @param destroy:是否撤销
  486 + *
  487 + */
  488 + public void saveSectionAndSectionRouteInfo(String sectionJSON,int directions,Line resultLine,String speedLimitStr,
414 489
415 - } catch (Exception e) { 490 + double sectionDistance,double sectionDuration,String dbType,int versions,int destroy) throws Exception{
  491 +
  492 + // 转换成JSON数组
  493 + JSONArray sectionsArray = JSONArray.parseArray(sectionJSON);
  494 +
  495 + // 原始线状图形坐标集合
  496 + String sectionsBpoints = "";
  497 +
  498 + // WGS线状图形坐标集合
  499 + String sectionsWJPpoints = "";
  500 +
  501 + // 遍历
  502 + for(int s = 0 ;s<sectionsArray.size();s++) {
416 503
417 - resultMap.put("status", ResponseCode.ERROR); 504 + String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString();
  505 +
  506 + String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString();
  507 +
  508 + String WGSLngStr = JSONObject.parseObject(sectionsArray.getJSONObject(s).get("WGSpotion").toString()).get("Lng").toString();
  509 +
  510 + String WGSLatStr = JSONObject.parseObject(sectionsArray.getJSONObject(s).get("WGSpotion").toString()).get("Lat").toString();
  511 +
  512 + if(s==0) {
  513 +
  514 + sectionsBpoints = pointsLngStr + " " + pointsLatStr;
  515 +
  516 + sectionsWJPpoints = WGSLngStr + " " + WGSLatStr;
  517 +
  518 + }else {
  519 +
  520 + sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr;
  521 +
  522 + sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr;
  523 +
  524 + }
418 525
419 - logger.error("save erro.", e);  
420 526
421 } 527 }
422 528
423 - return resultMap; 529 + long sectionMaxId = GetUIDAndCode.getSectionId();
  530 +
  531 + String sectionCode = String.valueOf(sectionMaxId);
  532 +
  533 + int sectionid = (int)sectionMaxId;
  534 +
  535 + String upOrDownStr = "";
  536 +
  537 + if(directions==0){
  538 +
  539 + upOrDownStr = "上行路段";
  540 +
  541 + }else if(directions==1){
  542 +
  543 + upOrDownStr = "下行路段";
  544 +
  545 + }
  546 +
  547 + // 路段名称
  548 + String sectionName = resultLine.getName()+upOrDownStr;
  549 +
  550 + // 交出路
  551 + String crosesRoad = "";
  552 +
  553 + // 终止节点
  554 + String endNode = "";
  555 +
  556 + // 开始节点
  557 + String startNode = "";
  558 +
  559 + // 中间节点
  560 + String middleNode = "";
  561 +
  562 + // WGS坐标点集合
  563 + String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")";
  564 +
  565 + // 原坐标点集合
  566 + String bsectionVector = "LINESTRING(" + sectionsBpoints + ")";
  567 +
  568 + // 城建坐标点集合
  569 + String csectionVector = "";
  570 +
  571 + // 路段类型
  572 + String sectionType = "";
  573 +
  574 + // 道路编码
  575 + String roadCoding = "";
  576 +
  577 + // 限速
  578 + double speedLimit = Double.parseDouble(speedLimitStr);
  579 +
  580 + // 说明
  581 + String descriptions = "";
  582 +
  583 + // 路段保存
  584 + sectionRepository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode,
  585 +
  586 + middleNode, gsectionVector, bsectionVector, sectionType, csectionVector,
  587 +
  588 + roadCoding, sectionDistance, sectionDuration, dbType, speedLimit,
  589 +
  590 + descriptions, versions,sectionid);
  591 +
  592 +
  593 +
  594 + Section section = sectionRepository.findOne(sectionid);
  595 +
  596 + // 路段路由
  597 + SectionRoute sectionRoute = new SectionRoute();
  598 +
  599 + // 路段序号
  600 + sectionRoute.setSectionrouteCode(100);
  601 +
  602 + // 线路编码
  603 + sectionRoute.setLineCode(resultLine.getLineCode());
  604 +
  605 + // 路段ID
  606 + sectionRoute.setSection(section);
  607 +
  608 + sectionRoute.setDestroy(destroy);
  609 +
  610 + // 线路ID
  611 + sectionRoute.setLine(resultLine);
  612 +
  613 + // 路段编码
  614 + sectionRoute.setSectionCode(sectionCode);
  615 +
  616 + // 版本
  617 + sectionRoute.setVersions(versions);
  618 +
  619 + // 方向
  620 + sectionRoute.setDirections(directions);
  621 +
  622 + // 路段路由保存
  623 + sectionRouteRepository.save(sectionRoute);
  624 +
424 } 625 }
425 626
426 -  
427 public boolean isHaveStationname(String bJwpoints,List<Object[]> stationNameList) { 627 public boolean isHaveStationname(String bJwpoints,List<Object[]> stationNameList) {
428 628
429 boolean temp = true; 629 boolean temp = true;
@@ -452,17 +652,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -452,17 +652,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
452 return temp; 652 return temp;
453 } 653 }
454 654
455 - /**  
456 - * @Description :TODO(查询站点编码)  
457 - *  
458 - * @return int <stationCode站点编码>  
459 - */  
460 - @Override  
461 - public int getStationCode() {  
462 -  
463 - return repository.stationMaxId();  
464 -  
465 - } 655 +
466 656
467 /** 657 /**
468 * @Description :TODO(新增站点保存) 658 * @Description :TODO(新增站点保存)
@@ -489,6 +679,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -489,6 +679,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
489 // 站点编码 679 // 站点编码
490 String stationCod = map.get("stationCod").equals("") ? "" : map.get("stationCod").toString(); 680 String stationCod = map.get("stationCod").equals("") ? "" : map.get("stationCod").toString();
491 681
  682 + // 站点ID
  683 + int stationId = Integer.valueOf(stationCod);
  684 +
492 // 站点名称 685 // 站点名称
493 String stationName = map.get("stationName").equals("") ? "" : map.get("stationName").toString(); 686 String stationName = map.get("stationName").equals("") ? "" : map.get("stationName").toString();
494 687
@@ -585,13 +778,12 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -585,13 +778,12 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
585 778
586 gLonx, gLaty, x, y, gPloygonGrid,bPloygonGrid, destroy, radius, 779 gLonx, gLaty, x, y, gPloygonGrid,bPloygonGrid, destroy, radius,
587 780
588 - shapesType, versions, descriptions, createBy, updateBy); 781 + shapesType, versions, descriptions, createBy, updateBy,stationId);
589 782
590 783
591 784
592 - int staitonId = repository.stationMaxId();  
593 785
594 - Station station = repository.findOne(staitonId); 786 + Station station = repository.findOne(stationId);
595 787
596 StationRoute arg0 = new StationRoute(); 788 StationRoute arg0 = new StationRoute();
597 789
@@ -605,9 +797,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -605,9 +797,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
605 arg0.setStationName(stationName); 797 arg0.setStationName(stationName);
606 798
607 // 站点路由编码 799 // 站点路由编码
608 - arg0.setStationCode(station.getStationCod()); 800 + arg0.setStationCode(stationCod);
609 801
610 - // 站点路由Id 802 + // 站点路由序号
611 arg0.setStationRouteCode(Integer.parseInt(stationRouteCodeArray[0])+1); 803 arg0.setStationRouteCode(Integer.parseInt(stationRouteCodeArray[0])+1);
612 804
613 // 站点路由类型 805 // 站点路由类型
@@ -878,7 +1070,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -878,7 +1070,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
878 1070
879 if(distanceStr.indexOf("米")!=-1){ 1071 if(distanceStr.indexOf("米")!=-1){
880 1072
881 - distance = Double.parseDouble(distanceStr.replaceAll("米", "")); 1073 + distance = Double.parseDouble(distanceStr.replaceAll("米", "")) / 1000;
882 1074
883 }else if(distanceStr.indexOf("公里")!=-1){ 1075 }else if(distanceStr.indexOf("公里")!=-1){
884 1076
@@ -930,7 +1122,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -930,7 +1122,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
930 Station arg0 = new Station(); 1122 Station arg0 = new Station();
931 1123
932 // 站点编码 1124 // 站点编码
933 - int stationCode = 0; 1125 + long stationCode = 0L;
934 1126
935 if(isHave) { 1127 if(isHave) {
936 1128
@@ -942,7 +1134,11 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -942,7 +1134,11 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
942 1134
943 }else { 1135 }else {
944 1136
945 - stationCode = repository.stationMaxId(); 1137 + stationCode = GetUIDAndCode.getStationId();
  1138 +
  1139 + int stationId = (int) (stationCode);
  1140 +
  1141 + arg0.setId(stationId);
946 1142
947 arg0.setStationName(stationName); 1143 arg0.setStationName(stationName);
948 1144
@@ -966,7 +1162,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -966,7 +1162,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
966 arg0.setShapesType(shapesType); 1162 arg0.setShapesType(shapesType);
967 1163
968 // 站点编码 1164 // 站点编码
969 - arg0.setStationCod(String.valueOf(stationCode+1)); 1165 + arg0.setStationCod(String.valueOf(stationCode));
970 1166
971 // 是否想撤销 1167 // 是否想撤销
972 arg0.setDestroy(destroy); 1168 arg0.setDestroy(destroy);
@@ -978,6 +1174,8 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -978,6 +1174,8 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
978 1174
979 // 插入站点信息 1175 // 插入站点信息
980 repository.save(arg0); 1176 repository.save(arg0);
  1177 +
  1178 +
981 // 站点路由对象 1179 // 站点路由对象
982 StationRoute route = new StationRoute(); 1180 StationRoute route = new StationRoute();
983 1181
@@ -1081,16 +1279,13 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -1081,16 +1279,13 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1081 } 1279 }
1082 1280
1083 } 1281 }
1084 - System.out.println(sectionName);  
1085 -  
1086 - System.out.println(sectionsBpoints); 1282 +
1087 1283
1088 - System.out.println(sectionsWJPpoints);  
1089 - 1284 + long sectionMaxId = GetUIDAndCode.getSectionId();
1090 1285
1091 - int sectionMaxId = sectionRepository.sectionMaxId(); 1286 + String sectionCode = String.valueOf(sectionMaxId);
1092 1287
1093 - String sectionCode = String.valueOf(sectionMaxId+1); 1288 + int sectionId = (int) (sectionMaxId);
1094 1289
1095 // 交出路 1290 // 交出路
1096 String crosesRoad = ""; 1291 String crosesRoad = "";
@@ -1138,7 +1333,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -1138,7 +1333,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1138 1333
1139 roadCoding, sectionDistance, sectionTime, dbType, speedLimit, 1334 roadCoding, sectionDistance, sectionTime, dbType, speedLimit,
1140 1335
1141 - descriptions, versions); 1336 + descriptions, versions,sectionId);
1142 1337
1143 1338
1144 1339
src/main/resources/static/index.html
@@ -281,6 +281,7 @@ tr.row-active td { @@ -281,6 +281,7 @@ tr.row-active td {
281 <script src="http://api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT" data-exclude=1></script> 281 <script src="http://api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT" data-exclude=1></script>
282 <script src="http://api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.js" data-exclude=1></script> 282 <script src="http://api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.js" data-exclude=1></script>
283 <script type="text/javascript" src="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js" data-exclude=1></script> 283 <script type="text/javascript" src="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js" data-exclude=1></script>
  284 +<script type="text/javascript" src="http://api.map.baidu.com/library/RichMarker/1.2/src/RichMarker_min.js ">
284 <script src="/assets/js/baidu/TextIconOverlay.js"></script> 285 <script src="/assets/js/baidu/TextIconOverlay.js"></script>
285 <script src="/assets/js/baidu//MarkerClusterer.js"></script> 286 <script src="/assets/js/baidu//MarkerClusterer.js"></script>
286 <!-- 高德 --> 287 <!-- 高德 -->
src/main/resources/static/pages/base/line/js/line-add-form.js
@@ -6,6 +6,8 @@ $(function(){ @@ -6,6 +6,8 @@ $(function(){
6 // 获取线路编码 6 // 获取线路编码
7 $.get('/line/getLineCode',function(lineCode){ 7 $.get('/line/getLineCode',function(lineCode){
8 8
  9 + console.log(lineCode);
  10 +
9 return cb && cb(lineCode); 11 return cb && cb(lineCode);
10 12
11 }); 13 });
src/main/resources/static/pages/base/section/list.html
@@ -43,28 +43,28 @@ @@ -43,28 +43,28 @@
43 <tr role="row" class="filter"> 43 <tr role="row" class="filter">
44 <td></td> 44 <td></td>
45 <td> 45 <td>
46 - <input type="text" class="form-control form-filter input-sm" name="lineCode"> 46 + <input type="text" class="form-control form-filter input-sm" name="lineCode_eq">
47 </td> 47 </td>
48 <td> 48 <td>
49 - <input type="text" class="form-control form-filter input-sm" name="name"> 49 + <input type="text" class="form-control form-filter input-sm" name="line.name_like">
50 </td> 50 </td>
51 <td> 51 <td>
52 - <input type="text" class="form-control form-filter input-sm" name="carSumNumber"> 52 + <input type="text" class="form-control form-filter input-sm" name="directions_eq">
53 </td> 53 </td>
54 <td> 54 <td>
55 - <input type="text" class="form-control form-filter input-sm" name="carParkCode"> 55 + <input type="text" class="form-control form-filter input-sm" name="section.sectionName_like">
56 </td> 56 </td>
57 <td> 57 <td>
58 - <input type="text" class="form-control form-filter input-sm" name="startStationName"> 58 + <input type="text" class="form-control form-filter input-sm" name="sectionCode_eq">
59 </td> 59 </td>
60 <td> 60 <td>
61 - <input type="text" class="form-control form-filter input-sm" name="endStationName"> 61 + <input type="text" class="form-control form-filter input-sm" name="sectionrouteCode_eq">
62 </td> 62 </td>
63 <td> 63 <td>
64 - <input type="text" class="form-control form-filter input-sm" name="company"> 64 + <input type="text" class="form-control form-filter input-sm" name="versions_eq">
65 </td> 65 </td>
66 <td> 66 <td>
67 - <select class="form-control form-filter " name="destroy"> 67 + <select class="form-control form-filter " name="destroy_eq">
68 <option value="">请选择...</option> 68 <option value="">请选择...</option>
69 <option value="1">运营</option> 69 <option value="1">运营</option>
70 <option value="0">撤销</option> 70 <option value="0">撤销</option>
@@ -122,14 +122,13 @@ @@ -122,14 +122,13 @@
122 {{obj.destroy}} 122 {{obj.destroy}}
123 </td> 123 </td>
124 <td> 124 <td>
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> 125 + <a href="positions.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 定位 </a>
127 </td> 126 </td>
128 </tr> 127 </tr>
129 {{/each}} 128 {{/each}}
130 {{if list.length == 0}} 129 {{if list.length == 0}}
131 <tr> 130 <tr>
132 - <td colspan=8><h6 class="muted">没有找到相关数据</h6></td> 131 + <td colspan=9><h6 class="muted">没有找到相关数据</h6></td>
133 </tr> 132 </tr>
134 {{/if}} 133 {{/if}}
135 </script> 134 </script>
src/main/resources/static/pages/base/station/js/station-list-table.js
1 /** 1 /**
2 * 2 *
3 - * @JSName : list.js(线路信息list.html页面js) 3 + * @JSName : list.js(站点信息list.html页面js)
4 * 4 *
5 * @Author : bsth@lq 5 * @Author : bsth@lq
6 * 6 *
7 - * @Description : TODO(线路信息list.html页面js) 7 + * @Description : TODO(站点信息list.html页面js)
8 * 8 *
9 * @Data : 2016年4月28日 上午9:21:17 9 * @Data : 2016年4月28日 上午9:21:17
10 * 10 *
@@ -14,59 +14,60 @@ @@ -14,59 +14,60 @@
14 14
15 (function(){ 15 (function(){
16 16
17 - /**  
18 - * -----page : 当前页  
19 - *  
20 - * -----initPag :  
21 - *  
22 - */ 17 + /** page : 当前页 initPag : */
23 var page = 0,initPag; 18 var page = 0,initPag;
24 19
25 -  
26 -  
27 - // 表格数据分页加载 20 + /** 表格数据分页加载 */
28 loadTableDate(null,true); 21 loadTableDate(null,true);
29 22
30 - /**  
31 - * 重置按钮事件  
32 - *  
33 - */ 23 + /** 重置按钮事件 */
34 $('tr.filter .filter-cancel').on('click',function(){ 24 $('tr.filter .filter-cancel').on('click',function(){
  25 +
35 // 清空搜索框值 26 // 清空搜索框值
36 $('tr.filter input,select').val('').change(); 27 $('tr.filter input,select').val('').change();
  28 +
37 // 重新加载表格数据 29 // 重新加载表格数据
38 loadTableDate(null,true); 30 loadTableDate(null,true);
39 }); 31 });
40 32
41 - /**  
42 - * 搜索按钮事件  
43 - *  
44 - */ 33 + /** 搜索按钮事件 */
45 $('tr.filter .filter-submit').on('click',function(){ 34 $('tr.filter .filter-submit').on('click',function(){
  35 +
46 // cells 集合返回表格中所有(列)单元格的一个数组 36 // cells 集合返回表格中所有(列)单元格的一个数组
47 var cells = $('tr.filter')[0].cells; 37 var cells = $('tr.filter')[0].cells;
  38 +
48 // 搜索参数集合 39 // 搜索参数集合
49 var params = {}; 40 var params = {};
  41 +
50 // 搜索字段名称 42 // 搜索字段名称
51 var name; 43 var name;
  44 +
52 // 遍历cells数组 45 // 遍历cells数组
53 $.each(cells, function(i, cell){ 46 $.each(cells, function(i, cell){
  47 +
54 // 获取第i列的input或者select集合 48 // 获取第i列的input或者select集合
55 var items = $('input,select', cell); 49 var items = $('input,select', cell);
  50 +
56 // 遍历items集合 51 // 遍历items集合
57 for(var j = 0, item; item = items[j++];){ 52 for(var j = 0, item; item = items[j++];){
  53 +
58 // 获取字段名称 54 // 获取字段名称
59 name = $(item).attr('name'); 55 name = $(item).attr('name');
  56 +
60 if(name){ 57 if(name){
  58 +
61 // 赋取相对应的值 59 // 赋取相对应的值
62 params[name] = $(item).val(); 60 params[name] = $(item).val();
  61 +
63 } 62 }
64 } 63 }
  64 +
65 }); 65 });
  66 +
66 page = 0; 67 page = 0;
67 68
68 - console.log(params);  
69 loadTableDate(params,true); 69 loadTableDate(params,true);
  70 +
70 }); 71 });
71 72
72 /** 73 /**
@@ -78,64 +79,99 @@ @@ -78,64 +79,99 @@
78 * 79 *
79 */ 80 */
80 function loadTableDate(param,isPon){ 81 function loadTableDate(param,isPon){
  82 +
81 // 搜索参数 83 // 搜索参数
82 var params = {}; 84 var params = {};
83 - if(param) 85 +
  86 + if(param) {
  87 +
84 params = param; 88 params = param;
  89 +
  90 + }
  91 +
85 // 排序(按更新时间) 92 // 排序(按更新时间)
86 params['order'] = 'id'; 93 params['order'] = 'id';
  94 +
87 // 记录当前页数 95 // 记录当前页数
88 params['page'] = page; 96 params['page'] = page;
  97 +
89 // 弹出正在加载层 98 // 弹出正在加载层
90 var i = layer.load(2); 99 var i = layer.load(2);
  100 +
91 // 异步请求获取表格数据 101 // 异步请求获取表格数据
92 $.get('/stationroute',params,function(result){ 102 $.get('/stationroute',params,function(result){
93 103
  104 + console.log(result);
  105 +
94 // 添加序号 106 // 添加序号
95 result.content.page = page; 107 result.content.page = page;
96 108
97 // 把数据填充到模版中 109 // 把数据填充到模版中
98 var tbodyHtml = template('staitonInfo_list_table_temp',{list:result.content}); 110 var tbodyHtml = template('staitonInfo_list_table_temp',{list:result.content});
99 - // 把渲染好的模版html文本追加到表格中  
100 - $('#datatable_line tbody').html(tbodyHtml); 111 +
  112 +
  113 + $('#datatable_station tbody').html(tbodyHtml);
  114 +
101 // 是重新分页且返回数据长度大于0 115 // 是重新分页且返回数据长度大于0
102 if(isPon && result.content.length > 0){ 116 if(isPon && result.content.length > 0){
  117 +
103 // 重新分页 118 // 重新分页
104 initPag = true; 119 initPag = true;
  120 +
105 // 分页栏 121 // 分页栏
106 showPagination(result); 122 showPagination(result);
  123 +
107 } 124 }
  125 +
108 // 关闭弹出加载层 126 // 关闭弹出加载层
109 layer.close(i); 127 layer.close(i);
  128 +
110 }); 129 });
111 } 130 }
112 131
113 - /**  
114 - * 分页栏组件  
115 - *  
116 - */ 132 + /** 分页栏组件 */
117 function showPagination(data){ 133 function showPagination(data){
  134 +
118 // 分页组件 135 // 分页组件
119 $('#pagination').jqPaginator({ 136 $('#pagination').jqPaginator({
  137 +
120 // 总页数 138 // 总页数
121 totalPages: data.totalPages, 139 totalPages: data.totalPages,
  140 +
122 // 中间显示页数 141 // 中间显示页数
123 visiblePages: 6, 142 visiblePages: 6,
  143 +
124 // 当前页 144 // 当前页
125 currentPage: page + 1, 145 currentPage: page + 1,
  146 +
126 first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>', 147 first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
  148 +
127 prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>', 149 prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
  150 +
128 next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>', 151 next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
  152 +
129 last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>', 153 last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
  154 +
130 page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>', 155 page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
  156 +
131 onPageChange: function (num, type) { 157 onPageChange: function (num, type) {
  158 +
132 if(initPag){ 159 if(initPag){
  160 +
133 initPag = false; 161 initPag = false;
  162 +
134 return; 163 return;
  164 +
135 } 165 }
  166 +
136 page = num - 1; 167 page = num - 1;
  168 +
137 loadTableDate(null, false); 169 loadTableDate(null, false);
  170 +
138 } 171 }
  172 +
139 }); 173 });
  174 +
140 } 175 }
  176 +
141 })(); 177 })();
142 \ No newline at end of file 178 \ No newline at end of file
src/main/resources/static/pages/base/station/list.html
@@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
26 </div> 26 </div>
27 <div class="portlet-body"> 27 <div class="portlet-body">
28 <div class="table-container" style="margin-top: 10px"> 28 <div class="table-container" style="margin-top: 10px">
29 - <table class="table table-striped table-bordered table-hover table-checkable" id="datatable_line"> 29 + <table class="table table-striped table-bordered table-hover table-checkable" id="datatable_station">
30 <thead> 30 <thead>
31 <tr role="row" class="heading"> 31 <tr role="row" class="heading">
32 <th width="3%">序号</th> 32 <th width="3%">序号</th>
@@ -44,34 +44,43 @@ @@ -44,34 +44,43 @@
44 <tr role="row" class="filter"> 44 <tr role="row" class="filter">
45 <td>#</td> 45 <td>#</td>
46 <td> 46 <td>
47 - <input type="text" class="form-control form-filter input-sm" name="carParkCode"> 47 + <input type="text" class="form-control form-filter input-sm" name="lineCode_eq">
48 </td> 48 </td>
49 <td> 49 <td>
50 - <input type="text" class="form-control form-filter input-sm" name="startStationName"> 50 + <input type="text" class="form-control form-filter input-sm" name="line.name_like">
51 </td> 51 </td>
52 <td> 52 <td>
53 - <input type="text" class="form-control form-filter input-sm" name="endStationName"> 53 + <select class="form-control form-filter " name="directions_eq">
  54 + <option value="">请选择...</option>
  55 + <option value="0">上行</option>
  56 + <option value="1">下行</option>
  57 + </select>
54 </td> 58 </td>
55 <td> 59 <td>
56 - <input type="text" class="form-control form-filter input-sm" name="brancheCompany"> 60 + <input type="text" class="form-control form-filter input-sm" name="stationName_like">
57 </td> 61 </td>
58 <td> 62 <td>
59 - <input type="text" class="form-control form-filter input-sm" name="startStationName"> 63 + <input type="text" class="form-control form-filter input-sm" name="stationCode_eq">
60 </td> 64 </td>
61 <td> 65 <td>
62 - <input type="text" class="form-control form-filter input-sm" name="endStationName"> 66 + <input type="text" class="form-control form-filter input-sm" name="stationRouteCode_eq">
63 </td> 67 </td>
64 <td> 68 <td>
65 - <input type="text" class="form-control form-filter input-sm" name="brancheCompany"> 69 + <select class="form-control form-filter " name="stationMark_eq">
  70 + <option value="">请选择...</option>
  71 + <option value="B">起始站</option>
  72 + <option value="Z">中途站</option>
  73 + <option value="E">终点站</option>
  74 + </select>
66 </td> 75 </td>
67 <td> 76 <td>
68 - <input type="text" class="form-control form-filter input-sm" name="company"> 77 + <input type="text" class="form-control form-filter input-sm" name="versions_eq">
69 </td> 78 </td>
70 <td> 79 <td>
71 - <select class="form-control form-filter " name="destroy"> 80 + <select class="form-control form-filter " name="destroy_eq">
72 <option value="">请选择...</option> 81 <option value="">请选择...</option>
73 - <option value="1">运营</option>  
74 - <option value="0">撤销</option> 82 + <option value="0">运营</option>
  83 + <option value="1">撤销</option>
75 </select> 84 </select>
76 </td> 85 </td>
77 <td> 86 <td>
@@ -129,14 +138,13 @@ @@ -129,14 +138,13 @@
129 {{obj.destroy}} 138 {{obj.destroy}}
130 </td> 139 </td>
131 <td> 140 <td>
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> 141 + <a href="positions.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 定位 </a>
134 </td> 142 </td>
135 </tr> 143 </tr>
136 {{/each}} 144 {{/each}}
137 {{if list.length == 0}} 145 {{if list.length == 0}}
138 <tr> 146 <tr>
139 - <td colspan=8><h6 class="muted">没有找到相关数据</h6></td> 147 + <td colspan=11><h6 class="muted">没有找到相关数据</h6></td>
140 </tr> 148 </tr>
141 {{/if}} 149 {{/if}}
142 </script> 150 </script>
src/main/resources/static/pages/base/stationroute/add_select.html
@@ -47,10 +47,10 @@ @@ -47,10 +47,10 @@
47 47
48 <div class="form-group"> 48 <div class="form-group">
49 <div class="alert alert-info font-blue-chambray" style="background-color: #2C3E50"> 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> 50 + <h5 class="block"><span class="help-block" style="color:#eee;"> * 新增方式说明: </span></h5>
  51 + <p><span class="help-block" style="color:#eee;"> a)系统生成:根据站点名称自动生成以300米为半径范围的圆.</span> </p>
  52 + <p><span class="help-block" style="color:#eee;"> b)手动添加:手动在地图上画出站点范围,然后双击鼠标右键保存.</span> </p>
  53 + <p><span class="help-block" style="color:#eee;"> c)选择引用:从系统中选择已有的站点进行引用.</span> </p>
54 </div> 54 </div>
55 </div> 55 </div>
56 </form> 56 </form>
src/main/resources/static/pages/base/stationroute/edit.html
@@ -348,7 +348,7 @@ $(function(){ @@ -348,7 +348,7 @@ $(function(){
348 required : true, 348 required : true,
349 349
350 // 必须输入合法的数字(负数,小数)。 350 // 必须输入合法的数字(负数,小数)。
351 - number : true 351 + /* number : true */
352 352
353 }, 353 },
354 354
src/main/resources/static/pages/base/stationroute/js/stationroute-ajax-getdata.js
@@ -345,6 +345,7 @@ var GetAjaxData = function(){ @@ -345,6 +345,7 @@ var GetAjaxData = function(){
345 345
346 }, 346 },
347 347
  348 + // 手动规划线路保存
348 manualSave : function(params,callback) { 349 manualSave : function(params,callback) {
349 350
350 // 保存 351 // 保存
@@ -354,6 +355,16 @@ var GetAjaxData = function(){ @@ -354,6 +355,16 @@ var GetAjaxData = function(){
354 355
355 }); 356 });
356 357
  358 + },
  359 +
  360 + createUsingSingle : function(params,callback) {
  361 +
  362 + $post('/stationroute/usingSingle',params,function(p) {
  363 +
  364 + return callback && callback(p);
  365 +
  366 + });
  367 +
357 } 368 }
358 369
359 } 370 }
src/main/resources/static/pages/base/stationroute/js/stationroute-list-events.js
@@ -164,4 +164,17 @@ $(function(){ @@ -164,4 +164,17 @@ $(function(){
164 164
165 }); 165 });
166 166
  167 + // 生成行单
  168 + $('.module_tools #createUsingSingle').on('click', function() {
  169 +
  170 + var params = {lineId:id};
  171 +
  172 + GetAjaxData.createUsingSingle(params,function(p) {
  173 +
  174 + console.log(p);
  175 +
  176 + })
  177 +
  178 + });
  179 +
167 }); 180 });
168 \ No newline at end of file 181 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/js/stationroute-list-function.js
@@ -68,7 +68,7 @@ var PublicFunctions = function () { @@ -68,7 +68,7 @@ var PublicFunctions = function () {
68 GetAjaxData.getStation(id,directionData,function(treeDateJson) { 68 GetAjaxData.getStation(id,directionData,function(treeDateJson) {
69 69
70 // 获取数据长度 70 // 获取数据长度
71 - var len = treeDateJson[0].children.length; 71 + var len = treeDateJson[0].children[0].children.length;
72 72
73 // 上行 73 // 上行
74 if(directionData==0){ 74 if(directionData==0){
@@ -342,6 +342,36 @@ var PublicFunctions = function () { @@ -342,6 +342,36 @@ var PublicFunctions = function () {
342 // 如果线路信息不为空 342 // 如果线路信息不为空
343 if(BusLine) { 343 if(BusLine) {
344 344
  345 + console.log(BusLine.yB.length);
  346 +
  347 + if(BusLine.yB.length == 0){
  348 +
  349 + layer.confirm('系统生成该线路【'+lineNameV+'】时获取站点与路段异常!请联系管理员或者检查网络连接是否异常!', {
  350 + btn : [ '确认' ]
  351 + }, function(index) {
  352 +
  353 + // 关闭弹出层
  354 + layer.closeAll();
  355 +
  356 + // 上行
  357 + if(directionData==0){
  358 +
  359 + // 显示上行规划
  360 + $('#upToolsMobal').show();
  361 +
  362 + // 下行
  363 + }else if(directionData==1){
  364 +
  365 + // 显示下行规划
  366 + $('#downToolsMobal').show();
  367 +
  368 + }
  369 +
  370 + return ;
  371 + });
  372 +
  373 + }
  374 +
345 // 获取公交线几何对象, 仅当结果自动添加到地图上时有效 375 // 获取公交线几何对象, 仅当结果自动添加到地图上时有效
346 var Polygon = BusLine.getPolyline(); 376 var Polygon = BusLine.getPolyline();
347 377
@@ -920,7 +950,13 @@ var PublicFunctions = function () { @@ -920,7 +950,13 @@ var PublicFunctions = function () {
920 var bJwpointsArray = bJwpointsStr.split(' '); 950 var bJwpointsArray = bJwpointsStr.split(' ');
921 951
922 var point_center = new BMap.Point(bJwpointsArray[0],bJwpointsArray[1]); 952 var point_center = new BMap.Point(bJwpointsArray[0],bJwpointsArray[1]);
923 - 953 + // var htm = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 80px; height: 26px; left: -10px; top: -35px; overflow: hidden;"><img id="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back1.png"></div>';
  954 + var htm = "<div style='background:#E7F0F5;color:#0082CB;border:1px solid #333'>"
  955 + + "欢迎使用百度地图"
  956 + + "</div>";
  957 + var myRichMarkerObject = new BMapLib.RichMarker(htm, point_center, { "enableDragging": false});
  958 + myRichMarkerObject.setWidth('50px');
  959 + myRichMarkerObject.setWidth('30px')
924 // 自定义标注物图片 960 // 自定义标注物图片
925 var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); 961 var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20));
926 962
@@ -935,6 +971,8 @@ var PublicFunctions = function () { @@ -935,6 +971,8 @@ var PublicFunctions = function () {
935 971
936 mapB.addOverlay(markers_thread); 972 mapB.addOverlay(markers_thread);
937 973
  974 + //mapB.addOverlay(myRichMarkerObject);
  975 +
938 } 976 }
939 977
940 } 978 }
@@ -949,7 +987,7 @@ var PublicFunctions = function () { @@ -949,7 +987,7 @@ var PublicFunctions = function () {
949 TreeUpOrDown : function(lineId,diraction) { 987 TreeUpOrDown : function(lineId,diraction) {
950 988
951 GetAjaxData.getStation(lineId,diraction,function(treeDateJson) { 989 GetAjaxData.getStation(lineId,diraction,function(treeDateJson) {
952 - 990 +
953 var len = treeDateJson[0].children[0].children.length; 991 var len = treeDateJson[0].children[0].children.length;
954 992
955 // 上行 993 // 上行
src/main/resources/static/pages/base/stationroute/list.html
@@ -73,6 +73,9 @@ @@ -73,6 +73,9 @@
73 <li> 73 <li>
74 <a href="javascript:;" id="editUplineTrend"><i class="fa fa-edit"></i> 编辑走向</a> 74 <a href="javascript:;" id="editUplineTrend"><i class="fa fa-edit"></i> 编辑走向</a>
75 </li> 75 </li>
  76 + <li>
  77 + <a href="javascript:;" id="createUsingSingle"><i class="fa fa-edit"></i> 生成行单</a>
  78 + </li>
76 </ul> 79 </ul>
77 </div> 80 </div>
78 </div> 81 </div>