Commit f3a485b31b2d2939cc61a1820c406a9c60df5e4d
1 parent
f7c126c5
update...
Showing
7 changed files
with
100 additions
and
15 deletions
src/main/java/com/bsth/service/geo_data/impl/GeoDataServiceImpl.java
| @@ -47,7 +47,7 @@ public class GeoDataServiceImpl implements GeoDataService { | @@ -47,7 +47,7 @@ public class GeoDataServiceImpl implements GeoDataService { | ||
| 47 | Map<String, Object> map = new HashMap(); | 47 | Map<String, Object> map = new HashMap(); |
| 48 | try { | 48 | try { |
| 49 | 49 | ||
| 50 | - String sql = "select DISTINCT versions from bsth_c_stationroute where line=" + lineCode + " and destroy=0"; | 50 | + String sql = "select versions from bsth_c_line_versions where line='"+lineCode+"' and status=1"; |
| 51 | //当前使用的线路版本 | 51 | //当前使用的线路版本 |
| 52 | Integer currentVersion = jdbcTemplate.queryForObject(sql, Integer.class); | 52 | Integer currentVersion = jdbcTemplate.queryForObject(sql, Integer.class); |
| 53 | 53 | ||
| @@ -67,6 +67,7 @@ public class GeoDataServiceImpl implements GeoDataService { | @@ -67,6 +67,7 @@ public class GeoDataServiceImpl implements GeoDataService { | ||
| 67 | map.put("status", ResponseCode.SUCCESS); | 67 | map.put("status", ResponseCode.SUCCESS); |
| 68 | map.put("list", list); | 68 | map.put("list", list); |
| 69 | map.put("currentVersion", currentVersion); | 69 | map.put("currentVersion", currentVersion); |
| 70 | + map.put("editVersion", version); | ||
| 70 | } catch (Exception e) { | 71 | } catch (Exception e) { |
| 71 | logger.error("", e); | 72 | logger.error("", e); |
| 72 | map.put("status", ResponseCode.ERROR); | 73 | map.put("status", ResponseCode.ERROR); |
| @@ -80,7 +81,7 @@ public class GeoDataServiceImpl implements GeoDataService { | @@ -80,7 +81,7 @@ public class GeoDataServiceImpl implements GeoDataService { | ||
| 80 | Map<String, Object> map = new HashMap(); | 81 | Map<String, Object> map = new HashMap(); |
| 81 | try { | 82 | try { |
| 82 | 83 | ||
| 83 | - String sql = "select DISTINCT versions from bsth_c_stationroute where line=" + lineCode + " and destroy=0"; | 84 | + String sql = "select versions from bsth_c_line_versions where line='"+lineCode+"' and status=1"; |
| 84 | //当前使用的线路版本 | 85 | //当前使用的线路版本 |
| 85 | Integer currentVersion = jdbcTemplate.queryForObject(sql, Integer.class); | 86 | Integer currentVersion = jdbcTemplate.queryForObject(sql, Integer.class); |
| 86 | 87 | ||
| @@ -419,6 +420,13 @@ public class GeoDataServiceImpl implements GeoDataService { | @@ -419,6 +420,13 @@ public class GeoDataServiceImpl implements GeoDataService { | ||
| 419 | def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); | 420 | def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); |
| 420 | TransactionStatus status = tran.getTransaction(def); | 421 | TransactionStatus status = tran.getTransaction(def); |
| 421 | try{ | 422 | try{ |
| 423 | + int versionCount = jdbcTemplate.queryForObject("select count(*) from bsth_c_line_versions where line_code='"+lineCode+"'", Integer.class); | ||
| 424 | + if(versionCount == 1){ | ||
| 425 | + rs.put("status", ResponseCode.ERROR); | ||
| 426 | + rs.put("msg", "线路至少要保留一个走向版本!"); | ||
| 427 | + return rs; | ||
| 428 | + } | ||
| 429 | + | ||
| 422 | /* //要删除的站点ID(未被其他线路、版本引用的) | 430 | /* //要删除的站点ID(未被其他线路、版本引用的) |
| 423 | String sql = "select DISTINCT station from bsth_c_ls_stationroute where line_code='"+lineCode+"' and versions="+version+" and station not in(" + | 431 | String sql = "select DISTINCT station from bsth_c_ls_stationroute where line_code='"+lineCode+"' and versions="+version+" and station not in(" + |
| 424 | "select station from bsth_c_ls_stationroute where (line!='"+lineCode+"' or versions!="+version+") and station in (" + | 432 | "select station from bsth_c_ls_stationroute where (line!='"+lineCode+"' or versions!="+version+") and station in (" + |
| @@ -644,8 +652,10 @@ public class GeoDataServiceImpl implements GeoDataService { | @@ -644,8 +652,10 @@ public class GeoDataServiceImpl implements GeoDataService { | ||
| 644 | for (int i = 0, size = routes.size(); i < size; i++) { | 652 | for (int i = 0, size = routes.size(); i < size; i++) { |
| 645 | routes.get(i).setStationMark("Z"); | 653 | routes.get(i).setStationMark("Z"); |
| 646 | } | 654 | } |
| 647 | - routes.get(0).setStationMark("B"); | ||
| 648 | - routes.get(routes.size() - 1).setStationMark("E"); | 655 | + if(routes.size() > 1){ |
| 656 | + routes.get(0).setStationMark("B"); | ||
| 657 | + routes.get(routes.size() - 1).setStationMark("E"); | ||
| 658 | + } | ||
| 649 | 659 | ||
| 650 | final List<SaveStationRouteDTO> saveList = routes; | 660 | final List<SaveStationRouteDTO> saveList = routes; |
| 651 | //insert 新路由 (ID自增) | 661 | //insert 新路由 (ID自增) |
src/main/resources/static/pages/base/geo_data_edit/css/mian.css
| @@ -627,4 +627,33 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root { | @@ -627,4 +627,33 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root { | ||
| 627 | 627 | ||
| 628 | .rt_show_version_txt{ | 628 | .rt_show_version_txt{ |
| 629 | display: none; | 629 | display: none; |
| 630 | +} | ||
| 631 | + | ||
| 632 | +.add_station_icon{ | ||
| 633 | + width: 140px; | ||
| 634 | + border: 1px dashed #e2e2e2 !important; | ||
| 635 | + text-align: center; | ||
| 636 | + padding: 5px 0; | ||
| 637 | + margin-left: 57px; | ||
| 638 | + cursor: pointer; | ||
| 639 | +} | ||
| 640 | + | ||
| 641 | +.add_station_icon:hover{ | ||
| 642 | + border: 1px solid #e2e2e2; | ||
| 643 | +} | ||
| 644 | + | ||
| 645 | +.add_station_icon>span.uk-icon{ | ||
| 646 | + vertical-align: top; | ||
| 647 | + margin-top: 3px; | ||
| 648 | +} | ||
| 649 | + | ||
| 650 | +.add_station_icon>a{ | ||
| 651 | + color: grey !important; | ||
| 652 | + display: inline-block !important; | ||
| 653 | + width: auto !important; | ||
| 654 | + padding-left: 0 !important; | ||
| 655 | +} | ||
| 656 | + | ||
| 657 | +.road_route>ul.empty{ | ||
| 658 | + border-left: none; | ||
| 630 | } | 659 | } |
| 631 | \ No newline at end of file | 660 | \ No newline at end of file |
src/main/resources/static/pages/base/geo_data_edit/fragments/f_road_route.html
| 1 | <div> | 1 | <div> |
| 2 | <script id="geo_d_e_road_route-temp" type="text/html"> | 2 | <script id="geo_d_e_road_route-temp" type="text/html"> |
| 3 | - <ul class="uk-list"> | 3 | + <ul class="uk-list {{if list.length==0}}empty{{/if}}"> |
| 4 | {{each list as subArr i}} | 4 | {{each list as subArr i}} |
| 5 | <li class="r_r_item f_r_a" data-id="{{subArr[0].id}}" data-code="{{subArr[0].sectionCode}}"> | 5 | <li class="r_r_item f_r_a" data-id="{{subArr[0].id}}" data-code="{{subArr[0].sectionCode}}"> |
| 6 | <a data-code="{{subArr[0].sectionCode}}" data-updown="{{subArr[0].directions}}">{{subArr[0].sectionName}}<span class="sub_name">{{subArr[0].crosesRoad}}</span></a> | 6 | <a data-code="{{subArr[0].sectionCode}}" data-updown="{{subArr[0].directions}}">{{subArr[0].sectionName}}<span class="sub_name">{{subArr[0].crosesRoad}}</span></a> |
| @@ -17,6 +17,15 @@ | @@ -17,6 +17,15 @@ | ||
| 17 | {{/if}} | 17 | {{/if}} |
| 18 | </li> | 18 | </li> |
| 19 | {{/each}} | 19 | {{/each}} |
| 20 | + | ||
| 21 | + {{if list.length==0}} | ||
| 22 | + <li class="r_r_item"> | ||
| 23 | + <div class="add_station_icon"> | ||
| 24 | + <span uk-icon="icon: plus;ratio:.8"></span> | ||
| 25 | + <a data-updown="{{updown}}">添加路段</a> | ||
| 26 | + </div> | ||
| 27 | + </li> | ||
| 28 | + {{/if}} | ||
| 20 | </ul> | 29 | </ul> |
| 21 | </script> | 30 | </script> |
| 22 | 31 |
src/main/resources/static/pages/base/geo_data_edit/fragments/f_station_route.html
| @@ -10,6 +10,15 @@ | @@ -10,6 +10,15 @@ | ||
| 10 | <a data-code="{{s.stationCode}}" data-updown="{{s.directions}}">{{s.stationName}}</a> | 10 | <a data-code="{{s.stationCode}}" data-updown="{{s.directions}}">{{s.stationName}}</a> |
| 11 | </li> | 11 | </li> |
| 12 | {{/each}} | 12 | {{/each}} |
| 13 | + | ||
| 14 | + {{if list.length==0}} | ||
| 15 | + <li class="s_r_item"> | ||
| 16 | + <div class="add_station_icon"> | ||
| 17 | + <span uk-icon="icon: plus;ratio:.8"></span> | ||
| 18 | + <a data-updown="{{updown}}">添加站点</a> | ||
| 19 | + </div> | ||
| 20 | + </li> | ||
| 21 | + {{/if}} | ||
| 13 | </ul> | 22 | </ul> |
| 14 | </script> | 23 | </script> |
| 15 | 24 |
src/main/resources/static/pages/base/geo_data_edit/js/map.js
| @@ -44,7 +44,7 @@ var gb_ct_map = function () { | @@ -44,7 +44,7 @@ var gb_ct_map = function () { | ||
| 44 | stCtrl.setOffset(new BMap.Size(20, 20)); | 44 | stCtrl.setOffset(new BMap.Size(20, 20)); |
| 45 | map.addControl(stCtrl);//添加全景控件 | 45 | map.addControl(stCtrl);//添加全景控件 |
| 46 | 46 | ||
| 47 | - var roadPolylines = [], stationMarkers = []; | 47 | + var roadPolylines = {0:[],1:[]}, stationMarkers = {0:[],1:[]}; |
| 48 | var _render = function (cb) { | 48 | var _render = function (cb) { |
| 49 | //绘制路段 | 49 | //绘制路段 |
| 50 | _renderRoads(gb_road_route.getData()); | 50 | _renderRoads(gb_road_route.getData()); |
| @@ -55,8 +55,10 @@ var gb_ct_map = function () { | @@ -55,8 +55,10 @@ var gb_ct_map = function () { | ||
| 55 | 55 | ||
| 56 | //居中至上行中间站点 | 56 | //居中至上行中间站点 |
| 57 | if(!initFlag){ | 57 | if(!initFlag){ |
| 58 | - var cm = stationMarkers[0][parseInt(stationMarkers[0].length / 2)]; | ||
| 59 | - map.setCenter(cm.point); | 58 | + if(stationMarkers[0].length>0){ |
| 59 | + var cm = stationMarkers[0][parseInt(stationMarkers[0].length / 2)]; | ||
| 60 | + map.setCenter(cm.point); | ||
| 61 | + } | ||
| 60 | initFlag=true; | 62 | initFlag=true; |
| 61 | } | 63 | } |
| 62 | 64 | ||
| @@ -67,11 +69,15 @@ var gb_ct_map = function () { | @@ -67,11 +69,15 @@ var gb_ct_map = function () { | ||
| 67 | return updown == 0 ? 'blue' : 'red'; | 69 | return updown == 0 ? 'blue' : 'red'; |
| 68 | }; | 70 | }; |
| 69 | var _renderRoads = function (data) { | 71 | var _renderRoads = function (data) { |
| 72 | + if(data[0].length==0) | ||
| 73 | + return; | ||
| 70 | _renderPolyline(data[0], updownColor(0));//上行路段 | 74 | _renderPolyline(data[0], updownColor(0));//上行路段 |
| 71 | _renderPolyline(data[1], updownColor(1));//下行路段 | 75 | _renderPolyline(data[1], updownColor(1));//下行路段 |
| 72 | }; | 76 | }; |
| 73 | 77 | ||
| 74 | var _renderStation = function (data) { | 78 | var _renderStation = function (data) { |
| 79 | + if(data[0].length==0) | ||
| 80 | + return; | ||
| 75 | _renderStationMarket(data[0]);//上行站点 | 81 | _renderStationMarket(data[0]);//上行站点 |
| 76 | _renderStationMarket(data[1]);//下行站点 | 82 | _renderStationMarket(data[1]);//下行站点 |
| 77 | }; | 83 | }; |
src/main/resources/static/pages/base/geo_data_edit/js/road_route.js
| @@ -36,7 +36,10 @@ var gb_road_route = function () { | @@ -36,7 +36,10 @@ var gb_road_route = function () { | ||
| 36 | this.cp = geolib.getCenter(_pos); | 36 | this.cp = geolib.getCenter(_pos); |
| 37 | this.len = geolib.getPathLength(_pos); | 37 | this.len = geolib.getPathLength(_pos); |
| 38 | }); | 38 | }); |
| 39 | - ep.emit('data', gb_common.groupBy(rs.list, 'directions')); | 39 | + var data = {0:[],1:[]}; |
| 40 | + if(rs.list.length > 0) | ||
| 41 | + data = gb_common.groupBy(rs.list, 'directions'); | ||
| 42 | + ep.emit('data', data); | ||
| 40 | }); | 43 | }); |
| 41 | 44 | ||
| 42 | //加载模板片段 | 45 | //加载模板片段 |
src/main/resources/static/pages/base/geo_data_edit/js/station_route.js
| @@ -10,12 +10,11 @@ var gb_station_route = function () { | @@ -10,12 +10,11 @@ var gb_station_route = function () { | ||
| 10 | var ep = EventProxy.create("data", "temp", function (data, temp) { | 10 | var ep = EventProxy.create("data", "temp", function (data, temp) { |
| 11 | station_maps = data; | 11 | station_maps = data; |
| 12 | temps = temp; | 12 | temps = temp; |
| 13 | - //当前编辑的线路版本 | ||
| 14 | - storage.setItem("geo_data_edit_line_version" , data[0][0].versions); | 13 | + |
| 15 | //渲染页面 | 14 | //渲染页面 |
| 16 | - var upHtmlStr = temps['geo_d_e_station_route-temp']({list: station_maps[0]}); | 15 | + var upHtmlStr = temps['geo_d_e_station_route-temp']({list: station_maps[0],updown:0}); |
| 17 | $('.up_down_route_list>li:first>.station_route').html(upHtmlStr); | 16 | $('.up_down_route_list>li:first>.station_route').html(upHtmlStr); |
| 18 | - var downHtmlStr = temps['geo_d_e_station_route-temp']({list: station_maps[1]}); | 17 | + var downHtmlStr = temps['geo_d_e_station_route-temp']({list: station_maps[1],updown:1}); |
| 19 | $('.up_down_route_list>li:last>.station_route').html(downHtmlStr); | 18 | $('.up_down_route_list>li:last>.station_route').html(downHtmlStr); |
| 20 | 19 | ||
| 21 | cb && cb(); | 20 | cb && cb(); |
| @@ -30,7 +29,13 @@ var gb_station_route = function () { | @@ -30,7 +29,13 @@ var gb_station_route = function () { | ||
| 30 | 29 | ||
| 31 | //线路当前启用的线路版本 | 30 | //线路当前启用的线路版本 |
| 32 | storage.setItem("geo_data_enable_version" , rs['currentVersion']); | 31 | storage.setItem("geo_data_enable_version" , rs['currentVersion']); |
| 33 | - ep.emit('data', gb_common.groupBy(rs.list, 'directions')); | 32 | + //当前编辑的线路版本 |
| 33 | + storage.setItem("geo_data_edit_line_version" , rs['editVersion']); | ||
| 34 | + | ||
| 35 | + var data = {0:[],1:[]}; | ||
| 36 | + if(rs.list.length > 0) | ||
| 37 | + data = gb_common.groupBy(rs.list, 'directions'); | ||
| 38 | + ep.emit('data', data); | ||
| 34 | }); | 39 | }); |
| 35 | 40 | ||
| 36 | //加载模板片段 | 41 | //加载模板片段 |
| @@ -170,13 +175,14 @@ var gb_station_route = function () { | @@ -170,13 +175,14 @@ var gb_station_route = function () { | ||
| 170 | prev = $(that).prev(); | 175 | prev = $(that).prev(); |
| 171 | 176 | ||
| 172 | if(prev.length == 0) | 177 | if(prev.length == 0) |
| 173 | - return null; | 178 | + return []; |
| 174 | 179 | ||
| 175 | if(prev.hasClass(clazz)) | 180 | if(prev.hasClass(clazz)) |
| 176 | return prev; | 181 | return prev; |
| 177 | 182 | ||
| 178 | that = prev; | 183 | that = prev; |
| 179 | } | 184 | } |
| 185 | + return []; | ||
| 180 | }; | 186 | }; |
| 181 | 187 | ||
| 182 | /** | 188 | /** |
| @@ -246,6 +252,19 @@ var gb_station_route = function () { | @@ -246,6 +252,19 @@ var gb_station_route = function () { | ||
| 246 | } | 252 | } |
| 247 | }); | 253 | }); |
| 248 | 254 | ||
| 255 | + /** | ||
| 256 | + * 新线路 添加第一个站点 | ||
| 257 | + */ | ||
| 258 | + $(document).on('click', '.add_station_icon', function () { | ||
| 259 | + //在之后插入站点 | ||
| 260 | + var cell = $(this); | ||
| 261 | + | ||
| 262 | + var addCell = $(temps['geo_d_e_add_station_panel-temp']()); | ||
| 263 | + cell.after(addCell); | ||
| 264 | + | ||
| 265 | + add_station(addCell); | ||
| 266 | + }); | ||
| 267 | + | ||
| 249 | var showEditPanel = function (s) { | 268 | var showEditPanel = function (s) { |
| 250 | var htmlStr = temps['geo_d_e_map_edit_buffer_panel-temp'](s); | 269 | var htmlStr = temps['geo_d_e_map_edit_buffer_panel-temp'](s); |
| 251 | $('.ct_page').append(htmlStr); | 270 | $('.ct_page').append(htmlStr); |