Commit 2f29f5bf9b90c8ac534788903549273a70eb1ed0

Authored by 王通
1 parent 75547575

1.站级加入中心点

@@ -431,7 +431,6 @@ @@ -431,7 +431,6 @@
431 <plugins> 431 <plugins>
432 <plugin> 432 <plugin>
433 <artifactId>maven-compiler-plugin</artifactId> 433 <artifactId>maven-compiler-plugin</artifactId>
434 - <version>2.3.2</version><!--$NO-MVN-MAN-VER$ -->  
435 <configuration> 434 <configuration>
436 <source>1.8</source> 435 <source>1.8</source>
437 <target>1.8</target> 436 <target>1.8</target>
@@ -439,7 +438,6 @@ @@ -439,7 +438,6 @@
439 </plugin> 438 </plugin>
440 <plugin> 439 <plugin>
441 <artifactId>maven-war-plugin</artifactId> 440 <artifactId>maven-war-plugin</artifactId>
442 - <version>2.2</version><!--$NO-MVN-MAN-VER$ -->  
443 <configuration> 441 <configuration>
444 <failOnMissingWebXml>false</failOnMissingWebXml> 442 <failOnMissingWebXml>false</failOnMissingWebXml>
445 </configuration> 443 </configuration>
src/main/java/com/bsth/entity/LsStationRoute.java
@@ -2,6 +2,7 @@ package com.bsth.entity; @@ -2,6 +2,7 @@ package com.bsth.entity;
2 2
3 import com.fasterxml.jackson.annotation.JsonIgnore; 3 import com.fasterxml.jackson.annotation.JsonIgnore;
4 import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  5 +import org.geolatte.geom.Point;
5 import org.geolatte.geom.Polygon; 6 import org.geolatte.geom.Polygon;
6 import org.hibernate.annotations.DynamicInsert; 7 import org.hibernate.annotations.DynamicInsert;
7 import org.hibernate.annotations.DynamicUpdate; 8 import org.hibernate.annotations.DynamicUpdate;
@@ -73,10 +74,10 @@ public class LsStationRoute { @@ -73,10 +74,10 @@ public class LsStationRoute {
73 private Integer outStationNmber; 74 private Integer outStationNmber;
74 75
75 // 站点路由到站距离 76 // 站点路由到站距离
76 - private Double distances = 0.; 77 + private Double distances;
77 78
78 // 站点路由到站时间 79 // 站点路由到站时间
79 - private Double toTime = 0.; 80 + private Double toTime;
80 81
81 // 首班时间 82 // 首班时间
82 private String firstTime; 83 private String firstTime;
@@ -88,7 +89,7 @@ public class LsStationRoute { @@ -88,7 +89,7 @@ public class LsStationRoute {
88 private Integer directions; 89 private Integer directions;
89 90
90 // 版本号 91 // 版本号
91 - private Integer versions = 1; 92 + private Integer versions;
92 93
93 // 是否撤销 94 // 是否撤销
94 private Integer destroy = 0; 95 private Integer destroy = 0;
@@ -121,12 +122,12 @@ public class LsStationRoute { @@ -121,12 +122,12 @@ public class LsStationRoute {
121 /** 122 /**
122 * 缓冲区几何图形类型 d 多边形 r 圆形 123 * 缓冲区几何图形类型 d 多边形 r 圆形
123 */ 124 */
124 - private String shapedType = "r"; 125 + private String shapedType;
125 126
126 /** 127 /**
127 * 缓冲区为圆形时的半径(米) 128 * 缓冲区为圆形时的半径(米)
128 */ 129 */
129 - private Integer radius = 80; 130 + private Integer radius;
130 131
131 /** 132 /**
132 * 多边形缓冲区坐标 字符串格式 POLYGON((lon lat, lon lat)) 133 * 多边形缓冲区坐标 字符串格式 POLYGON((lon lat, lon lat))
@@ -146,6 +147,24 @@ public class LsStationRoute { @@ -146,6 +147,24 @@ public class LsStationRoute {
146 @Transient 147 @Transient
147 private String bufferPolygonWgsWkt; 148 private String bufferPolygonWgsWkt;
148 149
  150 + /**
  151 + * 中心点 字符格式 Point(lon, lat)
  152 + */
  153 + @JsonIgnore
  154 + private Point centerPoint;
  155 +
  156 + /**
  157 + * 中心点 数字格式
  158 + */
  159 + @Transient
  160 + private String centerPointWkt;
  161 +
  162 + @JsonIgnore
  163 + private Point centerPointWgs;
  164 +
  165 + @Transient
  166 + private String centerPointWgsWkt;
  167 +
149 public Integer getId() { 168 public Integer getId() {
150 return id; 169 return id;
151 } 170 }
@@ -385,4 +404,40 @@ public class LsStationRoute { @@ -385,4 +404,40 @@ public class LsStationRoute {
385 public void setBufferPolygonWgsWkt(String bufferPolygonWgsWkt) { 404 public void setBufferPolygonWgsWkt(String bufferPolygonWgsWkt) {
386 this.bufferPolygonWgsWkt = bufferPolygonWgsWkt; 405 this.bufferPolygonWgsWkt = bufferPolygonWgsWkt;
387 } 406 }
  407 +
  408 + public Point getCenterPoint() {
  409 + return centerPoint;
  410 + }
  411 +
  412 + public void setCenterPoint(Point centerPoint) {
  413 + this.centerPoint = centerPoint;
  414 + }
  415 +
  416 + public String getCenterPointWkt() {
  417 + if (centerPointWkt == null && this.centerPoint != null) {
  418 + centerPointWkt = this.centerPoint.toString();
  419 + }
  420 +
  421 + return centerPointWkt;
  422 + }
  423 +
  424 + public void setCenterPointWkt(String centerPointWkt) {
  425 + this.centerPointWkt = centerPointWkt;
  426 + }
  427 +
  428 + public Point getCenterPointWgs() {
  429 + return centerPointWgs;
  430 + }
  431 +
  432 + public void setCenterPointWgs(Point centerPointWgs) {
  433 + this.centerPointWgs = centerPointWgs;
  434 + }
  435 +
  436 + public String getCenterPointWgsWkt() {
  437 + if (centerPointWgsWkt == null && this.centerPointWgs != null) {
  438 + centerPointWgsWkt = this.centerPointWgs .toString();
  439 + }
  440 +
  441 + return centerPointWgsWkt;
  442 + }
388 } 443 }
389 \ No newline at end of file 444 \ No newline at end of file
src/main/java/com/bsth/entity/StationRoute.java
1 package com.bsth.entity; 1 package com.bsth.entity;
2 2
3 import com.fasterxml.jackson.annotation.JsonIgnore; 3 import com.fasterxml.jackson.annotation.JsonIgnore;
  4 +import org.geolatte.geom.Point;
4 import org.geolatte.geom.Polygon; 5 import org.geolatte.geom.Polygon;
5 6
6 import javax.persistence.*; 7 import javax.persistence.*;
@@ -179,6 +180,24 @@ public class StationRoute { @@ -179,6 +180,24 @@ public class StationRoute {
179 @Transient 180 @Transient
180 private String bufferPolygonWgsWkt; 181 private String bufferPolygonWgsWkt;
181 182
  183 + /**
  184 + * 中心点 字符格式 Point(lon, lat)
  185 + */
  186 + @JsonIgnore
  187 + private Point centerPoint;
  188 +
  189 + /**
  190 + * 中心点 数字格式
  191 + */
  192 + @Transient
  193 + private String centerPointWkt;
  194 +
  195 + @JsonIgnore
  196 + private Point centerPointWgs;
  197 +
  198 + @Transient
  199 + private String centerPointWgsWkt;
  200 +
182 public Integer getId() { 201 public Integer getId() {
183 return id; 202 return id;
184 } 203 }
@@ -418,4 +437,40 @@ public class StationRoute { @@ -418,4 +437,40 @@ public class StationRoute {
418 public void setBufferPolygonWgsWkt(String bufferPolygonWgsWkt) { 437 public void setBufferPolygonWgsWkt(String bufferPolygonWgsWkt) {
419 this.bufferPolygonWgsWkt = bufferPolygonWgsWkt; 438 this.bufferPolygonWgsWkt = bufferPolygonWgsWkt;
420 } 439 }
  440 +
  441 + public Point getCenterPoint() {
  442 + return centerPoint;
  443 + }
  444 +
  445 + public void setCenterPoint(Point centerPoint) {
  446 + this.centerPoint = centerPoint;
  447 + }
  448 +
  449 + public String getCenterPointWkt() {
  450 + if (centerPointWkt == null && this.centerPoint != null) {
  451 + centerPointWkt = this.centerPoint.toString();
  452 + }
  453 +
  454 + return centerPointWkt;
  455 + }
  456 +
  457 + public void setCenterPointWkt(String centerPointWkt) {
  458 + this.centerPointWkt = centerPointWkt;
  459 + }
  460 +
  461 + public Point getCenterPointWgs() {
  462 + return centerPointWgs;
  463 + }
  464 +
  465 + public void setCenterPointWgs(Point centerPointWgs) {
  466 + this.centerPointWgs = centerPointWgs;
  467 + }
  468 +
  469 + public String getCenterPointWgsWkt() {
  470 + if (centerPointWgsWkt == null && this.centerPointWgs != null) {
  471 + centerPointWgsWkt = this.centerPointWgs .toString();
  472 + }
  473 +
  474 + return centerPointWgsWkt;
  475 + }
421 } 476 }
422 \ No newline at end of file 477 \ No newline at end of file
src/main/java/com/bsth/repository/StationRouteRepository.java
@@ -87,7 +87,7 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int @@ -87,7 +87,7 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
87 * 87 *
88 * [6]:distances(站点距离);[7]:station_name(站点名称);[8]:directions(方向)} 88 * [6]:distances(站点距离);[7]:station_name(站点名称);[8]:directions(方向)}
89 */ 89 */
90 - @Query(value = "SELECT ST_X(s.center_point_wgs) g_lonx,ST_Y(s.center_point_wgs) g_laty,CONCAT(ST_X(s.center_point), ' ', ST_Y(s.center_point)) b_jwpoints,r.station_mark,r.station_route_code,s.station_code,r.distances,r.station_name,r.directions,r.station_name_en FROM bsth_c_stationroute r JOIN bsth_c_station s ON r.station = s.id WHERE r.line = ?1 and r.destroy = 0 ORDER BY r.directions,r.station_route_code", nativeQuery=true) 90 + @Query(value = "SELECT ST_X(r.center_point_wgs) g_lonx,ST_Y(r.center_point_wgs) g_laty,CONCAT(ST_X(r.center_point), ' ', ST_Y(r.center_point)) b_jwpoints,r.station_mark,r.station_route_code,s.station_code,r.distances,r.station_name,r.directions,r.station_name_en FROM bsth_c_stationroute r JOIN bsth_c_station s ON r.station = s.id WHERE r.line = ?1 and r.destroy = 0 ORDER BY r.directions,r.station_route_code", nativeQuery=true)
91 List<Object[]> usingSingle(Integer lineId); 91 List<Object[]> usingSingle(Integer lineId);
92 92
93 List<StationRoute> findByLine(Line line); 93 List<StationRoute> findByLine(Line line);
src/main/java/com/bsth/service/impl/LsStationRouteServiceImpl.java
@@ -212,6 +212,8 @@ public class LsStationRouteServiceImpl extends BaseServiceImpl&lt;LsStationRoute, I @@ -212,6 +212,8 @@ public class LsStationRouteServiceImpl extends BaseServiceImpl&lt;LsStationRoute, I
212 // 中心点坐标信息 212 // 中心点坐标信息
213 if (!isPresent) { 213 if (!isPresent) {
214 centerPoint(station); 214 centerPoint(station);
  215 + stationRoute.setCenterPoint(station.getCenterPoint());
  216 + stationRoute.setCenterPointWgs(station.getCenterPointWgs());
215 } 217 }
216 218
217 // 多边形缓冲区 219 // 多边形缓冲区
@@ -241,16 +243,15 @@ public class LsStationRouteServiceImpl extends BaseServiceImpl&lt;LsStationRoute, I @@ -241,16 +243,15 @@ public class LsStationRouteServiceImpl extends BaseServiceImpl&lt;LsStationRoute, I
241 throw new IllegalArgumentException("历史版本不可变更"); 243 throw new IllegalArgumentException("历史版本不可变更");
242 } 244 }
243 245
  246 + if (!StringUtils.isEmpty(stationRoute.getCenterPointWkt())) {
  247 + centerPoint(stationRoute);
  248 + }
  249 +
244 // 多边形缓冲区 250 // 多边形缓冲区
245 if ("d".equals(stationRoute.getShapedType())) { 251 if ("d".equals(stationRoute.getShapedType())) {
246 bufferPolygon(stationRoute); 252 bufferPolygon(stationRoute);
247 } 253 }
248 254
249 - try {  
250 - logger.error(new ObjectMapper().writeValueAsString(stationRoute));  
251 - } catch (JsonProcessingException e) {  
252 - throw new RuntimeException(e);  
253 - }  
254 lsStationRouteRepository.updateStatiouRouteCode(stationRoute); 255 lsStationRouteRepository.updateStatiouRouteCode(stationRoute);
255 CustomBeanUtils.copyPropertiesIgnoredNull(stationRoute, stationRoute1); 256 CustomBeanUtils.copyPropertiesIgnoredNull(stationRoute, stationRoute1);
256 lsStationRouteRepository.save(stationRoute1); 257 lsStationRouteRepository.save(stationRoute1);
@@ -345,6 +346,17 @@ public class LsStationRouteServiceImpl extends BaseServiceImpl&lt;LsStationRoute, I @@ -345,6 +346,17 @@ public class LsStationRouteServiceImpl extends BaseServiceImpl&lt;LsStationRoute, I
345 } 346 }
346 } 347 }
347 348
  349 + protected void centerPoint(LsStationRoute route) {
  350 + // 中心点坐标信息
  351 + String wkt = route.getCenterPointWkt();
  352 + if (!StringUtils.isEmpty(wkt)) {
  353 + org.geolatte.geom.Point baidu = (org.geolatte.geom.Point) Wkt.fromWkt(wkt);
  354 + org.geolatte.geom.Point wgs = GeoConverter.pointBd2wgs(wkt);
  355 + route.setCenterPoint(baidu);
  356 + route.setCenterPointWgs(wgs);
  357 + }
  358 + }
  359 +
348 protected void bufferPolygon(LsStationRoute stationRoute) { 360 protected void bufferPolygon(LsStationRoute stationRoute) {
349 String wkt = stationRoute.getBufferPolygonWkt(); 361 String wkt = stationRoute.getBufferPolygonWkt();
350 if (!StringUtils.isEmpty(wkt)) { 362 if (!StringUtils.isEmpty(wkt)) {
src/main/resources/static/pages/base/carpark/edit.html
1 -<!-- 编辑停车场 -->  
2 -<div class="modal fade" id="editPoitsions_carpark_mobal" tabindex="-1" role="basic" aria-hidden="true">  
3 - <div class="modal-dialog">  
4 - <div class="modal-content">  
5 - <div class="modal-header">  
6 - <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>  
7 - <h4 class="modal-title">编辑停车场</h4>  
8 - </div>  
9 - <div class="modal-body">  
10 -  
11 - <form class="form-horizontal" role="form" id="edit_carPark_form" action="/module" method="post">  
12 -  
13 - <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button>  
14 - 您的输入有误,请检查下面的输入项  
15 - </div>  
16 - <input type="hidden" name="id" id="idInput" />  
17 - <input type="hidden" name="bParkPoint" id="bParkPointInput" />  
18 - <input type="hidden" name="gParkPoint" id="gParkPointInput" />  
19 - <input type="hidden" name="dbType" id="dbTypeInput" value="b"/>  
20 - <!-- 停车场名称 -->  
21 - <div class="form-body">  
22 - <div class="form-group">  
23 - <label class="control-label col-md-3">  
24 - <span class="required"> * </span> 停车场名称&nbsp;&nbsp;&nbsp; :  
25 - </label>  
26 - <div class="col-md-6">  
27 - <input type="text" class="form-control" name="parkName" id="parkNameInput" placeholder="请输入停车场名称">  
28 - </div>  
29 - </div>  
30 - </div>  
31 - <!-- 停车场编码 -->  
32 - <div class="form-body">  
33 - <div class="form-group">  
34 - <label class="control-label col-md-3">  
35 - <span class="required"> * </span>停车场编码&nbsp;&nbsp;&nbsp;:  
36 - </label>  
37 - <div class="col-md-6">  
38 - <input type="text" class="form-control" name="parkCode" id="parkCodeInput" readonly="readonly" placeholder="请输入停车场编码">  
39 - </div>  
40 - </div>  
41 - </div>  
42 - <!-- 经纬度坐标点 -->  
43 - <div class="form-body">  
44 - <div class="form-group">  
45 - <label class="col-md-3 control-label"><span class="required"> * </span>经纬度坐标点:</label>  
46 - <div class="col-md-6">  
47 - <input type="text" class="form-control" name="bCenterPoint" id="bCenterPointInput" readonly="readonly" placeholder="请输入经纬度坐标点">  
48 - </div>  
49 - </div>  
50 - </div>  
51 -  
52 - <!-- 几何图形类型 -->  
53 - <div class="form-body">  
54 - <div class="form-group">  
55 - <label class="col-md-3 control-label"><span class="required"> * </span>几何图形类型:</label>  
56 - <div class="col-md-6">  
57 - <input type="text" class="form-control" name="shapesType" id="shapesTypeSelect" readonly="readonly" placeholder="请输入几何图形类型">  
58 - </div>  
59 - </div>  
60 - </div>  
61 -  
62 - <!-- 圆形半径 -->  
63 - <div class="form-body" id="radiusGroup">  
64 - <div class="form-group">  
65 - <label class="col-md-3 control-label"><span class="required"> * </span>圆形半径&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>  
66 - <div class="col-md-6">  
67 - <input type="text" class="form-control" name="radius" id="radiusInput" placeholder="请输入圆形半径">  
68 - </div>  
69 - </div>  
70 - </div>  
71 - <!-- 是否撤销 -->  
72 - <div class="form-body">  
73 - <div class="form-group">  
74 - <label class="col-md-3 control-label"><span class="required"> * </span>是否撤销&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>  
75 - <div class="col-md-6">  
76 - <select name="destroy" class="form-control" id="destroySelect">  
77 - <option value="">-- 请选择撤销类型 --</option>  
78 - <option value="0">否</option>  
79 - <option value="1">是</option>  
80 - </select>  
81 - </div>  
82 - </div>  
83 - </div>  
84 - <!-- 面积 -->  
85 - <div class="form-body">  
86 - <div class="form-group">  
87 - <label class="col-md-3 control-label">面积&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>  
88 - <div class="col-md-6">  
89 - <input type="text" class="form-control" name="area" id="areaInput" >  
90 - <span class="help-block">单位:平方米(㎡)</span>  
91 - </div>  
92 - </div>  
93 - </div>  
94 -  
95 - <!-- 所属公司 -->  
96 - <div class="form-body">  
97 - <div class="form-group">  
98 - <label class="col-md-3 control-label">所属公司&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>  
99 - <div class="col-md-6">  
100 - <select name="company" class="form-control" style="width:100%" id="companySelect">  
101 -  
102 - </select>  
103 - </div>  
104 - </div>  
105 - </div>  
106 -  
107 - <!-- 所属分公司 -->  
108 - <div class="form-body">  
109 - <div class="form-group">  
110 - <label class="col-md-3 control-label">所属分公司&nbsp;&nbsp;&nbsp;:</label>  
111 - <div class="col-md-6">  
112 - <select name="brancheCompany" class="form-control" style="width:100%" id="brancheCompanySelect">  
113 - </select>  
114 - </div>  
115 - </div>  
116 - </div>  
117 -  
118 - <!-- 版本号 -->  
119 - <div class="form-body">  
120 - <div class="form-group">  
121 - <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>  
122 - <div class="col-md-6">  
123 - <input type="text" class="form-control" name="versions" value='1' Readonly placeholder="请输入版本号">  
124 - </div>  
125 - </div>  
126 - </div>  
127 -  
128 - <!-- 描述/说明 -->  
129 - <div class="form-group">  
130 - <label class="control-label col-md-3"> 描述/说明&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>  
131 - <div class="col-md-6">  
132 - <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="请输入描述/说明"></textarea>  
133 - </div>  
134 - </div>  
135 - </form>  
136 - </div>  
137 - <div class="modal-footer">  
138 - <button type="button" class="btn default" data-dismiss="modal">取消</button>  
139 - <button type="button" class="btn btn-primary" id="editStationButton">提交数据</button>  
140 - </div>  
141 - </div>  
142 - </div>  
143 -</div>  
144 -<script type="text/javascript">  
145 -  
146 -$('#editPoitsions_carpark_mobal').on('editCarParkMobal_show', function(e, map,fun,carP,ajaxd){  
147 - /** 获取停车场信息对象 */  
148 - var CarParkObj = carP.getEitdCarPark();  
149 - // 获取修改停车场对象ID  
150 - var carParkId = CarParkObj.carParkId;  
151 - /** 根据修改停车场对象属性值 设值表单元素 @paran:<CarParkObj:停车场对象>*/  
152 - fun.setFormValue(CarParkObj);  
153 - /** 填充公司下拉框 */  
154 - fun.selectTemp(function() {  
155 - // 获取公司代码  
156 - var businessCode = CarParkObj.carParkCompany;  
157 - // 获取公司元素并设值  
158 - $('#companySelect').val(businessCode);  
159 - /** 填充分公司下拉框 @param:<businessCode:公司代码> */  
160 - fun.getbrancheCompanyValues(businessCode,function() {  
161 - // 获取分公司元素并设值  
162 - $('#brancheCompanySelect').val(CarParkObj.carParkBrancheCompany);  
163 - });  
164 - });  
165 - // 公司值改变事件  
166 - $('#companySelect').on('change',companySelectChangeSetBrancheValue);  
167 - function companySelectChangeSetBrancheValue() {  
168 - // 获取公司下拉框选择值  
169 - var businessCode = $('#companySelect').val();  
170 - // 分公司下拉框options属性值  
171 - var options = '<option value="">-- 请选择分公司 --</option>';  
172 - // 如果公司选择为空则分公司为空 ; 否则查询出所属公司下的分公司名称和相应分公司代码  
173 - if(businessCode == null || businessCode ==''){  
174 - // 填充分公司下拉框options  
175 - $('#brancheCompanySelect').html(options);  
176 - } else {  
177 - // 查询出所属公司下的分公司名称和相应分公司代码  
178 - $get('/business/all', {upCode_eq: businessCode}, function(array){  
179 - // 遍历array  
180 - $.each(array, function(i,d){  
181 - options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>';  
182 - });  
183 - // 填充分公司下拉框options  
184 - $('#brancheCompanySelect').html(options);  
185 - });  
186 - }  
187 - }  
188 - // 显示mobal  
189 - $('#editPoitsions_carpark_mobal').modal({show : true,backdrop: 'static',keyboard: false});  
190 - // 当调用 hide 实例方法时触发  
191 - $('#editPoitsions_carpark_mobal').on('hide.bs.modal', function () {  
192 - clearSechear();  
193 - });  
194 - function clearSechear(){  
195 - map.clearMarkAndOverlays();  
196 - carP.setEitdCarPark({});  
197 - fun.initCarPark(carParkId);  
198 - }  
199 - // 编辑表单元素  
200 - var form = $('#edit_carPark_form');  
201 - // 获取错误提示元素  
202 - var error = $('.alert-danger', form);  
203 - // 提交数据按钮事件  
204 - $('#editStationButton').on('click', function() {  
205 - // 表单提交  
206 - form.submit();  
207 - });  
208 - // 表单验证  
209 - form.validate({  
210 -  
211 - errorElement : 'span',  
212 -  
213 - errorClass : 'help-block help-block-error',  
214 -  
215 - focusInvalid : false,  
216 -  
217 - rules : {  
218 - 'parkName' : {required : true,},// 停车场名称 必填项  
219 - 'parkCode' : {required : true},// 停车场编码 必填项  
220 - 'bCenterPoint' : {required : true,},// 经纬度坐标点 必填项  
221 - 'shapesType' : {required : true,},// 几何图形类型 必填项  
222 - 'radius' : {required : true,digits:true},// 圆形半径 必填项  
223 - 'destroy' : {required : true,},// 是否撤销 必填项  
224 - 'area' : {number:true,},// 面积 数字  
225 - 'descriptions' : {maxlength: 200,},// 描述/说明 最大长度200  
226 - },  
227 - invalidHandler : function(event, validator) {  
228 - error.show();  
229 - App.scrollTo(error, -200);  
230 - },  
231 - highlight : function(element) {  
232 - $(element).closest('.form-group').addClass('has-error');  
233 - },  
234 - unhighlight : function(element) {  
235 - $(element).closest('.form-group').removeClass('has-error');  
236 - },  
237 - success : function(label) {  
238 - label.closest('.form-group').removeClass('has-error');  
239 - },  
240 - submitHandler : function(f) {  
241 - var params = form.serializeJSON();  
242 - params.createBy = CarParkObj.carParkCreateBy;  
243 - // 定义日期格式  
244 - var fs = 'YYYY-MM-DD HH:mm:ss'  
245 - // 设置日期  
246 - params.createDate = moment(CarParkObj.carParkCreateDate).format(fs);  
247 - error.hide();  
248 - if(params.shapesType=='多边形')  
249 - params.shapesType = 'd';  
250 - else if(params.shapesType=='圆形')  
251 - params.shapesType=='r';  
252 - ajaxd.carParkUpdate(params,function(resuntDate) {  
253 - if(resuntDate.status=='SUCCESS') {  
254 - // 弹出添加成功提示消息  
255 - layer.msg('修改成功...');  
256 - }else {  
257 - // 弹出添加失败提示消息  
258 - layer.msg('修改失败...');  
259 - }  
260 - clearSechear();  
261 - $('#editPoitsions_carpark_mobal').modal('hide');  
262 - })  
263 - }  
264 - }); 1 +<!-- 编辑停车场 -->
  2 +<div class="modal fade" id="editPoitsions_carpark_mobal" tabindex="-1" role="basic" aria-hidden="true">
  3 + <div class="modal-dialog">
  4 + <div class="modal-content">
  5 + <div class="modal-header">
  6 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
  7 + <h4 class="modal-title">编辑停车场</h4>
  8 + </div>
  9 + <div class="modal-body">
  10 +
  11 + <form class="form-horizontal" role="form" id="edit_carPark_form" action="/module" method="post">
  12 +
  13 + <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button>
  14 + 您的输入有误,请检查下面的输入项
  15 + </div>
  16 + <input type="hidden" name="id" id="idInput" />
  17 + <input type="hidden" name="bParkPoint" id="bParkPointInput" />
  18 + <input type="hidden" name="gParkPoint" id="gParkPointInput" />
  19 + <input type="hidden" name="createBy" value="35" />
  20 + <input type="hidden" name="dbType" id="dbTypeInput" value="b"/>
  21 + <!-- 停车场名称 -->
  22 + <div class="form-body">
  23 + <div class="form-group">
  24 + <label class="control-label col-md-3">
  25 + <span class="required"> * </span> 停车场名称&nbsp;&nbsp;&nbsp; :
  26 + </label>
  27 + <div class="col-md-6">
  28 + <input type="text" class="form-control" name="parkName" id="parkNameInput" placeholder="请输入停车场名称">
  29 + </div>
  30 + </div>
  31 + </div>
  32 + <!-- 停车场编码 -->
  33 + <div class="form-body">
  34 + <div class="form-group">
  35 + <label class="control-label col-md-3">
  36 + <span class="required"> * </span>停车场编码&nbsp;&nbsp;&nbsp;:
  37 + </label>
  38 + <div class="col-md-6">
  39 + <input type="text" class="form-control" name="parkCode" id="parkCodeInput" readonly="readonly" placeholder="请输入停车场编码">
  40 + </div>
  41 + </div>
  42 + </div>
  43 + <!-- 经纬度坐标点 -->
  44 + <div class="form-body">
  45 + <div class="form-group">
  46 + <label class="col-md-3 control-label"><span class="required"> * </span>经纬度坐标点:</label>
  47 + <div class="col-md-6">
  48 + <input type="text" class="form-control" name="bCenterPoint" id="bCenterPointInput" readonly="readonly" placeholder="请输入经纬度坐标点">
  49 + </div>
  50 + </div>
  51 + </div>
  52 +
  53 + <!-- 几何图形类型 -->
  54 + <div class="form-body">
  55 + <div class="form-group">
  56 + <label class="col-md-3 control-label"><span class="required"> * </span>几何图形类型:</label>
  57 + <div class="col-md-6">
  58 + <input type="text" class="form-control" name="shapesType" id="shapesTypeSelect" readonly="readonly" placeholder="请输入几何图形类型">
  59 + </div>
  60 + </div>
  61 + </div>
  62 +
  63 + <!-- 圆形半径 -->
  64 + <div class="form-body" id="radiusGroup">
  65 + <div class="form-group">
  66 + <label class="col-md-3 control-label"><span class="required"> * </span>圆形半径&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  67 + <div class="col-md-6">
  68 + <input type="text" class="form-control" name="radius" id="radiusInput" placeholder="请输入圆形半径">
  69 + </div>
  70 + </div>
  71 + </div>
  72 + <!-- 是否撤销 -->
  73 + <div class="form-body">
  74 + <div class="form-group">
  75 + <label class="col-md-3 control-label"><span class="required"> * </span>是否撤销&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  76 + <div class="col-md-6">
  77 + <select name="destroy" class="form-control" id="destroySelect">
  78 + <option value="">-- 请选择撤销类型 --</option>
  79 + <option value="0">否</option>
  80 + <option value="1">是</option>
  81 + </select>
  82 + </div>
  83 + </div>
  84 + </div>
  85 + <!-- 面积 -->
  86 + <div class="form-body">
  87 + <div class="form-group">
  88 + <label class="col-md-3 control-label">面积&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  89 + <div class="col-md-6">
  90 + <input type="text" class="form-control" name="area" id="areaInput" >
  91 + <span class="help-block">单位:平方米(㎡)</span>
  92 + </div>
  93 + </div>
  94 + </div>
  95 +
  96 + <!-- 所属公司 -->
  97 + <div class="form-body">
  98 + <div class="form-group">
  99 + <label class="col-md-3 control-label">所属公司&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  100 + <div class="col-md-6">
  101 + <select name="company" class="form-control" style="width:100%" id="companySelect">
  102 +
  103 + </select>
  104 + </div>
  105 + </div>
  106 + </div>
  107 +
  108 + <!-- 所属分公司 -->
  109 + <div class="form-body">
  110 + <div class="form-group">
  111 + <label class="col-md-3 control-label">所属分公司&nbsp;&nbsp;&nbsp;:</label>
  112 + <div class="col-md-6">
  113 + <select name="brancheCompany" class="form-control" style="width:100%" id="brancheCompanySelect">
  114 + </select>
  115 + </div>
  116 + </div>
  117 + </div>
  118 +
  119 + <!-- 版本号 -->
  120 + <div class="form-body">
  121 + <div class="form-group">
  122 + <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  123 + <div class="col-md-6">
  124 + <input type="text" class="form-control" name="versions" value='1' Readonly placeholder="请输入版本号">
  125 + </div>
  126 + </div>
  127 + </div>
  128 +
  129 + <!-- 描述/说明 -->
  130 + <div class="form-group">
  131 + <label class="control-label col-md-3"> 描述/说明&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  132 + <div class="col-md-6">
  133 + <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="请输入描述/说明"></textarea>
  134 + </div>
  135 + </div>
  136 + </form>
  137 + </div>
  138 + <div class="modal-footer">
  139 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
  140 + <button type="button" class="btn btn-primary" id="editStationButton">提交数据</button>
  141 + </div>
  142 + </div>
  143 + </div>
  144 +</div>
  145 +<script type="text/javascript">
  146 +
  147 +$('#editPoitsions_carpark_mobal').on('editCarParkMobal_show', function(e, map,fun,carP,ajaxd){
  148 + /** 获取停车场信息对象 */
  149 + var CarParkObj = carP.getEitdCarPark();
  150 + // 获取修改停车场对象ID
  151 + var carParkId = CarParkObj.carParkId;
  152 + /** 根据修改停车场对象属性值 设值表单元素 @paran:<CarParkObj:停车场对象>*/
  153 + fun.setFormValue(CarParkObj);
  154 + /** 填充公司下拉框 */
  155 + fun.selectTemp(function() {
  156 + // 获取公司代码
  157 + var businessCode = CarParkObj.carParkCompany;
  158 + // 获取公司元素并设值
  159 + $('#companySelect').val(businessCode);
  160 + /** 填充分公司下拉框 @param:<businessCode:公司代码> */
  161 + fun.getbrancheCompanyValues(businessCode,function() {
  162 + // 获取分公司元素并设值
  163 + $('#brancheCompanySelect').val(CarParkObj.carParkBrancheCompany);
  164 + });
  165 + });
  166 + // 公司值改变事件
  167 + $('#companySelect').on('change',companySelectChangeSetBrancheValue);
  168 + function companySelectChangeSetBrancheValue() {
  169 + // 获取公司下拉框选择值
  170 + var businessCode = $('#companySelect').val();
  171 + // 分公司下拉框options属性值
  172 + var options = '<option value="">-- 请选择分公司 --</option>';
  173 + // 如果公司选择为空则分公司为空 ; 否则查询出所属公司下的分公司名称和相应分公司代码
  174 + if(businessCode == null || businessCode ==''){
  175 + // 填充分公司下拉框options
  176 + $('#brancheCompanySelect').html(options);
  177 + } else {
  178 + // 查询出所属公司下的分公司名称和相应分公司代码
  179 + $get('/business/all', {upCode_eq: businessCode}, function(array){
  180 + // 遍历array
  181 + $.each(array, function(i,d){
  182 + options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>';
  183 + });
  184 + // 填充分公司下拉框options
  185 + $('#brancheCompanySelect').html(options);
  186 + });
  187 + }
  188 + }
  189 + // 显示mobal
  190 + $('#editPoitsions_carpark_mobal').modal({show : true,backdrop: 'static',keyboard: false});
  191 + // 当调用 hide 实例方法时触发
  192 + $('#editPoitsions_carpark_mobal').on('hide.bs.modal', function () {
  193 + clearSechear();
  194 + });
  195 + function clearSechear(){
  196 + map.clearMarkAndOverlays();
  197 + carP.setEitdCarPark({});
  198 + fun.initCarPark(carParkId);
  199 + }
  200 + // 编辑表单元素
  201 + var form = $('#edit_carPark_form');
  202 + // 获取错误提示元素
  203 + var error = $('.alert-danger', form);
  204 + // 提交数据按钮事件
  205 + $('#editStationButton').on('click', function() {
  206 + // 表单提交
  207 + form.submit();
  208 + });
  209 + // 表单验证
  210 + form.validate({
  211 +
  212 + errorElement : 'span',
  213 +
  214 + errorClass : 'help-block help-block-error',
  215 +
  216 + focusInvalid : false,
  217 +
  218 + rules : {
  219 + 'parkName' : {required : true,},// 停车场名称 必填项
  220 + 'parkCode' : {required : true},// 停车场编码 必填项
  221 + 'bCenterPoint' : {required : true,},// 经纬度坐标点 必填项
  222 + 'shapesType' : {required : true,},// 几何图形类型 必填项
  223 + 'radius' : {required : true,digits:true},// 圆形半径 必填项
  224 + 'destroy' : {required : true,},// 是否撤销 必填项
  225 + 'area' : {number:true,},// 面积 数字
  226 + 'descriptions' : {maxlength: 200,},// 描述/说明 最大长度200
  227 + },
  228 + invalidHandler : function(event, validator) {
  229 + error.show();
  230 + App.scrollTo(error, -200);
  231 + },
  232 + highlight : function(element) {
  233 + $(element).closest('.form-group').addClass('has-error');
  234 + },
  235 + unhighlight : function(element) {
  236 + $(element).closest('.form-group').removeClass('has-error');
  237 + },
  238 + success : function(label) {
  239 + label.closest('.form-group').removeClass('has-error');
  240 + },
  241 + submitHandler : function(f) {
  242 + var params = form.serializeJSON();
  243 + params.createBy = CarParkObj.carParkCreateBy;
  244 + // 定义日期格式
  245 + var fs = 'YYYY-MM-DD HH:mm:ss'
  246 + // 设置日期
  247 + params.createDate = moment(CarParkObj.carParkCreateDate).format(fs);
  248 + error.hide();
  249 + if(params.shapesType=='多边形')
  250 + params.shapesType = 'd';
  251 + else if(params.shapesType=='圆形')
  252 + params.shapesType=='r';
  253 + ajaxd.carParkUpdate(params,function(resuntDate) {
  254 + if(resuntDate.status=='SUCCESS') {
  255 + // 弹出添加成功提示消息
  256 + layer.msg('修改成功...');
  257 + }else {
  258 + // 弹出添加失败提示消息
  259 + layer.msg('修改失败...');
  260 + }
  261 + clearSechear();
  262 + $('#editPoitsions_carpark_mobal').modal('hide');
  263 + })
  264 + }
  265 + });
265 }); 266 });
266 </script> 267 </script>
267 \ No newline at end of file 268 \ No newline at end of file
src/main/resources/static/pages/base/section/js/section-operation.js
@@ -93,8 +93,8 @@ var SectionOperation = function () { @@ -93,8 +93,8 @@ var SectionOperation = function () {
93 html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">南北向:');html.push((section.snDirection === undefined ? '' : section.snDirection == 0 ? '南->北' : '北->南'));html.push('</span>'); 93 html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">南北向:');html.push((section.snDirection === undefined ? '' : section.snDirection == 0 ? '南->北' : '北->南'));html.push('</span>');
94 html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">路段限速:');html.push(section.speedLimit);html.push('</span>'); 94 html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">路段限速:');html.push(section.speedLimit);html.push('</span>');
95 html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">路段长度:');html.push(section.sectionDistance);html.push('</span>'); 95 html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">路段长度:');html.push(section.sectionDistance);html.push('</span>');
96 - html.push('<button class="info_win_btn" onclick="SectionOperation.editSection(');html.push(section.id);html.push(');">修改路段信息</button>');  
97 - html.push('<button class="info_win_btn" onclick="SectionOperation.editPolyline(');html.push(section.id);html.push(');">移动路段位置</button>'); 96 + html.push('<button id="editSectionInfo" class="info_win_btn">修改路段信息</button>');
  97 + html.push('<button id="movePolyline" class="info_win_btn">移动路段位置</button>');
98 98
99 var infoWindow = new BMap.InfoWindow(html.join(''), opts); 99 var infoWindow = new BMap.InfoWindow(html.join(''), opts);
100 var icon = new BMap.Icon('/pages/base/stationroute/css/img/blank.gif', new BMap.Size(20, 20)); 100 var icon = new BMap.Icon('/pages/base/stationroute/css/img/blank.gif', new BMap.Size(20, 20));
@@ -110,6 +110,12 @@ var SectionOperation = function () { @@ -110,6 +110,12 @@ var SectionOperation = function () {
110 map.addOverlay(marker); 110 map.addOverlay(marker);
111 marker.setPosition(path[Math.ceil(path.length / 2)]); 111 marker.setPosition(path[Math.ceil(path.length / 2)]);
112 marker.openInfoWindow(infoWindow); 112 marker.openInfoWindow(infoWindow);
  113 + $('#editSectionInfo').on('click', function() {
  114 + operation.editSection(section.id);
  115 + });
  116 + $('#movePolyline').on('click', function() {
  117 + operation.editPolyline(section.id);
  118 + });
113 }); 119 });
114 }, 120 },
115 editPolyline : function(sectionId) { 121 editPolyline : function(sectionId) {
src/main/resources/static/pages/base/station/js/station-positions-function.js
@@ -24,8 +24,8 @@ var PositionsPublicFunctions = function () { @@ -24,8 +24,8 @@ var PositionsPublicFunctions = function () {
24 html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">南北向:');html.push(station.snDirection === undefined ? '' : station.snDirection == 0 ? '南->北' : '北->南');html.push('</span>'); 24 html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">南北向:');html.push(station.snDirection === undefined ? '' : station.snDirection == 0 ? '南->北' : '北->南');html.push('</span>');
25 html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">路段编码:');html.push(station.roadCoding ? station.roadCoding : '');html.push('</span>'); 25 html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">路段编码:');html.push(station.roadCoding ? station.roadCoding : '');html.push('</span>');
26 html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">地址:');html.push(station.address);html.push('</span>'); 26 html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">地址:');html.push(station.address);html.push('</span>');
27 - html.push('<button class="info_win_btn" onclick="StationPositionsWorldsBMap.editStation(');html.push(station.id);html.push(');">修改站点信息</button>');  
28 - html.push('<button class="info_win_btn" onclick="StationPositionsWorldsBMap.setDragEnable(true);">移动中心点</button>'); 27 + html.push('<button id="editStationInfo" class="info_win_btn">修改站点信息</button>');
  28 + html.push('<button id="moveCenterPoint" class="info_win_btn">移动中心点</button>');
29 // 信息窗口参数属性 29 // 信息窗口参数属性
30 var opts = { 30 var opts = {
31 // 信息窗口宽度 31 // 信息窗口宽度
src/main/resources/static/pages/base/station/js/station-positions-map.js
@@ -67,6 +67,12 @@ var StationPositionsWorldsBMap = function () { @@ -67,6 +67,12 @@ var StationPositionsWorldsBMap = function () {
67 marker.addEventListener("click",function() { 67 marker.addEventListener("click",function() {
68 //开启信息窗口 68 //开启信息窗口
69 marker.openInfoWindow(infoWindow, station.point); 69 marker.openInfoWindow(infoWindow, station.point);
  70 + $('#editStationInfo').on('click', function() {
  71 + StationPositionsWorldsBMap.editStation(station.id);
  72 + });
  73 + $('#moveCenterPoint').on('click', function() {
  74 + StationPositionsWorldsBMap.setDragEnable(true);
  75 + });
70 }); 76 });
71 }, 77 },
72 // 定位 78 // 定位
src/main/resources/static/pages/base/stationroute/js/routes-operation.js
@@ -405,7 +405,8 @@ var RoutesOperation = (function () { @@ -405,7 +405,8 @@ var RoutesOperation = (function () {
405 405
406 if(status > 0){ 406 if(status > 0){
407 htm += '<div>' + 407 htm += '<div>' +
408 - '<button class="info_win_btn" id="editStation" onclick="RoutesOperation.editStation(' + stationRoute.id+','+stationRoute.directions + ')">修改</button>' + 408 + '<button class="info_win_btn" onclick="RoutesOperation.editCenterPoint(' + stationRoute.id+','+stationRoute.directions + ')">站级中心点</button>' +
  409 + '<button class="info_win_btn" onclick="RoutesOperation.editStation(' + stationRoute.id+','+stationRoute.directions + ')">修改</button>' +
409 '<button class="info_win_btn" onclick="RoutesOperation.destroyStation('+ stationRoute.id + ','+stationRoute.line.id+','+stationRoute.directions+')">撤销</button>' + 410 '<button class="info_win_btn" onclick="RoutesOperation.destroyStation('+ stationRoute.id + ','+stationRoute.line.id+','+stationRoute.directions+')">撤销</button>' +
410 '<button class="info_win_btn" id="addBetweenStationRoad" onclick="RoutesOperation.addBetweenStationRoad(' + stationRoute.id + ')">添加站点间路段</button>' + 411 '<button class="info_win_btn" id="addBetweenStationRoad" onclick="RoutesOperation.addBetweenStationRoad(' + stationRoute.id + ')">添加站点间路段</button>' +
411 '</div>'; 412 '</div>';
@@ -890,6 +891,37 @@ var RoutesOperation = (function () { @@ -890,6 +891,37 @@ var RoutesOperation = (function () {
890 }); 891 });
891 busline.getBusList(lineName); 892 busline.getBusList(lineName);
892 }, 893 },
  894 +
  895 + /**
  896 + * 移动站级中心点
  897 + * @param stationRouteId
  898 + */
  899 + editCenterPoint: function (stationRouteId) {
  900 + jQuery.extend(true, editStationRoute, stationArray[stationRouteId]);
  901 + var centerPointWkt = editStationRoute.centerPointWkt;
  902 + if (!centerPointWkt) {
  903 + centerPointWkt = editStationRoute.station.centerPointWkt;
  904 + }
  905 + centerPointWkt = centerPointWkt.substring(6, centerPointWkt.length - 1);
  906 + var coordindates = centerPointWkt.split(" ")
  907 + var marker = new BMap.Marker(new BMap.Point(coordindates[0], coordindates[1]), {enableDragging: true});
  908 + operation.clearMarkAndOverlays();
  909 + baiduMap.addOverlay(marker);
  910 + marker.setTop(true);
  911 + marker.addEventListener('rightclick', operation.confirmCenterPoint);
  912 + layer.msg('拖动站点至相应位置,然后右击确定中心点!');
  913 + },
  914 +
  915 + confirmCenterPoint: function(event) {
  916 + var marker = event.target, point = marker.point, centerPointWkt = 'POINT(' + point.lng + ' ' + point.lat + ')';
  917 + marker.removeEventListener('rightclick', operation.confirmCenterPoint);
  918 + RoutesService.modifyStationRoute({id: editStationRoute.id, 'line.id': lineId, versions: versions, 'station.id': editStationRoute.station.id, centerPointWkt: centerPointWkt}, function() {
  919 + stationArray[editStationRoute.id].centerPointWkt = centerPointWkt;
  920 + layer.msg('站级中心点设置成功!');
  921 + RoutesOperation.resjtreeDate(lineId, directions, versions);
  922 + })
  923 + },
  924 +
893 /** 925 /**
894 * 编辑站点路由 926 * 编辑站点路由
895 * @param stationRouteId 927 * @param stationRouteId