Commit 8bb665561c6f09461b317b6d61d20a978eebc2d9

Authored by 潘钊
1 parent 05bd9885

update...

src/main/java/com/bsth/service/geo_data/impl/GeoDataServiceImpl.java
... ... @@ -722,7 +722,7 @@ public class GeoDataServiceImpl implements GeoDataService {
722 722 for (int i = 0, size = routes.size(); i < size; i++) {
723 723 routes.get(i).setStationMark("Z");
724 724 }
725   - if(routes.size() > 0)
  725 + if(routes.size() > 0 && prevRouteId!=-1)
726 726 routes.get(0).setStationMark("B");
727 727 if(routes.size() > 1)
728 728 routes.get(routes.size() - 1).setStationMark("E");
... ... @@ -808,15 +808,68 @@ public class GeoDataServiceImpl implements GeoDataService {
808 808 public Map<String, Object> destroyStation(GeoStation station) {
809 809 Map<String, Object> rs = new HashMap<>();
810 810  
  811 + //编程式事务
  812 + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
  813 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
  814 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
  815 + TransactionStatus status = tran.getTransaction(def);
811 816 try {
812 817 String sql = "update bsth_c_ls_stationroute set destroy=1 where id=?";
813 818 jdbcTemplate.update(sql, station.getId());
814 819  
  820 + //重新排序路由,标记mark
  821 + sql = "select * from bsth_c_ls_stationroute where line_code='" + station.getLineCode() + "' and directions=" + station.getDirections() + " and destroy=0 and versions=" + station.getVersions();
  822 + List<SaveStationRouteDTO> routes = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(SaveStationRouteDTO.class));
  823 + Collections.sort(routes, new StationRouteComp());
  824 +
  825 + for (int i = 0, size = routes.size(); i < size; i++) {
  826 + routes.get(i).setStationMark("Z");
  827 + }
  828 + if(routes.size() > 0)
  829 + routes.get(0).setStationMark("B");
  830 + if(routes.size() > 1)
  831 + routes.get(routes.size() - 1).setStationMark("E");
  832 +
  833 + final List<SaveStationRouteDTO> saveList = routes;
  834 + // update 原路由
  835 + jdbcTemplate.batchUpdate("update bsth_c_ls_stationroute set line=?,station=?,station_name=?,station_route_code=?," +
  836 + "line_code=?,station_code=?,station_mark=?,distances=?,to_time=?,destroy=?,versions=?,create_date=?,update_date=?,directions=?" +
  837 + " where id=?"
  838 + , new BatchPreparedStatementSetter() {
  839 + @Override
  840 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  841 + SaveStationRouteDTO sr = saveList.get(i);
  842 + ps.setInt(1, sr.getLine());
  843 + ps.setLong(2, sr.getStation());
  844 + ps.setString(3, sr.getStationName());
  845 + ps.setInt(4, sr.getStationRouteCode());
  846 + ps.setString(5, sr.getLineCode());
  847 + ps.setString(6, sr.getStationCode());
  848 + ps.setString(7, sr.getStationMark());
  849 + ps.setDouble(8, sr.getDistances());
  850 + ps.setDouble(9, sr.getToTime());
  851 + ps.setInt(10, sr.getDestroy());
  852 + ps.setInt(11, sr.getVersions());
  853 + ps.setTimestamp(12, new java.sql.Timestamp(sr.getCreateDate().getTime()));
  854 + ps.setTimestamp(13, new java.sql.Timestamp(sr.getUpdateDate().getTime()));
  855 + ps.setInt(14, sr.getDirections());
  856 + ps.setInt(15, sr.getId());
  857 + }
  858 +
  859 + @Override
  860 + public int getBatchSize() {
  861 + return saveList.size();
  862 + }
  863 + });
  864 +
  865 + tran.commit(status);
  866 +
815 867 //返回更新之后的数据
816 868 List<GeoStation> list = findByUpdown(station.getLineCode(), station.getDirections(), station.getVersions());
817 869 rs.put("list", list);
818 870 rs.put("status", ResponseCode.SUCCESS);
819 871 } catch (Exception e) {
  872 + tran.rollback(status);
820 873 logger.error("", e);
821 874 rs.put("status", ResponseCode.ERROR);
822 875 rs.put("msg", "服务器出现异常");
... ...
src/main/resources/static/pages/base/geo_data_edit/css/mian.css
... ... @@ -132,6 +132,7 @@ a.clock_enable_version:focus{
132 132 ._route_info_wrap{
133 133 height: calc(100% - 90px);
134 134 padding-top: 10px;
  135 + background: #fff;
135 136 }
136 137  
137 138 ._route_info_wrap .uk-tab>li>a{
... ... @@ -681,6 +682,7 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root {
681 682  
682 683 .s_future_version_info ._route_info_wrap{
683 684 height: calc(100% - 105px);
  685 + background: #fff;
684 686 }
685 687  
686 688 a.b_l_s_link{
... ...
src/main/resources/static/pages/base/geo_data_edit/fragments/f_station_route.html
... ... @@ -63,7 +63,7 @@
63 63 半径:{{radius}}
64 64 {{/if}}
65 65 </li>
66   - <li>站序:{{index + 1}}</li>
  66 + <li>站序:{{index}}</li>
67 67 <li>路由序号:{{stationRouteCode}}</li>
68 68 </ul>
69 69 </script>
... ...
src/main/resources/static/pages/base/geo_data_edit/fragments/versions.html
... ... @@ -35,6 +35,8 @@
35 35 <div class="uk-form-controls">
36 36 <select class="uk-select" name="remark">
37 37 <option>线路改道</option>
  38 + <option>增加中途站</option>
  39 + <option>站名更变</option>
38 40 <option>其他</option>
39 41 </select>
40 42 </div>
... ...
src/main/resources/static/pages/base/geo_data_edit/js/map.js
... ... @@ -290,6 +290,8 @@ var gb_ct_map = function () {
290 290 if (marker) {
291 291 openStationInfoWin(marker);
292 292 }
  293 + //居中
  294 + map.setCenter(marker.point);
293 295 };
294 296  
295 297 var getStationMarker = function (code, updown) {
... ...
src/main/resources/static/pages/base/geo_data_edit/js/station_route.js
... ... @@ -37,13 +37,24 @@ var gb_station_route = function () {
37 37 //当前编辑的线路版本
38 38 storage.setItem("geo_data_edit_line_version" , rs['editVersion']);
39 39  
40   - //序号
41   - for(var i=0,len=rs.list.length;i<len;i++){
42   - rs.list[i].index = i + 1;
43   - }
44 40 var data = {0:[],1:[]};
45 41 if(rs.list.length > 0)
46 42 data = gb_common.groupBy(rs.list, 'directions');
  43 +
  44 + //序号
  45 + if(data[0]){
  46 + for(var i=0,len=data[0].length;i<len;i++){
  47 + data[0][i].index = i + 1;
  48 + }
  49 + }
  50 + if(data[1]){
  51 + for(var i=0,len=data[1].length;i<len;i++){
  52 + data[1][i].index = i + 1;
  53 + }
  54 + }
  55 + /*for(var i=0,len=rs.list.length;i<len;i++){
  56 + rs.list[i].index = i + 1;
  57 + }*/
47 58 ep.emit('data', data);
48 59 });
49 60  
... ...
src/main/resources/static/pages/base/geo_data_edit/js/submit.js
... ... @@ -190,6 +190,8 @@ var gb_data_submit = function () {
190 190 */
191 191 var destroyStation = function (station) {
192 192  
  193 + station.bdCoords=null;
  194 + delete station.bdCoords;
193 195 UIkit.modal.confirm('确定撤销站点【'+station.stationName+'】?').then(function() {
194 196 show_run_text('正在撤销...');
195 197  
... ...