Commit f7c126c56716cf17f29ed9d81f2027b080dd88b1

Authored by 潘钊
1 parent 0d66c1a1

update...

src/main/java/com/bsth/controller/geo_data/GeoDataController.java
@@ -22,14 +22,14 @@ public class GeoDataController { @@ -22,14 +22,14 @@ public class GeoDataController {
22 GeoDataService geoDataService; 22 GeoDataService geoDataService;
23 23
24 @RequestMapping("findGeoStations") 24 @RequestMapping("findGeoStations")
25 - public Map<String, Object> findGeoStations(@RequestParam String lineCode){  
26 - return geoDataService.findGeoStations(lineCode); 25 + public Map<String, Object> findGeoStations(@RequestParam String lineCode, Integer version){
  26 + return geoDataService.findGeoStations(lineCode, version);
27 } 27 }
28 28
29 29
30 @RequestMapping("findGeoRoad") 30 @RequestMapping("findGeoRoad")
31 - public Map<String, Object> findGeoRoad(@RequestParam String lineCode){  
32 - return geoDataService.findGeoRoad(lineCode); 31 + public Map<String, Object> findGeoRoad(@RequestParam String lineCode,Integer version){
  32 + return geoDataService.findGeoRoad(lineCode, version);
33 } 33 }
34 34
35 @RequestMapping(value = "updateBufferInfo",method = RequestMethod.POST) 35 @RequestMapping(value = "updateBufferInfo",method = RequestMethod.POST)
@@ -73,4 +73,14 @@ public class GeoDataController { @@ -73,4 +73,14 @@ public class GeoDataController {
73 public Map<String, Object> findVersionInfo(@RequestParam String lineCode){ 73 public Map<String, Object> findVersionInfo(@RequestParam String lineCode){
74 return geoDataService.findVersionInfo(lineCode); 74 return geoDataService.findVersionInfo(lineCode);
75 } 75 }
  76 +
  77 + @RequestMapping(value = "addNewLineVersion",method = RequestMethod.POST)
  78 + public Map<String, Object> addNewLineVersion(@RequestParam Map<String, Object> map){
  79 + return geoDataService.addNewLineVersion(map);
  80 + }
  81 +
  82 + @RequestMapping(value = "deleteLineVersion",method = RequestMethod.POST)
  83 + public Map<String, Object> deleteLineVersion(@RequestParam String lineCode,@RequestParam int version){
  84 + return geoDataService.deleteLineVersion(lineCode, version);
  85 + }
76 } 86 }
77 \ No newline at end of file 87 \ No newline at end of file
src/main/java/com/bsth/service/geo_data/GeoDataService.java
@@ -11,10 +11,10 @@ import java.util.Map; @@ -11,10 +11,10 @@ import java.util.Map;
11 public interface GeoDataService { 11 public interface GeoDataService {
12 12
13 13
14 - Map<String, Object> findGeoStations(String lineCode); 14 + Map<String, Object> findGeoStations(String lineCode, Integer version);
15 15
16 16
17 - Map<String, Object> findGeoRoad(String lineCode); 17 + Map<String, Object> findGeoRoad(String lineCode,Integer version);
18 18
19 Map<String, Object> updateBufferInfo(GeoStation station); 19 Map<String, Object> updateBufferInfo(GeoStation station);
20 20
@@ -31,4 +31,8 @@ public interface GeoDataService { @@ -31,4 +31,8 @@ public interface GeoDataService {
31 Map<String,Object> addNewRoadRoute(String lineCode, int upDown, int versions, String sectionName,String crosesRoad, String coords, int prevRouteId); 31 Map<String,Object> addNewRoadRoute(String lineCode, int upDown, int versions, String sectionName,String crosesRoad, String coords, int prevRouteId);
32 32
33 Map<String,Object> findVersionInfo(String lineCode); 33 Map<String,Object> findVersionInfo(String lineCode);
  34 +
  35 + Map<String,Object> addNewLineVersion(Map<String, Object> map);
  36 +
  37 + Map<String,Object> deleteLineVersion(String lineCode, int version);
34 } 38 }
src/main/java/com/bsth/service/geo_data/impl/GeoDataServiceImpl.java
1 package com.bsth.service.geo_data.impl; 1 package com.bsth.service.geo_data.impl;
2 2
3 import com.bsth.common.ResponseCode; 3 import com.bsth.common.ResponseCode;
  4 +import com.bsth.entity.LineVersions;
4 import com.bsth.entity.geo_data.GeoLineVersionInfo; 5 import com.bsth.entity.geo_data.GeoLineVersionInfo;
5 import com.bsth.entity.geo_data.GeoRoad; 6 import com.bsth.entity.geo_data.GeoRoad;
6 import com.bsth.entity.geo_data.GeoStation; 7 import com.bsth.entity.geo_data.GeoStation;
7 import com.bsth.service.geo_data.GeoDataService; 8 import com.bsth.service.geo_data.GeoDataService;
  9 +import com.bsth.service.geo_data.impl.dto.CascadeSaveRoad;
  10 +import com.bsth.service.geo_data.impl.dto.CascadeSaveStation;
  11 +import com.bsth.service.geo_data.impl.dto.SaveRoadRouteDTO;
  12 +import com.bsth.service.geo_data.impl.dto.SaveStationRouteDTO;
8 import com.bsth.util.GetUIDAndCode; 13 import com.bsth.util.GetUIDAndCode;
9 import com.bsth.util.TransGPS; 14 import com.bsth.util.TransGPS;
10 import com.google.common.base.Splitter; 15 import com.google.common.base.Splitter;
@@ -22,6 +27,7 @@ import org.springframework.transaction.support.DefaultTransactionDefinition; @@ -22,6 +27,7 @@ import org.springframework.transaction.support.DefaultTransactionDefinition;
22 27
23 import java.sql.PreparedStatement; 28 import java.sql.PreparedStatement;
24 import java.sql.SQLException; 29 import java.sql.SQLException;
  30 +import java.text.SimpleDateFormat;
25 import java.util.*; 31 import java.util.*;
26 32
27 /** 33 /**
@@ -36,11 +42,20 @@ public class GeoDataServiceImpl implements GeoDataService { @@ -36,11 +42,20 @@ public class GeoDataServiceImpl implements GeoDataService {
36 Logger logger = LoggerFactory.getLogger(this.getClass()); 42 Logger logger = LoggerFactory.getLogger(this.getClass());
37 43
38 @Override 44 @Override
39 - public Map<String, Object> findGeoStations(String lineCode) { 45 + public Map<String, Object> findGeoStations(String lineCode, Integer version) {
40 46
41 Map<String, Object> map = new HashMap(); 47 Map<String, Object> map = new HashMap();
42 try { 48 try {
43 - String sql = "select t1.*,t2.g_lonx,g_laty,ST_AsText(g_polygon_grid) as g_polygon_grid,radius,shapes_type from (select id,station_name,station_route_code,line_code,station_code,station_mark,versions,directions from bsth_c_ls_stationroute where line=" + lineCode + " and destroy=0 and versions in (select DISTINCT versions from bsth_c_stationroute where line=" + lineCode + " and destroy=0)) t1 LEFT JOIN bsth_c_station t2 on t1.station_code=t2.station_cod"; 49 +
  50 + String sql = "select DISTINCT versions from bsth_c_stationroute where line=" + lineCode + " and destroy=0";
  51 + //当前使用的线路版本
  52 + Integer currentVersion = jdbcTemplate.queryForObject(sql, Integer.class);
  53 +
  54 +
  55 + if(null == version)
  56 + version = currentVersion;
  57 +
  58 + sql = "select t1.*,t2.g_lonx,g_laty,ST_AsText(g_polygon_grid) as g_polygon_grid,radius,shapes_type from (select id,station_name,station_route_code,line_code,station_code,station_mark,versions,directions from bsth_c_ls_stationroute where line=" + lineCode + " and destroy=0 and versions="+version+") t1 LEFT JOIN bsth_c_station t2 on t1.station_code=t2.station_cod";
44 59
45 60
46 List<GeoStation> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoStation.class)); 61 List<GeoStation> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoStation.class));
@@ -51,6 +66,7 @@ public class GeoDataServiceImpl implements GeoDataService { @@ -51,6 +66,7 @@ public class GeoDataServiceImpl implements GeoDataService {
51 } 66 }
52 map.put("status", ResponseCode.SUCCESS); 67 map.put("status", ResponseCode.SUCCESS);
53 map.put("list", list); 68 map.put("list", list);
  69 + map.put("currentVersion", currentVersion);
54 } catch (Exception e) { 70 } catch (Exception e) {
55 logger.error("", e); 71 logger.error("", e);
56 map.put("status", ResponseCode.ERROR); 72 map.put("status", ResponseCode.ERROR);
@@ -60,10 +76,20 @@ public class GeoDataServiceImpl implements GeoDataService { @@ -60,10 +76,20 @@ public class GeoDataServiceImpl implements GeoDataService {
60 } 76 }
61 77
62 @Override 78 @Override
63 - public Map<String, Object> findGeoRoad(String lineCode) { 79 + public Map<String, Object> findGeoRoad(String lineCode,Integer version) {
64 Map<String, Object> map = new HashMap(); 80 Map<String, Object> map = new HashMap();
65 try { 81 try {
66 - String sql = "select t1.*,t2.section_name,t2.croses_road,ST_AsText(t2.gsection_vector) as gsection_vector from (select id,sectionroute_code,directions,line_code,section_code,versions from bsth_c_ls_sectionroute where line=" + lineCode + " and destroy=0 and versions in (select DISTINCT versions from bsth_c_sectionroute where line=" + lineCode + " and destroy=0)) t1 LEFT JOIN bsth_c_section t2 on t1.section_code=t2.section_code"; 82 +
  83 + String sql = "select DISTINCT versions from bsth_c_stationroute where line=" + lineCode + " and destroy=0";
  84 + //当前使用的线路版本
  85 + Integer currentVersion = jdbcTemplate.queryForObject(sql, Integer.class);
  86 +
  87 +
  88 + if(null == version)
  89 + version = currentVersion;
  90 +
  91 +
  92 + sql = "select t1.*,t2.section_name,t2.croses_road,ST_AsText(t2.gsection_vector) as gsection_vector from (select id,sectionroute_code,directions,line_code,section_code,versions from bsth_c_ls_sectionroute where line=" + lineCode + " and destroy=0 and versions="+version+") t1 LEFT JOIN bsth_c_section t2 on t1.section_code=t2.section_code";
67 93
68 94
69 List<GeoRoad> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoRoad.class)); 95 List<GeoRoad> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoRoad.class));
@@ -169,7 +195,7 @@ public class GeoDataServiceImpl implements GeoDataService { @@ -169,7 +195,7 @@ public class GeoDataServiceImpl implements GeoDataService {
169 } 195 }
170 196
171 @Override 197 @Override
172 - public Map<String, Object> addNewRoadRoute(String lineCode, int upDown, int versions, String sectionName,String crosesRoad, String coords, int prevRouteId) { 198 + public Map<String, Object> addNewRoadRoute(String lineCode, int upDown, int versions, String sectionName, String crosesRoad, String coords, int prevRouteId) {
173 Map<String, Object> rs = new HashMap<>(); 199 Map<String, Object> rs = new HashMap<>();
174 200
175 //编程式事务 201 //编程式事务
@@ -178,7 +204,7 @@ public class GeoDataServiceImpl implements GeoDataService { @@ -178,7 +204,7 @@ public class GeoDataServiceImpl implements GeoDataService {
178 def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); 204 def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
179 TransactionStatus status = tran.getTransaction(def); 205 TransactionStatus status = tran.getTransaction(def);
180 try { 206 try {
181 - //根据站点编码,查询站点ID 207 + //根据线路编码,查询线路ID
182 int lineId = jdbcTemplate.queryForObject("select id from bsth_c_line where line_code=" + lineCode, Integer.class); 208 int lineId = jdbcTemplate.queryForObject("select id from bsth_c_line where line_code=" + lineCode, Integer.class);
183 209
184 String sql = "select * from bsth_c_ls_sectionroute where line_code='" + lineCode + "' and line=" + lineId + " and directions=" + upDown + " and destroy=0 and versions=" + versions; 210 String sql = "select * from bsth_c_ls_sectionroute where line_code='" + lineCode + "' and line=" + lineId + " and directions=" + upDown + " and destroy=0 and versions=" + versions;
@@ -192,7 +218,7 @@ public class GeoDataServiceImpl implements GeoDataService { @@ -192,7 +218,7 @@ public class GeoDataServiceImpl implements GeoDataService {
192 String bdCooed = "LINESTRING(" + coords + ")"; 218 String bdCooed = "LINESTRING(" + coords + ")";
193 //insert 路段 219 //insert 路段
194 sql = "insert into bsth_c_section(id, section_code, section_name, croses_road, bsection_vector, gsection_vector, create_date, update_date, versions) " + 220 sql = "insert into bsth_c_section(id, section_code, section_name, croses_road, bsection_vector, gsection_vector, create_date, update_date, versions) " +
195 - " values(?,?,?,?,ST_GeomFromText('"+bdCooed+"'),ST_GeomFromText('"+wgsCoord+"'),sysdate(),sysdate(),?)"; 221 + " values(?,?,?,?,ST_GeomFromText('" + bdCooed + "'),ST_GeomFromText('" + wgsCoord + "'),sysdate(),sysdate(),?)";
196 222
197 jdbcTemplate.update(sql, sCode, sCode, sectionName, crosesRoad, 1); 223 jdbcTemplate.update(sql, sCode, sCode, sectionName, crosesRoad, 1);
198 224
@@ -269,6 +295,7 @@ public class GeoDataServiceImpl implements GeoDataService { @@ -269,6 +295,7 @@ public class GeoDataServiceImpl implements GeoDataService {
269 295
270 /** 296 /**
271 * 获取线路版本信息 297 * 获取线路版本信息
  298 + *
272 * @param lineCode 299 * @param lineCode
273 * @return 300 * @return
274 */ 301 */
@@ -277,10 +304,10 @@ public class GeoDataServiceImpl implements GeoDataService { @@ -277,10 +304,10 @@ public class GeoDataServiceImpl implements GeoDataService {
277 Map<String, Object> rs = new HashMap<>(); 304 Map<String, Object> rs = new HashMap<>();
278 305
279 try { 306 try {
280 - String sql = "select t1.*,t2.name as line_name from bsth_c_line_versions t1 LEFT JOIN bsth_c_line t2 on t1.line_code=t2.line_code where t1.line_code='"+lineCode+"'"; 307 + String sql = "select t1.*,t2.name as line_name from bsth_c_line_versions t1 LEFT JOIN bsth_c_line t2 on t1.line_code=t2.line_code where t1.line_code='" + lineCode + "'";
281 308
282 List<GeoLineVersionInfo> list = 309 List<GeoLineVersionInfo> list =
283 - jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoLineVersionInfo.class)); 310 + jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoLineVersionInfo.class));
284 311
285 rs.put("list", list); 312 rs.put("list", list);
286 rs.put("status", ResponseCode.SUCCESS); 313 rs.put("status", ResponseCode.SUCCESS);
@@ -293,6 +320,253 @@ public class GeoDataServiceImpl implements GeoDataService { @@ -293,6 +320,253 @@ public class GeoDataServiceImpl implements GeoDataService {
293 } 320 }
294 321
295 @Override 322 @Override
  323 + public Map<String, Object> addNewLineVersion(Map<String, Object> map) {
  324 + Map<String, Object> rs = new HashMap<>();
  325 +
  326 + //编程式事务
  327 + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
  328 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
  329 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
  330 + TransactionStatus status = tran.getTransaction(def);
  331 + try {
  332 +
  333 + String lineCode = map.get("lineCode").toString();
  334 + String remark = map.get("remark").toString();
  335 + String name = map.get("name").toString();
  336 + Date startDate = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(map.get("startDate").toString());
  337 + int extendsVersion = Integer.parseInt(map.get("extendsVersion").toString());
  338 +
  339 +
  340 + //当前最大的版本号
  341 + int maxVersion = jdbcTemplate.queryForObject("select max(versions) as versions from bsth_c_line_versions where line_code=" + lineCode, Integer.class);
  342 + Date d = new Date();
  343 +
  344 + //根据线路编码,查询线路ID
  345 + int lineId = jdbcTemplate.queryForObject("select id from bsth_c_line where line_code=" + lineCode, Integer.class);
  346 +
  347 + maxVersion += 1;
  348 + LineVersions lVersion = new LineVersions();
  349 + lVersion.setName(name);
  350 + lVersion.setVersions(maxVersion);
  351 + lVersion.setRemark(remark);
  352 + lVersion.setStartDate(startDate);
  353 + lVersion.setStatus(2);
  354 + lVersion.setCreateDate(d);
  355 + lVersion.setUpdateDate(d);
  356 + lVersion.setLineCode(lineCode);
  357 +
  358 + //入库线路版本
  359 + jdbcTemplate.update("insert into bsth_c_line_versions(name, line, line_code, versions, start_date, create_date, update_date, remark,status, isupdate) " +
  360 + " values(?,?,?,?,?,?,?,?,?,?)", lVersion.getName(), lineId, lVersion.getLineCode()
  361 + , lVersion.getVersions(), lVersion.getStartDate(), lVersion.getCreateDate(), lVersion.getUpdateDate(), lVersion.getRemark(), lVersion.getStatus(), lVersion.getIsupdate());
  362 +
  363 + if (extendsVersion != -1) {
  364 + //复制站点信息
  365 + String sql = "SELECT t1.id AS route_id,t1.line,t1.directions,t1.station,t1.station_name,t1.station_route_code,t1.line_code,t1.station_code,t1.station_mark,t1.distances,t1.to_time,t2.id AS station_id,t2.db_type,t2.b_jwpoints,t2.g_lonx,t2.g_laty,t2.radius,ST_AsText(t2.g_polygon_grid) as g_polygon_grid,t2.shapes_type FROM bsth_c_ls_stationroute t1 LEFT JOIN bsth_c_station t2 ON t1.station_code = t2.station_cod where t1.destroy=0 and t1.line_code='" + lineCode + "' and t1.versions="+extendsVersion+" order by t1.directions, t1.station_route_code";
  366 + List<CascadeSaveStation> cssList = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(CascadeSaveStation.class));
  367 +
  368 + //新的站点编码
  369 + long sCode;
  370 + for (CascadeSaveStation ss : cssList) {
  371 + sCode = GetUIDAndCode.getStationId();
  372 + ss.setRouteId(null);
  373 + ss.setStationCode(sCode + "");
  374 + ss.setStation((int) sCode);
  375 + }
  376 + //入库新版本的站点 和 路由
  377 + batchInsertStation(cssList, maxVersion);
  378 +
  379 + //复制路段信息
  380 + sql = "SELECT t1.id AS route_id,t1.line,t1.line_code,t1.directions,t1.section,t1.section_code,t1.sectionroute_code,t1.versions,t2.section_name,t2.croses_road,ST_AsText(t2.gsection_vector) as gsection_vector,t2.db_type,t2.speed_limit FROM bsth_c_ls_sectionroute t1 LEFT JOIN bsth_c_section t2 ON t1.section_code = t2.section_code WHERE t1.destroy = 0 AND t1.line_code = '"+lineCode+"' and t1.versions="+ extendsVersion +" ORDER BY t1.directions,t1.sectionroute_code";
  381 + List<CascadeSaveRoad> csrList = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(CascadeSaveRoad.class));
  382 + //新的路段编码
  383 + long cCode;
  384 + for(CascadeSaveRoad csr : csrList){
  385 + cCode = GetUIDAndCode.getSectionId();
  386 + csr.setRouteId(null);
  387 + csr.setSection((int) cCode);
  388 + csr.setSectionCode(cCode + "");
  389 + }
  390 + //入库新版本的路段 和 路段路由
  391 + batchInsertRoad(csrList, maxVersion);
  392 + }
  393 +
  394 + tran.commit(status);
  395 + rs.put("newVersion", maxVersion);
  396 + rs.put("status", ResponseCode.SUCCESS);
  397 + } catch (Exception e) {
  398 + tran.rollback(status);
  399 + logger.error("", e);
  400 + rs.put("status", ResponseCode.ERROR);
  401 + rs.put("msg", "服务器出现异常");
  402 + }
  403 + return rs;
  404 + }
  405 +
  406 + /**
  407 + * 删除一个线路走向版本
  408 + * @param lineCode
  409 + * @param version
  410 + * @return
  411 + */
  412 + @Override
  413 + public Map<String, Object> deleteLineVersion(String lineCode, int version) {
  414 + Map<String, Object> rs = new HashMap<>();
  415 +
  416 + //编程式事务
  417 + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
  418 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
  419 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
  420 + TransactionStatus status = tran.getTransaction(def);
  421 + try{
  422 + /* //要删除的站点ID(未被其他线路、版本引用的)
  423 + 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 (" +
  425 + "select station from bsth_c_ls_stationroute where line_code='"+lineCode+"' and versions="+version +
  426 + "))";
  427 +
  428 + List<Integer> stationRemoves = jdbcTemplate.queryForList(sql, Integer.class);*/
  429 +
  430 + //删除站点路由
  431 + String sql = "delete from bsth_c_ls_stationroute where line_code='"+lineCode+"' and versions=" + version;
  432 + jdbcTemplate.update(sql);
  433 +
  434 + //删除路段路由
  435 + sql = "delete from bsth_c_ls_sectionroute where line_code='"+lineCode+"' and versions=" + version;
  436 + jdbcTemplate.update(sql);
  437 +
  438 + //删除版本信息
  439 + sql = "delete from bsth_c_line_versions where line_code='"+lineCode+"' and versions=" + version;
  440 + jdbcTemplate.update(sql);
  441 +
  442 + tran.commit(status);
  443 + rs.put("status", ResponseCode.SUCCESS);
  444 + }catch (Exception e){
  445 + tran.rollback(status);
  446 + logger.error("", e);
  447 + rs.put("status", ResponseCode.ERROR);
  448 + rs.put("msg", "服务器出现异常");
  449 + }
  450 + return rs;
  451 + }
  452 +
  453 + /**
  454 + * 批量入库路段
  455 + * @param cssList
  456 + * @param version
  457 + */
  458 + private void batchInsertRoad(final List<CascadeSaveRoad> csrList, final int version){
  459 + final Date d = new Date();
  460 + jdbcTemplate.batchUpdate("insert into bsth_c_section(id, section_code, section_name, croses_road, gsection_vector, create_date, update_date, versions) " +
  461 + " values(?,?,?,?,ST_GeomFromText(?),?,?,?)", new BatchPreparedStatementSetter() {
  462 + @Override
  463 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  464 + CascadeSaveRoad csr = csrList.get(i);
  465 + ps.setInt(1, csr.getSection());
  466 + ps.setString(2, csr.getSectionCode());
  467 + ps.setString(3, csr.getSectionName());
  468 + ps.setString(4, csr.getCrosesRoad());
  469 + ps.setString(5, csr.getGsectionVector());
  470 + ps.setTimestamp(6, new java.sql.Timestamp(d.getTime()));
  471 + ps.setTimestamp(7, new java.sql.Timestamp(d.getTime()));
  472 + ps.setInt(8, version);
  473 + }
  474 +
  475 + @Override
  476 + public int getBatchSize() {
  477 + return csrList.size();
  478 + }
  479 + });
  480 +
  481 + //路由
  482 + jdbcTemplate.batchUpdate("insert into bsth_c_ls_sectionroute(line_code, section_code, sectionroute_code, directions, line, section, create_date,update_date,versions,destroy,is_roade_speed) " +
  483 + " values(?,?,?,?,?,?,?,?,?,?,?)", new BatchPreparedStatementSetter() {
  484 + @Override
  485 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  486 + CascadeSaveRoad csr = csrList.get(i);
  487 + ps.setString(1, csr.getLineCode());
  488 + ps.setString(2, csr.getSectionCode());
  489 + ps.setInt(3, csr.getSectionrouteCode());
  490 + ps.setInt(4, csr.getDirections());
  491 + ps.setInt(5, csr.getLine());
  492 + ps.setInt(6, csr.getSection());
  493 + ps.setTimestamp(7, new java.sql.Timestamp(d.getTime()));
  494 + ps.setTimestamp(8, new java.sql.Timestamp(d.getTime()));
  495 + ps.setInt(9, version);
  496 + ps.setInt(10, 0);
  497 + ps.setInt(11, 0);
  498 + }
  499 +
  500 + @Override
  501 + public int getBatchSize() {
  502 + return csrList.size();
  503 + }
  504 + });
  505 + }
  506 +
  507 + /**
  508 + * 批量插入站点
  509 + *
  510 + * @param cssList
  511 + */
  512 + private void batchInsertStation(final List<CascadeSaveStation> cssList, final int version) {
  513 + //站点
  514 + jdbcTemplate.batchUpdate("insert into bsth_c_station(id, station_cod, station_name, db_type, b_jwpoints, g_lonx, g_laty, destroy, radius, shapes_type, versions, g_polygon_grid) " +
  515 + " values(?,?,?,?,?,?,?,?,?,?,?,ST_GeomFromText(?))", new BatchPreparedStatementSetter() {
  516 + @Override
  517 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  518 + CascadeSaveStation ss = cssList.get(i);
  519 + ps.setInt(1, ss.getStation());
  520 + ps.setString(2, ss.getStationCode());
  521 + ps.setString(3, ss.getStationName());
  522 + ps.setString(4, "b");
  523 + ps.setString(5, ss.getbJwpoints());
  524 + ps.setDouble(6, ss.getgLonx());
  525 + ps.setDouble(7, ss.getgLaty());
  526 + ps.setInt(8, 0);
  527 + ps.setInt(9, ss.getRadius()==null?0:ss.getRadius());
  528 + ps.setString(10, ss.getShapesType());
  529 + ps.setInt(11, version);
  530 + ps.setString(12, ss.getgPolygonGrid());
  531 + }
  532 +
  533 + @Override
  534 + public int getBatchSize() {
  535 + return cssList.size();
  536 + }
  537 + });
  538 +
  539 + final Date d = new Date();
  540 + //站点路由
  541 + jdbcTemplate.batchUpdate("insert into bsth_c_ls_stationroute(line, station, station_name, station_route_code, line_code, station_code, station_mark, distances, to_time, destroy, versions, create_date, update_date,directions) " +
  542 + " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)", new BatchPreparedStatementSetter() {
  543 + @Override
  544 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  545 + CascadeSaveStation ss = cssList.get(i);
  546 + ps.setInt(1, ss.getLine());
  547 + ps.setInt(2, ss.getStation());
  548 + ps.setString(3, ss.getStationName());
  549 + ps.setInt(4, ss.getStationRouteCode());
  550 + ps.setString(5, ss.getLineCode());
  551 + ps.setString(6, ss.getStationCode());
  552 + ps.setString(7, ss.getStationMark());
  553 + ps.setDouble(8, ss.getDistances());
  554 + ps.setDouble(9, ss.getToTime());
  555 + ps.setInt(10, 0);
  556 + ps.setInt(11, version);
  557 + ps.setTimestamp(12, new java.sql.Timestamp(d.getTime()));
  558 + ps.setTimestamp(13, new java.sql.Timestamp(d.getTime()));
  559 + ps.setInt(14, ss.getDirections());
  560 + }
  561 +
  562 + @Override
  563 + public int getBatchSize() {
  564 + return cssList.size();
  565 + }
  566 + });
  567 + }
  568 +
  569 + @Override
296 public Map<String, Object> addNewStationRoute(String lineCode, int upDown, int versions, String stationName, Float lat, Float lng, int prevRouteId) { 570 public Map<String, Object> addNewStationRoute(String lineCode, int upDown, int versions, String stationName, Float lat, Float lng, int prevRouteId) {
297 Map<String, Object> rs = new HashMap<>(); 571 Map<String, Object> rs = new HashMap<>();
298 572
src/main/java/com/bsth/service/geo_data/impl/dto/CascadeSaveRoad.java 0 → 100644
  1 +package com.bsth.service.geo_data.impl.dto;
  2 +
  3 +/**
  4 + * 级联入库的路段 和 路段路由
  5 + * Created by panzhao on 2017/12/25.
  6 + */
  7 +public class CascadeSaveRoad {
  8 +
  9 + private Integer routeId;
  10 +
  11 + private Integer line;
  12 +
  13 + private String lineCode;
  14 +
  15 + private int directions;
  16 +
  17 + private Integer section;
  18 +
  19 + private String sectionCode;
  20 +
  21 + private Integer sectionrouteCode;
  22 +
  23 + private int versions;
  24 +
  25 + private String sectionName;
  26 +
  27 + private String crosesRoad;
  28 +
  29 + private String gsectionVector;
  30 +
  31 + private String dbType;
  32 +
  33 + private Integer speedLimit;
  34 +
  35 + public Integer getRouteId() {
  36 + return routeId;
  37 + }
  38 +
  39 + public void setRouteId(Integer routeId) {
  40 + this.routeId = routeId;
  41 + }
  42 +
  43 + public Integer getLine() {
  44 + return line;
  45 + }
  46 +
  47 + public void setLine(Integer line) {
  48 + this.line = line;
  49 + }
  50 +
  51 + public String getLineCode() {
  52 + return lineCode;
  53 + }
  54 +
  55 + public void setLineCode(String lineCode) {
  56 + this.lineCode = lineCode;
  57 + }
  58 +
  59 + public Integer getSection() {
  60 + return section;
  61 + }
  62 +
  63 + public void setSection(Integer section) {
  64 + this.section = section;
  65 + }
  66 +
  67 + public String getSectionCode() {
  68 + return sectionCode;
  69 + }
  70 +
  71 + public void setSectionCode(String sectionCode) {
  72 + this.sectionCode = sectionCode;
  73 + }
  74 +
  75 + public Integer getSectionrouteCode() {
  76 + return sectionrouteCode;
  77 + }
  78 +
  79 + public void setSectionrouteCode(Integer sectionrouteCode) {
  80 + this.sectionrouteCode = sectionrouteCode;
  81 + }
  82 +
  83 + public int getVersions() {
  84 + return versions;
  85 + }
  86 +
  87 + public void setVersions(int versions) {
  88 + this.versions = versions;
  89 + }
  90 +
  91 + public String getSectionName() {
  92 + return sectionName;
  93 + }
  94 +
  95 + public void setSectionName(String sectionName) {
  96 + this.sectionName = sectionName;
  97 + }
  98 +
  99 + public String getCrosesRoad() {
  100 + return crosesRoad;
  101 + }
  102 +
  103 + public void setCrosesRoad(String crosesRoad) {
  104 + this.crosesRoad = crosesRoad;
  105 + }
  106 +
  107 + public String getGsectionVector() {
  108 + return gsectionVector;
  109 + }
  110 +
  111 + public void setGsectionVector(String gsectionVector) {
  112 + this.gsectionVector = gsectionVector;
  113 + }
  114 +
  115 + public String getDbType() {
  116 + return dbType;
  117 + }
  118 +
  119 + public void setDbType(String dbType) {
  120 + this.dbType = dbType;
  121 + }
  122 +
  123 + public Integer getSpeedLimit() {
  124 + return speedLimit;
  125 + }
  126 +
  127 + public void setSpeedLimit(Integer speedLimit) {
  128 + this.speedLimit = speedLimit;
  129 + }
  130 +
  131 + public int getDirections() {
  132 + return directions;
  133 + }
  134 +
  135 + public void setDirections(int directions) {
  136 + this.directions = directions;
  137 + }
  138 +}
src/main/java/com/bsth/service/geo_data/impl/dto/CascadeSaveStation.java 0 → 100644
  1 +package com.bsth.service.geo_data.impl.dto;
  2 +
  3 +/**
  4 + * 站点和路由级联入库
  5 + * Created by panzhao on 2017/12/21.
  6 + */
  7 +public class CascadeSaveStation {
  8 +
  9 + /**
  10 + * 路由id
  11 + */
  12 + private Integer routeId;
  13 +
  14 + /**
  15 + * 线路id
  16 + */
  17 + private Integer line;
  18 +
  19 + /**
  20 + * 上下行
  21 + */
  22 + private int directions;
  23 +
  24 + /**
  25 + * 站点id
  26 + */
  27 + private Integer station;
  28 +
  29 + /**
  30 + * 站点名称
  31 + */
  32 + private String stationName;
  33 +
  34 + /**
  35 + * 路由顺序
  36 + */
  37 + private Integer stationRouteCode;
  38 +
  39 + /**
  40 + * 线路编码
  41 + */
  42 + private String lineCode;
  43 +
  44 + /**
  45 + * 站点编码
  46 + */
  47 + private String stationCode;
  48 +
  49 + private String stationMark;
  50 +
  51 + private Double distances;
  52 +
  53 + private Double toTime;
  54 +
  55 + private Integer stationId;
  56 +
  57 + private String dbType;
  58 +
  59 + private String bJwpoints;
  60 +
  61 + private Float gLonx;
  62 +
  63 + private Float gLaty;
  64 +
  65 + private Integer radius;
  66 +
  67 + private String shapesType;
  68 +
  69 + private String gPolygonGrid;
  70 +
  71 +
  72 +
  73 + public Integer getLine() {
  74 + return line;
  75 + }
  76 +
  77 + public void setLine(Integer line) {
  78 + this.line = line;
  79 + }
  80 +
  81 + public Integer getStation() {
  82 + return station;
  83 + }
  84 +
  85 + public void setStation(Integer station) {
  86 + this.station = station;
  87 + }
  88 +
  89 + public String getStationName() {
  90 + return stationName;
  91 + }
  92 +
  93 + public void setStationName(String stationName) {
  94 + this.stationName = stationName;
  95 + }
  96 +
  97 + public Integer getStationRouteCode() {
  98 + return stationRouteCode;
  99 + }
  100 +
  101 + public void setStationRouteCode(Integer stationRouteCode) {
  102 + this.stationRouteCode = stationRouteCode;
  103 + }
  104 +
  105 + public String getLineCode() {
  106 + return lineCode;
  107 + }
  108 +
  109 + public void setLineCode(String lineCode) {
  110 + this.lineCode = lineCode;
  111 + }
  112 +
  113 + public String getStationCode() {
  114 + return stationCode;
  115 + }
  116 +
  117 + public void setStationCode(String stationCode) {
  118 + this.stationCode = stationCode;
  119 + }
  120 +
  121 + public String getStationMark() {
  122 + return stationMark;
  123 + }
  124 +
  125 + public void setStationMark(String stationMark) {
  126 + this.stationMark = stationMark;
  127 + }
  128 +
  129 + public Double getDistances() {
  130 + return distances;
  131 + }
  132 +
  133 + public void setDistances(Double distances) {
  134 + this.distances = distances;
  135 + }
  136 +
  137 + public Double getToTime() {
  138 + return toTime;
  139 + }
  140 +
  141 + public void setToTime(Double toTime) {
  142 + this.toTime = toTime;
  143 + }
  144 +
  145 + public Integer getStationId() {
  146 + return stationId;
  147 + }
  148 +
  149 + public void setStationId(Integer stationId) {
  150 + this.stationId = stationId;
  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 getbJwpoints() {
  162 + return bJwpoints;
  163 + }
  164 +
  165 + public void setbJwpoints(String bJwpoints) {
  166 + this.bJwpoints = bJwpoints;
  167 + }
  168 +
  169 + public Float getgLonx() {
  170 + return gLonx;
  171 + }
  172 +
  173 + public void setgLonx(Float gLonx) {
  174 + this.gLonx = gLonx;
  175 + }
  176 +
  177 + public Float getgLaty() {
  178 + return gLaty;
  179 + }
  180 +
  181 + public void setgLaty(Float gLaty) {
  182 + this.gLaty = gLaty;
  183 + }
  184 +
  185 + public Integer getRadius() {
  186 + return radius;
  187 + }
  188 +
  189 + public void setRadius(Integer radius) {
  190 + this.radius = radius;
  191 + }
  192 +
  193 + public String getShapesType() {
  194 + return shapesType;
  195 + }
  196 +
  197 + public void setShapesType(String shapesType) {
  198 + this.shapesType = shapesType;
  199 + }
  200 +
  201 + public String getgPolygonGrid() {
  202 + return gPolygonGrid;
  203 + }
  204 +
  205 + public void setgPolygonGrid(String gPolygonGrid) {
  206 + this.gPolygonGrid = gPolygonGrid;
  207 + }
  208 +
  209 + public int getDirections() {
  210 + return directions;
  211 + }
  212 +
  213 + public void setDirections(int directions) {
  214 + this.directions = directions;
  215 + }
  216 +
  217 + public Integer getRouteId() {
  218 + return routeId;
  219 + }
  220 +
  221 + public void setRouteId(Integer routeId) {
  222 + this.routeId = routeId;
  223 + }
  224 +}
src/main/java/com/bsth/service/geo_data/impl/SaveRoadRouteDTO.java renamed to src/main/java/com/bsth/service/geo_data/impl/dto/SaveRoadRouteDTO.java
1 -package com.bsth.service.geo_data.impl;  
2 -  
3 -import java.util.Date;  
4 -  
5 -/**  
6 - * Created by panzhao on 2017/12/17.  
7 - */  
8 -public class SaveRoadRouteDTO {  
9 -  
10 - private Integer id;  
11 -  
12 - // 路段路由序号  
13 - private Integer sectionrouteCode;  
14 -  
15 - // 线路编号  
16 - private String lineCode;  
17 -  
18 - // 路段编号  
19 - private String sectionCode;  
20 -  
21 - // 路段路由方向  
22 - private Integer directions;  
23 -  
24 - // 版本号  
25 - private Integer versions;  
26 -  
27 - // 是否撤销  
28 - private Integer destroy;  
29 -  
30 - /** 是否有路段限速数据 <0:分段;1:未分段>*/  
31 - private Integer isRoadeSpeed;  
32 -  
33 - // 描述  
34 - private String descriptions;  
35 -  
36 - // 创建人  
37 - private Integer createBy;  
38 -  
39 - // 修改人  
40 - private Integer updateBy;  
41 -  
42 - // 创建日期  
43 - private Date createDate;  
44 -  
45 - // 修改日期  
46 - private Date updateDate;  
47 -  
48 - // 路段信息  
49 - private long section;  
50 -  
51 - // 线路ID  
52 - private int line;  
53 -  
54 - public Integer getId() {  
55 - return id;  
56 - }  
57 -  
58 - public void setId(Integer id) {  
59 - this.id = id;  
60 - }  
61 -  
62 - public Integer getSectionrouteCode() {  
63 - return sectionrouteCode;  
64 - }  
65 -  
66 - public void setSectionrouteCode(Integer sectionrouteCode) {  
67 - this.sectionrouteCode = sectionrouteCode;  
68 - }  
69 -  
70 - public String getLineCode() {  
71 - return lineCode;  
72 - }  
73 -  
74 - public void setLineCode(String lineCode) {  
75 - this.lineCode = lineCode;  
76 - }  
77 -  
78 - public String getSectionCode() {  
79 - return sectionCode;  
80 - }  
81 -  
82 - public void setSectionCode(String sectionCode) {  
83 - this.sectionCode = sectionCode;  
84 - }  
85 -  
86 - public Integer getDirections() {  
87 - return directions;  
88 - }  
89 -  
90 - public void setDirections(Integer directions) {  
91 - this.directions = directions;  
92 - }  
93 -  
94 - public Integer getVersions() {  
95 - return versions;  
96 - }  
97 -  
98 - public void setVersions(Integer versions) {  
99 - this.versions = versions;  
100 - }  
101 -  
102 - public Integer getDestroy() {  
103 - return destroy;  
104 - }  
105 -  
106 - public void setDestroy(Integer destroy) {  
107 - this.destroy = destroy;  
108 - }  
109 -  
110 - public Integer getIsRoadeSpeed() {  
111 - return isRoadeSpeed;  
112 - }  
113 -  
114 - public void setIsRoadeSpeed(Integer isRoadeSpeed) {  
115 - this.isRoadeSpeed = isRoadeSpeed;  
116 - }  
117 -  
118 - public String getDescriptions() {  
119 - return descriptions;  
120 - }  
121 -  
122 - public void setDescriptions(String descriptions) {  
123 - this.descriptions = descriptions;  
124 - }  
125 -  
126 - public Integer getCreateBy() {  
127 - return createBy;  
128 - }  
129 -  
130 - public void setCreateBy(Integer createBy) {  
131 - this.createBy = createBy;  
132 - }  
133 -  
134 - public Integer getUpdateBy() {  
135 - return updateBy;  
136 - }  
137 -  
138 - public void setUpdateBy(Integer updateBy) {  
139 - this.updateBy = updateBy;  
140 - }  
141 -  
142 - public Date getCreateDate() {  
143 - return createDate;  
144 - }  
145 -  
146 - public void setCreateDate(Date createDate) {  
147 - this.createDate = createDate;  
148 - }  
149 -  
150 - public Date getUpdateDate() {  
151 - return updateDate;  
152 - }  
153 -  
154 - public void setUpdateDate(Date updateDate) {  
155 - this.updateDate = updateDate;  
156 - }  
157 -  
158 - public long getSection() {  
159 - return section;  
160 - }  
161 -  
162 - public void setSection(long section) {  
163 - this.section = section;  
164 - }  
165 -  
166 - public int getLine() {  
167 - return line;  
168 - }  
169 -  
170 - public void setLine(int line) {  
171 - this.line = line;  
172 - }  
173 -} 1 +package com.bsth.service.geo_data.impl.dto;
  2 +
  3 +import java.util.Date;
  4 +
  5 +/**
  6 + * Created by panzhao on 2017/12/17.
  7 + */
  8 +public class SaveRoadRouteDTO {
  9 +
  10 + private Integer id;
  11 +
  12 + // 路段路由序号
  13 + private Integer sectionrouteCode;
  14 +
  15 + // 线路编号
  16 + private String lineCode;
  17 +
  18 + // 路段编号
  19 + private String sectionCode;
  20 +
  21 + // 路段路由方向
  22 + private Integer directions;
  23 +
  24 + // 版本号
  25 + private Integer versions;
  26 +
  27 + // 是否撤销
  28 + private Integer destroy;
  29 +
  30 + /** 是否有路段限速数据 <0:分段;1:未分段>*/
  31 + private Integer isRoadeSpeed;
  32 +
  33 + // 描述
  34 + private String descriptions;
  35 +
  36 + // 创建人
  37 + private Integer createBy;
  38 +
  39 + // 修改人
  40 + private Integer updateBy;
  41 +
  42 + // 创建日期
  43 + private Date createDate;
  44 +
  45 + // 修改日期
  46 + private Date updateDate;
  47 +
  48 + // 路段信息
  49 + private long section;
  50 +
  51 + // 线路ID
  52 + private int line;
  53 +
  54 + public Integer getId() {
  55 + return id;
  56 + }
  57 +
  58 + public void setId(Integer id) {
  59 + this.id = id;
  60 + }
  61 +
  62 + public Integer getSectionrouteCode() {
  63 + return sectionrouteCode;
  64 + }
  65 +
  66 + public void setSectionrouteCode(Integer sectionrouteCode) {
  67 + this.sectionrouteCode = sectionrouteCode;
  68 + }
  69 +
  70 + public String getLineCode() {
  71 + return lineCode;
  72 + }
  73 +
  74 + public void setLineCode(String lineCode) {
  75 + this.lineCode = lineCode;
  76 + }
  77 +
  78 + public String getSectionCode() {
  79 + return sectionCode;
  80 + }
  81 +
  82 + public void setSectionCode(String sectionCode) {
  83 + this.sectionCode = sectionCode;
  84 + }
  85 +
  86 + public Integer getDirections() {
  87 + return directions;
  88 + }
  89 +
  90 + public void setDirections(Integer directions) {
  91 + this.directions = directions;
  92 + }
  93 +
  94 + public Integer getVersions() {
  95 + return versions;
  96 + }
  97 +
  98 + public void setVersions(Integer versions) {
  99 + this.versions = versions;
  100 + }
  101 +
  102 + public Integer getDestroy() {
  103 + return destroy;
  104 + }
  105 +
  106 + public void setDestroy(Integer destroy) {
  107 + this.destroy = destroy;
  108 + }
  109 +
  110 + public Integer getIsRoadeSpeed() {
  111 + return isRoadeSpeed;
  112 + }
  113 +
  114 + public void setIsRoadeSpeed(Integer isRoadeSpeed) {
  115 + this.isRoadeSpeed = isRoadeSpeed;
  116 + }
  117 +
  118 + public String getDescriptions() {
  119 + return descriptions;
  120 + }
  121 +
  122 + public void setDescriptions(String descriptions) {
  123 + this.descriptions = descriptions;
  124 + }
  125 +
  126 + public Integer getCreateBy() {
  127 + return createBy;
  128 + }
  129 +
  130 + public void setCreateBy(Integer createBy) {
  131 + this.createBy = createBy;
  132 + }
  133 +
  134 + public Integer getUpdateBy() {
  135 + return updateBy;
  136 + }
  137 +
  138 + public void setUpdateBy(Integer updateBy) {
  139 + this.updateBy = updateBy;
  140 + }
  141 +
  142 + public Date getCreateDate() {
  143 + return createDate;
  144 + }
  145 +
  146 + public void setCreateDate(Date createDate) {
  147 + this.createDate = createDate;
  148 + }
  149 +
  150 + public Date getUpdateDate() {
  151 + return updateDate;
  152 + }
  153 +
  154 + public void setUpdateDate(Date updateDate) {
  155 + this.updateDate = updateDate;
  156 + }
  157 +
  158 + public long getSection() {
  159 + return section;
  160 + }
  161 +
  162 + public void setSection(long section) {
  163 + this.section = section;
  164 + }
  165 +
  166 + public int getLine() {
  167 + return line;
  168 + }
  169 +
  170 + public void setLine(int line) {
  171 + this.line = line;
  172 + }
  173 +}
src/main/java/com/bsth/service/geo_data/impl/SaveStationRouteDTO.java renamed to src/main/java/com/bsth/service/geo_data/impl/dto/SaveStationRouteDTO.java
1 -package com.bsth.service.geo_data.impl;  
2 -  
3 -import java.util.Date;  
4 -  
5 -/**  
6 - * 站点路由 jdbc 入库数据  
7 - * Created by panzhao on 2017/12/14.  
8 - */  
9 -public class SaveStationRouteDTO {  
10 -  
11 - //站点路由ID  
12 - private Integer id;  
13 -  
14 - // 站点路由序号  
15 - private Integer stationRouteCode;  
16 -  
17 - // 站点编码  
18 - private String stationCode;  
19 -  
20 - // 站点名称  
21 - private String stationName;  
22 -  
23 - // 线路编码  
24 - private String lineCode;  
25 -  
26 - /**  
27 - * 站点类型  
28 - *  
29 - * ------ B:起点站  
30 - *  
31 - * ------ Z:中途站  
32 - *  
33 - * ------ E:终点站  
34 - *  
35 - * ------ T:停车场  
36 - *  
37 - */  
38 - private String stationMark;  
39 -  
40 - // 站点路由出站序号  
41 - private Integer outStationNmber;  
42 -  
43 - // 站点路由到站距离  
44 - private Double distances;  
45 -  
46 - // 站点路由到站时间  
47 - private Double toTime;  
48 -  
49 - // 首班时间  
50 - private String firstTime;  
51 -  
52 - // 末班时间  
53 - private String endTime;  
54 -  
55 - // 站点路由方向  
56 - private Integer directions;  
57 -  
58 - // 版本号  
59 - private Integer versions;  
60 -  
61 - // 是否撤销  
62 - private Integer destroy;  
63 -  
64 - // 描述  
65 - private String descriptions;  
66 -  
67 - // 创建人  
68 - private Integer createBy;  
69 -  
70 - // 修改人  
71 - private Integer updateBy;  
72 -  
73 - // 创建日期  
74 - private Date createDate;  
75 -  
76 - // 修改日期  
77 - private Date updateDate;  
78 -  
79 - // 站点ID  
80 - private long station;  
81 -  
82 - // 线路ID  
83 - private int line;  
84 -  
85 - public Integer getId() {  
86 - return id;  
87 - }  
88 -  
89 - public void setId(Integer id) {  
90 - this.id = id;  
91 - }  
92 -  
93 - public Integer getStationRouteCode() {  
94 - return stationRouteCode;  
95 - }  
96 -  
97 - public void setStationRouteCode(Integer stationRouteCode) {  
98 - this.stationRouteCode = stationRouteCode;  
99 - }  
100 -  
101 - public String getStationCode() {  
102 - return stationCode;  
103 - }  
104 -  
105 - public void setStationCode(String stationCode) {  
106 - this.stationCode = stationCode;  
107 - }  
108 -  
109 - public String getStationName() {  
110 - return stationName;  
111 - }  
112 -  
113 - public void setStationName(String stationName) {  
114 - this.stationName = stationName;  
115 - }  
116 -  
117 - public String getLineCode() {  
118 - return lineCode;  
119 - }  
120 -  
121 - public void setLineCode(String lineCode) {  
122 - this.lineCode = lineCode;  
123 - }  
124 -  
125 - public String getStationMark() {  
126 - return stationMark;  
127 - }  
128 -  
129 - public void setStationMark(String stationMark) {  
130 - this.stationMark = stationMark;  
131 - }  
132 -  
133 - public Integer getOutStationNmber() {  
134 - return outStationNmber;  
135 - }  
136 -  
137 - public void setOutStationNmber(Integer outStationNmber) {  
138 - this.outStationNmber = outStationNmber;  
139 - }  
140 -  
141 - public Double getDistances() {  
142 - return distances;  
143 - }  
144 -  
145 - public void setDistances(Double distances) {  
146 - this.distances = distances;  
147 - }  
148 -  
149 - public Double getToTime() {  
150 - return toTime;  
151 - }  
152 -  
153 - public void setToTime(Double toTime) {  
154 - this.toTime = toTime;  
155 - }  
156 -  
157 - public String getFirstTime() {  
158 - return firstTime;  
159 - }  
160 -  
161 - public void setFirstTime(String firstTime) {  
162 - this.firstTime = firstTime;  
163 - }  
164 -  
165 - public String getEndTime() {  
166 - return endTime;  
167 - }  
168 -  
169 - public void setEndTime(String endTime) {  
170 - this.endTime = endTime;  
171 - }  
172 -  
173 - public Integer getDirections() {  
174 - return directions;  
175 - }  
176 -  
177 - public void setDirections(Integer directions) {  
178 - this.directions = directions;  
179 - }  
180 -  
181 - public Integer getVersions() {  
182 - return versions;  
183 - }  
184 -  
185 - public void setVersions(Integer versions) {  
186 - this.versions = versions;  
187 - }  
188 -  
189 - public Integer getDestroy() {  
190 - return destroy;  
191 - }  
192 -  
193 - public void setDestroy(Integer destroy) {  
194 - this.destroy = destroy;  
195 - }  
196 -  
197 - public String getDescriptions() {  
198 - return descriptions;  
199 - }  
200 -  
201 - public void setDescriptions(String descriptions) {  
202 - this.descriptions = descriptions;  
203 - }  
204 -  
205 - public Integer getCreateBy() {  
206 - return createBy;  
207 - }  
208 -  
209 - public void setCreateBy(Integer createBy) {  
210 - this.createBy = createBy;  
211 - }  
212 -  
213 - public Integer getUpdateBy() {  
214 - return updateBy;  
215 - }  
216 -  
217 - public void setUpdateBy(Integer updateBy) {  
218 - this.updateBy = updateBy;  
219 - }  
220 -  
221 - public Date getCreateDate() {  
222 - return createDate;  
223 - }  
224 -  
225 - public void setCreateDate(Date createDate) {  
226 - this.createDate = createDate;  
227 - }  
228 -  
229 - public Date getUpdateDate() {  
230 - return updateDate;  
231 - }  
232 -  
233 - public void setUpdateDate(Date updateDate) {  
234 - this.updateDate = updateDate;  
235 - }  
236 -  
237 - public long getStation() {  
238 - return station;  
239 - }  
240 -  
241 - public void setStation(long station) {  
242 - this.station = station;  
243 - }  
244 -  
245 - public int getLine() {  
246 - return line;  
247 - }  
248 -  
249 - public void setLine(int line) {  
250 - this.line = line;  
251 - }  
252 -} 1 +package com.bsth.service.geo_data.impl.dto;
  2 +
  3 +import java.util.Date;
  4 +
  5 +/**
  6 + * 站点路由 jdbc 入库数据
  7 + * Created by panzhao on 2017/12/14.
  8 + */
  9 +public class SaveStationRouteDTO {
  10 +
  11 + //站点路由ID
  12 + private Integer id;
  13 +
  14 + // 站点路由序号
  15 + private Integer stationRouteCode;
  16 +
  17 + // 站点编码
  18 + private String stationCode;
  19 +
  20 + // 站点名称
  21 + private String stationName;
  22 +
  23 + // 线路编码
  24 + private String lineCode;
  25 +
  26 + /**
  27 + * 站点类型
  28 + *
  29 + * ------ B:起点站
  30 + *
  31 + * ------ Z:中途站
  32 + *
  33 + * ------ E:终点站
  34 + *
  35 + * ------ T:停车场
  36 + *
  37 + */
  38 + private String stationMark;
  39 +
  40 + // 站点路由出站序号
  41 + private Integer outStationNmber;
  42 +
  43 + // 站点路由到站距离
  44 + private Double distances;
  45 +
  46 + // 站点路由到站时间
  47 + private Double toTime;
  48 +
  49 + // 首班时间
  50 + private String firstTime;
  51 +
  52 + // 末班时间
  53 + private String endTime;
  54 +
  55 + // 站点路由方向
  56 + private Integer directions;
  57 +
  58 + // 版本号
  59 + private Integer versions;
  60 +
  61 + // 是否撤销
  62 + private Integer destroy;
  63 +
  64 + // 描述
  65 + private String descriptions;
  66 +
  67 + // 创建人
  68 + private Integer createBy;
  69 +
  70 + // 修改人
  71 + private Integer updateBy;
  72 +
  73 + // 创建日期
  74 + private Date createDate;
  75 +
  76 + // 修改日期
  77 + private Date updateDate;
  78 +
  79 + // 站点ID
  80 + private long station;
  81 +
  82 + // 线路ID
  83 + private int line;
  84 +
  85 + public Integer getId() {
  86 + return id;
  87 + }
  88 +
  89 + public void setId(Integer id) {
  90 + this.id = id;
  91 + }
  92 +
  93 + public Integer getStationRouteCode() {
  94 + return stationRouteCode;
  95 + }
  96 +
  97 + public void setStationRouteCode(Integer stationRouteCode) {
  98 + this.stationRouteCode = stationRouteCode;
  99 + }
  100 +
  101 + public String getStationCode() {
  102 + return stationCode;
  103 + }
  104 +
  105 + public void setStationCode(String stationCode) {
  106 + this.stationCode = stationCode;
  107 + }
  108 +
  109 + public String getStationName() {
  110 + return stationName;
  111 + }
  112 +
  113 + public void setStationName(String stationName) {
  114 + this.stationName = stationName;
  115 + }
  116 +
  117 + public String getLineCode() {
  118 + return lineCode;
  119 + }
  120 +
  121 + public void setLineCode(String lineCode) {
  122 + this.lineCode = lineCode;
  123 + }
  124 +
  125 + public String getStationMark() {
  126 + return stationMark;
  127 + }
  128 +
  129 + public void setStationMark(String stationMark) {
  130 + this.stationMark = stationMark;
  131 + }
  132 +
  133 + public Integer getOutStationNmber() {
  134 + return outStationNmber;
  135 + }
  136 +
  137 + public void setOutStationNmber(Integer outStationNmber) {
  138 + this.outStationNmber = outStationNmber;
  139 + }
  140 +
  141 + public Double getDistances() {
  142 + return distances;
  143 + }
  144 +
  145 + public void setDistances(Double distances) {
  146 + this.distances = distances;
  147 + }
  148 +
  149 + public Double getToTime() {
  150 + return toTime;
  151 + }
  152 +
  153 + public void setToTime(Double toTime) {
  154 + this.toTime = toTime;
  155 + }
  156 +
  157 + public String getFirstTime() {
  158 + return firstTime;
  159 + }
  160 +
  161 + public void setFirstTime(String firstTime) {
  162 + this.firstTime = firstTime;
  163 + }
  164 +
  165 + public String getEndTime() {
  166 + return endTime;
  167 + }
  168 +
  169 + public void setEndTime(String endTime) {
  170 + this.endTime = endTime;
  171 + }
  172 +
  173 + public Integer getDirections() {
  174 + return directions;
  175 + }
  176 +
  177 + public void setDirections(Integer directions) {
  178 + this.directions = directions;
  179 + }
  180 +
  181 + public Integer getVersions() {
  182 + return versions;
  183 + }
  184 +
  185 + public void setVersions(Integer versions) {
  186 + this.versions = versions;
  187 + }
  188 +
  189 + public Integer getDestroy() {
  190 + return destroy;
  191 + }
  192 +
  193 + public void setDestroy(Integer destroy) {
  194 + this.destroy = destroy;
  195 + }
  196 +
  197 + public String getDescriptions() {
  198 + return descriptions;
  199 + }
  200 +
  201 + public void setDescriptions(String descriptions) {
  202 + this.descriptions = descriptions;
  203 + }
  204 +
  205 + public Integer getCreateBy() {
  206 + return createBy;
  207 + }
  208 +
  209 + public void setCreateBy(Integer createBy) {
  210 + this.createBy = createBy;
  211 + }
  212 +
  213 + public Integer getUpdateBy() {
  214 + return updateBy;
  215 + }
  216 +
  217 + public void setUpdateBy(Integer updateBy) {
  218 + this.updateBy = updateBy;
  219 + }
  220 +
  221 + public Date getCreateDate() {
  222 + return createDate;
  223 + }
  224 +
  225 + public void setCreateDate(Date createDate) {
  226 + this.createDate = createDate;
  227 + }
  228 +
  229 + public Date getUpdateDate() {
  230 + return updateDate;
  231 + }
  232 +
  233 + public void setUpdateDate(Date updateDate) {
  234 + this.updateDate = updateDate;
  235 + }
  236 +
  237 + public long getStation() {
  238 + return station;
  239 + }
  240 +
  241 + public void setStation(long station) {
  242 + this.station = station;
  243 + }
  244 +
  245 + public int getLine() {
  246 + return line;
  247 + }
  248 +
  249 + public void setLine(int line) {
  250 + this.line = line;
  251 + }
  252 +}
src/main/resources/static/pages/base/geo_data_edit/css/mian.css
@@ -80,6 +80,10 @@ div#map_wrap{ @@ -80,6 +80,10 @@ div#map_wrap{
80 font-size: 14px; 80 font-size: 14px;
81 color: #0aae0a; 81 color: #0aae0a;
82 } 82 }
  83 +
  84 +a._version_text:hover{
  85 + color: #0aae0a;
  86 +}
83 ._version_dropdown_wrap li.uk-active>a{ 87 ._version_dropdown_wrap li.uk-active>a{
84 color: #0aae0a; 88 color: #0aae0a;
85 } 89 }
@@ -91,6 +95,13 @@ div#map_wrap{ @@ -91,6 +95,13 @@ div#map_wrap{
91 right: 18px; 95 right: 18px;
92 top: 10px; 96 top: 10px;
93 } 97 }
  98 +
  99 +.remove_line_version_icon{
  100 + position: absolute;
  101 + right: 46px;
  102 + top: 10px;
  103 +}
  104 +
94 .clock_enable_version{ 105 .clock_enable_version{
95 padding: 4px 0 0 15px; 106 padding: 4px 0 0 15px;
96 font-size: 13px; 107 font-size: 13px;
@@ -612,4 +623,8 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root { @@ -612,4 +623,8 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root {
612 623
613 #add_line_versions_modal form.uk-form-horizontal .uk-form-controls{ 624 #add_line_versions_modal form.uk-form-horizontal .uk-form-controls{
614 margin-left: 115px; 625 margin-left: 115px;
  626 +}
  627 +
  628 +.rt_show_version_txt{
  629 + display: none;
615 } 630 }
616 \ No newline at end of file 631 \ No newline at end of file
src/main/resources/static/pages/base/geo_data_edit/fragments/versions.html
1 <div> 1 <div>
  2 + <script id="geo_d_e_version_dropdown-temp" type="text/html">
  3 + {{if data[0]!=null}}
  4 + <li class="uk-nav-header">历史</li>
  5 + {{each data[0] as obj i}}
  6 + <li class="{{if obj.versions==cvs}}uk-active{{/if}}" data-version="{{obj.versions}}"><a>{{obj.name}}</a></li>
  7 + {{/each}}
  8 + <li class="uk-nav-divider"></li>
  9 + {{/if}}
  10 +
  11 + {{if data[1]!=null}}
  12 + <li class="uk-nav-header">启用的</li>
  13 + {{each data[1] as obj i}}
  14 + <li class="{{if obj.versions==cvs}}uk-active{{/if}}" data-version="{{obj.versions}}"><a>{{obj.name}}</a></li>
  15 + {{/each}}
  16 + {{/if}}
  17 +
  18 + {{if data[2]!=null}}
  19 + <li class="uk-nav-header">未来</li>
  20 + {{each data[2] as obj i}}
  21 + <li class="{{if obj.versions==cvs}}uk-active{{/if}}" data-version="{{obj.versions}}"><a>{{obj.name}}</a></li>
  22 + {{/each}}
  23 + {{/if}}
  24 + </script>
  25 +
2 <script id="geo_d_e_version_add-temp" type="text/html"> 26 <script id="geo_d_e_version_add-temp" type="text/html">
3 <div id="add_line_versions_modal" uk-modal esc-close="false" bg-close="false"> 27 <div id="add_line_versions_modal" uk-modal esc-close="false" bg-close="false">
4 <div class="uk-modal-dialog uk-modal-body"> 28 <div class="uk-modal-dialog uk-modal-body">
@@ -33,11 +57,11 @@ @@ -33,11 +57,11 @@
33 <div class="uk-margin"> 57 <div class="uk-margin">
34 <div class="uk-form-label">继承走向</div> 58 <div class="uk-form-label">继承走向</div>
35 <div class="uk-form-controls"> 59 <div class="uk-form-controls">
36 - <select class="uk-select" > 60 + <select class="uk-select" name="extendsVersion">
37 <option>不继承之前的走向</option> 61 <option>不继承之前的走向</option>
38 62
39 {{each array as obj i}} 63 {{each array as obj i}}
40 - <option data-id="{{obj.id}}" data-versions="{{obj.versions}}">{{obj.name}}</option> 64 + <option value="{{obj.versions}}" data-id="{{obj.id}}">{{obj.name}}</option>
41 {{/each}} 65 {{/each}}
42 </select> 66 </select>
43 </div> 67 </div>
src/main/resources/static/pages/base/geo_data_edit/js/map.js
@@ -2,6 +2,8 @@ @@ -2,6 +2,8 @@
2 2
3 var gb_ct_map = function () { 3 var gb_ct_map = function () {
4 4
  5 + var initFlag;
  6 +
5 //初始化地图 7 //初始化地图
6 if (!window.BMap) { 8 if (!window.BMap) {
7 alert('地图没有加载成功,请确认是否能正常连接外网!!'); 9 alert('地图没有加载成功,请确认是否能正常连接外网!!');
@@ -52,8 +54,11 @@ var gb_ct_map = function () { @@ -52,8 +54,11 @@ var gb_ct_map = function () {
52 changeUpDown(); 54 changeUpDown();
53 55
54 //居中至上行中间站点 56 //居中至上行中间站点
55 - var cm = stationMarkers[0][parseInt(stationMarkers[0].length / 2)];  
56 - map.setCenter(cm.point); 57 + if(!initFlag){
  58 + var cm = stationMarkers[0][parseInt(stationMarkers[0].length / 2)];
  59 + map.setCenter(cm.point);
  60 + initFlag=true;
  61 + }
57 62
58 cb && cb(); 63 cb && cb();
59 }; 64 };
@@ -843,6 +848,17 @@ var gb_ct_map = function () { @@ -843,6 +848,17 @@ var gb_ct_map = function () {
843 showAddRoadPanel: showAddRoadPanel, 848 showAddRoadPanel: showAddRoadPanel,
844 map: map, 849 map: map,
845 focus: focusPoint, 850 focus: focusPoint,
846 - clearfocus: clearfocus 851 + clearfocus: clearfocus,
  852 + clearAll: function () {
  853 + map_status = 0;
  854 + roadPolylines = [];
  855 + stationMarkers = [];
  856 + editCircle = null;
  857 + editPolygon = null;
  858 + dragMarker = null;
  859 +
  860 + map.clearOverlays();
  861 +
  862 + }
847 }; 863 };
848 }(); 864 }();
849 \ No newline at end of file 865 \ No newline at end of file
src/main/resources/static/pages/base/geo_data_edit/js/road_route.js
@@ -24,7 +24,8 @@ var gb_road_route = function () { @@ -24,7 +24,8 @@ var gb_road_route = function () {
24 }); 24 });
25 25
26 //加载数据 26 //加载数据
27 - gb_common.$get('/_geo_data/findGeoRoad', {lineCode: lineCode}, function (rs) { 27 + var version = storage.getItem("geo_data_edit_line_version");
  28 + gb_common.$get('/_geo_data/findGeoRoad', {lineCode: lineCode,version:version}, function (rs) {
28 rs.list.sort(function (a, b) { 29 rs.list.sort(function (a, b) {
29 return parseInt(a.sectionrouteCode) - parseInt(b.sectionrouteCode); 30 return parseInt(a.sectionrouteCode) - parseInt(b.sectionrouteCode);
30 }); 31 });
src/main/resources/static/pages/base/geo_data_edit/js/search.js
@@ -27,7 +27,8 @@ var gb_ct_search = function () { @@ -27,7 +27,8 @@ var gb_ct_search = function () {
27 }); 27 });
28 28
29 var searchComplete = function (e) { 29 var searchComplete = function (e) {
30 - var htmlStr = template('geo_d_e_search_result-temp', {list: e.wr}); 30 + //console.log('e.wr', e);
  31 + var htmlStr = template('geo_d_e_search_result-temp', {list: e.yr});
31 $('.ct_search_result').html(htmlStr); 32 $('.ct_search_result').html(htmlStr);
32 33
33 }; 34 };
src/main/resources/static/pages/base/geo_data_edit/js/station_route.js
@@ -10,7 +10,7 @@ var gb_station_route = function () { @@ -10,7 +10,7 @@ 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 - //当前使用的线路版本 13 + //当前编辑的线路版本
14 storage.setItem("geo_data_edit_line_version" , data[0][0].versions); 14 storage.setItem("geo_data_edit_line_version" , data[0][0].versions);
15 //渲染页面 15 //渲染页面
16 var upHtmlStr = temps['geo_d_e_station_route-temp']({list: station_maps[0]}); 16 var upHtmlStr = temps['geo_d_e_station_route-temp']({list: station_maps[0]});
@@ -21,11 +21,15 @@ var gb_station_route = function () { @@ -21,11 +21,15 @@ var gb_station_route = function () {
21 cb && cb(); 21 cb && cb();
22 }); 22 });
23 23
  24 + var version = storage.getItem("geo_data_edit_line_version");
24 //加载数据 25 //加载数据
25 - gb_common.$get('/_geo_data/findGeoStations', {lineCode: lineCode}, function (rs) { 26 + gb_common.$get('/_geo_data/findGeoStations', {lineCode: lineCode, version: version}, function (rs) {
26 rs.list.sort(function (a, b) { 27 rs.list.sort(function (a, b) {
27 return parseInt(a.stationRouteCode) - parseInt(b.stationRouteCode); 28 return parseInt(a.stationRouteCode) - parseInt(b.stationRouteCode);
28 }); 29 });
  30 +
  31 + //线路当前启用的线路版本
  32 + storage.setItem("geo_data_enable_version" , rs['currentVersion']);
29 ep.emit('data', gb_common.groupBy(rs.list, 'directions')); 33 ep.emit('data', gb_common.groupBy(rs.list, 'directions'));
30 }); 34 });
31 35
@@ -289,7 +293,7 @@ var gb_station_route = function () { @@ -289,7 +293,7 @@ var gb_station_route = function () {
289 }); 293 });
290 294
291 //缓冲区编辑 切换绘制模式 295 //缓冲区编辑 切换绘制模式
292 - $('.draw_polygon_switch', $editWrap).on('input', function (e) { 296 + $('.draw_polygon_switch', $editWrap).on('click', function (e) {
293 var type = $(this).data('type'); 297 var type = $(this).data('type');
294 if(type==1){ 298 if(type==1){
295 //退出绘制状态 299 //退出绘制状态
src/main/resources/static/pages/base/geo_data_edit/js/submit.js
@@ -155,6 +155,25 @@ var gb_data_submit = function () { @@ -155,6 +155,25 @@ var gb_data_submit = function () {
155 }); 155 });
156 }); 156 });
157 157
  158 + /**
  159 + *
  160 + * 添加线路版本 add_line_versions_modal
  161 + */
  162 + $(document).on('click', '#add_line_versions_modal ._submit', function (e) {
  163 + var f = $('form', '#add_line_versions_modal');
  164 + var data = f.serializeJSON();
  165 + data.lineCode = storage.getItem('geo_data_edit_line_code');
  166 +
  167 + UIkit.modal.confirm('确定线路版本【'+data.name+'】?').then(function() {
  168 + $loadPanel.show();
  169 + gb_common.$post('/_geo_data/addNewLineVersion', data, function (rs) {
  170 + storage.setItem("geo_data_edit_line_version", rs['newVersion']);
  171 + clearAll();
  172 + startup();
  173 + });
  174 + });
  175 + });
  176 +
158 var show_run_text = function (t) { 177 var show_run_text = function (t) {
159 $('.text', $loadPanel).text(t); 178 $('.text', $loadPanel).text(t);
160 $loadPanel.show(); 179 $loadPanel.show();
src/main/resources/static/pages/base/geo_data_edit/js/version_manage.js
@@ -7,8 +7,25 @@ var gb_version_manage = function () { @@ -7,8 +7,25 @@ var gb_version_manage = function () {
7 var current; 7 var current;
8 8
9 var temps; 9 var temps;
10 - var init = function (cVersion) { 10 + var init = function (enableVersion) {
11 var lineCode = storage.getItem("geo_data_edit_line_code"); 11 var lineCode = storage.getItem("geo_data_edit_line_code");
  12 +
  13 + var ep = EventProxy.create("data", "temp", function () {
  14 + if(!current){
  15 + alert('异常,无法选中当前线路版本!');
  16 + }
  17 +
  18 + //线路名称
  19 + $('.main_left_panel>._line_info>._line_name>span').text(lineName);
  20 + //当前版本
  21 + $('.main_left_panel ._version_dropdown_wrap>._version_text').html(current.name + '<i uk-icon="icon: chevron-down;ratio:.6"></i>');
  22 +
  23 + //按status 分组
  24 + var data = gb_common.groupBy(array, 'status');
  25 + var htmlStr = temps['geo_d_e_version_dropdown-temp']({data: data, cvs: storage.getItem('geo_data_edit_line_version')});
  26 + $('._version_dropdown_wrap ul.all_version_list').html(htmlStr);
  27 + });
  28 +
12 //获取线路版本信息 29 //获取线路版本信息
13 gb_common.$get('/_geo_data/findVersionInfo', {lineCode: lineCode}, function (rs) { 30 gb_common.$get('/_geo_data/findVersionInfo', {lineCode: lineCode}, function (rs) {
14 array = rs.list; 31 array = rs.list;
@@ -16,34 +33,48 @@ var gb_version_manage = function () { @@ -16,34 +33,48 @@ var gb_version_manage = function () {
16 33
17 //当前使用版本 34 //当前使用版本
18 for(var i=0,obj;obj=array[i++];){ 35 for(var i=0,obj;obj=array[i++];){
19 - if(obj.versions==cVersion){ 36 + if(obj.versions==enableVersion){
20 current = obj; 37 current = obj;
21 break; 38 break;
22 } 39 }
23 } 40 }
24 -  
25 - if(!current){  
26 - alert('异常,无法选中当前线路版本!');  
27 - }  
28 -  
29 - //线路名称  
30 - $('.main_left_panel>._line_info>._line_name>span').text(lineName);  
31 - //当前版本  
32 - $('.main_left_panel ._version_dropdown_wrap>._version_text').html(current.name + '<i uk-icon="icon: chevron-down;ratio:.6"></i>'); 41 + ep.emit('data', array);
33 }); 42 });
34 43
35 $.get('/pages/base/geo_data_edit/fragments/versions.html', function (dom) { 44 $.get('/pages/base/geo_data_edit/fragments/versions.html', function (dom) {
36 temps = gb_common.compileTempByDom(dom, { 45 temps = gb_common.compileTempByDom(dom, {
37 compress: true 46 compress: true
38 }); 47 });
  48 + ep.emit('temp');
39 }); 49 });
40 }; 50 };
41 51
  52 + var findOne = function (no) {
  53 + for(var i=0,obj;obj=array[i++];){
  54 + if(obj.versions == no)
  55 + return obj;
  56 + }
  57 +
  58 + return null;
  59 + };
  60 +
  61 + /**
  62 + * 版本切换
  63 + */
  64 + $('._version_dropdown_wrap ul.all_version_list').on('click', 'li[data-version]', function () {
  65 + var version = $(this).data('version');
  66 + //var name = $(this).text();
  67 +
  68 + storage.setItem("geo_data_edit_line_version" , version);
  69 + $loadPanel.show();
  70 + clearAll();
  71 + startup();
  72 + });
  73 +
42 /** 74 /**
43 * 新增 75 * 新增
44 */ 76 */
45 $('.add_line_version_icon').on('click', function () { 77 $('.add_line_version_icon').on('click', function () {
46 - console.log('arrayarray', array);  
47 var htmlStr = temps['geo_d_e_version_add-temp']({array: array}); 78 var htmlStr = temps['geo_d_e_version_add-temp']({array: array});
48 79
49 $(document.body).append(htmlStr); 80 $(document.body).append(htmlStr);
@@ -63,6 +94,24 @@ var gb_version_manage = function () { @@ -63,6 +94,24 @@ var gb_version_manage = function () {
63 $('[name=startDate]', modal).on('input', reSetName); 94 $('[name=startDate]', modal).on('input', reSetName);
64 }); 95 });
65 96
  97 + /**
  98 + * 删除
  99 + */
  100 + $('.remove_line_version_icon').on('click', function () {
  101 + var version = storage.getItem('geo_data_edit_line_version');
  102 + var obj = findOne(version);
  103 +
  104 + var txt = '<span style="color:#ff4444;">你确定要删除 【'+obj.lineName+'】【'+obj.name+'】走向版本?</span>';
  105 + UIkit.modal.confirm(txt).then(function() {
  106 + $loadPanel.show();
  107 + gb_common.$post('/_geo_data/deleteLineVersion', {lineCode: obj.lineCode, version: obj.versions}, function (rs) {
  108 + storage.removeItem("geo_data_edit_line_version");
  109 + clearAll();
  110 + startup();
  111 + });
  112 + });
  113 + });
  114 +
66 $(document).on('hidden', '.uk-modal', function () { 115 $(document).on('hidden', '.uk-modal', function () {
67 $(this).remove(); 116 $(this).remove();
68 $('.flatpickr-calendar').remove(); 117 $('.flatpickr-calendar').remove();
src/main/resources/static/pages/base/geo_data_edit/main.html
@@ -26,19 +26,14 @@ @@ -26,19 +26,14 @@
26 <div class="_line_info"> 26 <div class="_line_info">
27 <div class="_line_name"> 27 <div class="_line_name">
28 <span></span> 28 <span></span>
29 - <a uk-icon="icon: plus" class="add_line_version_icon" title="新增一个线路走向版本" uk-tooltip></a> 29 +
  30 + <a uk-icon="icon: trash" class="remove_line_version_icon" title="删除线路版本" uk-tooltip></a>
  31 + <a uk-icon="icon: plus" class="add_line_version_icon" title="新增一个线路版本" uk-tooltip></a>
30 </div> 32 </div>
31 <div class="_version_dropdown_wrap"> 33 <div class="_version_dropdown_wrap">
32 <a class="_version_text"></a> 34 <a class="_version_text"></a>
33 <div uk-dropdown> 35 <div uk-dropdown>
34 - <ul class="uk-nav uk-dropdown-nav">  
35 - <li class="uk-nav-header">历史</li>  
36 - <li><a>原始版本</a></li>  
37 - <li class="uk-nav-divider"></li>  
38 - <li class="uk-nav-header">启用</li>  
39 - <li class="uk-active"><a>20171206线路改道</a></li>  
40 - <li class="uk-nav-header">未来</li>  
41 - <li><a>20180206线路改道</a></li> 36 + <ul class="uk-nav uk-dropdown-nav all_version_list">
42 </ul> 37 </ul>
43 </div> 38 </div>
44 </div> 39 </div>
@@ -52,9 +47,7 @@ @@ -52,9 +47,7 @@
52 <li><a>上行</a></li> 47 <li><a>上行</a></li>
53 <li><a>下行</a></li> 48 <li><a>下行</a></li>
54 49
55 - <span class="rt_show_version_txt uk-badge uk-disabled">  
56 - 20180206线路改道  
57 - </span> 50 + <!--<span class="rt_show_version_txt uk-badge uk-disabled uk-animation-slide-top-small"></span>-->
58 </ul> 51 </ul>
59 52
60 <ul class="uk-switcher uk-margin up_down_route_list"> 53 <ul class="uk-switcher uk-margin up_down_route_list">
@@ -139,34 +132,43 @@ @@ -139,34 +132,43 @@
139 window.parent.$('#geo_edit_wrap_iframe').addClass('full_screen'); 132 window.parent.$('#geo_edit_wrap_iframe').addClass('full_screen');
140 }); 133 });
141 134
142 - var gb_main_ep = new EventProxy(); 135 + var gb_main_ep;
143 //文件加载 136 //文件加载
144 var res_load_ep = EventProxy.create('load_common_data', 'load_station_route','load_road_route' 137 var res_load_ep = EventProxy.create('load_common_data', 'load_station_route','load_road_route'
145 , 'load_version_manage', 'load_history_edit_logs', 'load_map', function () { 138 , 'load_version_manage', 'load_history_edit_logs', 'load_map', function () {
146 -  
147 - //UIkit.notification('加载完成!!');  
148 - var eq = gb_main_ep;  
149 -  
150 - //站点  
151 - gb_station_route.init(g_emit('init_road'));  
152 - //路段  
153 - eq.once('init_road', function () {  
154 - gb_road_route.init(g_emit('init_map'))  
155 - });  
156 - //地图  
157 - eq.once('init_map', function () {  
158 - gb_ct_map._render(g_emit('end'));  
159 - });  
160 -  
161 - eq.once('end', function () {  
162 - //线路版本信息  
163 - gb_version_manage.init(gb_station_route.getData()[0][0].versions);  
164 -  
165 - $loadPanel.hide();  
166 - gb_ct_search.init();  
167 - }); 139 + startup();
168 }); 140 });
169 141
  142 + var startup = function () {
  143 + gb_main_ep = new EventProxy();
  144 + var eq = gb_main_ep;
  145 +
  146 + //站点
  147 + gb_station_route.init(g_emit('init_road'));
  148 + //路段
  149 + eq.once('init_road', function () {
  150 + gb_road_route.init(g_emit('init_map'))
  151 + });
  152 + //地图
  153 + eq.once('init_map', function () {
  154 + gb_ct_map._render(g_emit('end'));
  155 + });
  156 +
  157 + eq.once('end', function () {
  158 + //线路版本信息
  159 + gb_version_manage.init(storage.getItem("geo_data_edit_line_version"));
  160 +
  161 + $loadPanel.hide();
  162 + gb_ct_search.init();
  163 + });
  164 + };
  165 +
  166 + var clearAll = function () {
  167 + $('.up_down_route_list .station_route').empty();
  168 + $('.up_down_route_list .road_route').empty();
  169 + gb_ct_map.clearAll();
  170 + };
  171 +
170 function g_emit(id) { 172 function g_emit(id) {
171 console.log('g_emit [' + id + ']'); 173 console.log('g_emit [' + id + ']');
172 return function () { 174 return function () {